@dogsbay/elements 0.2.0-beta.121 → 0.2.0-beta.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-S62ZVVO3.js → chunk-2ZMWJ74J.js} +2 -3
- package/dist/{chunk-CLUADA3G.js → chunk-5KHESKQR.js} +1 -2
- package/dist/{chunk-LAUNXWKJ.js → chunk-5WY3DHVB.js} +1 -2
- package/dist/{chunk-EGU66XCL.js → chunk-6QAYHFIQ.js} +2 -3
- package/dist/{chunk-4YPDR3W6.js → chunk-6ZKFQBCF.js} +1 -2
- package/dist/{chunk-VW7HZY2B.js → chunk-AVQ7KRRE.js} +1 -2
- package/dist/{chunk-V4P3UR4I.js → chunk-CD3G6HKT.js} +1 -2
- package/dist/{chunk-FIJZRZEN.js → chunk-EPHDSTM7.js} +4 -9
- package/dist/{chunk-MAD6XJY4.js → chunk-GC5HL7FU.js} +2 -3
- package/dist/{chunk-3FMXAKOU.js → chunk-HMNRE3FZ.js} +2 -3
- package/dist/{chunk-MEOIAZDF.js → chunk-HMV62CBN.js} +2 -3
- package/dist/{chunk-ETBBSA3I.js → chunk-JRAYNKQ6.js} +1 -2
- package/dist/chunk-KFY2MTR3.js +190 -0
- package/dist/{chunk-3AEQ6KHV.js → chunk-KXCPLIQD.js} +9 -2
- package/dist/{chunk-K6DPDBAG.js → chunk-MZDGSTI4.js} +1 -1
- package/dist/{chunk-SLJG53M7.js → chunk-RZ3KZOM3.js} +2 -3
- package/dist/{chunk-QSRUT67Y.js → chunk-US4H4ZPZ.js} +1 -2
- package/dist/db-accordion.js +2 -3
- package/dist/db-card.js +2 -3
- package/dist/db-code-block.js +2 -3
- package/dist/db-collapsible.js +2 -3
- package/dist/db-combobox.js +3 -4
- package/dist/db-details-sheet.d.ts +53 -0
- package/dist/db-details-sheet.js +8 -0
- package/dist/db-dialog.js +3 -4
- package/dist/db-link-button.js +2 -3
- package/dist/db-nav-tree.js +3 -4
- package/dist/db-popover.js +3 -4
- package/dist/db-select.js +3 -4
- package/dist/db-steps.js +2 -3
- package/dist/db-tabs.js +2 -3
- package/dist/db-toc.js +3 -3
- package/dist/db-tooltip.js +3 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +22 -19
- package/package.json +6 -2
- package/dist/chunk-3AEQ6KHV.js.map +0 -1
- package/dist/chunk-3FMXAKOU.js.map +0 -1
- package/dist/chunk-4YPDR3W6.js.map +0 -1
- package/dist/chunk-CLUADA3G.js.map +0 -1
- package/dist/chunk-EGU66XCL.js.map +0 -1
- package/dist/chunk-ETBBSA3I.js.map +0 -1
- package/dist/chunk-FIJZRZEN.js.map +0 -1
- package/dist/chunk-K6DPDBAG.js.map +0 -1
- package/dist/chunk-LAUNXWKJ.js.map +0 -1
- package/dist/chunk-MAD6XJY4.js.map +0 -1
- package/dist/chunk-MEOIAZDF.js.map +0 -1
- package/dist/chunk-QSRUT67Y.js.map +0 -1
- package/dist/chunk-S62ZVVO3.js.map +0 -1
- package/dist/chunk-SLJG53M7.js.map +0 -1
- package/dist/chunk-V4P3UR4I.js.map +0 -1
- package/dist/chunk-VW7HZY2B.js.map +0 -1
- package/dist/db-accordion.js.map +0 -1
- package/dist/db-card.js.map +0 -1
- package/dist/db-code-block.js.map +0 -1
- package/dist/db-collapsible.js.map +0 -1
- package/dist/db-combobox.js.map +0 -1
- package/dist/db-dialog.js.map +0 -1
- package/dist/db-link-button.js.map +0 -1
- package/dist/db-nav-tree.js.map +0 -1
- package/dist/db-popover.js.map +0 -1
- package/dist/db-select.js.map +0 -1
- package/dist/db-steps.js.map +0 -1
- package/dist/db-tabs.js.map +0 -1
- package/dist/db-toc.js.map +0 -1
- package/dist/db-tooltip.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
own,
|
|
3
3
|
uid
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KXCPLIQD.js";
|
|
5
5
|
import {
|
|
6
6
|
DogsbayElement,
|
|
7
7
|
ensureDefaultDisplay
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MZDGSTI4.js";
|
|
9
9
|
|
|
10
10
|
// src/db-nav-tree.ts
|
|
11
11
|
var DbNavTree = class extends DogsbayElement {
|
|
@@ -231,4 +231,3 @@ if (!customElements.get("db-nav-tree")) {
|
|
|
231
231
|
export {
|
|
232
232
|
DbNavTree
|
|
233
233
|
};
|
|
234
|
-
//# sourceMappingURL=chunk-S62ZVVO3.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DogsbayElement,
|
|
3
3
|
ensureDefaultDisplay
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MZDGSTI4.js";
|
|
5
5
|
|
|
6
6
|
// src/db-accordion.ts
|
|
7
7
|
import { CompositeNavigation } from "@dogsbay/primitives/composite";
|
|
@@ -94,4 +94,3 @@ if (!customElements.get("db-accordion")) {
|
|
|
94
94
|
export {
|
|
95
95
|
DbAccordion
|
|
96
96
|
};
|
|
97
|
-
//# sourceMappingURL=chunk-CLUADA3G.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DogsbayElement,
|
|
3
3
|
ensureDefaultDisplay
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MZDGSTI4.js";
|
|
5
5
|
|
|
6
6
|
// src/db-collapsible.ts
|
|
7
7
|
import { Collapsible } from "@dogsbay/primitives/collapsible";
|
|
@@ -45,4 +45,3 @@ if (!customElements.get("db-collapsible")) {
|
|
|
45
45
|
export {
|
|
46
46
|
DbCollapsible
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=chunk-LAUNXWKJ.js.map
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
resolveAsChild,
|
|
6
6
|
showFloating,
|
|
7
7
|
uid
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KXCPLIQD.js";
|
|
9
9
|
import {
|
|
10
10
|
DogsbayElement,
|
|
11
11
|
ensureDefaultDisplay
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-MZDGSTI4.js";
|
|
13
13
|
|
|
14
14
|
// src/db-popover.ts
|
|
15
15
|
import { DismissController } from "@dogsbay/primitives/dismiss";
|
|
@@ -113,4 +113,3 @@ if (!customElements.get("db-popover")) {
|
|
|
113
113
|
export {
|
|
114
114
|
DbPopover
|
|
115
115
|
};
|
|
116
|
-
//# sourceMappingURL=chunk-EGU66XCL.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DogsbayElement,
|
|
3
3
|
ensureDefaultDisplay
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MZDGSTI4.js";
|
|
5
5
|
|
|
6
6
|
// src/db-tabs.ts
|
|
7
7
|
import { CompositeNavigation } from "@dogsbay/primitives/composite";
|
|
@@ -187,4 +187,3 @@ if (!customElements.get("db-tabs")) {
|
|
|
187
187
|
export {
|
|
188
188
|
DbTabs
|
|
189
189
|
};
|
|
190
|
-
//# sourceMappingURL=chunk-4YPDR3W6.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DogsbayElement,
|
|
3
3
|
ensureDefaultDisplay
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MZDGSTI4.js";
|
|
5
5
|
|
|
6
6
|
// src/db-steps.ts
|
|
7
7
|
var DbSteps = class extends DogsbayElement {
|
|
@@ -21,4 +21,3 @@ if (!customElements.get("db-steps")) {
|
|
|
21
21
|
export {
|
|
22
22
|
DbSteps
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=chunk-VW7HZY2B.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DogsbayElement,
|
|
3
3
|
ensureDefaultDisplay
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MZDGSTI4.js";
|
|
5
5
|
|
|
6
6
|
// src/db-code-block.ts
|
|
7
7
|
var DbCodeBlock = class extends DogsbayElement {
|
|
@@ -88,4 +88,3 @@ if (!customElements.get("db-code-block")) {
|
|
|
88
88
|
export {
|
|
89
89
|
DbCodeBlock
|
|
90
90
|
};
|
|
91
|
-
//# sourceMappingURL=chunk-V4P3UR4I.js.map
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
safeDecode
|
|
3
|
+
} from "./chunk-KXCPLIQD.js";
|
|
1
4
|
import {
|
|
2
5
|
DogsbayElement,
|
|
3
6
|
ensureDefaultDisplay
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MZDGSTI4.js";
|
|
5
8
|
|
|
6
9
|
// src/db-toc.ts
|
|
7
10
|
var DbToc = class extends DogsbayElement {
|
|
@@ -72,13 +75,6 @@ var DbToc = class extends DogsbayElement {
|
|
|
72
75
|
this.dispatchEvent(new CustomEvent("db-toc:change", { detail: { id }, bubbles: true }));
|
|
73
76
|
}
|
|
74
77
|
};
|
|
75
|
-
function safeDecode(s) {
|
|
76
|
-
try {
|
|
77
|
-
return decodeURIComponent(s);
|
|
78
|
-
} catch {
|
|
79
|
-
return s;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
78
|
ensureDefaultDisplay();
|
|
83
79
|
if (!customElements.get("db-toc")) {
|
|
84
80
|
customElements.define("db-toc", DbToc);
|
|
@@ -87,4 +83,3 @@ if (!customElements.get("db-toc")) {
|
|
|
87
83
|
export {
|
|
88
84
|
DbToc
|
|
89
85
|
};
|
|
90
|
-
//# sourceMappingURL=chunk-FIJZRZEN.js.map
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
isDisabled,
|
|
3
3
|
ownOne,
|
|
4
4
|
uid
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KXCPLIQD.js";
|
|
6
6
|
import {
|
|
7
7
|
DogsbayElement,
|
|
8
8
|
ensureDefaultDisplay
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MZDGSTI4.js";
|
|
10
10
|
|
|
11
11
|
// src/db-combobox.ts
|
|
12
12
|
var DbCombobox = class extends DogsbayElement {
|
|
@@ -253,4 +253,3 @@ if (!customElements.get("db-combobox")) {
|
|
|
253
253
|
export {
|
|
254
254
|
DbCombobox
|
|
255
255
|
};
|
|
256
|
-
//# sourceMappingURL=chunk-MAD6XJY4.js.map
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
ownOne,
|
|
6
6
|
showFloating,
|
|
7
7
|
uid
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KXCPLIQD.js";
|
|
9
9
|
import {
|
|
10
10
|
DogsbayElement,
|
|
11
11
|
ensureDefaultDisplay
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-MZDGSTI4.js";
|
|
13
13
|
|
|
14
14
|
// src/db-select.ts
|
|
15
15
|
import { DismissController } from "@dogsbay/primitives/dismiss";
|
|
@@ -380,4 +380,3 @@ if (!customElements.get("db-select")) {
|
|
|
380
380
|
export {
|
|
381
381
|
DbSelect
|
|
382
382
|
};
|
|
383
|
-
//# sourceMappingURL=chunk-3FMXAKOU.js.map
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
resolveAsChild,
|
|
5
5
|
showFloating,
|
|
6
6
|
uid
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KXCPLIQD.js";
|
|
8
8
|
import {
|
|
9
9
|
DogsbayElement,
|
|
10
10
|
ensureDefaultDisplay
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MZDGSTI4.js";
|
|
12
12
|
|
|
13
13
|
// src/db-tooltip.ts
|
|
14
14
|
import { setupFloating } from "@dogsbay/primitives/floating";
|
|
@@ -137,4 +137,3 @@ if (!customElements.get("db-tooltip")) {
|
|
|
137
137
|
export {
|
|
138
138
|
DbTooltip
|
|
139
139
|
};
|
|
140
|
-
//# sourceMappingURL=chunk-MEOIAZDF.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DogsbayElement,
|
|
3
3
|
ensureDefaultDisplay
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MZDGSTI4.js";
|
|
5
5
|
|
|
6
6
|
// src/db-card.ts
|
|
7
7
|
var DbCard = class extends DogsbayElement {
|
|
@@ -51,4 +51,3 @@ if (!customElements.get("db-card")) {
|
|
|
51
51
|
export {
|
|
52
52
|
DbCard
|
|
53
53
|
};
|
|
54
|
-
//# sourceMappingURL=chunk-ETBBSA3I.js.map
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import {
|
|
2
|
+
safeDecode,
|
|
3
|
+
uid
|
|
4
|
+
} from "./chunk-KXCPLIQD.js";
|
|
5
|
+
import {
|
|
6
|
+
DogsbayElement,
|
|
7
|
+
ensureDefaultDisplay
|
|
8
|
+
} from "./chunk-MZDGSTI4.js";
|
|
9
|
+
|
|
10
|
+
// src/db-details-sheet.ts
|
|
11
|
+
var DbDetailsSheet = class extends DogsbayElement {
|
|
12
|
+
details = null;
|
|
13
|
+
summary = null;
|
|
14
|
+
dialog = null;
|
|
15
|
+
body = null;
|
|
16
|
+
/** Where the moved nodes came from, and the nodes, while the sheet is open. */
|
|
17
|
+
source = null;
|
|
18
|
+
moved = [];
|
|
19
|
+
/** The fragment already acted on: moving a nested sheet in and out of a
|
|
20
|
+
* dialog reconnects it, and reopening on every connect made it undismissable. */
|
|
21
|
+
handledHash = null;
|
|
22
|
+
get open() {
|
|
23
|
+
return !!this.dialog?.open;
|
|
24
|
+
}
|
|
25
|
+
onSummaryClick = (e) => {
|
|
26
|
+
const t = e.target;
|
|
27
|
+
if (t && t !== this.summary && t.closest?.("a[href], button, input, select, textarea, label")?.closest("summary") === this.summary) return;
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
this.show();
|
|
30
|
+
};
|
|
31
|
+
// A click on the ::backdrop targets the dialog itself, outside its box.
|
|
32
|
+
onDialogClick = (e) => {
|
|
33
|
+
const d = this.dialog;
|
|
34
|
+
if (!d || e.target !== d) return;
|
|
35
|
+
const r = d.getBoundingClientRect();
|
|
36
|
+
const inside = e.clientX >= r.left && e.clientX <= r.right && e.clientY >= r.top && e.clientY <= r.bottom;
|
|
37
|
+
if (!inside && (e.clientX !== 0 || e.clientY !== 0)) d.close();
|
|
38
|
+
};
|
|
39
|
+
// Every way the dialog closes (Escape, backdrop, button, api) ends here.
|
|
40
|
+
onDialogClose = () => this.restore();
|
|
41
|
+
// A link to the fragment the URL already has fires no hashchange: after the
|
|
42
|
+
// sheet was closed, a second click on the same link did nothing (#100)
|
|
43
|
+
onDocClick = (e) => {
|
|
44
|
+
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
|
45
|
+
const a = e.target?.closest?.("a[href]");
|
|
46
|
+
if (!a || !this.details || this.open || a.hasAttribute("download") || a.target && a.target !== "_self") return;
|
|
47
|
+
const url = new URL(a.href, location.href);
|
|
48
|
+
if (!url.hash || url.hash !== location.hash || url.pathname !== location.pathname || url.search !== location.search) return;
|
|
49
|
+
const target = document.getElementById(safeDecode(url.hash.slice(1)));
|
|
50
|
+
if (!target || !this.details.contains(target)) return;
|
|
51
|
+
for (const inner of this.details.querySelectorAll("db-details-sheet")) inner.handledHash = null;
|
|
52
|
+
this.show(target);
|
|
53
|
+
};
|
|
54
|
+
onHash = () => {
|
|
55
|
+
this.handledHash = null;
|
|
56
|
+
this.openForHash();
|
|
57
|
+
};
|
|
58
|
+
setup() {
|
|
59
|
+
const details = Array.from(this.children).find((c) => c.tagName === "DETAILS") ?? null;
|
|
60
|
+
const summary = details ? Array.from(details.children).find((c) => c.tagName === "SUMMARY") ?? null : null;
|
|
61
|
+
const dialogOk = typeof HTMLDialogElement !== "undefined" && typeof HTMLDialogElement.prototype.showModal === "function";
|
|
62
|
+
if (!details || !summary || !dialogOk) return;
|
|
63
|
+
for (const c of Array.from(details.children)) if (c.getAttribute("role") === "status") c.setAttribute("aria-live", "off");
|
|
64
|
+
this.details = details;
|
|
65
|
+
this.summary = summary;
|
|
66
|
+
details.open = false;
|
|
67
|
+
ensureSheetStyles();
|
|
68
|
+
const title = (summary.querySelector("[data-part='title']")?.textContent ?? summary.textContent ?? "").trim();
|
|
69
|
+
const dialog = document.createElement("dialog");
|
|
70
|
+
dialog.className = "db-sheet";
|
|
71
|
+
dialog.id = uid("db-sheet");
|
|
72
|
+
const heading = document.createElement("h2");
|
|
73
|
+
heading.className = "db-sheet-title";
|
|
74
|
+
heading.id = uid("db-sheet-title");
|
|
75
|
+
heading.textContent = title;
|
|
76
|
+
dialog.setAttribute("aria-labelledby", heading.id);
|
|
77
|
+
const close = document.createElement("button");
|
|
78
|
+
close.type = "button";
|
|
79
|
+
close.className = "db-sheet-close";
|
|
80
|
+
close.setAttribute("aria-label", this.getAttribute("close-label") || "Close");
|
|
81
|
+
close.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>';
|
|
82
|
+
close.addEventListener("click", () => dialog.close());
|
|
83
|
+
const header = document.createElement("div");
|
|
84
|
+
header.className = "db-sheet-header";
|
|
85
|
+
header.append(heading, close);
|
|
86
|
+
const body = document.createElement("div");
|
|
87
|
+
body.className = "db-sheet-body";
|
|
88
|
+
dialog.append(header, body);
|
|
89
|
+
this.append(dialog);
|
|
90
|
+
this.dialog = dialog;
|
|
91
|
+
this.body = body;
|
|
92
|
+
summary.setAttribute("aria-haspopup", "dialog");
|
|
93
|
+
summary.setAttribute("aria-controls", dialog.id);
|
|
94
|
+
summary.setAttribute("aria-expanded", "false");
|
|
95
|
+
this.setAttribute("data-state", "closed");
|
|
96
|
+
}
|
|
97
|
+
connect() {
|
|
98
|
+
if (!this.dialog) return;
|
|
99
|
+
this.summary.addEventListener("click", this.onSummaryClick);
|
|
100
|
+
this.dialog.addEventListener("click", this.onDialogClick);
|
|
101
|
+
this.dialog.addEventListener("close", this.onDialogClose);
|
|
102
|
+
window.addEventListener("hashchange", this.onHash);
|
|
103
|
+
document.addEventListener("click", this.onDocClick);
|
|
104
|
+
queueMicrotask(() => this.isConnected && this.openForHash());
|
|
105
|
+
}
|
|
106
|
+
disconnect() {
|
|
107
|
+
if (!this.dialog) return;
|
|
108
|
+
if (this.dialog.open) this.dialog.close();
|
|
109
|
+
this.restore(false);
|
|
110
|
+
this.summary.removeEventListener("click", this.onSummaryClick);
|
|
111
|
+
this.dialog.removeEventListener("click", this.onDialogClick);
|
|
112
|
+
this.dialog.removeEventListener("close", this.onDialogClose);
|
|
113
|
+
window.removeEventListener("hashchange", this.onHash);
|
|
114
|
+
document.removeEventListener("click", this.onDocClick);
|
|
115
|
+
}
|
|
116
|
+
show(focusTarget) {
|
|
117
|
+
const { dialog, details, body } = this;
|
|
118
|
+
if (!dialog || !details || !body || dialog.open) return;
|
|
119
|
+
const rest = Array.from(details.childNodes).filter((n) => n !== this.summary);
|
|
120
|
+
const elements = rest.filter((n) => n.nodeType === Node.ELEMENT_NODE);
|
|
121
|
+
const wrapper = elements.length === 1 && rest.every((n) => n === elements[0] || !n.textContent?.trim()) ? elements[0] : null;
|
|
122
|
+
this.source = wrapper ?? details;
|
|
123
|
+
this.moved = wrapper ? Array.from(wrapper.childNodes) : rest;
|
|
124
|
+
body.append(...this.moved);
|
|
125
|
+
dialog.showModal();
|
|
126
|
+
this.summary.setAttribute("aria-expanded", "true");
|
|
127
|
+
this.setAttribute("data-state", "open");
|
|
128
|
+
if (focusTarget && focusTarget !== details) focusTarget.scrollIntoView?.({ block: "start" });
|
|
129
|
+
this.dispatchEvent(new CustomEvent("db-details-sheet:open", { bubbles: true }));
|
|
130
|
+
}
|
|
131
|
+
close() {
|
|
132
|
+
this.dialog?.close();
|
|
133
|
+
}
|
|
134
|
+
restore(focus = true) {
|
|
135
|
+
if (!this.source) return;
|
|
136
|
+
this.source.append(...this.moved);
|
|
137
|
+
this.source = null;
|
|
138
|
+
this.moved = [];
|
|
139
|
+
this.summary.setAttribute("aria-expanded", "false");
|
|
140
|
+
this.setAttribute("data-state", "closed");
|
|
141
|
+
if (focus && this.isConnected && this.summary.checkVisibility?.() !== false) this.summary.focus();
|
|
142
|
+
this.dispatchEvent(new CustomEvent("db-details-sheet:close", { bubbles: true }));
|
|
143
|
+
}
|
|
144
|
+
/** Open when the URL fragment names the details or something in its body. */
|
|
145
|
+
openForHash() {
|
|
146
|
+
const id = safeDecode(location.hash.slice(1));
|
|
147
|
+
if (!id || !this.details || this.handledHash === location.hash) return;
|
|
148
|
+
this.handledHash = location.hash;
|
|
149
|
+
if (this.open) return;
|
|
150
|
+
const target = document.getElementById(id);
|
|
151
|
+
if (target && this.details.contains(target)) this.show(target);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
var STYLE_ID = "dogsbay-details-sheet";
|
|
155
|
+
function ensureSheetStyles() {
|
|
156
|
+
if (document.getElementById(STYLE_ID)) return;
|
|
157
|
+
const style = document.createElement("style");
|
|
158
|
+
style.id = STYLE_ID;
|
|
159
|
+
style.textContent = [
|
|
160
|
+
"dialog.db-sheet{position:fixed;inset:0 0 0 auto;margin:0;height:100dvh;max-height:none;width:min(32rem,100vw);max-width:100vw;padding:0;border:0;border-left:1px solid var(--border);background:var(--background);color:var(--foreground);box-shadow:0 10px 15px -3px rgb(0 0 0/.1),0 4px 6px -4px rgb(0 0 0/.1);flex-direction:column}",
|
|
161
|
+
"dialog.db-sheet[open]{display:flex}",
|
|
162
|
+
"dialog.db-sheet::backdrop{background:rgb(0 0 0/.6)}",
|
|
163
|
+
".db-sheet-header{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 1.5rem;border-bottom:1px solid var(--border)}",
|
|
164
|
+
// The dialog sits inside the page's prose: its h2 rule (border, margins)
|
|
165
|
+
// would otherwise style the title. Element + class beats `.docs-prose h2`.
|
|
166
|
+
"dialog.db-sheet h2.db-sheet-title{margin:0;padding:0;border:0;font-size:1.125rem;line-height:1.75rem;font-weight:600;scroll-margin:0}",
|
|
167
|
+
".db-sheet-close{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border:0;border-radius:.375rem;background:transparent;color:var(--muted-foreground);cursor:pointer}",
|
|
168
|
+
".db-sheet-close:hover{background:var(--accent,var(--muted));color:var(--foreground)}",
|
|
169
|
+
".db-sheet-close:focus-visible{outline:2px solid var(--ring);outline-offset:2px}",
|
|
170
|
+
".db-sheet-body{flex:1;overflow-y:auto;padding:1.5rem;font-size:.875rem;line-height:1.625}",
|
|
171
|
+
// Beats `.docs-prose p` (0,2,1): the first paragraph sat 12px down
|
|
172
|
+
"dialog.db-sheet .db-sheet-body>:first-child{margin-top:0}",
|
|
173
|
+
// A modal sheet: the page under it does not scroll
|
|
174
|
+
"html:has(dialog.db-sheet[open]){overflow:hidden}",
|
|
175
|
+
// The summary opens a panel, not a fold: its chevron points to the side.
|
|
176
|
+
"db-details-sheet>details>summary>span:last-child{transform:rotate(-90deg)}",
|
|
177
|
+
"@media (prefers-reduced-motion:no-preference){dialog.db-sheet[open]{animation:db-sheet-in .2s ease-out}dialog.db-sheet[open]::backdrop{animation:db-sheet-fade .2s ease-out}}",
|
|
178
|
+
"@keyframes db-sheet-in{from{transform:translateX(100%)}}",
|
|
179
|
+
"@keyframes db-sheet-fade{from{opacity:0}}"
|
|
180
|
+
].join("");
|
|
181
|
+
document.head.append(style);
|
|
182
|
+
}
|
|
183
|
+
ensureDefaultDisplay();
|
|
184
|
+
if (!customElements.get("db-details-sheet")) {
|
|
185
|
+
customElements.define("db-details-sheet", DbDetailsSheet);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export {
|
|
189
|
+
DbDetailsSheet
|
|
190
|
+
};
|
|
@@ -55,6 +55,13 @@ function afterAnimations(el, done) {
|
|
|
55
55
|
if (!anims.length) return done();
|
|
56
56
|
Promise.all(anims.map((a) => a.finished)).then(done, done);
|
|
57
57
|
}
|
|
58
|
+
function safeDecode(s) {
|
|
59
|
+
try {
|
|
60
|
+
return decodeURIComponent(s);
|
|
61
|
+
} catch {
|
|
62
|
+
return s;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
58
65
|
|
|
59
66
|
export {
|
|
60
67
|
uid,
|
|
@@ -65,6 +72,6 @@ export {
|
|
|
65
72
|
showFloating,
|
|
66
73
|
hideFloating,
|
|
67
74
|
focusables,
|
|
68
|
-
afterAnimations
|
|
75
|
+
afterAnimations,
|
|
76
|
+
safeDecode
|
|
69
77
|
};
|
|
70
|
-
//# sourceMappingURL=chunk-3AEQ6KHV.js.map
|
|
@@ -40,6 +40,7 @@ var DEFAULT_DISPLAY = {
|
|
|
40
40
|
"db-tabs": "block",
|
|
41
41
|
"db-accordion": "block",
|
|
42
42
|
"db-collapsible": "block",
|
|
43
|
+
"db-details-sheet": "block",
|
|
43
44
|
"db-card": "block",
|
|
44
45
|
"db-steps": "block",
|
|
45
46
|
"db-code-block": "block",
|
|
@@ -69,4 +70,3 @@ export {
|
|
|
69
70
|
DogsbayElement,
|
|
70
71
|
ensureDefaultDisplay
|
|
71
72
|
};
|
|
72
|
-
//# sourceMappingURL=chunk-K6DPDBAG.js.map
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
ownOne,
|
|
4
4
|
resolveAsChild,
|
|
5
5
|
uid
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KXCPLIQD.js";
|
|
7
7
|
import {
|
|
8
8
|
DogsbayElement,
|
|
9
9
|
ensureDefaultDisplay
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MZDGSTI4.js";
|
|
11
11
|
|
|
12
12
|
// src/db-dialog.ts
|
|
13
13
|
import { FocusTrap } from "@dogsbay/primitives/focus-trap";
|
|
@@ -205,4 +205,3 @@ if (!customElements.get("db-dialog")) {
|
|
|
205
205
|
export {
|
|
206
206
|
DbDialog
|
|
207
207
|
};
|
|
208
|
-
//# sourceMappingURL=chunk-SLJG53M7.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DogsbayElement,
|
|
3
3
|
ensureDefaultDisplay
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MZDGSTI4.js";
|
|
5
5
|
|
|
6
6
|
// src/db-link-button.ts
|
|
7
7
|
var DbLinkButton = class extends DogsbayElement {
|
|
@@ -36,4 +36,3 @@ if (!customElements.get("db-link-button")) {
|
|
|
36
36
|
export {
|
|
37
37
|
DbLinkButton
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=chunk-QSRUT67Y.js.map
|
package/dist/db-accordion.js
CHANGED
package/dist/db-card.js
CHANGED
package/dist/db-code-block.js
CHANGED
package/dist/db-collapsible.js
CHANGED
package/dist/db-combobox.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DbCombobox
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-GC5HL7FU.js";
|
|
4
|
+
import "./chunk-KXCPLIQD.js";
|
|
5
|
+
import "./chunk-MZDGSTI4.js";
|
|
6
6
|
export {
|
|
7
7
|
DbCombobox
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=db-combobox.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { D as DogsbayElement } from './base-D1Rz70fn.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `<db-details-sheet>` — a `<details>` that opens as a side sheet.
|
|
5
|
+
*
|
|
6
|
+
* The markup is an ordinary `<details>` (the CollapsibleAlert markup), so
|
|
7
|
+
* with no script — `js: none`, a blocked script, print, an agent reading the
|
|
8
|
+
* HTML — it is a working collapsible block and nothing is hidden. With the
|
|
9
|
+
* script, activating the summary opens the body in a native modal `<dialog>`
|
|
10
|
+
* on the right instead: the browser puts it in the top layer, makes the page
|
|
11
|
+
* inert and handles Escape.
|
|
12
|
+
*
|
|
13
|
+
* The body is MOVED into the sheet while it is open and back when it closes,
|
|
14
|
+
* so ids, anchors and nested elements exist once. A URL fragment naming the
|
|
15
|
+
* details or anything in its body opens the sheet, so a cross-reference lands.
|
|
16
|
+
*
|
|
17
|
+
* Attributes:
|
|
18
|
+
* close-label — the close button's accessible name (default "Close")
|
|
19
|
+
*
|
|
20
|
+
* Children:
|
|
21
|
+
* <details> with a <summary> — the summary's `[data-part="title"]`, or its
|
|
22
|
+
* text, titles the sheet
|
|
23
|
+
*
|
|
24
|
+
* Events: db-details-sheet:open, db-details-sheet:close
|
|
25
|
+
*/
|
|
26
|
+
declare class DbDetailsSheet extends DogsbayElement {
|
|
27
|
+
private details;
|
|
28
|
+
private summary;
|
|
29
|
+
private dialog;
|
|
30
|
+
private body;
|
|
31
|
+
/** Where the moved nodes came from, and the nodes, while the sheet is open. */
|
|
32
|
+
private source;
|
|
33
|
+
private moved;
|
|
34
|
+
/** The fragment already acted on: moving a nested sheet in and out of a
|
|
35
|
+
* dialog reconnects it, and reopening on every connect made it undismissable. */
|
|
36
|
+
private handledHash;
|
|
37
|
+
get open(): boolean;
|
|
38
|
+
private onSummaryClick;
|
|
39
|
+
private onDialogClick;
|
|
40
|
+
private onDialogClose;
|
|
41
|
+
private onDocClick;
|
|
42
|
+
private onHash;
|
|
43
|
+
protected setup(): void;
|
|
44
|
+
protected connect(): void;
|
|
45
|
+
protected disconnect(): void;
|
|
46
|
+
show(focusTarget?: Element | null): void;
|
|
47
|
+
close(): void;
|
|
48
|
+
private restore;
|
|
49
|
+
/** Open when the URL fragment names the details or something in its body. */
|
|
50
|
+
private openForHash;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { DbDetailsSheet };
|
package/dist/db-dialog.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DbDialog
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-RZ3KZOM3.js";
|
|
4
|
+
import "./chunk-KXCPLIQD.js";
|
|
5
|
+
import "./chunk-MZDGSTI4.js";
|
|
6
6
|
export {
|
|
7
7
|
DbDialog
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=db-dialog.js.map
|
package/dist/db-link-button.js
CHANGED
package/dist/db-nav-tree.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DbNavTree
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-2ZMWJ74J.js";
|
|
4
|
+
import "./chunk-KXCPLIQD.js";
|
|
5
|
+
import "./chunk-MZDGSTI4.js";
|
|
6
6
|
export {
|
|
7
7
|
DbNavTree
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=db-nav-tree.js.map
|
package/dist/db-popover.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DbPopover
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-6QAYHFIQ.js";
|
|
4
|
+
import "./chunk-KXCPLIQD.js";
|
|
5
|
+
import "./chunk-MZDGSTI4.js";
|
|
6
6
|
export {
|
|
7
7
|
DbPopover
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=db-popover.js.map
|