@loomidev/drawer 0.2.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/LICENSE +21 -0
- package/README.md +396 -0
- package/custom-elements.json +516 -0
- package/dist/generated/styles.css.d.ts +3 -0
- package/dist/generated/styles.css.d.ts.map +1 -0
- package/dist/generated/styles.css.js +5 -0
- package/dist/generated/styles.css.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/loomi-drawer.d.ts +75 -0
- package/dist/loomi-drawer.d.ts.map +1 -0
- package/dist/loomi-drawer.js +326 -0
- package/dist/loomi-drawer.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, nothing } from "lit";
|
|
8
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
9
|
+
import { LoomiElement, loomiStyles, loomiT, onClickOutside, lockBodyScroll, unlockBodyScroll, } from "@loomidev/core";
|
|
10
|
+
import "@loomidev/icon/loomi-icon.js";
|
|
11
|
+
import { componentStyles } from "./generated/styles.css.js";
|
|
12
|
+
const booleanAttribute = {
|
|
13
|
+
fromAttribute(value) {
|
|
14
|
+
return value !== null && value.toLowerCase() !== "false";
|
|
15
|
+
},
|
|
16
|
+
toAttribute(value) {
|
|
17
|
+
return value ? "" : null;
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
const FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
21
|
+
/** Walks into nested shadow roots to find the actually-focused element. */
|
|
22
|
+
function deepActiveElement() {
|
|
23
|
+
let el = document.activeElement;
|
|
24
|
+
while (el?.shadowRoot?.activeElement)
|
|
25
|
+
el = el.shadowRoot.activeElement;
|
|
26
|
+
return el;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolves once `el`'s open/close CSS animation finishes. Falls back to a timer so a
|
|
30
|
+
* disabled or zero-duration animation (e.g. via a custom `--loomi-drawer-duration`,
|
|
31
|
+
* or a misconfigured override) can't leave `hide()` hanging forever.
|
|
32
|
+
*/
|
|
33
|
+
function waitForAnimation(el, fallbackMs = 500) {
|
|
34
|
+
if (!el)
|
|
35
|
+
return Promise.resolve();
|
|
36
|
+
return new Promise((resolve) => {
|
|
37
|
+
let done = false;
|
|
38
|
+
const finish = () => {
|
|
39
|
+
if (done)
|
|
40
|
+
return;
|
|
41
|
+
done = true;
|
|
42
|
+
el.removeEventListener("animationend", onEnd);
|
|
43
|
+
el.removeEventListener("animationcancel", onEnd);
|
|
44
|
+
clearTimeout(timer);
|
|
45
|
+
resolve();
|
|
46
|
+
};
|
|
47
|
+
const onEnd = (e) => {
|
|
48
|
+
if (e.target === el)
|
|
49
|
+
finish();
|
|
50
|
+
};
|
|
51
|
+
el.addEventListener("animationend", onEnd);
|
|
52
|
+
el.addEventListener("animationcancel", onEnd);
|
|
53
|
+
const timer = setTimeout(finish, fallbackMs);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const registry = new Map();
|
|
57
|
+
/** Open a drawer by its `name`. */
|
|
58
|
+
export function showLoomiDrawer(name) {
|
|
59
|
+
registry.get(name)?.show();
|
|
60
|
+
}
|
|
61
|
+
/** Close a drawer by its `name`. */
|
|
62
|
+
export function hideLoomiDrawer(name) {
|
|
63
|
+
registry.get(name)?.hide();
|
|
64
|
+
}
|
|
65
|
+
if (typeof window !== "undefined") {
|
|
66
|
+
window.showLoomiDrawer = showLoomiDrawer;
|
|
67
|
+
window.hideLoomiDrawer = hideLoomiDrawer;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* `<loomi-drawer>` — a panel that slides in from an edge of the screen. Open/close via
|
|
71
|
+
* `name` with `showLoomiDrawer()` / `hideLoomiDrawer()`, or the instance `show()` / `hide()`
|
|
72
|
+
* methods.
|
|
73
|
+
*
|
|
74
|
+
* @slot - The drawer body.
|
|
75
|
+
* @fires open - Shown. @fires close - Dismissed (fires as the close animation starts).
|
|
76
|
+
*/
|
|
77
|
+
let LoomiDrawer = class LoomiDrawer extends LoomiElement {
|
|
78
|
+
constructor() {
|
|
79
|
+
super(...arguments);
|
|
80
|
+
this.name = "";
|
|
81
|
+
this.title = "";
|
|
82
|
+
this.placement = "right";
|
|
83
|
+
this.size = "medium";
|
|
84
|
+
this.locale = "";
|
|
85
|
+
this.open = false;
|
|
86
|
+
this.showCloseIcon = true;
|
|
87
|
+
this.backdrop = true;
|
|
88
|
+
this.closeOnOutsideClick = true;
|
|
89
|
+
this.preventScroll = true;
|
|
90
|
+
/** True while the close animation is playing; `open` stays true for that whole span. */
|
|
91
|
+
this.closing = false;
|
|
92
|
+
/** The element focused before `show()` was called, restored when the drawer closes. */
|
|
93
|
+
this.previouslyFocused = null;
|
|
94
|
+
this.hasScrollLock = false;
|
|
95
|
+
this.isMovingInDom = false;
|
|
96
|
+
this.originalParent = null;
|
|
97
|
+
this.originalNextSibling = null;
|
|
98
|
+
/** Bumped on every show()/hide() so a stale finalizeClose() from a superseded hide() is a no-op. */
|
|
99
|
+
this.closeToken = 0;
|
|
100
|
+
this.stopOutsideClick = null;
|
|
101
|
+
this.onKey = (e) => {
|
|
102
|
+
if (!this.open || this.closing)
|
|
103
|
+
return;
|
|
104
|
+
if (e.key === "Escape") {
|
|
105
|
+
this.hide();
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (e.key !== "Tab" || !this.backdrop)
|
|
109
|
+
return;
|
|
110
|
+
// Trap focus inside the panel while open — only when acting as a modal (backdrop on);
|
|
111
|
+
// a non-modal (no-backdrop) drawer leaves the rest of the page reachable by Tab.
|
|
112
|
+
const focusable = this.getFocusable();
|
|
113
|
+
if (focusable.length === 0) {
|
|
114
|
+
e.preventDefault();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const current = deepActiveElement();
|
|
118
|
+
const index = focusable.indexOf(current);
|
|
119
|
+
if (e.shiftKey) {
|
|
120
|
+
if (index <= 0) {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
focusable[focusable.length - 1].focus();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else if (index === -1 || index === focusable.length - 1) {
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
focusable[0].focus();
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
static { this.styles = loomiStyles(componentStyles); }
|
|
132
|
+
connectedCallback() {
|
|
133
|
+
super.connectedCallback();
|
|
134
|
+
if (this.name)
|
|
135
|
+
registry.set(this.name, this);
|
|
136
|
+
document.addEventListener("keydown", this.onKey);
|
|
137
|
+
}
|
|
138
|
+
disconnectedCallback() {
|
|
139
|
+
super.disconnectedCallback();
|
|
140
|
+
if (this.name)
|
|
141
|
+
registry.delete(this.name);
|
|
142
|
+
document.removeEventListener("keydown", this.onKey);
|
|
143
|
+
if (!this.isMovingInDom) {
|
|
144
|
+
this.releaseScrollLock();
|
|
145
|
+
this.stopOutsideClick?.();
|
|
146
|
+
this.stopOutsideClick = null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
updated(changedProperties) {
|
|
150
|
+
super.updated(changedProperties);
|
|
151
|
+
if (changedProperties.has("open") || changedProperties.has("preventScroll")) {
|
|
152
|
+
this.syncScrollLock();
|
|
153
|
+
}
|
|
154
|
+
if (changedProperties.has("open") || changedProperties.has("closeOnOutsideClick")) {
|
|
155
|
+
this.syncOutsideClick();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
show() {
|
|
159
|
+
this.closeToken += 1; // invalidate any in-flight close
|
|
160
|
+
if (this.open && !this.closing)
|
|
161
|
+
return;
|
|
162
|
+
this.closing = false;
|
|
163
|
+
this.previouslyFocused = deepActiveElement();
|
|
164
|
+
this.moveToDocumentBody();
|
|
165
|
+
this.open = true;
|
|
166
|
+
this.dispatchEvent(new Event("open", { bubbles: true, composed: true }));
|
|
167
|
+
this.updateComplete.then(() => {
|
|
168
|
+
const focusable = this.getFocusable();
|
|
169
|
+
(focusable[0] ?? this.shadowRoot?.querySelector(".loomi-panel"))?.focus();
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/** Starts the close animation immediately; resolves once the drawer has actually unmounted. */
|
|
173
|
+
hide() {
|
|
174
|
+
if (!this.open || this.closing)
|
|
175
|
+
return Promise.resolve();
|
|
176
|
+
const token = (this.closeToken += 1);
|
|
177
|
+
this.closing = true;
|
|
178
|
+
this.dispatchEvent(new Event("close", { bubbles: true, composed: true }));
|
|
179
|
+
this.previouslyFocused?.focus();
|
|
180
|
+
this.previouslyFocused = null;
|
|
181
|
+
return this.finalizeClose(token);
|
|
182
|
+
}
|
|
183
|
+
/** Waits for the exit animation, then actually unmounts — unless a newer show()/hide() superseded this one. */
|
|
184
|
+
async finalizeClose(token) {
|
|
185
|
+
await this.updateComplete;
|
|
186
|
+
const panel = this.shadowRoot?.querySelector(".loomi-panel");
|
|
187
|
+
await waitForAnimation(panel);
|
|
188
|
+
if (token !== this.closeToken)
|
|
189
|
+
return;
|
|
190
|
+
this.open = false;
|
|
191
|
+
this.closing = false;
|
|
192
|
+
this.restoreOriginalPosition();
|
|
193
|
+
}
|
|
194
|
+
moveToDocumentBody() {
|
|
195
|
+
if (this.parentNode === document.body)
|
|
196
|
+
return;
|
|
197
|
+
this.originalParent = this.parentNode;
|
|
198
|
+
this.originalNextSibling = this.nextSibling;
|
|
199
|
+
this.isMovingInDom = true;
|
|
200
|
+
document.body.appendChild(this);
|
|
201
|
+
this.isMovingInDom = false;
|
|
202
|
+
}
|
|
203
|
+
restoreOriginalPosition() {
|
|
204
|
+
if (!this.originalParent)
|
|
205
|
+
return;
|
|
206
|
+
const nextSibling = this.originalNextSibling?.parentNode === this.originalParent
|
|
207
|
+
? this.originalNextSibling
|
|
208
|
+
: null;
|
|
209
|
+
this.isMovingInDom = true;
|
|
210
|
+
if (this.originalParent.isConnected) {
|
|
211
|
+
this.originalParent.insertBefore(this, nextSibling);
|
|
212
|
+
}
|
|
213
|
+
this.isMovingInDom = false;
|
|
214
|
+
this.originalParent = null;
|
|
215
|
+
this.originalNextSibling = null;
|
|
216
|
+
}
|
|
217
|
+
syncScrollLock() {
|
|
218
|
+
if (this.open && this.preventScroll) {
|
|
219
|
+
if (!this.hasScrollLock) {
|
|
220
|
+
lockBodyScroll();
|
|
221
|
+
this.hasScrollLock = true;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
this.releaseScrollLock();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
releaseScrollLock() {
|
|
229
|
+
if (!this.hasScrollLock)
|
|
230
|
+
return;
|
|
231
|
+
unlockBodyScroll();
|
|
232
|
+
this.hasScrollLock = false;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Detects clicks outside `.loomi-panel` (including clicks on the backdrop, or
|
|
236
|
+
* anywhere on the page when there's no backdrop) and closes the drawer — independent
|
|
237
|
+
* of whether a dimming backdrop is actually rendered.
|
|
238
|
+
*/
|
|
239
|
+
syncOutsideClick() {
|
|
240
|
+
const shouldListen = this.open && this.closeOnOutsideClick;
|
|
241
|
+
if (shouldListen && !this.stopOutsideClick) {
|
|
242
|
+
const panel = this.shadowRoot?.querySelector(".loomi-panel");
|
|
243
|
+
if (panel)
|
|
244
|
+
this.stopOutsideClick = onClickOutside(panel, () => this.hide());
|
|
245
|
+
}
|
|
246
|
+
else if (!shouldListen && this.stopOutsideClick) {
|
|
247
|
+
this.stopOutsideClick();
|
|
248
|
+
this.stopOutsideClick = null;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/** Focusable elements in template order: close button, then slotted body content. */
|
|
252
|
+
getFocusable() {
|
|
253
|
+
const before = Array.from(this.shadowRoot?.querySelectorAll(".loomi-close") ?? []);
|
|
254
|
+
const light = Array.from(this.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
255
|
+
return [...before, ...light];
|
|
256
|
+
}
|
|
257
|
+
render() {
|
|
258
|
+
if (!this.open && !this.closing)
|
|
259
|
+
return nothing;
|
|
260
|
+
const animClass = this.closing ? "is-closing" : "is-open";
|
|
261
|
+
return html `
|
|
262
|
+
${this.backdrop ? html `<div class="loomi-backdrop ${animClass}"></div>` : nothing}
|
|
263
|
+
<div
|
|
264
|
+
class="loomi-panel placement-${this.placement} size-${this.size} ${animClass}"
|
|
265
|
+
role="dialog"
|
|
266
|
+
aria-modal=${this.backdrop ? "true" : "false"}
|
|
267
|
+
aria-label=${this.title || loomiT("drawer.dialog", {}, this.locale)}
|
|
268
|
+
tabindex="-1"
|
|
269
|
+
>
|
|
270
|
+
${this.title || this.showCloseIcon
|
|
271
|
+
? html `<div class="loomi-header">
|
|
272
|
+
${this.title ? html `<div class="loomi-title">${this.title}</div>` : nothing}
|
|
273
|
+
${this.showCloseIcon
|
|
274
|
+
? html `<button
|
|
275
|
+
class="loomi-close"
|
|
276
|
+
aria-label=${loomiT("common.close", {}, this.locale)}
|
|
277
|
+
@click=${() => this.hide()}
|
|
278
|
+
>
|
|
279
|
+
<loomi-icon name="x-mark" size="1.15rem" stroke-width="2"></loomi-icon>
|
|
280
|
+
</button>`
|
|
281
|
+
: nothing}
|
|
282
|
+
</div>`
|
|
283
|
+
: nothing}
|
|
284
|
+
<div class="loomi-body"><slot></slot></div>
|
|
285
|
+
</div>
|
|
286
|
+
`;
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
__decorate([
|
|
290
|
+
property()
|
|
291
|
+
], LoomiDrawer.prototype, "name", void 0);
|
|
292
|
+
__decorate([
|
|
293
|
+
property()
|
|
294
|
+
], LoomiDrawer.prototype, "title", void 0);
|
|
295
|
+
__decorate([
|
|
296
|
+
property()
|
|
297
|
+
], LoomiDrawer.prototype, "placement", void 0);
|
|
298
|
+
__decorate([
|
|
299
|
+
property()
|
|
300
|
+
], LoomiDrawer.prototype, "size", void 0);
|
|
301
|
+
__decorate([
|
|
302
|
+
property()
|
|
303
|
+
], LoomiDrawer.prototype, "locale", void 0);
|
|
304
|
+
__decorate([
|
|
305
|
+
property({ type: Boolean, reflect: true })
|
|
306
|
+
], LoomiDrawer.prototype, "open", void 0);
|
|
307
|
+
__decorate([
|
|
308
|
+
property({ type: Boolean, attribute: "show-close-icon", converter: booleanAttribute })
|
|
309
|
+
], LoomiDrawer.prototype, "showCloseIcon", void 0);
|
|
310
|
+
__decorate([
|
|
311
|
+
property({ type: Boolean, attribute: "backdrop", converter: booleanAttribute })
|
|
312
|
+
], LoomiDrawer.prototype, "backdrop", void 0);
|
|
313
|
+
__decorate([
|
|
314
|
+
property({ type: Boolean, attribute: "close-on-outside-click", converter: booleanAttribute })
|
|
315
|
+
], LoomiDrawer.prototype, "closeOnOutsideClick", void 0);
|
|
316
|
+
__decorate([
|
|
317
|
+
property({ type: Boolean, attribute: "prevent-scroll", converter: booleanAttribute })
|
|
318
|
+
], LoomiDrawer.prototype, "preventScroll", void 0);
|
|
319
|
+
__decorate([
|
|
320
|
+
state()
|
|
321
|
+
], LoomiDrawer.prototype, "closing", void 0);
|
|
322
|
+
LoomiDrawer = __decorate([
|
|
323
|
+
customElement("loomi-drawer")
|
|
324
|
+
], LoomiDrawer);
|
|
325
|
+
export { LoomiDrawer };
|
|
326
|
+
//# sourceMappingURL=loomi-drawer.js.map
|
|
@@ -0,0 +1 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> — a sliding edge panel with optional backdrop, focus trap, and customizable animations.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/loomidev/loomiui.git",
|
|
8
|
+
"directory": "packages/drawer"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"module": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"custom-elements.json"
|
|
21
|
+
],
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./loomi-drawer.js": {
|
|
28
|
+
"types": "./dist/loomi-drawer.d.ts",
|
|
29
|
+
"import": "./dist/loomi-drawer.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@loomidev/core": "^0.2.0",
|
|
34
|
+
"@loomidev/icon": "^0.2.0"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"lit": "^3.0.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@tailwindcss/cli": "^4.0.0",
|
|
41
|
+
"lit": "^3.3.3",
|
|
42
|
+
"tailwindcss": "^4.0.0",
|
|
43
|
+
"typescript": "^5.6.3",
|
|
44
|
+
"@loomidev/theme": "^0.2.0"
|
|
45
|
+
},
|
|
46
|
+
"keywords": [
|
|
47
|
+
"web-components",
|
|
48
|
+
"lit",
|
|
49
|
+
"loomiui",
|
|
50
|
+
"drawer",
|
|
51
|
+
"sidebar",
|
|
52
|
+
"panel"
|
|
53
|
+
],
|
|
54
|
+
"customElements": "custom-elements.json",
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "node scripts/build-styles.mjs && tsc -p tsconfig.json",
|
|
57
|
+
"dev": "node scripts/build-styles.mjs && tsc -p tsconfig.json --watch",
|
|
58
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
59
|
+
}
|
|
60
|
+
}
|