@muibook/components 8.0.1 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,6 +18,7 @@ import "@muibook/components/mui-body"; // Individual
18
18
  #### CSS Usage
19
19
 
20
20
  ```javascript
21
+ import "@muibook/components/css/mui-brand.css";
21
22
  import "@muibook/components/css/mui-tokens.css";
22
23
  import "@muibook/components/css/mui-base.css";
23
24
  import "@muibook/components/css/mui-reset.css";
@@ -178,6 +179,28 @@ npm publish
178
179
 
179
180
  ---
180
181
 
182
+ ## Style Dictionary
183
+
184
+ - npm run token-build
185
+
186
+ ---
187
+
188
+ ## NPM Token REFRESH
189
+
190
+ Refreshing Your npm Access Token (90-Day Expiry)
191
+
192
+ ### Description:
193
+
194
+ npm login tokens expire every 90 days. When they do, you must log in again before publishing packages. No other setup needs to be repeated.
195
+
196
+ ### Steps:
197
+
198
+ 1. Run npm login to refresh your token.
199
+ 2. Publish normally with `npm publish --access public`
200
+ 3. Repeat npm login every 90 days when prompted.
201
+
202
+ ---
203
+
181
204
  ### Development Notes
182
205
 
183
206
  - Add any new components to `vite.config.ts` to include them in builds
@@ -28,7 +28,7 @@ Rules:
28
28
  placeholder: '<mui-field label="Email"><mui-input type="email" placeholder="you@example.com" value="..."></mui-input></mui-field>',
29
29
  message: `<mui-field label="Name" message="This field doesn't accept special characters"><mui-input></mui-input></mui-field>`,
30
30
  select: `<mui-field label="Brand"><mui-select options='[{ "value": "jpy", "label": "JPY" },{ "value": "usd", "label": "USD" }]'></mui-select></mui-field>`,
31
- inputAndSelect: `<mui-field label="Amount to transfer" slot="body"><mui-input type="number"><mui-select slot="after" label="Currency" hide-label style="width: 100px;" options='[{ "value": "jpy", "label": "JPY" },{ "value": "usd", "label": "USD" }]'></mui-select></mui-input></mui-field>`
31
+ inputAndSelect: `<mui-field label="Amount to transfer"><mui-input type="number"><mui-select slot="after" label="Currency" hide-label style="width: 100px;" options='[{ "value": "jpy", "label": "JPY" },{ "value": "usd", "label": "USD" }]'></mui-select></mui-input></mui-field>`
32
32
  },
33
33
  addon: {
34
34
  text: [
@@ -3,23 +3,31 @@ import "../mui-icons/check/index.js";
3
3
  import "../mui-icons/info/index.js";
4
4
  import "../mui-icons/warning/index.js";
5
5
  import "../mui-icons/attention/index.js";
6
- function A(n) {
7
- return ["positive", "info", "warning", "attention"].includes(n);
6
+ function b(d) {
7
+ return ["positive", "info", "warning", "attention"].includes(d);
8
8
  }
9
- class x extends HTMLElement {
9
+ class m extends HTMLElement {
10
+ constructor() {
11
+ super(), this.actionSlotListener = null, this.attachShadow({ mode: "open" });
12
+ }
10
13
  static get observedAttributes() {
11
14
  return ["variant"];
12
15
  }
13
- constructor() {
14
- super(), this.attachShadow({ mode: "open" });
15
- }
16
16
  connectedCallback() {
17
- var c;
18
- const a = this.getAttribute("variant") || "positive", p = {
17
+ this.render();
18
+ }
19
+ attributeChangedCallback(i, o, t) {
20
+ i === "variant" && o !== t && this.shadowRoot && this.render();
21
+ }
22
+ render() {
23
+ const i = this.getAttribute("variant") || "positive", o = {
19
24
  success: "positive",
20
25
  error: "attention"
21
- }, t = A(a) ? a : p[a] || "positive";
22
- this.setAttribute("variant", t);
26
+ }, t = b(i) ? i : o[i] || "positive";
27
+ if (i !== t) {
28
+ this.setAttribute("variant", t);
29
+ return;
30
+ }
23
31
  const s = {
24
32
  positive: "polite",
25
33
  info: "polite",
@@ -27,29 +35,27 @@ class x extends HTMLElement {
27
35
  attention: "assertive"
28
36
  };
29
37
  this.setAttribute("role", "alert"), this.setAttribute("aria-live", s[t] || "polite");
30
- const g = {
38
+ const r = {
31
39
  positive: "mui-icon-check",
32
40
  info: "mui-icon-info",
33
41
  warning: "mui-icon-warning",
34
42
  attention: "mui-icon-attention"
35
- }, u = {
43
+ }, a = {
36
44
  positive: "--feedback-positive-icon",
37
45
  info: "--feedback-info-icon",
38
46
  warning: "--feedback-warning-icon",
39
47
  attention: "--feedback-attention-icon"
40
- }, b = {
48
+ }, e = {
41
49
  positive: "--feedback-positive-text",
42
50
  info: "--feedback-info-text",
43
51
  warning: "--feedback-warning-text",
44
52
  attention: "--feedback-attention-text"
45
- }, m = {
53
+ }, n = {
46
54
  positive: "Success!",
47
55
  info: "Info:",
48
56
  warning: "Warning!",
49
57
  attention: "Error!"
50
- };
51
- this.setAttribute("aria-live", s[t]);
52
- const r = g[t], v = u[t], h = b[t], f = m[t], w = (
58
+ }, c = r[t], p = a[t], g = e[t], u = n[t], h = (
53
59
  /*css*/
54
60
  `
55
61
  :host {
@@ -79,7 +85,6 @@ class x extends HTMLElement {
79
85
  ::slotted(mui-button[slot="action"]),
80
86
  ::slotted(mui-link[slot="action"]) { padding-top: var(--space-100); }
81
87
 
82
-
83
88
  @media (min-width: 600px) {
84
89
  :host { gap: var(--alert-gap-horizontal-desktop); }
85
90
  :host([has-action]) { padding-right: var(--space-100); }
@@ -88,7 +93,7 @@ class x extends HTMLElement {
88
93
  }
89
94
 
90
95
  .label {
91
- color: var(${h});
96
+ color: var(${g});
92
97
  font-weight: var(--font-weight-bold);
93
98
  }
94
99
 
@@ -101,41 +106,44 @@ class x extends HTMLElement {
101
106
  }
102
107
 
103
108
  ${["positive", "info", "warning", "attention"].map(
104
- (i) => (
109
+ (l) => (
105
110
  /*css*/
106
111
  `
107
- :host([variant="${i}"]) {
108
- border: var(--feedback-${i}-border);
109
- background: var(--feedback-${i}-background);
112
+ :host([variant="${l}"]) {
113
+ border: var(--feedback-${l}-border);
114
+ background: var(--feedback-${l}-background);
110
115
  }
111
116
  `
112
117
  )
113
118
  ).join("")}
114
119
  `
115
120
  );
116
- if (!this.shadowRoot) return;
117
- this.shadowRoot.innerHTML = /*html*/
121
+ this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
118
122
  `
119
- <style>${w}</style>
120
- <${r} size="medium" color="var(${v})" class="icon"></${r}>
123
+ <style>${h}</style>
124
+ <${c} size="medium" color="var(${p})" class="icon"></${c}>
121
125
  <mui-body>
122
- <span class="label">${f}</span>
126
+ <span class="label">${u}</span>
123
127
  <slot></slot>
124
128
  </mui-body>
125
129
  <slot name="action"></slot>
126
- `;
127
- const o = (c = this.shadowRoot) == null ? void 0 : c.querySelector('slot[name="action"]');
128
- if (o) {
129
- const i = () => {
130
- const k = o.assignedElements();
131
- let l = !1;
132
- k.forEach((e) => {
133
- const d = e.tagName;
134
- (d === "MUI-BUTTON" || d === "MUI-LINK") && (l = !0, e.setAttribute("variant", "tertiary"), e.classList.add("alert-slot", `alert-${t}-slot`));
135
- }), l ? this.setAttribute("has-action", "") : this.removeAttribute("has-action");
130
+ `, this.setupActionSlot());
131
+ }
132
+ setupActionSlot() {
133
+ var o;
134
+ const i = (o = this.shadowRoot) == null ? void 0 : o.querySelector('slot[name="action"]');
135
+ if (i) {
136
+ this.actionSlotListener && i.removeEventListener("slotchange", this.actionSlotListener);
137
+ const t = () => {
138
+ const s = this.getAttribute("variant") || "positive", r = i.assignedElements();
139
+ let a = !1;
140
+ r.forEach((e) => {
141
+ const n = e.tagName;
142
+ (n === "MUI-BUTTON" || n === "MUI-LINK") && (a = !0, e.setAttribute("variant", "tertiary"), e.classList.add("alert-slot", `alert-${s}-slot`));
143
+ }), a ? this.setAttribute("has-action", "") : this.removeAttribute("has-action");
136
144
  };
137
- o.addEventListener("slotchange", i), requestAnimationFrame(i);
145
+ this.actionSlotListener = t, i.addEventListener("slotchange", this.actionSlotListener), requestAnimationFrame(t);
138
146
  }
139
147
  }
140
148
  }
141
- customElements.get("mui-alert") || customElements.define("mui-alert", x);
149
+ customElements.get("mui-alert") || customElements.define("mui-alert", m);
@@ -24,7 +24,7 @@ class h extends HTMLElement {
24
24
  border: none;
25
25
  cursor: pointer;
26
26
  width: 100%;
27
- border-radius: var(--action-radius);
27
+ border-radius: var(--action-radius-medium);
28
28
  padding: var(--action-padding);
29
29
  text-decoration: none;
30
30
  line-height: var(--action-line-height);
@@ -1,10 +1,48 @@
1
- class u extends HTMLElement {
1
+ class l extends HTMLElement {
2
+ static get observedAttributes() {
3
+ return ["condensed"];
4
+ }
2
5
  constructor() {
3
6
  super(), this.attachShadow({ mode: "open" });
4
7
  }
5
8
  connectedCallback() {
9
+ this.render();
10
+ }
11
+ attributeChangedCallback(o, r, a) {
12
+ o === "condensed" && this.updateSlottedContent();
13
+ }
14
+ updateSlottedContent() {
15
+ requestAnimationFrame(() => {
16
+ if (!this.shadowRoot) return;
17
+ const o = this.shadowRoot.querySelector("slot");
18
+ if (!o) return;
19
+ const r = o.assignedNodes({ flatten: !0 });
20
+ this.classList.remove("inner-space", "has-card-slat-group", "has-accordion-slat-group");
21
+ let a = !1;
22
+ r.forEach((c) => {
23
+ if (c.nodeType === Node.ELEMENT_NODE) {
24
+ const t = c, i = t.tagName.toLowerCase() === "mui-accordion-group" ? t : t.querySelector("mui-accordion-group");
25
+ i instanceof HTMLElement && (i.querySelectorAll("mui-accordion-block").forEach((s) => {
26
+ s.classList.add("card-slot");
27
+ }), a = !0), (t.tagName.toLowerCase() === "mui-slat" ? [t] : Array.from(t.querySelectorAll("mui-slat"))).forEach((e) => {
28
+ const s = e.getAttribute("variant");
29
+ (s === "action" || s === "row") && (e.classList.add("card-slot"), this.hasAttribute("condensed") ? e.classList.add("condensed-slot") : e.classList.remove("condensed-slot"));
30
+ });
31
+ const n = t.tagName.toLowerCase() === "mui-table" ? t : t.querySelector("mui-table");
32
+ n instanceof HTMLElement && (n.querySelectorAll("mui-cell").forEach((s) => {
33
+ s.classList.add("card-slot");
34
+ }), a = !0);
35
+ const d = t.tagName.toLowerCase() === "mui-slat-group" ? [t] : Array.from(t.querySelectorAll("mui-slat-group"));
36
+ d.length && (a = !0, d.forEach((e) => {
37
+ e.setAttribute("usage", "card"), e.closest("mui-accordion-block") ? this.classList.add("has-accordion-slat-group") : this.classList.add("inner-space", "has-card-slat-group");
38
+ }));
39
+ }
40
+ }), !a && !this.hasAttribute("condensed") && this.classList.add("inner-space");
41
+ });
42
+ }
43
+ render() {
6
44
  if (!this.shadowRoot) return;
7
- const l = (
45
+ const o = (
8
46
  /*html*/
9
47
  `
10
48
  <style>
@@ -35,32 +73,7 @@ class u extends HTMLElement {
35
73
  <slot></slot>
36
74
  `
37
75
  );
38
- this.shadowRoot.innerHTML = l, requestAnimationFrame(() => {
39
- if (!this.shadowRoot) return;
40
- const a = this.shadowRoot.querySelector("slot");
41
- if (!a) return;
42
- const d = a.assignedNodes({ flatten: !0 });
43
- let e = !1;
44
- d.forEach((c) => {
45
- if (c.nodeType === Node.ELEMENT_NODE) {
46
- const t = c, i = t.tagName.toLowerCase() === "mui-accordion-group" ? t : t.querySelector("mui-accordion-group");
47
- i instanceof HTMLElement && (i.querySelectorAll("mui-accordion-block").forEach((o) => {
48
- o.classList.add("card-slot");
49
- }), e = !0), (t.tagName.toLowerCase() === "mui-slat" ? [t] : Array.from(t.querySelectorAll("mui-slat"))).forEach((s) => {
50
- const o = s.getAttribute("variant");
51
- (o === "action" || o === "row") && (s.classList.add("card-slot"), this.hasAttribute("condensed") && s.classList.add("condensed-slot"));
52
- });
53
- const r = t.tagName.toLowerCase() === "mui-table" ? t : t.querySelector("mui-table");
54
- r instanceof HTMLElement && (r.querySelectorAll("mui-cell").forEach((o) => {
55
- o.classList.add("card-slot");
56
- }), e = !0);
57
- const n = t.tagName.toLowerCase() === "mui-slat-group" ? [t] : Array.from(t.querySelectorAll("mui-slat-group"));
58
- n.length && (e = !0, n.forEach((s) => {
59
- s.setAttribute("usage", "card"), s.closest("mui-accordion-block") ? this.classList.add("has-accordion-slat-group") : this.classList.add("inner-space", "has-card-slat-group");
60
- }));
61
- }
62
- }), !e && !this.hasAttribute("condensed") && this.classList.add("inner-space");
63
- });
76
+ this.shadowRoot.innerHTML = o, this.updateSlottedContent();
64
77
  }
65
78
  }
66
- customElements.get("mui-card-body") || customElements.define("mui-card-body", u);
79
+ customElements.get("mui-card-body") || customElements.define("mui-card-body", l);
@@ -1,5 +1,5 @@
1
1
  import "../mui-body/index.js";
2
- class d extends HTMLElement {
2
+ class a extends HTMLElement {
3
3
  static get observedAttributes() {
4
4
  return ["checked", "disabled", "id", "indeterminate"];
5
5
  }
@@ -9,55 +9,54 @@ class d extends HTMLElement {
9
9
  connectedCallback() {
10
10
  this.render(), this.setupListener();
11
11
  }
12
- attributeChangedCallback(e, r, i) {
13
- var c, o, s;
12
+ disconnectedCallback() {
13
+ this.cleanupListeners();
14
+ }
15
+ attributeChangedCallback(e, t, c) {
16
+ var r, o, s;
14
17
  if (e === "checked") {
15
- const t = (c = this.shadowRoot) == null ? void 0 : c.querySelector("input");
16
- if (!t) return;
17
- t.checked = i !== null;
18
+ const i = (r = this.shadowRoot) == null ? void 0 : r.querySelector("input");
19
+ if (!i) return;
20
+ i.checked = c !== null;
18
21
  }
19
22
  if (e === "disabled") {
20
- const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input");
21
- if (!t) return;
22
- t.disabled = i !== null;
23
+ const i = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input");
24
+ if (!i) return;
25
+ i.disabled = c !== null;
23
26
  }
24
27
  if (e === "indeterminate") {
25
- const t = (s = this.shadowRoot) == null ? void 0 : s.querySelector("input");
26
- if (!t) return;
27
- const n = i !== null;
28
- t.indeterminate = n, n && (t.checked = !0, this.setAttribute("checked", ""));
28
+ const i = (s = this.shadowRoot) == null ? void 0 : s.querySelector("input");
29
+ if (!i) return;
30
+ const n = c !== null;
31
+ i.indeterminate = n, n && (i.checked = !0, this.setAttribute("checked", ""));
29
32
  }
30
33
  "id".includes(e) && (this.render(), this.setupListener());
31
34
  }
35
+ cleanupListeners() {
36
+ var t;
37
+ const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
38
+ e && this._changeHandler && e.removeEventListener("change", this._changeHandler);
39
+ }
32
40
  setupListener() {
33
- var r;
34
- const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector("input");
35
- e && (e.addEventListener("change", (i) => {
36
- const c = i.target;
37
- this.dispatchEvent(
38
- new CustomEvent("change", {
39
- detail: { checked: c.checked },
40
- bubbles: !0,
41
- composed: !0
42
- })
43
- ), c.checked ? this.setAttribute("checked", "") : this.removeAttribute("checked");
44
- }), e.indeterminate = this.hasAttribute("indeterminate"), e.addEventListener("change", (i) => {
45
- const c = i.target;
46
- this.dispatchEvent(
41
+ var t;
42
+ const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
43
+ e && (this.cleanupListeners(), e.indeterminate = this.hasAttribute("indeterminate"), this._changeHandler = (c) => {
44
+ const r = c.target;
45
+ r.checked ? this.setAttribute("checked", "") : this.removeAttribute("checked"), this.removeAttribute("indeterminate"), this.dispatchEvent(
47
46
  new CustomEvent("change", {
48
- detail: { checked: c.checked },
47
+ detail: { checked: r.checked },
49
48
  bubbles: !0,
50
49
  composed: !0
51
50
  })
52
- ), this.removeAttribute("indeterminate"), c.checked ? this.setAttribute("checked", "") : this.removeAttribute("checked");
53
- }));
51
+ );
52
+ }, e.addEventListener("change", this._changeHandler));
54
53
  }
55
54
  render() {
56
- const e = this.getAttribute("id") || `mui-checkbox-${Math.random().toString(36).substr(2, 9)}`, r = this.hasAttribute("checked"), i = this.hasAttribute("disabled"), c = `
55
+ const e = this.getAttribute("id") || `mui-checkbox-${Math.random().toString(36).substr(2, 9)}`, t = this.hasAttribute("checked"), c = this.hasAttribute("disabled"), r = `
57
56
  <mui-icon-checkmark class="icon" size="x-small" color="inverted"></mui-icon-checkmark>
58
- `, o = this.hasAttribute("indeterminate"), t = o ? `
57
+ `, o = this.hasAttribute("indeterminate"), i = o ? `
59
58
  <mui-icon-subtract class="icon" size="x-small" color="inverted"></mui-icon-subtract>
60
- ` : c, n = this.innerHTML.trim().length > 0;
59
+ ` : r, n = this.innerHTML.trim().length > 0;
61
60
  this.shadowRoot.innerHTML = /*html*/
62
61
  `
63
62
  <style>
@@ -139,22 +138,22 @@ class d extends HTMLElement {
139
138
  type="checkbox"
140
139
  id="${e}"
141
140
  ${o ? "indeterminate" : ""}
142
- ${o || r ? "checked" : ""}
143
- ${i ? "disabled" : ""}
141
+ ${o || t ? "checked" : ""}
142
+ ${c ? "disabled" : ""}
144
143
  />
145
- ${t}
144
+ ${i}
146
145
  </span>
147
146
  ${n ? '<mui-body size="small"><slot></slot></mui-body>' : ""}
148
147
  </label>
149
148
  `;
150
149
  }
151
150
  get checked() {
152
- var r;
153
- const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector("input");
151
+ var t;
152
+ const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
154
153
  return (e == null ? void 0 : e.checked) ?? !1;
155
154
  }
156
155
  set checked(e) {
157
156
  e ? this.setAttribute("checked", "") : this.removeAttribute("checked");
158
157
  }
159
158
  }
160
- customElements.get("mui-checkbox") || customElements.define("mui-checkbox", d);
159
+ customElements.get("mui-checkbox") || customElements.define("mui-checkbox", a);
@@ -13,6 +13,10 @@ class l extends HTMLElement {
13
13
  const s = (
14
14
  /*css*/
15
15
  `
16
+ :host {
17
+ display: contents;
18
+ }
19
+
16
20
  dialog {
17
21
  border: none;
18
22
  width: ${this.getAttribute("width") || "350px"};
@@ -1,7 +1,13 @@
1
1
  import "../mui-button/index.js";
2
2
  class r extends HTMLElement {
3
3
  constructor() {
4
- super(), this.attachShadow({ mode: "open" }), this.acceptedFileTypes = this.getAttribute("acceptedFileTypes") || "", this.currentFileName = this.getAttribute("currentFileName") || "", this.selectedFileName = null, this.render(), this.cacheElements(), this.attachEvents();
4
+ super(), this.attachShadow({ mode: "open" }), this.acceptedFileTypes = this.getAttribute("acceptedFileTypes") || "", this.currentFileName = this.getAttribute("currentFileName") || "", this.selectedFileName = null;
5
+ }
6
+ connectedCallback() {
7
+ this.render(), this.cacheElements(), this.attachEvents();
8
+ }
9
+ disconnectedCallback() {
10
+ this.cleanupListeners();
5
11
  }
6
12
  render() {
7
13
  this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
@@ -81,10 +87,13 @@ class r extends HTMLElement {
81
87
  cacheElements() {
82
88
  this.shadowRoot && (this.wrapper = this.shadowRoot.querySelector(".wrapper"), this.label = this.shadowRoot.querySelector(".label"), this.button = this.shadowRoot.querySelector(".button"), this.input = this.shadowRoot.querySelector('input[type="file"]'));
83
89
  }
90
+ cleanupListeners() {
91
+ this.wrapper && this._wrapperClickHandler && this.wrapper.removeEventListener("click", this._wrapperClickHandler), this.input && this._inputChangeHandler && this.input.removeEventListener("change", this._inputChangeHandler);
92
+ }
84
93
  attachEvents() {
85
- this.wrapper.addEventListener("click", () => {
94
+ this._wrapperClickHandler = () => {
86
95
  this.input.click();
87
- }), this.input.addEventListener("change", this.handleFileChange.bind(this));
96
+ }, this._inputChangeHandler = this.handleFileChange.bind(this), this.wrapper.addEventListener("click", this._wrapperClickHandler), this.input.addEventListener("change", this._inputChangeHandler);
88
97
  }
89
98
  handleFileChange(i) {
90
99
  var t;
@@ -1,14 +1,14 @@
1
- import { getPartMap as s } from "../../utils/part-map/index.js";
2
- class i extends HTMLElement {
1
+ import { getPartMap as e } from "../../utils/part-map/index.js";
2
+ class l extends HTMLElement {
3
3
  static get observedAttributes() {
4
- return ["col", "space"];
4
+ return ["col", "space", "alignx", "aligny"];
5
5
  }
6
6
  constructor() {
7
- super(), this.attachShadow({ mode: "open" });
7
+ super(), this.attachShadow({ mode: "open" }), this.col = "1fr 1fr", this.space = "var(--space-000)", this.alignX = "normal", this.alignY = "normal";
8
8
  }
9
9
  async connectedCallback() {
10
10
  await this.waitForPartMap();
11
- const t = this.getAttribute("col") || "1fr 1fr", e = this.getAttribute("space") || "var(--space-000)", a = s("layout", "spacing"), o = (
11
+ const t = this.getAttribute("col") || this.col, a = this.getAttribute("space") || this.space, i = this.getAttribute("alignx") || this.alignX, s = this.getAttribute("aligny") || this.alignY, o = e("layout", "spacing"), r = (
12
12
  /*css*/
13
13
  `
14
14
  :host {
@@ -18,25 +18,32 @@ class i extends HTMLElement {
18
18
  display: grid;
19
19
  grid-template-columns: var(--col);
20
20
  gap: var(--gap);
21
+ align-items: var(--alignY);
22
+ justify-items: var(--alignX);
21
23
  }
22
24
  `
23
25
  );
24
26
  this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
25
27
  `
26
- <style>${o}</style>
27
- <div part="${a}" style="--col: ${t}; --gap: ${e};">
28
+ <style>${r}</style>
29
+ <div part="${o}" style="--col: ${t}; --gap: ${a}; --alignX: ${i}; --alignY: ${s};">
28
30
  <slot></slot>
29
31
  </div>
30
32
  `);
31
33
  }
34
+ attributeChangedCallback(t, a, i) {
35
+ if (a === i || !this.shadowRoot) return;
36
+ const s = this.shadowRoot.querySelector("div");
37
+ s && (t === "col" && s.style.setProperty("--col", i || this.col), t === "space" && s.style.setProperty("--gap", i || this.space), t === "alignx" && s.style.setProperty("--alignX", i || this.alignX), t === "aligny" && s.style.setProperty("--alignY", i || this.alignY));
38
+ }
32
39
  waitForPartMap() {
33
40
  return new Promise((t) => {
34
- if (typeof s == "function") return t();
35
- const e = () => {
36
- typeof s == "function" ? t() : requestAnimationFrame(e);
41
+ if (typeof e == "function") return t();
42
+ const a = () => {
43
+ typeof e == "function" ? t() : requestAnimationFrame(a);
37
44
  };
38
- e();
45
+ a();
39
46
  });
40
47
  }
41
48
  }
42
- customElements.get("mui-grid") || customElements.define("mui-grid", i);
49
+ customElements.get("mui-grid") || customElements.define("mui-grid", l);
@@ -1,4 +1,4 @@
1
- class t extends HTMLElement {
1
+ class n extends HTMLElement {
2
2
  static get observedAttributes() {
3
3
  return ["size", "level"];
4
4
  }
@@ -6,8 +6,14 @@ class t extends HTMLElement {
6
6
  super(), this.attachShadow({ mode: "open" });
7
7
  }
8
8
  connectedCallback() {
9
+ this.render();
10
+ }
11
+ attributeChangedCallback(i, t, e) {
12
+ t !== e && this.shadowRoot && this.render();
13
+ }
14
+ render() {
9
15
  if (!this.shadowRoot) return;
10
- const e = this.getAttribute("size") || "1", i = `h${this.getAttribute("level") || e}`;
16
+ const i = this.getAttribute("size") || "1", e = `h${this.getAttribute("level") || i}`;
11
17
  this.shadowRoot.innerHTML = /*html*/
12
18
  `
13
19
  <style>
@@ -26,10 +32,10 @@ class t extends HTMLElement {
26
32
  .size-5 { font-size: var(--heading-font-size-500); line-height: var(--heading-line-height-500); }
27
33
  .size-6 { font-size: var(--heading-font-size-600); line-height: var(--heading-line-height-600); }
28
34
  </style>
29
- <${i} class="size-${e}">
35
+ <${e} class="size-${i}">
30
36
  <slot></slot>
31
- </${i}>
37
+ </${e}>
32
38
  `;
33
39
  }
34
40
  }
35
- customElements.get("mui-heading") || customElements.define("mui-heading", t);
41
+ customElements.get("mui-heading") || customElements.define("mui-heading", n);