@monster-orange/den-ui 0.0.0-stage → 0.6.6

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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +408 -2
  3. package/bin/den-ui-parity.mjs +365 -0
  4. package/inventory/nav-inventory.d.ts +89 -0
  5. package/inventory/nav-inventory.js +590 -0
  6. package/inventory/reference/den-chromium-1280.json +5137 -0
  7. package/inventory/reference/den-chromium-390.json +3653 -0
  8. package/inventory/reference/den-webkit-1280.json +5137 -0
  9. package/inventory/reference/den-webkit-390.json +3653 -0
  10. package/package.json +51 -4
  11. package/src/base.css +80 -0
  12. package/src/busy-words.d.ts +2 -0
  13. package/src/busy-words.js +71 -0
  14. package/src/busy.css +155 -0
  15. package/src/busy.d.ts +80 -0
  16. package/src/busy.js +662 -0
  17. package/src/dialog.css +103 -0
  18. package/src/dialog.d.ts +44 -0
  19. package/src/dialog.js +282 -0
  20. package/src/fonts/OFL.txt +97 -0
  21. package/src/fonts/rubik-latin-400-normal.woff2 +0 -0
  22. package/src/fonts/rubik-latin-500-normal.woff2 +0 -0
  23. package/src/fonts/rubik-latin-ext-400-normal.woff2 +0 -0
  24. package/src/fonts/rubik-latin-ext-500-normal.woff2 +0 -0
  25. package/src/fonts/space-mono-latin-400-normal.woff2 +0 -0
  26. package/src/fonts/space-mono-latin-ext-400-normal.woff2 +0 -0
  27. package/src/fonts.css +71 -0
  28. package/src/icons.d.ts +4 -0
  29. package/src/icons.js +43 -0
  30. package/src/kit.d.ts +146 -0
  31. package/src/kit.js +224 -0
  32. package/src/report-shot.d.ts +47 -0
  33. package/src/report-shot.js +255 -0
  34. package/src/report.css +387 -0
  35. package/src/report.d.ts +61 -0
  36. package/src/report.js +909 -0
  37. package/src/shell-client.d.ts +31 -0
  38. package/src/shell-client.js +240 -0
  39. package/src/shell-html.d.ts +91 -0
  40. package/src/shell-html.js +289 -0
  41. package/src/shell.css +558 -0
  42. package/src/strings.d.ts +18 -0
  43. package/src/strings.js +514 -0
  44. package/src/time.d.ts +18 -0
  45. package/src/time.js +254 -0
  46. package/src/tokens.css +158 -0
  47. package/src/update-pill.css +32 -0
  48. package/src/update-pill.d.ts +17 -0
  49. package/src/update-pill.js +95 -0
  50. package/src/version.d.ts +7 -0
  51. package/src/version.js +31 -0
  52. package/src/whatsnew.css +235 -0
  53. package/src/whatsnew.d.ts +36 -0
  54. package/src/whatsnew.js +411 -0
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@monster-orange/den-ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.6.6",
4
+ "description": "Den's UI kit: tokens, fonts and shared components, framework-free",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Monster-Orange/den.git",
9
+ "directory": "packages/den-ui"
10
+ },
11
+ "type": "module",
12
+ "types": "./src/kit.d.ts",
13
+ "exports": {
14
+ "./tokens.css": "./src/tokens.css",
15
+ "./fonts.css": "./src/fonts.css",
16
+ "./base.css": "./src/base.css",
17
+ "./time": "./src/time.js",
18
+ "./update-pill": "./src/update-pill.js",
19
+ "./update-pill.css": "./src/update-pill.css",
20
+ "./busy": "./src/busy.js",
21
+ "./busy-words": "./src/busy-words.js",
22
+ "./dialog": "./src/dialog.js",
23
+ "./strings": "./src/strings.js",
24
+ "./icons": "./src/icons.js",
25
+ "./shell-html": "./src/shell-html.js",
26
+ "./shell-client": "./src/shell-client.js",
27
+ "./version": "./src/version.js",
28
+ "./whatsnew": "./src/whatsnew.js",
29
+ "./report": "./src/report.js",
30
+ "./report-shot": "./src/report-shot.js",
31
+ "./kit": "./src/kit.js",
32
+ "./shell.css": "./src/shell.css",
33
+ "./whatsnew.css": "./src/whatsnew.css",
34
+ "./report.css": "./src/report.css",
35
+ "./busy.css": "./src/busy.css",
36
+ "./dialog.css": "./src/dialog.css",
37
+ "./inventory": {
38
+ "types": "./inventory/nav-inventory.d.ts",
39
+ "default": "./inventory/nav-inventory.js"
40
+ },
41
+ "./inventory/reference/*": "./inventory/reference/*"
42
+ },
43
+ "files": [
44
+ "src/",
45
+ "inventory/",
46
+ "bin/",
47
+ "LICENSE",
48
+ "README.md"
49
+ ],
50
+ "bin": {
51
+ "den-ui-parity": "bin/den-ui-parity.mjs"
52
+ }
53
+ }
package/src/base.css ADDED
@@ -0,0 +1,80 @@
1
+ /*
2
+ * den-ui base: what every page using the kit gets. Load after tokens.css.
3
+ * Zero specificity (:where), so a product's own rules win.
4
+ */
5
+
6
+ /* Motion: every animation and transition uses the duration tokens, so
7
+ one rule stops them all when the person asks for less motion. */
8
+ @media (prefers-reduced-motion: reduce) {
9
+ :where(:root) {
10
+ --dur-fast: 0ms;
11
+ --dur: 0ms;
12
+ --dur-cue: 0ms;
13
+ }
14
+ }
15
+
16
+ /* Japanese: keep words whole, break a run only where it would overflow,
17
+ strict kinsoku. Chromium keeps phrases whole (auto-phrase); WebKit has
18
+ keep-all. break-word, not anywhere: anywhere lets a table column shrink
19
+ to one character, so a short header breaks inside its word. */
20
+ :where(:lang(ja)) {
21
+ word-break: keep-all;
22
+ overflow-wrap: break-word;
23
+ line-break: strict;
24
+ }
25
+ @supports (word-break: auto-phrase) {
26
+ :where(:lang(ja)) {
27
+ word-break: auto-phrase;
28
+ }
29
+ }
30
+
31
+ /* An open modal dialog is as tall as its content, and centred. The
32
+ browser's own box (inset-block 0, height fit-content) is not enough: on
33
+ an iPad a pop-up still ran the window's full height, even with height:
34
+ fit-content. So the box is placed by hand and owes nothing to the
35
+ browser's inset or height:
36
+ - fixed, top 50%, moved up by half its own height; bottom auto, so no
37
+ inset pair can stretch it;
38
+ - height auto, capped at the window less 32 px (vh first, for an older
39
+ iPad without dvh), and it scrolls inside.
40
+ Each dialog keeps its own width and its own smaller max-height. Zero
41
+ specificity, so a sheet's own rules win; a bottom sheet sets
42
+ transform: none (Report at phone width). A dialog placed by its anchor
43
+ (.den-pop, .den-toplayer: the admin-password prompt) is left alone. */
44
+ :where(dialog:modal:not(.den-pop):not(.den-toplayer)) {
45
+ position: fixed;
46
+ inset-block: auto;
47
+ inset-inline: 0;
48
+ top: 50%;
49
+ transform: translateY(-50%);
50
+ margin: 0 auto;
51
+ height: auto;
52
+ max-height: calc(100vh - 32px);
53
+ max-height: calc(100dvh - 32px);
54
+ overflow: auto;
55
+ }
56
+
57
+ /* UK-3, one placement for Report (issue 94). Where it sits is the kit's,
58
+ for every page and pop-up, in Den and in any product on the kit:
59
+ - top bar: right group, in the order Report, bell, account, at every
60
+ width; the shortcut shows beside the word only where there is room
61
+ (the tooltip always has it);
62
+ - dialog, drawer and popover: first in the footer, on the left, and
63
+ the pop-up's other buttons follow;
64
+ - never only in a menu. */
65
+ :where(.den-rb-top) {
66
+ flex: none;
67
+ margin: 0;
68
+ }
69
+ @media (max-width: 720px) {
70
+ :where(.den-rb-top kbd) {
71
+ display: none;
72
+ }
73
+ }
74
+ :where(.den-rb-in) {
75
+ order: -1;
76
+ margin-right: auto;
77
+ }
78
+ :where(.den-rb-foot) {
79
+ justify-content: flex-start;
80
+ }
@@ -0,0 +1,2 @@
1
+ /** The working pop-up's shared words, by language (en, es, ja). */
2
+ export declare const BUSY_WORDS: Record<string, Record<string, string>>;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * UK-2: the working pop-up's shared words (Settled 9), in every language
3
+ * the kit speaks. Each product registers its own actions' words (working,
4
+ * success, failure) with registerActions; a product may add or override a
5
+ * shared key through configureBusy({ words }).
6
+ */
7
+ export const BUSY_WORDS = {
8
+ en: {
9
+ wait: "Waiting for {who}…",
10
+ still: "Still working ({s} s). You can leave this open.",
11
+ still_running: "Still running. Check the page, then check again.",
12
+ done: "Done",
13
+ close: "Close",
14
+ retry: "Try again",
15
+ check: "Check again",
16
+ report: "Report",
17
+ details: "Details",
18
+ log: "Open the log",
19
+ noans_t: "No answer from {who} yet.",
20
+ noans_b: "It may still finish. Check the page before you try again.",
21
+ noans_unknown:
22
+ "{who} has no record of this request any more. Check the page before you try again.",
23
+ err_code: "{who} answered with an error ({code}).",
24
+ network: "Couldn't reach {who}.",
25
+ next: "Trying again won't help. Do this first:",
26
+ progress: "Progress",
27
+ },
28
+ es: {
29
+ wait: "Esperando a {who}…",
30
+ still: "Sigue trabajando ({s} s). Puedes dejar esto abierto.",
31
+ still_running: "Sigue en curso. Revisa la página y vuelve a comprobar.",
32
+ done: "Listo",
33
+ close: "Cerrar",
34
+ retry: "Intentar de nuevo",
35
+ check: "Volver a comprobar",
36
+ report: "Informar",
37
+ details: "Detalles",
38
+ log: "Abrir el registro",
39
+ noans_t: "{who} aún no responde.",
40
+ noans_b:
41
+ "Puede que aún termine. Revisa la página antes de intentarlo de nuevo.",
42
+ noans_unknown:
43
+ "{who} ya no tiene registro de esta solicitud. Revisa la página antes de intentarlo de nuevo.",
44
+ err_code: "{who} respondió con un error ({code}).",
45
+ network: "No se pudo contactar con {who}.",
46
+ next: "Intentar de nuevo no servirá. Haz esto primero:",
47
+ progress: "Progreso",
48
+ },
49
+ ja: {
50
+ wait: "{who} の応答を待っています…",
51
+ still: "処理中です({s} 秒)。このまま開いておけます。",
52
+ still_running:
53
+ "まだ処理中です。ページを確認してから、もう一度確認してください。",
54
+ done: "完了",
55
+ close: "閉じる",
56
+ retry: "もう一度試す",
57
+ check: "もう一度確認",
58
+ report: "報告",
59
+ details: "詳細",
60
+ log: "ログを開く",
61
+ noans_t: "{who} からまだ応答がありません。",
62
+ noans_b:
63
+ "まだ完了する可能性があります。もう一度試す前にページを確認してください。",
64
+ noans_unknown:
65
+ "{who} にこのリクエストの記録がもうありません。もう一度試す前にページを確認してください。",
66
+ err_code: "{who} がエラーを返しました({code})。",
67
+ network: "{who} に接続できませんでした。",
68
+ next: "もう一度試しても解決しません。先にこちらを:",
69
+ progress: "進行状況",
70
+ },
71
+ };
package/src/busy.css ADDED
@@ -0,0 +1,155 @@
1
+ /* den-ui: the working pop-up's look (busy.js). Tokens only (UK-1): no
2
+ colour of its own. Linked, never injected: clean under style-src 'self'. */
3
+ .bz-dlg {
4
+ font-family: var(--sans);
5
+ position: fixed;
6
+ inset-block: auto;
7
+ inset-inline: 0;
8
+ top: 50%;
9
+ transform: translateY(-50%);
10
+ margin: 0 auto;
11
+ height: auto;
12
+ max-height: calc(100vh - 32px);
13
+ max-height: calc(100dvh - 32px);
14
+ overflow: auto;
15
+ width: min(420px, calc(100vw - 32px));
16
+ max-width: 100%;
17
+ padding: 0;
18
+ border: 1px solid var(--border-strong);
19
+ border-radius: var(--radius);
20
+ background: var(--surface);
21
+ color: var(--text);
22
+ box-shadow: var(--shadow-dialog);
23
+ }
24
+ .bz-dlg::backdrop {
25
+ background: color-mix(in srgb, var(--sunken) 70%, transparent);
26
+ }
27
+ .bz-b {
28
+ padding: var(--space-4) calc(var(--space-4) + 2px);
29
+ display: grid;
30
+ gap: 10px;
31
+ }
32
+ .bz-b h2 {
33
+ font-size: var(--fs-l);
34
+ margin: 0;
35
+ outline: none;
36
+ display: flex;
37
+ gap: var(--space-2);
38
+ align-items: center;
39
+ }
40
+ .bz-b p {
41
+ margin: 0;
42
+ font-size: var(--fs-s);
43
+ line-height: 1.5;
44
+ }
45
+ .bz-ico {
46
+ width: 18px;
47
+ height: 18px;
48
+ flex: none;
49
+ }
50
+ .bz-ok {
51
+ color: var(--ok);
52
+ }
53
+ .bz-bad {
54
+ color: var(--bad);
55
+ }
56
+ .bz-dlg[data-state="noanswer"] .bz-clock {
57
+ color: var(--warn);
58
+ }
59
+ .bz-bar {
60
+ height: 2px;
61
+ background: color-mix(in srgb, var(--accent) 22%, transparent);
62
+ position: relative;
63
+ overflow: hidden;
64
+ border-radius: 2px;
65
+ }
66
+ .bz-bar i {
67
+ position: absolute;
68
+ inset: 0 auto 0 0;
69
+ width: 35%;
70
+ background: var(--accent);
71
+ animation: bz-ind 1.4s ease-in-out infinite;
72
+ }
73
+ @keyframes bz-ind {
74
+ 0% {
75
+ transform: translateX(-100%);
76
+ }
77
+ 100% {
78
+ transform: translateX(300%);
79
+ }
80
+ }
81
+ @media (prefers-reduced-motion: reduce) {
82
+ .bz-bar i {
83
+ animation: none;
84
+ width: 100%;
85
+ opacity: 0.7;
86
+ }
87
+ }
88
+ .bz-b details {
89
+ font-size: var(--fs-xs);
90
+ color: var(--muted);
91
+ }
92
+ .bz-b pre {
93
+ margin: 6px 0 0;
94
+ font: 11.5px/1.5 var(--mono);
95
+ background: var(--sunken);
96
+ padding: var(--space-2);
97
+ border-radius: var(--radius-button);
98
+ white-space: pre-wrap;
99
+ overflow-wrap: anywhere;
100
+ }
101
+ .bz-ft {
102
+ display: flex;
103
+ flex-wrap: wrap;
104
+ gap: var(--space-2);
105
+ justify-content: flex-end;
106
+ align-items: center;
107
+ }
108
+ .bz-btn {
109
+ font: inherit;
110
+ font-size: var(--fs-s);
111
+ min-height: var(--tap-min);
112
+ padding: 0 var(--space-3);
113
+ border-radius: var(--radius-button);
114
+ border: 1px solid var(--border-strong);
115
+ background: var(--surface);
116
+ color: var(--text);
117
+ cursor: pointer;
118
+ }
119
+ .bz-btn:focus-visible {
120
+ outline: 2px solid var(--accent);
121
+ outline-offset: 2px;
122
+ }
123
+ .bz-btn.bz-primary {
124
+ background: var(--accent-fill);
125
+ border-color: var(--accent-fill);
126
+ color: var(--on-accent);
127
+ }
128
+ @media (max-width: 480px) {
129
+ .bz-btn {
130
+ min-height: var(--tap);
131
+ }
132
+ .bz-ft .bz-primary {
133
+ flex-basis: 100%;
134
+ order: 9;
135
+ }
136
+ }
137
+ .bz-prog {
138
+ margin: 0;
139
+ padding-inline-start: 1.25em;
140
+ font-size: var(--fs-s);
141
+ line-height: 1.5;
142
+ color: var(--muted);
143
+ }
144
+ .bz-prog li:last-child {
145
+ color: var(--text);
146
+ }
147
+ .bz-next {
148
+ font-weight: 500;
149
+ }
150
+ a.bz-btn {
151
+ display: inline-flex;
152
+ align-items: center;
153
+ text-decoration: none;
154
+ box-sizing: border-box;
155
+ }
package/src/busy.d.ts ADDED
@@ -0,0 +1,80 @@
1
+ export declare const OPEN_MS: number;
2
+ export declare const MIN_MS: number;
3
+ export declare const STILL_MS: number;
4
+ export declare const NO_ANSWER_MS: number;
5
+ export declare const SUCCESS_CLOSE_MS: number;
6
+ export declare const POLL_MS: number;
7
+ export declare const POLL_MAX_MS: number;
8
+
9
+ export type Words = Record<string, Record<string, string>>;
10
+ /** Check again's answer: how a request id ended. */
11
+ export interface RequestState {
12
+ state: "done" | "failed" | "running" | "unknown";
13
+ result?: unknown;
14
+ error?: { code?: number; message?: string };
15
+ }
16
+ export interface BusyHooks {
17
+ lang?: () => string;
18
+ words?: Words;
19
+ idHeader?: string;
20
+ statusUrl?: (id: string) => string;
21
+ /** Check again through the product's adapter (statusUrl is then unused). */
22
+ request?: (id: string) => Promise<RequestState | null>;
23
+ report?:
24
+ | ((info: { title: string; details: string; requestId: string }) => void)
25
+ | null;
26
+ toast?: ((text: string) => void) | null;
27
+ open?: (url: string) => void;
28
+ logUrl?: string | null;
29
+ reconnect?: {
30
+ url: string;
31
+ back: (now: unknown, before: unknown) => boolean;
32
+ waitMs?: (before: unknown) => number;
33
+ version?: (now: unknown) => string;
34
+ done?: (now: unknown) => void;
35
+ } | null;
36
+ }
37
+ export interface BusyActionDef {
38
+ who?: string;
39
+ autoClose?: boolean;
40
+ inline?: boolean;
41
+ mode?: "reconnect";
42
+ words: Words;
43
+ }
44
+ export interface BusyOptions<T = unknown> {
45
+ button?: HTMLElement | null;
46
+ vars?: Record<string, string | number>;
47
+ success?: (data: T) => string;
48
+ onDone?: (data: T) => void;
49
+ onFail?: (err: unknown) => void;
50
+ toastFast?: boolean;
51
+ quietFail?: boolean;
52
+ inlineError?: boolean;
53
+ skipDone?: (data: T) => boolean;
54
+ extra?: (data: T) => Node | null | undefined;
55
+ before?: unknown;
56
+ /**
57
+ * A failure trying again won't fix: its link (the primary) in place of
58
+ * Try again; or, from the failure, null for Try again as before.
59
+ */
60
+ next?: NextStep | ((err: unknown) => NextStep | null | undefined) | null;
61
+ }
62
+ export interface NextStep {
63
+ label: string;
64
+ /** None: the words in place of Try again, and Close is the primary. */
65
+ href?: string;
66
+ }
67
+ /** run's second argument: a progress line under the working title. */
68
+ export type Progress = (text: string) => void;
69
+ export declare function configureBusy(h?: BusyHooks): void;
70
+ export declare function registerActions(
71
+ map: Record<string, BusyActionDef>,
72
+ ): void;
73
+ export declare function busyActionOf(name: string): BusyActionDef | null;
74
+ /** The first message with words in an error or its answer, else "". */
75
+ export declare function messageOf(err: unknown): string;
76
+ export declare function busyAction<T = unknown>(
77
+ name: string,
78
+ run: (headers: Record<string, string>, progress: Progress) => Promise<T> | T,
79
+ opts?: BusyOptions<T>,
80
+ ): Promise<T | null>;