wj-elements 0.7.6 → 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 +9053 -9048
- 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/packages/wje-img/img.element.d.ts +4 -4
- 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 +698 -698
- 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 -668
- 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 -197
- 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 +4 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-reorder-item.js","sources":["../packages/wje-reorder-item/reorder-item.element.js","../packages/wje-reorder-item/reorder-item.js"],"sourcesContent":["import { default as WJElement, WjElementUtils } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `ReorderItem` is a custom web component that represents a reorder item.\n * @summary This element represents a reorder item.\n * @documentation https://elements.webjet.sk/components/reorder-item\n * @status stable\n * @augments WJElement\n * @csspart native-reorder-item - The native part of the reorder item.\n * @csspart handle-part - The handle part of the reorder item when the handle slot is present.\n * @slot - The default slot for the reorder item.\n * @tag wje-reorder-item\n */\nexport default class ReorderItem extends WJElement {\n /**\n * Creates an instance of ReorderItem.\n */\n constructor() {\n super();\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'ReorderItem';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @returns {CSSStyleSheet} The CSS stylesheet.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Returns the list of observed attributes.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let wrapper = document.createElement('div');\n wrapper.classList.add('item');\n wrapper.setAttribute('part', 'native-reorder-item');\n\n let element = document.createElement('slot');\n element.classList.add('name');\n\n if (WjElementUtils.hasSlot(this, 'handle')) {\n const handle = document.createElement('slot');\n handle.classList.add('handle');\n handle.setAttribute('name', 'handle');\n handle.setAttribute('part', 'handle-part');\n\n wrapper.classList.add('item-w-handle');\n wrapper.appendChild(handle);\n } else {\n element.setAttribute('draggable', 'true');\n }\n\n wrapper.appendChild(element);\n\n fragment.appendChild(wrapper);\n\n return fragment;\n }\n}\n","import ReorderItem from './reorder-item.element.js';\n\nexport default ReorderItem;\n\nReorderItem.define('wje-reorder-item', ReorderItem);\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wje-reorder-item.js","sources":["../packages/wje-reorder-item/reorder-item.element.js","../packages/wje-reorder-item/reorder-item.js"],"sourcesContent":["import { default as WJElement, WjElementUtils } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `ReorderItem` is a custom web component that represents a reorder item.\n * @summary This element represents a reorder item.\n * @documentation https://elements.webjet.sk/components/reorder-item\n * @status stable\n * @augments WJElement\n * @csspart native-reorder-item - The native part of the reorder item.\n * @csspart handle-part - The handle part of the reorder item when the handle slot is present.\n * @slot - The default slot for the reorder item.\n * @tag wje-reorder-item\n */\nexport default class ReorderItem extends WJElement {\n /**\n * Creates an instance of ReorderItem.\n */\n constructor() {\n super();\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'ReorderItem';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @returns {CSSStyleSheet} The CSS stylesheet.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Returns the list of observed attributes.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let wrapper = document.createElement('div');\n wrapper.classList.add('item');\n wrapper.setAttribute('part', 'native-reorder-item');\n\n let element = document.createElement('slot');\n element.classList.add('name');\n\n if (WjElementUtils.hasSlot(this, 'handle')) {\n const handle = document.createElement('slot');\n handle.classList.add('handle');\n handle.setAttribute('name', 'handle');\n handle.setAttribute('part', 'handle-part');\n\n wrapper.classList.add('item-w-handle');\n wrapper.appendChild(handle);\n } else {\n element.setAttribute('draggable', 'true');\n }\n\n wrapper.appendChild(element);\n\n fragment.appendChild(wrapper);\n\n return fragment;\n }\n}\n","import ReorderItem from './reorder-item.element.js';\n\nexport default ReorderItem;\n\nReorderItem.define('wje-reorder-item', ReorderItem);\n"],"names":["ReorderItem","WJElement","super","className","setupAttributes","this","isShadowRoot","draw","fragment","document","createDocumentFragment","wrapper","createElement","classList","add","setAttribute","element","WjElementUtils","hasSlot","handle","appendChild","define"],"mappings":";;;;;AAce,MAAMA,UAAoBC,EAAAA;AAAAA,EAIrC;AACIC,UAAAA;AAOJC,qCAAY;AAAA,EANZ;AAAA,EAYA,WAAA;AACI;EACJ;AAAA,EAKA,kBAAAC;AACIC,SAAKC,eAAe;AAAA,EACxB;AAAA,EAMA,OAAAC;AACI,QAAIC,KAAWC,SAASC,uBAAAA,GAEpBC,KAAUF,SAASG,cAAc;AACrCD,IAAAA,GAAQE,UAAUC,IAAI,MAAA,GACtBH,GAAQI,aAAa,QAAQ,qBAAA;AAE7B,QAAIC,IAAUP,SAASG,cAAc,MAAA;AAGrC,QAFAI,EAAQH,UAAUC,IAAI,MAAA,GAElBG,EAAeC,QAAQb,MAAM,WAAW;AACxC,YAAMc,KAASV,SAASG,cAAc;AACtCO,MAAAA,GAAON,UAAUC,IAAI,QAAA,GACrBK,GAAOJ,aAAa,QAAQ,QAAA,GAC5BI,GAAOJ,aAAa,QAAQ,aAAA,GAE5BJ,GAAQE,UAAUC,IAAI,kBACtBH,GAAQS,YAAYD;IACxB,MACIH,GAAQD,aAAa,aAAa,MAAA;AAOtC,WAJAJ,GAAQS,YAAYJ,CAAAA,GAEpBR,GAASY,YAAYT,EAAAA,GAEdH;AAAAA,EACX;AAAA;ACtEJR,EAAYqB,OAAO,oBAAoBrB,CAAAA;"}
|
package/dist/wje-reorder.js
CHANGED
|
@@ -1,292 +1,107 @@
|
|
|
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
|
|
5
|
-
|
|
6
|
-
class Reorder extends WJElement {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of Select.
|
|
9
|
-
* @class
|
|
10
|
-
*/
|
|
4
|
+
import e from "./wje-element.js";
|
|
5
|
+
class t extends e {
|
|
11
6
|
constructor() {
|
|
12
7
|
super();
|
|
13
|
-
/**
|
|
14
|
-
* The class name for the component.
|
|
15
|
-
* @type {string}
|
|
16
|
-
*/
|
|
17
8
|
__publicField(this, "className", "Select");
|
|
18
|
-
this.dragEl = null;
|
|
19
|
-
this.items = [];
|
|
20
|
-
this.originalIndex = null;
|
|
21
|
-
this.isDragging = false;
|
|
22
|
-
this.offsetX = 0;
|
|
23
|
-
this.offsetY = 0;
|
|
24
|
-
this.cloneEl = null;
|
|
9
|
+
this.dragEl = null, this.items = [], this.originalIndex = null, this.isDragging = false, this.offsetX = 0, this.offsetY = 0, this.cloneEl = null;
|
|
25
10
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Returns the CSS styles for the component.
|
|
28
|
-
* @static
|
|
29
|
-
* @returns {CSSStyleSheet}
|
|
30
|
-
*/
|
|
31
11
|
static get cssStyleSheet() {
|
|
32
|
-
return
|
|
12
|
+
return ".container{position:relative;display:flex;align-items:center;justify-content:center;margin:auto;flex-direction:var(--flex-direction)}.container-w-dropzones{position:relative;display:flex;align-items:center;justify-content:center;flex-direction:row}.reversed{--flex-direction: column-reverse}.basic{--flex-direction: column}.dragging{position:absolute;pointer-events:none;z-index:1000}.reorder-item{transition:top .3s ease,left .3s ease}";
|
|
33
13
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Returns the list of attributes to observe for changes.
|
|
36
|
-
* @static
|
|
37
|
-
* @returns {Array<string>}
|
|
38
|
-
*/
|
|
39
14
|
static get observedAttributes() {
|
|
40
15
|
return [];
|
|
41
16
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Sets up the attributes for the component.
|
|
44
|
-
*/
|
|
45
17
|
setupAttributes() {
|
|
46
|
-
this.isShadowRoot = "open";
|
|
47
|
-
this.syncAria();
|
|
18
|
+
this.isShadowRoot = "open", this.syncAria();
|
|
48
19
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Draws the component after it is connected to the DOM.
|
|
51
|
-
* @returns {DocumentFragment}
|
|
52
|
-
*/
|
|
53
20
|
draw() {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const slot = document.createElement("slot");
|
|
59
|
-
slot.classList.add("reorder-items");
|
|
60
|
-
container.appendChild(slot);
|
|
61
|
-
fragment.appendChild(container);
|
|
62
|
-
this.container = container;
|
|
63
|
-
return fragment;
|
|
21
|
+
const e2 = document.createDocumentFragment(), t2 = document.createElement("div");
|
|
22
|
+
t2.classList.add("container"), t2.setAttribute("part", "native");
|
|
23
|
+
const i = document.createElement("slot");
|
|
24
|
+
return i.classList.add("reorder-items"), t2.appendChild(i), e2.appendChild(t2), this.container = t2, e2;
|
|
64
25
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Adds event listeners after the component is drawn.
|
|
67
|
-
*/
|
|
68
26
|
afterDraw() {
|
|
69
27
|
this.syncAria();
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this.
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
if (items) {
|
|
80
|
-
items.forEach((item) => {
|
|
81
|
-
const handles = item.querySelectorAll("[slot=handle]");
|
|
82
|
-
const draggableElement = handles.length > 0 ? handles : [item];
|
|
83
|
-
draggableElement.forEach((element) => {
|
|
84
|
-
this.attachEventListeners(element);
|
|
85
|
-
});
|
|
28
|
+
const e2 = this.querySelectorAll("wje-reorder-item"), t2 = this.querySelectorAll("wje-reorder-dropzone");
|
|
29
|
+
this.container.classList.add(this.hasAttribute("reverse") ? "reversed" : "basic"), t2 && t2.forEach((e3) => {
|
|
30
|
+
this.container.classList.remove("container"), this.container.classList.add("container-w-dropzones");
|
|
31
|
+
}), e2 && e2.forEach((e3) => {
|
|
32
|
+
const t3 = e3.querySelectorAll("[slot=handle]");
|
|
33
|
+
(t3.length > 0 ? t3 : [e3]).forEach((e4) => {
|
|
34
|
+
this.attachEventListeners(e4);
|
|
86
35
|
});
|
|
87
|
-
}
|
|
36
|
+
});
|
|
88
37
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Sync ARIA attributes on host.
|
|
91
|
-
*/
|
|
92
38
|
syncAria() {
|
|
93
|
-
|
|
94
|
-
this.setAriaState({ role: "list" });
|
|
95
|
-
}
|
|
39
|
+
this.hasAttribute("role") || this.setAriaState({ role: "list" });
|
|
96
40
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
* @param element
|
|
100
|
-
*/
|
|
101
|
-
attachEventListeners(element) {
|
|
102
|
-
element.addEventListener("mousedown", this.mouseDown.bind(this), false);
|
|
103
|
-
element.addEventListener("touchstart", this.touchStart.bind(this), false);
|
|
104
|
-
element.addEventListener("dragstart", this.dragStart.bind(this), false);
|
|
41
|
+
attachEventListeners(e2) {
|
|
42
|
+
e2.addEventListener("mousedown", this.mouseDown.bind(this), false), e2.addEventListener("touchstart", this.touchStart.bind(this), false), e2.addEventListener("dragstart", this.dragStart.bind(this), false);
|
|
105
43
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
* @param {object} e
|
|
109
|
-
*/
|
|
110
|
-
mouseDown(e) {
|
|
111
|
-
this.startDragging(e.clientX, e.clientY, e.currentTarget);
|
|
112
|
-
document.addEventListener("mousemove", this.mouseMove.bind(this), false);
|
|
113
|
-
document.addEventListener("mouseup", this.mouseUp.bind(this), false);
|
|
114
|
-
document.body.style.userSelect = "none";
|
|
44
|
+
mouseDown(e2) {
|
|
45
|
+
this.startDragging(e2.clientX, e2.clientY, e2.currentTarget), document.addEventListener("mousemove", this.mouseMove.bind(this), false), document.addEventListener("mouseup", this.mouseUp.bind(this), false), document.body.style.userSelect = "none";
|
|
115
46
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
*/
|
|
120
|
-
touchStart(e) {
|
|
121
|
-
const touch = e.touches[0];
|
|
122
|
-
this.startDragging(touch.clientX, touch.clientY, e.currentTarget);
|
|
123
|
-
document.addEventListener("touchmove", this.touchMove.bind(this), false);
|
|
124
|
-
document.addEventListener("touchend", this.touchEnd.bind(this), false);
|
|
125
|
-
document.body.style.userSelect = "none";
|
|
47
|
+
touchStart(e2) {
|
|
48
|
+
const t2 = e2.touches[0];
|
|
49
|
+
this.startDragging(t2.clientX, t2.clientY, e2.currentTarget), document.addEventListener("touchmove", this.touchMove.bind(this), false), document.addEventListener("touchend", this.touchEnd.bind(this), false), document.body.style.userSelect = "none";
|
|
126
50
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*/
|
|
133
|
-
startDragging(clientX, clientY, target) {
|
|
134
|
-
if (this.hasAttribute("disabled")) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
this.isDragging = true;
|
|
138
|
-
this.dragEl = target.closest("wje-reorder-item");
|
|
139
|
-
this.createClone();
|
|
140
|
-
this.dragEl.style.opacity = "0.3";
|
|
141
|
-
const rect = this.dragEl.getBoundingClientRect();
|
|
142
|
-
this.offsetX = clientX - rect.left;
|
|
143
|
-
this.offsetY = clientY - rect.top;
|
|
144
|
-
this.dragEl.classList.add("dragging");
|
|
145
|
-
this.originalIndex = [...this.dragEl.parentNode.children].indexOf(this.dragEl);
|
|
146
|
-
this.originalParent = this.dragEl.parentNode;
|
|
51
|
+
startDragging(e2, t2, i) {
|
|
52
|
+
if (this.hasAttribute("disabled")) return;
|
|
53
|
+
this.isDragging = true, this.dragEl = i.closest("wje-reorder-item"), this.createClone(), this.dragEl.style.opacity = "0.3";
|
|
54
|
+
const s = this.dragEl.getBoundingClientRect();
|
|
55
|
+
this.offsetX = e2 - s.left, this.offsetY = t2 - s.top, this.dragEl.classList.add("dragging"), this.originalIndex = [...this.dragEl.parentNode.children].indexOf(this.dragEl), this.originalParent = this.dragEl.parentNode;
|
|
147
56
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
* @param e
|
|
151
|
-
*/
|
|
152
|
-
mouseMove(e) {
|
|
153
|
-
if (!this.isDragging) return;
|
|
154
|
-
this.moveElement(e.pageX, e.pageY);
|
|
155
|
-
if (this.cloneEl) {
|
|
156
|
-
this.cloneEl.style.left = `${e.pageX - this.offsetX}px`;
|
|
157
|
-
this.cloneEl.style.top = `${e.pageY - this.offsetY}px`;
|
|
158
|
-
}
|
|
57
|
+
mouseMove(e2) {
|
|
58
|
+
this.isDragging && (this.moveElement(e2.pageX, e2.pageY), this.cloneEl && (this.cloneEl.style.left = e2.pageX - this.offsetX + "px", this.cloneEl.style.top = e2.pageY - this.offsetY + "px"));
|
|
159
59
|
}
|
|
160
|
-
|
|
161
|
-
* Handles the `touchmove` event and updates the position of the dragged element.
|
|
162
|
-
* @param {TouchEvent} e The touch event containing touch position data.
|
|
163
|
-
*/
|
|
164
|
-
touchMove(e) {
|
|
60
|
+
touchMove(e2) {
|
|
165
61
|
if (!this.isDragging) return;
|
|
166
|
-
const
|
|
167
|
-
this.moveElement(
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const scrollY = window.scrollY || document.documentElement.scrollTop;
|
|
177
|
-
const adjustedPageX = pageX - scrollX;
|
|
178
|
-
const adjustedPageY = pageY - scrollY;
|
|
179
|
-
this.dragEl.style.left = `${adjustedPageX}px`;
|
|
180
|
-
this.dragEl.style.top = `${adjustedPageY}px`;
|
|
181
|
-
if (this.cloneEl) {
|
|
182
|
-
this.cloneEl.style.left = `${adjustedPageX}px`;
|
|
183
|
-
this.cloneEl.style.top = `${adjustedPageY}px`;
|
|
184
|
-
}
|
|
185
|
-
const items = this.querySelectorAll("wje-reorder-item");
|
|
186
|
-
items.forEach((item) => {
|
|
187
|
-
if (item === this.dragEl) return;
|
|
188
|
-
const boundingBox = item.getBoundingClientRect();
|
|
189
|
-
const mouseY = adjustedPageY - boundingBox.top;
|
|
190
|
-
const mouseYPercent = mouseY / boundingBox.height * 100;
|
|
191
|
-
if (mouseYPercent > 30 && this.isMovingDown(item)) {
|
|
192
|
-
item.parentNode.insertBefore(this.dragEl, item.nextSibling);
|
|
193
|
-
} else if (mouseYPercent < 30 && !this.isMovingDown(item)) {
|
|
194
|
-
item.parentNode.insertBefore(this.dragEl, item);
|
|
195
|
-
}
|
|
62
|
+
const t2 = e2.touches[0];
|
|
63
|
+
this.moveElement(t2.pageX, t2.pageY);
|
|
64
|
+
}
|
|
65
|
+
moveElement(e2, t2) {
|
|
66
|
+
const i = e2 - (window.scrollX || document.documentElement.scrollLeft), s = t2 - (window.scrollY || document.documentElement.scrollTop);
|
|
67
|
+
this.dragEl.style.left = `${i}px`, this.dragEl.style.top = `${s}px`, this.cloneEl && (this.cloneEl.style.left = `${i}px`, this.cloneEl.style.top = `${s}px`);
|
|
68
|
+
this.querySelectorAll("wje-reorder-item").forEach((e3) => {
|
|
69
|
+
if (e3 === this.dragEl) return;
|
|
70
|
+
const t3 = e3.getBoundingClientRect(), i2 = (s - t3.top) / t3.height * 100;
|
|
71
|
+
i2 > 30 && this.isMovingDown(e3) ? e3.parentNode.insertBefore(this.dragEl, e3.nextSibling) : i2 < 30 && !this.isMovingDown(e3) && e3.parentNode.insertBefore(this.dragEl, e3);
|
|
196
72
|
});
|
|
197
73
|
}
|
|
198
|
-
/**
|
|
199
|
-
* Handles the mouse up event.
|
|
200
|
-
*/
|
|
201
74
|
mouseUp() {
|
|
202
|
-
this.stopDragging();
|
|
203
|
-
document.removeEventListener("mousemove", this.mouseMove.bind(this), false);
|
|
204
|
-
document.removeEventListener("mouseup", this.mouseUp.bind(this), false);
|
|
205
|
-
if (this.cloneEl) {
|
|
206
|
-
this.cloneEl.remove();
|
|
207
|
-
this.cloneEl = null;
|
|
208
|
-
}
|
|
209
|
-
if (this.dragEl) {
|
|
210
|
-
this.dragEl.style.opacity = "1";
|
|
211
|
-
}
|
|
75
|
+
this.stopDragging(), document.removeEventListener("mousemove", this.mouseMove.bind(this), false), document.removeEventListener("mouseup", this.mouseUp.bind(this), false), this.cloneEl && (this.cloneEl.remove(), this.cloneEl = null), this.dragEl && (this.dragEl.style.opacity = "1");
|
|
212
76
|
}
|
|
213
|
-
/**
|
|
214
|
-
* Handles the touch end event.
|
|
215
|
-
*/
|
|
216
77
|
touchEnd() {
|
|
217
|
-
this.stopDragging();
|
|
218
|
-
document.removeEventListener("touchmove", this.touchMove.bind(this), false);
|
|
219
|
-
document.removeEventListener("touchend", this.touchEnd.bind(this), false);
|
|
78
|
+
this.stopDragging(), document.removeEventListener("touchmove", this.touchMove.bind(this), false), document.removeEventListener("touchend", this.touchEnd.bind(this), false);
|
|
220
79
|
}
|
|
221
|
-
/**
|
|
222
|
-
* Stops dragging the element.
|
|
223
|
-
*/
|
|
224
80
|
stopDragging() {
|
|
225
81
|
if (!this.isDragging) return;
|
|
226
|
-
this.isDragging = false;
|
|
227
|
-
this.dragEl.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
const newOrderElements = Array.from(parent.children).map((el) => {
|
|
233
|
-
const clonedNode = el.cloneNode(true);
|
|
234
|
-
const handle = clonedNode.querySelector(".handle");
|
|
235
|
-
if (handle) {
|
|
236
|
-
handle.remove();
|
|
237
|
-
}
|
|
238
|
-
return clonedNode;
|
|
239
|
-
});
|
|
240
|
-
const newOrder = newOrderElements.map((el) => el.innerText.trim());
|
|
241
|
-
this.dispatchChange(this.originalIndex, newIndex, newOrder, newOrderElements);
|
|
242
|
-
document.body.style.userSelect = "";
|
|
82
|
+
this.isDragging = false, this.dragEl.classList.remove("dragging"), this.dragEl.style.left = "", this.dragEl.style.top = "";
|
|
83
|
+
const e2 = this.dragEl.parentNode, t2 = Array.from(e2.children).indexOf(this.dragEl), i = Array.from(e2.children).map((e3) => {
|
|
84
|
+
const t3 = e3.cloneNode(true), i2 = t3.querySelector(".handle");
|
|
85
|
+
return i2 && i2.remove(), t3;
|
|
86
|
+
}), s = i.map((e3) => e3.innerText.trim());
|
|
87
|
+
this.dispatchChange(this.originalIndex, t2, s, i), document.body.style.userSelect = "";
|
|
243
88
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
* @param {DragEvent} e The drag event triggered when a drag operation starts.
|
|
247
|
-
*/
|
|
248
|
-
dragStart(e) {
|
|
249
|
-
e.preventDefault();
|
|
89
|
+
dragStart(e2) {
|
|
90
|
+
e2.preventDefault();
|
|
250
91
|
}
|
|
251
|
-
/**
|
|
252
|
-
* Creates a clone of the element.
|
|
253
|
-
*/
|
|
254
92
|
createClone() {
|
|
255
|
-
this.cloneEl = this.dragEl.cloneNode(true);
|
|
256
|
-
this.cloneEl.style.position = "absolute";
|
|
257
|
-
this.cloneEl.style.pointerEvents = "none";
|
|
258
|
-
this.cloneEl.style.visibility = "visible";
|
|
259
|
-
document.body.appendChild(this.cloneEl);
|
|
93
|
+
this.cloneEl = this.dragEl.cloneNode(true), this.cloneEl.style.position = "absolute", this.cloneEl.style.pointerEvents = "none", this.cloneEl.style.visibility = "visible", document.body.appendChild(this.cloneEl);
|
|
260
94
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
* @returns {boolean}
|
|
265
|
-
*/
|
|
266
|
-
isMovingDown(droppedElement) {
|
|
267
|
-
const parent = droppedElement.parentNode;
|
|
268
|
-
const dragIndex = Array.from(parent.children).indexOf(this.dragEl);
|
|
269
|
-
const dropIndex = Array.from(parent.children).indexOf(droppedElement);
|
|
270
|
-
return dragIndex < dropIndex;
|
|
95
|
+
isMovingDown(e2) {
|
|
96
|
+
const t2 = e2.parentNode;
|
|
97
|
+
return Array.from(t2.children).indexOf(this.dragEl) < Array.from(t2.children).indexOf(e2);
|
|
271
98
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
* @param {number} from The original index of the dragged item.
|
|
275
|
-
* @param {number} to The new index of the dragged item after reordering.
|
|
276
|
-
* @param {Array<number>} order The updated order of items after the reordering.
|
|
277
|
-
* // @fires wje-reorder:change - Dispatched when the reordering is completed.
|
|
278
|
-
* The event includes details about the initial position, the new position, and the new order.
|
|
279
|
-
*/
|
|
280
|
-
dispatchChange(from, to, order, orderElements) {
|
|
281
|
-
this.dispatchEvent(
|
|
282
|
-
new CustomEvent("wje-reorder:change", {
|
|
283
|
-
detail: { from, to, order, orderElements }
|
|
284
|
-
})
|
|
285
|
-
);
|
|
99
|
+
dispatchChange(e2, t2, i, s) {
|
|
100
|
+
this.dispatchEvent(new CustomEvent("wje-reorder:change", { detail: { from: e2, to: t2, order: i, orderElements: s } }));
|
|
286
101
|
}
|
|
287
102
|
}
|
|
288
|
-
|
|
103
|
+
t.define("wje-reorder", t);
|
|
289
104
|
export {
|
|
290
|
-
|
|
105
|
+
t as default
|
|
291
106
|
};
|
|
292
107
|
//# sourceMappingURL=wje-reorder.js.map
|
package/dist/wje-reorder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-reorder.js","sources":["../packages/wje-reorder/reorder.element.js","../packages/wje-reorder/reorder.js"],"sourcesContent":["import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Reorder` is a custom web component that represents a reorder.\n * It extends from `WJElement`.\n * @summary This element represents a reorder.\n * @documentation https://elements.webjet.sk/components/reorder\n * @status stable\n * @augments WJElement\n * @csspart native - The native part of the reorder.\n * @slot - The default slot for the reorder.\n * // @fires wje-reorder:change - Event fired when the reorder is changed.\n * @tag wje-reorder\n */\n\nexport default class Reorder extends WJElement {\n /**\n * Creates an instance of Select.\n * @class\n */\n constructor() {\n super();\n this.dragEl = null;\n this.items = [];\n this.originalIndex = null;\n this.isDragging = false;\n this.offsetX = 0;\n this.offsetY = 0;\n this.cloneEl = null;\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'Select';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n /**\n * Draws the component after it is connected to the DOM.\n * @returns {DocumentFragment}\n */\n draw() {\n const fragment = document.createDocumentFragment();\n\n const container = document.createElement('div');\n container.classList.add('container');\n container.setAttribute('part', 'native');\n\n const slot = document.createElement('slot');\n slot.classList.add('reorder-items');\n\n container.appendChild(slot);\n\n fragment.appendChild(container);\n\n this.container = container;\n\n return fragment;\n }\n\n /**\n * Adds event listeners after the component is drawn.\n */\n afterDraw() {\n this.syncAria();\n const items = this.querySelectorAll('wje-reorder-item');\n const dropZones = this.querySelectorAll('wje-reorder-dropzone');\n this.container.classList.add(this.hasAttribute('reverse') ? 'reversed' : 'basic');\n\n if (dropZones) {\n dropZones.forEach((dropZone) => {\n this.container.classList.remove('container');\n this.container.classList.add('container-w-dropzones');\n });\n }\n\n if (items) {\n items.forEach((item) => {\n const handles = item.querySelectorAll('[slot=handle]');\n const draggableElement = handles.length > 0 ? handles : [item];\n\n draggableElement.forEach((element) => {\n this.attachEventListeners(element);\n });\n });\n }\n }\n\n /**\n * Sync ARIA attributes on host.\n */\n syncAria() {\n if (!this.hasAttribute('role')) {\n this.setAriaState({ role: 'list' });\n }\n }\n\n /**\n * Attaches event listeners to the element.\n * @param element\n */\n attachEventListeners(element) {\n element.addEventListener('mousedown', this.mouseDown.bind(this), false);\n element.addEventListener('touchstart', this.touchStart.bind(this), false);\n element.addEventListener('dragstart', this.dragStart.bind(this), false);\n }\n\n /**\n * Handles the mouse down event.\n * @param {object} e\n */\n mouseDown(e) {\n this.startDragging(e.clientX, e.clientY, e.currentTarget);\n document.addEventListener('mousemove', this.mouseMove.bind(this), false);\n document.addEventListener('mouseup', this.mouseUp.bind(this), false);\n document.body.style.userSelect = 'none';\n }\n\n /**\n * Handles the touch start event.\n * @param e\n */\n touchStart(e) {\n const touch = e.touches[0];\n this.startDragging(touch.clientX, touch.clientY, e.currentTarget);\n document.addEventListener('touchmove', this.touchMove.bind(this), false);\n document.addEventListener('touchend', this.touchEnd.bind(this), false);\n document.body.style.userSelect = 'none';\n }\n\n /**\n * Initializes the dragging process for a reorderable item.\n * @param {number} clientX The x-coordinate of the mouse pointer when the drag starts.\n * @param {number} clientY The y-coordinate of the mouse pointer when the drag starts.\n * @param {HTMLElement} target The target element where the drag event originated.\n */\n startDragging(clientX, clientY, target) {\n if (this.hasAttribute('disabled')) {\n return;\n }\n\n this.isDragging = true;\n this.dragEl = target.closest('wje-reorder-item');\n\n this.createClone();\n\n this.dragEl.style.opacity = '0.3';\n\n const rect = this.dragEl.getBoundingClientRect();\n this.offsetX = clientX - rect.left;\n this.offsetY = clientY - rect.top;\n\n this.dragEl.classList.add('dragging');\n\n this.originalIndex = [...this.dragEl.parentNode.children].indexOf(this.dragEl);\n this.originalParent = this.dragEl.parentNode;\n }\n\n /**\n * Handles the mouse move event.\n * @param e\n */\n mouseMove(e) {\n if (!this.isDragging) return;\n this.moveElement(e.pageX, e.pageY);\n\n if (this.cloneEl) {\n this.cloneEl.style.left = `${e.pageX - this.offsetX}px`;\n this.cloneEl.style.top = `${e.pageY - this.offsetY}px`;\n }\n }\n\n /**\n * Handles the `touchmove` event and updates the position of the dragged element.\n * @param {TouchEvent} e The touch event containing touch position data.\n */\n touchMove(e) {\n if (!this.isDragging) return;\n const touch = e.touches[0];\n this.moveElement(touch.pageX, touch.pageY);\n }\n\n /**\n * Updates the position of the dragged element and handles reordering logic based on the mouse position.\n * @param {number} pageX The x-coordinate of the mouse pointer relative to the viewport during the move event.\n * @param {number} pageY The y-coordinate of the mouse pointer relative to the viewport during the move event.\n */\n moveElement(pageX, pageY) {\n const scrollX = window.scrollX || document.documentElement.scrollLeft;\n const scrollY = window.scrollY || document.documentElement.scrollTop;\n const adjustedPageX = pageX - scrollX;\n const adjustedPageY = pageY - scrollY;\n\n this.dragEl.style.left = `${adjustedPageX}px`;\n this.dragEl.style.top = `${adjustedPageY}px`;\n\n if (this.cloneEl) {\n this.cloneEl.style.left = `${adjustedPageX}px`;\n this.cloneEl.style.top = `${adjustedPageY}px`;\n }\n\n const items = this.querySelectorAll('wje-reorder-item');\n items.forEach((item) => {\n if (item === this.dragEl) return;\n\n const boundingBox = item.getBoundingClientRect();\n const mouseY = adjustedPageY - boundingBox.top;\n const mouseYPercent = (mouseY / boundingBox.height) * 100;\n\n if (mouseYPercent > 30 && this.isMovingDown(item)) {\n item.parentNode.insertBefore(this.dragEl, item.nextSibling);\n } else if (mouseYPercent < 30 && !this.isMovingDown(item)) {\n item.parentNode.insertBefore(this.dragEl, item);\n }\n });\n }\n\n /**\n * Handles the mouse up event.\n */\n mouseUp() {\n this.stopDragging();\n document.removeEventListener('mousemove', this.mouseMove.bind(this), false);\n document.removeEventListener('mouseup', this.mouseUp.bind(this), false);\n\n if (this.cloneEl) {\n this.cloneEl.remove();\n this.cloneEl = null;\n }\n\n if (this.dragEl) {\n this.dragEl.style.opacity = '1';\n }\n }\n\n /**\n * Handles the touch end event.\n */\n touchEnd() {\n this.stopDragging();\n document.removeEventListener('touchmove', this.touchMove.bind(this), false);\n document.removeEventListener('touchend', this.touchEnd.bind(this), false);\n }\n\n /**\n * Stops dragging the element.\n */\n stopDragging() {\n if (!this.isDragging) return;\n\n this.isDragging = false;\n this.dragEl.classList.remove('dragging');\n this.dragEl.style.left = '';\n this.dragEl.style.top = '';\n\n const parent = this.dragEl.parentNode;\n const newIndex = Array.from(parent.children).indexOf(this.dragEl);\n\n const newOrderElements = Array.from(parent.children).map((el) => {\n const clonedNode = el.cloneNode(true);\n const handle = clonedNode.querySelector('.handle');\n if (handle) {\n handle.remove();\n }\n return clonedNode;\n });\n\n const newOrder = newOrderElements.map(el => el.innerText.trim());\n\n this.dispatchChange(this.originalIndex, newIndex, newOrder, newOrderElements);\n\n document.body.style.userSelect = '';\n }\n\n /**\n * Prevents the default behavior of the `dragstart` event.\n * @param {DragEvent} e The drag event triggered when a drag operation starts.\n */\n dragStart(e) {\n e.preventDefault();\n }\n\n /**\n * Creates a clone of the element.\n */\n createClone() {\n this.cloneEl = this.dragEl.cloneNode(true);\n this.cloneEl.style.position = 'absolute';\n this.cloneEl.style.pointerEvents = 'none';\n this.cloneEl.style.visibility = 'visible';\n\n document.body.appendChild(this.cloneEl);\n }\n\n /**\n * Checks if the dragged element is moving down.\n * @param droppedElement\n * @returns {boolean}\n */\n isMovingDown(droppedElement) {\n const parent = droppedElement.parentNode;\n const dragIndex = Array.from(parent.children).indexOf(this.dragEl);\n const dropIndex = Array.from(parent.children).indexOf(droppedElement);\n\n return dragIndex < dropIndex;\n }\n\n /**\n * Dispatches a custom event to signal that a reordering operation has occurred.\n * @param {number} from The original index of the dragged item.\n * @param {number} to The new index of the dragged item after reordering.\n * @param {Array<number>} order The updated order of items after the reordering.\n * // @fires wje-reorder:change - Dispatched when the reordering is completed.\n * The event includes details about the initial position, the new position, and the new order.\n */\n dispatchChange(from, to, order, orderElements) {\n this.dispatchEvent(\n new CustomEvent('wje-reorder:change', {\n detail: { from, to, order, orderElements },\n })\n );\n }\n}\n","import Reorder from './reorder.element.js';\n\nexport default Reorder;\n\nReorder.define('wje-reorder', Reorder);\n"],"names":[],"mappings":";;;;;AAgBe,MAAM,gBAAgB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK3C,cAAc;AACV,UAAK;AAcT;AAAA;AAAA;AAAA;AAAA,qCAAY;AAbR,SAAK,SAAS;AACd,SAAK,QAAQ,CAAA;AACb,SAAK,gBAAgB;AACrB,SAAK,aAAa;AAClB,SAAK,UAAU;AACf,SAAK,UAAU;AACf,SAAK,UAAU;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,WAAW,gBAAgB;AACvB,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAW,qBAAqB;AAC5B,WAAO,CAAA;AAAA,EACX;AAAA;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QAAM,GAAG,UAAU,MAAM;AAE/D,SAAK,eAAe,KAAK,eAAe,UAAU,UAAU,gBAAgB;AAE5E,aAAS,KAAK,MAAM,aAAa;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU,GAAG;AACT,MAAE,eAAc;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA,EAKA,cAAc;AACV,SAAK,UAAU,KAAK,OAAO,UAAU,IAAI;AACzC,SAAK,QAAQ,MAAM,WAAW;AAC9B,SAAK,QAAQ,MAAM,gBAAgB;AACnC,SAAK,QAAQ,MAAM,aAAa;AAEhC,aAAS,KAAK,YAAY,KAAK,OAAO;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,gBAAgB;AACzB,UAAM,SAAS,eAAe;AAC9B,UAAM,YAAY,MAAM,KAAK,OAAO,QAAQ,EAAE,QAAQ,KAAK,MAAM;AACjE,UAAM,YAAY,MAAM,KAAK,OAAO,QAAQ,EAAE,QAAQ,cAAc;AAEpE,WAAO,YAAY;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,eAAe,MAAM,IAAI,OAAO,eAAe;AAC3C,SAAK;AAAA,MACD,IAAI,YAAY,sBAAsB;AAAA,QAClC,QAAQ,EAAE,MAAM,IAAI,OAAO,cAAa;AAAA,MACxD,CAAa;AAAA,IACb;AAAA,EACI;AACJ;ACzVA,QAAQ,OAAO,eAAe,OAAO;"}
|
|
1
|
+
{"version":3,"file":"wje-reorder.js","sources":["../packages/wje-reorder/reorder.element.js","../packages/wje-reorder/reorder.js"],"sourcesContent":["import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Reorder` is a custom web component that represents a reorder.\n * It extends from `WJElement`.\n * @summary This element represents a reorder.\n * @documentation https://elements.webjet.sk/components/reorder\n * @status stable\n * @augments WJElement\n * @csspart native - The native part of the reorder.\n * @slot - The default slot for the reorder.\n * // @fires wje-reorder:change - Event fired when the reorder is changed.\n * @tag wje-reorder\n */\n\nexport default class Reorder extends WJElement {\n /**\n * Creates an instance of Select.\n * @class\n */\n constructor() {\n super();\n this.dragEl = null;\n this.items = [];\n this.originalIndex = null;\n this.isDragging = false;\n this.offsetX = 0;\n this.offsetY = 0;\n this.cloneEl = null;\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'Select';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n /**\n * Draws the component after it is connected to the DOM.\n * @returns {DocumentFragment}\n */\n draw() {\n const fragment = document.createDocumentFragment();\n\n const container = document.createElement('div');\n container.classList.add('container');\n container.setAttribute('part', 'native');\n\n const slot = document.createElement('slot');\n slot.classList.add('reorder-items');\n\n container.appendChild(slot);\n\n fragment.appendChild(container);\n\n this.container = container;\n\n return fragment;\n }\n\n /**\n * Adds event listeners after the component is drawn.\n */\n afterDraw() {\n this.syncAria();\n const items = this.querySelectorAll('wje-reorder-item');\n const dropZones = this.querySelectorAll('wje-reorder-dropzone');\n this.container.classList.add(this.hasAttribute('reverse') ? 'reversed' : 'basic');\n\n if (dropZones) {\n dropZones.forEach((dropZone) => {\n this.container.classList.remove('container');\n this.container.classList.add('container-w-dropzones');\n });\n }\n\n if (items) {\n items.forEach((item) => {\n const handles = item.querySelectorAll('[slot=handle]');\n const draggableElement = handles.length > 0 ? handles : [item];\n\n draggableElement.forEach((element) => {\n this.attachEventListeners(element);\n });\n });\n }\n }\n\n /**\n * Sync ARIA attributes on host.\n */\n syncAria() {\n if (!this.hasAttribute('role')) {\n this.setAriaState({ role: 'list' });\n }\n }\n\n /**\n * Attaches event listeners to the element.\n * @param element\n */\n attachEventListeners(element) {\n element.addEventListener('mousedown', this.mouseDown.bind(this), false);\n element.addEventListener('touchstart', this.touchStart.bind(this), false);\n element.addEventListener('dragstart', this.dragStart.bind(this), false);\n }\n\n /**\n * Handles the mouse down event.\n * @param {object} e\n */\n mouseDown(e) {\n this.startDragging(e.clientX, e.clientY, e.currentTarget);\n document.addEventListener('mousemove', this.mouseMove.bind(this), false);\n document.addEventListener('mouseup', this.mouseUp.bind(this), false);\n document.body.style.userSelect = 'none';\n }\n\n /**\n * Handles the touch start event.\n * @param e\n */\n touchStart(e) {\n const touch = e.touches[0];\n this.startDragging(touch.clientX, touch.clientY, e.currentTarget);\n document.addEventListener('touchmove', this.touchMove.bind(this), false);\n document.addEventListener('touchend', this.touchEnd.bind(this), false);\n document.body.style.userSelect = 'none';\n }\n\n /**\n * Initializes the dragging process for a reorderable item.\n * @param {number} clientX The x-coordinate of the mouse pointer when the drag starts.\n * @param {number} clientY The y-coordinate of the mouse pointer when the drag starts.\n * @param {HTMLElement} target The target element where the drag event originated.\n */\n startDragging(clientX, clientY, target) {\n if (this.hasAttribute('disabled')) {\n return;\n }\n\n this.isDragging = true;\n this.dragEl = target.closest('wje-reorder-item');\n\n this.createClone();\n\n this.dragEl.style.opacity = '0.3';\n\n const rect = this.dragEl.getBoundingClientRect();\n this.offsetX = clientX - rect.left;\n this.offsetY = clientY - rect.top;\n\n this.dragEl.classList.add('dragging');\n\n this.originalIndex = [...this.dragEl.parentNode.children].indexOf(this.dragEl);\n this.originalParent = this.dragEl.parentNode;\n }\n\n /**\n * Handles the mouse move event.\n * @param e\n */\n mouseMove(e) {\n if (!this.isDragging) return;\n this.moveElement(e.pageX, e.pageY);\n\n if (this.cloneEl) {\n this.cloneEl.style.left = `${e.pageX - this.offsetX}px`;\n this.cloneEl.style.top = `${e.pageY - this.offsetY}px`;\n }\n }\n\n /**\n * Handles the `touchmove` event and updates the position of the dragged element.\n * @param {TouchEvent} e The touch event containing touch position data.\n */\n touchMove(e) {\n if (!this.isDragging) return;\n const touch = e.touches[0];\n this.moveElement(touch.pageX, touch.pageY);\n }\n\n /**\n * Updates the position of the dragged element and handles reordering logic based on the mouse position.\n * @param {number} pageX The x-coordinate of the mouse pointer relative to the viewport during the move event.\n * @param {number} pageY The y-coordinate of the mouse pointer relative to the viewport during the move event.\n */\n moveElement(pageX, pageY) {\n const scrollX = window.scrollX || document.documentElement.scrollLeft;\n const scrollY = window.scrollY || document.documentElement.scrollTop;\n const adjustedPageX = pageX - scrollX;\n const adjustedPageY = pageY - scrollY;\n\n this.dragEl.style.left = `${adjustedPageX}px`;\n this.dragEl.style.top = `${adjustedPageY}px`;\n\n if (this.cloneEl) {\n this.cloneEl.style.left = `${adjustedPageX}px`;\n this.cloneEl.style.top = `${adjustedPageY}px`;\n }\n\n const items = this.querySelectorAll('wje-reorder-item');\n items.forEach((item) => {\n if (item === this.dragEl) return;\n\n const boundingBox = item.getBoundingClientRect();\n const mouseY = adjustedPageY - boundingBox.top;\n const mouseYPercent = (mouseY / boundingBox.height) * 100;\n\n if (mouseYPercent > 30 && this.isMovingDown(item)) {\n item.parentNode.insertBefore(this.dragEl, item.nextSibling);\n } else if (mouseYPercent < 30 && !this.isMovingDown(item)) {\n item.parentNode.insertBefore(this.dragEl, item);\n }\n });\n }\n\n /**\n * Handles the mouse up event.\n */\n mouseUp() {\n this.stopDragging();\n document.removeEventListener('mousemove', this.mouseMove.bind(this), false);\n document.removeEventListener('mouseup', this.mouseUp.bind(this), false);\n\n if (this.cloneEl) {\n this.cloneEl.remove();\n this.cloneEl = null;\n }\n\n if (this.dragEl) {\n this.dragEl.style.opacity = '1';\n }\n }\n\n /**\n * Handles the touch end event.\n */\n touchEnd() {\n this.stopDragging();\n document.removeEventListener('touchmove', this.touchMove.bind(this), false);\n document.removeEventListener('touchend', this.touchEnd.bind(this), false);\n }\n\n /**\n * Stops dragging the element.\n */\n stopDragging() {\n if (!this.isDragging) return;\n\n this.isDragging = false;\n this.dragEl.classList.remove('dragging');\n this.dragEl.style.left = '';\n this.dragEl.style.top = '';\n\n const parent = this.dragEl.parentNode;\n const newIndex = Array.from(parent.children).indexOf(this.dragEl);\n\n const newOrderElements = Array.from(parent.children).map((el) => {\n const clonedNode = el.cloneNode(true);\n const handle = clonedNode.querySelector('.handle');\n if (handle) {\n handle.remove();\n }\n return clonedNode;\n });\n\n const newOrder = newOrderElements.map(el => el.innerText.trim());\n\n this.dispatchChange(this.originalIndex, newIndex, newOrder, newOrderElements);\n\n document.body.style.userSelect = '';\n }\n\n /**\n * Prevents the default behavior of the `dragstart` event.\n * @param {DragEvent} e The drag event triggered when a drag operation starts.\n */\n dragStart(e) {\n e.preventDefault();\n }\n\n /**\n * Creates a clone of the element.\n */\n createClone() {\n this.cloneEl = this.dragEl.cloneNode(true);\n this.cloneEl.style.position = 'absolute';\n this.cloneEl.style.pointerEvents = 'none';\n this.cloneEl.style.visibility = 'visible';\n\n document.body.appendChild(this.cloneEl);\n }\n\n /**\n * Checks if the dragged element is moving down.\n * @param droppedElement\n * @returns {boolean}\n */\n isMovingDown(droppedElement) {\n const parent = droppedElement.parentNode;\n const dragIndex = Array.from(parent.children).indexOf(this.dragEl);\n const dropIndex = Array.from(parent.children).indexOf(droppedElement);\n\n return dragIndex < dropIndex;\n }\n\n /**\n * Dispatches a custom event to signal that a reordering operation has occurred.\n * @param {number} from The original index of the dragged item.\n * @param {number} to The new index of the dragged item after reordering.\n * @param {Array<number>} order The updated order of items after the reordering.\n * // @fires wje-reorder:change - Dispatched when the reordering is completed.\n * The event includes details about the initial position, the new position, and the new order.\n */\n dispatchChange(from, to, order, orderElements) {\n this.dispatchEvent(\n new CustomEvent('wje-reorder:change', {\n detail: { from, to, order, orderElements },\n })\n );\n }\n}\n","import Reorder from './reorder.element.js';\n\nexport default Reorder;\n\nReorder.define('wje-reorder', Reorder);\n"],"names":["Reorder","WJElement","super","className","this","dragEl","items","originalIndex","isDragging","offsetX","offsetY","cloneEl","cssStyleSheet","isShadowRoot","syncAria","draw","fragment","document","createDocumentFragment","container","createElement","classList","add","setAttribute","slot","appendChild","querySelectorAll","dropZones","hasAttribute","forEach","dropZone","remove","item","handles","length","element","attachEventListeners","setAriaState","role","addEventListener","mouseDown","bind","touchStart","dragStart","e","startDragging","clientX","clientY","currentTarget","mouseMove","mouseUp","body","style","userSelect","touch","touches","touchMove","touchEnd","target","closest","createClone","opacity","rect","getBoundingClientRect","left","top","parentNode","children","indexOf","originalParent","moveElement","pageX","pageY","adjustedPageX","window","scrollX","documentElement","scrollLeft","adjustedPageY","scrollY","scrollTop","boundingBox","mouseYPercent","height","isMovingDown","insertBefore","nextSibling","stopDragging","removeEventListener","parent","newIndex","Array","from","newOrderElements","map","el","clonedNode","cloneNode","handle","querySelector","newOrder","innerText","trim","dispatchChange","preventDefault","position","pointerEvents","visibility","droppedElement","to","order","orderElements","dispatchEvent","CustomEvent","detail","define"],"mappings":";;;;AAgBe,MAAMA,UAAgBC,EAAAA;AAAAA,EAKjC;AACIC,UAAAA;AAcJC,qCAAY;AAbRC,SAAKC,SAAS,MACdD,KAAKE,QAAQ,CAAA,GACbF,KAAKG,gBAAgB,MACrBH,KAAKI,aAAAA,OACLJ,KAAKK,UAAU,GACfL,KAAKM,UAAU,GACfN,KAAKO,UAAU;AAAA,EACnB;AAAA,EAaA,2BAAWC;AACP;EACJ;AAAA,EAOA,WAAA;AACI,WAAO,CAAA;AAAA,EACX;AAAA,EAKA;AACIR,SAAKS,eAAe,QACpBT,KAAKU;EACT;AAAA,EAMA,OAAAC;AACI,UAAMC,KAAWC,SAASC,uBAAAA,GAEpBC,KAAYF,SAASG,cAAc;AACzCD,IAAAA,GAAUE,UAAUC,IAAI,WAAA,GACxBH,GAAUI,aAAa,QAAQ,QAAA;AAE/B,UAAMC,IAAOP,SAASG,cAAc,MAAA;AASpC,WARAI,EAAKH,UAAUC,IAAI,kBAEnBH,GAAUM,YAAYD,IAEtBR,GAASS,YAAYN,EAAAA,GAErBf,KAAKe,YAAYA,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wC,EAAAA;AAAAA,EAG1D;AAAA,EAUA,eAAehB,IAAMiB,IAAIC,GAAOC,GAAAA;AAC5B3G,SAAK4G,cACD,IAAIC,YAAY,sBAAsB,EAClCC,QAAQ,EAAEtB,MAAAA,IAAMiB,QAAIC,OAAAA,GAAOC,eAAAA,EAAAA,EAAAA,CAAAA,CAAAA;AAAAA,EAGvC;;ACxVJ/G,EAAQmH,OAAO,eAAenH,CAAAA;"}
|
package/dist/wje-route.js
CHANGED
|
@@ -1,43 +1,25 @@
|
|
|
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
|
|
5
|
-
class
|
|
6
|
-
/**
|
|
7
|
-
* Creates an instance of Route.
|
|
8
|
-
* @class
|
|
9
|
-
*/
|
|
4
|
+
import e from "./wje-element.js";
|
|
5
|
+
class t extends e {
|
|
10
6
|
constructor() {
|
|
11
7
|
super();
|
|
12
8
|
__publicField(this, "className", "Route");
|
|
13
9
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Returns the list of attributes to observe for changes.
|
|
16
|
-
* @static
|
|
17
|
-
* @returns {Array<string>}
|
|
18
|
-
*/
|
|
19
10
|
static get observedAttributes() {
|
|
20
11
|
return [];
|
|
21
12
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Sets up the attributes for the component.
|
|
24
|
-
*/
|
|
25
13
|
setupAttributes() {
|
|
26
14
|
this.isShadowRoot = "open";
|
|
27
15
|
}
|
|
28
|
-
/**
|
|
29
|
-
* Draws the component for the route.
|
|
30
|
-
* @returns {DocumentFragment}
|
|
31
|
-
*/
|
|
32
16
|
draw() {
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
fragment.appendChild(slot);
|
|
36
|
-
return fragment;
|
|
17
|
+
let e2 = document.createDocumentFragment(), t2 = document.createElement("slot");
|
|
18
|
+
return e2.appendChild(t2), e2;
|
|
37
19
|
}
|
|
38
20
|
}
|
|
39
|
-
|
|
21
|
+
t.define("wje-route", t);
|
|
40
22
|
export {
|
|
41
|
-
|
|
23
|
+
t as default
|
|
42
24
|
};
|
|
43
25
|
//# sourceMappingURL=wje-route.js.map
|
package/dist/wje-route.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-route.js","sources":["../packages/wje-route/route.element.js","../packages/wje-route/route.js"],"sourcesContent":["import { default as WJElement } from '../wje-element/element.js';\n\n/**\n * `Route` is a custom web component that represents a route in a routing system.\n * @summary This element represents a route in a routing system.\n * @documentation https://elements.webjet.sk/components/route\n * @status stable\n * @augments WJElement\n * @tag wje-route\n */\nexport default class Route extends WJElement {\n /**\n * Creates an instance of Route.\n * @class\n */\n constructor() {\n super();\n }\n\n className = 'Route';\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the route.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let slot = document.createElement('slot');\n\n fragment.appendChild(slot);\n\n return fragment;\n }\n}\n","import Route from './route.element.js';\n\nexport default Route;\n\nRoute.define('wje-route', Route);\n"],"names":[],"mappings":";;;;AAUe,
|
|
1
|
+
{"version":3,"file":"wje-route.js","sources":["../packages/wje-route/route.element.js","../packages/wje-route/route.js"],"sourcesContent":["import { default as WJElement } from '../wje-element/element.js';\n\n/**\n * `Route` is a custom web component that represents a route in a routing system.\n * @summary This element represents a route in a routing system.\n * @documentation https://elements.webjet.sk/components/route\n * @status stable\n * @augments WJElement\n * @tag wje-route\n */\nexport default class Route extends WJElement {\n /**\n * Creates an instance of Route.\n * @class\n */\n constructor() {\n super();\n }\n\n className = 'Route';\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the route.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let slot = document.createElement('slot');\n\n fragment.appendChild(slot);\n\n return fragment;\n }\n}\n","import Route from './route.element.js';\n\nexport default Route;\n\nRoute.define('wje-route', Route);\n"],"names":["Route","WJElement","constructor","super","className","setupAttributes","this","isShadowRoot","fragment","document","createDocumentFragment","slot","createElement","appendChild","define"],"mappings":";;;;AAUe,MAAMA,UAAcC;EAK/B,cAAAC;AACIC;AAGJC,qCAAY;AAAA,EAFZ;AAAA,EASA,WAAA;AACI,WAAO,CAAA;AAAA,EACX;AAAA,EAKA,kBAAAC;AACIC,SAAKC,eAAe;AAAA,EACxB;AAAA,EAMA;AACI,QAAIC,KAAWC,SAASC,uBAAAA,GAEpBC,KAAOF,SAASG,cAAc,MAAA;AAIlC,WAFAJ,GAASK,YAAYF,EAAAA,GAEdH;AAAAA,EACX;;AC7CJR,EAAMc,OAAO,aAAad,CAAAA;"}
|
package/dist/wje-router-link.js
CHANGED
|
@@ -1,64 +1,36 @@
|
|
|
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
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
class RouterLink extends WJElement {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of RouterLink.
|
|
10
|
-
* @class
|
|
11
|
-
*/
|
|
4
|
+
import { b as t } from "./router-links-CNsJ-elb.js";
|
|
5
|
+
import e from "./wje-element.js";
|
|
6
|
+
class r extends e {
|
|
12
7
|
constructor() {
|
|
13
8
|
super();
|
|
14
9
|
__publicField(this, "className", "RouterLink");
|
|
15
10
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Returns the CSS styles for the component.
|
|
18
|
-
* @static
|
|
19
|
-
* @returns {CSSStyleSheet}
|
|
20
|
-
*/
|
|
21
11
|
static get cssStyleSheet() {
|
|
22
|
-
return
|
|
12
|
+
return ":host{display:block;background:transparent!important}:host(.active){cursor:pointer;font-weight:700}";
|
|
23
13
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Returns the list of attributes to observe for changes.
|
|
26
|
-
* @static
|
|
27
|
-
* @returns {Array<string>}
|
|
28
|
-
*/
|
|
29
14
|
static get observedAttributes() {
|
|
30
15
|
return [];
|
|
31
16
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Sets up the attributes for the component.
|
|
34
|
-
*/
|
|
35
17
|
setupAttributes() {
|
|
36
|
-
this.isShadowRoot = "open";
|
|
37
|
-
this.setAttribute("active-class", "active");
|
|
18
|
+
this.isShadowRoot = "open", this.setAttribute("active-class", "active");
|
|
38
19
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Draws the component for the router link.
|
|
41
|
-
* @returns {DocumentFragment}
|
|
42
|
-
*/
|
|
43
20
|
draw() {
|
|
44
|
-
let
|
|
45
|
-
|
|
46
|
-
fragment.appendChild(element);
|
|
47
|
-
return fragment;
|
|
21
|
+
let t2 = document.createDocumentFragment(), e2 = document.createElement("slot");
|
|
22
|
+
return t2.appendChild(e2), t2;
|
|
48
23
|
}
|
|
49
|
-
afterDraw(
|
|
50
|
-
this.unbindRouterLinks =
|
|
24
|
+
afterDraw(e2, r2, s) {
|
|
25
|
+
this.unbindRouterLinks = t(this.parentElement, { selector: false });
|
|
51
26
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Cleans up before the component is disconnected.
|
|
54
|
-
*/
|
|
55
27
|
beforeDisconnect() {
|
|
56
28
|
var _a;
|
|
57
29
|
(_a = this.unbindRouterLinks) == null ? void 0 : _a.call(this);
|
|
58
30
|
}
|
|
59
31
|
}
|
|
60
|
-
|
|
32
|
+
r.define("wje-router-link", r);
|
|
61
33
|
export {
|
|
62
|
-
|
|
34
|
+
r as default
|
|
63
35
|
};
|
|
64
36
|
//# sourceMappingURL=wje-router-link.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-router-link.js","sources":["../packages/wje-router-link/router-link.element.js","../packages/wje-router-link/router-link.js"],"sourcesContent":["import { bindRouterLinks } from 'slick-router/middlewares/router-links.js';\n\nimport { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `RouterLink` is a custom web component that represents a router link in a routing system.\n * @summary This element represents a router link in a routing system.\n * @documentation https://elements.webjet.sk/components/router-link\n * @status stable\n * @augments {WJElement}\n * @slot - The default slot for the router link.\n * @tag wje-router-link\n */\nexport default class RouterLink extends WJElement {\n /**\n * Creates an instance of RouterLink.\n * @class\n */\n constructor() {\n super();\n }\n\n className = 'RouterLink';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAttribute('active-class', 'active');\n }\n\n /**\n * Draws the component for the router link.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let element = document.createElement('slot');\n\n fragment.appendChild(element);\n\n return fragment;\n }\n\n afterDraw(context, appStore, attributes) {\n this.unbindRouterLinks = bindRouterLinks(this.parentElement, { selector: false });\n }\n\n /**\n * Cleans up before the component is disconnected.\n */\n beforeDisconnect() {\n this.unbindRouterLinks?.();\n }\n}\n","import RouterLink from './router-link.element.js';\n\nexport default RouterLink;\n\nRouterLink.define('wje-router-link', RouterLink);\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wje-router-link.js","sources":["../packages/wje-router-link/router-link.element.js","../packages/wje-router-link/router-link.js"],"sourcesContent":["import { bindRouterLinks } from 'slick-router/middlewares/router-links.js';\n\nimport { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `RouterLink` is a custom web component that represents a router link in a routing system.\n * @summary This element represents a router link in a routing system.\n * @documentation https://elements.webjet.sk/components/router-link\n * @status stable\n * @augments {WJElement}\n * @slot - The default slot for the router link.\n * @tag wje-router-link\n */\nexport default class RouterLink extends WJElement {\n /**\n * Creates an instance of RouterLink.\n * @class\n */\n constructor() {\n super();\n }\n\n className = 'RouterLink';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAttribute('active-class', 'active');\n }\n\n /**\n * Draws the component for the router link.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let element = document.createElement('slot');\n\n fragment.appendChild(element);\n\n return fragment;\n }\n\n afterDraw(context, appStore, attributes) {\n this.unbindRouterLinks = bindRouterLinks(this.parentElement, { selector: false });\n }\n\n /**\n * Cleans up before the component is disconnected.\n */\n beforeDisconnect() {\n this.unbindRouterLinks?.();\n }\n}\n","import RouterLink from './router-link.element.js';\n\nexport default RouterLink;\n\nRouterLink.define('wje-router-link', RouterLink);\n"],"names":["RouterLink","WJElement","constructor","super","className","observedAttributes","setupAttributes","this","isShadowRoot","setAttribute","draw","fragment","document","createDocumentFragment","element","createElement","appendChild","context","appStore","attributes","unbindRouterLinks","bindRouterLinks","parentElement","selector","beforeDisconnect","define"],"mappings":";;;;;AAce,MAAMA,UAAmBC,EAAAA;AAAAA,EAKpC,cAAAC;AACIC,UAAAA;AAGJC,qCAAY;AAAA,EAFZ;AAAA,EASA,WAAA;AACI;EACJ;AAAA,EAOA,WAAA,qBAAWC;AACP,WAAO,CAAA;AAAA,EACX;AAAA,EAKA,kBAAAC;AACIC,SAAKC,eAAe,QACpBD,KAAKE,aAAa,gBAAgB,QAAA;AAAA,EACtC;AAAA,EAMA,OAAAC;AACI,QAAIC,KAAWC,SAASC,uBAAAA,GAEpBC,KAAUF,SAASG,cAAc;AAIrC,WAFAJ,GAASK,YAAYF,EAAAA,GAEdH;AAAAA,EACX;AAAA,EAEA,UAAUM,IAASC,IAAUC,GAAAA;AACzBZ,SAAKa,oBAAoBC,EAAgBd,KAAKe,eAAe,EAAEC,gBAAU,CAAA;AAAA,EAC7E;AAAA,EAKA,mBAAAC;;AACIjB,eAAKa,sBAALb;AAAAA,EACJ;AAAA;ACtEJP,EAAWyB,OAAO,mBAAmBzB,CAAAA;"}
|