@muibook/components 19.6.0 → 20.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/AGENTS.md +67 -0
- package/DESIGN.md +358 -0
- package/README.md +53 -2
- package/dist/esm/agent/keywords/index.js +2 -173
- package/dist/esm/agent/prompts/index.js +6 -432
- package/dist/esm/components/mui-accordion/core/index.js +25 -17
- package/dist/esm/components/mui-addon/index.js +14 -14
- package/dist/esm/components/mui-avatar/index.js +103 -43
- package/dist/esm/components/mui-avatar-chip/index.js +158 -0
- package/dist/esm/components/mui-avatar-group/index.js +88 -0
- package/dist/esm/components/mui-badge/index.js +37 -20
- package/dist/esm/components/mui-body/index.js +20 -11
- package/dist/esm/components/mui-button/index.js +265 -78
- package/dist/esm/components/mui-calendar/index.js +199 -0
- package/dist/esm/components/mui-card/body/index.js +33 -18
- package/dist/esm/components/mui-card/footer/index.js +11 -9
- package/dist/esm/components/mui-carousel/controller/index.js +1 -1
- package/dist/esm/components/mui-checkbox/index.js +23 -18
- package/dist/esm/components/mui-chip/index.js +219 -73
- package/dist/esm/components/mui-chip-input/index.js +146 -137
- package/dist/esm/components/mui-chip-rail/index.js +342 -0
- package/dist/esm/components/mui-code/index.js +26 -7
- package/dist/esm/components/mui-container/index.js +68 -45
- package/dist/esm/components/mui-date-picker/index.js +169 -0
- package/dist/esm/components/mui-drawer/index.js +968 -100
- package/dist/esm/components/mui-dropdown/index.js +255 -59
- package/dist/esm/components/mui-field/index.js +1 -1
- package/dist/esm/components/mui-file-upload/index.js +14 -4
- package/dist/esm/components/mui-form-group/index.js +1 -2
- package/dist/esm/components/mui-form-message/index.js +4 -9
- package/dist/esm/components/mui-heading/index.js +3 -2
- package/dist/esm/components/mui-hint/index.js +178 -72
- package/dist/esm/components/mui-icons/copy/index.js +54 -0
- package/dist/esm/components/mui-icons/fullscreen/index.js +5 -0
- package/dist/esm/components/mui-icons/icon-helper/index.js +56 -0
- package/dist/esm/components/mui-icons/index.js +14 -1
- package/dist/esm/components/mui-icons/moon/index.js +3 -1
- package/dist/esm/components/mui-icons/{rectangle-bottom-panel → panel}/index.js +6 -6
- package/dist/esm/components/mui-icons/pause/index.js +5 -0
- package/dist/esm/components/mui-icons/picture-in-picture/index.js +5 -0
- package/dist/esm/components/mui-icons/play-fill/index.js +5 -0
- package/dist/esm/components/mui-icons/rectangle-right-drawer/index.js +56 -0
- package/dist/esm/components/mui-icons/reload/index.js +5 -0
- package/dist/esm/components/mui-icons/speaker-mute/index.js +5 -0
- package/dist/esm/components/mui-icons/speaker-one-wave/index.js +5 -0
- package/dist/esm/components/mui-icons/speaker-two-wave/index.js +5 -0
- package/dist/esm/components/mui-icons/spinner/index.js +7 -5
- package/dist/esm/components/mui-icons/stop-fill/index.js +5 -0
- package/dist/esm/components/mui-icons/sun/index.js +5 -5
- package/dist/esm/components/mui-icons/timer/index.js +54 -0
- package/dist/esm/components/mui-icons/toggle/index.js +16 -6
- package/dist/esm/components/mui-icons/vertical-ellipsis/index.js +5 -0
- package/dist/esm/components/mui-illustrations/trash/index.js +6 -5
- package/dist/esm/components/mui-input/index.js +96 -67
- package/dist/esm/components/mui-link/index.js +352 -96
- package/dist/esm/components/mui-media-player/index.js +1577 -83
- package/dist/esm/components/mui-message/index.js +7 -6
- package/dist/esm/components/mui-model-viewer/index.js +258 -0
- package/dist/esm/components/mui-progress-ring/index.js +349 -0
- package/dist/esm/components/mui-prompt/index.js +143 -115
- package/dist/esm/components/mui-prompt-preview/index.js +11 -23
- package/dist/esm/components/mui-radio/index.js +38 -17
- package/dist/esm/components/mui-range-input/index.js +9 -4
- package/dist/esm/components/mui-responsive/index.js +60 -27
- package/dist/esm/components/mui-search-input/index.js +300 -0
- package/dist/esm/components/mui-select/index.js +235 -46
- package/dist/esm/components/mui-slat/slat/index.js +40 -12
- package/dist/esm/components/mui-spinner/index.js +11 -9
- package/dist/esm/components/mui-stack/hstack/index.js +10 -5
- package/dist/esm/components/mui-status/index.js +239 -0
- package/dist/esm/components/mui-stepper/step/index.js +46 -32
- package/dist/esm/components/mui-switch/index.js +37 -26
- package/dist/esm/components/mui-table/row/index.js +2 -6
- package/dist/esm/components/mui-table/table/index.js +157 -14
- package/dist/esm/components/mui-tabs/controller/index.js +17 -6
- package/dist/esm/components/mui-tabs/item/index.js +17 -5
- package/dist/esm/components/mui-tabs/tab-bar/index.js +93 -39
- package/dist/esm/components/mui-textarea/index.js +43 -26
- package/dist/esm/components/mui-time/index/index.js +336 -0
- package/dist/esm/components/mui-time-picker/index.js +126 -0
- package/dist/esm/components/mui-video-thumbnail/index.js +205 -0
- package/dist/esm/css/mui-brand.css +12 -8
- package/dist/esm/css/mui-tokens.css +646 -344
- package/dist/esm/css/readme.md +2 -2
- package/dist/esm/custom-elements.json +4506 -1707
- package/dist/esm/dynamic-attrs.json +271 -54
- package/dist/esm/index.js +33 -6
- package/dist/esm/knowledge/compositions/index.js +1560 -0
- package/dist/esm/knowledge/index.js +28 -0
- package/dist/esm/knowledge/keywords/index.js +306 -0
- package/dist/esm/knowledge/rules/index.js +199 -0
- package/dist/esm/tokens/js/index.js +143 -139
- package/dist/types/agent/keywords/index.d.ts +1 -1
- package/dist/types/components/mui-avatar-chip/api.d.ts +28 -0
- package/dist/types/components/mui-avatar-chip/index.d.ts +18 -0
- package/dist/types/components/mui-avatar-group/api.d.ts +28 -0
- package/dist/types/components/mui-avatar-group/doc.d.ts +2 -0
- package/dist/types/components/mui-avatar-group/index.d.ts +1 -0
- package/dist/types/components/mui-button/api.d.ts +6 -2
- package/dist/types/components/mui-calendar/api.d.ts +41 -0
- package/dist/types/components/mui-calendar/doc.d.ts +2 -0
- package/dist/types/components/mui-calendar/index.d.ts +3 -0
- package/dist/types/components/mui-checkbox/api.d.ts +4 -0
- package/dist/types/components/mui-chip/api.d.ts +4 -0
- package/dist/types/components/mui-chip-input/api.d.ts +4 -0
- package/dist/types/components/mui-chip-rail/api.d.ts +21 -0
- package/dist/types/components/mui-chip-rail/doc.d.ts +2 -0
- package/dist/types/components/mui-chip-rail/index.d.ts +4 -0
- package/dist/types/components/mui-date-picker/api.d.ts +38 -0
- package/dist/types/components/mui-date-picker/doc.d.ts +2 -0
- package/dist/types/components/mui-date-picker/index.d.ts +6 -0
- package/dist/types/components/mui-drawer/api.d.ts +4 -0
- package/dist/types/components/mui-drawer/index.d.ts +2 -0
- package/dist/types/components/mui-file-upload/api.d.ts +4 -0
- package/dist/types/components/mui-icons/fullscreen.d.ts +1 -0
- package/dist/types/components/mui-icons/icon-helper.d.ts +1 -0
- package/dist/types/components/mui-icons/index.d.ts +14 -1
- package/dist/types/components/mui-icons/panel.d.ts +1 -0
- package/dist/types/components/mui-icons/pause.d.ts +1 -0
- package/dist/types/components/mui-icons/picture-in-picture.d.ts +1 -0
- package/dist/types/components/mui-icons/play-fill.d.ts +1 -0
- package/dist/types/components/mui-icons/rectangle-right-drawer.d.ts +1 -0
- package/dist/types/components/mui-icons/reload.d.ts +1 -0
- package/dist/types/components/mui-icons/speaker-mute.d.ts +1 -0
- package/dist/types/components/mui-icons/speaker-one-wave.d.ts +1 -0
- package/dist/types/components/mui-icons/speaker-two-wave.d.ts +1 -0
- package/dist/types/components/mui-icons/stop-fill.d.ts +1 -0
- package/dist/types/components/mui-icons/timer.d.ts +1 -0
- package/dist/types/components/mui-icons/vertical-ellipsis.d.ts +1 -0
- package/dist/types/components/mui-input/api.d.ts +12 -0
- package/dist/types/components/mui-link/api.d.ts +4 -0
- package/dist/types/components/mui-media-player/api.d.ts +4 -0
- package/dist/types/components/mui-media-player/index.d.ts +13 -4
- package/dist/types/components/mui-model-viewer/api.d.ts +28 -0
- package/dist/types/components/mui-model-viewer/doc.d.ts +2 -0
- package/dist/types/components/mui-model-viewer/index.d.ts +17 -0
- package/dist/types/components/mui-progress-ring/api.d.ts +24 -0
- package/dist/types/components/mui-progress-ring/doc.d.ts +2 -0
- package/dist/types/components/mui-progress-ring/index.d.ts +1 -0
- package/dist/types/components/mui-radio/api.d.ts +12 -0
- package/dist/types/components/mui-range-input/api.d.ts +4 -0
- package/dist/types/components/mui-responsive/api.d.ts +10 -2
- package/dist/types/components/mui-search-input/api.d.ts +40 -0
- package/dist/types/components/mui-search-input/doc.d.ts +2 -0
- package/dist/types/components/mui-search-input/index.d.ts +3 -0
- package/dist/types/components/mui-select/api.d.ts +12 -0
- package/dist/types/components/mui-status/api.d.ts +24 -0
- package/dist/types/components/mui-status/doc.d.ts +2 -0
- package/dist/types/components/mui-status/index.d.ts +1 -0
- package/dist/types/components/mui-switch/api.d.ts +4 -0
- package/dist/types/components/mui-table/api.d.ts +15 -0
- package/dist/types/components/mui-textarea/api.d.ts +12 -0
- package/dist/types/components/mui-time/api.d.ts +41 -0
- package/dist/types/components/mui-time/doc.d.ts +2 -0
- package/dist/types/components/mui-time/index.d.ts +1 -0
- package/dist/types/components/mui-time-picker/api.d.ts +38 -0
- package/dist/types/components/mui-time-picker/doc.d.ts +2 -0
- package/dist/types/components/mui-time-picker/index.d.ts +4 -0
- package/dist/types/components/mui-video-thumbnail/api.d.ts +28 -0
- package/dist/types/components/mui-video-thumbnail/doc.d.ts +2 -0
- package/dist/types/components/mui-video-thumbnail/index.d.ts +1 -0
- package/dist/types/index.d.ts +27 -2
- package/dist/types/knowledge/compositions.d.ts +4644 -0
- package/dist/types/knowledge/index.d.ts +4657 -0
- package/dist/types/knowledge/keywords.d.ts +4 -0
- package/dist/types/knowledge/rules.d.ts +1 -0
- package/dist/types/tokens/js/index.d.ts +11 -7
- package/package.json +131 -12
- package/dist/esm/components/mui-form-hint/index.js +0 -1
- package/dist/types/components/mui-form-hint/index.d.ts +0 -1
- /package/dist/types/components/{mui-form-hint → mui-avatar-chip}/doc.d.ts +0 -0
- /package/dist/types/components/mui-icons/{rectangle-bottom-panel.d.ts → copy.d.ts} +0 -0
|
@@ -1,21 +1,164 @@
|
|
|
1
|
-
class
|
|
1
|
+
class n extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
|
-
super(), this.
|
|
3
|
+
super(), this.hoverRow = null, this.handlePointerOver = (t) => {
|
|
4
|
+
if (!this.isHoverHighlightEnabled()) return;
|
|
5
|
+
const e = this.getEventRow(t);
|
|
6
|
+
if (!e || !this.isBodyRow(e)) {
|
|
7
|
+
this.hoverRow && (this.hoverRow = null, this.scheduleHighlightUpdate());
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
this.hoverRow !== e && (this.hoverRow = e, this.scheduleHighlightUpdate());
|
|
11
|
+
}, this.handlePointerLeave = () => {
|
|
12
|
+
this.hoverRow && (this.hoverRow = null, this.scheduleHighlightUpdate());
|
|
13
|
+
}, this.handleRowClick = (t) => {
|
|
14
|
+
if (!this.hasHighlightMode("select")) return;
|
|
15
|
+
const e = this.getEventRow(t);
|
|
16
|
+
if (!e || !this.isBodyRow(e)) return;
|
|
17
|
+
const i = e.getAttribute("row-id"), r = this.getBodyRows().indexOf(e);
|
|
18
|
+
i ? (this.setAttribute("highlight-row", i), this.removeAttribute("highlight-row-index")) : r >= 0 && (this.setAttribute("highlight-row-index", String(r)), this.removeAttribute("highlight-row")), this.dispatchEvent(
|
|
19
|
+
new CustomEvent("row-highlight-change", {
|
|
20
|
+
detail: { row: e, rowId: i, rowIndex: r, source: "select" },
|
|
21
|
+
bubbles: !0
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
}, this.attachShadow({ mode: "open" });
|
|
25
|
+
}
|
|
26
|
+
static get observedAttributes() {
|
|
27
|
+
return ["highlight", "highlight-row", "highlight-row-index"];
|
|
4
28
|
}
|
|
5
29
|
connectedCallback() {
|
|
6
|
-
this.setAttribute("role", "table"), this.
|
|
30
|
+
this.setAttribute("role", "table"), this.render(), this.addEventListener("pointerover", this.handlePointerOver), this.addEventListener("pointerleave", this.handlePointerLeave), this.addEventListener("click", this.handleRowClick), this.syncHighlightTracking(), this.scheduleHighlightUpdate();
|
|
31
|
+
}
|
|
32
|
+
disconnectedCallback() {
|
|
33
|
+
this.removeEventListener("pointerover", this.handlePointerOver), this.removeEventListener("pointerleave", this.handlePointerLeave), this.removeEventListener("click", this.handleRowClick), this.disconnectLayoutObservers(), this.animationFrame && cancelAnimationFrame(this.animationFrame);
|
|
34
|
+
}
|
|
35
|
+
attributeChangedCallback() {
|
|
36
|
+
this.syncHighlightTracking(), this.scheduleHighlightUpdate();
|
|
37
|
+
}
|
|
38
|
+
hasHighlightTarget() {
|
|
39
|
+
return this.hasAttribute("highlight-row") || this.hasAttribute("highlight-row-index");
|
|
40
|
+
}
|
|
41
|
+
get highlightModes() {
|
|
42
|
+
return (this.getAttribute("highlight") || "").split(/\s+/).map((t) => t.trim().toLowerCase()).filter(Boolean);
|
|
43
|
+
}
|
|
44
|
+
hasHighlightMode(t) {
|
|
45
|
+
return this.highlightModes.includes(t);
|
|
46
|
+
}
|
|
47
|
+
isHoverHighlightEnabled() {
|
|
48
|
+
return this.hasHighlightMode("hover") && !this.hasHighlightMode("select");
|
|
49
|
+
}
|
|
50
|
+
hasHighlightBehavior() {
|
|
51
|
+
return this.hasHighlightTarget() || this.highlightModes.length > 0;
|
|
52
|
+
}
|
|
53
|
+
getBodyRows() {
|
|
54
|
+
return Array.from(this.querySelectorAll("mui-row-group:not([heading]) > mui-row"));
|
|
55
|
+
}
|
|
56
|
+
getEventRow(t) {
|
|
57
|
+
return t.composedPath().find((e) => e instanceof HTMLElement && e.tagName.toLowerCase() === "mui-row");
|
|
58
|
+
}
|
|
59
|
+
isBodyRow(t) {
|
|
60
|
+
return this.getBodyRows().includes(t);
|
|
61
|
+
}
|
|
62
|
+
getHighlightRow() {
|
|
63
|
+
if (this.hoverRow && this.isHoverHighlightEnabled())
|
|
64
|
+
return this.hoverRow;
|
|
65
|
+
const t = this.getAttribute("highlight-row");
|
|
66
|
+
if (t)
|
|
67
|
+
return this.querySelector(`mui-row[row-id="${CSS.escape(t)}"]`);
|
|
68
|
+
const e = this.getAttribute("highlight-row-index");
|
|
69
|
+
if (e === null) return null;
|
|
70
|
+
const i = Number.parseInt(e, 10);
|
|
71
|
+
return !Number.isFinite(i) || i < 0 ? null : this.getBodyRows()[i] || null;
|
|
72
|
+
}
|
|
73
|
+
observeLayout() {
|
|
74
|
+
var t, e;
|
|
75
|
+
(t = this.resizeObserver) == null || t.disconnect(), (e = this.mutationObserver) == null || e.disconnect(), typeof ResizeObserver < "u" && (this.resizeObserver = new ResizeObserver(() => this.scheduleHighlightUpdate()), this.resizeObserver.observe(this)), this.mutationObserver = new MutationObserver(() => this.scheduleHighlightUpdate()), this.mutationObserver.observe(this, {
|
|
76
|
+
childList: !0,
|
|
77
|
+
subtree: !0,
|
|
78
|
+
attributes: !0,
|
|
79
|
+
attributeFilter: ["row-id", "hidden", "style", "columns", "size"]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
disconnectLayoutObservers() {
|
|
83
|
+
var t, e;
|
|
84
|
+
(t = this.resizeObserver) == null || t.disconnect(), (e = this.mutationObserver) == null || e.disconnect(), this.resizeObserver = void 0, this.mutationObserver = void 0;
|
|
85
|
+
}
|
|
86
|
+
syncHighlightTracking() {
|
|
87
|
+
this.hasHighlightBehavior() ? this.observeLayout() : this.disconnectLayoutObservers();
|
|
88
|
+
}
|
|
89
|
+
scheduleHighlightUpdate() {
|
|
90
|
+
this.animationFrame && cancelAnimationFrame(this.animationFrame), this.animationFrame = requestAnimationFrame(() => {
|
|
91
|
+
this.animationFrame = void 0, this.updateHighlight();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
updateHighlight() {
|
|
95
|
+
var o;
|
|
96
|
+
const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector(".row-highlight");
|
|
97
|
+
if (!t) return;
|
|
98
|
+
const e = this.getHighlightRow();
|
|
99
|
+
if (!e) {
|
|
100
|
+
t.removeAttribute("data-visible"), t.removeAttribute("data-last-row");
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const i = this.getBodyRows(), r = this.getBoundingClientRect(), s = e.getBoundingClientRect(), a = s.top - r.top, h = t.hasAttribute("data-visible");
|
|
104
|
+
h || t.setAttribute("data-positioning", ""), t.style.transform = `translate3d(0, ${a}px, 0)`, t.style.height = `${s.height}px`, t.toggleAttribute("data-last-row", i.at(-1) === e), t.setAttribute("data-visible", ""), h || requestAnimationFrame(() => {
|
|
105
|
+
t.removeAttribute("data-positioning");
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
render() {
|
|
109
|
+
this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
|
|
7
110
|
`
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
111
|
+
<style>
|
|
112
|
+
:host {
|
|
113
|
+
display: block;
|
|
114
|
+
box-sizing: border-box;
|
|
115
|
+
text-indent: initial;
|
|
116
|
+
width: 100%;
|
|
117
|
+
margin: var(--space-000);
|
|
118
|
+
position: relative;
|
|
119
|
+
}
|
|
120
|
+
:host([card-slot]) {
|
|
121
|
+
--table-row-highlight-background: var(--surface-elevated-200);
|
|
122
|
+
}
|
|
123
|
+
:host([card-slot]) .row-highlight[data-last-row] {
|
|
124
|
+
border-bottom-left-radius: var(--card-radius);
|
|
125
|
+
border-bottom-right-radius: var(--card-radius);
|
|
126
|
+
}
|
|
127
|
+
.row-highlight {
|
|
128
|
+
position: absolute;
|
|
129
|
+
inset-block-start: 0;
|
|
130
|
+
inset-inline: 0;
|
|
131
|
+
height: 0;
|
|
132
|
+
border-radius: var(--table-row-highlight-radius, var(--radius-000));
|
|
133
|
+
background: var(--table-row-highlight-background, var(--surface-elevated-100));
|
|
134
|
+
box-shadow: var(--table-row-highlight-shadow, none);
|
|
135
|
+
opacity: 0;
|
|
136
|
+
pointer-events: none;
|
|
137
|
+
transform: translate3d(0, 0, 0);
|
|
138
|
+
transition:
|
|
139
|
+
transform var(--table-row-highlight-speed, var(--speed-200)) var(--table-row-highlight-easing, ease),
|
|
140
|
+
height var(--table-row-highlight-speed, var(--speed-200)) var(--table-row-highlight-easing, ease),
|
|
141
|
+
opacity var(--speed-100) ease;
|
|
142
|
+
z-index: 0;
|
|
143
|
+
}
|
|
144
|
+
.row-highlight[data-visible] {
|
|
145
|
+
opacity: 1;
|
|
146
|
+
}
|
|
147
|
+
.row-highlight[data-positioning] {
|
|
148
|
+
transition: opacity var(--speed-100) ease;
|
|
149
|
+
}
|
|
150
|
+
slot {
|
|
151
|
+
position: relative;
|
|
152
|
+
z-index: 1;
|
|
153
|
+
}
|
|
154
|
+
::slotted(mui-row-group) {
|
|
155
|
+
position: relative;
|
|
156
|
+
z-index: 1;
|
|
157
|
+
}
|
|
158
|
+
</style>
|
|
159
|
+
<div class="row-highlight" aria-hidden="true"></div>
|
|
160
|
+
<slot></slot>
|
|
18
161
|
`);
|
|
19
162
|
}
|
|
20
163
|
}
|
|
21
|
-
customElements.get("mui-table") || customElements.define("mui-table",
|
|
164
|
+
customElements.get("mui-table") || customElements.define("mui-table", n);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
class
|
|
1
|
+
class a extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
|
-
super(), this.handleTabChange = this.handleTabChange.bind(this);
|
|
3
|
+
super(), this.handleTabChange = this.handleTabChange.bind(this), this.attachShadow({ mode: "open" });
|
|
4
4
|
}
|
|
5
5
|
connectedCallback() {
|
|
6
|
-
this.addEventListener("tab-change", this.handleTabChange), requestAnimationFrame(() => this.initializePanels());
|
|
6
|
+
this.render(), this.addEventListener("tab-change", this.handleTabChange), requestAnimationFrame(() => this.initializePanels());
|
|
7
7
|
}
|
|
8
8
|
disconnectedCallback() {
|
|
9
9
|
this.removeEventListener("tab-change", this.handleTabChange);
|
|
@@ -22,9 +22,20 @@ class s extends HTMLElement {
|
|
|
22
22
|
if (!e.length) return;
|
|
23
23
|
let n = e.find((t) => t.getAttribute("item") === i) || null;
|
|
24
24
|
n || (n = e[0]), e.forEach((t) => {
|
|
25
|
-
const
|
|
26
|
-
t.toggleAttribute("hidden", !
|
|
25
|
+
const s = t === n;
|
|
26
|
+
t.toggleAttribute("hidden", !s), t.setAttribute("aria-hidden", String(!s)), t.style.display = s ? "" : "none";
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
+
render() {
|
|
30
|
+
this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
|
|
31
|
+
`
|
|
32
|
+
<style>
|
|
33
|
+
:host {
|
|
34
|
+
display: block;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
37
|
+
<slot></slot>
|
|
38
|
+
`);
|
|
39
|
+
}
|
|
29
40
|
}
|
|
30
|
-
customElements.get("mui-tab-controller") || customElements.define("mui-tab-controller",
|
|
41
|
+
customElements.get("mui-tab-controller") || customElements.define("mui-tab-controller", a);
|
|
@@ -5,7 +5,7 @@ class i extends HTMLElement {
|
|
|
5
5
|
}
|
|
6
6
|
getBadgeSizeFromTabSize() {
|
|
7
7
|
const t = this.getAttribute("size") || "medium";
|
|
8
|
-
return t === "x-small" ? "
|
|
8
|
+
return t === "x-small" ? "xx-small" : t === "small" ? "x-small" : t === "large" ? "large" : "medium";
|
|
9
9
|
}
|
|
10
10
|
hasAssignedContent(t) {
|
|
11
11
|
return t ? t.assignedNodes({ flatten: !0 }).some(
|
|
@@ -55,7 +55,7 @@ class i extends HTMLElement {
|
|
|
55
55
|
background: transparent;
|
|
56
56
|
white-space: nowrap;
|
|
57
57
|
cursor: pointer;
|
|
58
|
-
min-height: var(--
|
|
58
|
+
min-height: var(--tab-item-size-medium, var(--action-size-medium));
|
|
59
59
|
box-sizing: border-box;
|
|
60
60
|
border-radius: calc(var(--tab-radius) - 0.2rem);
|
|
61
61
|
}
|
|
@@ -140,12 +140,24 @@ class i extends HTMLElement {
|
|
|
140
140
|
margin-left: var(--tab-badge-offset-large);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
:host ::slotted(mui-badge[variant="neutral"]:not([color])[slot="before"]),
|
|
144
|
+
:host ::slotted(mui-badge[variant="neutral"]:not([color])[slot="after"]) {
|
|
145
|
+
--badge-background: var(--tab-text-color);
|
|
146
|
+
--badge-text-color: var(--tab-background);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:host([active]) ::slotted(mui-badge[variant="neutral"]:not([color])[slot="before"]),
|
|
150
|
+
:host([active]) ::slotted(mui-badge[variant="neutral"]:not([color])[slot="after"]) {
|
|
151
|
+
--badge-background: var(--tab-text-color-active);
|
|
152
|
+
--badge-text-color: var(--tab-background-active);
|
|
153
|
+
}
|
|
154
|
+
|
|
143
155
|
:host([size="x-small"]) {
|
|
144
156
|
font-size: var(--text-font-size-xs);
|
|
145
157
|
line-height: var(--text-line-height-xs);
|
|
146
158
|
font-weight: var(--font-weight-semi-bold);
|
|
147
159
|
padding: var(--action-padding-x-small);
|
|
148
|
-
min-height: var(--
|
|
160
|
+
min-height: var(--tab-item-size-x-small, var(--action-size-x-small));
|
|
149
161
|
}
|
|
150
162
|
|
|
151
163
|
:host([size="x-small"][has-after]) {
|
|
@@ -169,7 +181,7 @@ class i extends HTMLElement {
|
|
|
169
181
|
font-size: var(--text-font-size-s);
|
|
170
182
|
line-height: var(--text-line-height-s);
|
|
171
183
|
padding: var(--action-padding-small);
|
|
172
|
-
min-height: var(--
|
|
184
|
+
min-height: var(--tab-item-size-small, var(--action-size-small));
|
|
173
185
|
}
|
|
174
186
|
|
|
175
187
|
:host([size="small"][has-after]) {
|
|
@@ -193,7 +205,7 @@ class i extends HTMLElement {
|
|
|
193
205
|
font-size: var(--text-font-size-l);
|
|
194
206
|
line-height: var(--text-line-height-l);
|
|
195
207
|
padding: var(--action-padding-large);
|
|
196
|
-
min-height: var(--
|
|
208
|
+
min-height: var(--tab-item-size-large, var(--action-size-large));
|
|
197
209
|
}
|
|
198
210
|
|
|
199
211
|
:host([size="large"][has-after]) {
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
class
|
|
1
|
+
class d extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
3
|
super(), this._animationSpeed = 200, this.attachShadow({ mode: "open" }), this._handleResize = this._handleResize.bind(this), this._hasInitialized = !1, this._resizeTimeout = null, this._observedTab = null, this._activeTab = null, this._resizeObserver = new ResizeObserver(() => {
|
|
4
4
|
this._activeTab && this._updateHighlight(this._activeTab);
|
|
5
5
|
});
|
|
6
6
|
}
|
|
7
7
|
static get observedAttributes() {
|
|
8
|
-
return ["size", "variant"];
|
|
8
|
+
return ["size", "variant", "stroke", "radius"];
|
|
9
9
|
}
|
|
10
|
-
attributeChangedCallback(e,
|
|
11
|
-
(e === "size" || e === "variant") &&
|
|
10
|
+
attributeChangedCallback(e, i, s) {
|
|
11
|
+
(e === "size" || e === "variant" || e === "stroke") && i !== s && (this._applySizeToChildren(), this._applyVariantToChildren(), this._activeTab && this._updateHighlight(this._activeTab)), e === "radius" && i !== s && this._syncRadiusAttribute();
|
|
12
12
|
}
|
|
13
13
|
connectedCallback() {
|
|
14
|
-
this.hasAttribute("size") || this.setAttribute("size", "medium");
|
|
14
|
+
this.hasAttribute("size") || this.setAttribute("size", "medium"), this._syncRadiusAttribute();
|
|
15
15
|
const e = this.getAttribute("speed") || "200";
|
|
16
16
|
this._animationSpeed = parseInt(e, 10);
|
|
17
|
-
const
|
|
18
|
-
this._applySizeToChildren(
|
|
19
|
-
const
|
|
20
|
-
this.setAttribute("aria-orientation",
|
|
21
|
-
const
|
|
17
|
+
const i = Array.from(this.children);
|
|
18
|
+
this._applySizeToChildren(i), this._applyVariantToChildren(i), this.setAttribute("role", "tablist");
|
|
19
|
+
const s = this.getAttribute("orientation") || "horizontal";
|
|
20
|
+
this.setAttribute("aria-orientation", s), this.addEventListener("keydown", (t) => {
|
|
21
|
+
const a = Array.from(this.children), r = a.findIndex((l) => l.hasAttribute("active")), n = this.getAttribute("aria-orientation") || "horizontal";
|
|
22
22
|
let o = r;
|
|
23
23
|
switch (t.key) {
|
|
24
24
|
case "ArrowRight":
|
|
25
|
-
n === "horizontal" && (o = (r + 1) %
|
|
25
|
+
n === "horizontal" && (o = (r + 1) % a.length, t.preventDefault());
|
|
26
26
|
break;
|
|
27
27
|
case "ArrowLeft":
|
|
28
|
-
n === "horizontal" && (o = (r - 1 +
|
|
28
|
+
n === "horizontal" && (o = (r - 1 + a.length) % a.length, t.preventDefault());
|
|
29
29
|
break;
|
|
30
30
|
case "ArrowDown":
|
|
31
|
-
n === "vertical" && (o = (r + 1) %
|
|
31
|
+
n === "vertical" && (o = (r + 1) % a.length, t.preventDefault());
|
|
32
32
|
break;
|
|
33
33
|
case "ArrowUp":
|
|
34
|
-
n === "vertical" && (o = (r - 1 +
|
|
34
|
+
n === "vertical" && (o = (r - 1 + a.length) % a.length, t.preventDefault());
|
|
35
35
|
break;
|
|
36
36
|
case "Home":
|
|
37
37
|
o = 0, t.preventDefault();
|
|
38
38
|
break;
|
|
39
39
|
case "End":
|
|
40
|
-
o =
|
|
40
|
+
o = a.length - 1, t.preventDefault();
|
|
41
41
|
break;
|
|
42
42
|
default:
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
const h =
|
|
45
|
+
const h = a[o];
|
|
46
46
|
h && (this.setActiveTab(h), h.focus());
|
|
47
|
-
}),
|
|
48
|
-
t.classList.remove("first", "middle", "last", "only"),
|
|
47
|
+
}), i.forEach((t, a) => {
|
|
48
|
+
t.classList.remove("first", "middle", "last", "only"), i.length === 1 ? t.classList.add("only") : a === 0 ? t.classList.add("first") : a === i.length - 1 ? t.classList.add("last") : t.classList.add("middle");
|
|
49
49
|
}), this.addEventListener("click", (t) => {
|
|
50
50
|
const r = (typeof t.composedPath == "function" ? t.composedPath() : []).find(
|
|
51
51
|
(h) => h instanceof HTMLElement && h.tagName.toLowerCase() === "mui-tab-item"
|
|
@@ -56,24 +56,48 @@ class l extends HTMLElement {
|
|
|
56
56
|
<style>
|
|
57
57
|
:host {
|
|
58
58
|
--tab-animation-speed: ${this._animationSpeed}ms;
|
|
59
|
+
--tab-stroke-size: var(--stroke-size-100);
|
|
60
|
+
--tab-item-size-x-small: calc(var(--action-size-x-small) - (var(--tab-stroke-size) * 2));
|
|
61
|
+
--tab-item-size-small: calc(var(--action-size-small) - (var(--tab-stroke-size) * 2));
|
|
62
|
+
--tab-item-size-medium: calc(var(--action-size-medium) - (var(--tab-stroke-size) * 2));
|
|
63
|
+
--tab-item-size-large: calc(var(--action-size-large) - (var(--tab-stroke-size) * 2));
|
|
64
|
+
--tab-active-shadow: var(--tab-shadow-active);
|
|
65
|
+
--tab-active-inset-width: var(--stroke-size-300);
|
|
59
66
|
position: relative;
|
|
60
67
|
display: inline-flex;
|
|
61
|
-
border-width: var(--stroke-size
|
|
68
|
+
border-width: var(--tab-stroke-size);
|
|
62
69
|
border-style: var(--stroke-solid);
|
|
63
70
|
border-color: var(--tab-border-color);
|
|
64
71
|
border-radius: var(--tab-radius);
|
|
65
72
|
background: var(--tab-background);
|
|
66
|
-
will-change: transform;
|
|
67
73
|
box-sizing: border-box;
|
|
68
74
|
overflow: hidden;
|
|
69
75
|
}
|
|
70
76
|
|
|
77
|
+
:host([active-inset]) {
|
|
78
|
+
--tab-active-shadow: none;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:host([stroke="none"]) {
|
|
82
|
+
--tab-stroke-size: 0px;
|
|
83
|
+
--tab-item-size-x-small: var(--action-size-x-small);
|
|
84
|
+
--tab-item-size-small: var(--action-size-small);
|
|
85
|
+
--tab-item-size-medium: var(--action-size-medium);
|
|
86
|
+
--tab-item-size-large: var(--action-size-large);
|
|
87
|
+
border: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
71
90
|
:host([full-width]) {
|
|
72
91
|
display: flex;
|
|
73
92
|
width: 100%;
|
|
74
93
|
}
|
|
75
94
|
|
|
76
95
|
:host([variant="dots"]) {
|
|
96
|
+
--tab-stroke-size: 0px;
|
|
97
|
+
--tab-item-size-x-small: var(--action-size-x-small);
|
|
98
|
+
--tab-item-size-small: var(--action-size-small);
|
|
99
|
+
--tab-item-size-medium: var(--action-size-medium);
|
|
100
|
+
--tab-item-size-large: var(--action-size-large);
|
|
77
101
|
border: none;
|
|
78
102
|
border-radius: var(--radius-000);
|
|
79
103
|
background: transparent;
|
|
@@ -83,6 +107,11 @@ class l extends HTMLElement {
|
|
|
83
107
|
}
|
|
84
108
|
|
|
85
109
|
:host([variant="ghost"]) {
|
|
110
|
+
--tab-stroke-size: 0px;
|
|
111
|
+
--tab-item-size-x-small: var(--action-size-x-small);
|
|
112
|
+
--tab-item-size-small: var(--action-size-small);
|
|
113
|
+
--tab-item-size-medium: var(--action-size-medium);
|
|
114
|
+
--tab-item-size-large: var(--action-size-large);
|
|
86
115
|
border: none;
|
|
87
116
|
background: transparent;
|
|
88
117
|
box-shadow: var(--tabs-ghost-box-shadow);
|
|
@@ -106,12 +135,29 @@ class l extends HTMLElement {
|
|
|
106
135
|
z-index: 0;
|
|
107
136
|
padding: var(--space-200) var(--space-400);
|
|
108
137
|
box-sizing: border-box;
|
|
109
|
-
box-shadow: var(--tab-shadow
|
|
110
|
-
|
|
111
|
-
transform: translateX(0) translateZ(0);
|
|
138
|
+
box-shadow: var(--tab-active-shadow);
|
|
139
|
+
transform: translateX(0);
|
|
112
140
|
width: 0;
|
|
113
141
|
}
|
|
114
142
|
|
|
143
|
+
.highlight::after {
|
|
144
|
+
content: none;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
:host([active-inset]) .highlight {
|
|
148
|
+
background: var(--tab-background);
|
|
149
|
+
box-shadow: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
:host([active-inset]) .highlight::after {
|
|
153
|
+
content: "";
|
|
154
|
+
position: absolute;
|
|
155
|
+
inset: var(--tab-active-inset-width);
|
|
156
|
+
border-radius: calc(var(--tab-radius) - var(--tab-active-inset-width));
|
|
157
|
+
background: var(--tab-background-active);
|
|
158
|
+
box-shadow: var(--tab-active-shadow);
|
|
159
|
+
}
|
|
160
|
+
|
|
115
161
|
:host([variant="dots"]) .highlight {
|
|
116
162
|
display: none;
|
|
117
163
|
}
|
|
@@ -120,8 +166,6 @@ class l extends HTMLElement {
|
|
|
120
166
|
position: relative;
|
|
121
167
|
z-index: 1;
|
|
122
168
|
flex: 1;
|
|
123
|
-
contain: content; /* Performance optimization */
|
|
124
|
-
transform: translateZ(0);
|
|
125
169
|
}
|
|
126
170
|
|
|
127
171
|
:host([variant="dots"]) ::slotted(mui-tab-item) {
|
|
@@ -133,31 +177,41 @@ class l extends HTMLElement {
|
|
|
133
177
|
`, window.addEventListener("resize", this._handleResize), this._resizeObserver.observe(this), requestAnimationFrame(() => {
|
|
134
178
|
const t = this.shadowRoot.querySelector(".highlight");
|
|
135
179
|
t.style.transition = "none";
|
|
136
|
-
const
|
|
137
|
-
|
|
180
|
+
const a = i.find((r) => r.hasAttribute("active")) || i[0];
|
|
181
|
+
a && (this._activeTab = a, a.setAttribute("active", ""), this._updateHighlight(a), this._observedTab = a, this._resizeObserver.observe(a)), t.offsetWidth, requestAnimationFrame(() => {
|
|
138
182
|
t.style.transition = "", this._hasInitialized = !0;
|
|
139
183
|
});
|
|
140
184
|
}));
|
|
141
185
|
}
|
|
142
186
|
_applySizeToChildren(e) {
|
|
143
|
-
const
|
|
187
|
+
const i = this.getAttribute("size") || "medium";
|
|
144
188
|
(e || Array.from(this.children)).forEach((t) => {
|
|
145
|
-
t.tagName.toLowerCase() === "mui-tab-item" && t.setAttribute("size",
|
|
189
|
+
t.tagName.toLowerCase() === "mui-tab-item" && t.setAttribute("size", i);
|
|
146
190
|
});
|
|
147
191
|
}
|
|
148
192
|
_applyVariantToChildren(e) {
|
|
149
|
-
const
|
|
193
|
+
const i = this.getAttribute("variant") || "default";
|
|
150
194
|
(e || Array.from(this.children)).forEach((t) => {
|
|
151
|
-
t.tagName.toLowerCase() === "mui-tab-item" && t.setAttribute("variant",
|
|
195
|
+
t.tagName.toLowerCase() === "mui-tab-item" && t.setAttribute("variant", i);
|
|
152
196
|
});
|
|
153
197
|
}
|
|
198
|
+
_syncRadiusAttribute() {
|
|
199
|
+
var t;
|
|
200
|
+
const e = (t = this.getAttribute("radius")) == null ? void 0 : t.trim();
|
|
201
|
+
if (!e) {
|
|
202
|
+
this.style.removeProperty("--tab-radius");
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const i = e.startsWith("radius-") ? e.replace("radius-", "") : e, s = /^(000|100|150|200|300|400|500|600)$/.test(i);
|
|
206
|
+
this.style.setProperty("--tab-radius", s ? `var(--radius-${i})` : e);
|
|
207
|
+
}
|
|
154
208
|
disconnectedCallback() {
|
|
155
209
|
window.removeEventListener("resize", this._handleResize), this._observedTab && this._resizeObserver.unobserve(this._observedTab), this._resizeObserver.unobserve(this), this._resizeTimeout && clearTimeout(this._resizeTimeout), this._resizeObserver.disconnect();
|
|
156
210
|
}
|
|
157
211
|
_handleResize() {
|
|
158
212
|
if (!this._activeTab) return;
|
|
159
|
-
this._resizeTimeout && clearTimeout(this._resizeTimeout), this._activeTab && Array.from(this.children).forEach((
|
|
160
|
-
|
|
213
|
+
this._resizeTimeout && clearTimeout(this._resizeTimeout), this._activeTab && Array.from(this.children).forEach((i) => {
|
|
214
|
+
i === this._activeTab ? i.setAttribute("active", "") : i.removeAttribute("active");
|
|
161
215
|
});
|
|
162
216
|
const e = this.shadowRoot.querySelector(".highlight");
|
|
163
217
|
e && (e.style.transition = "none", this._updateHighlight(this._activeTab), e.offsetWidth, this._resizeTimeout = window.setTimeout(() => {
|
|
@@ -166,15 +220,15 @@ class l extends HTMLElement {
|
|
|
166
220
|
}
|
|
167
221
|
_updateHighlight(e) {
|
|
168
222
|
if (this.getAttribute("variant") === "dots") return;
|
|
169
|
-
const
|
|
170
|
-
|
|
223
|
+
const i = this.shadowRoot.querySelector(".highlight"), s = e.getBoundingClientRect(), t = this.getBoundingClientRect(), a = parseFloat(getComputedStyle(this).borderWidth) || 0, r = s.left - t.left - a;
|
|
224
|
+
i.style.transform = `translateX(${r}px)`, i.style.width = `${s.width}px`;
|
|
171
225
|
}
|
|
172
226
|
setActiveTab(e) {
|
|
173
|
-
if (Array.from(this.children).forEach((
|
|
227
|
+
if (Array.from(this.children).forEach((s) => s.removeAttribute("active")), e.setAttribute("active", ""), this._activeTab = e, this._observedTab && this._observedTab !== e && this._resizeObserver.unobserve(this._observedTab), this._observedTab = e, this._resizeObserver.observe(e), this._hasInitialized)
|
|
174
228
|
this._updateHighlight(e);
|
|
175
229
|
else {
|
|
176
|
-
const
|
|
177
|
-
|
|
230
|
+
const s = this.shadowRoot.querySelector(".highlight");
|
|
231
|
+
s.style.transition = "none", this._updateHighlight(e), s.offsetWidth, s.style.transition = "", this._hasInitialized = !0;
|
|
178
232
|
}
|
|
179
233
|
this.dispatchEvent(
|
|
180
234
|
new CustomEvent("tab-change", {
|
|
@@ -185,4 +239,4 @@ class l extends HTMLElement {
|
|
|
185
239
|
);
|
|
186
240
|
}
|
|
187
241
|
}
|
|
188
|
-
customElements.get("mui-tab-bar") || customElements.define("mui-tab-bar",
|
|
242
|
+
customElements.get("mui-tab-bar") || customElements.define("mui-tab-bar", d);
|