@monster-orange/den-ui 0.7.1 → 0.7.5
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 +93 -0
- package/inventory/nav-inventory.d.ts +8 -2
- package/inventory/nav-inventory.js +68 -7
- package/package.json +9 -1
- package/src/busy.d.ts +1 -0
- package/src/busy.js +23 -14
- package/src/markdown-editor.css +230 -0
- package/src/markdown-editor.d.ts +187 -0
- package/src/markdown-editor.js +1122 -0
- package/src/report.d.ts +7 -1
- package/src/report.js +32 -2
- package/src/shell-client.js +7 -0
- package/src/shell-html.d.ts +68 -3
- package/src/shell-html.js +206 -12
- package/src/shell.css +49 -3
- package/src/strings.js +99 -0
- package/src/whatsnew.js +13 -2
package/src/report.d.ts
CHANGED
|
@@ -20,7 +20,13 @@ export interface ReportAdapter {
|
|
|
20
20
|
},
|
|
21
21
|
) => Promise<{ number: number; url?: string } | { error: string }>;
|
|
22
22
|
info?: () => Promise<{
|
|
23
|
-
repos?: {
|
|
23
|
+
repos?: {
|
|
24
|
+
repo: string;
|
|
25
|
+
/** Who can see it; missing or anything else reads as "public". */
|
|
26
|
+
visibility?: "public" | "private" | "internal";
|
|
27
|
+
/** Who can see it, as words (shown after a private or internal pill). */
|
|
28
|
+
audience?: string;
|
|
29
|
+
}[];
|
|
24
30
|
maxPerHour?: number;
|
|
25
31
|
captureSeconds?: number;
|
|
26
32
|
}>;
|
package/src/report.js
CHANGED
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
* with the link. With no way to send, the form offers
|
|
14
14
|
* Copy report only.
|
|
15
15
|
* info() → { repos: [{ repo }], maxPerHour, captureSeconds }
|
|
16
|
+
* each repo may say its visibility ("public" | "private" |
|
|
17
|
+
* "internal"; missing or anything else reads as public)
|
|
18
|
+
* and an audience (who can see it, plain text)
|
|
16
19
|
* diagnostics() → { sections: { name: text } } shown on Include
|
|
17
20
|
* preview(form, headers) → { status, data: { title, body } }
|
|
18
21
|
* the text the product will post (its redactor's); else
|
|
@@ -294,6 +297,32 @@ export async function openReport(opts = {}) {
|
|
|
294
297
|
function allSections() {
|
|
295
298
|
return { ...st.diag, ...st.client };
|
|
296
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* Who can see the selected repo (issue 415): public unless the host says
|
|
302
|
+
* private or internal, with the host's audience words then.
|
|
303
|
+
*/
|
|
304
|
+
function vis(repos) {
|
|
305
|
+
const r = repos.find((x) => x.repo === st.repo) || {};
|
|
306
|
+
const v =
|
|
307
|
+
r.visibility === "private" || r.visibility === "internal"
|
|
308
|
+
? r.visibility
|
|
309
|
+
: "public";
|
|
310
|
+
const who = v === "public" ? "" : String(r.audience || "").trim();
|
|
311
|
+
return { v, who };
|
|
312
|
+
}
|
|
313
|
+
/** The pill after the destination, then the audience when not public. */
|
|
314
|
+
function visPill(repos) {
|
|
315
|
+
const { v, who } = vis(repos);
|
|
316
|
+
const key = { public: "pub", private: "priv", internal: "int" }[v];
|
|
317
|
+
return `<span class="fb-pill" data-vis="${v}">${esc(t(`kit.report.${key}`))}</span>${who ? `<span class="fb-fine">${esc(who)}</span>` : ""}`;
|
|
318
|
+
}
|
|
319
|
+
/** Above Send: the public warning, or a quiet line for a private repo. */
|
|
320
|
+
function visNote(repos) {
|
|
321
|
+
const { v, who } = vis(repos);
|
|
322
|
+
if (v === "public")
|
|
323
|
+
return `<div class="fb-warn" role="note"><b>${esc(t("kit.report.pub"))}.</b> ${esc(t("kit.report.pubW"))}</div>`;
|
|
324
|
+
return `<p class="fb-fine" role="note" data-vis-note>${esc(who ? t("kit.report.privW", { who }) : t("kit.report.privN"))}</p>`;
|
|
325
|
+
}
|
|
297
326
|
/** Whether a screenshot goes with the report. */
|
|
298
327
|
function shotOn() {
|
|
299
328
|
return !!st.shot && !st.noShot;
|
|
@@ -447,7 +476,7 @@ ${
|
|
|
447
476
|
)
|
|
448
477
|
.join("")}</select>`
|
|
449
478
|
: `<b>${esc(st.repo)}</b>`
|
|
450
|
-
}
|
|
479
|
+
}${visPill(repos)}</div>`
|
|
451
480
|
: ""
|
|
452
481
|
}
|
|
453
482
|
<pre data-preview>${esc(pv ? `${pv.title}\n\n${pv.body}` : "…")}</pre>${
|
|
@@ -455,7 +484,7 @@ ${
|
|
|
455
484
|
? `<div class="fb-h">${esc(t("kit.report.revShot", { n: st.masks.length }))}</div><div class="fb-shot"><img data-shot-review alt="${esc(t("kit.report.revShot", { n: st.masks.length }))}" src="${maskedShot().toDataURL("image/png")}"></div>`
|
|
456
485
|
: ""
|
|
457
486
|
}
|
|
458
|
-
${sends() ?
|
|
487
|
+
${sends() ? visNote(repos) : ""}${err}${st.copied ? `<p class="fb-fine" role="status">${esc(t(st.copied === "ok" ? "kit.report.copied" : "kit.report.copyFailed"))}</p>` : ""}
|
|
459
488
|
<div class="fb-btns">${sends() ? btn("send", t("kit.report.send"), true) : btn("copy", t("kit.report.copy"), true)}${laterBtn(t("kit.report.later"))}${btn("back-include", t("kit.report.back"))}</div>`;
|
|
460
489
|
} else if (st.step === "signin") {
|
|
461
490
|
label = t("kit.report.siH");
|
|
@@ -782,6 +811,7 @@ ${st.link ? `<p class="fb-fine">${esc(t("kit.report.siAlt"))} ${linkBtn(st.link,
|
|
|
782
811
|
}
|
|
783
812
|
if (f === "repo") {
|
|
784
813
|
st.repo = el.value;
|
|
814
|
+
render('[data-f="repo"]');
|
|
785
815
|
void preview();
|
|
786
816
|
}
|
|
787
817
|
});
|
package/src/shell-client.js
CHANGED
|
@@ -229,7 +229,13 @@ export function hydrateShell(root, opts = {}) {
|
|
|
229
229
|
else el.removeAttribute("inert");
|
|
230
230
|
}
|
|
231
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
|
+
}
|
|
232
237
|
function openDrawer() {
|
|
238
|
+
armSlide();
|
|
233
239
|
document.body.classList.add("den-rail-open");
|
|
234
240
|
if (menu) menu.setAttribute("aria-expanded", "true");
|
|
235
241
|
railBox.setAttribute("role", "dialog");
|
|
@@ -250,6 +256,7 @@ export function hydrateShell(root, opts = {}) {
|
|
|
250
256
|
}
|
|
251
257
|
function closeDrawer(refocus) {
|
|
252
258
|
if (!drawerOpen()) return;
|
|
259
|
+
armSlide();
|
|
253
260
|
document.body.classList.remove("den-rail-open");
|
|
254
261
|
if (menu) menu.setAttribute("aria-expanded", "false");
|
|
255
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,
|
|
@@ -171,6 +231,11 @@ export interface BellPanelOptions {
|
|
|
171
231
|
items?: BellItem[];
|
|
172
232
|
/** The host's own HTML in place of rows. */
|
|
173
233
|
body?: string | null;
|
|
234
|
+
/**
|
|
235
|
+
* Issue 101: the rows of the panel's two sections, in place of rows:
|
|
236
|
+
* the kit heads them "Needs you" (always first) and "Earlier".
|
|
237
|
+
*/
|
|
238
|
+
sections?: { needs: string; earlier?: string };
|
|
174
239
|
/** The empty state: its words, and HTML under them. */
|
|
175
240
|
empty?: { text?: string; more?: string };
|
|
176
241
|
after?: string;
|
package/src/shell-html.js
CHANGED
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
* { text?, svg?, label } the mark beside it (text escaped;
|
|
18
18
|
* svg the product's own markup; label its name)
|
|
19
19
|
* nav [{ id, label, href, group, icon?, tip?, current?, badge?,
|
|
20
|
-
* lead?, mono?, cls?, attrs?, pin?, after? }] rail
|
|
20
|
+
* lead?, mono?, cls?, attrs?, pin?, after?, kind?, off? }] rail
|
|
21
|
+
* entries
|
|
21
22
|
* groups [{ id, label, from? }] in rail order; a group with no
|
|
22
23
|
* entry is left out
|
|
23
24
|
* foot entries under the rail's spacer (Settings, say), then the
|
|
@@ -34,11 +35,18 @@
|
|
|
34
35
|
* collapsed the rail drawn collapsed (the toggle says Expand)
|
|
35
36
|
* report false: no Report button (reports off)
|
|
36
37
|
*
|
|
37
|
-
* An entry: `badge` { n, bad?,
|
|
38
|
+
* An entry: `badge` { n, bad?, what? } (what it counts: "open",
|
|
39
|
+
* "waiting", "down", "running", read with the name in the kit's words);
|
|
38
40
|
* `lead` HTML in place of the icon (a status dot); `attrs` more
|
|
39
41
|
* attributes { name: value } (escaped); `cls` more classes; `pin` the
|
|
40
42
|
* pinned id (the row is a pin row: Delete unpins it); `after` HTML after
|
|
41
|
-
* the link inside the pin row (a Visit link).
|
|
43
|
+
* the link inside the pin row (a Visit link); `kind` (0.7.3) "project",
|
|
44
|
+
* "den", "service", "hub" or { artifact: word }: a small uppercase tag at
|
|
45
|
+
* the row's end; its tooltip and name are the kit's ("North · Project");
|
|
46
|
+
* `off` (0.7.4) "connect", "reconnect", "forbidden", "unreachable" or
|
|
47
|
+
* "config": the entry is greyed and the kit says why ("Acme Co · Hub,
|
|
48
|
+
* reconnect in Settings"); `icon`
|
|
49
|
+
* { initial } a project's initial in a disc in place of the icon.
|
|
42
50
|
*
|
|
43
51
|
* 0.7.0, for the slots: scopeHtml (the scope crumbs), searchHtml (the
|
|
44
52
|
* search field with ⌘K inside), bellButtonHtml and bellPanelHtml (the
|
|
@@ -61,14 +69,128 @@ function attrs(o) {
|
|
|
61
69
|
return s;
|
|
62
70
|
}
|
|
63
71
|
|
|
72
|
+
/** The fixed kinds a rail entry may name (issue 307). */
|
|
73
|
+
export const NAV_KINDS = ["project", "den", "service", "hub"];
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A rail entry's kind (issue 307), from its data: one of NAV_KINDS (any
|
|
77
|
+
* case), or { artifact: "<word>" }, an artifact pin's own kind word (the
|
|
78
|
+
* host's, already in its language). Anything else is no kind: the tag
|
|
79
|
+
* never names a machine. → { id, word } or null.
|
|
80
|
+
*/
|
|
81
|
+
export function navKind(kind, lang) {
|
|
82
|
+
if (kind == null) return null;
|
|
83
|
+
if (typeof kind === "string") {
|
|
84
|
+
const id = kind.trim().toLowerCase();
|
|
85
|
+
return NAV_KINDS.includes(id)
|
|
86
|
+
? { id, word: kitT(lang, "kit.kind." + id) }
|
|
87
|
+
: null;
|
|
88
|
+
}
|
|
89
|
+
if (typeof kind === "object" && kind.artifact != null) {
|
|
90
|
+
const word = String(kind.artifact).trim();
|
|
91
|
+
return word ? { id: "artifact", word } : null;
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Attributes that carry a host's words, not data: never in an entry of the rail
|
|
98
|
+
* (issue 307). data-* attributes are data and stay allowed.
|
|
99
|
+
*/
|
|
100
|
+
export const HOST_TEXT_ATTRS = [
|
|
101
|
+
"title",
|
|
102
|
+
"aria-label",
|
|
103
|
+
"aria-labelledby",
|
|
104
|
+
"aria-description",
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
/** What a badge counts (issue 307): the kit words it. */
|
|
108
|
+
export const BADGE_WHATS = ["open", "waiting", "down", "running"];
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Why a rail entry is off (issue 326): the kit greys it (.den-off) and
|
|
112
|
+
* words why. "connect" (not connected yet), "reconnect" (its sign-in is
|
|
113
|
+
* no longer accepted), "forbidden" (not allowed; an admin decides),
|
|
114
|
+
* "unreachable" (can't be reached right now), "config" (its settings have
|
|
115
|
+
* a problem). Anything else is dropped.
|
|
116
|
+
*/
|
|
117
|
+
export const NAV_OFFS = [
|
|
118
|
+
"connect",
|
|
119
|
+
"reconnect",
|
|
120
|
+
"forbidden",
|
|
121
|
+
"unreachable",
|
|
122
|
+
"config",
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
/** An entry's off reason, from its data, or null. */
|
|
126
|
+
export function navOff(off) {
|
|
127
|
+
const id = typeof off === "string" ? off.trim().toLowerCase() : "";
|
|
128
|
+
return NAV_OFFS.includes(id) ? id : null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* A badge's words, from its data: "3 waiting". Without a `what` (a plain
|
|
133
|
+
* total) the kit reads the bare number, so "Hub Docs, 4" still says the
|
|
134
|
+
* count the visible badge (aria-hidden) shows. Nothing to count: none.
|
|
135
|
+
*/
|
|
136
|
+
function badgeWords(b, lang) {
|
|
137
|
+
if (!b || b.n == null || b.n === "") return "";
|
|
138
|
+
const n = typeof b.n === "number" ? b.n : String(b.n);
|
|
139
|
+
if (BADGE_WHATS.includes(b.what))
|
|
140
|
+
return kitT(lang, "kit.badge." + b.what, { n });
|
|
141
|
+
if (typeof n !== "number") return n;
|
|
142
|
+
try {
|
|
143
|
+
return new Intl.NumberFormat(lang || undefined).format(n);
|
|
144
|
+
} catch {
|
|
145
|
+
return String(n);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** The icon, or (issue 307) a project's initial in a disc: { initial }. */
|
|
150
|
+
function leadIcon(ic) {
|
|
151
|
+
if (ic && typeof ic === "object") {
|
|
152
|
+
const ch = Array.from(String(ic.initial ?? "").trim())[0] || "";
|
|
153
|
+
return (
|
|
154
|
+
'<span class="den-ini" aria-hidden="true">' +
|
|
155
|
+
esc(ch.toLocaleUpperCase()) +
|
|
156
|
+
"</span>"
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
return icon(ic);
|
|
160
|
+
}
|
|
161
|
+
|
|
64
162
|
/**
|
|
65
163
|
* One rail entry (a link, .den-ni). `navRole`: the data-nav-role the nav
|
|
66
164
|
* inventory reads ("page" for a rail group's entries: host content).
|
|
165
|
+
* `lang`: the kit's words (the kind tag's).
|
|
166
|
+
*
|
|
167
|
+
* `kind` (issue 307): a small uppercase tag at the row's end, in the scope
|
|
168
|
+
* labels' look (.den-k), for pins and links into another product. The
|
|
169
|
+
* tooltip and the name are always the kit's: "<label> · <Kind>" (and a
|
|
170
|
+
* badge's label after a comma), so a collapsed rail still says it. A
|
|
171
|
+
* host's tip, title or aria-label on such an entry is not used: hosts pass
|
|
172
|
+
* data, the kit owns the words.
|
|
173
|
+
*
|
|
174
|
+
* `badge.what` ("open", "waiting", "down", "running"): what the badge
|
|
175
|
+
* counts; the kit words it ("North · Den, 3 waiting"). Without one, the
|
|
176
|
+
* bare number reads ("Hub Docs, 4"). A label that is
|
|
177
|
+
* its kind word reads once ("Hub", not "Hub · Hub"). A pin row gets
|
|
178
|
+
* aria-keyshortcuts="Delete" from the kit.
|
|
179
|
+
*
|
|
180
|
+
* `off` (issue 326, NAV_OFFS): the entry is greyed (.den-off) and its
|
|
181
|
+
* tooltip and name say why in the kit's words ("Acme Co · Hub, reconnect
|
|
182
|
+
* in Settings"); an entry without a kind reads "<label>, <why>". An `off`
|
|
183
|
+
* the kit doesn't know is dropped.
|
|
184
|
+
*
|
|
185
|
+
* Host text on any entry (HOST_TEXT_ATTRS in `attrs`, a badge's `label`)
|
|
186
|
+
* is stamped data-nav-host-text, and the nav inventory fails on it.
|
|
67
187
|
*/
|
|
68
|
-
export function navItemHtml(n, navRole) {
|
|
188
|
+
export function navItemHtml(n, navRole, lang) {
|
|
69
189
|
const role =
|
|
70
190
|
typeof navRole === "string" ? ' data-nav-role="' + esc(navRole) + '"' : "";
|
|
71
191
|
const b = n.badge || null;
|
|
192
|
+
const kind = navKind(n.kind, lang);
|
|
193
|
+
const off = navOff(n.off);
|
|
72
194
|
const extra = b
|
|
73
195
|
? '<span class="den-bdg' +
|
|
74
196
|
(b.bad ? " bad" : "") +
|
|
@@ -76,12 +198,42 @@ export function navItemHtml(n, navRole) {
|
|
|
76
198
|
esc(b.n) +
|
|
77
199
|
"</span>"
|
|
78
200
|
: "";
|
|
201
|
+
const tag = kind
|
|
202
|
+
? '<span class="den-k den-ni-kind" data-nav-role="kind" aria-hidden="true">' +
|
|
203
|
+
esc(kind.word) +
|
|
204
|
+
"</span>"
|
|
205
|
+
: "";
|
|
79
206
|
const more = { ...(n.attrs || {}) };
|
|
80
|
-
|
|
81
|
-
|
|
207
|
+
// Host text: words a host put on the entry itself. Never used on an
|
|
208
|
+
// entry with a kind; stamped for the nav inventory, which fails on it.
|
|
209
|
+
const hostText = HOST_TEXT_ATTRS.filter((k) => more[k] != null);
|
|
210
|
+
if (b && b.label != null) hostText.push("badge.label");
|
|
211
|
+
// A label that is its kind word (any case) reads once: "Hub", never
|
|
212
|
+
// "Hub · Hub".
|
|
213
|
+
const same =
|
|
214
|
+
kind &&
|
|
215
|
+
String(n.label).trim().toLocaleLowerCase() ===
|
|
216
|
+
kind.word.trim().toLocaleLowerCase();
|
|
217
|
+
const named = kind && !same ? n.label + " · " + kind.word : n.label;
|
|
218
|
+
const counted = badgeWords(b, lang);
|
|
219
|
+
// Issue 326: why it is off, in the kit's words, after the name.
|
|
220
|
+
const why = off ? kitT(lang, "kit.off." + off) : "";
|
|
221
|
+
const tip = why ? named + ", " + why : named;
|
|
222
|
+
if (kind || off) {
|
|
223
|
+
for (const k of HOST_TEXT_ATTRS) delete more[k];
|
|
224
|
+
more["aria-label"] = [named, counted, why].filter(Boolean).join(", ");
|
|
225
|
+
if (kind) more["data-nav-kind"] = kind.id;
|
|
226
|
+
if (off) more["data-nav-off"] = off;
|
|
227
|
+
} else if (more["aria-label"] == null && (counted || (b && b.label)))
|
|
228
|
+
// Without a kind, as before: a badge's label still reads (flagged).
|
|
229
|
+
more["aria-label"] = named + ", " + (counted || b.label);
|
|
230
|
+
// A pin row's Delete (unpin) is the kit's own feature: its shortcut too.
|
|
231
|
+
if (n.pin != null) more["aria-keyshortcuts"] = "Delete";
|
|
232
|
+
if (hostText.length) more["data-nav-host-text"] = hostText.join(",");
|
|
82
233
|
const link =
|
|
83
234
|
'<a class="den-ni' +
|
|
84
235
|
(n.cls ? " " + esc(n.cls) : "") +
|
|
236
|
+
(off ? " den-off" : "") +
|
|
85
237
|
'" href="' +
|
|
86
238
|
esc(n.href) +
|
|
87
239
|
'" data-nav="' +
|
|
@@ -91,15 +243,16 @@ export function navItemHtml(n, navRole) {
|
|
|
91
243
|
(n.current ? ' aria-current="page"' : "") +
|
|
92
244
|
attrs(more) +
|
|
93
245
|
' title="' +
|
|
94
|
-
esc(n.tip || n.label) +
|
|
246
|
+
esc(kind || off ? tip : n.tip || n.label) +
|
|
95
247
|
'">' +
|
|
96
|
-
(n.lead ||
|
|
248
|
+
(n.lead || leadIcon(n.icon)) +
|
|
97
249
|
'<span class="den-lbl' +
|
|
98
250
|
(n.mono ? " den-mono" : "") +
|
|
99
251
|
'">' +
|
|
100
252
|
esc(n.label) +
|
|
101
253
|
"</span>" +
|
|
102
254
|
extra +
|
|
255
|
+
tag +
|
|
103
256
|
"</a>";
|
|
104
257
|
return n.pin != null
|
|
105
258
|
? '<div class="den-pin-row"' +
|
|
@@ -177,13 +330,13 @@ export function railHtml({
|
|
|
177
330
|
if (!items.length) continue;
|
|
178
331
|
html += railGroupHtml(
|
|
179
332
|
g,
|
|
180
|
-
items.map((n) => navItemHtml(n, "page")).join(""),
|
|
333
|
+
items.map((n) => navItemHtml(n, "page", lang)).join(""),
|
|
181
334
|
lang,
|
|
182
335
|
);
|
|
183
336
|
}
|
|
184
337
|
html += '<div class="den-rail-grow"></div>';
|
|
185
338
|
html += foot
|
|
186
|
-
.map((n) => (typeof n === "string" ? n : navItemHtml(n)))
|
|
339
|
+
.map((n) => (typeof n === "string" ? n : navItemHtml(n, undefined, lang)))
|
|
187
340
|
.join("");
|
|
188
341
|
html += settingsHtml(settings, lang);
|
|
189
342
|
html += accountHtml(account);
|
|
@@ -631,6 +784,10 @@ function bellRowHtml(it) {
|
|
|
631
784
|
* `actions`: buttons beside the heading (Mark all read); `lead`: HTML
|
|
632
785
|
* under the heading; `after`: HTML after the rows; `foot`: the footer (a
|
|
633
786
|
* Report button). Every HTML part is the host's own.
|
|
787
|
+
* Issue 101: `sections` { needs, earlier? } in place of rows: the kit
|
|
788
|
+
* heads them "Needs you" (first, always; its own line when `needs` is
|
|
789
|
+
* empty) and "Earlier" (when given), in its words; the host gives only
|
|
790
|
+
* each section's rows.
|
|
634
791
|
*/
|
|
635
792
|
export function bellPanelHtml({
|
|
636
793
|
title,
|
|
@@ -639,6 +796,7 @@ export function bellPanelHtml({
|
|
|
639
796
|
lead,
|
|
640
797
|
items,
|
|
641
798
|
body,
|
|
799
|
+
sections,
|
|
642
800
|
empty,
|
|
643
801
|
after,
|
|
644
802
|
foot,
|
|
@@ -646,8 +804,9 @@ export function bellPanelHtml({
|
|
|
646
804
|
} = {}) {
|
|
647
805
|
const list = Array.isArray(items) ? items : [];
|
|
648
806
|
const e = empty || {};
|
|
649
|
-
const rows =
|
|
650
|
-
|
|
807
|
+
const rows = sections
|
|
808
|
+
? bellSectionsHtml(sections, lang)
|
|
809
|
+
: body != null && body !== ""
|
|
651
810
|
? body
|
|
652
811
|
: list.length
|
|
653
812
|
? list.map(bellRowHtml).join("")
|
|
@@ -671,6 +830,41 @@ export function bellPanelHtml({
|
|
|
671
830
|
);
|
|
672
831
|
}
|
|
673
832
|
|
|
833
|
+
/** Issue 101: one titled section of the bell's panel. */
|
|
834
|
+
function bellSectionHtml(id, word, rows) {
|
|
835
|
+
return (
|
|
836
|
+
'<section class="den-bell-sec" data-sec="' +
|
|
837
|
+
id +
|
|
838
|
+
'" aria-labelledby="den-bell-' +
|
|
839
|
+
id +
|
|
840
|
+
'"><h3 class="den-bell-sech" id="den-bell-' +
|
|
841
|
+
id +
|
|
842
|
+
'">' +
|
|
843
|
+
esc(word) +
|
|
844
|
+
"</h3>" +
|
|
845
|
+
rows +
|
|
846
|
+
"</section>"
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/** Issue 101: Needs you, then Earlier (the host's rows in each). */
|
|
851
|
+
function bellSectionsHtml(s, lang) {
|
|
852
|
+
const needs = s.needs || "";
|
|
853
|
+
return (
|
|
854
|
+
bellSectionHtml(
|
|
855
|
+
"needs",
|
|
856
|
+
kitT(lang, "kit.bell.needs"),
|
|
857
|
+
needs ||
|
|
858
|
+
'<p class="den-bell-none">' +
|
|
859
|
+
esc(kitT(lang, "kit.bell.needsNone")) +
|
|
860
|
+
"</p>",
|
|
861
|
+
) +
|
|
862
|
+
(s.earlier
|
|
863
|
+
? bellSectionHtml("earlier", kitT(lang, "kit.bell.earlier"), s.earlier)
|
|
864
|
+
: "")
|
|
865
|
+
);
|
|
866
|
+
}
|
|
867
|
+
|
|
674
868
|
/**
|
|
675
869
|
* The account entry, in the rail's foot: who is signed in, here.
|
|
676
870
|
* accountHtml({ label, detail?, href?, action?, icon?, id?, navId?,
|
package/src/shell.css
CHANGED
|
@@ -537,6 +537,25 @@ body.den-has-shell > #den-content {
|
|
|
537
537
|
background: color-mix(in srgb, var(--bad) 16%, transparent);
|
|
538
538
|
color: var(--bad);
|
|
539
539
|
}
|
|
540
|
+
/* Issue 307: a pin's or a cross-app link's kind (PROJECT, DEN, SERVICE,
|
|
541
|
+
HUB, an artifact's word), at the row's end. Its look is the scope
|
|
542
|
+
labels' (.den-k); this only places it. */
|
|
543
|
+
.den-ni-kind {
|
|
544
|
+
flex: none;
|
|
545
|
+
white-space: nowrap;
|
|
546
|
+
}
|
|
547
|
+
/* A project pin's initial, in a disc the icon's size, in place of it. */
|
|
548
|
+
.den-ini {
|
|
549
|
+
width: 18px;
|
|
550
|
+
height: 18px;
|
|
551
|
+
flex: none;
|
|
552
|
+
border-radius: 50%;
|
|
553
|
+
display: inline-grid;
|
|
554
|
+
place-items: center;
|
|
555
|
+
background: var(--sunken);
|
|
556
|
+
color: var(--text);
|
|
557
|
+
font: 500 11px/1 var(--sans);
|
|
558
|
+
}
|
|
540
559
|
.den-rail-grow {
|
|
541
560
|
flex: 1;
|
|
542
561
|
}
|
|
@@ -611,7 +630,8 @@ body.den-has-shell > #den-content {
|
|
|
611
630
|
color: var(--muted);
|
|
612
631
|
border-color: transparent;
|
|
613
632
|
}
|
|
614
|
-
body.den-rail-collapsed .den-rail .den-pvisit
|
|
633
|
+
body.den-rail-collapsed .den-rail .den-pvisit,
|
|
634
|
+
body.den-rail-collapsed .den-rail .den-ni-kind {
|
|
615
635
|
display: none;
|
|
616
636
|
}
|
|
617
637
|
@media (max-width: 720px) {
|
|
@@ -622,6 +642,9 @@ body.den-rail-collapsed .den-rail .den-pvisit {
|
|
|
622
642
|
body.den-rail-collapsed .den-rail .den-pvisit {
|
|
623
643
|
display: grid;
|
|
624
644
|
}
|
|
645
|
+
body.den-rail-collapsed .den-rail .den-ni-kind {
|
|
646
|
+
display: inline;
|
|
647
|
+
}
|
|
625
648
|
}
|
|
626
649
|
body.den-rail-collapsed .den-rail .den-lbl,
|
|
627
650
|
body.den-rail-collapsed .den-rail .den-gh,
|
|
@@ -652,10 +675,16 @@ body.den-has-shell .den-upd {
|
|
|
652
675
|
}
|
|
653
676
|
.den-rail {
|
|
654
677
|
transform: translateX(-105%);
|
|
655
|
-
transition: transform 0.18s;
|
|
656
678
|
box-shadow: var(--shadow);
|
|
657
679
|
z-index: 42;
|
|
658
680
|
}
|
|
681
|
+
/* The drawer slides only once the person has opened or closed it
|
|
682
|
+
(shell-client adds den-rail-moved then). Before that, a load or a
|
|
683
|
+
window narrowing past 720 puts the rail straight where it belongs;
|
|
684
|
+
a transition here slid it across the page (issue 311). */
|
|
685
|
+
body.den-rail-moved .den-rail {
|
|
686
|
+
transition: transform 0.18s;
|
|
687
|
+
}
|
|
659
688
|
body.den-rail-open .den-rail {
|
|
660
689
|
transform: none;
|
|
661
690
|
}
|
|
@@ -713,7 +742,8 @@ body.den-has-shell .den-upd {
|
|
|
713
742
|
}
|
|
714
743
|
}
|
|
715
744
|
@media (prefers-reduced-motion: reduce) {
|
|
716
|
-
.den-rail
|
|
745
|
+
.den-rail,
|
|
746
|
+
body.den-rail-moved .den-rail {
|
|
717
747
|
transition: none;
|
|
718
748
|
}
|
|
719
749
|
}
|
|
@@ -979,6 +1009,22 @@ body.den-has-shell .den-upd {
|
|
|
979
1009
|
font-size: 11px;
|
|
980
1010
|
white-space: nowrap;
|
|
981
1011
|
}
|
|
1012
|
+
/* Issue 101: Needs you, then Earlier, each under a quiet heading. */
|
|
1013
|
+
.den-bell-sec + .den-bell-sec {
|
|
1014
|
+
border-top: 1px solid var(--border);
|
|
1015
|
+
}
|
|
1016
|
+
.den-bell-sech {
|
|
1017
|
+
margin: 0;
|
|
1018
|
+
padding: 10px 12px 2px;
|
|
1019
|
+
font-size: 12px;
|
|
1020
|
+
font-weight: 600;
|
|
1021
|
+
color: var(--muted);
|
|
1022
|
+
}
|
|
1023
|
+
.den-bell-none {
|
|
1024
|
+
margin: 0;
|
|
1025
|
+
padding: 6px 12px 10px;
|
|
1026
|
+
color: var(--muted);
|
|
1027
|
+
}
|
|
982
1028
|
.den-bell-empty {
|
|
983
1029
|
padding: 16px 12px;
|
|
984
1030
|
color: var(--muted);
|