wj-elements 0.1.12 → 0.1.13

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.
Files changed (92) hide show
  1. package/package.json +1 -1
  2. package/dist/dark.css +0 -1
  3. package/dist/light.css +0 -1
  4. package/dist/localize-DVuO3S17.js +0 -43
  5. package/dist/popup.element-CpEjis9f.js +0 -1068
  6. package/dist/router-links-FtZbFUto.js +0 -146
  7. package/dist/styles.css +0 -1
  8. package/dist/wje-accordion-item.js +0 -88
  9. package/dist/wje-accordion.js +0 -79
  10. package/dist/wje-animation.js +0 -121
  11. package/dist/wje-aside.js +0 -55
  12. package/dist/wje-avatar.js +0 -74
  13. package/dist/wje-badge.js +0 -50
  14. package/dist/wje-breadcrumb.js +0 -148
  15. package/dist/wje-breadcrumbs.js +0 -67
  16. package/dist/wje-button-group.js +0 -78
  17. package/dist/wje-button.js +0 -175
  18. package/dist/wje-card-content.js +0 -48
  19. package/dist/wje-card-controls.js +0 -48
  20. package/dist/wje-card-header.js +0 -47
  21. package/dist/wje-card-subtitle.js +0 -55
  22. package/dist/wje-card-title.js +0 -55
  23. package/dist/wje-card.js +0 -50
  24. package/dist/wje-carousel-item.js +0 -33
  25. package/dist/wje-carousel.js +0 -177
  26. package/dist/wje-checkbox.js +0 -104
  27. package/dist/wje-chip.js +0 -32
  28. package/dist/wje-col.js +0 -27
  29. package/dist/wje-color-picker.js +0 -953
  30. package/dist/wje-container.js +0 -57
  31. package/dist/wje-copy-button.js +0 -164
  32. package/dist/wje-dialog.js +0 -86
  33. package/dist/wje-divider.js +0 -53
  34. package/dist/wje-dropdown.js +0 -68
  35. package/dist/wje-element.js +0 -453
  36. package/dist/wje-fetchAndParseCSS.js +0 -40
  37. package/dist/wje-file-upload-item.js +0 -115
  38. package/dist/wje-file-upload.js +0 -297
  39. package/dist/wje-footer.js +0 -56
  40. package/dist/wje-form.js +0 -28
  41. package/dist/wje-format-digital.js +0 -85
  42. package/dist/wje-grid.js +0 -28
  43. package/dist/wje-header.js +0 -58
  44. package/dist/wje-icon-picker.js +0 -221
  45. package/dist/wje-icon.js +0 -119
  46. package/dist/wje-img-comparer.js +0 -111
  47. package/dist/wje-img.js +0 -58
  48. package/dist/wje-infinite-scroll.js +0 -193
  49. package/dist/wje-inline-edit.js +0 -120
  50. package/dist/wje-input-file.js +0 -85
  51. package/dist/wje-input.js +0 -240
  52. package/dist/wje-item.js +0 -45
  53. package/dist/wje-label.js +0 -67
  54. package/dist/wje-list.js +0 -53
  55. package/dist/wje-main.js +0 -56
  56. package/dist/wje-masonry.js +0 -218
  57. package/dist/wje-master.js +0 -196
  58. package/dist/wje-menu-button.js +0 -65
  59. package/dist/wje-menu-item.js +0 -192
  60. package/dist/wje-menu-label.js +0 -57
  61. package/dist/wje-menu.js +0 -74
  62. package/dist/wje-option.js +0 -99
  63. package/dist/wje-options.js +0 -63
  64. package/dist/wje-popup.js +0 -5
  65. package/dist/wje-progress-bar.js +0 -145
  66. package/dist/wje-radio-group.js +0 -101
  67. package/dist/wje-radio.js +0 -46
  68. package/dist/wje-rate.js +0 -260
  69. package/dist/wje-relative-time.js +0 -85
  70. package/dist/wje-reorder-dropzone.js +0 -27
  71. package/dist/wje-reorder-item.js +0 -32
  72. package/dist/wje-reorder.js +0 -132
  73. package/dist/wje-route.js +0 -28
  74. package/dist/wje-router-link.js +0 -64
  75. package/dist/wje-router-outlet.js +0 -127
  76. package/dist/wje-routerx.js +0 -1088
  77. package/dist/wje-row.js +0 -58
  78. package/dist/wje-select.js +0 -240
  79. package/dist/wje-slider.js +0 -177
  80. package/dist/wje-split-view.js +0 -112
  81. package/dist/wje-store.js +0 -192
  82. package/dist/wje-tab-group.js +0 -105
  83. package/dist/wje-tab-panel.js +0 -52
  84. package/dist/wje-tab.js +0 -59
  85. package/dist/wje-textarea.js +0 -116
  86. package/dist/wje-thumbnail.js +0 -64
  87. package/dist/wje-toast.js +0 -76
  88. package/dist/wje-toggle.js +0 -94
  89. package/dist/wje-toolbar-action.js +0 -63
  90. package/dist/wje-toolbar.js +0 -61
  91. package/dist/wje-tooltip.js +0 -105
  92. package/dist/wje-visually-hidden.js +0 -56
@@ -1,145 +0,0 @@
1
- var A = Object.defineProperty;
2
- var j = (i, o, e) => o in i ? A(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
3
- var g = (i, o, e) => (j(i, typeof o != "symbol" ? o + "" : o, e), e);
4
- import k from "./wje-element.js";
5
- const f = ':host(.wje-color-primary) #bar{--wje-progress-bar-color: var(--wje-color-primary)}:host(.wje-color-complete) #bar{--wje-progress-bar-color: var(--wje-color-complete)}:host(.wje-color-success) #bar{--wje-progress-bar-color: var(--wje-color-success)}:host(.wje-color-warning) #bar{--wje-progress-bar-color: var(--wje-color-warning)}:host(.wje-color-danger) #bar{--wje-progress-bar-color: var(--wje-color-danger)}:host(.wje-color-dark) #bar{--wje-progress-bar-color: var(--wje-color-contrast-0)}:host(.wje-color-light) #bar{--wje-progress-bar-color: var(--wje-color-contrast-11)}:host{--wje-progress-bar-color: var(--wje-color-contrast-6);--wje-progress-bar-text-size: .75rem;--wje-progress-bar-text-color: var(--wje-color);--wje-progress-bar-stroke: var(--wje-color-contrast-3);stroke:var(--wje-progress-bar-stroke)}:host .progress{position:relative;display:flex;align-items:center}:host .slot-wrapper{display:flex;position:absolute;top:0;align-items:center;width:100%;height:100%;justify-content:center}:host #bar{stroke:var(--wje-progress-bar-color)}:host text{transform:rotate(90deg);transform-origin:center;text-anchor:middle;dominant-baseline:middle;font-size:var(--wje-progress-bar-text-size);fill:var(--wje-progress-bar-text-color);stroke:var(--wje-progress-bar-text-color)}:host(.wje-color) #bar{stroke:var(--wje-progress-bar-color)}::slotted([slot="start"]){margin-inline:0 1rem}::slotted([slot="end"]){margin-inline:1rem 0}';
6
- class w extends k {
7
- /**
8
- * Creates an instance of ProgressBar.
9
- *
10
- * @constructor
11
- */
12
- constructor() {
13
- super();
14
- g(this, "className", "ProgressBar");
15
- }
16
- /**
17
- * Sets the radius of the progress bar.
18
- *
19
- * @param {number} value - The value to set.
20
- */
21
- set radius(e) {
22
- this.setAttribute("radius", e);
23
- }
24
- /**
25
- * Gets the radius of the progress bar.
26
- *
27
- * @returns {number} The value of the radius.
28
- */
29
- get radius() {
30
- return +this.getAttribute("radius") || 70;
31
- }
32
- /**
33
- * Gets the diameter of the progress bar.
34
- *
35
- * @returns {number} The value of the diameter.
36
- */
37
- get diameter() {
38
- return this.radius * 2 + this.stroke;
39
- }
40
- /**
41
- * Sets the stroke of the progress bar.
42
- *
43
- * @param {number} value - The value to set.
44
- */
45
- set stroke(e) {
46
- this.setAttribute("stroke", e);
47
- }
48
- /**
49
- * Gets the stroke of the progress bar.
50
- *
51
- * @returns {number} The value of the stroke.
52
- */
53
- get stroke() {
54
- return +this.getAttribute("stroke") || 6;
55
- }
56
- /**
57
- * Gets the linecap of the progress bar.
58
- *
59
- * @returns {string} The value of the linecap.
60
- */
61
- get linecap() {
62
- return this.getAttribute("linecap") || "square";
63
- }
64
- /**
65
- * Returns the CSS styles for the component.
66
- *
67
- * @static
68
- * @returns {CSSStyleSheet}
69
- */
70
- static get cssStyleSheet() {
71
- return f;
72
- }
73
- /**
74
- * Returns the list of attributes to observe for changes.
75
- *
76
- * @static
77
- * @returns {Array<string>}
78
- */
79
- static get observedAttributes() {
80
- return ["progress"];
81
- }
82
- /**
83
- * Sets up the attributes for the component.
84
- */
85
- setupAttributes() {
86
- this.isShadowRoot = "open";
87
- }
88
- /**
89
- * Draws the component.
90
- *
91
- * @param {Object} context - The context for drawing.
92
- * @param {Object} store - The store for drawing.
93
- * @param {Object} params - The parameters for drawing.
94
- * @returns {DocumentFragment}
95
- */
96
- draw(e, h, l) {
97
- let c = this.radius + this.stroke / 2, u = document.createDocumentFragment();
98
- l.color && this.classList.add("wje-color-" + l.color, "wje-color");
99
- let a = document.createElement("div");
100
- a.classList.add("progress");
101
- let m = document.createElement("slot"), d = document.createElement("div");
102
- d.classList.add("slot-wrapper");
103
- let p = document.createElement("slot");
104
- p.setAttribute("name", "start");
105
- let b = document.createElement("slot");
106
- b.setAttribute("name", "end");
107
- let s = document.createElementNS("http://www.w3.org/2000/svg", "svg"), r, t;
108
- if ((this == null ? void 0 : this.type) === "circle") {
109
- s.setAttribute("width", this.diameter), s.setAttribute("height", this.diameter), s.setAttribute("viewBox", `0 0 ${this.diameter} ${this.diameter}`), s.setAttribute("style", "transform: rotate(-90deg)"), r = document.createElementNS("http://www.w3.org/2000/svg", "circle"), r.setAttribute("r", this.radius), r.setAttribute("cx", c), r.setAttribute("cy", c), r.setAttribute("fill", "transparent"), t = document.createElementNS("http://www.w3.org/2000/svg", "circle"), t.setAttribute("r", this.radius), t.setAttribute("cx", c), t.setAttribute("cy", c), t.setAttribute("fill", "transparent"), t.setAttribute("stroke-dasharray", "0"), t.setAttribute("stroke-dashoffset", "0");
110
- let n = document.createElementNS("http://www.w3.org/2000/svg", "text");
111
- n.setAttribute("x", "50%"), n.setAttribute("y", "50%"), n.innerHTML = this.progress + "%", s.appendChild(n);
112
- } else
113
- s.setAttribute("width", "100%"), s.setAttribute("height", this.stroke), s.setAttribute("preserveAspectRatio", "none"), r = document.createElementNS("http://www.w3.org/2000/svg", "line"), r.setAttribute("x1", 0), r.setAttribute("y1", this.stroke / 2), r.setAttribute("x2", "100%"), r.setAttribute("y2", this.stroke / 2), t = document.createElementNS("http://www.w3.org/2000/svg", "line"), t.setAttribute("x1", 0), t.setAttribute("y1", this.stroke / 2), t.setAttribute("x2", this.progress + "%"), t.setAttribute("y2", this.stroke / 2);
114
- return r.setAttribute("stroke-linecap", this.linecap), r.setAttribute("stroke-width", this.stroke + "px"), t.setAttribute("stroke-linecap", this.linecap), t.setAttribute("stroke-width", this.stroke + "px"), t.setAttribute("id", "bar"), s.appendChild(r), s.appendChild(t), d.appendChild(m), a.appendChild(p), a.appendChild(d), a.appendChild(s), a.appendChild(b), u.appendChild(a), this.background = r, this.bar = t, u;
115
- }
116
- /**
117
- * Adds event listeners after the component is drawn.
118
- */
119
- afterDraw(e, h, l) {
120
- this.type === "circle" && (this.background.setAttribute("stroke-dasharray", this.getCircleDashoffset(100) + "px"), this.background.setAttribute("stroke-dashoffset", "0px"), this.bar.setAttribute("stroke-dasharray", this.getCircleDasharray(this.radius) + "px"), this.bar.setAttribute("stroke-dashoffset", this.getCircleDashoffset(l.progress, this.radius) + "px"));
121
- }
122
- /**
123
- * Returns the dasharray for a circle with the given radius.
124
- *
125
- * @param {number} radius - The radius of the circle.
126
- * @returns {number} The dasharray value.
127
- */
128
- getCircleDasharray(e = 70) {
129
- return 2 * Math.PI * e;
130
- }
131
- /**
132
- * Returns the dashoffset for a circle with the given progress and radius.
133
- *
134
- * @param {number} progress - The progress of the circle.
135
- * @param {number} radius - The radius of the circle.
136
- * @returns {number} The dashoffset value.
137
- */
138
- getCircleDashoffset(e = 0, h) {
139
- return this.getCircleDasharray(h) * ((100 - e) / 100);
140
- }
141
- }
142
- w.define("wje-progress-bar", w);
143
- export {
144
- w as default
145
- };
@@ -1,101 +0,0 @@
1
- var c = Object.defineProperty;
2
- var u = (i, t, e) => t in i ? c(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var n = (i, t, e) => (u(i, typeof t != "symbol" ? t + "" : t, e), e);
4
- import h from "./wje-element.js";
5
- import r from "./wje-radio.js";
6
- const m = ".wje-inline{display:flex;flex-direction:row;flex-wrap:wrap;gap:.5rem}";
7
- class l extends h {
8
- /**
9
- * Creates an instance of RadioGroup.
10
- *
11
- * @constructor
12
- */
13
- constructor() {
14
- super();
15
- n(this, "className", "RadioGroup");
16
- }
17
- /**
18
- * Returns the CSS styles for the component.
19
- *
20
- * @static
21
- * @returns {CSSStyleSheet}
22
- */
23
- static get cssStyleSheet() {
24
- return m;
25
- }
26
- /**
27
- * Returns the list of attributes to observe for changes.
28
- *
29
- * @static
30
- * @returns {Array<string>}
31
- */
32
- static get observedAttributes() {
33
- return [];
34
- }
35
- /**
36
- * Sets up the attributes for the component.
37
- */
38
- setupAttributes() {
39
- this.isShadowRoot = "open";
40
- }
41
- /**
42
- * Draws the component.
43
- *
44
- * @param {Object} context - The context for drawing.
45
- * @param {Object} store - The store for drawing.
46
- * @param {Object} params - The parameters for drawing.
47
- * @returns {DocumentFragment}
48
- */
49
- draw(e, s, p) {
50
- let o = document.createDocumentFragment(), a = document.createElement("div");
51
- a.classList.add("native-radio-group", this.hasAttribute("inline") ? "wje-inline" : "ddd");
52
- let d = document.createElement("slot");
53
- return a.appendChild(d), o.appendChild(a), o;
54
- }
55
- /**
56
- * Adds event listeners after the component is drawn.
57
- * Handles the selection of radio buttons.
58
- */
59
- afterDraw() {
60
- this.value && this.setRadioToChekced(this.getRadioByValue(this.value)), this.addEventListener("wje-radio:input", (e) => {
61
- this.removeCheck(), this.setRadioToChekced(e.detail.context);
62
- });
63
- }
64
- /**
65
- * Returns the radio button with the given value.
66
- *
67
- * @param {string} value - The value of the radio button.
68
- * @returns {Radio} The radio button.
69
- */
70
- getRadioByValue(e) {
71
- return this.getAllElements().filter((s) => s instanceof r && s.value === e)[0];
72
- }
73
- /**
74
- * Removes the check from all radio buttons.
75
- */
76
- removeCheck() {
77
- this.getAllElements().forEach((e) => {
78
- e instanceof r && (e.checked = !1);
79
- });
80
- }
81
- /**
82
- * Sets the given radio button to checked.
83
- *
84
- * @param {Radio} radio - The radio button to check.
85
- */
86
- setRadioToChekced(e) {
87
- e instanceof r && (this.setAttribute("value", e.value), e.checked = !0);
88
- }
89
- /**
90
- * Returns all the elements in the radio group.
91
- *
92
- * @returns {Array<Element>} The elements.
93
- */
94
- getAllElements() {
95
- return Array.from(this.childNodes);
96
- }
97
- }
98
- l.define("wje-radio-group", l);
99
- export {
100
- l as default
101
- };
package/dist/wje-radio.js DELETED
@@ -1,46 +0,0 @@
1
- var l = Object.defineProperty;
2
- var s = (i, t, e) => t in i ? l(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var a = (i, t, e) => (s(i, typeof t != "symbol" ? t + "" : t, e), e);
4
- import p, { event as n } from "./wje-element.js";
5
- const h = ':host{--wje-radio-margin-top: 0;--wje-radio-margin-bottom: .5rem;--wje-radio-margin-inline: 0;display:block;margin-top:var(--wje-radio-margin-top);margin-bottom:var(--wje-radio-margin-bottom);margin-inline:var(--wje-radio-margin-inline);line-height:100%;padding-left:0}:host label{display:inline-flex;cursor:pointer;position:relative;padding-left:1.5rem;min-width:16px;min-height:16px;margin-bottom:0;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;align-items:center}:host label:before{content:"";position:absolute;width:16px;height:16px;left:0;-webkit-box-sizing:inherit;box-sizing:border-box;background-color:var(--wje-color-contrast-1);border:1px solid var(--wje-color-contrast-4)}.native-radio input[type=radio]+label:before{border-radius:var(--wje-border-radius-circle);transition:border .3s 0s cubic-bezier(.455,.03,.215,1.33)}.native-radio input[type=radio]:checked+label:before{border-color:var(--wje-color-contrast-6);border-width:5px}.native-radio input[type=radio]:focus+label{color:var(--wje-color)}.native-radio input[type=radio]:focus+label:before{outline:none!important;box-shadow:0 0 #78c8fe}.native-radio input[type=radio]{opacity:0;position:absolute;top:3px;width:16px;height:16px}.native-radio input[type=radio][disabled]+label{cursor:not-allowed!important;color:var(--wje-color-contrast-9);opacity:.5}.native-radio input[type=radio][disabled]+label:before{cursor:not-allowed!important}.success input[type=radio]:checked+label:before{border-color:var(--wje-color-success)}.primary input[type=radio]:checked+label:before{border-color:var(--wje-color-primary)}.complete input[type=radio]:checked+label:before{border-color:var(--wje-color-complete)}.warning input[type=radio]:checked+label:before{border-color:var(--wje-color-warning)}.danger input[type=radio]:checked+label:before{border-color:var(--wje-color-danger)}.neutral input[type=radio]:checked+label:before{border-color:var(--wje-color-info)}';
6
- class c extends p {
7
- constructor() {
8
- super();
9
- a(this, "className", "Radio");
10
- a(this, "inputEvent", (e) => {
11
- this.checked = e.target.checked;
12
- });
13
- this._checked = !1;
14
- }
15
- set checked(e) {
16
- this._checked = e, e ? this.setAttribute("checked", "") : this.removeAttribute("checked");
17
- }
18
- get checked() {
19
- return this._checked;
20
- }
21
- static get cssStyleSheet() {
22
- return h;
23
- }
24
- static get observedAttributes() {
25
- return ["checked"];
26
- }
27
- setupAttributes() {
28
- this.isShadowRoot = "open";
29
- }
30
- draw(e, b, u) {
31
- let d = document.createDocumentFragment(), r = document.createElement("div");
32
- r.classList.add("native-radio"), this.color && r.classList.add(this.color), this.input = document.createElement("input"), this.input.type = "radio", this.input.id = "radio", this.input.name = this.name + "-radio", this.input.checked = this.hasAttribute("checked"), this.input.disabled = this.hasAttribute("disabled"), this.input.indeterminate = this.hasAttribute("indeterminate");
33
- let o = document.createElement("label");
34
- return o.htmlFor = "radio", o.innerHTML = "<slot></slot>", r.appendChild(this.input), r.appendChild(o), d.appendChild(r), d;
35
- }
36
- afterDraw() {
37
- this.hasAttribute("disabled") || (n.addListener(this, "click", "wje-radio:change"), n.addListener(this, "click", "wje-radio:input"));
38
- }
39
- disconnectedCallback() {
40
- n.removeElement(this);
41
- }
42
- }
43
- c.define("wje-radio", c);
44
- export {
45
- c as default
46
- };
package/dist/wje-rate.js DELETED
@@ -1,260 +0,0 @@
1
- var u = Object.defineProperty;
2
- var d = (r, o, e) => o in r ? u(r, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[o] = e;
3
- var n = (r, o, e) => (d(r, typeof o != "symbol" ? o + "" : o, e), e);
4
- import v from "./wje-element.js";
5
- const p = ":host{--wje-rate-gap: .25rem;display:flex}.native-rate{position:relative;display:flex;gap:var(--wje-rate-gap)}.wje-rate-icon{position:relative;cursor:pointer}.selected{color:var(--wje-color-danger)}:host(:not([readonly])) .wje-rate-icon:hover{transform:scale(1.2)}.half wje-icon:first-child{color:var(--wje-color)}.half wje-icon:last-child{color:currentColor;position:absolute;top:0;left:0}:host([disabled]) .native-rate{pointer-events:none;opacity:.5}";
6
- class c extends v {
7
- /**
8
- * Creates an instance of Rate.
9
- *
10
- * @constructor
11
- */
12
- constructor() {
13
- super();
14
- n(this, "className", "Rate");
15
- /**
16
- * Event handler for the mouse enter event.
17
- *
18
- * @param {Event} e - The event.
19
- */
20
- n(this, "onMouseEnter", (e) => {
21
- e.preventDefault(), this.hoverValue = this.getValueFromXPosition(e.clientX), this.changeRate();
22
- });
23
- /**
24
- * Event handler for the mouse leave event.
25
- *
26
- * @param {Event} e - The event.
27
- */
28
- n(this, "onMouseLeave", (e) => {
29
- e.preventDefault(), this.hoverValue = 0, this.changeRate();
30
- });
31
- /**
32
- * Event handler for the mouse move event.
33
- *
34
- * @param {Event} e - The event.
35
- */
36
- n(this, "onMouseMove", (e) => {
37
- e.preventDefault();
38
- let i = this.getValueFromXPosition(e.clientX);
39
- i != this.hoverValue && (this.hoverValue = i, this.changeRate());
40
- });
41
- /**
42
- * Event handler for the touch start event.
43
- *
44
- * @param {Event} e - The event.
45
- */
46
- n(this, "onTouchStart", (e) => {
47
- e.preventDefault(), this.hoverValue = this.getValueFromXPosition(e.touches[0].clientX), this.changeRate();
48
- });
49
- /**
50
- * Event handler for the touch end event.
51
- *
52
- * @param {Event} e - The event.
53
- */
54
- n(this, "onTouchEnd", (e) => {
55
- e.preventDefault(), this.hoverValue = 0, this.changeRate();
56
- });
57
- /**
58
- * Event handler for the touch move event.
59
- *
60
- * @param {Event} e - The event.
61
- */
62
- n(this, "onTouchMove", (e) => {
63
- e.preventDefault(), this.hoverValue = this.getValueFromXPosition(e.touches[0].clientX), this.changeRate();
64
- });
65
- /**
66
- * Event handler for the click event.
67
- *
68
- * @param {Event} e - The event.
69
- */
70
- n(this, "onClick", (e) => {
71
- e.preventDefault(), this.value = +this.hoverValue;
72
- });
73
- }
74
- /**
75
- * Sets the precision of the rating component.
76
- *
77
- * @param {number} value - The value to set.
78
- */
79
- set precision(e) {
80
- this.setAttribute("precision", e);
81
- }
82
- /**
83
- * Gets the precision of the rating component.
84
- *
85
- * @returns {number} The value of the precision.
86
- */
87
- get precision() {
88
- return this.hasAttribute("precision") ? +this.getAttribute("precision") : 1;
89
- }
90
- /**
91
- * Sets the maximum value of the rating component.
92
- *
93
- * @param {number} value - The value to set.
94
- */
95
- set max(e) {
96
- this.setAttribute("max", e);
97
- }
98
- /**
99
- * Gets the maximum value of the rating component.
100
- *
101
- * @returns {number} The value of the maximum value.
102
- */
103
- get max() {
104
- return this.hasAttribute("icons") ? this.icons.length : +this.getAttribute("max");
105
- }
106
- /**
107
- * Sets the icons of the rating component.
108
- *
109
- * @param {Array<string>} value - The value to set.
110
- */
111
- set icons(e) {
112
- return e;
113
- }
114
- /**
115
- * Gets the icons of the rating component.
116
- *
117
- * @returns {Array<string>} The value of the icons.
118
- */
119
- get icons() {
120
- return this.hasAttribute("icons") ? JSON.parse(this.getAttribute("icons").replace(/'/g, '"')) : ["star"];
121
- }
122
- /**
123
- * Sets the value of the rating component.
124
- *
125
- * @param {number} value - The value to set.
126
- */
127
- set value(e) {
128
- this.setAttribute("value", e);
129
- }
130
- /**
131
- * Gets the value of the rating component.
132
- *
133
- * @returns {number} The value of the value.
134
- */
135
- get value() {
136
- return this.hasAttribute("value") ? +this.getAttribute("value") : 0;
137
- }
138
- /**
139
- * Returns the CSS styles for the component.
140
- *
141
- * @static
142
- * @returns {CSSStyleSheet}
143
- */
144
- static get cssStyleSheet() {
145
- return p;
146
- }
147
- /**
148
- * Returns the list of attributes to observe for changes.
149
- *
150
- * @static
151
- * @returns {Array<string>}
152
- */
153
- static get observedAttributes() {
154
- return ["is-hover"];
155
- }
156
- /**
157
- * Called when an attribute changes.
158
- *
159
- * @param {string} name - The name of the attribute.
160
- * @param {string} old - The old value of the attribute.
161
- * @param {string} newName - The new value of the attribute.
162
- */
163
- attributeChangedCallback(e, i, t) {
164
- }
165
- /**
166
- * Sets up the attributes for the component.
167
- */
168
- setupAttributes() {
169
- this.isShadowRoot = "open";
170
- }
171
- /**
172
- * Draws the component.
173
- *
174
- * @param {Object} context - The context for drawing.
175
- * @param {Object} store - The store for drawing.
176
- * @param {Object} params - The parameters for drawing.
177
- * @returns {DocumentFragment}
178
- */
179
- draw(e, i, t) {
180
- let a = document.createDocumentFragment(), s = document.createElement("div");
181
- if (s.setAttribute("part", "native"), s.classList.add("native-rate"), this.native = s, this.hasAttribute("icons")) {
182
- let h = this.icons;
183
- for (let l = 0; l < h.length; l++)
184
- s.appendChild(this.createIcons(l));
185
- } else
186
- for (let h = 0; h < this.max; h++)
187
- s.appendChild(this.createIcons(h));
188
- return this.changeRate(), a.appendChild(s), a;
189
- }
190
- /**
191
- * Adds event listeners after the component is drawn.
192
- */
193
- afterDraw() {
194
- this.hasAttribute("disabled") || this.hasAttribute("readonly") || (this.addEventListener("mouseenter", this.onMouseEnter), this.addEventListener("mouseleave", this.onMouseLeave), this.addEventListener("mousemove", this.onMouseMove), this.addEventListener("touchstart", this.onTouchStart), this.addEventListener("touchend", this.onTouchEnd), this.addEventListener("touchmove", this.onTouchMove), this.addEventListener("click", this.onClick));
195
- }
196
- /**
197
- * Creates the icons for the rating component.
198
- *
199
- * @param {number} i - The index of the icon.
200
- * @returns {Element} The icon element.
201
- */
202
- createIcons(e) {
203
- let i = document.createElement("div");
204
- i.classList.add("wje-rate-icon");
205
- let t = this.getIcons(e);
206
- if (i.appendChild(t), this.value > e && this.value < e + 1) {
207
- let a = t.cloneNode(!0);
208
- i.appendChild(a);
209
- }
210
- return i;
211
- }
212
- /**
213
- * Changes the rate of the rating component.
214
- */
215
- changeRate() {
216
- const e = this.native.children, i = this.value !== this.hoverValue && this.hoverValue !== 0 && this.hoverValue !== void 0 ? this.hoverValue : this.value;
217
- for (let t = 0; t < e.length; t++)
218
- if (e[t].classList.remove("selected", "hovered"), e[t].children.length > 1 && (e[t].classList.remove("half"), e[t].querySelector("wje-icon:first-child").removeAttribute("style"), e[t].querySelector("wje-icon:last-child").remove()), t < i && e[t].classList.add("selected"), i > t && i < t + 1 && e[t].children.length === 1) {
219
- let a = e[t].querySelector("wje-icon").cloneNode(!0);
220
- e[t].appendChild(a);
221
- let s = (i - t) * 100;
222
- e[t].classList.add("half"), e[t].querySelector("wje-icon:first-child").style.clipPath = `inset(0 0 0 ${s}%)`, e[t].querySelector("wje-icon:last-child").style.clipPath = `inset(0 ${s}% 0 0)`;
223
- }
224
- }
225
- /**
226
- * Returns the icons for the rating component.
227
- *
228
- * @param {number} index - The index of the icon.
229
- * @returns {Element} The icon element.
230
- */
231
- getIcons(e) {
232
- let i = document.createElement("wje-icon");
233
- return i.setAttribute("name", this.max ? this.icons[0] : this.icons[e]), i;
234
- }
235
- /**
236
- * Returns the value from the x position.
237
- *
238
- * @param {number} coordinate - The x coordinate.
239
- * @returns {number} The value.
240
- */
241
- getValueFromXPosition(e) {
242
- const { left: i, right: t, width: a } = this.native.getBoundingClientRect(), s = this.roundToPrecision((e - i) / a * this.max, this.precision);
243
- return Math.min(Math.max(s, 0), this.max);
244
- }
245
- /**
246
- * Rounds a number to the given precision.
247
- *
248
- * @param {number} numberToRound - The number to round.
249
- * @param {number} precision - The precision.
250
- * @returns {number} The rounded number.
251
- */
252
- roundToPrecision(e, i = 0.5) {
253
- const t = 1 / i;
254
- return Math.ceil(e * t) / t;
255
- }
256
- }
257
- c.define("wje-rate", c);
258
- export {
259
- c as default
260
- };
@@ -1,85 +0,0 @@
1
- var h = Object.defineProperty;
2
- var v = (n, i, e) => i in n ? h(n, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[i] = e;
3
- var d = (n, i, e) => (v(n, typeof i != "symbol" ? i + "" : i, e), e);
4
- import f from "./wje-element.js";
5
- import { L as p } from "./localize-DVuO3S17.js";
6
- class l extends f {
7
- /**
8
- * Creates an instance of RelativeTime.
9
- *
10
- * @constructor
11
- */
12
- constructor() {
13
- super();
14
- d(this, "className", "RelativeTime");
15
- this.localizer = new p(this);
16
- }
17
- /**
18
- * Gets the ISO date of the relative time component.
19
- *
20
- * @returns {string} The ISO date.
21
- */
22
- get dateISO() {
23
- let e = /* @__PURE__ */ new Date(), t = this.getAttribute("date");
24
- return this.hasAttribute("date") && (this.isISODate(t) ? t = t : t = +t * 1e3, e = new Date(t)), e.toISOString();
25
- }
26
- /**
27
- * Returns the list of attributes to observe for changes.
28
- *
29
- * @static
30
- * @returns {Array<string>}
31
- */
32
- static get observedAttributes() {
33
- return [""];
34
- }
35
- /**
36
- * Sets up the attributes for the component.
37
- */
38
- setupAttributes() {
39
- this.isShadowRoot = "open";
40
- }
41
- /**
42
- * Draws the component.
43
- *
44
- * @param {Object} context - The context for drawing.
45
- * @param {Object} store - The store for drawing.
46
- * @param {Object} params - The parameters for drawing.
47
- * @returns {DocumentFragment}
48
- */
49
- draw(e, t, u) {
50
- let r = document.createDocumentFragment(), a = document.createElement("div");
51
- return a.setAttribute("part", "native"), a.classList.add("native-relative-time"), a.innerText = this.getRelativeTimeString(this.dateISO), r.appendChild(a), r;
52
- }
53
- /**
54
- * Returns the relative time string for the given date.
55
- *
56
- * @param {string} date - The date.
57
- * @param {string} lang - The language.
58
- * @returns {string} The relative time string.
59
- */
60
- getRelativeTimeString(e, t = navigator.language) {
61
- const r = new Date(e).getTime(), a = Math.round((r - Date.now()) / 1e3), o = [
62
- 60,
63
- 3600,
64
- 86400,
65
- 86400 * 7,
66
- 86400 * 30,
67
- 86400 * 365,
68
- 1 / 0
69
- ], m = ["second", "minute", "hour", "day", "week", "month", "year"], s = o.findIndex((g) => g > Math.abs(a)), c = s ? o[s - 1] : 1;
70
- return this.localizer.relativeTime(Math.floor(a / c), m[s], { numeric: "auto" });
71
- }
72
- /**
73
- * Checks if the given string is an ISO date.
74
- *
75
- * @param {string} str - The string to check.
76
- * @returns {boolean} True if the string is an ISO date, false otherwise.
77
- */
78
- isISODate(e) {
79
- return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$/.test(e);
80
- }
81
- }
82
- l.define("wje-relative-time", l);
83
- export {
84
- l as default
85
- };
@@ -1,27 +0,0 @@
1
- var l = Object.defineProperty;
2
- var i = (t, e, r) => e in t ? l(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var d = (t, e, r) => (i(t, typeof e != "symbol" ? e + "" : e, r), r);
4
- import c from "./wje-element.js";
5
- const m = ".dropzone{border:1px dashed lightgrey;border-radius:var(--wje-border-radius-small);margin:.5rem;display:flex;flex-direction:column;align-items:center;overflow:hidden;justify-content:center;min-height:250px}";
6
- class s extends c {
7
- constructor() {
8
- super();
9
- d(this, "className", "ReorderDropzone");
10
- }
11
- static get cssStyleSheet() {
12
- return m;
13
- }
14
- setupAttributes() {
15
- this.isShadowRoot = "open";
16
- }
17
- draw(r, p, u) {
18
- let n = document.createDocumentFragment(), o = document.createElement("div");
19
- o.classList.add("dropzone");
20
- let a = document.createElement("slot");
21
- return o.appendChild(a), n.appendChild(o), n;
22
- }
23
- }
24
- s.define("wje-reorder-dropzone", s);
25
- export {
26
- s as default
27
- };