@muibook/components 20.0.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 +52 -1
- package/dist/esm/agent/keywords/index.js +2 -204
- package/dist/esm/agent/prompts/index.js +6 -434
- package/dist/esm/components/mui-accordion/core/index.js +25 -17
- package/dist/esm/components/mui-avatar/index.js +99 -42
- 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 +2 -2
- package/dist/esm/components/mui-body/index.js +20 -11
- package/dist/esm/components/mui-button/index.js +117 -65
- package/dist/esm/components/mui-calendar/index.js +199 -0
- package/dist/esm/components/mui-card/body/index.js +32 -17
- 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 +184 -68
- package/dist/esm/components/mui-chip-input/index.js +146 -137
- package/dist/esm/components/mui-chip-rail/index.js +154 -51
- package/dist/esm/components/mui-code/index.js +27 -8
- 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 +250 -63
- package/dist/esm/components/mui-field/index.js +1 -1
- package/dist/esm/components/mui-file-upload/index.js +13 -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-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 +87 -62
- package/dist/esm/components/mui-link/index.js +195 -83
- package/dist/esm/components/mui-media-player/index.js +1577 -83
- 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 +99 -71
- 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 +231 -42
- 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-switch/index.js +23 -20
- 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-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 +5 -5
- package/dist/esm/css/mui-brand.css +12 -8
- package/dist/esm/css/mui-tokens.css +417 -305
- package/dist/esm/css/readme.md +2 -2
- package/dist/esm/custom-elements.json +3678 -1553
- package/dist/esm/dynamic-attrs.json +263 -66
- package/dist/esm/index.js +30 -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 +2 -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-input/api.d.ts +4 -0
- package/dist/types/components/mui-chip-rail/index.d.ts +1 -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-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-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/index.d.ts +24 -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 +119 -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,46 +1,245 @@
|
|
|
1
1
|
import "../mui-icons/close/index.js";
|
|
2
|
+
import "../mui-icons/left-chevron/index.js";
|
|
3
|
+
import "../mui-body/index.js";
|
|
2
4
|
import "../mui-button/index.js";
|
|
3
|
-
|
|
5
|
+
import { getPartMap as f } from "../../utils/part-map/index.js";
|
|
6
|
+
const g = 240, W = 320, S = 96, m = 16, z = 64, k = 4;
|
|
7
|
+
class A extends HTMLElement {
|
|
4
8
|
constructor() {
|
|
5
|
-
super(), this.innerEl = null, this.overlayEl = null, this.footerEl = null, this.actionsSlot = null, this.pushLayout = null, this.outer = null, this.persistentLayout = null, this.headerEl = null, this.headerSlot = null, this._handleEscape = (
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
super(), this.innerEl = null, this.overlayEl = null, this.footerEl = null, this.actionsSlot = null, this.pushLayout = null, this.outer = null, this.persistentLayout = null, this.headerEl = null, this.headerSlot = null, this.resizeRailEl = null, this.workspaceResizeRailEls = [], this.resizeState = null, this.workspaceResizeState = null, this._handleEscape = (e) => {
|
|
10
|
+
const t = this.getAttribute("variant") || "overlay";
|
|
11
|
+
if (e.key === "Escape") {
|
|
12
|
+
if (t === "workspace") {
|
|
13
|
+
const i = this.getFocusedWorkspaceResizeSide();
|
|
14
|
+
if (i && this.hasAttribute(`${i}-open`)) {
|
|
15
|
+
e.preventDefault(), this.removeAttribute(`${i}-open`), this.syncWorkspaceState();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
this.usesMobileOverlay(t) && this.close();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
t === "push" && !this.isEventInsideDrawer(e) || (t === "overlay" || t === "push" || this.usesMobileOverlay(t)) && this.close();
|
|
22
|
+
}
|
|
23
|
+
}, this._computedSide = "left", this._handleResizeStart = (e) => {
|
|
24
|
+
var i;
|
|
25
|
+
const t = this.getAttribute("variant") || "overlay";
|
|
26
|
+
!this.hasAttribute("resize-rail") || t !== "push" && t !== "persistent" || (e.preventDefault(), this.clearResizeRailKeyboardHint(this.resizeRailEl), this.resizeState = {
|
|
27
|
+
startX: e.clientX,
|
|
28
|
+
startY: e.clientY,
|
|
29
|
+
startWidth: this.getCurrentDrawerWidth(),
|
|
30
|
+
currentWidth: this.getCurrentDrawerWidth(),
|
|
31
|
+
closeOnRelease: !1,
|
|
32
|
+
side: this.getAttribute("side") || this._computedSide
|
|
33
|
+
}, this.syncResizeCloseOpacity(this.resizeState.startWidth), this.setAttribute("resizing", ""), (i = this.resizeRailEl) == null || i.classList.add("is-resizing"), window.addEventListener("pointermove", this._handleResizeMove), window.addEventListener("pointerup", this._handleResizeEnd));
|
|
34
|
+
}, this._handleResizeMove = (e) => {
|
|
35
|
+
var d, l;
|
|
36
|
+
if (!this.resizeState) return;
|
|
37
|
+
const t = e.clientX - this.resizeState.startX, i = this.getAttribute("variant") || "overlay", s = this.getResizeRailMinDrawerWidth(), r = this.getResizeRailMaxDrawerWidth(), a = this.resizeState.side === "left" ? this.resizeState.startWidth + t : this.resizeState.startWidth - t, o = Math.min(this.getResizeRailCloseThreshold(), s - 1), n = Math.max(s, Math.min(a, r));
|
|
38
|
+
this.resizeState.currentWidth = n, this.resizeState.closeOnRelease = i === "push" && a <= o, (d = this.resizeRailEl) == null || d.classList.toggle("threshold", this.resizeState.closeOnRelease);
|
|
39
|
+
const h = (a <= s || a >= r) && !this.resizeState.closeOnRelease;
|
|
40
|
+
(l = this.resizeRailEl) == null || l.classList.toggle("at-limit", h), this.syncResizeCloseOpacity(a), this.setAttribute("width", `${Math.round(n)}px`);
|
|
41
|
+
}, this._handleResizeEnd = (e) => {
|
|
42
|
+
var s, r, a, o;
|
|
43
|
+
const t = this.resizeState, i = ((s = this.resizeState) == null ? void 0 : s.closeOnRelease) && (this.getAttribute("variant") || "overlay") === "push";
|
|
44
|
+
this.resizeState = null, this.removeAttribute("resizing"), (r = this.resizeRailEl) == null || r.classList.remove("is-resizing", "threshold", "at-limit"), window.removeEventListener("pointermove", this._handleResizeMove), window.removeEventListener("pointerup", this._handleResizeEnd), i ? this.close() : this.syncResizeCloseOpacity(this.getCurrentDrawerWidth()), t && this.isResizeRailPointerClick(t.startX, t.startY, e) ? (a = this.resizeRailEl) == null || a.focus() : (o = this.resizeRailEl) == null || o.blur();
|
|
45
|
+
}, this._handleResizeKeydown = (e) => {
|
|
9
46
|
const t = this.getAttribute("variant") || "overlay";
|
|
10
|
-
if (t
|
|
11
|
-
|
|
12
|
-
|
|
47
|
+
if (!this.hasAttribute("resize-rail") || t !== "push" && t !== "persistent" || e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
const i = this.getAttribute("side") || this._computedSide, s = e.key === "ArrowRight" ? 1 : -1, r = e.shiftKey ? z : m, a = this.getCurrentDrawerWidth() + (i === "left" ? s : -s) * r, o = Math.max(
|
|
50
|
+
this.getResizeRailMinDrawerWidth(),
|
|
51
|
+
Math.min(a, this.getResizeRailMaxDrawerWidth())
|
|
52
|
+
);
|
|
53
|
+
this.syncResizeRailKeyboardHint(
|
|
54
|
+
this.resizeRailEl,
|
|
55
|
+
a,
|
|
56
|
+
this.getResizeRailMinDrawerWidth(),
|
|
57
|
+
t === "push"
|
|
58
|
+
), this.setAttribute("width", `${Math.round(o)}px`), this.syncResizeCloseOpacity(o);
|
|
59
|
+
}, this._handleWorkspaceResizeStart = (e) => {
|
|
60
|
+
const t = e.currentTarget, i = t == null ? void 0 : t.dataset.workspaceResize;
|
|
61
|
+
(this.getAttribute("variant") || "overlay") !== "workspace" || !i || !this.hasAttribute("resize-rail") || this.hasAttribute(`${i}-open`) && (e.preventDefault(), this.clearResizeRailKeyboardHint(t), this.workspaceResizeState = {
|
|
62
|
+
side: i,
|
|
63
|
+
startX: e.clientX,
|
|
64
|
+
startY: e.clientY,
|
|
65
|
+
startLeftWidth: this.getWorkspacePanelWidth("left"),
|
|
66
|
+
startRightWidth: this.getWorkspacePanelWidth("right"),
|
|
67
|
+
closeOnRelease: !1
|
|
68
|
+
}, this.setAttribute("resizing", ""), t == null || t.classList.add("is-resizing"), this.syncWorkspaceResizeCloseOpacity(
|
|
69
|
+
i,
|
|
70
|
+
i === "left" ? this.workspaceResizeState.startLeftWidth : this.workspaceResizeState.startRightWidth
|
|
71
|
+
), window.addEventListener("pointermove", this._handleWorkspaceResizeMove), window.addEventListener("pointerup", this._handleWorkspaceResizeEnd));
|
|
72
|
+
}, this._handleWorkspaceResizeMove = (e) => {
|
|
73
|
+
var l, c;
|
|
74
|
+
if (!this.workspaceResizeState) return;
|
|
75
|
+
const t = e.clientX - this.workspaceResizeState.startX, i = this.workspaceResizeState.side, s = i === "left" ? this.workspaceResizeState.startLeftWidth : this.workspaceResizeState.startRightWidth, r = i === "left" ? s + t : s - t, a = this.getResizeRailMinDrawerWidth(i), o = this.getWorkspaceMaxPanelWidth(i), n = Math.min(this.getResizeRailCloseThreshold(), a - 1), h = Math.max(a, Math.min(r, o));
|
|
76
|
+
this.workspaceResizeState.closeOnRelease = r <= n, (l = this.getWorkspaceResizeRail(i)) == null || l.classList.toggle("threshold", this.workspaceResizeState.closeOnRelease);
|
|
77
|
+
const d = (r <= a || r >= o) && !this.workspaceResizeState.closeOnRelease;
|
|
78
|
+
(c = this.getWorkspaceResizeRail(i)) == null || c.classList.toggle("at-limit", d), this.syncWorkspaceResizeCloseOpacity(i, r), this.setAttribute(`${i}-width`, `${Math.round(h)}px`);
|
|
79
|
+
}, this._handleWorkspaceResizeEnd = (e) => {
|
|
80
|
+
const t = this.workspaceResizeState;
|
|
81
|
+
t != null && t.closeOnRelease && this.removeAttribute(`${t.side}-open`), this.workspaceResizeRailEls.forEach((s) => s.classList.remove("is-resizing", "threshold", "at-limit")), this.workspaceResizeState = null, this.removeAttribute("resizing"), window.removeEventListener("pointermove", this._handleWorkspaceResizeMove), window.removeEventListener("pointerup", this._handleWorkspaceResizeEnd), t && !t.closeOnRelease && this.syncWorkspaceResizeCloseOpacity(t.side, this.getWorkspacePanelWidth(t.side));
|
|
82
|
+
const i = t ? this.getWorkspaceResizeRail(t.side) : null;
|
|
83
|
+
t && !t.closeOnRelease && this.isResizeRailPointerClick(t.startX, t.startY, e) ? i == null || i.focus() : i == null || i.blur();
|
|
84
|
+
}, this._handleWorkspaceResizeKeydown = (e) => {
|
|
85
|
+
const t = e.currentTarget, i = t == null ? void 0 : t.dataset.workspaceResize;
|
|
86
|
+
if ((this.getAttribute("variant") || "overlay") !== "workspace" || !i || !this.hasAttribute("resize-rail") || !this.hasAttribute(`${i}-open`)) return;
|
|
87
|
+
if (e.key === "Escape") {
|
|
88
|
+
e.preventDefault(), this.removeAttribute(`${i}-open`), this.syncWorkspaceState();
|
|
89
|
+
return;
|
|
13
90
|
}
|
|
91
|
+
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
const s = e.key === "ArrowRight" ? 1 : -1, r = e.shiftKey ? z : m, a = this.getWorkspacePanelWidth(i) + (i === "left" ? s : -s) * r, o = Math.max(
|
|
94
|
+
this.getResizeRailMinDrawerWidth(i),
|
|
95
|
+
Math.min(a, this.getWorkspaceMaxPanelWidth(i))
|
|
96
|
+
);
|
|
97
|
+
this.syncResizeRailKeyboardHint(t, a, this.getResizeRailMinDrawerWidth(i), !0), this.setAttribute(`${i}-width`, `${Math.round(o)}px`), this.syncWorkspaceResizeCloseOpacity(i, o);
|
|
98
|
+
}, this._handleResize = () => {
|
|
99
|
+
var t;
|
|
100
|
+
this.syncMobileState(), this.syncResizeRailDrawerWidthBounds(), this.syncDrawerWidth();
|
|
101
|
+
const e = this.getAttribute("variant") || "overlay";
|
|
102
|
+
if (this.classList.add("no-transition"), (e === "push" || e === "persistent") && (this.updateLayout(e, this.getLayoutOpenState(e)), this.syncOpenState()), e === "workspace") {
|
|
103
|
+
const i = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".workspace-shell");
|
|
104
|
+
i == null || i.classList.add("no-transition"), this.syncWorkspaceState(), requestAnimationFrame(() => i == null ? void 0 : i.classList.remove("no-transition"));
|
|
105
|
+
}
|
|
106
|
+
requestAnimationFrame(() => this.classList.remove("no-transition"));
|
|
14
107
|
}, this.attachShadow({ mode: "open" });
|
|
15
108
|
}
|
|
16
109
|
static get observedAttributes() {
|
|
17
|
-
return [
|
|
110
|
+
return [
|
|
111
|
+
"open",
|
|
112
|
+
"width",
|
|
113
|
+
"height",
|
|
114
|
+
"side",
|
|
115
|
+
"variant",
|
|
116
|
+
"left-open",
|
|
117
|
+
"right-open",
|
|
118
|
+
"left-width",
|
|
119
|
+
"right-width",
|
|
120
|
+
"z-index",
|
|
121
|
+
"drawer-space",
|
|
122
|
+
"close-size",
|
|
123
|
+
"breakpoint",
|
|
124
|
+
"mobile-presentation",
|
|
125
|
+
"resize-rail",
|
|
126
|
+
"resize-min-drawer-width",
|
|
127
|
+
"resize-min-left-width",
|
|
128
|
+
"resize-min-right-width",
|
|
129
|
+
"resize-min-page-width",
|
|
130
|
+
"resize-close-threshold"
|
|
131
|
+
];
|
|
18
132
|
}
|
|
19
133
|
connectedCallback() {
|
|
20
|
-
this.render(), this.cacheEls(), this.attachEvents(), this.updateFooterVisibility(), this.updateHeaderVisibility(), this.syncOpenState(), document.addEventListener("keydown", this._handleEscape), window.addEventListener("resize", this._handleResize);
|
|
134
|
+
this.syncMobileState(), this.syncHeight(), this.render(), this.cacheEls(), this.syncDrawerWidth(), this.attachEvents(), this.updateFooterVisibility(), this.updateHeaderVisibility(), this.syncOpenState(), this.syncWorkspaceState(), document.addEventListener("keydown", this._handleEscape), window.addEventListener("resize", this._handleResize);
|
|
21
135
|
}
|
|
22
136
|
disconnectedCallback() {
|
|
23
|
-
document.removeEventListener("keydown", this._handleEscape), window.removeEventListener("resize", this._handleResize);
|
|
137
|
+
document.removeEventListener("keydown", this._handleEscape), window.removeEventListener("resize", this._handleResize), window.removeEventListener("pointermove", this._handleResizeMove), window.removeEventListener("pointerup", this._handleResizeEnd), window.removeEventListener("pointermove", this._handleWorkspaceResizeMove), window.removeEventListener("pointerup", this._handleWorkspaceResizeEnd);
|
|
24
138
|
}
|
|
25
139
|
getBreakpoint() {
|
|
26
|
-
const
|
|
27
|
-
return
|
|
140
|
+
const e = this.getAttribute("breakpoint");
|
|
141
|
+
return e ? Number(e) : 768;
|
|
142
|
+
}
|
|
143
|
+
getPositiveNumberAttribute(e, t) {
|
|
144
|
+
const i = Number(this.getAttribute(e));
|
|
145
|
+
return Number.isFinite(i) && i > 0 ? i : t;
|
|
146
|
+
}
|
|
147
|
+
getResizeRailMinDrawerWidth(e) {
|
|
148
|
+
return e === "left" && this.hasAttribute("resize-min-left-width") ? this.getPositiveNumberAttribute("resize-min-left-width", g) : e === "right" && this.hasAttribute("resize-min-right-width") ? this.getPositiveNumberAttribute("resize-min-right-width", g) : this.getPositiveNumberAttribute("resize-min-drawer-width", g);
|
|
149
|
+
}
|
|
150
|
+
getResizeRailMinPageWidth() {
|
|
151
|
+
return this.getPositiveNumberAttribute("resize-min-page-width", W);
|
|
152
|
+
}
|
|
153
|
+
getResizeRailCloseThreshold() {
|
|
154
|
+
return this.getPositiveNumberAttribute("resize-close-threshold", S);
|
|
155
|
+
}
|
|
156
|
+
getCloseSize() {
|
|
157
|
+
const e = this.getAttribute("close-size");
|
|
158
|
+
return e && ["x-small", "small", "medium", "large"].includes(e) ? e : "medium";
|
|
159
|
+
}
|
|
160
|
+
getCloseActionSizeToken() {
|
|
161
|
+
return `var(--action-size-${this.getCloseSize()})`;
|
|
162
|
+
}
|
|
163
|
+
getMobilePresentation() {
|
|
164
|
+
return this.getAttribute("mobile-presentation") === "stack" ? "stack" : "overlay";
|
|
165
|
+
}
|
|
166
|
+
isMobileViewport() {
|
|
167
|
+
return window.innerWidth <= this.getBreakpoint();
|
|
168
|
+
}
|
|
169
|
+
usesMobileOverlay(e = this.getAttribute("variant") || "overlay") {
|
|
170
|
+
return this.isMobileViewport() && (e === "push" || e === "workspace" || e === "persistent" && this.getMobilePresentation() !== "stack");
|
|
171
|
+
}
|
|
172
|
+
getLayoutOpenState(e = this.getAttribute("variant") || "overlay") {
|
|
173
|
+
return e === "persistent" && !this.usesMobileOverlay(e) ? !0 : this.hasAttribute("open");
|
|
174
|
+
}
|
|
175
|
+
syncHeight() {
|
|
176
|
+
this.style.setProperty("--drawer-height", this.getAttribute("height") || "100dvh");
|
|
177
|
+
}
|
|
178
|
+
syncDrawerWidth() {
|
|
179
|
+
if (!(!this.innerEl || (this.getAttribute("variant") || "overlay") === "workspace")) {
|
|
180
|
+
if (this.isMobileViewport()) {
|
|
181
|
+
this.innerEl.style.removeProperty("width");
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
this.innerEl.style.width = this.getAttribute("width") || "320px";
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
syncResizeRailDrawerWidthBounds() {
|
|
188
|
+
const e = this.getAttribute("variant") || "overlay";
|
|
189
|
+
if (!this.hasAttribute("resize-rail") || e !== "push" && e !== "persistent" || this.isMobileViewport()) return;
|
|
190
|
+
const t = this.getCurrentDrawerWidth(), i = this.getResizeRailMinDrawerWidth(), s = this.getResizeRailMaxDrawerWidth(), r = Math.round(Math.max(i, Math.min(t, s)));
|
|
191
|
+
Math.round(t) !== r && this.setAttribute("width", `${r}px`);
|
|
192
|
+
}
|
|
193
|
+
syncMobileState() {
|
|
194
|
+
this.toggleAttribute("mobile", this.isMobileViewport());
|
|
195
|
+
}
|
|
196
|
+
getWorkspaceColumns() {
|
|
197
|
+
const e = this.getAttribute("left-width") || "28rem", t = this.getAttribute("right-width") || "32rem", i = this.hasAttribute("left-open") ? e : "0", s = this.hasAttribute("right-open") ? t : "0";
|
|
198
|
+
if (!this.hasAttribute("resize-rail"))
|
|
199
|
+
return `${i} minmax(0, 1fr) ${s}`;
|
|
200
|
+
const r = "var(--drawer-resize-rail-size, var(--space-100))", a = this.hasAttribute("left-open") ? r : "0", o = this.hasAttribute("right-open") ? r : "0";
|
|
201
|
+
return `${i} ${a} minmax(0, 1fr) ${o} ${s}`;
|
|
28
202
|
}
|
|
29
|
-
|
|
30
|
-
|
|
203
|
+
syncWorkspaceState() {
|
|
204
|
+
var l;
|
|
205
|
+
if ((this.getAttribute("variant") || "overlay") !== "workspace" || !this.shadowRoot) return;
|
|
206
|
+
const e = this.shadowRoot.querySelector(".workspace-shell");
|
|
207
|
+
if (!e) return;
|
|
208
|
+
const t = this.isMobileViewport();
|
|
209
|
+
t ? e.style.removeProperty("grid-template-columns") : e.style.gridTemplateColumns = this.getWorkspaceColumns();
|
|
210
|
+
const i = this.getAttribute("side") === "right" ? "right" : "left", s = this.hasAttribute("open"), r = t ? s && i === "left" : this.hasAttribute("left-open"), a = t ? s && i === "right" : this.hasAttribute("right-open"), o = this.getWorkspacePanel("left"), n = this.getWorkspacePanel("right");
|
|
211
|
+
this.classList.contains("no-transition") || [o, n, this.overlayEl].forEach((c) => {
|
|
212
|
+
if (c) {
|
|
213
|
+
c.classList.add("is-animating");
|
|
214
|
+
let p = !1;
|
|
215
|
+
const u = () => {
|
|
216
|
+
p || (p = !0, c.classList.remove("is-animating"));
|
|
217
|
+
};
|
|
218
|
+
c.addEventListener("transitionend", u, { once: !0 }), setTimeout(u, 400);
|
|
219
|
+
}
|
|
220
|
+
}), o == null || o.toggleAttribute("inert", !r), n == null || n.toggleAttribute("inert", !a), o && (o.hidden = !t && !r), n && (n.hidden = !t && !a);
|
|
221
|
+
const h = this.shadowRoot.querySelector('[data-workspace-resize="left"]'), d = this.shadowRoot.querySelector('[data-workspace-resize="right"]');
|
|
222
|
+
h && (h.hidden = t || !this.hasAttribute("left-open")), d && (d.hidden = t || !this.hasAttribute("right-open")), r || o == null || o.style.removeProperty("opacity"), a || n == null || n.style.removeProperty("opacity"), (l = this.shadowRoot.querySelector(".workspace-page")) == null || l.scrollTo({ left: 0 });
|
|
223
|
+
}
|
|
224
|
+
isEventInsideDrawer(e) {
|
|
225
|
+
const t = e.composedPath();
|
|
226
|
+
return !!(this.outer && t.includes(this.outer) || this.resizeRailEl && t.includes(this.resizeRailEl) || this.overlayEl && t.includes(this.overlayEl));
|
|
227
|
+
}
|
|
228
|
+
getDrawerTemplate(e = !0) {
|
|
229
|
+
const t = this.hasAttribute("drawer-space") ? "no-padding" : "", i = this.getCloseSize();
|
|
31
230
|
return (
|
|
32
231
|
/*html*/
|
|
33
232
|
`
|
|
34
233
|
<div class="outer">
|
|
35
|
-
<div class="inner" role="complementary">
|
|
234
|
+
<div class="inner" part="${f("visual")}" role="complementary">
|
|
36
235
|
<div class="header">
|
|
37
236
|
<slot name="title"></slot>
|
|
38
|
-
${
|
|
39
|
-
<mui-button class="close" variant="tertiary" aria-label="Close drawer">
|
|
40
|
-
<mui-icon-close size="
|
|
237
|
+
${e ? `
|
|
238
|
+
<mui-button class="close" variant="tertiary" size="${i}" aria-label="Close drawer">
|
|
239
|
+
<mui-icon-close size="${i}"></mui-icon-close>
|
|
41
240
|
</mui-button>` : "<span class='spacer'></span>"}
|
|
42
241
|
</div>
|
|
43
|
-
<div class="content ${
|
|
242
|
+
<div class="content ${t}"><slot></slot></div>
|
|
44
243
|
<div class="actions" hidden><slot name="actions"></slot></div>
|
|
45
244
|
</div>
|
|
46
245
|
</div>
|
|
@@ -49,28 +248,61 @@ class u extends HTMLElement {
|
|
|
49
248
|
}
|
|
50
249
|
render() {
|
|
51
250
|
if (!this.shadowRoot) return;
|
|
52
|
-
const
|
|
53
|
-
this._computedSide = this.getAttribute("side") || (
|
|
54
|
-
const
|
|
251
|
+
const e = this.getAttribute("width") || "320px", t = this.getAttribute("variant") || "overlay", i = this.getBreakpoint(), s = (t === "push" || t === "persistent") && this.hasAttribute("resize-rail"), r = t === "workspace" && this.hasAttribute("resize-rail"), a = this.getCloseSize(), o = f("visual"), n = !!this.querySelector('[slot="before"]');
|
|
252
|
+
this._computedSide = this.getAttribute("side") || (n ? "right" : "left"), t !== "workspace" && this.getAttribute("side") !== this._computedSide && this.setAttribute("side", this._computedSide);
|
|
253
|
+
const h = (
|
|
55
254
|
/*css*/
|
|
56
255
|
`
|
|
256
|
+
:host {
|
|
257
|
+
--drawer-safe-top: 0px;
|
|
258
|
+
--drawer-safe-bottom: 0px;
|
|
259
|
+
--drawer-safe-left: 0px;
|
|
260
|
+
--drawer-safe-right: 0px;
|
|
261
|
+
--drawer-safe-inline: 0px;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
:host([variant="overlay"]:not([contained])) {
|
|
265
|
+
--drawer-safe-top: env(safe-area-inset-top);
|
|
266
|
+
--drawer-safe-bottom: env(safe-area-inset-bottom);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
:host([variant="overlay"]:not([contained])[side="left"]) {
|
|
270
|
+
--drawer-safe-left: env(safe-area-inset-left);
|
|
271
|
+
--drawer-safe-inline: env(safe-area-inset-left);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
:host([variant="overlay"]:not([contained])[side="right"]) {
|
|
275
|
+
--drawer-safe-right: env(safe-area-inset-right);
|
|
276
|
+
--drawer-safe-inline: env(safe-area-inset-right);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
:host(.no-transition) *,
|
|
280
|
+
:host(.no-transition) {
|
|
281
|
+
transition: none !important;
|
|
282
|
+
}
|
|
283
|
+
|
|
57
284
|
.header {
|
|
58
285
|
display: flex;
|
|
59
286
|
flex: 0 0 auto;
|
|
60
287
|
justify-content: space-between;
|
|
61
288
|
align-items: center;
|
|
62
|
-
padding: calc(var(--space-400) +
|
|
289
|
+
padding: calc(var(--space-400) + var(--drawer-safe-top)) var(--space-400) var(--space-400) var(--space-500);
|
|
63
290
|
border-bottom: var(--border-thin);
|
|
64
291
|
box-sizing: border-box;
|
|
65
292
|
}
|
|
66
293
|
.inner {
|
|
67
294
|
display: flex;
|
|
68
295
|
flex-direction: column;
|
|
296
|
+
box-sizing: border-box;
|
|
297
|
+
padding-left: var(--drawer-safe-left);
|
|
298
|
+
padding-right: var(--drawer-safe-right);
|
|
69
299
|
}
|
|
70
300
|
.content {
|
|
71
301
|
flex: 1 1 auto;
|
|
72
302
|
min-height: 0;
|
|
73
303
|
overflow-y: auto;
|
|
304
|
+
overscroll-behavior: contain;
|
|
305
|
+
-webkit-overflow-scrolling: touch;
|
|
74
306
|
height: auto;
|
|
75
307
|
padding: var(--space-500);
|
|
76
308
|
box-sizing: border-box;
|
|
@@ -80,11 +312,11 @@ class u extends HTMLElement {
|
|
|
80
312
|
}
|
|
81
313
|
|
|
82
314
|
.content.no-heading {
|
|
83
|
-
padding-top: calc(var(--space-500) +
|
|
315
|
+
padding-top: calc(var(--space-500) + var(--drawer-safe-top));
|
|
84
316
|
}
|
|
85
317
|
|
|
86
318
|
.content.no-padding.no-heading {
|
|
87
|
-
padding-top:
|
|
319
|
+
padding-top: var(--drawer-safe-top);
|
|
88
320
|
}
|
|
89
321
|
|
|
90
322
|
|
|
@@ -93,7 +325,7 @@ class u extends HTMLElement {
|
|
|
93
325
|
flex: 0 0 auto;
|
|
94
326
|
align-items: center;
|
|
95
327
|
justify-content: flex-end;
|
|
96
|
-
padding: var(--space-400) var(--space-500) calc(var(--space-400) +
|
|
328
|
+
padding: var(--space-400) var(--space-500) calc(var(--space-400) + var(--drawer-safe-bottom));
|
|
97
329
|
border-top: var(--border-thin);
|
|
98
330
|
background: var(--drawer-background);
|
|
99
331
|
gap: var(--space-300);
|
|
@@ -104,8 +336,345 @@ class u extends HTMLElement {
|
|
|
104
336
|
.actions[hidden] {
|
|
105
337
|
display: none !important;
|
|
106
338
|
}
|
|
339
|
+
.header .spacer {
|
|
340
|
+
display: inline-flex;
|
|
341
|
+
flex: 0 0 auto;
|
|
342
|
+
width: ${this.getCloseActionSizeToken()};
|
|
343
|
+
height: ${this.getCloseActionSizeToken()};
|
|
344
|
+
}
|
|
345
|
+
`
|
|
346
|
+
), d = (
|
|
347
|
+
/*css*/
|
|
348
|
+
`
|
|
349
|
+
.resize-rail,
|
|
350
|
+
.workspace-resize-rail {
|
|
351
|
+
position: relative;
|
|
352
|
+
z-index: 2;
|
|
353
|
+
display: block;
|
|
354
|
+
width: var(--drawer-resize-rail-size, var(--space-100));
|
|
355
|
+
height: 100%;
|
|
356
|
+
padding: 0;
|
|
357
|
+
border: 0;
|
|
358
|
+
background: var(--drawer-resize-rail-background, transparent);
|
|
359
|
+
cursor: col-resize;
|
|
360
|
+
appearance: none;
|
|
361
|
+
touch-action: none;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.resize-rail[hidden],
|
|
365
|
+
.workspace-resize-rail[hidden] {
|
|
366
|
+
display: none !important;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.resize-rail::before,
|
|
370
|
+
.workspace-resize-rail::before {
|
|
371
|
+
content: "";
|
|
372
|
+
position: absolute;
|
|
373
|
+
top: 0;
|
|
374
|
+
bottom: 0;
|
|
375
|
+
left: 50%;
|
|
376
|
+
width: var(--stroke-size-100);
|
|
377
|
+
background: var(--drawer-resize-rail-inner-background);
|
|
378
|
+
transform: translateX(-50%);
|
|
379
|
+
transition:
|
|
380
|
+
width var(--speed-100) ease,
|
|
381
|
+
background var(--speed-100) ease;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.resize-rail:hover::before,
|
|
385
|
+
.workspace-resize-rail:hover::before,
|
|
386
|
+
.resize-rail.is-resizing::before,
|
|
387
|
+
.workspace-resize-rail.is-resizing::before {
|
|
388
|
+
width: var(--stroke-size-300);
|
|
389
|
+
background: var(--outline-color);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.resize-rail:focus::before,
|
|
393
|
+
.workspace-resize-rail:focus::before {
|
|
394
|
+
width: var(--stroke-size-300);
|
|
395
|
+
background: var(--outline-color);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.resize-rail:focus,
|
|
399
|
+
.workspace-resize-rail:focus {
|
|
400
|
+
outline: none;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
:host([resizing]) .resize-rail.threshold::before,
|
|
404
|
+
.workspace-resize-rail.threshold::before {
|
|
405
|
+
width: var(--stroke-size-300);
|
|
406
|
+
background: var(--drawer-resize-rail-threshold-indicator);
|
|
407
|
+
animation: resize-rail-threshold-pulse calc(var(--speed-400) * 2) ease-in-out infinite;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
:host([resizing]) .resize-rail.at-limit::before,
|
|
411
|
+
.workspace-resize-rail.at-limit::before {
|
|
412
|
+
width: var(--stroke-size-300);
|
|
413
|
+
background: var(--drawer-resize-rail-threshold-indicator, var(--attention-color));
|
|
414
|
+
animation: rail-limit-flash 0.25s ease-in-out 3;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
@keyframes rail-limit-flash {
|
|
418
|
+
0%, 100% {
|
|
419
|
+
opacity: 0.4;
|
|
420
|
+
}
|
|
421
|
+
50% {
|
|
422
|
+
opacity: 0.8;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.resize-rail-icon,
|
|
427
|
+
.workspace-resize-rail-icon,
|
|
428
|
+
.resize-rail-esc,
|
|
429
|
+
.workspace-resize-rail-esc {
|
|
430
|
+
position: absolute;
|
|
431
|
+
top: 50%;
|
|
432
|
+
right: var(--space-200);
|
|
433
|
+
color: var(--drawer-resize-rail-threshold-indicator);
|
|
434
|
+
opacity: 0;
|
|
435
|
+
pointer-events: none;
|
|
436
|
+
transform: translateY(-50%);
|
|
437
|
+
transition: opacity var(--speed-100) ease;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
:host([side="right"]) .resize-rail-icon,
|
|
441
|
+
.workspace-resize-rail-right .workspace-resize-rail-icon {
|
|
442
|
+
right: auto;
|
|
443
|
+
left: var(--space-200);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
:host([side="left"]) .resize-rail-esc,
|
|
447
|
+
.workspace-resize-rail-left .workspace-resize-rail-esc {
|
|
448
|
+
left: auto;
|
|
449
|
+
right: var(--space-400);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
:host([side="right"]) .resize-rail-esc,
|
|
453
|
+
.workspace-resize-rail-right .workspace-resize-rail-esc {
|
|
454
|
+
right: auto;
|
|
455
|
+
left: var(--space-400);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
:host([side="right"]) .resize-rail-icon,
|
|
459
|
+
.workspace-resize-rail-right .workspace-resize-rail-icon {
|
|
460
|
+
transform: translateY(-50%) rotate(180deg);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
:host([resizing]) .resize-rail.threshold .resize-rail-icon,
|
|
464
|
+
.workspace-resize-rail.threshold .workspace-resize-rail-icon {
|
|
465
|
+
opacity: 0.7;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.resize-rail.keyboard-at-min .resize-rail-esc,
|
|
469
|
+
.workspace-resize-rail.keyboard-at-min .workspace-resize-rail-esc {
|
|
470
|
+
opacity: 0.85;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.resize-rail-esc,
|
|
474
|
+
.workspace-resize-rail-esc {
|
|
475
|
+
--text-color: var(--drawer-resize-rail-threshold-indicator);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
@keyframes resize-rail-threshold-pulse {
|
|
479
|
+
0%,
|
|
480
|
+
100% {
|
|
481
|
+
opacity: 0.4;
|
|
482
|
+
}
|
|
483
|
+
50% {
|
|
484
|
+
opacity: 0.8;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
107
487
|
`
|
|
108
|
-
),
|
|
488
|
+
), l = (
|
|
489
|
+
/*css*/
|
|
490
|
+
`
|
|
491
|
+
:host([variant="workspace"]) {
|
|
492
|
+
display: block;
|
|
493
|
+
width: 100%;
|
|
494
|
+
height: var(--drawer-height, 100dvh);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.workspace-shell {
|
|
498
|
+
display: grid;
|
|
499
|
+
grid-template-columns: ${this.getWorkspaceColumns()};
|
|
500
|
+
width: 100%;
|
|
501
|
+
height: var(--drawer-height, 100dvh);
|
|
502
|
+
min-width: 0;
|
|
503
|
+
overflow: hidden;
|
|
504
|
+
transition: grid-template-columns var(--speed-100) ease;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.workspace-panel {
|
|
508
|
+
min-width: 0;
|
|
509
|
+
overflow: hidden;
|
|
510
|
+
background: var(--drawer-background);
|
|
511
|
+
visibility: hidden;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.workspace-panel.is-animating {
|
|
515
|
+
transition:
|
|
516
|
+
opacity var(--speed-100) ease,
|
|
517
|
+
transform 0.3s ease,
|
|
518
|
+
visibility var(--speed-100) ease;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.workspace-panel[hidden] {
|
|
522
|
+
display: none !important;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
:host([left-open]) .workspace-panel-left,
|
|
526
|
+
:host([right-open]) .workspace-panel-right {
|
|
527
|
+
visibility: visible;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
:host([resizing]) .workspace-panel,
|
|
531
|
+
.workspace-shell.no-transition .workspace-panel {
|
|
532
|
+
transition: none;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.workspace-panel-left .inner,
|
|
536
|
+
.workspace-panel-right .inner {
|
|
537
|
+
position: static;
|
|
538
|
+
width: 100%;
|
|
539
|
+
height: var(--drawer-height, 100dvh);
|
|
540
|
+
background: var(--drawer-background);
|
|
541
|
+
padding-top: var(--drawer-safe-top);
|
|
542
|
+
padding-bottom: var(--drawer-safe-bottom);
|
|
543
|
+
box-sizing: border-box;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.workspace-panel-left .inner {
|
|
547
|
+
border-right: var(--border-thin);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
.workspace-panel-right .inner {
|
|
551
|
+
border-left: var(--border-thin);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
@media (min-width: ${i + 1}px) {
|
|
555
|
+
:host([resize-rail]) .workspace-panel-left .inner {
|
|
556
|
+
border-right: none;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
:host([resize-rail]) .workspace-panel-right .inner {
|
|
560
|
+
border-left: none;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.workspace-page {
|
|
565
|
+
grid-column: 2;
|
|
566
|
+
min-width: 0;
|
|
567
|
+
width: 100%;
|
|
568
|
+
height: var(--drawer-height, 100dvh);
|
|
569
|
+
overflow: auto;
|
|
570
|
+
-webkit-overflow-scrolling: touch;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
:host([resize-rail]) .workspace-page {
|
|
574
|
+
grid-column: 3;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
::slotted([slot="page"]) {
|
|
578
|
+
min-width: 0;
|
|
579
|
+
height: var(--drawer-height, 100dvh);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
:host([resizing]) .workspace-shell,
|
|
583
|
+
.workspace-shell.no-transition {
|
|
584
|
+
transition: none;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
@media (max-width: ${i}px) {
|
|
588
|
+
:host([variant="workspace"]) {
|
|
589
|
+
--drawer-safe-top: env(safe-area-inset-top);
|
|
590
|
+
--drawer-safe-bottom: env(safe-area-inset-bottom);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
:host([variant="workspace"][side="left"]) {
|
|
594
|
+
--drawer-safe-left: env(safe-area-inset-left);
|
|
595
|
+
--drawer-safe-inline: env(safe-area-inset-left);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
:host([variant="workspace"][side="right"]) {
|
|
599
|
+
--drawer-safe-right: env(safe-area-inset-right);
|
|
600
|
+
--drawer-safe-inline: env(safe-area-inset-right);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/* Mobile overlay surfaces must use the viewport, not --drawer-height, so desktop/contained heights do not clip them. */
|
|
604
|
+
.overlay {
|
|
605
|
+
position: fixed;
|
|
606
|
+
display: block;
|
|
607
|
+
inset: 0;
|
|
608
|
+
height: 100dvh;
|
|
609
|
+
z-index: 10;
|
|
610
|
+
background: var(--backdrop-overlay);
|
|
611
|
+
opacity: 0;
|
|
612
|
+
visibility: hidden;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.overlay.is-animating {
|
|
616
|
+
transition: opacity 0.3s ease, visibility 0.3s ease;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
:host([open]) .overlay {
|
|
620
|
+
opacity: 1;
|
|
621
|
+
visibility: visible;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
.workspace-shell {
|
|
625
|
+
grid-template-columns: minmax(0, 1fr);
|
|
626
|
+
height: var(--drawer-height, 100dvh);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.workspace-page,
|
|
630
|
+
:host([resize-rail]) .workspace-page {
|
|
631
|
+
grid-column: 1;
|
|
632
|
+
height: var(--drawer-height, 100dvh);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
.workspace-panel {
|
|
636
|
+
position: fixed;
|
|
637
|
+
top: 0;
|
|
638
|
+
bottom: auto;
|
|
639
|
+
z-index: 11;
|
|
640
|
+
width: 90%;
|
|
641
|
+
max-width: calc(32rem + var(--drawer-safe-inline));
|
|
642
|
+
height: 100dvh;
|
|
643
|
+
max-height: 100dvh;
|
|
644
|
+
overflow: visible;
|
|
645
|
+
visibility: hidden;
|
|
646
|
+
pointer-events: none;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
.workspace-panel .inner {
|
|
650
|
+
height: 100dvh;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
.workspace-panel-left {
|
|
654
|
+
left: 0;
|
|
655
|
+
right: auto;
|
|
656
|
+
transform: translateX(-100%);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
.workspace-panel-right {
|
|
660
|
+
right: 0;
|
|
661
|
+
left: auto;
|
|
662
|
+
transform: translateX(100%);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
:host([open][side="left"]) .workspace-panel-left,
|
|
666
|
+
:host([open][side="right"]) .workspace-panel-right {
|
|
667
|
+
transform: translateX(0);
|
|
668
|
+
visibility: visible;
|
|
669
|
+
pointer-events: auto;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
.workspace-resize-rail {
|
|
673
|
+
display: none;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
`
|
|
677
|
+
), c = (
|
|
109
678
|
/*css*/
|
|
110
679
|
`
|
|
111
680
|
.overlay {
|
|
@@ -113,15 +682,18 @@ class u extends HTMLElement {
|
|
|
113
682
|
top: 0;
|
|
114
683
|
left: 0;
|
|
115
684
|
width: 100%;
|
|
116
|
-
height:
|
|
685
|
+
height: 100dvh;
|
|
117
686
|
z-index: 101;
|
|
118
|
-
transition: opacity 0.3s ease, visibility 0.3s ease;
|
|
119
687
|
background: var(--backdrop-overlay);
|
|
120
688
|
opacity: 0;
|
|
121
689
|
visibility: hidden;
|
|
122
690
|
will-change: opacity, visibility;
|
|
123
691
|
}
|
|
124
692
|
|
|
693
|
+
.overlay.is-animating {
|
|
694
|
+
transition: opacity 0.3s ease, visibility 0.3s ease;
|
|
695
|
+
}
|
|
696
|
+
|
|
125
697
|
.surface {
|
|
126
698
|
background: var(--surface);
|
|
127
699
|
width: 100%;
|
|
@@ -130,12 +702,12 @@ class u extends HTMLElement {
|
|
|
130
702
|
.inner {
|
|
131
703
|
position: fixed;
|
|
132
704
|
top: 0;
|
|
133
|
-
height: 100dvh;
|
|
705
|
+
height: var(--drawer-height, 100dvh);
|
|
134
706
|
z-index: 110;
|
|
135
707
|
transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
|
|
136
708
|
background: var(--drawer-background);
|
|
137
709
|
border-left: var(--border-thin);
|
|
138
|
-
width: ${
|
|
710
|
+
width: ${e};
|
|
139
711
|
transform: translateX(100%);
|
|
140
712
|
opacity: 0;
|
|
141
713
|
visibility: hidden;
|
|
@@ -170,109 +742,243 @@ class u extends HTMLElement {
|
|
|
170
742
|
visibility: visible;
|
|
171
743
|
}
|
|
172
744
|
`
|
|
173
|
-
),
|
|
745
|
+
), p = this._computedSide === "left" ? "border-right: var(--border-thin);" : "border-left: var(--border-thin);", u = (
|
|
174
746
|
/*css*/
|
|
175
747
|
`
|
|
176
748
|
.inner {
|
|
177
749
|
background: var(--drawer-background);
|
|
178
|
-
width: ${
|
|
750
|
+
width: ${e};
|
|
179
751
|
position: fixed;
|
|
180
752
|
top: 0;
|
|
181
753
|
left: 0;
|
|
182
|
-
height:
|
|
754
|
+
height: var(--drawer-height, 100dvh);
|
|
183
755
|
}
|
|
184
756
|
|
|
185
757
|
.outer {
|
|
186
758
|
overflow: hidden;
|
|
187
759
|
will-change: transform;
|
|
760
|
+
visibility: hidden;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
.outer.is-animating {
|
|
764
|
+
transition: opacity var(--speed-100) ease, visibility var(--speed-100) ease;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
:host([open]) .outer {
|
|
768
|
+
visibility: visible;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
@media (min-width: ${i + 1}px) {
|
|
772
|
+
:host([variant="persistent"]) .outer {
|
|
773
|
+
visibility: visible;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
:host([resizing]) .outer {
|
|
778
|
+
transition: none;
|
|
188
779
|
}
|
|
189
780
|
|
|
190
781
|
:host([variant="push"]),
|
|
191
782
|
:host([variant="persistent"]) {
|
|
192
783
|
display: block;
|
|
193
784
|
width: 100%;
|
|
785
|
+
height: var(--drawer-height, 100dvh);
|
|
786
|
+
position: relative;
|
|
194
787
|
}
|
|
195
788
|
|
|
196
789
|
/* Push */
|
|
197
790
|
:host([variant="push"]) .shell {
|
|
198
791
|
display: grid;
|
|
199
|
-
height:
|
|
792
|
+
height: var(--drawer-height, 100dvh);
|
|
200
793
|
overflow: hidden;
|
|
201
794
|
transition: grid-template-columns var(--speed-100) ease;
|
|
202
795
|
}
|
|
203
796
|
|
|
797
|
+
:host([resizing]) .shell {
|
|
798
|
+
transition: none;
|
|
799
|
+
}
|
|
800
|
+
|
|
204
801
|
/* Persistent */
|
|
205
802
|
:host([variant="persistent"]) .shell {
|
|
206
803
|
display: grid;
|
|
207
|
-
height:
|
|
804
|
+
height: var(--drawer-height, 100dvh);
|
|
208
805
|
overflow: hidden;
|
|
209
806
|
}
|
|
210
807
|
|
|
211
|
-
:host([variant="persistent"]) .header .spacer {
|
|
212
|
-
height: 4.4rem;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
808
|
/* Hidden & Persistent */
|
|
216
809
|
:host([open]) .outer,
|
|
217
|
-
:host([variant="persistent"]) .outer { ${
|
|
810
|
+
:host([variant="persistent"]) .outer { ${p} }
|
|
811
|
+
|
|
812
|
+
:host([variant="push"][resize-rail]) .outer,
|
|
813
|
+
:host([variant="persistent"][resize-rail]) .outer {
|
|
814
|
+
border: none;
|
|
815
|
+
}
|
|
218
816
|
|
|
817
|
+
:host([variant="push"][resize-rail]:not([open])) .resize-rail {
|
|
818
|
+
opacity: 0;
|
|
819
|
+
pointer-events: none;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
.overlay {
|
|
823
|
+
display: none;
|
|
824
|
+
}
|
|
219
825
|
|
|
220
826
|
/* Direct slotted element */
|
|
221
827
|
::slotted([slot="page"]) {
|
|
222
|
-
height: 100dvh;
|
|
828
|
+
height: var(--drawer-height, 100dvh);
|
|
223
829
|
overflow-y: auto;
|
|
830
|
+
overscroll-behavior: contain;
|
|
224
831
|
-webkit-overflow-scrolling: touch;
|
|
225
832
|
}
|
|
226
833
|
|
|
227
834
|
`
|
|
228
|
-
),
|
|
835
|
+
), w = (
|
|
229
836
|
/*css*/
|
|
230
837
|
`
|
|
231
|
-
@media (max-width: ${
|
|
838
|
+
@media (max-width: ${i}px) {
|
|
839
|
+
:host([variant="push"]),
|
|
840
|
+
:host([variant="persistent"]:not([mobile-presentation="stack"])) {
|
|
841
|
+
--drawer-safe-top: env(safe-area-inset-top);
|
|
842
|
+
--drawer-safe-bottom: env(safe-area-inset-bottom);
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
:host([variant="push"][side="left"]),
|
|
846
|
+
:host([variant="persistent"]:not([mobile-presentation="stack"])[side="left"]) {
|
|
847
|
+
--drawer-safe-left: env(safe-area-inset-left);
|
|
848
|
+
--drawer-safe-inline: env(safe-area-inset-left);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
:host([variant="push"][side="right"]),
|
|
852
|
+
:host([variant="persistent"]:not([mobile-presentation="stack"])[side="right"]) {
|
|
853
|
+
--drawer-safe-right: env(safe-area-inset-right);
|
|
854
|
+
--drawer-safe-inline: env(safe-area-inset-right);
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/* Mobile overlay surfaces must use the viewport, not --drawer-height, so desktop/contained heights do not clip them. */
|
|
858
|
+
.actions {
|
|
859
|
+
padding-bottom: calc(var(--space-400) + max(env(safe-area-inset-bottom), var(--space-400)));
|
|
860
|
+
}
|
|
861
|
+
|
|
232
862
|
.outer {
|
|
233
863
|
position: fixed;
|
|
234
|
-
left: 0;
|
|
235
|
-
right: 0;
|
|
236
|
-
bottom: 0;
|
|
237
864
|
top: 0;
|
|
238
|
-
|
|
865
|
+
bottom: 0;
|
|
866
|
+
max-height: var(--drawer-height, 100dvh);
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
.outer.is-animating {
|
|
870
|
+
transition: transform 0.3s ease, visibility 0.3s ease;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
:host([variant="push"]) .outer,
|
|
874
|
+
:host([variant="persistent"]:not([mobile-presentation="stack"])) .outer {
|
|
875
|
+
bottom: auto;
|
|
876
|
+
width: 90%;
|
|
877
|
+
max-width: calc(${e} + var(--drawer-safe-inline));
|
|
878
|
+
height: 100dvh;
|
|
239
879
|
max-height: 100dvh;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
880
|
+
overflow: visible;
|
|
881
|
+
transform: translateX(-100%);
|
|
882
|
+
z-index: 11;
|
|
883
|
+
visibility: hidden;
|
|
884
|
+
}
|
|
243
885
|
|
|
244
|
-
:host([
|
|
245
|
-
|
|
246
|
-
|
|
886
|
+
:host([variant="push"]) .overlay,
|
|
887
|
+
:host([variant="persistent"]:not([mobile-presentation="stack"])) .overlay {
|
|
888
|
+
position: fixed;
|
|
889
|
+
display: block;
|
|
890
|
+
inset: 0;
|
|
891
|
+
height: 100dvh;
|
|
892
|
+
z-index: 10;
|
|
893
|
+
background: var(--backdrop-overlay);
|
|
894
|
+
opacity: 0;
|
|
895
|
+
visibility: hidden;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
:host([variant="push"]) .overlay.is-animating,
|
|
899
|
+
:host([variant="persistent"]:not([mobile-presentation="stack"])) .overlay.is-animating {
|
|
900
|
+
transition: opacity 0.3s ease, visibility 0.3s ease;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
:host([variant="push"][side="left"]) .outer,
|
|
904
|
+
:host([variant="persistent"]:not([mobile-presentation="stack"])[side="left"]) .outer {
|
|
905
|
+
left: 0;
|
|
906
|
+
right: auto;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
:host([variant="push"][side="right"]) .outer,
|
|
910
|
+
:host([variant="persistent"]:not([mobile-presentation="stack"])[side="right"]) .outer {
|
|
911
|
+
left: auto;
|
|
912
|
+
right: 0;
|
|
913
|
+
transform: translateX(100%);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
:host([open][variant="push"]) .outer,
|
|
917
|
+
:host([open][variant="persistent"]:not([mobile-presentation="stack"])) .outer {
|
|
918
|
+
transform: translateX(0);
|
|
919
|
+
visibility: visible;
|
|
247
920
|
border: none;
|
|
248
921
|
}
|
|
249
922
|
|
|
923
|
+
:host([open][variant="push"][side="left"]) .inner,
|
|
924
|
+
:host([open][variant="persistent"]:not([mobile-presentation="stack"])[side="left"]) .inner {
|
|
925
|
+
border-right: var(--border-thin);
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
:host([open][variant="push"][side="right"]) .inner,
|
|
929
|
+
:host([open][variant="persistent"]:not([mobile-presentation="stack"])[side="right"]) .inner {
|
|
930
|
+
border-left: var(--border-thin);
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
:host([open][variant="push"]) .overlay,
|
|
934
|
+
:host([open][variant="persistent"]:not([mobile-presentation="stack"])) .overlay {
|
|
935
|
+
opacity: 1;
|
|
936
|
+
visibility: visible;
|
|
937
|
+
}
|
|
938
|
+
|
|
250
939
|
/* Overlay */
|
|
251
940
|
:host([variant="overlay"]) .inner {
|
|
252
|
-
max-width: ${
|
|
941
|
+
max-width: calc(${e} + var(--drawer-safe-inline));
|
|
253
942
|
width: 90%;
|
|
254
|
-
height:
|
|
943
|
+
height: 100dvh;
|
|
255
944
|
}
|
|
256
945
|
|
|
257
946
|
/* Push */
|
|
258
|
-
:host([variant="push"]) .inner
|
|
947
|
+
:host([variant="push"]) .inner,
|
|
948
|
+
:host([variant="persistent"]:not([mobile-presentation="stack"])) .inner {
|
|
949
|
+
position: static;
|
|
259
950
|
width: 100%;
|
|
260
|
-
height:
|
|
951
|
+
height: 100dvh;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
:host([variant="push"]),
|
|
955
|
+
:host([variant="push"]) .shell,
|
|
956
|
+
:host([variant="push"]) ::slotted([slot="page"]),
|
|
957
|
+
:host([variant="persistent"]:not([mobile-presentation="stack"])),
|
|
958
|
+
:host([variant="persistent"]:not([mobile-presentation="stack"])) .shell,
|
|
959
|
+
:host([variant="persistent"]:not([mobile-presentation="stack"])) ::slotted([slot="page"]) {
|
|
960
|
+
height: auto;
|
|
961
|
+
min-height: var(--drawer-height, 100dvh);
|
|
962
|
+
overflow: visible;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
:host([variant="persistent"]:not([mobile-presentation="stack"])) .close {
|
|
966
|
+
display: inline-flex;
|
|
261
967
|
}
|
|
262
968
|
|
|
263
969
|
/* Persistent */
|
|
264
|
-
:host([variant="persistent"]) .inner {
|
|
970
|
+
:host([variant="persistent"][mobile-presentation="stack"]) .inner {
|
|
265
971
|
width: 100%;
|
|
266
972
|
position: static;
|
|
267
973
|
height: auto;
|
|
268
974
|
border-radius: var(--radius-200);
|
|
269
975
|
}
|
|
270
976
|
|
|
271
|
-
:host([variant="persistent"]) .shell {
|
|
977
|
+
:host([variant="persistent"][mobile-presentation="stack"]) .shell {
|
|
272
978
|
height: auto;
|
|
273
979
|
}
|
|
274
980
|
|
|
275
|
-
:host([variant="persistent"]) .outer {
|
|
981
|
+
:host([variant="persistent"][mobile-presentation="stack"]) .outer {
|
|
276
982
|
width: 100%;
|
|
277
983
|
position: static;
|
|
278
984
|
height: auto;
|
|
@@ -284,95 +990,257 @@ class u extends HTMLElement {
|
|
|
284
990
|
z-index: initial;
|
|
285
991
|
}
|
|
286
992
|
|
|
287
|
-
:host([variant="persistent"]) .header {
|
|
993
|
+
:host([variant="persistent"][mobile-presentation="stack"]) .header {
|
|
288
994
|
padding-top: var(--space-400);
|
|
289
995
|
}
|
|
290
996
|
|
|
291
|
-
:host([variant="persistent"]) .content {
|
|
997
|
+
:host([variant="persistent"][mobile-presentation="stack"]) .content {
|
|
292
998
|
flex: 0 1 auto;
|
|
293
999
|
min-height: initial;
|
|
294
1000
|
height: auto;
|
|
295
1001
|
}
|
|
296
1002
|
|
|
297
|
-
:host([variant="persistent"]) .actions {
|
|
1003
|
+
:host([variant="persistent"][mobile-presentation="stack"]) .actions {
|
|
298
1004
|
border-bottom-right-radius: var(--radius-200);
|
|
299
1005
|
border-bottom-left-radius: var(--radius-200);
|
|
300
1006
|
width: 100%;
|
|
301
1007
|
padding: var(--space-400) var(--space-500) var(--space-400);
|
|
302
1008
|
}
|
|
303
1009
|
|
|
1010
|
+
.resize-rail {
|
|
1011
|
+
display: none;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
304
1014
|
}
|
|
305
1015
|
|
|
306
1016
|
@media (max-width: 360px) {
|
|
307
|
-
:host([variant="persistent"]) .outer {
|
|
1017
|
+
:host([variant="persistent"][mobile-presentation="stack"]) .outer {
|
|
308
1018
|
padding: calc(var(--space-400) / 2);
|
|
309
1019
|
}
|
|
310
1020
|
}
|
|
311
1021
|
|
|
312
1022
|
`
|
|
313
|
-
),
|
|
314
|
-
let
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
1023
|
+
), R = this.getAttribute("side") || this._computedSide, b = t === "overlay" || t === "push" || this.usesMobileOverlay(t);
|
|
1024
|
+
let v = "";
|
|
1025
|
+
const E = this.hasAttribute("drawer-space") ? "no-padding" : "";
|
|
1026
|
+
if (t === "workspace")
|
|
1027
|
+
v = /*html*/
|
|
1028
|
+
`
|
|
1029
|
+
<style>${h}${d}${l}</style>
|
|
1030
|
+
<div class="overlay"></div>
|
|
1031
|
+
<div class="workspace-shell">
|
|
1032
|
+
<div class="outer workspace-panel workspace-panel-left">
|
|
1033
|
+
<div class="inner" role="complementary">
|
|
1034
|
+
<div class="content no-padding"><slot name="left"></slot></div>
|
|
1035
|
+
</div>
|
|
1036
|
+
</div>
|
|
1037
|
+
${r ? '<button class="workspace-resize-rail workspace-resize-rail-left" part="resize-rail" type="button" aria-label="Resize left drawer" data-workspace-resize="left"><mui-icon-left-chevron class="workspace-resize-rail-icon" size="x-small" color="var(--drawer-resize-rail-threshold-indicator)" aria-hidden="true"></mui-icon-left-chevron><mui-body class="workspace-resize-rail-esc" size="xx-small" weight="bold" aria-hidden="true">ESC</mui-body></button>' : ""}
|
|
1038
|
+
<div class="workspace-page">
|
|
1039
|
+
<slot name="page"></slot>
|
|
1040
|
+
</div>
|
|
1041
|
+
${r ? '<button class="workspace-resize-rail workspace-resize-rail-right" part="resize-rail" type="button" aria-label="Resize right drawer" data-workspace-resize="right"><mui-icon-left-chevron class="workspace-resize-rail-icon" size="x-small" color="var(--drawer-resize-rail-threshold-indicator)" aria-hidden="true"></mui-icon-left-chevron><mui-body class="workspace-resize-rail-esc" size="xx-small" weight="bold" aria-hidden="true">ESC</mui-body></button>' : ""}
|
|
1042
|
+
<div class="outer workspace-panel workspace-panel-right">
|
|
1043
|
+
<div class="inner" role="complementary">
|
|
1044
|
+
<div class="content no-padding"><slot name="right"></slot></div>
|
|
1045
|
+
</div>
|
|
1046
|
+
</div>
|
|
1047
|
+
</div>
|
|
1048
|
+
`;
|
|
1049
|
+
else if (t === "overlay")
|
|
1050
|
+
v = /*html*/
|
|
1051
|
+
`
|
|
1052
|
+
<style>${h}${c}${w}</style>
|
|
319
1053
|
<div class="overlay"></div>
|
|
320
|
-
<div class="inner" role="dialog" aria-modal="true">
|
|
1054
|
+
<div class="inner" part="${o}" role="dialog" aria-modal="true">
|
|
321
1055
|
<div class="header" hidden>
|
|
322
1056
|
<slot name="title"></slot>
|
|
323
|
-
<mui-button class="close" variant="tertiary" aria-label="Close drawer">
|
|
324
|
-
<mui-icon-close size="
|
|
1057
|
+
<mui-button class="close" variant="tertiary" size="${a}" aria-label="Close drawer">
|
|
1058
|
+
<mui-icon-close size="${a}"></mui-icon-close>
|
|
325
1059
|
</mui-button>
|
|
326
1060
|
</div>
|
|
327
|
-
<div class="content ${
|
|
1061
|
+
<div class="content ${E}">
|
|
328
1062
|
<slot></slot>
|
|
329
1063
|
</div>
|
|
330
1064
|
<div class="actions" hidden>
|
|
331
1065
|
<slot name="actions"></slot>
|
|
332
1066
|
</div>
|
|
333
1067
|
</div>
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
1068
|
+
`;
|
|
1069
|
+
else if (t === "push" || t === "persistent") {
|
|
1070
|
+
const y = s ? '<button class="resize-rail" part="resize-rail" type="button" aria-label="Resize drawer"><mui-icon-left-chevron class="resize-rail-icon" size="x-small" color="var(--drawer-resize-rail-threshold-indicator)" aria-hidden="true"></mui-icon-left-chevron><mui-body class="resize-rail-esc" size="xx-small" weight="bold" aria-hidden="true">ESC</mui-body></button>' : "";
|
|
1071
|
+
v = /*html*/
|
|
1072
|
+
`
|
|
1073
|
+
<style>${h}${d}${u}${w}</style>
|
|
1074
|
+
<div class="overlay"></div>
|
|
337
1075
|
<div class="shell">
|
|
338
|
-
${
|
|
1076
|
+
${R === "left" ? this.getDrawerTemplate(b) + y + '<slot name="page"></slot>' : '<slot name="page"></slot>' + y + this.getDrawerTemplate(b)}
|
|
339
1077
|
</div>
|
|
340
|
-
|
|
1078
|
+
`;
|
|
1079
|
+
}
|
|
1080
|
+
this.shadowRoot.innerHTML = v;
|
|
341
1081
|
}
|
|
342
1082
|
cacheEls() {
|
|
343
|
-
this.innerEl = this.shadowRoot.querySelector(".inner"), this.overlayEl = this.shadowRoot.querySelector(".overlay"), this.footerEl = this.shadowRoot.querySelector(".actions"), this.actionsSlot = this.shadowRoot.querySelector('slot[name="actions"]'), this.outer = this.shadowRoot.querySelector(".outer"), this.pushLayout = this.shadowRoot.querySelector(".shell"), this.persistentLayout = this.shadowRoot.querySelector(".shell"), this.headerEl = this.shadowRoot.querySelector(".header"), this.headerSlot = this.shadowRoot.querySelector('slot[name="title"]');
|
|
1083
|
+
this.innerEl = this.shadowRoot.querySelector(".inner"), this.overlayEl = this.shadowRoot.querySelector(".overlay"), this.footerEl = this.shadowRoot.querySelector(".actions"), this.actionsSlot = this.shadowRoot.querySelector('slot[name="actions"]'), this.outer = this.shadowRoot.querySelector(".outer"), this.pushLayout = this.shadowRoot.querySelector(".shell"), this.persistentLayout = this.shadowRoot.querySelector(".shell"), this.headerEl = this.shadowRoot.querySelector(".header"), this.headerSlot = this.shadowRoot.querySelector('slot[name="title"]'), this.resizeRailEl = this.shadowRoot.querySelector(".resize-rail"), this.workspaceResizeRailEls = Array.from(this.shadowRoot.querySelectorAll("[data-workspace-resize]"));
|
|
344
1084
|
}
|
|
345
1085
|
attachEvents() {
|
|
346
|
-
var
|
|
347
|
-
(
|
|
1086
|
+
var e, t, i, s, r, a, o;
|
|
1087
|
+
(e = this.shadowRoot.querySelector(".close")) == null || e.addEventListener("click", () => this.close()), (t = this.overlayEl) == null || t.addEventListener("click", () => this.close()), (i = this.actionsSlot) == null || i.addEventListener("slotchange", () => this.updateFooterVisibility()), (s = this.headerSlot) == null || s.addEventListener("slotchange", () => this.updateHeaderVisibility()), (r = this.resizeRailEl) == null || r.addEventListener("pointerdown", this._handleResizeStart), (a = this.resizeRailEl) == null || a.addEventListener("keydown", this._handleResizeKeydown), (o = this.resizeRailEl) == null || o.addEventListener("blur", () => this.clearResizeRailKeyboardHint(this.resizeRailEl)), this.workspaceResizeRailEls.forEach((n) => {
|
|
1088
|
+
n.addEventListener("pointerdown", this._handleWorkspaceResizeStart), n.addEventListener("keydown", this._handleWorkspaceResizeKeydown), n.addEventListener("blur", () => this.clearResizeRailKeyboardHint(n));
|
|
1089
|
+
});
|
|
348
1090
|
}
|
|
349
1091
|
updateFooterVisibility() {
|
|
350
1092
|
if (!this.footerEl || !this.actionsSlot) return;
|
|
351
|
-
const
|
|
352
|
-
this.footerEl.hidden = !
|
|
1093
|
+
const e = this.actionsSlot.assignedElements().length > 0;
|
|
1094
|
+
this.footerEl.hidden = !e, this.toggleAttribute("has-footer", e);
|
|
353
1095
|
}
|
|
354
1096
|
updateHeaderVisibility() {
|
|
355
1097
|
if (!this.headerEl || !this.headerSlot || !this.innerEl) return;
|
|
356
|
-
const
|
|
357
|
-
this.headerEl.hidden = !
|
|
358
|
-
const
|
|
359
|
-
|
|
1098
|
+
const e = this.headerSlot.assignedElements().length > 0;
|
|
1099
|
+
this.headerEl.hidden = !e, this.toggleAttribute("has-header", e);
|
|
1100
|
+
const t = this.innerEl.querySelector(".content");
|
|
1101
|
+
t && t.classList.toggle("no-heading", !e);
|
|
1102
|
+
}
|
|
1103
|
+
clearResizeRailKeyboardHint(e) {
|
|
1104
|
+
e == null || e.classList.remove("keyboard-at-min");
|
|
360
1105
|
}
|
|
361
|
-
|
|
362
|
-
|
|
1106
|
+
syncResizeRailKeyboardHint(e, t, i, s) {
|
|
1107
|
+
e == null || e.classList.toggle("keyboard-at-min", s && t <= i);
|
|
1108
|
+
}
|
|
1109
|
+
attributeChangedCallback(e, t, i) {
|
|
1110
|
+
if (e === "breakpoint") {
|
|
1111
|
+
this.syncMobileState(), this.syncDrawerWidth();
|
|
1112
|
+
const s = this.getAttribute("variant") || "overlay";
|
|
1113
|
+
(s === "push" || s === "persistent") && this.updateLayout(s, this.getLayoutOpenState(s)), this.syncOpenState();
|
|
1114
|
+
}
|
|
1115
|
+
if (e === "open" && (this.syncOpenState(), this.syncWorkspaceState()), (e === "left-open" || e === "right-open" || e === "left-width" || e === "right-width") && this.syncWorkspaceState(), e === "height") {
|
|
1116
|
+
this.syncHeight();
|
|
1117
|
+
const s = this.getAttribute("variant") || "overlay";
|
|
1118
|
+
s === "workspace" && this.syncWorkspaceState(), (s === "push" || s === "persistent") && this.updateLayout(s, this.getLayoutOpenState(s));
|
|
1119
|
+
}
|
|
1120
|
+
if (e === "width" && this.innerEl) {
|
|
1121
|
+
this.syncDrawerWidth();
|
|
1122
|
+
const s = this.getAttribute("variant") || "overlay";
|
|
1123
|
+
(s === "push" || s === "persistent") && this.updateLayout(s, this.getLayoutOpenState(s));
|
|
1124
|
+
}
|
|
1125
|
+
if (e === "mobile-presentation") {
|
|
1126
|
+
this.syncDrawerWidth();
|
|
1127
|
+
const s = this.getAttribute("variant") || "overlay";
|
|
1128
|
+
(s === "push" || s === "persistent") && this.updateLayout(s, this.getLayoutOpenState(s)), this.syncOpenState();
|
|
1129
|
+
}
|
|
1130
|
+
if (e === "side" && (this.getAttribute("variant") || "overlay") === "workspace") {
|
|
1131
|
+
this.syncOpenState(), this.syncWorkspaceState();
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
if ((e === "side" || e === "resize-rail") && (this.render(), this.cacheEls(), this.syncDrawerWidth(), this.attachEvents(), this.syncOpenState(), this.syncWorkspaceState()), e === "resize-min-drawer-width" || e === "resize-min-page-width") {
|
|
1135
|
+
const s = this.getAttribute("variant") || "overlay";
|
|
1136
|
+
if ((s === "push" || s === "persistent") && this.hasAttribute("resize-rail") && (this.syncResizeRailDrawerWidthBounds(), this.updateLayout(s, s === "persistent" ? !0 : this.hasAttribute("open"))), s === "workspace" && this.hasAttribute("resize-rail")) {
|
|
1137
|
+
const r = this.getResizeRailMinDrawerWidth();
|
|
1138
|
+
["left", "right"].forEach((a) => {
|
|
1139
|
+
this.hasAttribute(`${a}-open`) && this.getWorkspacePanelWidth(a) < r && this.setAttribute(`${a}-width`, `${r}px`);
|
|
1140
|
+
}), this.syncWorkspaceState();
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
if (e === "resize-close-threshold") {
|
|
1144
|
+
const s = this.getAttribute("variant") || "overlay";
|
|
1145
|
+
s === "push" && this.hasAttribute("resize-rail") && this.updateLayout(s, this.hasAttribute("open"));
|
|
1146
|
+
}
|
|
1147
|
+
e === "variant" && (this.render(), this.cacheEls(), this.syncDrawerWidth(), this.attachEvents(), this.syncOpenState());
|
|
1148
|
+
}
|
|
1149
|
+
syncResizeCloseOpacity(e) {
|
|
1150
|
+
var s;
|
|
1151
|
+
if (!this.outer) return;
|
|
1152
|
+
const t = this.getAttribute("variant") || "overlay", i = window.innerWidth <= this.getBreakpoint();
|
|
1153
|
+
if (t !== "push" || !this.hasAttribute("resize-rail") || i) {
|
|
1154
|
+
this.outer.style.removeProperty("opacity"), (s = this.resizeRailEl) == null || s.classList.remove("threshold");
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1157
|
+
this.outer.style.opacity = this.getResizeCloseOpacity(e).toString();
|
|
1158
|
+
}
|
|
1159
|
+
getResizeCloseOpacity(e) {
|
|
1160
|
+
const t = this.getResizeRailMinDrawerWidth(), i = Math.min(this.getResizeRailCloseThreshold(), t - 1), s = t - i;
|
|
1161
|
+
return 0.2 + Math.max(0, Math.min((e - i) / s, 1)) * 0.8;
|
|
1162
|
+
}
|
|
1163
|
+
getCurrentDrawerWidth() {
|
|
1164
|
+
var i;
|
|
1165
|
+
const e = this.getAttribute("width") || "320px", t = Number.parseFloat(e);
|
|
1166
|
+
return e.endsWith("px") && Number.isFinite(t) ? t : ((i = this.innerEl) == null ? void 0 : i.getBoundingClientRect().width) || 320;
|
|
1167
|
+
}
|
|
1168
|
+
getResizeRailMaxDrawerWidth() {
|
|
1169
|
+
var r, a;
|
|
1170
|
+
const e = ((r = this.pushLayout) == null ? void 0 : r.getBoundingClientRect().width) || window.innerWidth, t = this.getResizeRailMinDrawerWidth(), i = Math.min(this.getResizeRailMinPageWidth(), e * 0.5), s = ((a = this.resizeRailEl) == null ? void 0 : a.getBoundingClientRect().width) || 0;
|
|
1171
|
+
return Math.max(t, e - i - s);
|
|
1172
|
+
}
|
|
1173
|
+
getWorkspacePanelWidth(e) {
|
|
1174
|
+
const t = this.getWorkspacePanel(e), i = this.getAttribute(`${e}-width`) || (e === "left" ? "28rem" : "32rem"), s = Number.parseFloat(i);
|
|
1175
|
+
return i.endsWith("px") && Number.isFinite(s) ? s : i.endsWith("rem") && Number.isFinite(s) ? s * parseFloat(getComputedStyle(document.documentElement).fontSize) : (t == null ? void 0 : t.getBoundingClientRect().width) || s || g;
|
|
1176
|
+
}
|
|
1177
|
+
getWorkspacePanel(e) {
|
|
1178
|
+
var t;
|
|
1179
|
+
return ((t = this.shadowRoot) == null ? void 0 : t.querySelector(`.workspace-panel-${e}`)) || null;
|
|
1180
|
+
}
|
|
1181
|
+
getWorkspaceResizeRail(e) {
|
|
1182
|
+
var t;
|
|
1183
|
+
return ((t = this.shadowRoot) == null ? void 0 : t.querySelector(`[data-workspace-resize="${e}"]`)) || null;
|
|
1184
|
+
}
|
|
1185
|
+
getFocusedWorkspaceResizeSide() {
|
|
1186
|
+
var i;
|
|
1187
|
+
const e = (i = this.shadowRoot) == null ? void 0 : i.activeElement, t = e == null ? void 0 : e.dataset.workspaceResize;
|
|
1188
|
+
return t === "left" || t === "right" ? t : null;
|
|
1189
|
+
}
|
|
1190
|
+
isResizeRailPointerClick(e, t, i) {
|
|
1191
|
+
return Math.abs(i.clientX - e) <= k && Math.abs(i.clientY - t) <= k;
|
|
1192
|
+
}
|
|
1193
|
+
syncWorkspaceResizeCloseOpacity(e, t) {
|
|
1194
|
+
var a;
|
|
1195
|
+
const i = this.getWorkspacePanel(e);
|
|
1196
|
+
if (!i) return;
|
|
1197
|
+
const s = this.getAttribute("variant") || "overlay", r = window.innerWidth <= this.getBreakpoint();
|
|
1198
|
+
if (s !== "workspace" || !this.hasAttribute("resize-rail") || r) {
|
|
1199
|
+
i.style.removeProperty("opacity"), (a = this.getWorkspaceResizeRail(e)) == null || a.classList.remove("threshold");
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
i.style.opacity = this.getResizeCloseOpacity(t).toString();
|
|
1203
|
+
}
|
|
1204
|
+
getWorkspaceMaxPanelWidth(e) {
|
|
1205
|
+
var h;
|
|
1206
|
+
const t = (h = this.shadowRoot) == null ? void 0 : h.querySelector(".workspace-shell"), i = (t == null ? void 0 : t.getBoundingClientRect().width) || window.innerWidth, s = this.getResizeRailMinDrawerWidth(), r = Math.min(this.getResizeRailMinPageWidth(), i * 0.5), a = e === "left" ? "right" : "left", o = this.hasAttribute(`${a}-open`) ? this.getWorkspacePanelWidth(a) : 0, n = this.workspaceResizeRailEls.reduce((d, l) => d + (l.hidden ? 0 : l.getBoundingClientRect().width), 0);
|
|
1207
|
+
return Math.max(s, i - o - r - n);
|
|
363
1208
|
}
|
|
364
1209
|
syncOpenState() {
|
|
365
|
-
const
|
|
366
|
-
|
|
1210
|
+
const e = this.hasAttribute("open"), t = this.getAttribute("variant") || "overlay", i = this.getAttribute("z-index"), s = i ? Number(i) : 10, r = i ? Number(i) + 1 : 11;
|
|
1211
|
+
if (this.classList.contains("no-transition") || [this.outer, this.overlayEl].forEach((a) => {
|
|
1212
|
+
if (a) {
|
|
1213
|
+
a.classList.add("is-animating");
|
|
1214
|
+
let o = !1;
|
|
1215
|
+
const n = () => {
|
|
1216
|
+
o || (o = !0, a.classList.remove("is-animating"));
|
|
1217
|
+
};
|
|
1218
|
+
a.addEventListener("transitionend", n, { once: !0 }), setTimeout(n, 400);
|
|
1219
|
+
}
|
|
1220
|
+
}), t === "overlay" && this.overlayEl && (this.overlayEl.style.visibility = e ? "visible" : "hidden", this.overlayEl.style.opacity = e ? "1" : "0", this.overlayEl.style.zIndex = s.toString(), this.innerEl.style.zIndex = r.toString(), this.inert = !e), t === "push" && this.outer && (this.updateLayout(t, e), this.resizeState || this.syncResizeCloseOpacity(e ? this.getCurrentDrawerWidth() : 0), this.overlayEl && (this.overlayEl.style.zIndex = s.toString()), this.outer.style.zIndex = i ? r.toString() : "", this.style.zIndex = i || "", this.outer.inert = !e, this.resizeRailEl && (this.resizeRailEl.tabIndex = e ? 0 : -1, this.resizeRailEl.setAttribute("aria-hidden", e ? "false" : "true"))), t === "persistent" && this.outer) {
|
|
1221
|
+
const a = this.usesMobileOverlay(t);
|
|
1222
|
+
this.updateLayout(t, this.getLayoutOpenState(t)), this.overlayEl && (this.overlayEl.style.zIndex = s.toString()), this.outer.style.zIndex = a && i ? r.toString() : "", this.style.zIndex = i || "", this.outer.inert = a ? !e : !1, this.resizeRailEl && (this.resizeRailEl.tabIndex = 0, this.resizeRailEl.setAttribute("aria-hidden", "false"));
|
|
1223
|
+
}
|
|
1224
|
+
if (t === "workspace") {
|
|
1225
|
+
if (this.overlayEl) {
|
|
1226
|
+
const o = this.usesMobileOverlay(t) && e;
|
|
1227
|
+
this.overlayEl.style.visibility = o ? "visible" : "hidden", this.overlayEl.style.opacity = o ? "1" : "0", this.overlayEl.style.zIndex = s.toString();
|
|
1228
|
+
}
|
|
1229
|
+
const a = this.usesMobileOverlay(t) && i ? r.toString() : "";
|
|
1230
|
+
[this.getWorkspacePanel("left"), this.getWorkspacePanel("right")].forEach((o) => {
|
|
1231
|
+
o && (o.style.zIndex = a);
|
|
1232
|
+
}), this.style.zIndex = i || "", this.syncWorkspaceState();
|
|
1233
|
+
}
|
|
367
1234
|
}
|
|
368
|
-
updateLayout(
|
|
369
|
-
|
|
370
|
-
|
|
1235
|
+
updateLayout(e, t) {
|
|
1236
|
+
var o, n;
|
|
1237
|
+
const i = this.getAttribute("width") || "320px", s = this.getAttribute("side") || this._computedSide, r = e === "push" ? this.pushLayout : e === "persistent" ? this.persistentLayout : null;
|
|
1238
|
+
if (!r) return;
|
|
371
1239
|
if (window.innerWidth <= this.getBreakpoint()) {
|
|
372
|
-
|
|
1240
|
+
(o = this.outer) == null || o.style.removeProperty("opacity"), (n = this.resizeRailEl) == null || n.classList.remove("threshold"), e === "push" ? r.style.removeProperty("grid-template-columns") : e === "persistent" && (this.getMobilePresentation() === "stack" && (r.style.display = "grid"), r.style.removeProperty("grid-template-columns"));
|
|
373
1241
|
return;
|
|
374
1242
|
}
|
|
375
|
-
|
|
1243
|
+
r.style.display = "grid", e === "push" ? this.hasAttribute("resize-rail") ? r.style.gridTemplateColumns = s === "left" ? t ? `${i} var(--drawer-resize-rail-size, var(--space-100)) minmax(0, 1fr)` : "0 0 minmax(0, 1fr)" : t ? `minmax(0, 1fr) var(--drawer-resize-rail-size, var(--space-100)) ${i}` : "minmax(0, 1fr) 0 0" : r.style.gridTemplateColumns = s === "left" ? t ? `${i} auto` : "0 auto" : t ? `auto ${i}` : "auto 0" : e === "persistent" && (this.hasAttribute("resize-rail") ? r.style.gridTemplateColumns = s === "left" ? `${i} var(--drawer-resize-rail-size, var(--space-100)) minmax(0, 1fr)` : `minmax(0, 1fr) var(--drawer-resize-rail-size, var(--space-100)) ${i}` : r.style.gridTemplateColumns = s === "left" ? `${i} auto` : `auto ${i}`);
|
|
376
1244
|
}
|
|
377
1245
|
open() {
|
|
378
1246
|
this.setAttribute("open", ""), this.dispatchEvent(new CustomEvent("mui-drawer-open", { bubbles: !0, composed: !0 }));
|
|
@@ -381,4 +1249,4 @@ class u extends HTMLElement {
|
|
|
381
1249
|
this.removeAttribute("open"), this.dispatchEvent(new CustomEvent("mui-drawer-close", { bubbles: !0, composed: !0 }));
|
|
382
1250
|
}
|
|
383
1251
|
}
|
|
384
|
-
customElements.get("mui-drawer") || customElements.define("mui-drawer",
|
|
1252
|
+
customElements.get("mui-drawer") || customElements.define("mui-drawer", A);
|