@muibook/components 9.0.0 → 9.1.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/dist/esm/agent/keywords/index.js +2 -2
- package/dist/esm/agent/prompts/index.js +855 -3
- package/dist/esm/components/mui-body/index.js +8 -0
- package/dist/esm/components/mui-button/index.js +46 -41
- package/dist/esm/components/mui-input/index.js +20 -10
- package/dist/esm/components/mui-select/index.js +9 -1
- package/dist/esm/components/mui-smart-card/index.js +1 -0
- package/dist/esm/css/mui-brand.css +1 -1
- package/dist/esm/css/mui-tokens.css +2 -2
- package/dist/esm/custom-elements.json +124 -124
- package/dist/types/agent/prompts/index.d.ts +9 -0
- package/package.json +1 -1
|
@@ -55,6 +55,11 @@ class r extends HTMLElement {
|
|
|
55
55
|
:host([variant="default"]) p {
|
|
56
56
|
color: var(--text-color);
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
:host([variant="optional"]) p {
|
|
60
|
+
color: var(--text-color-optional);
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
:host([variant="success"]) p {
|
|
59
64
|
color: var(--text-color-success);
|
|
60
65
|
}
|
|
@@ -68,6 +73,9 @@ class r extends HTMLElement {
|
|
|
68
73
|
:host([variant="default"]) ::slotted(.mui-icon) {
|
|
69
74
|
fill: var(--text-color);
|
|
70
75
|
}
|
|
76
|
+
:host([variant="optional"]) ::slotted(.mui-icon) {
|
|
77
|
+
fill: var(--text-color-optional);
|
|
78
|
+
}
|
|
71
79
|
:host([variant="success"]) ::slotted(.mui-icon) {
|
|
72
80
|
fill: var(--text-color-success);
|
|
73
81
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPartMap as
|
|
1
|
+
import { getPartMap as b } from "../../utils/part-map/index.js";
|
|
2
2
|
class h extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
4
|
return ["onclick", "type", "aria-label", "disabled", "variant", "size", "usage"];
|
|
@@ -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
|
|
11
|
+
let o = (
|
|
12
12
|
/*html*/
|
|
13
13
|
`
|
|
14
14
|
<style>
|
|
@@ -524,7 +524,7 @@ class h extends HTMLElement {
|
|
|
524
524
|
</style>
|
|
525
525
|
|
|
526
526
|
<button
|
|
527
|
-
part="${
|
|
527
|
+
part="${b("text", "spacing", "layout", "visual")}"
|
|
528
528
|
onclick="${this.getAttribute("onclick")}"
|
|
529
529
|
type="${this.getAttribute("type") || "button"}"
|
|
530
530
|
aria-label="${this.getAttribute("aria-label") || ""}"
|
|
@@ -537,23 +537,23 @@ class h extends HTMLElement {
|
|
|
537
537
|
|
|
538
538
|
`
|
|
539
539
|
);
|
|
540
|
-
this.shadowRoot.innerHTML =
|
|
541
|
-
const
|
|
542
|
-
if (!
|
|
543
|
-
const
|
|
540
|
+
this.shadowRoot.innerHTML = o, await customElements.whenDefined("mui-button"), requestAnimationFrame(() => {
|
|
541
|
+
const n = this.shadowRoot;
|
|
542
|
+
if (!n) return;
|
|
543
|
+
const e = n.querySelector("slot:not([name])"), t = n.querySelector('slot[name="before"]'), i = n.querySelector('slot[name="after"]'), a = (l) => l ? l.assignedNodes({ flatten: !0 }).some((s) => {
|
|
544
544
|
var c;
|
|
545
545
|
return s.nodeType === Node.ELEMENT_NODE || s.nodeType === Node.TEXT_NODE && !!((c = s.textContent) != null && c.trim());
|
|
546
|
-
}) : !1, d =
|
|
547
|
-
this.classList.toggle("has-before", d), this.classList.toggle("has-after",
|
|
548
|
-
const
|
|
549
|
-
|
|
546
|
+
}) : !1, d = a(t), u = a(i);
|
|
547
|
+
this.classList.toggle("has-before", d), this.classList.toggle("has-after", u);
|
|
548
|
+
const v = (e == null ? void 0 : e.assignedNodes({ flatten: !0 })) ?? [];
|
|
549
|
+
v.every((l) => {
|
|
550
550
|
var s;
|
|
551
551
|
if (l.nodeType === Node.ELEMENT_NODE) {
|
|
552
552
|
const c = l;
|
|
553
553
|
return c.tagName.toLowerCase() === "svg" || c.classList.contains("mui-icon");
|
|
554
554
|
}
|
|
555
555
|
return l.nodeType === Node.TEXT_NODE && !((s = l.textContent) != null && s.trim());
|
|
556
|
-
}) ? (this.setAttribute("icon-only", ""), this.updateIconSizes(
|
|
556
|
+
}) ? (this.setAttribute("icon-only", ""), this.updateIconSizes(v, !0)) : (this.removeAttribute("icon-only"), [t, e, i].forEach((s) => {
|
|
557
557
|
if (s) {
|
|
558
558
|
const c = s.assignedNodes({ flatten: !0 });
|
|
559
559
|
this.updateIconSizes(c, !1), this.updateAvatarSizes(c);
|
|
@@ -561,60 +561,65 @@ class h extends HTMLElement {
|
|
|
561
561
|
}));
|
|
562
562
|
});
|
|
563
563
|
}
|
|
564
|
-
attributeChangedCallback(
|
|
565
|
-
e
|
|
564
|
+
attributeChangedCallback(r, o, n) {
|
|
565
|
+
var e;
|
|
566
|
+
if (r === "disabled") {
|
|
567
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("button");
|
|
568
|
+
t && (this.hasAttribute("disabled") ? t.setAttribute("disabled", "") : t.removeAttribute("disabled"));
|
|
569
|
+
}
|
|
570
|
+
r === "size" && o !== n && this.shadowRoot && requestAnimationFrame(() => {
|
|
566
571
|
const t = this.shadowRoot;
|
|
567
572
|
if (!t) return;
|
|
568
|
-
const
|
|
573
|
+
const i = [
|
|
569
574
|
t.querySelector("slot:not([name])"),
|
|
570
575
|
t.querySelector('slot[name="before"]'),
|
|
571
576
|
t.querySelector('slot[name="after"]')
|
|
572
|
-
],
|
|
573
|
-
|
|
574
|
-
if (
|
|
575
|
-
const
|
|
576
|
-
this.updateIconSizes(
|
|
577
|
+
], a = this.hasAttribute("icon-only");
|
|
578
|
+
i.forEach((d) => {
|
|
579
|
+
if (d) {
|
|
580
|
+
const u = d.assignedNodes({ flatten: !0 });
|
|
581
|
+
this.updateIconSizes(u, a), this.updateAvatarSizes(u);
|
|
577
582
|
}
|
|
578
583
|
});
|
|
579
584
|
});
|
|
580
585
|
}
|
|
581
586
|
// Update avatar sizes based on button size
|
|
582
|
-
updateAvatarSizes(
|
|
583
|
-
const
|
|
587
|
+
updateAvatarSizes(r) {
|
|
588
|
+
const o = this.getAttribute("size") || "medium", e = {
|
|
584
589
|
"x-small": "x-small",
|
|
585
590
|
small: "x-small",
|
|
586
591
|
medium: "small",
|
|
587
592
|
large: "medium"
|
|
588
|
-
}[
|
|
589
|
-
|
|
590
|
-
if (
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
+
}[o] || "small";
|
|
594
|
+
r.forEach((t) => {
|
|
595
|
+
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
596
|
+
const i = t;
|
|
597
|
+
i.tagName.toLowerCase() === "mui-avatar" && i.setAttribute("size", e);
|
|
593
598
|
}
|
|
594
599
|
});
|
|
595
600
|
}
|
|
596
|
-
updateIconSizes(
|
|
597
|
-
const
|
|
601
|
+
updateIconSizes(r, o) {
|
|
602
|
+
const n = this.getAttribute("size") || "medium", t = {
|
|
598
603
|
"x-small": "x-small",
|
|
599
604
|
small: "x-small",
|
|
600
|
-
medium:
|
|
605
|
+
medium: o ? "medium" : "small",
|
|
601
606
|
// small for regular, medium for icon-only
|
|
602
|
-
large:
|
|
603
|
-
}[
|
|
604
|
-
|
|
605
|
-
if (
|
|
606
|
-
const
|
|
607
|
-
(
|
|
607
|
+
large: o ? "large" : "medium"
|
|
608
|
+
}[n] || "small";
|
|
609
|
+
r.forEach((i) => {
|
|
610
|
+
if (i.nodeType === Node.ELEMENT_NODE) {
|
|
611
|
+
const a = i;
|
|
612
|
+
(a.tagName.toLowerCase() === "svg" || a.classList.contains("mui-icon") || a.tagName.toLowerCase() === "mui-icon") && !a.hasAttribute("size") && a.setAttribute("size", t);
|
|
608
613
|
}
|
|
609
614
|
});
|
|
610
615
|
}
|
|
611
616
|
waitForPartMap() {
|
|
612
|
-
return new Promise((
|
|
613
|
-
if (typeof
|
|
614
|
-
const
|
|
615
|
-
typeof
|
|
617
|
+
return new Promise((r) => {
|
|
618
|
+
if (typeof b == "function") return r();
|
|
619
|
+
const o = () => {
|
|
620
|
+
typeof b == "function" ? r() : requestAnimationFrame(o);
|
|
616
621
|
};
|
|
617
|
-
|
|
622
|
+
o();
|
|
618
623
|
});
|
|
619
624
|
}
|
|
620
625
|
}
|
|
@@ -12,9 +12,19 @@ class m extends HTMLElement {
|
|
|
12
12
|
this.cleanupListeners();
|
|
13
13
|
}
|
|
14
14
|
attributeChangedCallback(e, r, o) {
|
|
15
|
-
var
|
|
16
|
-
const t = (
|
|
17
|
-
|
|
15
|
+
var s;
|
|
16
|
+
const t = (s = this.shadowRoot) == null ? void 0 : s.querySelector("input");
|
|
17
|
+
if (t) {
|
|
18
|
+
if (e === "value") {
|
|
19
|
+
t.value = o ?? "";
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (e === "disabled") {
|
|
23
|
+
o === null || o === "false" ? t.removeAttribute("disabled") : t.setAttribute("disabled", "");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
["type", "placeholder", "label", "hide-label", "variant"].includes(e) && (this.render(), this.setupListener());
|
|
27
|
+
}
|
|
18
28
|
}
|
|
19
29
|
cleanupListeners() {
|
|
20
30
|
var r;
|
|
@@ -37,13 +47,13 @@ class m extends HTMLElement {
|
|
|
37
47
|
}
|
|
38
48
|
updateSlottedButtons() {
|
|
39
49
|
requestAnimationFrame(() => {
|
|
40
|
-
var t,
|
|
41
|
-
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector('slot[name="before"]'), r = (
|
|
50
|
+
var t, s;
|
|
51
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector('slot[name="before"]'), r = (s = this.shadowRoot) == null ? void 0 : s.querySelector('slot[name="after"]'), o = (l) => {
|
|
42
52
|
if (!l) return;
|
|
43
53
|
l.assignedNodes({ flatten: !0 }).forEach((i) => {
|
|
44
54
|
if (i.nodeType === Node.ELEMENT_NODE) {
|
|
45
|
-
const
|
|
46
|
-
(n === "mui-button" || n === "mui-link") && (
|
|
55
|
+
const a = i, n = a.tagName.toLowerCase();
|
|
56
|
+
(n === "mui-button" || n === "mui-link") && (a.setAttribute("usage", "input"), a.setAttribute("size", "medium"), a.removeAttribute("variant"), a.removeAttribute("weight"));
|
|
47
57
|
}
|
|
48
58
|
});
|
|
49
59
|
};
|
|
@@ -51,7 +61,7 @@ class m extends HTMLElement {
|
|
|
51
61
|
});
|
|
52
62
|
}
|
|
53
63
|
render() {
|
|
54
|
-
const e = ["text", "password", "email", "number", "search", "tel", "url", "date", "time"], r = this.getAttribute("type") || "text", o = e.includes(r) ? r : "text", t = this.getAttribute("name") || "",
|
|
64
|
+
const e = ["text", "password", "email", "number", "search", "tel", "url", "date", "time"], r = this.getAttribute("type") || "text", o = e.includes(r) ? r : "text", t = this.getAttribute("name") || "", s = this.getAttribute("value") || "", l = this.getAttribute("placeholder") || "", d = this.getAttribute("id") || `mui-input-${Math.random().toString(36).substr(2, 9)}`, i = this.getAttribute("label") || "", a = this.hasAttribute("hide-label"), n = this.hasAttribute("disabled"), u = a && i ? `aria-label="${i}"` : "", c = this.getAttribute("variant") || "", h = c || "", b = this.querySelector('[slot="before"]') !== null, p = this.querySelector('[slot="after"]') !== null, f = [h, b ? "before" : "", p ? "after" : ""].filter(Boolean).join(" "), v = (
|
|
55
65
|
/*html*/
|
|
56
66
|
`
|
|
57
67
|
<style>
|
|
@@ -222,7 +232,7 @@ class m extends HTMLElement {
|
|
|
222
232
|
|
|
223
233
|
|
|
224
234
|
</style>
|
|
225
|
-
${i ? `<label for="${d}" class="${
|
|
235
|
+
${i ? `<label for="${d}" class="${a ? "vh" : ""}">${i}</label>` : ""}
|
|
226
236
|
<div class="input-wrapper">
|
|
227
237
|
<slot name="before"></slot>
|
|
228
238
|
<input
|
|
@@ -230,7 +240,7 @@ class m extends HTMLElement {
|
|
|
230
240
|
type="${o}"
|
|
231
241
|
name="${t}"
|
|
232
242
|
id="${d}"
|
|
233
|
-
value="${
|
|
243
|
+
value="${s}"
|
|
234
244
|
placeholder="${l}"
|
|
235
245
|
${n ? 'disabled aria-disabled="true"' : ""}
|
|
236
246
|
${u}
|
|
@@ -16,7 +16,15 @@ class p extends HTMLElement {
|
|
|
16
16
|
attributeChangedCallback(e, r, t) {
|
|
17
17
|
if (!this.shadowRoot || r === t) return;
|
|
18
18
|
const o = this.shadowRoot.querySelector("select");
|
|
19
|
-
|
|
19
|
+
if (e === "value" && o) {
|
|
20
|
+
o.value = t || "";
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (e === "disabled" && o) {
|
|
24
|
+
t === null || t === "false" ? o.removeAttribute("disabled") : o.setAttribute("disabled", "");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
["options", "label", "hide-label", "variant"].includes(e) && (this.render(), this.setupListener());
|
|
20
28
|
}
|
|
21
29
|
cleanupListeners() {
|
|
22
30
|
var r;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/* ================================================================================================== */
|
|
3
|
-
/* Don't edit directly • Generated on
|
|
3
|
+
/* Don't edit directly • Generated on Thu, 08 Jan 2026 02:39:52 GMT • muibook.com */
|
|
4
4
|
/* ================================================================================================== */
|
|
5
5
|
|
|
6
6
|
/* ================================================================================================== */
|
|
@@ -169,7 +169,7 @@ html[data-theme="light"] {
|
|
|
169
169
|
--text-color-success: var(--green-600);
|
|
170
170
|
--text-color-warning: var(--orange-600);
|
|
171
171
|
--text-color-error: var(--red-600);
|
|
172
|
-
--text-color-optional: var(--grey-
|
|
172
|
+
--text-color-optional: var(--grey-500);
|
|
173
173
|
/* Overlay */
|
|
174
174
|
--backdrop-overlay: var(--black-opacity-70);
|
|
175
175
|
/* ================================================================================================== */
|
|
@@ -426,7 +426,7 @@ html[data-theme="dark"] {
|
|
|
426
426
|
--text-color-success: var(--green-400);
|
|
427
427
|
--text-color-warning: var(--orange-400);
|
|
428
428
|
--text-color-error: var(--red-400);
|
|
429
|
-
--text-color-optional: var(--grey-
|
|
429
|
+
--text-color-optional: var(--grey-400);
|
|
430
430
|
/* Overlay */
|
|
431
431
|
--backdrop-overlay: var(--black-opacity-70);
|
|
432
432
|
/* ================================================================================================== */
|