@monster-orange/den-ui 0.7.4 → 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 +63 -0
- package/package.json +9 -1
- 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-html.d.ts +5 -0
- package/src/shell-html.js +43 -2
- package/src/shell.css +16 -0
- package/src/strings.js +58 -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-html.d.ts
CHANGED
|
@@ -231,6 +231,11 @@ export interface BellPanelOptions {
|
|
|
231
231
|
items?: BellItem[];
|
|
232
232
|
/** The host's own HTML in place of rows. */
|
|
233
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 };
|
|
234
239
|
/** The empty state: its words, and HTML under them. */
|
|
235
240
|
empty?: { text?: string; more?: string };
|
|
236
241
|
after?: string;
|
package/src/shell-html.js
CHANGED
|
@@ -784,6 +784,10 @@ function bellRowHtml(it) {
|
|
|
784
784
|
* `actions`: buttons beside the heading (Mark all read); `lead`: HTML
|
|
785
785
|
* under the heading; `after`: HTML after the rows; `foot`: the footer (a
|
|
786
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.
|
|
787
791
|
*/
|
|
788
792
|
export function bellPanelHtml({
|
|
789
793
|
title,
|
|
@@ -792,6 +796,7 @@ export function bellPanelHtml({
|
|
|
792
796
|
lead,
|
|
793
797
|
items,
|
|
794
798
|
body,
|
|
799
|
+
sections,
|
|
795
800
|
empty,
|
|
796
801
|
after,
|
|
797
802
|
foot,
|
|
@@ -799,8 +804,9 @@ export function bellPanelHtml({
|
|
|
799
804
|
} = {}) {
|
|
800
805
|
const list = Array.isArray(items) ? items : [];
|
|
801
806
|
const e = empty || {};
|
|
802
|
-
const rows =
|
|
803
|
-
|
|
807
|
+
const rows = sections
|
|
808
|
+
? bellSectionsHtml(sections, lang)
|
|
809
|
+
: body != null && body !== ""
|
|
804
810
|
? body
|
|
805
811
|
: list.length
|
|
806
812
|
? list.map(bellRowHtml).join("")
|
|
@@ -824,6 +830,41 @@ export function bellPanelHtml({
|
|
|
824
830
|
);
|
|
825
831
|
}
|
|
826
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
|
+
|
|
827
868
|
/**
|
|
828
869
|
* The account entry, in the rail's foot: who is signed in, here.
|
|
829
870
|
* accountHtml({ label, detail?, href?, action?, icon?, id?, navId?,
|
package/src/shell.css
CHANGED
|
@@ -1009,6 +1009,22 @@ body.den-has-shell .den-upd {
|
|
|
1009
1009
|
font-size: 11px;
|
|
1010
1010
|
white-space: nowrap;
|
|
1011
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
|
+
}
|
|
1012
1028
|
.den-bell-empty {
|
|
1013
1029
|
padding: 16px 12px;
|
|
1014
1030
|
color: var(--muted);
|
package/src/strings.js
CHANGED
|
@@ -27,6 +27,9 @@ export const en = {
|
|
|
27
27
|
"kit.bell": "Notifications",
|
|
28
28
|
"kit.bell.n": "Notifications: {n} unread",
|
|
29
29
|
"kit.bell.empty": "Nothing new.",
|
|
30
|
+
"kit.bell.needs": "Needs you",
|
|
31
|
+
"kit.bell.earlier": "Earlier",
|
|
32
|
+
"kit.bell.needsNone": "Nothing needs you now.",
|
|
30
33
|
"kit.settings": "Settings",
|
|
31
34
|
"kit.appearance": "Appearance",
|
|
32
35
|
"kit.appearance.title": "Appearance and theme",
|
|
@@ -117,6 +120,11 @@ export const en = {
|
|
|
117
120
|
"kit.report.cancel": "Cancel",
|
|
118
121
|
"kit.report.dest": "Goes to",
|
|
119
122
|
"kit.report.pub": "Public repository",
|
|
123
|
+
"kit.report.priv": "Private repository",
|
|
124
|
+
"kit.report.int": "Internal repository",
|
|
125
|
+
"kit.report.privN": "Only people with access to this repository can see it.",
|
|
126
|
+
"kit.report.privW":
|
|
127
|
+
"Only people with access to this repository can see it: {who}.",
|
|
120
128
|
"kit.report.pubW":
|
|
121
129
|
"Screenshots and text are visible to everyone. Mask anything private.",
|
|
122
130
|
"kit.report.incH": "What goes with your report",
|
|
@@ -179,6 +187,18 @@ export const en = {
|
|
|
179
187
|
"kit.report.copyFailed":
|
|
180
188
|
"Could not copy. Select the text and copy it yourself.",
|
|
181
189
|
"kit.report.copyH": "Copy the report",
|
|
190
|
+
// The Markdown editor (markdown-editor.js, 0.7.5): its toolbar.
|
|
191
|
+
"kit.md.toolbar": "Formatting",
|
|
192
|
+
"kit.md.toolKey": "{name} ({key})",
|
|
193
|
+
"kit.md.bold": "Bold",
|
|
194
|
+
"kit.md.italic": "Italic",
|
|
195
|
+
"kit.md.code": "Code",
|
|
196
|
+
"kit.md.link": "Link",
|
|
197
|
+
"kit.md.heading": "Heading",
|
|
198
|
+
"kit.md.bulleted": "Bulleted list",
|
|
199
|
+
"kit.md.numbered": "Numbered list",
|
|
200
|
+
"kit.md.quote": "Quote",
|
|
201
|
+
"kit.md.linkText": "text",
|
|
182
202
|
};
|
|
183
203
|
|
|
184
204
|
export const es = {
|
|
@@ -198,6 +218,9 @@ export const es = {
|
|
|
198
218
|
"kit.bell": "Notificaciones",
|
|
199
219
|
"kit.bell.n": "Notificaciones: {n} sin leer",
|
|
200
220
|
"kit.bell.empty": "Nada nuevo.",
|
|
221
|
+
"kit.bell.needs": "Te necesitan",
|
|
222
|
+
"kit.bell.earlier": "Antes",
|
|
223
|
+
"kit.bell.needsNone": "Nada te necesita ahora.",
|
|
201
224
|
"kit.settings": "Ajustes",
|
|
202
225
|
"kit.appearance": "Apariencia",
|
|
203
226
|
"kit.appearance.title": "Apariencia y tema",
|
|
@@ -290,6 +313,11 @@ export const es = {
|
|
|
290
313
|
"kit.report.cancel": "Cancelar",
|
|
291
314
|
"kit.report.dest": "Va a",
|
|
292
315
|
"kit.report.pub": "Repositorio público",
|
|
316
|
+
"kit.report.priv": "Repositorio privado",
|
|
317
|
+
"kit.report.int": "Repositorio interno",
|
|
318
|
+
"kit.report.privN": "Solo lo ve quien tiene acceso a este repositorio.",
|
|
319
|
+
"kit.report.privW":
|
|
320
|
+
"Solo lo ve quien tiene acceso a este repositorio: {who}.",
|
|
293
321
|
"kit.report.pubW":
|
|
294
322
|
"Las capturas y el texto los ve todo el mundo. Tapa lo que sea privado.",
|
|
295
323
|
"kit.report.incH": "Qué va con tu informe",
|
|
@@ -356,6 +384,17 @@ export const es = {
|
|
|
356
384
|
"kit.report.copyFailed":
|
|
357
385
|
"No se pudo copiar. Selecciona el texto y cópialo tú.",
|
|
358
386
|
"kit.report.copyH": "Copia el informe",
|
|
387
|
+
"kit.md.toolbar": "Formato",
|
|
388
|
+
"kit.md.toolKey": "{name} ({key})",
|
|
389
|
+
"kit.md.bold": "Negrita",
|
|
390
|
+
"kit.md.italic": "Cursiva",
|
|
391
|
+
"kit.md.code": "Código",
|
|
392
|
+
"kit.md.link": "Enlace",
|
|
393
|
+
"kit.md.heading": "Encabezado",
|
|
394
|
+
"kit.md.bulleted": "Lista con viñetas",
|
|
395
|
+
"kit.md.numbered": "Lista numerada",
|
|
396
|
+
"kit.md.quote": "Cita",
|
|
397
|
+
"kit.md.linkText": "texto",
|
|
359
398
|
};
|
|
360
399
|
|
|
361
400
|
export const ja = {
|
|
@@ -375,6 +414,9 @@ export const ja = {
|
|
|
375
414
|
"kit.bell": "通知",
|
|
376
415
|
"kit.bell.n": "通知: 未読 {n} 件",
|
|
377
416
|
"kit.bell.empty": "新しいものはありません。",
|
|
417
|
+
"kit.bell.needs": "対応が必要",
|
|
418
|
+
"kit.bell.earlier": "以前",
|
|
419
|
+
"kit.bell.needsNone": "今、対応が必要なものはありません。",
|
|
378
420
|
"kit.settings": "設定",
|
|
379
421
|
"kit.appearance": "外観",
|
|
380
422
|
"kit.appearance.title": "外観とテーマ",
|
|
@@ -462,6 +504,11 @@ export const ja = {
|
|
|
462
504
|
"kit.report.cancel": "キャンセル",
|
|
463
505
|
"kit.report.dest": "送り先",
|
|
464
506
|
"kit.report.pub": "公開リポジトリ",
|
|
507
|
+
"kit.report.priv": "非公開リポジトリ",
|
|
508
|
+
"kit.report.int": "内部リポジトリ",
|
|
509
|
+
"kit.report.privN": "このリポジトリにアクセスできる人だけが見られます。",
|
|
510
|
+
"kit.report.privW":
|
|
511
|
+
"このリポジトリにアクセスできる人だけが見られます({who})。",
|
|
465
512
|
"kit.report.pubW":
|
|
466
513
|
"スクリーンショットとテキストは誰でも見られます。見せたくない部分は隠してください。",
|
|
467
514
|
"kit.report.incH": "報告に添えるもの",
|
|
@@ -528,6 +575,17 @@ export const ja = {
|
|
|
528
575
|
"kit.report.copyFailed":
|
|
529
576
|
"コピーできませんでした。テキストを選んでコピーしてください。",
|
|
530
577
|
"kit.report.copyH": "報告をコピー",
|
|
578
|
+
"kit.md.toolbar": "書式",
|
|
579
|
+
"kit.md.toolKey": "{name}({key})",
|
|
580
|
+
"kit.md.bold": "太字",
|
|
581
|
+
"kit.md.italic": "斜体",
|
|
582
|
+
"kit.md.code": "コード",
|
|
583
|
+
"kit.md.link": "リンク",
|
|
584
|
+
"kit.md.heading": "見出し",
|
|
585
|
+
"kit.md.bulleted": "箇条書き",
|
|
586
|
+
"kit.md.numbered": "番号付きリスト",
|
|
587
|
+
"kit.md.quote": "引用",
|
|
588
|
+
"kit.md.linkText": "テキスト",
|
|
531
589
|
};
|
|
532
590
|
|
|
533
591
|
/** The kit's tables, by language (en is the fallback for any key). */
|
package/src/whatsnew.js
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* loadWhatsNew() asks changelog() and keeps the entries
|
|
15
15
|
* setEntries(list) or gives them directly
|
|
16
16
|
* openWhatsNew() opens it at the newest release; focus on its heading
|
|
17
|
-
* closeWhatsNew() closes it; focus back where it was (else the chip)
|
|
17
|
+
* closeWhatsNew() closes it; focus back where it was (else the chip),
|
|
18
|
+
* unless the page put it in a control of its own meanwhile
|
|
18
19
|
* changelogView(entries, showAll) what it shows (pure)
|
|
19
20
|
*
|
|
20
21
|
* It is an aria-modal dialog: Tab stays in it, Escape and a click on the
|
|
@@ -399,11 +400,21 @@ export function openWhatsNew() {
|
|
|
399
400
|
export function closeWhatsNew() {
|
|
400
401
|
const overlay = document.getElementById("cl-overlay");
|
|
401
402
|
const wasOpen = !!overlay?.classList.contains("open");
|
|
403
|
+
// Issue 143: where the keyboard is now. The page may have given it to a
|
|
404
|
+
// field of its own while this was open (a deep link's composer, which
|
|
405
|
+
// came after What's new): that field keeps it.
|
|
406
|
+
const at = document.activeElement;
|
|
407
|
+
const elsewhere =
|
|
408
|
+
!!at &&
|
|
409
|
+
at !== document.body &&
|
|
410
|
+
at !== document.documentElement &&
|
|
411
|
+
!overlay?.contains(at);
|
|
402
412
|
if (overlay) overlay.classList.remove("open");
|
|
403
413
|
if (wasOpen) {
|
|
404
414
|
const back = returnFocus;
|
|
405
415
|
returnFocus = null;
|
|
406
|
-
if (!focusBack(back))
|
|
416
|
+
if (!elsewhere && !focusBack(back))
|
|
417
|
+
focusBack(document.getElementById("version-pill"));
|
|
407
418
|
}
|
|
408
419
|
if (cfg.onClose) cfg.onClose(entries[0]?.version ?? null);
|
|
409
420
|
const pip = document.getElementById("v-pip");
|