@dogsbay/elements 0.2.0-beta.13 → 0.2.0-beta.130
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/{base-BtvRtAsC.d.ts → base-D1Rz70fn.d.ts} +1 -0
- package/dist/chunk-2ZMWJ74J.js +233 -0
- package/dist/{chunk-7M7SFLKN.js → chunk-5KHESKQR.js} +4 -3
- package/dist/{chunk-TTNTPXBA.js → chunk-5WY3DHVB.js} +4 -3
- package/dist/chunk-6QAYHFIQ.js +115 -0
- package/dist/{chunk-LVXR7KTB.js → chunk-6ZKFQBCF.js} +40 -12
- package/dist/{chunk-5T4OXQA2.js → chunk-AVQ7KRRE.js} +5 -6
- package/dist/{chunk-FWAAU5UY.js → chunk-CD3G6HKT.js} +4 -3
- package/dist/chunk-EPHDSTM7.js +85 -0
- package/dist/chunk-GC5HL7FU.js +255 -0
- package/dist/chunk-HMNRE3FZ.js +382 -0
- package/dist/chunk-HMV62CBN.js +139 -0
- package/dist/{chunk-7BIVQSGP.js → chunk-JRAYNKQ6.js} +4 -3
- package/dist/chunk-KFY2MTR3.js +190 -0
- package/dist/chunk-KXCPLIQD.js +77 -0
- package/dist/chunk-MZDGSTI4.js +72 -0
- package/dist/chunk-RZ3KZOM3.js +207 -0
- package/dist/{chunk-LFXZQ4YV.js → chunk-US4H4ZPZ.js} +4 -3
- package/dist/db-accordion.d.ts +1 -1
- package/dist/db-accordion.js +2 -3
- package/dist/db-card.d.ts +1 -1
- package/dist/db-card.js +2 -3
- package/dist/db-code-block.d.ts +1 -1
- package/dist/db-code-block.js +2 -3
- package/dist/db-collapsible.d.ts +1 -1
- package/dist/db-collapsible.js +2 -3
- package/dist/db-combobox.d.ts +70 -0
- package/dist/db-combobox.js +8 -0
- package/dist/db-details-sheet.d.ts +53 -0
- package/dist/db-details-sheet.js +8 -0
- package/dist/db-dialog.d.ts +62 -0
- package/dist/db-dialog.js +8 -0
- package/dist/db-link-button.d.ts +1 -1
- package/dist/db-link-button.js +2 -3
- package/dist/db-nav-tree.d.ts +83 -0
- package/dist/db-nav-tree.js +8 -0
- package/dist/db-popover.d.ts +42 -0
- package/dist/db-popover.js +8 -0
- package/dist/db-select.d.ts +72 -0
- package/dist/db-select.js +8 -0
- package/dist/db-steps.d.ts +1 -1
- package/dist/db-steps.js +2 -3
- package/dist/db-tabs.d.ts +28 -1
- package/dist/db-tabs.js +2 -3
- package/dist/db-toc.d.ts +32 -0
- package/dist/db-toc.js +8 -0
- package/dist/db-tooltip.d.ts +48 -0
- package/dist/db-tooltip.js +8 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +44 -12
- package/package.json +38 -6
- package/dist/chunk-5T4OXQA2.js.map +0 -1
- package/dist/chunk-7BIVQSGP.js.map +0 -1
- package/dist/chunk-7M7SFLKN.js.map +0 -1
- package/dist/chunk-FWAAU5UY.js.map +0 -1
- package/dist/chunk-LFXZQ4YV.js.map +0 -1
- package/dist/chunk-LVXR7KTB.js.map +0 -1
- package/dist/chunk-TTNTPXBA.js.map +0 -1
- package/dist/chunk-XBMLE4N3.js +0 -28
- package/dist/chunk-XBMLE4N3.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-link-button.js.map +0 -1
- package/dist/db-steps.js.map +0 -1
- package/dist/db-tabs.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import {
|
|
2
|
+
afterAnimations,
|
|
3
|
+
ownOne,
|
|
4
|
+
resolveAsChild,
|
|
5
|
+
uid
|
|
6
|
+
} from "./chunk-KXCPLIQD.js";
|
|
7
|
+
import {
|
|
8
|
+
DogsbayElement,
|
|
9
|
+
ensureDefaultDisplay
|
|
10
|
+
} from "./chunk-MZDGSTI4.js";
|
|
11
|
+
|
|
12
|
+
// src/db-dialog.ts
|
|
13
|
+
import { FocusTrap } from "@dogsbay/primitives/focus-trap";
|
|
14
|
+
import { ScrollLock } from "@dogsbay/primitives/scroll-lock";
|
|
15
|
+
import { DismissController } from "@dogsbay/primitives/dismiss";
|
|
16
|
+
import { markOthersInert } from "@dogsbay/primitives/inert";
|
|
17
|
+
var DbDialog = class extends DogsbayElement {
|
|
18
|
+
content = null;
|
|
19
|
+
backdrop = null;
|
|
20
|
+
trigger = null;
|
|
21
|
+
native = false;
|
|
22
|
+
_open = false;
|
|
23
|
+
openedBy = null;
|
|
24
|
+
focusTrap = null;
|
|
25
|
+
dismiss = null;
|
|
26
|
+
cleanupInert = null;
|
|
27
|
+
get open() {
|
|
28
|
+
return this._open;
|
|
29
|
+
}
|
|
30
|
+
get dismissible() {
|
|
31
|
+
return this.getAttribute("dismissible") !== "false";
|
|
32
|
+
}
|
|
33
|
+
onTriggerClick = (e) => {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
this.toggle(e.currentTarget);
|
|
36
|
+
};
|
|
37
|
+
onHostClick = (e) => {
|
|
38
|
+
const close = e.target.closest("[data-part='close']");
|
|
39
|
+
if (close && close.closest("db-dialog") === this) this.close("close-press");
|
|
40
|
+
};
|
|
41
|
+
onDocumentClick = (e) => {
|
|
42
|
+
const ext = e.target.closest?.("[data-dialog-for]");
|
|
43
|
+
if (!ext || ext === this.trigger) return;
|
|
44
|
+
const target = ext.getAttribute("data-dialog-for");
|
|
45
|
+
if (target && (target === this.id || target === this.content?.id)) {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
this.toggle(ext);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
// Native <dialog>: Escape fires "cancel".
|
|
51
|
+
onCancel = (e) => {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
if (this.dismissible) this.close("escape-key");
|
|
54
|
+
};
|
|
55
|
+
// Native <dialog>: a click on the ::backdrop targets the dialog itself.
|
|
56
|
+
onNativeClick = (e) => {
|
|
57
|
+
if (!this.dismissible || e.target !== this.content || !this.content) return;
|
|
58
|
+
const r = this.content.getBoundingClientRect();
|
|
59
|
+
const inside = e.clientX >= r.left && e.clientX <= r.right && e.clientY >= r.top && e.clientY <= r.bottom;
|
|
60
|
+
if (!inside && (e.clientX !== 0 || e.clientY !== 0)) this.close("outside-press");
|
|
61
|
+
};
|
|
62
|
+
// Native <dialog> closed by the platform (form method="dialog").
|
|
63
|
+
onNativeClose = () => {
|
|
64
|
+
if (this._open) this.finishClose("close-press");
|
|
65
|
+
};
|
|
66
|
+
setup() {
|
|
67
|
+
this.content = ownOne(this, "[data-part='content']");
|
|
68
|
+
if (!this.content) return;
|
|
69
|
+
this.native = typeof HTMLDialogElement !== "undefined" && this.content instanceof HTMLDialogElement && typeof this.content.showModal === "function";
|
|
70
|
+
this.backdrop = ownOne(this, "[data-part='backdrop']");
|
|
71
|
+
this.trigger = resolveAsChild(ownOne(this, "[data-part='trigger']"));
|
|
72
|
+
const content = this.content;
|
|
73
|
+
if (!content.id) content.id = uid("db-dialog");
|
|
74
|
+
if (!this.native) {
|
|
75
|
+
content.setAttribute("role", content.getAttribute("role") || "dialog");
|
|
76
|
+
content.setAttribute("aria-modal", "true");
|
|
77
|
+
content.hidden = !this.hasAttribute("open");
|
|
78
|
+
if (this.backdrop) this.backdrop.hidden = true;
|
|
79
|
+
}
|
|
80
|
+
const title = content.querySelector("[data-part='title']");
|
|
81
|
+
if (title && !content.hasAttribute("aria-labelledby") && !content.hasAttribute("aria-label")) {
|
|
82
|
+
title.id ||= uid("db-dialog-title");
|
|
83
|
+
content.setAttribute("aria-labelledby", title.id);
|
|
84
|
+
}
|
|
85
|
+
const desc = content.querySelector("[data-part='description']");
|
|
86
|
+
if (desc && !content.hasAttribute("aria-describedby")) {
|
|
87
|
+
desc.id ||= uid("db-dialog-desc");
|
|
88
|
+
content.setAttribute("aria-describedby", desc.id);
|
|
89
|
+
}
|
|
90
|
+
for (const t of this.triggers()) this.prepareTrigger(t);
|
|
91
|
+
this.setState("closed");
|
|
92
|
+
if (!this.native) {
|
|
93
|
+
this.focusTrap = new FocusTrap(content);
|
|
94
|
+
this.dismiss = new DismissController(content, {
|
|
95
|
+
onDismiss: (reason) => this.dismissible && this.close(reason)
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
connect() {
|
|
100
|
+
if (!this.content) return;
|
|
101
|
+
this.trigger?.addEventListener("click", this.onTriggerClick);
|
|
102
|
+
this.addEventListener("click", this.onHostClick);
|
|
103
|
+
document.addEventListener("click", this.onDocumentClick);
|
|
104
|
+
if (this.native) {
|
|
105
|
+
this.content.addEventListener("cancel", this.onCancel);
|
|
106
|
+
this.content.addEventListener("click", this.onNativeClick);
|
|
107
|
+
this.content.addEventListener("close", this.onNativeClose);
|
|
108
|
+
}
|
|
109
|
+
queueMicrotask(() => {
|
|
110
|
+
if (!this.isConnected) return;
|
|
111
|
+
for (const t of this.triggers()) if (!t.hasAttribute("aria-controls")) this.prepareTrigger(t);
|
|
112
|
+
if (this.hasAttribute("open") && !this._open) this.show();
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
disconnect() {
|
|
116
|
+
this.trigger?.removeEventListener("click", this.onTriggerClick);
|
|
117
|
+
this.removeEventListener("click", this.onHostClick);
|
|
118
|
+
document.removeEventListener("click", this.onDocumentClick);
|
|
119
|
+
if (this.content && this.native) {
|
|
120
|
+
this.content.removeEventListener("cancel", this.onCancel);
|
|
121
|
+
this.content.removeEventListener("click", this.onNativeClick);
|
|
122
|
+
this.content.removeEventListener("close", this.onNativeClose);
|
|
123
|
+
}
|
|
124
|
+
if (this._open) this.finishClose("api", false);
|
|
125
|
+
}
|
|
126
|
+
/** Internal trigger plus every `[data-dialog-for]` pointing here. */
|
|
127
|
+
triggers() {
|
|
128
|
+
const out = this.trigger ? [this.trigger] : [];
|
|
129
|
+
const ids = [this.id, this.content?.id].filter(Boolean);
|
|
130
|
+
for (const id of ids) document.querySelectorAll(`[data-dialog-for="${CSS.escape(id)}"]`).forEach((el) => out.push(el));
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
prepareTrigger(t) {
|
|
134
|
+
if (!t.hasAttribute("aria-haspopup")) t.setAttribute("aria-haspopup", "dialog");
|
|
135
|
+
t.setAttribute("aria-controls", this.content.id);
|
|
136
|
+
t.setAttribute("aria-expanded", "false");
|
|
137
|
+
}
|
|
138
|
+
setState(state) {
|
|
139
|
+
this.setAttribute("data-state", state);
|
|
140
|
+
this.content?.setAttribute("data-state", state);
|
|
141
|
+
this.backdrop?.setAttribute("data-state", state);
|
|
142
|
+
}
|
|
143
|
+
toggle(opener) {
|
|
144
|
+
if (this._open) this.close("trigger-press");
|
|
145
|
+
else this.show(opener);
|
|
146
|
+
}
|
|
147
|
+
show(opener) {
|
|
148
|
+
const content = this.content;
|
|
149
|
+
if (!content || this._open) return;
|
|
150
|
+
this._open = true;
|
|
151
|
+
this.openedBy = opener ?? document.activeElement ?? this.trigger;
|
|
152
|
+
for (const t of this.triggers()) {
|
|
153
|
+
this.prepareTrigger(t);
|
|
154
|
+
t.setAttribute("aria-expanded", "true");
|
|
155
|
+
}
|
|
156
|
+
ScrollLock.activate();
|
|
157
|
+
if (this.native) {
|
|
158
|
+
const d = content;
|
|
159
|
+
if (!d.open) d.showModal();
|
|
160
|
+
} else {
|
|
161
|
+
content.hidden = false;
|
|
162
|
+
if (this.backdrop) this.backdrop.hidden = false;
|
|
163
|
+
this.cleanupInert = markOthersInert(content);
|
|
164
|
+
this.focusTrap?.activate();
|
|
165
|
+
this.dismiss?.activate();
|
|
166
|
+
}
|
|
167
|
+
this.setState("open");
|
|
168
|
+
this.dispatchEvent(new CustomEvent("db-dialog:open", { bubbles: true }));
|
|
169
|
+
}
|
|
170
|
+
close(reason = "api") {
|
|
171
|
+
if (!this._open) return;
|
|
172
|
+
this.finishClose(reason);
|
|
173
|
+
}
|
|
174
|
+
finishClose(reason, restoreFocus = true) {
|
|
175
|
+
const content = this.content;
|
|
176
|
+
this._open = false;
|
|
177
|
+
this.setState("closed");
|
|
178
|
+
for (const t of this.triggers()) t.setAttribute("aria-expanded", "false");
|
|
179
|
+
ScrollLock.deactivate();
|
|
180
|
+
if (this.native) {
|
|
181
|
+
const d = content;
|
|
182
|
+
if (d.open) d.close();
|
|
183
|
+
} else {
|
|
184
|
+
this.dismiss?.deactivate();
|
|
185
|
+
this.focusTrap?.deactivate();
|
|
186
|
+
this.cleanupInert?.();
|
|
187
|
+
this.cleanupInert = null;
|
|
188
|
+
afterAnimations(content, () => {
|
|
189
|
+
if (this._open) return;
|
|
190
|
+
content.hidden = true;
|
|
191
|
+
if (this.backdrop) this.backdrop.hidden = true;
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
const back = this.openedBy;
|
|
195
|
+
this.openedBy = null;
|
|
196
|
+
if (restoreFocus && back && document.contains(back)) back.focus();
|
|
197
|
+
this.dispatchEvent(new CustomEvent("db-dialog:close", { detail: { reason }, bubbles: true }));
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
ensureDefaultDisplay();
|
|
201
|
+
if (!customElements.get("db-dialog")) {
|
|
202
|
+
customElements.define("db-dialog", DbDialog);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export {
|
|
206
|
+
DbDialog
|
|
207
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DogsbayElement
|
|
3
|
-
|
|
2
|
+
DogsbayElement,
|
|
3
|
+
ensureDefaultDisplay
|
|
4
|
+
} from "./chunk-MZDGSTI4.js";
|
|
4
5
|
|
|
5
6
|
// src/db-link-button.ts
|
|
6
7
|
var DbLinkButton = class extends DogsbayElement {
|
|
@@ -27,6 +28,7 @@ var DbLinkButton = class extends DogsbayElement {
|
|
|
27
28
|
this.appendChild(this.anchor);
|
|
28
29
|
}
|
|
29
30
|
};
|
|
31
|
+
ensureDefaultDisplay();
|
|
30
32
|
if (!customElements.get("db-link-button")) {
|
|
31
33
|
customElements.define("db-link-button", DbLinkButton);
|
|
32
34
|
}
|
|
@@ -34,4 +36,3 @@ if (!customElements.get("db-link-button")) {
|
|
|
34
36
|
export {
|
|
35
37
|
DbLinkButton
|
|
36
38
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-LFXZQ4YV.js.map
|
package/dist/db-accordion.d.ts
CHANGED
package/dist/db-accordion.js
CHANGED
package/dist/db-card.d.ts
CHANGED
package/dist/db-card.js
CHANGED
package/dist/db-code-block.d.ts
CHANGED
package/dist/db-code-block.js
CHANGED
package/dist/db-collapsible.d.ts
CHANGED
package/dist/db-collapsible.js
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { D as DogsbayElement } from './base-D1Rz70fn.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `<db-combobox>` — Editable combobox with a listbox (APG "Editable
|
|
5
|
+
* Combobox With List Autocomplete"). Focus stays in the input; the
|
|
6
|
+
* highlighted option is exposed with aria-activedescendant.
|
|
7
|
+
*
|
|
8
|
+
* Parts (same contract as the Astro Combobox):
|
|
9
|
+
* [data-part="input"] text input, role=combobox
|
|
10
|
+
* [data-part="listbox"] role=listbox
|
|
11
|
+
* [data-part="option"] role=option, data-value, data-disabled
|
|
12
|
+
* [data-part="empty"] shown when a query has no matches (optional)
|
|
13
|
+
*
|
|
14
|
+
* Attributes:
|
|
15
|
+
* filter="contains" (default) the element filters its own options by text
|
|
16
|
+
* filter="none" the page supplies options (search results); the element
|
|
17
|
+
* watches the listbox and manages highlight and ARIA
|
|
18
|
+
* inline the listbox is always shown (e.g. inside a search dialog);
|
|
19
|
+
* aria-expanded tracks whether it has options
|
|
20
|
+
* no-autohighlight do not highlight the first option when the list changes
|
|
21
|
+
*
|
|
22
|
+
* Choosing an option dispatches a cancelable `db-combobox:select`
|
|
23
|
+
* (detail: { value, text, option }). If not cancelled, a link option
|
|
24
|
+
* (`<a href data-part="option">`, the accessible shape for results that
|
|
25
|
+
* navigate: ARIA allows role=option on a link, but not a link inside an
|
|
26
|
+
* option) is followed; otherwise the input takes the option's text and
|
|
27
|
+
* `db-combobox:change` fires. Wrap link options in `<li role="none">`.
|
|
28
|
+
*
|
|
29
|
+
* Other events: db-combobox:update (detail: { count }) when the visible options change.
|
|
30
|
+
*/
|
|
31
|
+
declare class DbCombobox extends DogsbayElement {
|
|
32
|
+
private input;
|
|
33
|
+
private listbox;
|
|
34
|
+
private empty;
|
|
35
|
+
private _open;
|
|
36
|
+
private highlighted;
|
|
37
|
+
private observer;
|
|
38
|
+
private base;
|
|
39
|
+
private optionSeq;
|
|
40
|
+
get open(): boolean;
|
|
41
|
+
private get inline();
|
|
42
|
+
private get filtering();
|
|
43
|
+
/** All options, in order. Read live, so page-supplied results are always current. */
|
|
44
|
+
options(): HTMLElement[];
|
|
45
|
+
private visible;
|
|
46
|
+
protected setup(): void;
|
|
47
|
+
private prepareOptions;
|
|
48
|
+
private onInput;
|
|
49
|
+
private onFocus;
|
|
50
|
+
private onKey;
|
|
51
|
+
private onListClick;
|
|
52
|
+
private onListPointer;
|
|
53
|
+
private onListDown;
|
|
54
|
+
private onDocDown;
|
|
55
|
+
protected connect(): void;
|
|
56
|
+
protected disconnect(): void;
|
|
57
|
+
/** Re-scan options after the page replaced them (filter="none"). */
|
|
58
|
+
refresh(): void;
|
|
59
|
+
private onOptionsChanged;
|
|
60
|
+
private filter;
|
|
61
|
+
private syncExpanded;
|
|
62
|
+
show(): void;
|
|
63
|
+
hide(): void;
|
|
64
|
+
private highlight;
|
|
65
|
+
private clearHighlight;
|
|
66
|
+
/** Returns false when a `db-combobox:select` listener cancelled the choice. */
|
|
67
|
+
private choose;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { DbCombobox };
|
|
@@ -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 };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { D as DogsbayElement } from './base-D1Rz70fn.js';
|
|
2
|
+
|
|
3
|
+
type DialogCloseReason = "escape-key" | "outside-press" | "close-press" | "trigger-press" | "api";
|
|
4
|
+
/**
|
|
5
|
+
* `<db-dialog>` — Modal dialog (WAI-ARIA APG "Dialog (Modal)").
|
|
6
|
+
*
|
|
7
|
+
* Same parts as the Astro Dialog. When `[data-part="content"]` is a native
|
|
8
|
+
* `<dialog>`, it opens with `showModal()`: the browser puts it in the top
|
|
9
|
+
* layer, makes the rest of the page inert and handles Escape. Otherwise the
|
|
10
|
+
* content is a positioned element and the primitives do that work
|
|
11
|
+
* (FocusTrap, markOthersInert, ScrollLock, DismissController). Content is
|
|
12
|
+
* never moved out of the element, so nested elements keep working.
|
|
13
|
+
*
|
|
14
|
+
* Attributes:
|
|
15
|
+
* open — open on connect
|
|
16
|
+
* dismissible="false" — ignore Escape and outside clicks
|
|
17
|
+
*
|
|
18
|
+
* Parts:
|
|
19
|
+
* [data-part="trigger"] — opens (optional; `data-as-child` supported)
|
|
20
|
+
* [data-part="content"] — `<dialog>` (recommended) or any element
|
|
21
|
+
* [data-part="backdrop"] — overlay for non-native content
|
|
22
|
+
* [data-part="title"] — becomes aria-labelledby
|
|
23
|
+
* [data-part="description"] — becomes aria-describedby
|
|
24
|
+
* [data-part="close"] — closes
|
|
25
|
+
*
|
|
26
|
+
* External triggers: any element with `data-dialog-for="<id>"`, where the id
|
|
27
|
+
* is the element's or the content's, opens it from anywhere on the page.
|
|
28
|
+
*
|
|
29
|
+
* Events: db-dialog:open, db-dialog:close (detail: { reason })
|
|
30
|
+
*/
|
|
31
|
+
declare class DbDialog extends DogsbayElement {
|
|
32
|
+
content: HTMLElement | null;
|
|
33
|
+
private backdrop;
|
|
34
|
+
private trigger;
|
|
35
|
+
private native;
|
|
36
|
+
private _open;
|
|
37
|
+
private openedBy;
|
|
38
|
+
private focusTrap;
|
|
39
|
+
private dismiss;
|
|
40
|
+
private cleanupInert;
|
|
41
|
+
get open(): boolean;
|
|
42
|
+
private get dismissible();
|
|
43
|
+
private onTriggerClick;
|
|
44
|
+
private onHostClick;
|
|
45
|
+
private onDocumentClick;
|
|
46
|
+
private onCancel;
|
|
47
|
+
private onNativeClick;
|
|
48
|
+
private onNativeClose;
|
|
49
|
+
protected setup(): void;
|
|
50
|
+
protected connect(): void;
|
|
51
|
+
protected disconnect(): void;
|
|
52
|
+
/** Internal trigger plus every `[data-dialog-for]` pointing here. */
|
|
53
|
+
private triggers;
|
|
54
|
+
private prepareTrigger;
|
|
55
|
+
private setState;
|
|
56
|
+
toggle(opener?: HTMLElement): void;
|
|
57
|
+
show(opener?: HTMLElement): void;
|
|
58
|
+
close(reason?: DialogCloseReason): void;
|
|
59
|
+
private finishClose;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { DbDialog, type DialogCloseReason };
|
package/dist/db-link-button.d.ts
CHANGED
package/dist/db-link-button.js
CHANGED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { D as DogsbayElement } from './base-D1Rz70fn.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* [label, url, children?, noCurrent?]. `noCurrent` (1): never mark this link
|
|
5
|
+
* as the current page even when its URL matches — an alias (a link to a page
|
|
6
|
+
* that lives in another section) or a #section link. The server-rendered
|
|
7
|
+
* tree already leaves those unmarked; lazily built groups must agree.
|
|
8
|
+
*/
|
|
9
|
+
type NavData = [string, string | null, NavData[]?, 1?];
|
|
10
|
+
/**
|
|
11
|
+
* `<db-nav-tree>` — Site navigation tree (APG "Disclosure Navigation").
|
|
12
|
+
*
|
|
13
|
+
* A section that is also a page gets a real link AND a separate toggle
|
|
14
|
+
* button as siblings — never a link inside `<summary>`, which is nested
|
|
15
|
+
* interactive content (axe `nested-interactive`). A section with no page
|
|
16
|
+
* is a single toggle button carrying the label. Every link stays in the
|
|
17
|
+
* normal Tab order; arrow keys are an extra shortcut, not a replacement.
|
|
18
|
+
*
|
|
19
|
+
* Server-rendered markup works without JavaScript: links navigate, and the
|
|
20
|
+
* branch to the current page is rendered open.
|
|
21
|
+
*
|
|
22
|
+
* <db-nav-tree>
|
|
23
|
+
* <ul data-part="list">
|
|
24
|
+
* <li data-part="item" data-state="open">
|
|
25
|
+
* <div data-part="row">
|
|
26
|
+
* <button data-part="toggle" type="button" aria-expanded="true" aria-controls="g1" aria-label="Toggle Guides"></button>
|
|
27
|
+
* <a data-part="link" href="guides/index.html">Guides</a>
|
|
28
|
+
* </div>
|
|
29
|
+
* <ul data-part="group" id="g1">…</ul>
|
|
30
|
+
* </li>
|
|
31
|
+
* <li data-part="item"><div data-part="row"><a data-part="link" href="faq.html" aria-current="page">FAQ</a></div></li>
|
|
32
|
+
* </ul>
|
|
33
|
+
* </db-nav-tree>
|
|
34
|
+
*
|
|
35
|
+
* Lazy sections: a group with `data-lazy` and `data-path="0.3"` is filled
|
|
36
|
+
* from `navData` (or the global named by `data-source`) the first time it
|
|
37
|
+
* opens. URLs in the data are prefixed with the `base` attribute.
|
|
38
|
+
*
|
|
39
|
+
* Attributes:
|
|
40
|
+
* base — prefix for data URLs (e.g. "../../")
|
|
41
|
+
* data-source — name of a window global holding NavData[]
|
|
42
|
+
* toggle-label — accessible name template, default "Toggle {label}"
|
|
43
|
+
* scroll-current — scroll the current page's link into view on connect
|
|
44
|
+
* Built items carry `style="--db-level:N"` (0 at the top) so CSS can indent
|
|
45
|
+
* them; server markup should set the same.
|
|
46
|
+
*
|
|
47
|
+
* toggle-position — "start" (default) or "end": where lazily built rows put
|
|
48
|
+
* the toggle relative to the link. Match the server markup
|
|
49
|
+
* so DOM (and Tab) order follows the visual order.
|
|
50
|
+
*
|
|
51
|
+
* Keyboard (in addition to Tab): ArrowDown/ArrowUp move between visible
|
|
52
|
+
* rows, ArrowRight opens a section or moves into it, ArrowLeft closes it or
|
|
53
|
+
* moves to its parent, Home/End go to the first/last row.
|
|
54
|
+
*
|
|
55
|
+
* Events: db-nav-tree:toggle (detail: { item, open })
|
|
56
|
+
*/
|
|
57
|
+
declare class DbNavTree extends DogsbayElement {
|
|
58
|
+
/** Nav data for lazy sections. Falls back to `window[data-source]`. */
|
|
59
|
+
navData: NavData[] | null;
|
|
60
|
+
private onClick;
|
|
61
|
+
private onKey;
|
|
62
|
+
protected setup(): void;
|
|
63
|
+
protected connect(): void;
|
|
64
|
+
protected disconnect(): void;
|
|
65
|
+
private prepareItem;
|
|
66
|
+
private groupOf;
|
|
67
|
+
private toggleOf;
|
|
68
|
+
/** The row's main focus target: its link, or its toggle for a label-only section. */
|
|
69
|
+
private primary;
|
|
70
|
+
private visibleRows;
|
|
71
|
+
isOpen(item: HTMLElement): boolean;
|
|
72
|
+
toggle(item: HTMLElement): void;
|
|
73
|
+
setOpen(item: HTMLElement, open: boolean): void;
|
|
74
|
+
private apply;
|
|
75
|
+
/** Expand every section on the path to the current page. */
|
|
76
|
+
revealCurrent(): void;
|
|
77
|
+
private data;
|
|
78
|
+
/** Fill a lazy group from nav data. */
|
|
79
|
+
private fill;
|
|
80
|
+
private build;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { DbNavTree, type NavData };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { D as DogsbayElement } from './base-D1Rz70fn.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `<db-popover>` — Non-modal floating panel (APG "Dialog", non-modal).
|
|
5
|
+
*
|
|
6
|
+
* Same parts as the Astro Popover. The content opens in the browser's top
|
|
7
|
+
* layer (Popover API) where available, so no ancestor's `overflow` clips it
|
|
8
|
+
* and it needs no portal, and floating-ui positions it next to the trigger.
|
|
9
|
+
*
|
|
10
|
+
* Attributes:
|
|
11
|
+
* placement — "bottom" (default), "top-start", … (or data-side/data-align on the content)
|
|
12
|
+
* offset — gap in px (default 8)
|
|
13
|
+
* no-autofocus — keep focus on the trigger when opening
|
|
14
|
+
*
|
|
15
|
+
* Parts: [data-part="trigger"], [data-part="content"], [data-part="close"]
|
|
16
|
+
*
|
|
17
|
+
* Focus: opening moves focus to the first focusable element in the content.
|
|
18
|
+
* Escape and the close part return focus to the trigger; an outside click
|
|
19
|
+
* leaves focus where the user clicked.
|
|
20
|
+
*
|
|
21
|
+
* Events: db-popover:open, db-popover:close (detail: { reason })
|
|
22
|
+
*/
|
|
23
|
+
declare class DbPopover extends DogsbayElement {
|
|
24
|
+
private trigger;
|
|
25
|
+
private content;
|
|
26
|
+
private dismiss;
|
|
27
|
+
private cleanupFloating;
|
|
28
|
+
private _open;
|
|
29
|
+
get open(): boolean;
|
|
30
|
+
private onTriggerClick;
|
|
31
|
+
private onContentClick;
|
|
32
|
+
protected setup(): void;
|
|
33
|
+
protected connect(): void;
|
|
34
|
+
protected disconnect(): void;
|
|
35
|
+
private setState;
|
|
36
|
+
private placement;
|
|
37
|
+
toggle(): void;
|
|
38
|
+
show(): void;
|
|
39
|
+
close(reason?: string): void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { DbPopover };
|