wj-elements 0.1.11 → 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,221 +0,0 @@
1
- var w = Object.defineProperty;
2
- var g = (l, o, e) => o in l ? w(l, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[o] = e;
3
- var p = (l, o, e) => (g(l, typeof o != "symbol" ? o + "" : o, e), e);
4
- import b, { event as j } from "./wje-element.js";
5
- import u from "./wje-infinite-scroll.js";
6
- import v from "./wje-input.js";
7
- import f from "./wje-tooltip.js";
8
- import "./wje-popup.js";
9
- import { P as k } from "./popup.element-CpEjis9f.js";
10
- const x = ":host{--wje-icon-picker-radius: var(--wje-border-radius-small);--wje-icon-picker-icon-size: 1.5rem;--wje-icon-picker-border-width: 1px;--wje-icon-picker-border-style: solid;--wje-icon-picker-border-color: var(--wje-border-color);--wje-icon-picker-padding: .25rem;padding:0 1rem}.anchor{width:var(--wje-icon-picker-icon-size);height:var(--wje-icon-picker-icon-size);padding:var(--wje-icon-picker-padding);border-width:var(--wje-icon-picker-border-width);border-style:var(--wje-icon-picker-border-style);border-color:var(--wje-icon-picker-border-color);box-sizing:border-box;border-radius:var(--wje-icon-picker-radius)}.picker{width:320px;height:271px;box-shadow:0 0 5px #0000000d,0 5px 20px #0000001a;border-radius:var(--wje-icon-picker-radius);border-width:var(--wje-icon-picker-border-width);border-style:var(--wje-icon-picker-border-style);border-color:var(--wje-icon-picker-border-color);overflow:auto;padding:1rem;background:var(--wje-background)}.icon-items{--icon-min-width: 2rem;display:grid;grid-gap:.5rem;grid-template-columns:repeat(auto-fit,minmax(var(--icon-min-width),1fr))}.icon-item{box-sizing:border-box;display:flex;align-items:center;justify-content:center;text-align:center;color:inherit;padding:.25rem;min-height:var(--wje-icon-picker-icon-size);min-width:var(--wje-icon-picker-icon-size);text-decoration:none}.icon-item:hover{border-radius:.25rem;background:var(--wje-border-color)}.wje-size{--wje-icon-size: 24px !important}icon-item svg{width:var(--wje-icon-picker-icon-size);height:var(--wje-icon-picker-icon-size)}wje-input{--wje-input-border-radius: 4px;--wje-input-margin-bottom: 0}wje-infinite-scroll{margin-top:1rem}wje-select{--wje-select-border-width: 0 0 1px 0 !important;--wje-select-border-radius: 0 !important;margin-bottom:1rem}.anchor wje-icon{--wje-icon-size: 100% !important}";
11
- class m extends b {
12
- /**
13
- * Creates an instance of IconPicker.
14
- *
15
- * @constructor
16
- */
17
- constructor() {
18
- super();
19
- /**
20
- * Dependencies of the IconPicker component.
21
- *
22
- * @property {Object} depandencies
23
- */
24
- p(this, "depandencies", {
25
- "wje-input": v,
26
- "wje-infinite-scroll": u,
27
- "wje-tooltip": f,
28
- "wje-popup": k
29
- });
30
- p(this, "className", "IconPicker");
31
- /**
32
- * Event handler for searching icons.
33
- *
34
- * @param {Event} e - The event.
35
- */
36
- p(this, "searchIcon", (e) => {
37
- this.infiniteScroll.unScrollEvent(), this.infiniteScroll.setCustomData = (i = 0) => {
38
- let t = this.tags.filter((n) => n.tags.includes(e.detail.value));
39
- return {
40
- data: t,
41
- page: i,
42
- size: this.size,
43
- totalPages: Math.round(t.length / this.size)
44
- };
45
- }, this.clearIconsContainer(), this.infiniteScroll.loadPages();
46
- });
47
- /**
48
- * Closes the component.
49
- */
50
- p(this, "onClose", () => {
51
- this.popup.onHide();
52
- });
53
- /**
54
- * Gets the URL of the tags.
55
- *
56
- * @param {string} path - The path to get the URL of.
57
- * @returns {string} The URL of the tags.
58
- */
59
- p(this, "getTagsUrl", (e) => {
60
- let i = new URL(import.meta.url), t = i.pathname, r = t.substring(0, t.lastIndexOf("/"));
61
- return new URL(i.origin + r + e).href;
62
- });
63
- this.size = 48;
64
- }
65
- /**
66
- * Setter for the markerPosition property.
67
- *
68
- * @param {any} value - The value to set.
69
- */
70
- set markerPosition(e) {
71
- this._markerPosition = e;
72
- }
73
- /**
74
- * Getter for the markerPosition property.
75
- *
76
- * @returns {any} The value of the markerPosition property.
77
- */
78
- get markerPosition() {
79
- return this._markerPosition;
80
- }
81
- /**
82
- * Setter for the swatches property.
83
- *
84
- * @param {any} value - The value to set.
85
- */
86
- set swatches(e) {
87
- this.setAttribute("swatches", e.split(","));
88
- }
89
- /**
90
- * Getter for the swatches property.
91
- *
92
- * @returns {any} The value of the swatches property.
93
- */
94
- get swatches() {
95
- return this._swatches;
96
- }
97
- /**
98
- * Returns the CSS styles for the component.
99
- *
100
- * @static
101
- * @returns {CSSStyleSheet}
102
- */
103
- static get cssStyleSheet() {
104
- return x;
105
- }
106
- /**
107
- * Returns the list of attributes to observe for changes.
108
- *
109
- * @static
110
- * @returns {Array<string>}
111
- */
112
- static get observedAttributes() {
113
- return [];
114
- }
115
- /**
116
- * Sets up the attributes for the component.
117
- */
118
- setupAttributes() {
119
- this.isShadowRoot = "open";
120
- }
121
- /**
122
- * Prepares the component before drawing.
123
- */
124
- async beforeDraw() {
125
- this.tags = Object.values(await this.getTags()), this.category = this.getCategory(this.tags);
126
- }
127
- /**
128
- * Draws the component.
129
- *
130
- * @param {Object} context - The context for drawing.
131
- * @param {Object} store - The store for drawing.
132
- * @param {Object} params - The parameters for drawing.
133
- * @returns {DocumentFragment}
134
- */
135
- draw(e, i, t) {
136
- let r = document.createDocumentFragment(), n = document.createElement("div");
137
- n.classList.add("native-color-picker");
138
- let d = document.createElement("div");
139
- d.setAttribute("slot", "anchor"), d.classList.add("anchor");
140
- let h = document.createElement("div");
141
- h.classList.add("picker");
142
- let s = document.createElement("wje-input");
143
- s.classList.add("input"), s.setAttribute("variant", "standard"), s.setAttribute("placeholder", "type to filter..."), s.setAttribute("clearable", ""), s.addEventListener("wje-input:input", this.searchIcon);
144
- let a = new u();
145
- a.setAttribute("url", this.getTagsUrl("/assets/tags.json")), a.setAttribute("placement", ".icon-items"), a.setAttribute("size", this.size), a.setAttribute("height", "223px"), a.innerHTML = `<div class="icon-items">
146
- <div class="icon-item" iterate>
147
- <wje-tooltip content="{{name}}">
148
- <wje-icon name="{{name}}" size="large"></wje-icon>
149
- </wje-tooltip>
150
- </div>
151
- </div>`, h.appendChild(s), h.appendChild(a);
152
- let c = document.createElement("wje-popup");
153
- return c.setAttribute("placement", this.placement || "bottom-start"), c.setAttribute("offset", this.offset), c.setAttribute("manual", ""), c.appendChild(d), c.appendChild(h), n.appendChild(c), r.appendChild(n), this.popup = c, this.input = s, this.anchor = d, this.picker = h, this.infiniteScroll = a, r;
154
- }
155
- /**
156
- * Called after the component has been drawn.
157
- */
158
- afterDraw() {
159
- this.setupInfiniteScroll(), this.addEventListener("wje-popup:show", (e) => {
160
- this.initial();
161
- }), this.addEventListener("wje-input:clear", (e) => {
162
- this.setupInfiniteScroll(), this.clearIconsContainer(), this.infiniteScroll.scrollEvent(), this.infiniteScroll.loadPages(0);
163
- }), this.addEventListener("wje-infinite-scroll:click-item", (e) => {
164
- const t = e.detail.context.querySelector("wje-icon").getAttribute("name"), r = this.tags.find((d) => d.name === t), n = document.createElement("wje-icon");
165
- n.setAttribute("name", t), r.icon = n, this.value = r, this.anchor.innerHTML = "", this.anchor.appendChild(n), j.dispatchCustomEvent(this, "wje-icon-picker:select", r);
166
- }), this.init = !1;
167
- }
168
- /**
169
- * Initializes the component.
170
- */
171
- initial() {
172
- this.infiniteScroll.scrollEvent();
173
- }
174
- /**
175
- * Sets up the infinite scroll for the component.
176
- */
177
- setupInfiniteScroll() {
178
- this.infiniteScroll.setCustomData = (e = 0) => {
179
- let i = Object.values(this.tags);
180
- return {
181
- data: i.slice(e * this.size, e * this.size + this.size),
182
- page: e,
183
- size: this.size,
184
- totalPages: Math.round(i.length / this.size)
185
- };
186
- };
187
- }
188
- /**
189
- * Gets the category of the tags.
190
- *
191
- * @param {Array} tags - The tags to get the category of.
192
- * @returns {Array} The category of the tags.
193
- */
194
- getCategory(e) {
195
- return [...new Set(e.map((t) => t.category))];
196
- }
197
- /**
198
- * Gets the tags.
199
- *
200
- * @returns {Promise<Array>} The tags.
201
- */
202
- async getTags() {
203
- return (await fetch(this.getTagsUrl("/assets/tags.json"))).json();
204
- }
205
- /**
206
- * Called when the component is disconnected.
207
- */
208
- disconnectedCallback() {
209
- this.init = !1;
210
- }
211
- /**
212
- * Clears the icons container.
213
- */
214
- clearIconsContainer() {
215
- this.context.querySelector(".icon-items").innerHTML = "";
216
- }
217
- }
218
- m.define("wje-icon-picker", m);
219
- export {
220
- m as default
221
- };
package/dist/wje-icon.js DELETED
@@ -1,119 +0,0 @@
1
- var g = Object.defineProperty;
2
- var w = (e, t, r) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var d = (e, t, r) => (w(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- import m from "./wje-element.js";
5
- const n = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
6
- let l;
7
- const j = (e) => c(e) && (e = e.trim(), z(e)) ? e : null, z = (e) => e.length > 0 && /(\/|\.)/.test(e), p = (e) => e.startsWith("data:image/svg+xml"), x = (e) => e.indexOf(";utf8,") !== -1, c = (e) => typeof e == "string", b = (e) => {
8
- const t = document.createElement("div");
9
- t.innerHTML = e;
10
- const r = t.firstElementChild;
11
- return r && r.nodeName.toLowerCase() === "svg" && (r.getAttribute("class"), f(r)) ? t.innerHTML : "";
12
- }, f = (e) => {
13
- if (e.nodeType === 1) {
14
- if (e.nodeName.toLowerCase() === "script")
15
- return !1;
16
- for (let t = 0; t < e.attributes.length; t++) {
17
- const r = e.attributes[t].name;
18
- if (c(r) && r.toLowerCase().indexOf("on") === 0)
19
- return !1;
20
- }
21
- for (let t = 0; t < e.childNodes.length; t++)
22
- if (!f(e.childNodes[t]))
23
- return !1;
24
- }
25
- return !0;
26
- }, y = (e, t) => {
27
- let r = v.get(e);
28
- if (!r)
29
- if (typeof fetch < "u" && typeof document < "u")
30
- if (p(e) && x(e)) {
31
- l || (l = new DOMParser());
32
- const s = l.parseFromString(e, "text/html").querySelector("svg");
33
- return s && n.set(e, s.outerHTML), Promise.resolve();
34
- } else
35
- r = fetch(e).then((o) => {
36
- if (o.ok)
37
- return o.text().then((s) => {
38
- s && t !== !1 && (s = b(s)), n.set(e, s || "");
39
- });
40
- n.set(e, "");
41
- }), v.set(e, r);
42
- else
43
- return n.set(e, ""), Promise.resolve();
44
- return r;
45
- }, k = (e) => {
46
- let t = j(e.src);
47
- return t || (t = L(e.name), t ? S(t, e.hasAttribute("filled")) : null);
48
- }, L = (e) => !c(e) || e.trim() === "" || e.replace(/[a-z]|-|\d/gi, "") !== "" ? null : e, S = (e, t = !1) => {
49
- const r = `/assets/img/icons/${t ? "filled" : "outline"}/${e}.svg`;
50
- let o = new URL(import.meta.url), s = o.pathname, i = s.substring(0, s.lastIndexOf("/"));
51
- return new URL(o.origin + i + r).href;
52
- }, E = '.native-icon{display:flex;align-items:center;width:var(--wje-icon-size);height:var(--wje-icon-size)}svg{width:100%;height:100%;stroke-width:var(--wje-icon-stroke);color:var(--wje-icon-color)}:host([stroke="1"]){--wje-icon-stroke: 1}:host([stroke="1.25"]){--wje-icon-stroke: 1.25}:host([stroke="1.5"]){--wje-icon-stroke: 1.5}:host([stroke="1.75"]){--wje-icon-stroke: 1.75}:host([stroke="2"]){--wje-icon-stroke: 2}:host([size="x-small"]){--wje-icon-size: var(--wje-size-x-small)}:host([size="small"]){--wje-icon-size: var(--wje-size-small)}:host([size="medium"]){--wje-icon-size: var(--wje-size-medium)}:host([size="large"]){--wje-icon-size: var(--wje-size-large)}:host([size="x-large"]){--wje-icon-size: var(--wje-size-x-large)}:host([size="2x-large"]){--wje-icon-size: var(--wje-size-2x-large)}:host([size="3x-large"]){--wje-icon-size: var(--wje-size-3x-large)}:host([size="4x-large"]){--wje-icon-size: var(--wje-size-4x-large)}:host([color="primary"]) .native-icon{color:var(--wje-color-primary-11)}:host([color="complete"]) .native-icon{color:var(--wje-color-complete-11)}:host([color="success"]) .native-icon{color:var(--wje-color-success-11)}:host([color="warning"]) .native-icon{color:var(--wje-color-warning-11)}:host([color="danger"]) .native-icon{color:var(--wje-color-danger-11)}:host([color="info"]) .native-icon{color:var(--wje-color-info-11)}:host([color="menu"]) .native-icon{color:var(--wje-color-contrast-11)}';
53
- class u extends m {
54
- /**
55
- * Creates an instance of IconElement.
56
- *
57
- * @constructor
58
- */
59
- constructor() {
60
- super();
61
- d(this, "className", "Icon");
62
- }
63
- /**
64
- * Returns the CSS styles for the component.
65
- *
66
- * @static
67
- * @returns {CSSStyleSheet}
68
- */
69
- static get cssStyleSheet() {
70
- return E;
71
- }
72
- /**
73
- * Returns the list of attributes to observe for changes.
74
- *
75
- * @static
76
- * @returns {Array<string>}
77
- */
78
- static get observedAttributes() {
79
- return ["name"];
80
- }
81
- /**
82
- * Sets up the attributes for the component.
83
- */
84
- setupAttributes() {
85
- this.isShadowRoot = "open";
86
- }
87
- /**
88
- * Draws the component.
89
- *
90
- * @param {Object} context - The context for drawing.
91
- * @param {Object} store - The store for drawing.
92
- * @param {Object} params - The parameters for drawing.
93
- * @returns {DocumentFragment}
94
- */
95
- draw(r, o, s) {
96
- let i = document.createDocumentFragment();
97
- this.classList.add("lazy-loaded-image", "lazy");
98
- let a = document.createElement("div");
99
- return a.setAttribute("part", "native"), a.classList.add("native-icon"), this.url = k(this), i.appendChild(a), this.native = a, i;
100
- }
101
- /**
102
- * Called after the component has been drawn.
103
- */
104
- afterDraw() {
105
- let r = new IntersectionObserver((o, s) => {
106
- o.forEach((i) => {
107
- i.isIntersecting && (y(this.url).then((a) => {
108
- var h;
109
- this.native.innerHTML = n == null ? void 0 : n.get(this.url), (h = this.native.querySelector("svg")) == null || h.setAttribute("part", "svg");
110
- }), this.classList.remove("lazy"), r.unobserve(i.target));
111
- });
112
- });
113
- r.observe(this.native);
114
- }
115
- }
116
- u.define("wje-icon", u);
117
- export {
118
- u as default
119
- };
@@ -1,111 +0,0 @@
1
- var f = Object.defineProperty;
2
- var h = (i, e, t) => e in i ? f(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var c = (i, e, t) => (h(i, typeof e != "symbol" ? e + "" : e, t), t);
4
- import w from "./wje-element.js";
5
- import g from "./wje-icon.js";
6
- function b(i, e) {
7
- function t(o) {
8
- const d = i.getBoundingClientRect(), r = i.ownerDocument.defaultView, n = d.left + r.pageXOffset, m = d.top + r.pageYOffset, s = o.pageX - n, p = o.pageY - m;
9
- e != null && e.onMove && e.onMove(s, p);
10
- }
11
- function a() {
12
- document.removeEventListener("pointermove", t), document.removeEventListener("pointerup", a), e != null && e.onStop && e.onStop();
13
- }
14
- document.addEventListener("pointermove", t, { passive: !0 }), document.addEventListener("pointerup", a), (e == null ? void 0 : e.initialEvent) instanceof PointerEvent && t(e.initialEvent);
15
- }
16
- const j = ':host{display:inline-block;position:relative;width:100%;border-color:var(--wje-border-color);border-style:solid;border-width:1px}.wje-before,.wje-after{display:block}.wje-after{position:absolute;top:0;left:0;height:100%;width:100%;clip-path:var(--wje-img-compare-clip-path)}.native-split-view{max-width:100%;max-height:100%;overflow:hidden}.wje-divider{display:flex;position:absolute;align-items:center;justify-content:center;z-index:1;background-color:var(--wje-img-compare-divider-background);height:100%;width:var(--wje-img-compare-divider-size);cursor:col-resize;top:0;left:var(--wje-img-compare-divider-left)}.wje-divider:after{display:flex;content:"";position:absolute;height:100%;left:calc(var(--wje-img-compare-divider-area) / -2 + var(--wje-img-compare-divider-size) / 2);width:var(---wje-img-compare-divider-area)}.wje-divider wje-icon{position:absolute;background-color:#fff;padding:.5rem;color:var(--wje-color-dark);border-radius:var(--wje-border-radius-circle);box-shadow:#523f6933 0 0 30px 10px;background:var(--wje-color-white)!important}';
17
- class u extends w {
18
- /**
19
- * Creates an instance of ImgComparer.
20
- *
21
- * @constructor
22
- */
23
- constructor() {
24
- super();
25
- /**
26
- * Dependencies of the ImgComparer component.
27
- *
28
- * @property {Object} depandencies
29
- */
30
- c(this, "depandencies", {
31
- "wje-icon": g
32
- });
33
- c(this, "className", "ImgComparer");
34
- /**
35
- * Handles the drag event.
36
- *
37
- * @param {Event} e - The event.
38
- */
39
- c(this, "handleDrag", (t) => {
40
- const { width: a } = this.native.getBoundingClientRect();
41
- b(this, {
42
- onMove: (o) => {
43
- let d = o / a * 100;
44
- this.position = parseFloat(this.clamp(d, 0, 100).toFixed(2)), this.native.style.setProperty("--wje-img-compare-divider-left", this.position + "%"), this.native.style.setProperty("--wje-img-compare-clip-path", `inset(0 ${100 - this.position}% 0 0)`);
45
- },
46
- initialEvent: t
47
- });
48
- });
49
- /**
50
- * Clamps a number between a minimum and maximum value.
51
- *
52
- * @param {number} num - The number to clamp.
53
- * @param {number} min - The minimum value.
54
- * @param {number} max - The maximum value.
55
- * @returns {number} The clamped number.
56
- */
57
- c(this, "clamp", (t, a, o) => Math.min(Math.max(t, a), o));
58
- }
59
- /**
60
- * Returns the CSS styles for the component.
61
- *
62
- * @static
63
- * @returns {CSSStyleSheet}
64
- */
65
- static get cssStyleSheet() {
66
- return j;
67
- }
68
- /**
69
- * Returns the list of attributes to observe for changes.
70
- *
71
- * @static
72
- * @returns {Array<string>}
73
- */
74
- static get observedAttributes() {
75
- return [];
76
- }
77
- /**
78
- * Sets up the attributes for the component.
79
- */
80
- setupAttributes() {
81
- this.isShadowRoot = "open";
82
- }
83
- /**
84
- * Draws the component.
85
- *
86
- * @param {Object} context - The context for drawing.
87
- * @param {Object} store - The store for drawing.
88
- * @param {Object} params - The parameters for drawing.
89
- * @returns {DocumentFragment}
90
- */
91
- draw(t, a, o) {
92
- let d = document.createDocumentFragment(), r = document.createElement("div");
93
- r.classList.add("native-split-view");
94
- let n = document.createElement("div");
95
- n.classList.add("wje-before");
96
- let m = document.createElement("slot");
97
- m.setAttribute("name", "before");
98
- let s = document.createElement("div");
99
- s.classList.add("wje-after");
100
- let p = document.createElement("slot");
101
- p.setAttribute("name", "after");
102
- let v = document.createElement("wje-icon");
103
- v.setAttribute("name", "arrow-bar-both");
104
- let l = document.createElement("div");
105
- return l.classList.add("wje-divider"), l.setAttribute("part", "divider"), l.addEventListener("mousedown", this.handleDrag, !1), n.appendChild(m), s.appendChild(p), l.appendChild(v), r.appendChild(n), r.appendChild(s), r.appendChild(l), d.appendChild(r), this.native = r, d;
106
- }
107
- }
108
- u.define("wje-img-comparer", u);
109
- export {
110
- u as default
111
- };
package/dist/wje-img.js DELETED
@@ -1,58 +0,0 @@
1
- var l = Object.defineProperty;
2
- var d = (r, e, t) => e in r ? l(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var o = (r, e, t) => (d(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- import n from "./wje-element.js";
5
- const h = "img{display:block;width:var(--wje-img-width, 100%);height:var(--wje-img-height, auto);max-width:100%;object-fit:inherit;border-radius:var(--wje-img-border-radius, 0)}";
6
- class m extends n {
7
- /**
8
- * Creates an instance of Img.
9
- *
10
- * @constructor
11
- */
12
- constructor() {
13
- super();
14
- o(this, "className", "Img");
15
- }
16
- /**
17
- * Returns the CSS styles for the component.
18
- *
19
- * @static
20
- * @returns {CSSStyleSheet}
21
- */
22
- static get cssStyleSheet() {
23
- return h;
24
- }
25
- /**
26
- * Sets up the attributes for the component.
27
- */
28
- setupAttributes() {
29
- this.isShadowRoot = "open";
30
- }
31
- /**
32
- * Draws the component.
33
- *
34
- * @param {Object} context - The context for drawing.
35
- * @param {Object} store - The store for drawing.
36
- * @param {Object} params - The parameters for drawing.
37
- * @returns {DocumentFragment}
38
- */
39
- draw(t, c, g) {
40
- let a = document.createDocumentFragment(), s = document.createElement("img");
41
- return s.setAttribute("src", "./assets/img/image-loader.gif"), s.classList.add("lazy-loaded-image", "lazy"), s.setAttribute("alt", this.alt || ""), this.img = s, a.appendChild(s), a;
42
- }
43
- /**
44
- * Called after the component has been drawn.
45
- */
46
- afterDraw(t, c, g) {
47
- let a = new IntersectionObserver((s, u) => {
48
- s.forEach((i) => {
49
- i.isIntersecting && (i.target.src = this.src, this.classList.remove("lazy"), a.unobserve(i.target));
50
- });
51
- });
52
- a.observe(this.img);
53
- }
54
- }
55
- m.define("wje-img", m);
56
- export {
57
- m as default
58
- };