@monster-orange/den-ui 0.7.0 → 0.7.4
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/README.md +125 -12
- package/bin/den-ui-parity.mjs +2 -0
- package/inventory/nav-inventory.d.ts +44 -1
- package/inventory/nav-inventory.js +295 -3
- package/inventory/reference/den-chromium-1280.json +338 -110
- package/inventory/reference/den-chromium-390.json +271 -39
- package/inventory/reference/den-webkit-1280.json +338 -110
- package/inventory/reference/den-webkit-390.json +271 -39
- package/package.json +1 -1
- package/src/busy.d.ts +1 -0
- package/src/busy.js +23 -14
- package/src/kit.d.ts +2 -0
- package/src/kit.js +2 -0
- package/src/shell-client.js +48 -0
- package/src/shell-html.d.ts +93 -10
- package/src/shell-html.js +292 -41
- package/src/shell.css +310 -16
- package/src/strings.js +44 -0
- package/src/version.js +5 -1
package/src/shell-client.js
CHANGED
|
@@ -116,6 +116,47 @@ export function hydrateShell(root, opts = {}) {
|
|
|
116
116
|
const menu = root.querySelector(".den-menu-btn");
|
|
117
117
|
let scrim = null;
|
|
118
118
|
|
|
119
|
+
// Issue 303: a host chip that gives way keeps its dot and "…"; its
|
|
120
|
+
// whole words are its title and name, so it stays readable and
|
|
121
|
+
// reachable. A name the host set itself is kept.
|
|
122
|
+
const end = root.querySelector(".den-top .den-end");
|
|
123
|
+
function nameHostChips() {
|
|
124
|
+
if (!end) return;
|
|
125
|
+
for (const c of end.children) {
|
|
126
|
+
const words = (c.textContent || "").replace(/\s+/g, " ").trim();
|
|
127
|
+
const set = c.getAttribute("data-den-named");
|
|
128
|
+
if (set != null) {
|
|
129
|
+
// The host changed what the kit set: its own words win.
|
|
130
|
+
if (
|
|
131
|
+
c.getAttribute("title") !== set ||
|
|
132
|
+
c.getAttribute("aria-label") !== set
|
|
133
|
+
) {
|
|
134
|
+
c.removeAttribute("data-den-named");
|
|
135
|
+
// …and what is left of the kit's words goes.
|
|
136
|
+
if (c.getAttribute("title") === set) c.removeAttribute("title");
|
|
137
|
+
if (c.getAttribute("aria-label") === set)
|
|
138
|
+
c.removeAttribute("aria-label");
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
} else if (c.hasAttribute("aria-label") || c.hasAttribute("title"))
|
|
142
|
+
continue;
|
|
143
|
+
if (!words || set === words) continue;
|
|
144
|
+
// (Only on a change: a write queues a mutation, which runs this.)
|
|
145
|
+
c.setAttribute("data-den-named", words);
|
|
146
|
+
c.setAttribute("aria-label", words);
|
|
147
|
+
c.setAttribute("title", words);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
nameHostChips();
|
|
151
|
+
if (end && typeof MutationObserver === "function")
|
|
152
|
+
new MutationObserver(nameHostChips).observe(end, {
|
|
153
|
+
childList: true,
|
|
154
|
+
subtree: true,
|
|
155
|
+
characterData: true,
|
|
156
|
+
attributes: true,
|
|
157
|
+
attributeFilter: ["title", "aria-label"],
|
|
158
|
+
});
|
|
159
|
+
|
|
119
160
|
function rove() {
|
|
120
161
|
if (!nav) return;
|
|
121
162
|
const links = all(nav, ".den-ni");
|
|
@@ -188,7 +229,13 @@ export function hydrateShell(root, opts = {}) {
|
|
|
188
229
|
else el.removeAttribute("inert");
|
|
189
230
|
}
|
|
190
231
|
}
|
|
232
|
+
// The drawer's slide is armed on the person's first open or close only
|
|
233
|
+
// (shell.css: body.den-rail-moved), so a load never slides it (issue 311).
|
|
234
|
+
function armSlide() {
|
|
235
|
+
document.body.classList.add("den-rail-moved");
|
|
236
|
+
}
|
|
191
237
|
function openDrawer() {
|
|
238
|
+
armSlide();
|
|
192
239
|
document.body.classList.add("den-rail-open");
|
|
193
240
|
if (menu) menu.setAttribute("aria-expanded", "true");
|
|
194
241
|
railBox.setAttribute("role", "dialog");
|
|
@@ -209,6 +256,7 @@ export function hydrateShell(root, opts = {}) {
|
|
|
209
256
|
}
|
|
210
257
|
function closeDrawer(refocus) {
|
|
211
258
|
if (!drawerOpen()) return;
|
|
259
|
+
armSlide();
|
|
212
260
|
document.body.classList.remove("den-rail-open");
|
|
213
261
|
if (menu) menu.setAttribute("aria-expanded", "false");
|
|
214
262
|
railBox.removeAttribute("role");
|
package/src/shell-html.d.ts
CHANGED
|
@@ -17,15 +17,44 @@ export interface Product {
|
|
|
17
17
|
*/
|
|
18
18
|
mark?: Mark | null;
|
|
19
19
|
}
|
|
20
|
+
/** 0.7.3: the fixed kinds a rail entry's tag may name. */
|
|
21
|
+
export type NavKindId = "project" | "den" | "service" | "hub";
|
|
22
|
+
/**
|
|
23
|
+
* 0.7.3: a rail entry's kind: a fixed one (any case), or an artifact pin's
|
|
24
|
+
* own kind word (the host's, in its language). Never a machine's name.
|
|
25
|
+
*/
|
|
26
|
+
export type NavKind = NavKindId | Uppercase<NavKindId> | { artifact: string };
|
|
27
|
+
/**
|
|
28
|
+
* 0.7.4: why a rail entry is off (greyed; the kit's words say why):
|
|
29
|
+
* not connected yet, its sign-in no longer accepted, not allowed (an
|
|
30
|
+
* admin decides), can't be reached, or its settings have a problem.
|
|
31
|
+
*/
|
|
32
|
+
export type NavOff =
|
|
33
|
+
| "connect"
|
|
34
|
+
| "reconnect"
|
|
35
|
+
| "forbidden"
|
|
36
|
+
| "unreachable"
|
|
37
|
+
| "config";
|
|
38
|
+
/** 0.7.3: what a rail badge counts (the kit's words for it). */
|
|
39
|
+
export type BadgeWhat = "open" | "waiting" | "down" | "running";
|
|
40
|
+
/** 0.7.3: a project's initial, in a disc in place of the icon. */
|
|
41
|
+
export interface NavInitial {
|
|
42
|
+
initial: string;
|
|
43
|
+
}
|
|
20
44
|
export interface NavItem {
|
|
21
45
|
id: string;
|
|
22
46
|
label: string;
|
|
23
47
|
href: string;
|
|
24
48
|
group?: string;
|
|
25
|
-
icon
|
|
49
|
+
/** An icon's name (icons.js), or (0.7.3) a project's initial disc. */
|
|
50
|
+
icon?: string | NavInitial;
|
|
26
51
|
tip?: string;
|
|
27
52
|
current?: boolean;
|
|
28
|
-
|
|
53
|
+
/**
|
|
54
|
+
* A count. `what` (0.7.3): what it counts; the kit words it with the
|
|
55
|
+
* name ("North · Den, 3 waiting"). Hosts pass data, never the words.
|
|
56
|
+
*/
|
|
57
|
+
badge?: { n: number | string; bad?: boolean; what?: BadgeWhat } | null;
|
|
29
58
|
/** HTML in place of the icon (a status dot). */
|
|
30
59
|
lead?: string;
|
|
31
60
|
mono?: boolean;
|
|
@@ -35,6 +64,18 @@ export interface NavItem {
|
|
|
35
64
|
pin?: string | null;
|
|
36
65
|
/** HTML after the link inside the pin row. */
|
|
37
66
|
after?: string;
|
|
67
|
+
/**
|
|
68
|
+
* 0.7.3: a small uppercase tag at the row's end (pins and links into
|
|
69
|
+
* another product); the tooltip and name are always the kit's,
|
|
70
|
+
* "<label> · <Kind>" (a host's tip, title or aria-label is not used).
|
|
71
|
+
*/
|
|
72
|
+
kind?: NavKind | null;
|
|
73
|
+
/**
|
|
74
|
+
* 0.7.4: the entry is off: greyed (.den-off), and its tooltip and name
|
|
75
|
+
* say why in the kit's words ("Acme Co · Hub, reconnect in Settings").
|
|
76
|
+
* Any other value is dropped.
|
|
77
|
+
*/
|
|
78
|
+
off?: NavOff | null;
|
|
38
79
|
}
|
|
39
80
|
export interface NavGroup {
|
|
40
81
|
id: string;
|
|
@@ -70,7 +111,26 @@ export interface ShellModel extends RailModel {
|
|
|
70
111
|
/** false: no Report button (reports off). */
|
|
71
112
|
report?: boolean;
|
|
72
113
|
}
|
|
73
|
-
export declare function navItemHtml(
|
|
114
|
+
export declare function navItemHtml(
|
|
115
|
+
n: NavItem,
|
|
116
|
+
navRole?: string,
|
|
117
|
+
lang?: string,
|
|
118
|
+
): string;
|
|
119
|
+
/** 0.7.3: attributes that carry a host's words (flagged in an entry of the rail). */
|
|
120
|
+
export declare const HOST_TEXT_ATTRS: readonly string[];
|
|
121
|
+
/** 0.7.3: what a badge may count. */
|
|
122
|
+
export declare const BADGE_WHATS: readonly BadgeWhat[];
|
|
123
|
+
/** 0.7.3: the fixed kinds. */
|
|
124
|
+
export declare const NAV_KINDS: readonly NavKindId[];
|
|
125
|
+
/** 0.7.4: the reasons an entry may be off. */
|
|
126
|
+
export declare const NAV_OFFS: readonly NavOff[];
|
|
127
|
+
/** 0.7.4: an entry's off reason, from its data (any case), or null. */
|
|
128
|
+
export declare function navOff(off: unknown): NavOff | null;
|
|
129
|
+
/** 0.7.3: a kind's id ("artifact" for an artifact's) and its word. */
|
|
130
|
+
export declare function navKind(
|
|
131
|
+
kind: NavKind | null | undefined,
|
|
132
|
+
lang?: string,
|
|
133
|
+
): { id: NavKindId | "artifact"; word: string } | null;
|
|
74
134
|
export declare function railGroupHtml(
|
|
75
135
|
g: NavGroup,
|
|
76
136
|
body: string,
|
|
@@ -137,10 +197,8 @@ export interface ScopeOptions {
|
|
|
137
197
|
/** The host's HTML at the group's end. */
|
|
138
198
|
after?: string;
|
|
139
199
|
}
|
|
200
|
+
/** The search's placeholder and name are the kit's words ("Search…"). */
|
|
140
201
|
export interface SearchOptions {
|
|
141
|
-
placeholder?: string;
|
|
142
|
-
/** Its name (default the placeholder). */
|
|
143
|
-
label?: string;
|
|
144
202
|
id?: string;
|
|
145
203
|
/** false: no ⌘K inside, and no aria-keyshortcuts. */
|
|
146
204
|
shortcut?: boolean;
|
|
@@ -180,7 +238,18 @@ export interface BellPanelOptions {
|
|
|
180
238
|
lang?: string;
|
|
181
239
|
}
|
|
182
240
|
export interface Account {
|
|
183
|
-
|
|
241
|
+
/** 0.7.1: who is signed in, as data. The kit draws the name, then @login. */
|
|
242
|
+
name?: string;
|
|
243
|
+
/** The login, without "@" (the kit adds it). */
|
|
244
|
+
login?: string;
|
|
245
|
+
/** Shown in the account menu's header only, never in the rail's entry. */
|
|
246
|
+
role?: string;
|
|
247
|
+
/** No identity known: the kit's word for this computer ("Local"). */
|
|
248
|
+
local?: boolean;
|
|
249
|
+
lang?: string;
|
|
250
|
+
/** @deprecated 0.7.1: use name (flagged by the nav inventory). */
|
|
251
|
+
label?: string;
|
|
252
|
+
/** @deprecated 0.7.1: use login (flagged by the nav inventory). */
|
|
184
253
|
detail?: string;
|
|
185
254
|
/**
|
|
186
255
|
* A link; else `menu: true`, a button opening the account menu
|
|
@@ -209,8 +278,20 @@ export declare function searchHtml(o?: SearchOptions): string;
|
|
|
209
278
|
export declare function bellCount(n: number | null | undefined): string;
|
|
210
279
|
export declare function bellButtonHtml(o?: BellButtonOptions): string;
|
|
211
280
|
export declare function bellPanelHtml(o?: BellPanelOptions): string;
|
|
212
|
-
/** The rail's account entry;
|
|
281
|
+
/** The rail's account entry; nobody known, "". */
|
|
213
282
|
export declare function accountHtml(a: Account | null | undefined): string;
|
|
283
|
+
/** Who is signed in, as the kit draws it: its lines and its shape. */
|
|
284
|
+
export declare function accountWho(
|
|
285
|
+
a: Account | null | undefined,
|
|
286
|
+
o?: { menu?: boolean },
|
|
287
|
+
): {
|
|
288
|
+
lines: string[];
|
|
289
|
+
/** The role: the menu's header only. */
|
|
290
|
+
role: string;
|
|
291
|
+
shape: string;
|
|
292
|
+
legacy: boolean;
|
|
293
|
+
full: string;
|
|
294
|
+
} | null;
|
|
214
295
|
/** An account menu entry: a link, a button (onPick "item"), or a form post. */
|
|
215
296
|
export type AccountMenuItem =
|
|
216
297
|
| { label: string; href: string }
|
|
@@ -226,9 +307,11 @@ export type AccountMenuItem =
|
|
|
226
307
|
};
|
|
227
308
|
};
|
|
228
309
|
export interface AccountMenu {
|
|
229
|
-
/** Who is signed in. */
|
|
310
|
+
/** Who is signed in, as data (0.7.1), drawn as the entry is. */
|
|
230
311
|
name?: string;
|
|
231
|
-
|
|
312
|
+
login?: string;
|
|
313
|
+
role?: string;
|
|
314
|
+
/** @deprecated 0.7.1: use login (flagged by the nav inventory). */
|
|
232
315
|
detail?: string;
|
|
233
316
|
items?: AccountMenuItem[];
|
|
234
317
|
lang?: string;
|