wj-elements 0.0.11 → 0.0.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 (79) hide show
  1. package/dist/localize-20081fd1.js +55 -0
  2. package/dist/router-links-26e4a166.js +204 -0
  3. package/dist/style.css +2243 -2
  4. package/dist/wj-animation.js +35 -23
  5. package/dist/wj-aside.js +22 -16
  6. package/dist/wj-avatar.js +49 -30
  7. package/dist/wj-badge.js +22 -18
  8. package/dist/wj-breadcrumb.js +102 -50
  9. package/dist/wj-breadcrumbs.js +36 -19
  10. package/dist/wj-button-group.js +36 -22
  11. package/dist/wj-button.js +104 -39
  12. package/dist/wj-card-content.js +18 -14
  13. package/dist/wj-card-controls.js +18 -14
  14. package/dist/wj-card-header.js +20 -14
  15. package/dist/wj-card-subtitle.js +19 -15
  16. package/dist/wj-card-title.js +18 -14
  17. package/dist/wj-card.js +20 -14
  18. package/dist/wj-carousel-item.js +22 -16
  19. package/dist/wj-carousel.js +169 -92
  20. package/dist/wj-checkbox.js +46 -24
  21. package/dist/wj-chip.js +39 -21
  22. package/dist/wj-col.js +31 -17
  23. package/dist/wj-color-picker.js +877 -509
  24. package/dist/wj-container.js +20 -16
  25. package/dist/wj-copy-button.js +112 -64
  26. package/dist/wj-dialog.js +68 -42
  27. package/dist/wj-divider.js +20 -14
  28. package/dist/wj-dropdown.js +29 -17
  29. package/dist/wj-element.js +415 -241
  30. package/dist/wj-fetchAndParseCSS.js +49 -32
  31. package/dist/wj-file-upload-item.js +64 -38
  32. package/dist/wj-file-upload.js +237 -137
  33. package/dist/wj-footer.js +18 -14
  34. package/dist/wj-form.js +18 -14
  35. package/dist/wj-format-digital.js +40 -25
  36. package/dist/wj-grid.js +20 -16
  37. package/dist/wj-header.js +22 -16
  38. package/dist/wj-icon-picker.js +122 -68
  39. package/dist/wj-icon.js +144 -64
  40. package/dist/wj-img-comparer.js +72 -41
  41. package/dist/wj-img.js +31 -19
  42. package/dist/wj-infinite-scroll.js +90 -52
  43. package/dist/wj-input-file.js +50 -27
  44. package/dist/wj-input.js +169 -70
  45. package/dist/wj-item.js +34 -17
  46. package/dist/wj-label.js +21 -19
  47. package/dist/wj-list.js +20 -15
  48. package/dist/wj-main.js +18 -14
  49. package/dist/wj-masonry.js +140 -83
  50. package/dist/wj-master.js +492 -350
  51. package/dist/wj-menu-button.js +19 -15
  52. package/dist/wj-menu-item.js +150 -64
  53. package/dist/wj-menu-label.js +21 -17
  54. package/dist/wj-menu.js +24 -18
  55. package/dist/wj-popup.js +1140 -712
  56. package/dist/wj-progress-bar.js +100 -40
  57. package/dist/wj-radio-group.js +38 -25
  58. package/dist/wj-radio.js +46 -22
  59. package/dist/wj-rate.js +121 -71
  60. package/dist/wj-relative-time.js +48 -24
  61. package/dist/wj-route.js +11 -8
  62. package/dist/wj-router-link.js +22 -17
  63. package/dist/wj-router-outlet.js +135 -71
  64. package/dist/wj-routerx.js +1124 -641
  65. package/dist/wj-row.js +21 -19
  66. package/dist/wj-slider.js +97 -55
  67. package/dist/wj-split-view.js +81 -43
  68. package/dist/wj-store.js +195 -110
  69. package/dist/wj-textarea.js +86 -37
  70. package/dist/wj-thumbnail.js +19 -15
  71. package/dist/wj-toast.js +87 -34
  72. package/dist/wj-toggle.js +42 -24
  73. package/dist/wj-toolbar-action.js +27 -16
  74. package/dist/wj-toolbar.js +26 -19
  75. package/dist/wj-tooltip.js +40 -24
  76. package/dist/wj-visually-hidden.js +18 -14
  77. package/package.json +1 -1
  78. package/dist/localize-762a9f0f.js +0 -43
  79. package/dist/router-links-e0087f84.js +0 -146
@@ -1,43 +1,60 @@
1
- let o = [];
2
- function f(n) {
3
- const t = /@keyframes\s+([\w-]+)\s*{([\s\S]+?})\s*}/g;
4
- let e, s = [];
5
- for (; (e = t.exec(n)) !== null; ) {
6
- let r = e[1], a = e[2].trim(), i = l(a);
7
- s.push({ name: r, keyframes: i });
1
+ let animations = [];
2
+ function parseCSS(css) {
3
+ const keyframesRegex = /@keyframes\s+([\w-]+)\s*{([\s\S]+?})\s*}/g;
4
+ let match;
5
+ let localAnimations = [];
6
+ while ((match = keyframesRegex.exec(css)) !== null) {
7
+ let name = match[1];
8
+ let frames = match[2].trim();
9
+ let keyframes = parseKeyframes(frames);
10
+ localAnimations.push({ name, keyframes });
8
11
  }
9
- return s;
12
+ return localAnimations;
10
13
  }
11
- function l(n) {
12
- const t = /([\d%]+)\s*{([\s\S]+?)}/g;
13
- let e, s = [];
14
- for (; (e = t.exec(n)) !== null; ) {
15
- let r = parseFloat(e[1]) / 100, a = c(e[2]), i = {
16
- offset: r,
17
- ...a
14
+ function parseKeyframes(frames) {
15
+ const frameRegex = /([\d%]+)\s*{([\s\S]+?)}/g;
16
+ let match;
17
+ let keyframes = [];
18
+ while ((match = frameRegex.exec(frames)) !== null) {
19
+ let offset = parseFloat(match[1]) / 100;
20
+ let properties = parseProperties(match[2]);
21
+ let keyframeObject = {
22
+ offset,
23
+ ...properties
18
24
  };
19
- s.push(i);
25
+ keyframes.push(keyframeObject);
20
26
  }
21
- return s.sort((r, a) => r.offset - a.offset), s;
27
+ keyframes.sort((a, b) => a.offset - b.offset);
28
+ return keyframes;
22
29
  }
23
- function c(n) {
24
- const t = {};
25
- return n.split(";").forEach((e) => {
26
- const [s, r] = e.split(":").map((a) => a.trim());
27
- s && r && (s === "animation-timing-function" ? t.easing = r : t[s] = r);
28
- }), t;
30
+ function parseProperties(propertiesString) {
31
+ const properties = {};
32
+ propertiesString.split(";").forEach((property) => {
33
+ const [key, value] = property.split(":").map((part) => part.trim());
34
+ if (key && value) {
35
+ if (key === "animation-timing-function") {
36
+ properties["easing"] = value;
37
+ } else {
38
+ properties[key] = value;
39
+ }
40
+ }
41
+ });
42
+ return properties;
29
43
  }
30
- async function m(n) {
44
+ async function fetchAndParseCSS(url) {
31
45
  try {
32
- if (o.length > 0)
33
- return o;
34
- const e = await (await fetch(n)).text();
35
- return o = f(e), o;
36
- } catch (t) {
37
- console.error("Error:", t);
46
+ if (animations.length > 0) {
47
+ return animations;
48
+ }
49
+ const response = await fetch(url);
50
+ const cssText = await response.text();
51
+ animations = parseCSS(cssText);
52
+ return animations;
53
+ } catch (error) {
54
+ console.error("Error:", error);
38
55
  }
39
56
  }
40
57
  export {
41
- o as animations,
42
- m as fetchAndParseCSS
58
+ animations,
59
+ fetchAndParseCSS
43
60
  };
@@ -1,63 +1,89 @@
1
- var h = Object.defineProperty;
2
- var g = (a, t, e) => t in a ? h(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
- var c = (a, t, e) => (g(a, typeof t != "symbol" ? t + "" : t, e), e);
4
- import w from "./wj-element.js";
5
- import { L as b } from "./localize-762a9f0f.js";
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import WJElement from "./wj-element.js";
8
+ import { L as Localizer } from "./localize-20081fd1.js";
6
9
  import "./wj-store.js";
7
- const f = `:host{width:100%}.native-file-upload-item{display:grid;grid-template-columns:auto 1fr 1fr;grid-template-rows:auto auto auto;gap:0 .5rem;grid-template-areas:"image name actions" "image size actions" "progress progress progress";padding:.5rem;border:1px solid var(--wj-border-color);border-radius:var(--wj-border-radius-medium)}.image{grid-area:image;align-items:center;display:flex}::slotted([slot=img]){--wj-img-border-radius: var(--wj-border-radius-medium) !important}.name{grid-area:name;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:700}.size{grid-area:size;display:flex}.actions{grid-area:actions;display:flex;align-items:center;justify-content:flex-end}.file-progress{grid-area:progress}wj-icon{margin-right:.25rem}wj-img{margin-right:.25rem}.file-info>span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}wj-slider{flex-basis:100%;margin-top:.5rem}::part(slider)::-webkit-slider-thumb{visibility:hidden}::part(slider)::-moz-range-thumb{visibility:hidden}::part(slider)::-ms-thumb{visibility:hidden}wj-img{width:50px;height:50px;display:flex;align-items:center;padding:.25rem;border:1px solid var(--wj-border-color);border-radius:var(--wj-border-radius-medium)}
8
- `;
9
- class v extends w {
10
+ const styles = '/*\n[ WJ File Upload Item ]\n*/\n:host {\n width: 100%;\n}\n\n.native-file-upload-item {\n display: grid;\n grid-template-columns: auto 1fr 1fr;\n grid-template-rows: auto auto auto;\n gap: 0 0.5rem;\n grid-template-areas: "image name actions" "image size actions" "progress progress progress";\n padding: 0.5rem;\n border: 1px solid var(--wj-border-color);\n border-radius: var(--wj-border-radius-medium);\n}\n\n.image {\n grid-area: image;\n align-items: center;\n display: flex;\n}\n\n::slotted([slot=img]) {\n --wj-img-border-radius: var(--wj-border-radius-medium) !important;\n}\n\n.name {\n grid-area: name;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n font-weight: bold;\n}\n\n.size {\n grid-area: size;\n display: flex;\n}\n\n.actions {\n grid-area: actions;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n}\n\n.file-progress {\n grid-area: progress;\n}\n\nwj-icon {\n margin-right: 0.25rem;\n}\n\nwj-img {\n margin-right: 0.25rem;\n}\n\n.file-info > span {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\nwj-slider {\n flex-basis: 100%;\n margin-top: 0.5rem;\n}\n\n::part(slider)::-webkit-slider-thumb {\n visibility: hidden;\n}\n::part(slider)::-moz-range-thumb {\n visibility: hidden;\n}\n::part(slider)::-ms-thumb {\n visibility: hidden;\n}\n\nwj-img {\n width: 50px;\n height: 50px;\n display: flex;\n align-items: center;\n padding: 0.25rem;\n border: 1px solid var(--wj-border-color);\n border-radius: var(--wj-border-radius-medium);\n}';
11
+ class FileUploadItem extends WJElement {
10
12
  constructor() {
11
13
  super();
12
- c(this, "className", "FileUploadItem");
13
- c(this, "onDelete", () => {
14
+ __publicField(this, "className", "FileUploadItem");
15
+ __publicField(this, "onDelete", () => {
14
16
  this.remove();
15
17
  });
16
- this.localizer = new b(this);
18
+ this.localizer = new Localizer(this);
17
19
  }
18
20
  static get cssStyleSheet() {
19
- return f;
21
+ return styles;
20
22
  }
21
23
  static get observedAttributes() {
22
24
  return ["uploaded"];
23
25
  }
24
- attributeChangedCallback(e, i, m) {
25
- if (e === "uploaded" && this.drawingStatus === "AFTER") {
26
+ attributeChangedCallback(name, old, newName) {
27
+ if (name === "uploaded" && this.drawingStatus === "AFTER") {
26
28
  this.uploadedEl.setAttribute("value", this.uploaded);
27
- let r = +this.uploaded / +this.size * 100 || 0;
28
- this.sliderEl.setAttribute("value", Math.round(r, 0));
29
+ let progress = +this.uploaded / +this.size * 100 || 0;
30
+ this.sliderEl.setAttribute("value", Math.round(progress, 0));
29
31
  }
30
32
  }
31
33
  setupAttributes() {
32
34
  this.isShadowRoot = "open";
33
35
  }
34
36
  draw() {
35
- let e = document.createDocumentFragment(), i = document.createElement("div");
36
- i.classList.add("native-file-upload-item");
37
- let m = document.createElement("slot");
38
- m.setAttribute("name", "img");
39
- let r = document.createElement("div");
40
- r.classList.add("image");
41
- let p = document.createElement("span");
42
- p.classList.add("name"), p.innerText = this.name;
43
- let d = document.createElement("slot");
44
- d.classList.add("actions"), d.setAttribute("name", "action");
45
- let l = document.createElement("wj-button");
46
- l.setAttribute("fill", "link"), l.setAttribute("size", "small"), l.innerHTML = '<wj-icon name="x" size="small"></wj-icon>';
47
- let o = document.createElement("span");
48
- o.classList.add("size");
49
- let n = document.createElement("wj-format-digital");
50
- n.setAttribute("value", this.uploaded || 0), n.innerHTML = `<span slot="start">${this.localizer.translate("wj.file.upload.uploaded")}</span>`;
51
- let u = document.createElement("wj-format-digital");
52
- u.setAttribute("value", this.size || 0), u.innerHTML = `<span slot="start">&nbsp;${this.localizer.translate("wj.file.upload.from")} </span>`;
53
- let s = document.createElement("wj-slider");
54
- return s.classList.add("file-progress"), s.setAttribute("id", "id-" + this.lastModified), s.setAttribute("value", this.progress || 0), s.setAttribute("color", "success"), r.appendChild(m), d.appendChild(l), o.appendChild(n), o.appendChild(u), i.appendChild(r), i.appendChild(p), i.appendChild(o), i.appendChild(d), i.appendChild(s), e.appendChild(i), this.button = l, this.uploadedEl = n, this.sliderEl = s, e;
37
+ let fragment = document.createDocumentFragment();
38
+ let native = document.createElement("div");
39
+ native.classList.add("native-file-upload-item");
40
+ let slot = document.createElement("slot");
41
+ slot.setAttribute("name", "img");
42
+ let image = document.createElement("div");
43
+ image.classList.add("image");
44
+ let name = document.createElement("span");
45
+ name.classList.add("name");
46
+ name.innerText = this.name;
47
+ let actions = document.createElement("slot");
48
+ actions.classList.add("actions");
49
+ actions.setAttribute("name", "action");
50
+ let button = document.createElement("wj-button");
51
+ button.setAttribute("fill", "link");
52
+ button.setAttribute("size", "small");
53
+ button.innerHTML = `<wj-icon name="x" size="small"></wj-icon>`;
54
+ let sizeWrapper = document.createElement("span");
55
+ sizeWrapper.classList.add("size");
56
+ let uploaded = document.createElement("wj-format-digital");
57
+ uploaded.setAttribute("value", this.uploaded || 0);
58
+ uploaded.innerHTML = `<span slot="start">${this.localizer.translate("wj.file.upload.uploaded")}</span>`;
59
+ let size = document.createElement("wj-format-digital");
60
+ size.setAttribute("value", this.size || 0);
61
+ size.innerHTML = `<span slot="start">&nbsp;${this.localizer.translate("wj.file.upload.from")} </span>`;
62
+ let slider = document.createElement("wj-slider");
63
+ slider.classList.add("file-progress");
64
+ slider.setAttribute("id", "id-" + this.lastModified);
65
+ slider.setAttribute("value", this.progress || 0);
66
+ slider.setAttribute("color", "success");
67
+ image.appendChild(slot);
68
+ actions.appendChild(button);
69
+ sizeWrapper.appendChild(uploaded);
70
+ sizeWrapper.appendChild(size);
71
+ native.appendChild(image);
72
+ native.appendChild(name);
73
+ native.appendChild(sizeWrapper);
74
+ native.appendChild(actions);
75
+ native.appendChild(slider);
76
+ fragment.appendChild(native);
77
+ this.button = button;
78
+ this.uploadedEl = uploaded;
79
+ this.sliderEl = slider;
80
+ return fragment;
55
81
  }
56
82
  afterDraw() {
57
83
  this.button.addEventListener("wj:button-click", this.onDelete);
58
84
  }
59
85
  }
60
- customElements.get("wj-file-upload-item") || window.customElements.define("wj-file-upload-item", v);
86
+ customElements.get("wj-file-upload-item") || window.customElements.define("wj-file-upload-item", FileUploadItem);
61
87
  export {
62
- v as FileUploadItem
88
+ FileUploadItem
63
89
  };