wj-elements 0.1.4 → 0.1.6

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 (89) 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-Dj9j__Dh.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 -48
  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 -177
  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 -48
  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 -117
  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 -342
  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-route.js +0 -28
  71. package/dist/wje-router-link.js +0 -64
  72. package/dist/wje-router-outlet.js +0 -127
  73. package/dist/wje-routerx.js +0 -1088
  74. package/dist/wje-row.js +0 -58
  75. package/dist/wje-select.js +0 -240
  76. package/dist/wje-slider.js +0 -177
  77. package/dist/wje-split-view.js +0 -112
  78. package/dist/wje-store.js +0 -192
  79. package/dist/wje-tab-group.js +0 -105
  80. package/dist/wje-tab-panel.js +0 -52
  81. package/dist/wje-tab.js +0 -59
  82. package/dist/wje-textarea.js +0 -116
  83. package/dist/wje-thumbnail.js +0 -64
  84. package/dist/wje-toast.js +0 -76
  85. package/dist/wje-toggle.js +0 -94
  86. package/dist/wje-toolbar-action.js +0 -63
  87. package/dist/wje-toolbar.js +0 -61
  88. package/dist/wje-tooltip.js +0 -105
  89. package/dist/wje-visually-hidden.js +0 -56
package/dist/wje-item.js DELETED
@@ -1,45 +0,0 @@
1
- var d = Object.defineProperty;
2
- var l = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var r = (i, t, e) => (l(i, typeof t != "symbol" ? t + "" : t, e), e);
4
- import m from "./wje-element.js";
5
- const p = ':host{--wje-border-width: 0 0 1px 0;--wje-item-background: transparent;--wje-item-background-hover: var(--wje-color-contrast-3);--wje-item-padding-top: 0px;--wje-item-padding-bottom: 0px;--wje-item-padding-end: 0px;--wje-item-padding-start: 0px;--wje-item-inner-border-width: 0 0 1px 0;--wje-item-inner-padding-top: 0px;--wje-item-inner-padding-bottom: 0px;--wje-item-inner-padding-start: 0px;--wje-item-inner-padding-end: 0px;--wje-item-inner-box-shadow: none;--wje-item-min-height: 40px;--wje-item-transition: opacity 15ms linear, background-color 15ms linear;display:block;position:relative;align-items:center;justify-content:space-between;outline:none;color:var(--wje-item-color);text-align:initial;text-decoration:none;overflow:hidden;box-sizing:border-box;width:100%}.item-native{border-radius:var(--wje-item-border-radius);padding-top:var(--wje-item-padding-top);padding-bottom:var(--wje-item-padding-bottom);padding-inline:var(--wje-item-padding-start) var(--wje-item-padding-end);margin:0;display:flex;position:relative;align-items:inherit;justify-content:inherit;width:100%;min-height:var(--wje-item-min-height);transition:var(--wje-item-transition);outline:none;background:var(--wje-item-background);overflow:inherit;box-sizing:border-box;z-index:1;text-decoration:none;color:var(--wje-item-color)}.item-native .item-inner{margin:0;padding:var(--wje-item-inner-padding-top) var(--wje-item-inner-padding-end) var(--wje-item-inner-padding-bottom) var(--wje-item-inner-padding-start);display:flex;position:relative;flex:1 1 0;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--wje-border-width);border-style:var(--wje-border-style);border-color:var(--wje-border-color);box-shadow:var(--wje-item-inner-box-shadow);overflow:inherit;box-sizing:border-box}.item-native .item-inner .input-wrapper{display:flex;flex:1 1 0;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:inherit;box-sizing:border-box}.item-native .item-bottom{padding:0 var(--wje-item-inner-padding-end) 0 var(--wje-item-padding-start);display:flex;justify-content:space-between}@media (any-hover: hover){:host(:hover) .item-native{color:var(--wje-item-color)}:host(:hover) .item-native :after{transition:var(--wje-item-transition);z-index:-1;top:0;right:0;bottom:0;left:0;position:absolute;content:"";background:var(--wje-item-background-hover);opacity:.7}}button,a{cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}::slotted([slot=start]){margin-inline:0 1rem}::slotted(wje-label:not([slot=end])){flex:1 1 0}';
6
- class a extends m {
7
- constructor() {
8
- super();
9
- r(this, "className", "Item");
10
- r(this, "hostContext", (e, n) => n.closest(e) !== null);
11
- this.labelColorStyles = {}, this.itemStyles = /* @__PURE__ */ new Map(), this.inheritedAriaAttributes = {}, this.multipleInputs = !1, this.focusable = !0, this.button = !1, this.detailIcon = "", this.disabled = !1, this.counter = !1, this.routerDirection = "forward", this.type = "button";
12
- }
13
- isClickable() {
14
- return this.hasAttribute("href") || this.button;
15
- }
16
- static get cssStyleSheet() {
17
- return p;
18
- }
19
- setupAttributes() {
20
- this.isShadowRoot = "open";
21
- }
22
- beforeDraw(e, n, s) {
23
- }
24
- draw(e, n, s) {
25
- const o = this.isClickable() ? this.hasAttribute("href") === void 0 ? "button" : "a" : "div";
26
- return this.hostContext("wje-list", this) && this.classList.add("wje-item-list"), `<${o} class="item-native" part="native">
27
- <slot name="start"></slot>
28
- <div class="item-inner">
29
- <div class="input-wrapper">
30
- <slot></slot>
31
- </div>
32
- <slot name="end"></slot>
33
- </div>
34
- <div class="item-highlight"></div>
35
- </${o}>
36
- <div class="item-bottom">
37
- <slot name="error"></slot>
38
- <slot name="helper"></slot>
39
- </div>`;
40
- }
41
- }
42
- a.define("wje-item", a);
43
- export {
44
- a as default
45
- };
package/dist/wje-label.js DELETED
@@ -1,67 +0,0 @@
1
- var i = Object.defineProperty;
2
- var w = (e, o, t) => o in e ? i(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
3
- var l = (e, o, t) => (w(e, typeof o != "symbol" ? o + "" : o, t), t);
4
- import m from "./wje-element.js";
5
- const h = ":host(.wje-color-primary){--wje-color: var(--wje-color-primary) !important}:host(.wje-color-complete){--wje-color: var(--wje-color-complete) !important}:host(.wje-color-success){--wje-color-base: var(--wje-color-success) !important;--wje-color-contrast: var(--wje-color-contrast-0) !important}:host(.wje-color-warning){--wje-color-base: var(--wje-color-warning) !important;--wje-color-contrast: var(--wje-color-contrast-11) !important}:host(.wje-color-danger){--wje-color-base: var(--wje-color-danger) !important;--wje-color-contrast: var(--wje-color-contrast-0) !important}:host(.wje-color-info){--wje-color-base: var(--wje-color-info) !important;--wje-color-contrast: var(--wje-color-contrast-0) !important}:host(.wje-color-menu){--wje-color-base: var(--wje-color-menu) !important;--wje-color-contrast: var(--wje-color-contrast-0) !important}:host{--wje-color: initial;display:block;font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;box-sizing:border-box}:host(.wje-color){color:current-color(base)}:host(.wje-text-wrap),:host([text-wrap]){white-space:normal!important}:host(.label-fixed){flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.label-stacked),:host(.label-floating){margin-bottom:0;align-self:stretch;width:auto;max-width:100%}:host(.label-no-animate.label-floating){transition:none}::slotted(*) h1,::slotted(*) h2,::slotted(*) h3,::slotted(*) h4,::slotted(*) h5,::slotted(*) h6{text-overflow:inherit;overflow:inherit}:host(.wje-color){color:var(--wje-color)}::slotted(*:first-child){margin-top:0!important}::slotted(*:last-child){margin-bottom:0!important}";
6
- class s extends m {
7
- /**
8
- * Creates an instance of Label.
9
- *
10
- * @constructor
11
- */
12
- constructor() {
13
- super();
14
- l(this, "className", "Label");
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
- * Returns the list of attributes to observe for changes.
27
- *
28
- * @static
29
- * @returns {Array<string>}
30
- */
31
- static get observedAttributes() {
32
- return [];
33
- }
34
- /**
35
- * Sets up the attributes for the component.
36
- */
37
- setupAttributes() {
38
- this.isShadowRoot = "open";
39
- }
40
- /**
41
- * Prepares the component before drawing.
42
- *
43
- * @param {Object} context - The context for drawing.
44
- * @param {Object} store - The store for drawing.
45
- * @param {Object} params - The parameters for drawing.
46
- */
47
- beforeDraw(t, c, r) {
48
- }
49
- /**
50
- * Draws the component.
51
- *
52
- * @param {Object} context - The context for drawing.
53
- * @param {Object} store - The store for drawing.
54
- * @param {Object} params - The parameters for drawing.
55
- * @returns {DocumentFragment}
56
- */
57
- draw(t, c, r) {
58
- let a = document.createDocumentFragment();
59
- this.color && this.classList.add("wje-color-" + r.color, "wje-color");
60
- let n = document.createElement("slot");
61
- return a.appendChild(n), a;
62
- }
63
- }
64
- s.define("wje-label", s);
65
- export {
66
- s as default
67
- };
package/dist/wje-list.js DELETED
@@ -1,53 +0,0 @@
1
- var o = Object.defineProperty;
2
- var l = (e, t, s) => t in e ? o(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var r = (e, t, s) => (l(e, typeof t != "symbol" ? t + "" : t, s), s);
4
- import d from "./wje-element.js";
5
- const c = ":host{--wje-list-inset-padding: 1rem;--wje-list-border-radius: 8px;--wje-list-background: var(--wje-background);margin:0;padding:0;display:block;contain:content;list-style-type:none}:host(.wje-inset){background:var(--wje-list-background);transform:translateZ(0);overflow:hidden;padding:var(--wje-list-inset-padding);border-radius:var(--wje-list-border-radius)}:host(.wje-lines-none) ::slotted(wje-item){--wje-border-width: 0 !important}";
6
- class n extends d {
7
- /**
8
- * Creates an instance of List.
9
- *
10
- * @constructor
11
- */
12
- constructor() {
13
- super();
14
- r(this, "className", "List");
15
- }
16
- /**
17
- * Returns the CSS styles for the component.
18
- *
19
- * @static
20
- * @returns {CSSStyleSheet}
21
- */
22
- static get cssStyleSheet() {
23
- return c;
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(s, u, w) {
40
- let i = document.createDocumentFragment(), a = document.createElement("slot");
41
- return i.appendChild(a), i;
42
- }
43
- /**
44
- * Called after the component has been drawn.
45
- */
46
- afterDraw() {
47
- this.classList.toggle("wje-lines-" + this.lines, this.hasAttribute("lines")), this.classList.toggle("wje-inset", this.hasAttribute("inset"));
48
- }
49
- }
50
- n.define("wje-list", n);
51
- export {
52
- n as default
53
- };
package/dist/wje-main.js DELETED
@@ -1,56 +0,0 @@
1
- var i = Object.defineProperty;
2
- var l = (t, e, s) => e in t ? i(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var a = (t, e, s) => (l(t, typeof e != "symbol" ? e + "" : e, s), s);
4
- import c from "./wje-element.js";
5
- const d = ":host{display:block;flex:1;flex-basis:auto;padding:1.5rem;box-sizing:border-box}";
6
- class n extends c {
7
- /**
8
- * Creates an instance of Main.
9
- *
10
- * @constructor
11
- */
12
- constructor() {
13
- super();
14
- a(this, "className", "Main");
15
- }
16
- /**
17
- * Returns the CSS styles for the component.
18
- *
19
- * @static
20
- * @returns {CSSStyleSheet}
21
- */
22
- static get cssStyleSheet() {
23
- return d;
24
- }
25
- /**
26
- * Returns the list of attributes to observe for changes.
27
- *
28
- * @static
29
- * @returns {Array<string>}
30
- */
31
- static get observedAttributes() {
32
- return [];
33
- }
34
- /**
35
- * Sets up the attributes for the component.
36
- */
37
- setupAttributes() {
38
- this.isShadowRoot = "open";
39
- }
40
- /**
41
- * Draws the component.
42
- *
43
- * @param {Object} context - The context for drawing.
44
- * @param {Object} store - The store for drawing.
45
- * @param {Object} params - The parameters for drawing.
46
- * @returns {DocumentFragment}
47
- */
48
- draw(s, m, u) {
49
- let r = document.createDocumentFragment(), o = document.createElement("slot");
50
- return r.appendChild(o), r;
51
- }
52
- }
53
- n.define("wje-main", n);
54
- export {
55
- n as default
56
- };
@@ -1,218 +0,0 @@
1
- var p = Object.defineProperty;
2
- var b = (o, s, t) => s in o ? p(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
3
- var r = (o, s, t) => (b(o, typeof s != "symbol" ? s + "" : s, t), t);
4
- import w from "./wje-element.js";
5
- const A = 500, C = 300, x = "--wje-masonry-layout-col-count", v = "--wje-masonry-layout-gap", d = 1, m = /* @__PURE__ */ new Map();
6
- function c(o, s, t) {
7
- const e = parseFloat(o.getAttribute(s) || "");
8
- return isNaN(e) ? t : e;
9
- }
10
- function g(o, s, t) {
11
- return isNaN(s) ? Math.max(1, Math.ceil(o / t)) : s;
12
- }
13
- function E(o, s, t) {
14
- const e = m.get(t);
15
- e != null && window.clearTimeout(e), m.set(t, window.setTimeout(o, s));
16
- }
17
- function S(o) {
18
- let s = 0, t = 1 / 0;
19
- return o.forEach((e, n) => {
20
- e < t && (t = e, s = n);
21
- }), s;
22
- }
23
- const N = ":host{display:flex;align-items:flex-start;justify-content:stretch;width:100%}.column{max-width:calc((100% / var(--wje-masonry-layout-col-count, 1) - ((var(--wje-masonry-layout-gap, 1rem) * (var(--wje-masonry-layout-col-count, 1) - 1) / var(--wje-masonry-layout-col-count, 1)))));width:100%;flex:1;display:flex;flex-direction:column}.column:not(:last-child){margin-inline-end:var(--wje-masonry-layout-gap, 1rem)}.column ::slotted(*){margin-block-end:var(--wje-masonry-layout-gap, 1rem);box-sizing:border-box;width:100%}#unset-items{opacity:0;position:absolute;pointer-events:none}";
24
- class f extends w {
25
- /**
26
- * Constructor for the Masonry class.
27
- */
28
- constructor() {
29
- super();
30
- r(this, "debounceId", `layout_${Math.random()}`);
31
- r(this, "ro");
32
- r(this, "className", "Masonry");
33
- /**
34
- * Called when the slot changes.
35
- */
36
- r(this, "onSlotChange", () => {
37
- (this.unsetSlot.assignedNodes() || []).filter((e) => e.nodeType === d).length > 0 && this.layout();
38
- });
39
- /**
40
- * Called when the window resizes.
41
- * @param {Array} entries - The entries to use.
42
- */
43
- r(this, "onResize", (t) => {
44
- const { width: e } = t != null && Array.isArray(t) && t.length > 0 ? t[0].contentRect : { width: this.offsetWidth };
45
- g(e, this.cols, this.maxColWidth) !== this.columns.length && this.scheduleLayout();
46
- });
47
- /**
48
- * Lays out the element.
49
- */
50
- r(this, "layout", () => {
51
- this.currentRequestAnimationFrameCallback != null && window.cancelAnimationFrame(this.currentRequestAnimationFrameCallback), this.currentRequestAnimationFrameCallback = requestAnimationFrame(() => {
52
- const t = this.gap, e = Array.from(this.children).filter((l) => l.nodeType === d), n = g(this.offsetWidth, this.cols, this.maxColWidth), a = Array(n).fill(0), i = [];
53
- for (const l of e) {
54
- const y = l.getBoundingClientRect().height;
55
- let u = S(a);
56
- a[u] += y + +t;
57
- const h = u;
58
- l.slot !== h && i.push(() => l.slot = h);
59
- }
60
- for (const l of i)
61
- l();
62
- this.renderCols(n);
63
- });
64
- });
65
- this.debounceId = `layout_${Math.random()}`, this.ro = void 0, this.currentRequestAnimationFrameCallback = void 0, this.unsetSlot = void 0;
66
- }
67
- /**
68
- * Setter for the maxColWidth property.
69
- * @param {number} value - The maximum column width.
70
- */
71
- set maxColWidth(t) {
72
- this.setAttribute("max-col-width", t);
73
- }
74
- /**
75
- * Getter for the maxColWidth property.
76
- * @returns {number} The maximum column width.
77
- */
78
- get maxColWidth() {
79
- return this.hasAttribute("max-col-width") ? +this.getAttribute("max-col-width") : +A;
80
- }
81
- /**
82
- * Setter for the cols property.
83
- * @param {number} value - The number of columns.
84
- */
85
- set cols(t) {
86
- this.hasAttribute("cols") && this.setAttribute("cols", t);
87
- }
88
- /**
89
- * Getter for the cols property.
90
- * @returns {number} The number of columns.
91
- */
92
- get cols() {
93
- return c(this, "cols", "auto");
94
- }
95
- /**
96
- * Setter for the gap property.
97
- * @param {number} value - The gap between columns.
98
- */
99
- set gap(t) {
100
- this.setAttribute("gap", t);
101
- }
102
- /**
103
- * Getter for the gap property.
104
- * @returns {number} The gap between columns.
105
- */
106
- get gap() {
107
- return c(this, "gap", "24");
108
- }
109
- /**
110
- * Setter for the debounce property.
111
- * @param {number} value - The debounce time.
112
- */
113
- set debounce(t) {
114
- this.setAttribute("debounce", t);
115
- }
116
- /**
117
- * Getter for the debounce property.
118
- * @returns {number} The debounce time.
119
- */
120
- get debounce() {
121
- return c(this, "debounce", C);
122
- }
123
- /**
124
- * Getter for the columns property.
125
- * @returns {Array} An array of all the columns.
126
- */
127
- get columns() {
128
- return Array.from(this.shadowRoot.querySelectorAll(".column"));
129
- }
130
- /**
131
- * Getter for the cssStyleSheet property.
132
- * @returns {CSSStyleSheet} The CSS style sheet.
133
- */
134
- static get cssStyleSheet() {
135
- return N;
136
- }
137
- /**
138
- * Getter for the observedAttributes property.
139
- * @returns {Array} An array of the observed attributes.
140
- */
141
- static get observedAttributes() {
142
- return ["max-col-width", "gap", "cols"];
143
- }
144
- /**
145
- * Callback for when an attribute changes.
146
- * @param {string} name - The name of the attribute.
147
- * @param {string} old - The old value of the attribute.
148
- * @param {string} newName - The new value of the attribute.
149
- */
150
- attributeChangedCallback(t, e, n) {
151
- switch (t) {
152
- case "gap":
153
- this.style.setProperty(v, `${this.gap}px`);
154
- break;
155
- }
156
- this.scheduleLayout();
157
- }
158
- /**
159
- * Callback for when the element is disconnected.
160
- */
161
- disconnectedCallback() {
162
- this.unsetSlot.removeEventListener("slotchange", this.onSlotChange), window.removeEventListener("resize", this.onResize), this.ro != null && this.ro.unobserve(this);
163
- }
164
- /**
165
- * Sets up the attributes for the element.
166
- */
167
- setupAttributes() {
168
- this.isShadowRoot = "open";
169
- }
170
- /**
171
- * Draws the element.
172
- * @param {CanvasRenderingContext2D} context - The context to draw on.
173
- * @param {Object} store - The store to use.
174
- * @param {Object} params - The parameters to use.
175
- * @returns {DocumentFragment} The drawn element.
176
- */
177
- draw(t, e, n) {
178
- let a = document.createDocumentFragment(), i = document.createElement("div");
179
- i.setAttribute("id", "unset-items"), i.setAttribute("part", "native");
180
- let l = document.createElement("slot");
181
- return i.appendChild(l), this.unsetSlot = l, this.native = i, a.appendChild(i), a;
182
- }
183
- /**
184
- * Called after the element is drawn.
185
- */
186
- afterDraw() {
187
- this.onSlotChange(), this.onResize(), this.layout(), this.unsetSlot.addEventListener("slotchange", this.onSlotChange), "ResizeObserver" in window ? (this.ro = new ResizeObserver(this.onResize), this.ro.observe(this)) : window.addEventListener("resize", this.onResize);
188
- }
189
- /**
190
- * Renders the columns.
191
- * @param {number} colCount - The number of columns to render.
192
- */
193
- renderCols(t) {
194
- const e = this.columns;
195
- if (e.length !== t) {
196
- for (const n of e)
197
- n.parentNode && n.parentNode.removeChild(n);
198
- for (let n = 0; n < t; n++) {
199
- const a = document.createElement("div");
200
- a.classList.add("column"), a.setAttribute("part", `column column-${n}`);
201
- const i = document.createElement("slot");
202
- i.setAttribute("name", n), a.appendChild(i), this.context.appendChild(a);
203
- }
204
- this.style.setProperty(x, t);
205
- }
206
- }
207
- /**
208
- * Schedules a layout.
209
- * @param {number} ms - The number of milliseconds to wait before laying out.
210
- */
211
- scheduleLayout(t = this.debounce) {
212
- E(this.layout, t, this.debounceId);
213
- }
214
- }
215
- f.define("wje-masonry", f);
216
- export {
217
- f as default
218
- };