@muibook/components 19.1.1 → 19.3.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.
@@ -8,7 +8,7 @@ class h extends HTMLElement {
8
8
  }
9
9
  async connectedCallback() {
10
10
  if (this.hasAttribute("size") || this.setAttribute("size", "medium"), await this.waitForPartMap(), !this.shadowRoot) return;
11
- let o = (
11
+ let t = (
12
12
  /*html*/
13
13
  `
14
14
  <style>
@@ -662,6 +662,35 @@ class h extends HTMLElement {
662
662
  padding-left: var(--action-before-slot-padding-large);
663
663
  }
664
664
 
665
+ :host([avatar-only]) {
666
+ width: auto;
667
+ display: flex;
668
+ }
669
+
670
+ :host([avatar-only]) button,
671
+ :host([avatar-only]) button:hover,
672
+ :host([avatar-only]) button:focus,
673
+ :host([avatar-only]) button:focus-visible,
674
+ :host([avatar-only]) button:disabled {
675
+ width: auto;
676
+ min-width: 0;
677
+ min-height: 0;
678
+ padding: var(--space-000);
679
+ border: none;
680
+ background: transparent;
681
+ display: inline-flex;
682
+ align-items: center;
683
+ justify-content: center;
684
+ gap: var(--space-000);
685
+ line-height: 0;
686
+ border-radius: 999rem;
687
+ }
688
+
689
+ :host([avatar-only]) button ::slotted(mui-avatar) {
690
+ margin-right: var(--space-000);
691
+ margin-left: var(--space-000);
692
+ }
693
+
665
694
 
666
695
  </style>
667
696
 
@@ -679,106 +708,103 @@ class h extends HTMLElement {
679
708
 
680
709
  `
681
710
  );
682
- this.shadowRoot.innerHTML = o, await customElements.whenDefined("mui-button"), requestAnimationFrame(() => {
683
- const s = this.shadowRoot;
684
- if (!s) return;
685
- const e = s.querySelector("slot:not([name])"), t = s.querySelector('slot[name="before"]'), a = s.querySelector('slot[name="after"]'), i = (d) => d ? d.assignedNodes({ flatten: !0 }).some((n) => {
686
- var l;
687
- return n.nodeType === Node.ELEMENT_NODE || n.nodeType === Node.TEXT_NODE && !!((l = n.textContent) != null && l.trim());
688
- }) : !1, c = i(t), u = i(a);
689
- this.toggleAttribute("has-before", c), this.toggleAttribute("has-after", u);
690
- const v = (e == null ? void 0 : e.assignedNodes({ flatten: !0 })) ?? [];
691
- v.every((d) => {
692
- var n;
693
- if (d.nodeType === Node.ELEMENT_NODE) {
694
- const l = d;
695
- return l.tagName.toLowerCase() === "svg" || l.classList.contains("mui-icon");
696
- }
697
- return d.nodeType === Node.TEXT_NODE && !((n = d.textContent) != null && n.trim());
698
- }) ? (this.setAttribute("icon-only", ""), this.updateIconSizes(v, !0)) : (this.removeAttribute("icon-only"), [t, e, a].forEach((n) => {
699
- if (n) {
700
- const l = n.assignedNodes({ flatten: !0 });
701
- this.updateIconSizes(l, !1), this.updateAvatarSizes(l), this.updateBadgeSizes(l);
702
- }
703
- }));
704
- });
711
+ this.shadowRoot.innerHTML = t, await customElements.whenDefined("mui-button"), [
712
+ this.shadowRoot.querySelector("slot:not([name])"),
713
+ this.shadowRoot.querySelector('slot[name="before"]'),
714
+ this.shadowRoot.querySelector('slot[name="after"]')
715
+ ].forEach((r) => r == null ? void 0 : r.addEventListener("slotchange", () => this.syncButtonState())), requestAnimationFrame(() => this.syncButtonState());
716
+ }
717
+ attributeChangedCallback(o, t, n) {
718
+ var r;
719
+ if (o === "disabled") {
720
+ const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector("button");
721
+ e && (this.hasAttribute("disabled") ? e.setAttribute("disabled", "") : e.removeAttribute("disabled"));
722
+ }
723
+ o === "size" && t !== n && this.shadowRoot && requestAnimationFrame(() => this.syncButtonState());
705
724
  }
706
- attributeChangedCallback(r, o, s) {
707
- var e;
708
- if (r === "disabled") {
709
- const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("button");
710
- t && (this.hasAttribute("disabled") ? t.setAttribute("disabled", "") : t.removeAttribute("disabled"));
711
- }
712
- r === "size" && o !== s && this.shadowRoot && requestAnimationFrame(() => {
713
- const t = this.shadowRoot;
714
- if (!t) return;
715
- const a = [
716
- t.querySelector("slot:not([name])"),
717
- t.querySelector('slot[name="before"]'),
718
- t.querySelector('slot[name="after"]')
719
- ], i = this.hasAttribute("icon-only");
720
- a.forEach((c) => {
721
- if (c) {
722
- const u = c.assignedNodes({ flatten: !0 });
723
- this.updateIconSizes(u, i), this.updateAvatarSizes(u), this.updateBadgeSizes(u);
724
- }
725
- });
725
+ syncButtonState() {
726
+ const o = this.shadowRoot;
727
+ if (!o) return;
728
+ const t = o.querySelector("slot:not([name])"), n = o.querySelector('slot[name="before"]'), r = o.querySelector('slot[name="after"]'), e = (a) => a ? a.assignedNodes({ flatten: !0 }).some((i) => {
729
+ var d;
730
+ return i.nodeType === Node.ELEMENT_NODE || i.nodeType === Node.TEXT_NODE && !!((d = i.textContent) != null && d.trim());
731
+ }) : !1, s = e(n), l = e(r);
732
+ this.toggleAttribute("has-before", s), this.toggleAttribute("has-after", l);
733
+ const c = (t == null ? void 0 : t.assignedNodes({ flatten: !0 })) ?? [], v = (t == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? [], u = v.length === 1 && v[0].tagName.toLowerCase() === "mui-avatar" && c.every((a) => {
734
+ var i;
735
+ return a.nodeType === Node.TEXT_NODE ? !((i = a.textContent) != null && i.trim()) : a.nodeType === Node.ELEMENT_NODE ? a.tagName.toLowerCase() === "mui-avatar" : !1;
736
+ });
737
+ if (this.toggleAttribute("avatar-only", u), !u && c.every((a) => {
738
+ var i;
739
+ if (a.nodeType === Node.ELEMENT_NODE) {
740
+ const d = a;
741
+ return d.tagName.toLowerCase() === "svg" || d.classList.contains("mui-icon");
742
+ }
743
+ return a.nodeType === Node.TEXT_NODE && !((i = a.textContent) != null && i.trim());
744
+ })) {
745
+ this.setAttribute("icon-only", ""), this.updateIconSizes(c, !0);
746
+ return;
747
+ }
748
+ this.removeAttribute("icon-only"), [n, t, r].forEach((a) => {
749
+ if (!a) return;
750
+ const i = a.assignedNodes({ flatten: !0 });
751
+ this.updateIconSizes(i, !1), u || this.updateAvatarSizes(i), this.updateBadgeSizes(i);
726
752
  });
727
753
  }
728
754
  // Update avatar sizes based on button size
729
- updateAvatarSizes(r) {
730
- const o = this.getAttribute("size") || "medium", e = {
755
+ updateAvatarSizes(o) {
756
+ const t = this.getAttribute("size") || "medium", r = {
731
757
  "xx-small": "x-small",
732
758
  "x-small": "x-small",
733
759
  small: "x-small",
734
760
  medium: "small",
735
761
  large: "medium"
736
- }[o] || "small";
737
- r.forEach((t) => {
738
- if (t.nodeType === Node.ELEMENT_NODE) {
739
- const a = t;
740
- a.tagName.toLowerCase() === "mui-avatar" && a.setAttribute("size", e);
762
+ }[t] || "small";
763
+ o.forEach((e) => {
764
+ if (e.nodeType === Node.ELEMENT_NODE) {
765
+ const s = e;
766
+ s.tagName.toLowerCase() === "mui-avatar" && s.setAttribute("size", r);
741
767
  }
742
768
  });
743
769
  }
744
- updateIconSizes(r, o) {
745
- const s = this.getAttribute("size") || "medium", t = {
770
+ updateIconSizes(o, t) {
771
+ const n = this.getAttribute("size") || "medium", e = {
746
772
  "xx-small": "xx-small",
747
773
  "x-small": "x-small",
748
774
  small: "x-small",
749
- medium: o ? "medium" : "small",
775
+ medium: t ? "medium" : "small",
750
776
  // small for regular, medium for icon-only
751
- large: o ? "large" : "medium"
752
- }[s] || "small";
753
- r.forEach((a) => {
754
- if (a.nodeType === Node.ELEMENT_NODE) {
755
- const i = a;
756
- (i.tagName.toLowerCase() === "svg" || i.classList.contains("mui-icon") || i.tagName.toLowerCase() === "mui-icon") && !i.hasAttribute("size") && i.setAttribute("size", t);
777
+ large: t ? "large" : "medium"
778
+ }[n] || "small";
779
+ o.forEach((s) => {
780
+ if (s.nodeType === Node.ELEMENT_NODE) {
781
+ const l = s;
782
+ (l.tagName.toLowerCase() === "svg" || l.classList.contains("mui-icon") || l.tagName.toLowerCase() === "mui-icon") && !l.hasAttribute("size") && l.setAttribute("size", e);
757
783
  }
758
784
  });
759
785
  }
760
- updateBadgeSizes(r) {
761
- const o = this.getAttribute("size") || "medium", e = {
786
+ updateBadgeSizes(o) {
787
+ const t = this.getAttribute("size") || "medium", r = {
762
788
  "xx-small": "x-small",
763
789
  "x-small": "x-small",
764
790
  small: "small",
765
791
  medium: "medium",
766
792
  large: "large"
767
- }[o] || "medium";
768
- r.forEach((t) => {
769
- if (t.nodeType === Node.ELEMENT_NODE) {
770
- const a = t;
771
- a.tagName.toLowerCase() === "mui-badge" && a.setAttribute("size", e);
793
+ }[t] || "medium";
794
+ o.forEach((e) => {
795
+ if (e.nodeType === Node.ELEMENT_NODE) {
796
+ const s = e;
797
+ s.tagName.toLowerCase() === "mui-badge" && s.setAttribute("size", r);
772
798
  }
773
799
  });
774
800
  }
775
801
  waitForPartMap() {
776
- return new Promise((r) => {
777
- if (typeof b == "function") return r();
778
- const o = () => {
779
- typeof b == "function" ? r() : requestAnimationFrame(o);
802
+ return new Promise((o) => {
803
+ if (typeof b == "function") return o();
804
+ const t = () => {
805
+ typeof b == "function" ? o() : requestAnimationFrame(t);
780
806
  };
781
- o();
807
+ t();
782
808
  });
783
809
  }
784
810
  }
@@ -1,6 +1,6 @@
1
1
  import "../mui-icons/close/index.js";
2
2
  import "../mui-button/index.js";
3
- class n extends HTMLElement {
3
+ class l extends HTMLElement {
4
4
  static get observedAttributes() {
5
5
  return ["open", "width", "content-max-height"];
6
6
  }
@@ -8,7 +8,7 @@ class n extends HTMLElement {
8
8
  super(), this.attachShadow({ mode: "open" });
9
9
  }
10
10
  connectedCallback() {
11
- var a;
11
+ var a, n;
12
12
  if (!this.shadowRoot) return;
13
13
  const s = (
14
14
  /*css*/
@@ -71,6 +71,10 @@ class n extends HTMLElement {
71
71
  .actions[hidden] {
72
72
  display: none !important;
73
73
  }
74
+
75
+ .header[hidden] {
76
+ display: none !important;
77
+ }
74
78
  `
75
79
  );
76
80
  this.shadowRoot.innerHTML = /*html*/
@@ -88,12 +92,17 @@ class n extends HTMLElement {
88
92
  <slot name="actions"></slot>
89
93
  </div>
90
94
  </dialog>
91
- `, this.dialogEl = this.shadowRoot.querySelector("dialog"), this.footerEl = this.shadowRoot.querySelector(".actions"), this.actionsSlot = this.shadowRoot.querySelector('slot[name="actions"]');
95
+ `, this.dialogEl = this.shadowRoot.querySelector("dialog"), this.footerEl = this.shadowRoot.querySelector(".actions"), this.actionsSlot = this.shadowRoot.querySelector('slot[name="actions"]'), this.headerEl = this.shadowRoot.querySelector(".header"), this.titleSlot = this.shadowRoot.querySelector('slot[name="title"]');
92
96
  const e = this.shadowRoot.querySelector(".close");
93
97
  e == null || e.addEventListener("click", () => this.close()), this.dialogEl.addEventListener("click", (i) => {
94
98
  const o = this.dialogEl.getBoundingClientRect();
95
99
  i.clientX >= o.left && i.clientX <= o.right && i.clientY >= o.top && i.clientY <= o.bottom || this.close();
96
- }), (a = this.actionsSlot) == null || a.addEventListener("slotchange", () => this.updateFooterVisibility()), this.updateFooterVisibility(), this.syncOpenState();
100
+ }), (a = this.actionsSlot) == null || a.addEventListener("slotchange", () => this.updateFooterVisibility()), (n = this.titleSlot) == null || n.addEventListener("slotchange", () => this.updateHeaderVisibility()), this.updateHeaderVisibility(), this.updateFooterVisibility(), this.syncOpenState();
101
+ }
102
+ updateHeaderVisibility() {
103
+ if (!this.headerEl || !this.titleSlot) return;
104
+ const t = this.titleSlot.assignedElements().length > 0;
105
+ this.headerEl.hidden = !t, this.toggleAttribute("has-header", t);
97
106
  }
98
107
  updateFooterVisibility() {
99
108
  if (!this.footerEl || !this.actionsSlot) return;
@@ -113,4 +122,4 @@ class n extends HTMLElement {
113
122
  this.removeAttribute("open"), this.dispatchEvent(new CustomEvent("mui-dialog-close", { bubbles: !0, composed: !0 }));
114
123
  }
115
124
  }
116
- customElements.get("mui-dialog") || customElements.define("mui-dialog", n);
125
+ customElements.get("mui-dialog") || customElements.define("mui-dialog", l);
@@ -21,7 +21,7 @@ class n extends HTMLElement {
21
21
  margin-top: var(--space-300);
22
22
  }
23
23
  :host([size="x-small"][has-message]) .message-container { margin-top: var(--space-100); }
24
- :host([size="small"][has-message]) .message-container { margin-top: var(--space-100); }
24
+ :host([size="small"][has-message]) .message-container { margin-top: var(--space-200); }
25
25
  :host([size="medium"][has-message]) .message-container { margin-top: var(--space-300); }
26
26
  :host([size="large"][has-message]) .message-container { margin-top: var(--space-300); }
27
27
 
@@ -0,0 +1 @@
1
+ import "./trash/index.js";
@@ -0,0 +1,81 @@
1
+ class c extends HTMLElement {
2
+ static get observedAttributes() {
3
+ return ["size", "color"];
4
+ }
5
+ constructor() {
6
+ super(), this.attachShadow({ mode: "open" });
7
+ }
8
+ connectedCallback() {
9
+ this.render();
10
+ }
11
+ attributeChangedCallback(l, t, a) {
12
+ (l === "size" || l === "color") && t !== a && this.render();
13
+ }
14
+ render() {
15
+ const l = this.getAttribute("size") || "medium", t = this.getAttribute("color"), a = {
16
+ default: "var(--illustration-main-color-default)",
17
+ inverted: "var(--illustration-main-color-inverted)"
18
+ }, o = t && a[t] || t || a.default, s = "color-mix(in srgb, var(--illustration-main-color) 35%, transparent)", e = "color-mix(in srgb, var(--illustration-main-color) 14%, transparent)", n = t === "inverted" ? "var(--illustration-shadow-color-inverted)" : "var(--illustration-shadow-color-default)", i = {
19
+ small: "var(--illustration-size-small)",
20
+ medium: "var(--illustration-size-medium)",
21
+ large: "var(--illustration-size-large)",
22
+ "x-large": "var(--illustration-size-x-large)"
23
+ }, r = i[l] ?? i.medium;
24
+ this.classList.add("mui-illustration"), this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
25
+ `
26
+ <style>
27
+ :host {
28
+ width: ${r};
29
+ height: ${r};
30
+ display: inline-flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ flex: none;
34
+ --illustration-main-color: ${o};
35
+ --illustration-detail-color: ${s};
36
+ --illustration-atmosphere-color: ${e};
37
+ --illustration-shadow-color: ${n};
38
+ }
39
+
40
+ svg {
41
+ width: 100%;
42
+ height: 100%;
43
+ display: block;
44
+ }
45
+ </style>
46
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96">
47
+ <ellipse cx="48" cy="93" fill="var(--illustration-shadow-color)" rx="25" ry="3"></ellipse>
48
+ <path
49
+ fill="var(--illustration-main-color)"
50
+ d="M39.947 69.904q.765 0 1.24-.448.474-.449.448-1.16l-.844-29.057q0-.738-.475-1.16-.474-.422-1.213-.422-.79 0-1.265.448-.45.422-.422 1.16l.79 29.03q.054.739.502 1.187.474.422 1.24.422m8.042 0q.791 0 1.266-.422.5-.448.5-1.186v-29.03q0-.74-.5-1.16-.475-.45-1.266-.449-.764 0-1.265.448-.475.422-.475 1.16v29.03q0 .739.474 1.187.501.422 1.266.422m8.069 0q.764 0 1.212-.422.476-.422.501-1.186l.791-29.03q.027-.74-.448-1.16-.448-.45-1.24-.449-.711 0-1.186.422-.474.422-.5 1.186l-.818 29.03q-.027.739.422 1.187.474.422 1.265.422M35.697 28.742l-.474-5.887q-.228-2.838 1.376-4.608 1.628-1.797 4.65-2.04l9.987-.803q3.022-.242 4.89 1.273 1.893 1.488 2.12 4.327l.474 5.887-4.179.336-.452-5.624q-.089-1.104-.88-1.728-.765-.627-1.947-.532l-9.41.757q-1.181.094-1.863.837-.654.741-.566 1.845l.453 5.624zm-11.764 3.062q-.788.063-1.439-.466a2 2 0 0 1-.692-1.373 1.88 1.88 0 0 1 .468-1.413q.556-.653 1.344-.716l46.967-3.776q.789-.065 1.413.468.626.531.69 1.346a2 2 0 0 1-.464 1.466 1.82 1.82 0 0 1-1.32.688zm11.98 46.116q-2.848 0-4.614-1.688-1.74-1.66-1.872-4.509l-1.872-38.917h40.869l-1.846 38.891q-.131 2.847-1.898 4.535t-4.588 1.688z"
51
+ ></path>
52
+ <path
53
+ fill="var(--illustration-detail-color)"
54
+ d="M84 59a1 1 0 1 0-1 1v1a2 2 0 1 1 0-4 2 2 0 0 1 0 4v-1a1 1 0 0 0 1-1"
55
+ ></path>
56
+ <circle cx="17" cy="50" r="1" fill="var(--illustration-atmosphere-color)"></circle>
57
+ <path
58
+ fill="var(--illustration-detail-color)"
59
+ d="M77 85a1 1 0 1 1-2 0 1 1 0 0 1 2 0M34.5 1.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0"
60
+ ></path>
61
+ <path
62
+ fill="var(--illustration-detail-color)"
63
+ d="M82 13c.207 0 .375.168.375.375v1.25h1.25a.375.375 0 0 1 0 .75h-1.25v1.25a.375.375 0 0 1-.75 0v-1.25h-1.25a.375.375 0 0 1 0-.75h1.25v-1.25c0-.207.168-.375.375-.375"
64
+ ></path>
65
+ <path
66
+ fill="var(--illustration-detail-color)"
67
+ d="M10.5 75.4c.155 0 .281.126.281.281v.938h.938a.281.281 0 0 1 0 .562h-.938v.938a.281.281 0 0 1-.562 0v-.938H9.28a.281.281 0 1 1 0-.562h.938v-.938c0-.155.126-.28.281-.28"
68
+ ></path>
69
+ <path
70
+ fill="var(--illustration-detail-color)"
71
+ d="M13.508 20.4c.362 0 .656.294.656.656v2.188h2.188a.656.656 0 0 1 0 1.312h-2.188v2.188a.656.656 0 0 1-1.312 0v-2.188h-2.188a.656.656 0 1 1 0-1.312h2.188v-2.188c0-.362.293-.656.656-.656"
72
+ ></path>
73
+ <path
74
+ fill="var(--illustration-atmosphere-color)"
75
+ d="M74.535 64.6c.156 0 .281.127.281.282v.937h.938a.281.281 0 0 1 0 .563h-.938v.937a.281.281 0 0 1-.562 0v-.937h-.938a.281.281 0 0 1 0-.563h.938v-.937c0-.156.126-.281.281-.281"
76
+ ></path>
77
+ </svg>
78
+ `);
79
+ }
80
+ }
81
+ customElements.get("mui-illustration-trash") || customElements.define("mui-illustration-trash", c);
@@ -91,7 +91,7 @@ class I extends HTMLElement {
91
91
  medium: "x-small",
92
92
  large: "small"
93
93
  }, v = {
94
- "x-small": "x-small",
94
+ "x-small": "xx-small",
95
95
  small: "x-small",
96
96
  medium: "small",
97
97
  large: "medium"
@@ -113,7 +113,7 @@ class I extends HTMLElement {
113
113
  medium: "x-small",
114
114
  large: "small"
115
115
  }, u = {
116
- "x-small": "x-small",
116
+ "x-small": "xx-small",
117
117
  small: "x-small",
118
118
  medium: "small",
119
119
  large: "medium"
@@ -1,6 +1,6 @@
1
1
 
2
2
  /* ================================================================================================== */
3
- /* Don't edit directly • Generated on Mon, 30 Mar 2026 07:14:52 GMT • muibook.com */
3
+ /* Don't edit directly • Generated on Thu, 07 May 2026 04:13:10 GMT • muibook.com */
4
4
  /* ================================================================================================== */
5
5
 
6
6
  /* ================================================================================================== */
@@ -256,6 +256,14 @@ html[data-theme="light"] {
256
256
  /* Icon */
257
257
  --icon-color-default: var(--black);
258
258
  --icon-color-inverted: var(--white);
259
+ --illustration-main-color-default: var(--icon-color-default);
260
+ --illustration-main-color-inverted: var(--icon-color-inverted);
261
+ --illustration-shadow-color-default: var(--black-opacity-20);
262
+ --illustration-shadow-color-inverted: var(--white-opacity-20);
263
+ --illustration-size-small: 8rem;
264
+ --illustration-size-medium: 9.6rem;
265
+ --illustration-size-large: 11.2rem;
266
+ --illustration-size-x-large: 12.8rem;
259
267
  /* Badge */
260
268
  --badge-text-color: var(--grey-100);
261
269
  --badge-background-neutral: var(--grey-600);
@@ -600,6 +608,14 @@ html[data-theme="dark"] {
600
608
  /* Icon */
601
609
  --icon-color-default: var(--white);
602
610
  --icon-color-inverted: var(--black);
611
+ --illustration-main-color-default: var(--icon-color-default);
612
+ --illustration-main-color-inverted: var(--icon-color-inverted);
613
+ --illustration-shadow-color-default: var(--black-opacity-30);
614
+ --illustration-shadow-color-inverted: var(--black-opacity-20);
615
+ --illustration-size-small: 8rem;
616
+ --illustration-size-medium: 9.6rem;
617
+ --illustration-size-large: 11.2rem;
618
+ --illustration-size-x-large: 12.8rem;
603
619
  /* Badge */
604
620
  --badge-text-color: var(--grey-900);
605
621
  --badge-background-neutral: var(--grey-400);