@monster-orange/den-ui 0.5.1 → 0.7.0

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 (45) hide show
  1. package/README.md +515 -1
  2. package/bin/den-ui-parity.mjs +440 -0
  3. package/inventory/fonts-dir.cjs +8 -0
  4. package/inventory/fonts-dir.mjs +10 -0
  5. package/inventory/nav-inventory.d.ts +133 -0
  6. package/inventory/nav-inventory.js +839 -0
  7. package/inventory/reference/den-chromium-1280.json +5388 -0
  8. package/inventory/reference/den-chromium-390.json +3834 -0
  9. package/inventory/reference/den-webkit-1280.json +5388 -0
  10. package/inventory/reference/den-webkit-390.json +3834 -0
  11. package/package.json +40 -3
  12. package/src/busy-words.d.ts +2 -0
  13. package/src/busy-words.js +6 -0
  14. package/src/busy.css +155 -0
  15. package/src/busy.d.ts +80 -0
  16. package/src/busy.js +105 -35
  17. package/src/dialog.css +103 -0
  18. package/src/dialog.d.ts +44 -0
  19. package/src/dialog.js +95 -30
  20. package/src/icons.d.ts +4 -0
  21. package/src/icons.js +43 -0
  22. package/src/kit.d.ts +217 -0
  23. package/src/kit.js +299 -0
  24. package/src/marks/den.svg +6 -0
  25. package/src/report-shot.d.ts +47 -0
  26. package/src/report-shot.js +437 -0
  27. package/src/report.css +387 -0
  28. package/src/report.d.ts +61 -0
  29. package/src/report.js +909 -0
  30. package/src/shell-client.d.ts +149 -0
  31. package/src/shell-client.js +820 -0
  32. package/src/shell-html.d.ts +305 -0
  33. package/src/shell-html.js +903 -0
  34. package/src/shell.css +1010 -0
  35. package/src/strings.d.ts +18 -0
  36. package/src/strings.js +565 -0
  37. package/src/time.d.ts +18 -0
  38. package/src/time.js +14 -2
  39. package/src/tokens.css +81 -67
  40. package/src/update-pill.d.ts +17 -0
  41. package/src/version.d.ts +7 -0
  42. package/src/version.js +31 -0
  43. package/src/whatsnew.css +235 -0
  44. package/src/whatsnew.d.ts +36 -0
  45. package/src/whatsnew.js +411 -0
@@ -0,0 +1,305 @@
1
+ export { icon } from "./icons.js";
2
+ export { esc } from "./strings.js";
3
+
4
+ export interface Product {
5
+ /** The word beside the mark. */
6
+ name?: string;
7
+ /** Its tooltip (default: name). */
8
+ title?: string;
9
+ /** The version chip's text ("v" + version; "v…" when unknown). */
10
+ version?: string | null;
11
+ /** Where the brand goes (default "/"). */
12
+ href?: string;
13
+ /**
14
+ * The mark: `src`, an image file drawn as Den draws its theme's mark
15
+ * (the default is the kit's `marks/den.svg`); else text (escaped) or the
16
+ * product's own svg markup, named by label.
17
+ */
18
+ mark?: Mark | null;
19
+ }
20
+ export interface NavItem {
21
+ id: string;
22
+ label: string;
23
+ href: string;
24
+ group?: string;
25
+ icon?: string;
26
+ tip?: string;
27
+ current?: boolean;
28
+ badge?: { n: number | string; bad?: boolean; label?: string } | null;
29
+ /** HTML in place of the icon (a status dot). */
30
+ lead?: string;
31
+ mono?: boolean;
32
+ cls?: string;
33
+ attrs?: Record<string, string | number | boolean | null | undefined>;
34
+ /** The pinned id: the row is a pin row (Delete unpins it). */
35
+ pin?: string | null;
36
+ /** HTML after the link inside the pin row. */
37
+ after?: string;
38
+ }
39
+ export interface NavGroup {
40
+ id: string;
41
+ label: string;
42
+ /** A "from <d>" tag on the group's heading. */
43
+ from?: string;
44
+ }
45
+ export interface Slots {
46
+ /** After the brand (a search, a scope menu). */
47
+ start?: string;
48
+ /** The right group's start, before Report (status chips). */
49
+ end?: string;
50
+ /** After Report. */
51
+ bell?: string;
52
+ /** Last, after the version chip. */
53
+ account?: string;
54
+ }
55
+ export interface RailModel {
56
+ nav?: NavItem[];
57
+ groups?: NavGroup[];
58
+ /** Entries (or HTML) under the rail's spacer, before the collapse toggle. */
59
+ foot?: (NavItem | string)[];
60
+ /** 0.7.0: the Settings entry, after foot. */
61
+ settings?: SettingsEntry | null;
62
+ /** 0.7.0: the account entry, last in the foot. */
63
+ account?: Account | null;
64
+ lang?: string;
65
+ collapsed?: boolean;
66
+ }
67
+ export interface ShellModel extends RailModel {
68
+ product?: Product;
69
+ slots?: Slots;
70
+ /** false: no Report button (reports off). */
71
+ report?: boolean;
72
+ }
73
+ export declare function navItemHtml(n: NavItem, navRole?: string): string;
74
+ export declare function railGroupHtml(
75
+ g: NavGroup,
76
+ body: string,
77
+ lang?: string,
78
+ ): string;
79
+ export declare function railHtml(model?: RailModel): string;
80
+ export declare function versionChipHtml(o?: {
81
+ version?: string | null;
82
+ lang?: string;
83
+ }): string;
84
+ export declare function reportButtonHtml(o?: {
85
+ inFoot?: boolean;
86
+ inTop?: boolean;
87
+ lang?: string;
88
+ /** The button's own words, and its accessible name (escaped). */
89
+ label?: string;
90
+ /** Kept on the button as JSON; the kit's click opens Report with it. */
91
+ prefill?: { kind?: string; title?: string; description?: string };
92
+ }): string;
93
+ /** A Report button's prefill (its data-den-report-prefill), or undefined. */
94
+ export declare function reportPrefillOf(
95
+ el: Element | null | undefined,
96
+ ): { kind?: string; title?: string; description?: string } | undefined;
97
+ export declare function topBarHtml(model?: ShellModel): string;
98
+ /** The whole shell: skip link, top bar and rail, as HTML. Pure: runs in Node. */
99
+ export declare function shellHtml(model?: ShellModel): string;
100
+
101
+ /** 0.7.0: a link in a crumb's own menu. */
102
+ export interface CrumbLink {
103
+ label: string;
104
+ href: string;
105
+ current?: boolean;
106
+ }
107
+ /** 0.7.0: one scope crumb (COMPANY, PROJECT, ENV …). */
108
+ export interface Crumb {
109
+ /** Its kind: data-scope, the id "den-scope-<key>", "den-<key>-sep". */
110
+ key?: string;
111
+ /** The small-caps word. */
112
+ label: string;
113
+ value?: string;
114
+ /**
115
+ * Links or HTML: the kit draws and opens the menu. true: the host opens
116
+ * its own (hydrateScope's onOpen). None: a plain label, no ▾.
117
+ */
118
+ menu?: CrumbLink[] | string | true | null;
119
+ id?: string;
120
+ title?: string;
121
+ hidden?: boolean;
122
+ /** The first to give way on a narrow bar. */
123
+ optional?: boolean;
124
+ cls?: string;
125
+ valueCls?: string;
126
+ /**
127
+ * A type-to-filter field at the top of a list of links: by default past
128
+ * 6 of them; a number sets that threshold; true always; false never.
129
+ */
130
+ filter?: boolean | number;
131
+ }
132
+ export interface ScopeOptions {
133
+ crumbs?: (Crumb | null | undefined | false)[];
134
+ /** The group's name (default the kit's "Scope"). */
135
+ label?: string;
136
+ lang?: string;
137
+ /** The host's HTML at the group's end. */
138
+ after?: string;
139
+ }
140
+ export interface SearchOptions {
141
+ placeholder?: string;
142
+ /** Its name (default the placeholder). */
143
+ label?: string;
144
+ id?: string;
145
+ /** false: no ⌘K inside, and no aria-keyshortcuts. */
146
+ shortcut?: boolean;
147
+ lang?: string;
148
+ }
149
+ export interface BellButtonOptions {
150
+ count?: number;
151
+ /** Its word (default the kit's "Notifications"). */
152
+ label?: string;
153
+ id?: string;
154
+ lang?: string;
155
+ }
156
+ export interface BellItem {
157
+ text: string;
158
+ href?: string;
159
+ /** The time as shown ("2 min"). */
160
+ time?: string;
161
+ /** Its ISO stamp, for <time datetime>. */
162
+ datetime?: string;
163
+ read?: boolean;
164
+ id?: string;
165
+ }
166
+ export interface BellPanelOptions {
167
+ title?: string;
168
+ titleId?: string;
169
+ /** Buttons beside the heading (HTML). */
170
+ actions?: string;
171
+ /** HTML under the heading. */
172
+ lead?: string;
173
+ items?: BellItem[];
174
+ /** The host's own HTML in place of rows. */
175
+ body?: string | null;
176
+ /** The empty state: its words, and HTML under them. */
177
+ empty?: { text?: string; more?: string };
178
+ after?: string;
179
+ foot?: string;
180
+ lang?: string;
181
+ }
182
+ export interface Account {
183
+ label: string;
184
+ detail?: string;
185
+ /**
186
+ * A link; else `menu: true`, a button opening the account menu
187
+ * (hydrateAccount's menu); else `action: true`, a button
188
+ * (hydrateAccount's onAction).
189
+ */
190
+ href?: string;
191
+ menu?: boolean;
192
+ action?: boolean;
193
+ icon?: string;
194
+ id?: string;
195
+ /** Its data-nav (default "account"). */
196
+ navId?: string;
197
+ attrs?: Record<string, string | number | boolean | null | undefined>;
198
+ current?: boolean;
199
+ }
200
+ export declare function scopeCrumbHtml(
201
+ c: Crumb | null | undefined,
202
+ lang?: string,
203
+ ): string;
204
+ /** The scope crumbs; no crumbs, "". */
205
+ export declare function scopeHtml(o?: ScopeOptions): string;
206
+ /** The search field, ⌘K inside it. */
207
+ export declare function searchHtml(o?: SearchOptions): string;
208
+ /** A count as the badge shows it: "" for none, "99+" past 99. */
209
+ export declare function bellCount(n: number | null | undefined): string;
210
+ export declare function bellButtonHtml(o?: BellButtonOptions): string;
211
+ export declare function bellPanelHtml(o?: BellPanelOptions): string;
212
+ /** The rail's account entry; no label, "". */
213
+ export declare function accountHtml(a: Account | null | undefined): string;
214
+ /** An account menu entry: a link, a button (onPick "item"), or a form post. */
215
+ export type AccountMenuItem =
216
+ | { label: string; href: string }
217
+ | { label: string; id: string }
218
+ | {
219
+ label: string;
220
+ action: {
221
+ method?: "post" | "get";
222
+ url: string;
223
+ csrf?: string;
224
+ /** The hidden field's name (default "csrf"). */
225
+ field?: string;
226
+ };
227
+ };
228
+ export interface AccountMenu {
229
+ /** Who is signed in. */
230
+ name?: string;
231
+ /** Where ("Signed in · this device"). */
232
+ detail?: string;
233
+ items?: AccountMenuItem[];
234
+ lang?: string;
235
+ }
236
+ /** Whether a menu of n entries gets the filter field (see Crumb.filter). */
237
+ export declare function menuHasFilter(
238
+ filter: boolean | number | undefined,
239
+ n: number,
240
+ ): boolean;
241
+ /**
242
+ * A menu's filter field (aria-controls `<menuId>-list`, the role="menu"
243
+ * list) and its "No match" line: [field, none].
244
+ */
245
+ export declare function menuFilterParts(
246
+ menuId: string,
247
+ label?: string,
248
+ lang?: string,
249
+ ): [string, string];
250
+ /** The account entry's menu content. */
251
+ export declare function accountMenuHtml(o?: AccountMenu): string;
252
+ export interface SettingsEntry {
253
+ href: string;
254
+ /** Default the kit's "Settings". */
255
+ label?: string;
256
+ current?: boolean;
257
+ /** Its data-nav (default "settings"). */
258
+ id?: string;
259
+ }
260
+ export declare function settingsHtml(
261
+ o: SettingsEntry | null | undefined,
262
+ lang?: string,
263
+ ): string;
264
+ export declare function appearanceButtonHtml(o?: {
265
+ id?: string;
266
+ label?: string;
267
+ title?: string;
268
+ lang?: string;
269
+ }): string;
270
+ export interface AppearanceMenu {
271
+ /** "system", "dark" or "light": the checked mode. */
272
+ mode?: string;
273
+ /** Default the kit's System, Dark, Light. */
274
+ modes?: { value: string; label: string }[];
275
+ themes?: { value: string; label: string; selected?: boolean }[];
276
+ /** A line under the themes. */
277
+ notice?: string | null;
278
+ /** Each named in itself. */
279
+ languages?: { id: string; name: string; current?: boolean }[];
280
+ /** After a rule: links, or buttons onPick("item", id). */
281
+ items?: { label: string; href?: string; id?: string }[];
282
+ lang?: string;
283
+ }
284
+ export declare function appearanceMenuHtml(o?: AppearanceMenu): string;
285
+ export interface WaitingOptions {
286
+ /** The words before the dot ("stale server"). */
287
+ label?: string;
288
+ /** The bold word after it ("Restart"). */
289
+ action?: string;
290
+ title?: string;
291
+ /** Its name. */
292
+ name?: string;
293
+ id?: string;
294
+ }
295
+ export declare function waitingHtml(o?: WaitingOptions): string;
296
+
297
+ /** The brand's mark: an image file, text, or the host's own svg markup. */
298
+ export interface Mark {
299
+ src?: string;
300
+ text?: string;
301
+ svg?: string;
302
+ label: string;
303
+ }
304
+ /** The brand's mark (#den-mark); see Mark. */
305
+ export declare function markHtml(mark?: Mark | null): string;