@broberg/app-shell 0.3.1 → 0.4.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.
- package/README.md +55 -0
- package/css/app-shell.css +36 -0
- package/dist/index.cjs +93 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -1
- package/dist/index.d.ts +93 -1
- package/dist/index.js +88 -3
- package/dist/index.js.map +1 -1
- package/dist/preact.cjs +249 -2
- package/dist/preact.cjs.map +1 -1
- package/dist/preact.d.cts +118 -2
- package/dist/preact.d.ts +118 -2
- package/dist/preact.js +242 -3
- package/dist/preact.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,6 +49,61 @@ the user menu reads and writes theme, palette, surfaces and backdrop through it.
|
|
|
49
49
|
| `UserMenu` | Avatar, name + email, **Konto** → Broberg ID, your items, Theme · Palette · Surfaces · Backdrop, sign out. |
|
|
50
50
|
| `PageHeader`, `PageTabs` | Eyebrow/title/description/actions; tabs as routes (`?tab=` or one path per tab). |
|
|
51
51
|
| `Avatar` | `picture` when given, otherwise initials. |
|
|
52
|
+
| `AccountPage` | The user's own name and picture, edited inside the app (0.4.0). |
|
|
53
|
+
|
|
54
|
+
## 0.4.0 — AccountPage: name and picture, edited inside the app (F095.3)
|
|
55
|
+
|
|
56
|
+
The user changes their own name and profile picture without leaving for
|
|
57
|
+
id.broberg.ai. Purely additive: nothing else in the shell moved.
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { AccountPage } from "@broberg/app-shell/preact";
|
|
61
|
+
|
|
62
|
+
<AccountPage lang="da" /> // talks to /api/account (below)
|
|
63
|
+
<AccountPage lang="en" adapter={myAdapter} reauthHref="/login?next=/me" />
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Backend.** The default adapter speaks to `@broberg/sso`'s `accountRoutes()`
|
|
67
|
+
mounted on `/api/account` (this package does not import sso):
|
|
68
|
+
|
|
69
|
+
| Call | Request | Answer |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `load()` | `GET /api/account/profile` | `{ sub, name, picture, email, account_url }` |
|
|
72
|
+
| `saveName(name)` | `POST /api/account/profile` `{ name }` | the profile |
|
|
73
|
+
| `uploadAvatar(file)` | `POST /api/account/profile/avatar`, raw bytes, `Content-Type` = the image's | the profile |
|
|
74
|
+
| `removeAvatar()` | `POST /api/account/profile/avatar/remove` | the profile |
|
|
75
|
+
|
|
76
|
+
Point it elsewhere with `createFetchAccountAdapter({ url })`, or pass any
|
|
77
|
+
`{ load, saveName, uploadAvatar, removeAvatar }` that resolves to the profile.
|
|
78
|
+
A non-2xx throws an `AccountError` (`status`, `code`) — a failed save never
|
|
79
|
+
looks saved.
|
|
80
|
+
|
|
81
|
+
**What the page shows after a save is the server's answer.** The name field
|
|
82
|
+
and the shown name are set from the response, never from what was typed — if
|
|
83
|
+
Broberg ID trims the name, the field shows the trimmed name. On a failed save
|
|
84
|
+
the error shows and the field keeps the typed text.
|
|
85
|
+
|
|
86
|
+
**Picture.** A custom button over a hidden `<input type=file
|
|
87
|
+
accept="image/png,image/jpeg,image/webp">`. Over 2 MB or another type is
|
|
88
|
+
refused with a message **before** anything is sent. Remove asks inline
|
|
89
|
+
(Fjern / Annuller), never `confirm()`. The avatar is round by CSS; no cropping
|
|
90
|
+
in v1.
|
|
91
|
+
|
|
92
|
+
**Signing in again is a normal state.** Broberg ID issues no refresh token, so
|
|
93
|
+
about an hour after login every change answers `401 reauth`. A 401 (or `403
|
|
94
|
+
insufficient_scope`) shows «Log ind igen for at rette» / "Sign in again to make
|
|
95
|
+
changes" with a button that does a full page load to `reauthHref` — default
|
|
96
|
+
`/auth/login?returnTo=<this page>` (no `prompt=login`: BID still has the
|
|
97
|
+
session and offers «Fortsæt som …») — and the fields go read-only.
|
|
98
|
+
|
|
99
|
+
**«Sikkerhed i Broberg ID»** links to `account_url` in a new tab.
|
|
100
|
+
|
|
101
|
+
**Test ids:** `account-page`, `account-avatar`, `account-avatar-file`,
|
|
102
|
+
`account-avatar-upload`, `account-avatar-remove`,
|
|
103
|
+
`account-avatar-remove-confirmation`, `account-avatar-remove-confirm`,
|
|
104
|
+
`account-avatar-remove-cancel`, `account-name`, `account-email`,
|
|
105
|
+
`account-name-input`, `account-name-save`, `account-ok`, `account-error`,
|
|
106
|
+
`account-reauth`, `account-reauth-signin`, `account-bid-link`.
|
|
52
107
|
|
|
53
108
|
## 0.3.0 — inset layout by default, links that leave open a new tab, a language row (F092.8, .10, .11)
|
|
54
109
|
|
package/css/app-shell.css
CHANGED
|
@@ -305,3 +305,39 @@
|
|
|
305
305
|
.bas-pagehead { padding: 16px 16px 8px; }
|
|
306
306
|
.bas-tabs { padding: 0 16px; }
|
|
307
307
|
}
|
|
308
|
+
|
|
309
|
+
/* ── account page (F095.3) ── */
|
|
310
|
+
.bas-account { display: flex; flex-direction: column; gap: 16px; max-width: 560px; width: 100%; min-width: 0; padding: 16px 0; }
|
|
311
|
+
.bas-account__who { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; min-width: 0; }
|
|
312
|
+
.bas-account__avatar { display: inline-flex; flex: none; }
|
|
313
|
+
.bas-account__whotext { min-width: 0; max-width: 100%; }
|
|
314
|
+
.bas-account__name { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
|
|
315
|
+
.bas-account__email { font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; color: var(--fg-muted); overflow-wrap: anywhere; }
|
|
316
|
+
.bas-account__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
|
|
317
|
+
.bas-account__form { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
|
|
318
|
+
.bas-account__label { font-size: 12.5px; color: var(--fg-muted); }
|
|
319
|
+
.bas-account__input {
|
|
320
|
+
flex: 1 1 220px; min-width: 0; max-width: 100%; padding: 8px 10px; font: inherit; font-size: 14px;
|
|
321
|
+
color: var(--fg); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--bas-radius);
|
|
322
|
+
}
|
|
323
|
+
.bas-account__input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
324
|
+
.bas-account__input[readonly] { color: var(--fg-muted); background: var(--bg-sunk); }
|
|
325
|
+
.bas-account__btn {
|
|
326
|
+
display: inline-flex; align-items: center; padding: 8px 12px; font: inherit; font-size: 13px; font-weight: 500;
|
|
327
|
+
border: 1px solid var(--border); border-radius: var(--bas-radius); background: transparent; color: var(--fg); cursor: pointer;
|
|
328
|
+
transition: background var(--bas-dur) var(--bas-ease);
|
|
329
|
+
}
|
|
330
|
+
.bas-account__btn:hover:not(:disabled) { background: var(--hover); }
|
|
331
|
+
.bas-account__btn:active:not(:disabled) { background: var(--active); }
|
|
332
|
+
.bas-account__btn:disabled { color: var(--fg-faint); cursor: not-allowed; }
|
|
333
|
+
.bas-account__btn.is-primary { background: var(--olive-btn); color: var(--paper, var(--bg-card)); border-color: transparent; }
|
|
334
|
+
.bas-account__btn.is-primary:disabled { opacity: .55; color: var(--paper, var(--bg-card)); }
|
|
335
|
+
.bas-account__btn.is-quiet { border-color: transparent; color: var(--fg-muted); }
|
|
336
|
+
.bas-account__btn.is-danger { color: var(--danger); border-color: var(--danger); }
|
|
337
|
+
.bas-account__confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
|
|
338
|
+
.bas-account__note { margin: 0; padding: 8px 12px; font-size: 13px; border-radius: var(--bas-radius); border: 1px solid var(--border); overflow-wrap: anywhere; }
|
|
339
|
+
.bas-account__note.is-ok { color: var(--success, var(--fg)); }
|
|
340
|
+
.bas-account__note.is-error { color: var(--danger); }
|
|
341
|
+
.bas-account__note.is-reauth { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; color: var(--fg); }
|
|
342
|
+
.bas-account__muted { margin: 0; font-size: 13px; color: var(--fg-muted); }
|
|
343
|
+
.bas-account__link { align-self: flex-start; font-size: 13px; color: var(--accent); overflow-wrap: anywhere; }
|
package/dist/index.cjs
CHANGED
|
@@ -174,6 +174,51 @@ function relativeTime(ts, lang, now = Date.now()) {
|
|
|
174
174
|
if (d === 1) return lang === "da" ? "i g\xE5r" : "yesterday";
|
|
175
175
|
return `${d} d`;
|
|
176
176
|
}
|
|
177
|
+
var AccountError = class extends Error {
|
|
178
|
+
constructor(status, code) {
|
|
179
|
+
super(code ? `HTTP ${status} ${code}` : `HTTP ${status}`);
|
|
180
|
+
this.status = status;
|
|
181
|
+
this.code = code;
|
|
182
|
+
this.name = "AccountError";
|
|
183
|
+
}
|
|
184
|
+
status;
|
|
185
|
+
code;
|
|
186
|
+
};
|
|
187
|
+
var AVATAR_TYPES = ["image/png", "image/jpeg", "image/webp"];
|
|
188
|
+
var AVATAR_MAX_BYTES = 2 * 1024 * 1024;
|
|
189
|
+
function checkAvatarFile(file) {
|
|
190
|
+
if (!AVATAR_TYPES.includes(file.type)) return "wrongType";
|
|
191
|
+
if (file.size > AVATAR_MAX_BYTES) return "tooLarge";
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
function accountErrorKind(err) {
|
|
195
|
+
if (!(err instanceof AccountError)) return "other";
|
|
196
|
+
if (err.status === 401) return "reauth";
|
|
197
|
+
if (err.status === 403 && err.code === "insufficient_scope") return "reauth";
|
|
198
|
+
if (err.status === 413) return "tooLarge";
|
|
199
|
+
if (err.status === 415) return "wrongType";
|
|
200
|
+
return "other";
|
|
201
|
+
}
|
|
202
|
+
function createFetchAccountAdapter(opts = {}) {
|
|
203
|
+
const base = (opts.url ?? "/api/account").replace(/\/+$/, "");
|
|
204
|
+
const call = async (path, init) => {
|
|
205
|
+
const res = await (opts.fetch ?? fetch)(`${base}${path}`, {
|
|
206
|
+
credentials: opts.credentials ?? "same-origin",
|
|
207
|
+
...init,
|
|
208
|
+
headers: { accept: "application/json", ...init?.headers }
|
|
209
|
+
});
|
|
210
|
+
const body = await res.json().catch(() => null);
|
|
211
|
+
if (!res.ok) throw new AccountError(res.status, typeof body?.error === "string" ? body.error : void 0);
|
|
212
|
+
if (!body || typeof body.sub !== "string") throw new AccountError(res.status, "bad_response");
|
|
213
|
+
return body;
|
|
214
|
+
};
|
|
215
|
+
return {
|
|
216
|
+
load: () => call("/profile"),
|
|
217
|
+
saveName: (name) => call("/profile", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ name }) }),
|
|
218
|
+
uploadAvatar: (file) => call("/profile/avatar", { method: "POST", headers: { "content-type": file.type }, body: file }),
|
|
219
|
+
removeAvatar: () => call("/profile/avatar/remove", { method: "POST" })
|
|
220
|
+
};
|
|
221
|
+
}
|
|
177
222
|
var TEXT = {
|
|
178
223
|
da: {
|
|
179
224
|
openMenu: "\xC5bn menu",
|
|
@@ -201,7 +246,27 @@ var TEXT = {
|
|
|
201
246
|
layered: "Lag",
|
|
202
247
|
backdrop: "Baggrund",
|
|
203
248
|
neurons: "Neuroner",
|
|
204
|
-
plain: "Ren"
|
|
249
|
+
plain: "Ren",
|
|
250
|
+
name: "Navn",
|
|
251
|
+
email: "E-mail",
|
|
252
|
+
save: "Gem",
|
|
253
|
+
saving: "Gemmer\u2026",
|
|
254
|
+
saved: "Gemt",
|
|
255
|
+
loadingProfile: "Henter profil\u2026",
|
|
256
|
+
couldNotLoadProfile: "Kunne ikke hente din profil.",
|
|
257
|
+
couldNotSave: "Kunne ikke gemme. Pr\xF8v igen.",
|
|
258
|
+
reauth: "Log ind igen for at rette",
|
|
259
|
+
signInAgain: "Log ind igen",
|
|
260
|
+
changePicture: "Skift billede",
|
|
261
|
+
removePicture: "Fjern billede",
|
|
262
|
+
confirmRemovePicture: "Fjern dit billede?",
|
|
263
|
+
remove: "Fjern",
|
|
264
|
+
cancel: "Annuller",
|
|
265
|
+
pictureSaved: "Billedet er gemt",
|
|
266
|
+
pictureRemoved: "Billedet er fjernet",
|
|
267
|
+
pictureTooLarge: "Billedet er for stort \u2014 h\xF8jst 2 MB.",
|
|
268
|
+
pictureWrongType: "V\xE6lg et PNG-, JPEG- eller WebP-billede.",
|
|
269
|
+
bidSecurity: "Sikkerhed i Broberg ID"
|
|
205
270
|
},
|
|
206
271
|
en: {
|
|
207
272
|
openMenu: "Open menu",
|
|
@@ -229,13 +294,39 @@ var TEXT = {
|
|
|
229
294
|
layered: "Layered",
|
|
230
295
|
backdrop: "Backdrop",
|
|
231
296
|
neurons: "Neurons",
|
|
232
|
-
plain: "Plain"
|
|
297
|
+
plain: "Plain",
|
|
298
|
+
name: "Name",
|
|
299
|
+
email: "Email",
|
|
300
|
+
save: "Save",
|
|
301
|
+
saving: "Saving\u2026",
|
|
302
|
+
saved: "Saved",
|
|
303
|
+
loadingProfile: "Loading profile\u2026",
|
|
304
|
+
couldNotLoadProfile: "Could not load your profile.",
|
|
305
|
+
couldNotSave: "Could not save. Try again.",
|
|
306
|
+
reauth: "Sign in again to make changes",
|
|
307
|
+
signInAgain: "Sign in again",
|
|
308
|
+
changePicture: "Change picture",
|
|
309
|
+
removePicture: "Remove picture",
|
|
310
|
+
confirmRemovePicture: "Remove your picture?",
|
|
311
|
+
remove: "Remove",
|
|
312
|
+
cancel: "Cancel",
|
|
313
|
+
pictureSaved: "Picture saved",
|
|
314
|
+
pictureRemoved: "Picture removed",
|
|
315
|
+
pictureTooLarge: "The picture is too large \u2014 2 MB at most.",
|
|
316
|
+
pictureWrongType: "Choose a PNG, JPEG or WebP image.",
|
|
317
|
+
bidSecurity: "Security in Broberg ID"
|
|
233
318
|
}
|
|
234
319
|
};
|
|
235
320
|
|
|
321
|
+
exports.AVATAR_MAX_BYTES = AVATAR_MAX_BYTES;
|
|
322
|
+
exports.AVATAR_TYPES = AVATAR_TYPES;
|
|
323
|
+
exports.AccountError = AccountError;
|
|
236
324
|
exports.TEXT = TEXT;
|
|
325
|
+
exports.accountErrorKind = accountErrorKind;
|
|
237
326
|
exports.activeNavLabel = activeNavLabel;
|
|
238
327
|
exports.badgeLabel = badgeLabel;
|
|
328
|
+
exports.checkAvatarFile = checkAvatarFile;
|
|
329
|
+
exports.createFetchAccountAdapter = createFetchAccountAdapter;
|
|
239
330
|
exports.createFetchNotificationSource = createFetchNotificationSource;
|
|
240
331
|
exports.createMemoryNotificationSource = createMemoryNotificationSource;
|
|
241
332
|
exports.initials = initials;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AAuCO,SAAS,YAAA,CAAa,MAAc,WAAA,EAA8B;AACvE,EAAA,MAAM,IAAA,GAAA,CAAQ,WAAA,CAAY,KAAA,CAAM,MAAM,CAAA,CAAE,CAAC,CAAA,IAAK,GAAA,EAAK,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA,IAAK,GAAA;AAC1E,EAAA,MAAM,MAAA,GAAA,CAAU,IAAA,CAAK,KAAA,CAAM,MAAM,CAAA,CAAE,CAAC,CAAA,IAAK,GAAA,EAAK,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA,IAAK,GAAA;AACrE,EAAA,IAAI,MAAA,KAAW,GAAA,EAAK,OAAO,IAAA,KAAS,GAAA;AACpC,EAAA,OAAO,IAAA,KAAS,MAAA,IAAU,IAAA,CAAK,UAAA,CAAW,SAAS,GAAG,CAAA;AACxD;AAOO,SAAS,aAAa,MAAA,EAAkD;AAC7E,EAAA,IAAI,OAAO,MAAA,KAAW,QAAA,EAAU,OAAO,IAAA;AACvC,EAAA,MAAM,CAAA,GAAI,OAAO,IAAA,EAAK;AACtB,EAAA,IAAI,CAAA,CAAE,UAAA,CAAW,GAAG,CAAA,IAAK,CAAC,CAAA,CAAE,UAAA,CAAW,IAAI,CAAA,IAAK,CAAC,CAAA,CAAE,UAAA,CAAW,KAAK,GAAG,OAAO,CAAA;AAC7E,EAAA,IAAI;AACF,IAAA,MAAM,CAAA,GAAI,IAAI,GAAA,CAAI,CAAC,CAAA;AACnB,IAAA,OAAO,EAAE,QAAA,KAAa,QAAA,IAAY,EAAE,QAAA,KAAa,OAAA,GAAU,EAAE,IAAA,GAA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;AAAA,IACf,WAAA,EAAa,eAAA;AAAA,IACb,eAAA,EAAiB,uBAAA;AAAA,IACjB,YAAA,EAAc,+BAAA;AAAA,IACd,MAAA,EAAQ,SAAA;AAAA,IACR,KAAA,EAAO,OAAA;AAAA,IACP,OAAA,EAAS,SAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,KAAA,EAAO,OAAA;AAAA,IACP,KAAA,EAAO,OAAA;AAAA,IACP,IAAA,EAAM,MAAA;AAAA,IACN,MAAA,EAAQ,QAAA;AAAA,IACR,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,UAAA;AAAA,IACV,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,UAAA;AAAA,IACV,OAAA,EAAS,SAAA;AAAA,IACT,KAAA,EAAO;AAAA;AAEX","file":"index.cjs","sourcesContent":["// @broberg/app-shell — the framework-free core of the fleet's app shell (F092).\n//\n// The shell every app in the fleet had been copying: sidebar + top bar +\n// notification bell + user menu. cardmem and trail each had one (\"ported from\n// trail\"), and helpdesk and the appkit starter would have made the third and\n// fourth. This file holds what does not depend on a framework: the navigation\n// data model, the notification contract and its sources, and the small rules\n// both the Preact and React parts must agree on.\n//\n// Christian, 4 Oct 2026: notifications are a STANDARD part of the template, not\n// an optional slot — so the contract and a default source live here, and a new\n// app gets a working notification centre by pointing one URL at its backend.\n\n// ── Navigation ─────────────────────────────────────────────────────────────\n\n/** One sidebar entry. `icon` is whatever your framework renders (an element). */\nexport interface NavItem<Icon = unknown> {\n id: string;\n label: string;\n href: string;\n icon?: Icon;\n /** A count shown on the item (99+ above 99). 0/undefined shows nothing. */\n badge?: number;\n /**\n * Sub-items, ONE level (F092.5). An item with children is a toggle that opens\n * and closes them, not a link; its own `href` is used only to decide whether\n * it is on the current path.\n */\n children?: NavItem<Icon>[];\n}\nexport interface NavGroup<Icon = unknown> {\n label: string;\n items: NavItem<Icon>[];\n}\n\n/**\n * Is this item the current page? Exact match for \"/\", otherwise the path is the\n * item or below it (\"/board/123\" is on \"/board\", \"/boardroom\" is not).\n */\nexport function isActivePath(href: string, currentPath: string): boolean {\n const path = (currentPath.split(/[?#]/)[0] || \"/\").replace(/\\/+$/, \"\") || \"/\";\n const target = (href.split(/[?#]/)[0] || \"/\").replace(/\\/+$/, \"\") || \"/\";\n if (target === \"/\") return path === \"/\";\n return path === target || path.startsWith(target + \"/\");\n}\n\n/**\n * A notification's `navigate` is SERVER DATA, and it ends in `location.assign`.\n * `javascript:` there runs code in the app, so only a same-site path or an\n * http(s) URL is followed; anything else returns null and the row just closes.\n */\nexport function safeNavigate(target: string | null | undefined): string | null {\n if (typeof target !== \"string\") return null;\n const t = target.trim();\n if (t.startsWith(\"/\") && !t.startsWith(\"//\") && !t.startsWith(\"/\\\\\")) return t;\n try {\n const u = new URL(t);\n return u.protocol === \"https:\" || u.protocol === \"http:\" ? u.href : null;\n } catch {\n return null;\n }\n}\n\n/**\n * F092.10 — is this link leaving the app? An http(s) link to another origin.\n * Paths, \"#…\", mailto:/tel: and the app's own origin are not. Owner decision\n * D-d28547: every external link opens in a new tab.\n */\nexport function isExternal(\n href: string | null | undefined,\n origin: string | undefined = typeof location !== \"undefined\" ? location.origin : undefined,\n): boolean {\n if (typeof href !== \"string\") return false;\n const h = href.trim();\n if (!origin) return /^(https?:)?\\/\\//i.test(h); // no page to compare with: absolute = external\n let u: URL;\n try {\n u = new URL(h, origin);\n } catch {\n return false;\n }\n return (u.protocol === \"http:\" || u.protocol === \"https:\") && u.origin !== origin;\n}\n\n/**\n * The label of the nav item the user is on, for the content header (F092.4).\n * Sub-items count, and the most specific match wins: on \"/models/genesis\" a\n * \"Genesis\" child beats its \"Models\" parent.\n */\nexport function activeNavLabel<Icon>(\n groups: NavGroup<Icon>[],\n footer: NavItem<Icon>[] | undefined,\n currentPath: string,\n): string | undefined {\n let best: { label: string; len: number } | undefined;\n const visit = (it: NavItem<Icon>) => {\n if (it.href && isActivePath(it.href, currentPath)) {\n const len = it.href.length;\n if (!best || len > best.len) best = { label: it.label, len };\n }\n it.children?.forEach(visit);\n };\n for (const g of groups) g.items.forEach(visit);\n footer?.forEach(visit);\n return best?.label;\n}\n\n/** \"99+\" above 99, nothing for 0 or less. */\nexport function badgeLabel(n: number | undefined): string | null {\n if (!n || n <= 0) return null;\n return n > 99 ? \"99+\" : String(n);\n}\n\n// ── Persisted UI state ─────────────────────────────────────────────────────\n\n/** Read a boolean flag from localStorage; storage errors read as `fallback`. */\nexport function readFlag(key: string, fallback: boolean): boolean {\n try {\n const v = typeof localStorage === \"undefined\" ? null : localStorage.getItem(key);\n return v === null ? fallback : v === \"1\";\n } catch {\n return fallback;\n }\n}\nexport function writeFlag(key: string, value: boolean): void {\n try {\n if (typeof localStorage !== \"undefined\") localStorage.setItem(key, value ? \"1\" : \"0\");\n } catch {\n /* private mode / quota: the UI still works, it just does not remember */\n }\n}\nexport function readSet(key: string): Set<string> {\n try {\n const raw = typeof localStorage === \"undefined\" ? null : localStorage.getItem(key);\n const v = raw ? (JSON.parse(raw) as unknown) : [];\n return new Set(Array.isArray(v) ? v.filter((x): x is string => typeof x === \"string\") : []);\n } catch {\n return new Set();\n }\n}\nexport function writeSet(key: string, value: Set<string>): void {\n try {\n if (typeof localStorage !== \"undefined\") localStorage.setItem(key, JSON.stringify([...value]));\n } catch {\n /* see writeFlag */\n }\n}\n\n// ── Avatar ─────────────────────────────────────────────────────────────────\n\n/**\n * Two initials for the avatar fallback: first letter of the first and the last\n * word, upper-cased. One word gives one letter; nothing gives \"?\".\n *\n * There is deliberately no Gravatar here (owner decision D-1dc849): the avatar\n * is the Broberg ID `picture`, and without one, initials. Gravatar would send a\n * hash of the user's email to a US service on every render.\n */\nexport function initials(name: string | undefined, email?: string): string {\n const source = (name ?? \"\").trim() || (email ?? \"\").split(\"@\")[0] || \"\";\n const words = source.split(/[\\s._-]+/).filter(Boolean);\n if (words.length === 0) return \"?\";\n const first = words[0]![0] ?? \"\";\n const last = words.length > 1 ? words[words.length - 1]![0] ?? \"\" : \"\";\n return (first + last).toUpperCase() || \"?\";\n}\n\n// ── Notifications ──────────────────────────────────────────────────────────\n//\n// REUSE, NOT A SECOND CONTRACT. The fleet already agreed the notification shape\n// in @broberg/notifications (F074): `NotificationRow` — the same field names\n// @broberg/webpush sends, end to end — and the server core that owns the ONE\n// counting rule. The shell's bell renders that row and drives its panel with\n// that package's `createBellShell`, so a server built on `createNotifications`\n// and this bell speak the same language without an adapter.\n//\n// Christian, 4 Oct 2026: notifications are a STANDARD part of the template. So\n// a source, and a default one, ship here: point one URL at your backend.\n\nimport type { NotificationRow } from \"@broberg/notifications/types\";\nexport type { NotificationRow } from \"@broberg/notifications/types\";\n\n/** Where the bell gets its data. Swap it to point at any backend. */\nexport interface NotificationSource {\n /** The rows to show (newest first). */\n loadRows(): Promise<NotificationRow[]>;\n /** THE count — your server's, which may exclude muted kinds (F074's counting rule). */\n countUnseen(): Promise<number>;\n /** Returns the ids that actually transitioned to seen. */\n markSeen(ids: readonly string[]): Promise<string[]>;\n markAllSeen(): Promise<string[]>;\n /** Called with a callback that re-counts; return an unsubscribe. Optional. */\n subscribe?(onChange: () => void): () => void;\n}\n\n/**\n * The default source: a URL on your own backend, shaped after\n * @broberg/notifications' server core so `createNotifications` sits right\n * behind it.\n *\n * GET {url} → { items: NotificationRow[], unseen: number }\n * POST {url}/seen { ids: string[] } → { clearedIds: string[], count: number }\n * POST {url}/seen-all → { clearedIds: string[], count: number }\n *\n * It re-counts when the window regains focus or the tab becomes visible, and on\n * a timer (default 60 s). A failed GET THROWS — the bell shows «could not\n * load», never an empty list: \"could not fetch\" and \"nothing new\" must not look\n * the same.\n */\nexport function createFetchNotificationSource(opts: {\n url: string;\n fetch?: typeof fetch;\n /** Re-count interval in ms. 0 turns it off. Default 60 000. */\n pollMs?: number;\n credentials?: RequestCredentials;\n}): NotificationSource {\n const base = opts.url.replace(/\\/+$/, \"\");\n const doFetch = (input: string, init?: RequestInit) =>\n (opts.fetch ?? fetch)(input, { credentials: opts.credentials ?? \"include\", ...init });\n const get = async (): Promise<{ items: NotificationRow[]; unseen: number }> => {\n const res = await doFetch(base, { headers: { accept: \"application/json\" } });\n if (!res.ok) throw new Error(`HTTP ${res.status}`);\n const body = (await res.json().catch(() => null)) as { items?: unknown; unseen?: unknown } | null;\n if (!body || !Array.isArray(body.items)) throw new Error(\"response has no items array\");\n const items = body.items as NotificationRow[];\n const unseen = typeof body.unseen === \"number\" ? body.unseen : items.filter((n) => n.seenAt == null).length;\n return { items, unseen };\n };\n const post = async (path: string, body?: unknown): Promise<string[]> => {\n const res = await doFetch(`${base}${path}`, {\n method: \"POST\",\n headers: body === undefined ? undefined : { \"content-type\": \"application/json\" },\n body: body === undefined ? undefined : JSON.stringify(body),\n });\n if (!res.ok) throw new Error(`HTTP ${res.status}`);\n const r = (await res.json().catch(() => ({}))) as { clearedIds?: unknown };\n return Array.isArray(r.clearedIds) ? (r.clearedIds as string[]) : [];\n };\n return {\n loadRows: async () => (await get()).items,\n countUnseen: async () => (await get()).unseen,\n markSeen: (ids) => post(\"/seen\", { ids }),\n markAllSeen: () => post(\"/seen-all\"),\n subscribe(onChange) {\n if (typeof window === \"undefined\") return () => {};\n const onVisible = () => {\n if (document.visibilityState === \"visible\") onChange();\n };\n window.addEventListener(\"focus\", onChange);\n document.addEventListener(\"visibilitychange\", onVisible);\n const ms = opts.pollMs ?? 60_000;\n const timer = ms > 0 ? setInterval(onChange, ms) : null;\n return () => {\n window.removeEventListener(\"focus\", onChange);\n document.removeEventListener(\"visibilitychange\", onVisible);\n if (timer) clearInterval(timer);\n };\n },\n };\n}\n\n/** An in-memory source for demos and tests. */\nexport function createMemoryNotificationSource(initial: NotificationRow[] = []): NotificationSource & {\n push(n: NotificationRow): void;\n rows(): NotificationRow[];\n} {\n let rows = initial.map((n) => ({ ...n }));\n const listeners = new Set<() => void>();\n const emit = () => listeners.forEach((l) => l());\n const mark = (pred: (n: NotificationRow) => boolean): string[] => {\n const now = Date.now();\n const cleared: string[] = [];\n rows = rows.map((n) => {\n if (n.seenAt == null && pred(n)) {\n cleared.push(n.id);\n return { ...n, seenAt: now };\n }\n return n;\n });\n if (cleared.length) emit();\n return cleared;\n };\n return {\n loadRows: async () => rows.map((n) => ({ ...n })),\n countUnseen: async () => rows.filter((n) => n.seenAt == null).length,\n markSeen: async (ids) => mark((n) => ids.includes(n.id)),\n markAllSeen: async () => mark(() => true),\n subscribe(onChange) {\n listeners.add(onChange);\n return () => listeners.delete(onChange);\n },\n push(n) {\n rows = [n, ...rows];\n emit();\n },\n rows: () => rows.map((n) => ({ ...n })),\n };\n}\n\n/** \"nu\", \"5 min\", \"3 t\", \"i går\", \"4 d\" (da) or the English equivalents. */\nexport function relativeTime(ts: string | number, lang: \"da\" | \"en\", now = Date.now()): string {\n const ms = typeof ts === \"number\" ? ts : Date.parse(ts);\n if (!Number.isFinite(ms)) return \"\";\n const m = Math.floor((now - ms) / 60_000);\n if (m < 1) return lang === \"da\" ? \"nu\" : \"now\";\n if (m < 60) return `${m} min`;\n const h = Math.floor(m / 60);\n if (h < 24) return lang === \"da\" ? `${h} t` : `${h} h`;\n const d = Math.floor(h / 24);\n if (d === 1) return lang === \"da\" ? \"i går\" : \"yesterday\";\n return `${d} d`;\n}\n\n// ── Text ───────────────────────────────────────────────────────────────────\n\nexport const TEXT = {\n da: {\n openMenu: \"Åbn menu\",\n closeMenu: \"Luk menu\",\n home: \"Forside\",\n language: \"Sprog\",\n couldNotMarkAll: \"Kunne ikke markere alle som læst. Prøv igen.\",\n collapse: \"Skjul sidemenu\",\n expand: \"Vis sidemenu\",\n notifications: \"Notifikationer\",\n markAllRead: \"Markér alle læst\",\n noNotifications: \"Ingen notifikationer endnu.\",\n couldNotLoad: \"Kunne ikke hente notifikationer.\",\n seeAll: \"Vis alle\",\n close: \"Luk\",\n account: \"Konto\",\n signOut: \"Log ud\",\n theme: \"Tema\",\n light: \"Lys\",\n dark: \"Mørk\",\n system: \"System\",\n palette: \"Palet\",\n surfaces: \"Flader\",\n flat: \"Flade\",\n layered: \"Lag\",\n backdrop: \"Baggrund\",\n neurons: \"Neuroner\",\n plain: \"Ren\",\n },\n en: {\n openMenu: \"Open menu\",\n closeMenu: \"Close menu\",\n home: \"Home\",\n language: \"Language\",\n couldNotMarkAll: \"Could not mark all as read. Try again.\",\n collapse: \"Hide sidebar\",\n expand: \"Show sidebar\",\n notifications: \"Notifications\",\n markAllRead: \"Mark all read\",\n noNotifications: \"No notifications yet.\",\n couldNotLoad: \"Could not load notifications.\",\n seeAll: \"See all\",\n close: \"Close\",\n account: \"Account\",\n signOut: \"Sign out\",\n theme: \"Theme\",\n light: \"Light\",\n dark: \"Dark\",\n system: \"System\",\n palette: \"Palette\",\n surfaces: \"Surfaces\",\n flat: \"Flat\",\n layered: \"Layered\",\n backdrop: \"Backdrop\",\n neurons: \"Neurons\",\n plain: \"Plain\",\n },\n} as const;\nexport type Lang = keyof typeof TEXT;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AAuCO,SAAS,YAAA,CAAa,MAAc,WAAA,EAA8B;AACvE,EAAA,MAAM,IAAA,GAAA,CAAQ,WAAA,CAAY,KAAA,CAAM,MAAM,CAAA,CAAE,CAAC,CAAA,IAAK,GAAA,EAAK,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA,IAAK,GAAA;AAC1E,EAAA,MAAM,MAAA,GAAA,CAAU,IAAA,CAAK,KAAA,CAAM,MAAM,CAAA,CAAE,CAAC,CAAA,IAAK,GAAA,EAAK,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA,IAAK,GAAA;AACrE,EAAA,IAAI,MAAA,KAAW,GAAA,EAAK,OAAO,IAAA,KAAS,GAAA;AACpC,EAAA,OAAO,IAAA,KAAS,MAAA,IAAU,IAAA,CAAK,UAAA,CAAW,SAAS,GAAG,CAAA;AACxD;AAOO,SAAS,aAAa,MAAA,EAAkD;AAC7E,EAAA,IAAI,OAAO,MAAA,KA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YAAA,EAAc,+BAAA;AAAA,IACd,MAAA,EAAQ,SAAA;AAAA,IACR,KAAA,EAAO,OAAA;AAAA,IACP,OAAA,EAAS,SAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,KAAA,EAAO,OAAA;AAAA,IACP,KAAA,EAAO,OAAA;AAAA,IACP,IAAA,EAAM,MAAA;AAAA,IACN,MAAA,EAAQ,QAAA;AAAA,IACR,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,UAAA;AAAA,IACV,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,UAAA;AAAA,IACV,OAAA,EAAS,SAAA;AAAA,IACT,KAAA,EAAO,OAAA;AAAA,IACP,IAAA,EAAM,MAAA;AAAA,IACN,KAAA,EAAO,OAAA;AAAA,IACP,IAAA,EAAM,MAAA;AAAA,IACN,MAAA,EAAQ,cAAA;AAAA,IACR,KAAA,EAAO,OAAA;AAAA,IACP,cAAA,EAAgB,uBAAA;AAAA,IAChB,mBAAA,EAAqB,8BAAA;AAAA,IACrB,YAAA,EAAc,4BAAA;AAAA,IACd,MAAA,EAAQ,+BAAA;AAAA,IACR,WAAA,EAAa,eAAA;AAAA,IACb,aAAA,EAAe,gBAAA;AAAA,IACf,aAAA,EAAe,gBAAA;AAAA,IACf,oBAAA,EAAsB,sBAAA;AAAA,IACtB,MAAA,EAAQ,QAAA;AAAA,IACR,MAAA,EAAQ,QAAA;AAAA,IACR,YAAA,EAAc,eAAA;AAAA,IACd,cAAA,EAAgB,iBAAA;AAAA,IAChB,eAAA,EAAiB,+CAAA;AAAA,IACjB,gBAAA,EAAkB,mCAAA;AAAA,IAClB,WAAA,EAAa;AAAA;AAEjB","file":"index.cjs","sourcesContent":["// @broberg/app-shell — the framework-free core of the fleet's app shell (F092).\n//\n// The shell every app in the fleet had been copying: sidebar + top bar +\n// notification bell + user menu. cardmem and trail each had one (\"ported from\n// trail\"), and helpdesk and the appkit starter would have made the third and\n// fourth. This file holds what does not depend on a framework: the navigation\n// data model, the notification contract and its sources, and the small rules\n// both the Preact and React parts must agree on.\n//\n// Christian, 4 Oct 2026: notifications are a STANDARD part of the template, not\n// an optional slot — so the contract and a default source live here, and a new\n// app gets a working notification centre by pointing one URL at its backend.\n\n// ── Navigation ─────────────────────────────────────────────────────────────\n\n/** One sidebar entry. `icon` is whatever your framework renders (an element). */\nexport interface NavItem<Icon = unknown> {\n id: string;\n label: string;\n href: string;\n icon?: Icon;\n /** A count shown on the item (99+ above 99). 0/undefined shows nothing. */\n badge?: number;\n /**\n * Sub-items, ONE level (F092.5). An item with children is a toggle that opens\n * and closes them, not a link; its own `href` is used only to decide whether\n * it is on the current path.\n */\n children?: NavItem<Icon>[];\n}\nexport interface NavGroup<Icon = unknown> {\n label: string;\n items: NavItem<Icon>[];\n}\n\n/**\n * Is this item the current page? Exact match for \"/\", otherwise the path is the\n * item or below it (\"/board/123\" is on \"/board\", \"/boardroom\" is not).\n */\nexport function isActivePath(href: string, currentPath: string): boolean {\n const path = (currentPath.split(/[?#]/)[0] || \"/\").replace(/\\/+$/, \"\") || \"/\";\n const target = (href.split(/[?#]/)[0] || \"/\").replace(/\\/+$/, \"\") || \"/\";\n if (target === \"/\") return path === \"/\";\n return path === target || path.startsWith(target + \"/\");\n}\n\n/**\n * A notification's `navigate` is SERVER DATA, and it ends in `location.assign`.\n * `javascript:` there runs code in the app, so only a same-site path or an\n * http(s) URL is followed; anything else returns null and the row just closes.\n */\nexport function safeNavigate(target: string | null | undefined): string | null {\n if (typeof target !== \"string\") return null;\n const t = target.trim();\n if (t.startsWith(\"/\") && !t.startsWith(\"//\") && !t.startsWith(\"/\\\\\")) return t;\n try {\n const u = new URL(t);\n return u.protocol === \"https:\" || u.protocol === \"http:\" ? u.href : null;\n } catch {\n return null;\n }\n}\n\n/**\n * F092.10 — is this link leaving the app? An http(s) link to another origin.\n * Paths, \"#…\", mailto:/tel: and the app's own origin are not. Owner decision\n * D-d28547: every external link opens in a new tab.\n */\nexport function isExternal(\n href: string | null | undefined,\n origin: string | undefined = typeof location !== \"undefined\" ? location.origin : undefined,\n): boolean {\n if (typeof href !== \"string\") return false;\n const h = href.trim();\n if (!origin) return /^(https?:)?\\/\\//i.test(h); // no page to compare with: absolute = external\n let u: URL;\n try {\n u = new URL(h, origin);\n } catch {\n return false;\n }\n return (u.protocol === \"http:\" || u.protocol === \"https:\") && u.origin !== origin;\n}\n\n/**\n * The label of the nav item the user is on, for the content header (F092.4).\n * Sub-items count, and the most specific match wins: on \"/models/genesis\" a\n * \"Genesis\" child beats its \"Models\" parent.\n */\nexport function activeNavLabel<Icon>(\n groups: NavGroup<Icon>[],\n footer: NavItem<Icon>[] | undefined,\n currentPath: string,\n): string | undefined {\n let best: { label: string; len: number } | undefined;\n const visit = (it: NavItem<Icon>) => {\n if (it.href && isActivePath(it.href, currentPath)) {\n const len = it.href.length;\n if (!best || len > best.len) best = { label: it.label, len };\n }\n it.children?.forEach(visit);\n };\n for (const g of groups) g.items.forEach(visit);\n footer?.forEach(visit);\n return best?.label;\n}\n\n/** \"99+\" above 99, nothing for 0 or less. */\nexport function badgeLabel(n: number | undefined): string | null {\n if (!n || n <= 0) return null;\n return n > 99 ? \"99+\" : String(n);\n}\n\n// ── Persisted UI state ─────────────────────────────────────────────────────\n\n/** Read a boolean flag from localStorage; storage errors read as `fallback`. */\nexport function readFlag(key: string, fallback: boolean): boolean {\n try {\n const v = typeof localStorage === \"undefined\" ? null : localStorage.getItem(key);\n return v === null ? fallback : v === \"1\";\n } catch {\n return fallback;\n }\n}\nexport function writeFlag(key: string, value: boolean): void {\n try {\n if (typeof localStorage !== \"undefined\") localStorage.setItem(key, value ? \"1\" : \"0\");\n } catch {\n /* private mode / quota: the UI still works, it just does not remember */\n }\n}\nexport function readSet(key: string): Set<string> {\n try {\n const raw = typeof localStorage === \"undefined\" ? null : localStorage.getItem(key);\n const v = raw ? (JSON.parse(raw) as unknown) : [];\n return new Set(Array.isArray(v) ? v.filter((x): x is string => typeof x === \"string\") : []);\n } catch {\n return new Set();\n }\n}\nexport function writeSet(key: string, value: Set<string>): void {\n try {\n if (typeof localStorage !== \"undefined\") localStorage.setItem(key, JSON.stringify([...value]));\n } catch {\n /* see writeFlag */\n }\n}\n\n// ── Avatar ─────────────────────────────────────────────────────────────────\n\n/**\n * Two initials for the avatar fallback: first letter of the first and the last\n * word, upper-cased. One word gives one letter; nothing gives \"?\".\n *\n * There is deliberately no Gravatar here (owner decision D-1dc849): the avatar\n * is the Broberg ID `picture`, and without one, initials. Gravatar would send a\n * hash of the user's email to a US service on every render.\n */\nexport function initials(name: string | undefined, email?: string): string {\n const source = (name ?? \"\").trim() || (email ?? \"\").split(\"@\")[0] || \"\";\n const words = source.split(/[\\s._-]+/).filter(Boolean);\n if (words.length === 0) return \"?\";\n const first = words[0]![0] ?? \"\";\n const last = words.length > 1 ? words[words.length - 1]![0] ?? \"\" : \"\";\n return (first + last).toUpperCase() || \"?\";\n}\n\n// ── Notifications ──────────────────────────────────────────────────────────\n//\n// REUSE, NOT A SECOND CONTRACT. The fleet already agreed the notification shape\n// in @broberg/notifications (F074): `NotificationRow` — the same field names\n// @broberg/webpush sends, end to end — and the server core that owns the ONE\n// counting rule. The shell's bell renders that row and drives its panel with\n// that package's `createBellShell`, so a server built on `createNotifications`\n// and this bell speak the same language without an adapter.\n//\n// Christian, 4 Oct 2026: notifications are a STANDARD part of the template. So\n// a source, and a default one, ship here: point one URL at your backend.\n\nimport type { NotificationRow } from \"@broberg/notifications/types\";\nexport type { NotificationRow } from \"@broberg/notifications/types\";\n\n/** Where the bell gets its data. Swap it to point at any backend. */\nexport interface NotificationSource {\n /** The rows to show (newest first). */\n loadRows(): Promise<NotificationRow[]>;\n /** THE count — your server's, which may exclude muted kinds (F074's counting rule). */\n countUnseen(): Promise<number>;\n /** Returns the ids that actually transitioned to seen. */\n markSeen(ids: readonly string[]): Promise<string[]>;\n markAllSeen(): Promise<string[]>;\n /** Called with a callback that re-counts; return an unsubscribe. Optional. */\n subscribe?(onChange: () => void): () => void;\n}\n\n/**\n * The default source: a URL on your own backend, shaped after\n * @broberg/notifications' server core so `createNotifications` sits right\n * behind it.\n *\n * GET {url} → { items: NotificationRow[], unseen: number }\n * POST {url}/seen { ids: string[] } → { clearedIds: string[], count: number }\n * POST {url}/seen-all → { clearedIds: string[], count: number }\n *\n * It re-counts when the window regains focus or the tab becomes visible, and on\n * a timer (default 60 s). A failed GET THROWS — the bell shows «could not\n * load», never an empty list: \"could not fetch\" and \"nothing new\" must not look\n * the same.\n */\nexport function createFetchNotificationSource(opts: {\n url: string;\n fetch?: typeof fetch;\n /** Re-count interval in ms. 0 turns it off. Default 60 000. */\n pollMs?: number;\n credentials?: RequestCredentials;\n}): NotificationSource {\n const base = opts.url.replace(/\\/+$/, \"\");\n const doFetch = (input: string, init?: RequestInit) =>\n (opts.fetch ?? fetch)(input, { credentials: opts.credentials ?? \"include\", ...init });\n const get = async (): Promise<{ items: NotificationRow[]; unseen: number }> => {\n const res = await doFetch(base, { headers: { accept: \"application/json\" } });\n if (!res.ok) throw new Error(`HTTP ${res.status}`);\n const body = (await res.json().catch(() => null)) as { items?: unknown; unseen?: unknown } | null;\n if (!body || !Array.isArray(body.items)) throw new Error(\"response has no items array\");\n const items = body.items as NotificationRow[];\n const unseen = typeof body.unseen === \"number\" ? body.unseen : items.filter((n) => n.seenAt == null).length;\n return { items, unseen };\n };\n const post = async (path: string, body?: unknown): Promise<string[]> => {\n const res = await doFetch(`${base}${path}`, {\n method: \"POST\",\n headers: body === undefined ? undefined : { \"content-type\": \"application/json\" },\n body: body === undefined ? undefined : JSON.stringify(body),\n });\n if (!res.ok) throw new Error(`HTTP ${res.status}`);\n const r = (await res.json().catch(() => ({}))) as { clearedIds?: unknown };\n return Array.isArray(r.clearedIds) ? (r.clearedIds as string[]) : [];\n };\n return {\n loadRows: async () => (await get()).items,\n countUnseen: async () => (await get()).unseen,\n markSeen: (ids) => post(\"/seen\", { ids }),\n markAllSeen: () => post(\"/seen-all\"),\n subscribe(onChange) {\n if (typeof window === \"undefined\") return () => {};\n const onVisible = () => {\n if (document.visibilityState === \"visible\") onChange();\n };\n window.addEventListener(\"focus\", onChange);\n document.addEventListener(\"visibilitychange\", onVisible);\n const ms = opts.pollMs ?? 60_000;\n const timer = ms > 0 ? setInterval(onChange, ms) : null;\n return () => {\n window.removeEventListener(\"focus\", onChange);\n document.removeEventListener(\"visibilitychange\", onVisible);\n if (timer) clearInterval(timer);\n };\n },\n };\n}\n\n/** An in-memory source for demos and tests. */\nexport function createMemoryNotificationSource(initial: NotificationRow[] = []): NotificationSource & {\n push(n: NotificationRow): void;\n rows(): NotificationRow[];\n} {\n let rows = initial.map((n) => ({ ...n }));\n const listeners = new Set<() => void>();\n const emit = () => listeners.forEach((l) => l());\n const mark = (pred: (n: NotificationRow) => boolean): string[] => {\n const now = Date.now();\n const cleared: string[] = [];\n rows = rows.map((n) => {\n if (n.seenAt == null && pred(n)) {\n cleared.push(n.id);\n return { ...n, seenAt: now };\n }\n return n;\n });\n if (cleared.length) emit();\n return cleared;\n };\n return {\n loadRows: async () => rows.map((n) => ({ ...n })),\n countUnseen: async () => rows.filter((n) => n.seenAt == null).length,\n markSeen: async (ids) => mark((n) => ids.includes(n.id)),\n markAllSeen: async () => mark(() => true),\n subscribe(onChange) {\n listeners.add(onChange);\n return () => listeners.delete(onChange);\n },\n push(n) {\n rows = [n, ...rows];\n emit();\n },\n rows: () => rows.map((n) => ({ ...n })),\n };\n}\n\n/** \"nu\", \"5 min\", \"3 t\", \"i går\", \"4 d\" (da) or the English equivalents. */\nexport function relativeTime(ts: string | number, lang: \"da\" | \"en\", now = Date.now()): string {\n const ms = typeof ts === \"number\" ? ts : Date.parse(ts);\n if (!Number.isFinite(ms)) return \"\";\n const m = Math.floor((now - ms) / 60_000);\n if (m < 1) return lang === \"da\" ? \"nu\" : \"now\";\n if (m < 60) return `${m} min`;\n const h = Math.floor(m / 60);\n if (h < 24) return lang === \"da\" ? `${h} t` : `${h} h`;\n const d = Math.floor(h / 24);\n if (d === 1) return lang === \"da\" ? \"i går\" : \"yesterday\";\n return `${d} d`;\n}\n\n// ── Account page (F095.3) ─────────────────────────────────────────────────\n//\n// The user edits their own name and picture inside the app. The app's backend\n// (@broberg/sso's `accountRoutes()`, mounted on /api/account) talks to Broberg\n// ID; this package only talks to that backend, through an adapter, and never\n// imports @broberg/sso.\n\n/** What every account call resolves to — the profile AS THE SERVER NOW HOLDS IT. */\nexport interface AccountProfile {\n sub: string;\n name: string | null;\n picture: string | null;\n email: string | null;\n /** Broberg ID's own account page (password, passkeys, sessions). */\n account_url: string;\n}\n\n/** Where the account page gets and saves the profile. Swap it to point anywhere. */\nexport interface AccountAdapter {\n load(): Promise<AccountProfile>;\n saveName(name: string): Promise<AccountProfile>;\n uploadAvatar(file: Blob): Promise<AccountProfile>;\n removeAvatar(): Promise<AccountProfile>;\n}\n\n/** A failed account call: the HTTP status and the server's `error` code, if any. */\nexport class AccountError extends Error {\n constructor(\n readonly status: number,\n readonly code?: string,\n ) {\n super(code ? `HTTP ${status} ${code}` : `HTTP ${status}`);\n this.name = \"AccountError\";\n }\n}\n\nexport const AVATAR_TYPES = [\"image/png\", \"image/jpeg\", \"image/webp\"] as const;\nexport const AVATAR_MAX_BYTES = 2 * 1024 * 1024;\n\n/** Checked BEFORE uploading, so a file the server will refuse is never sent. */\nexport function checkAvatarFile(file: { size: number; type: string }): \"tooLarge\" | \"wrongType\" | null {\n if (!(AVATAR_TYPES as readonly string[]).includes(file.type)) return \"wrongType\";\n if (file.size > AVATAR_MAX_BYTES) return \"tooLarge\";\n return null;\n}\n\n/**\n * What a failed call means for the page. `reauth` = the user's session or its\n * scope does not allow the change (401, or 403 insufficient_scope): signing in\n * again is the fix, so the page says that instead of «try again».\n */\nexport function accountErrorKind(err: unknown): \"reauth\" | \"tooLarge\" | \"wrongType\" | \"other\" {\n if (!(err instanceof AccountError)) return \"other\";\n if (err.status === 401) return \"reauth\";\n if (err.status === 403 && err.code === \"insufficient_scope\") return \"reauth\";\n if (err.status === 413) return \"tooLarge\";\n if (err.status === 415) return \"wrongType\";\n return \"other\";\n}\n\n/**\n * The default adapter: the app's own backend, shaped after @broberg/sso's\n * `accountRoutes()`.\n *\n * GET {url}/profile → AccountProfile\n * POST {url}/profile {name} → AccountProfile\n * POST {url}/profile/avatar (raw bytes, Content-Type = the image's) → AccountProfile\n * POST {url}/profile/avatar/remove → AccountProfile\n *\n * A non-2xx THROWS an AccountError — a failed save must never look like a\n * saved one.\n */\nexport function createFetchAccountAdapter(opts: { url?: string; fetch?: typeof fetch; credentials?: RequestCredentials } = {}): AccountAdapter {\n const base = (opts.url ?? \"/api/account\").replace(/\\/+$/, \"\");\n const call = async (path: string, init?: RequestInit): Promise<AccountProfile> => {\n const res = await (opts.fetch ?? fetch)(`${base}${path}`, {\n credentials: opts.credentials ?? \"same-origin\",\n ...init,\n headers: { accept: \"application/json\", ...(init?.headers as Record<string, string> | undefined) },\n });\n const body = (await res.json().catch(() => null)) as Record<string, unknown> | null;\n if (!res.ok) throw new AccountError(res.status, typeof body?.error === \"string\" ? body.error : undefined);\n if (!body || typeof body.sub !== \"string\") throw new AccountError(res.status, \"bad_response\");\n return body as unknown as AccountProfile;\n };\n return {\n load: () => call(\"/profile\"),\n saveName: (name) =>\n call(\"/profile\", { method: \"POST\", headers: { \"content-type\": \"application/json\" }, body: JSON.stringify({ name }) }),\n uploadAvatar: (file) =>\n call(\"/profile/avatar\", { method: \"POST\", headers: { \"content-type\": file.type }, body: file }),\n removeAvatar: () => call(\"/profile/avatar/remove\", { method: \"POST\" }),\n };\n}\n\n// ── Text ───────────────────────────────────────────────────────────────────\n\nexport const TEXT = {\n da: {\n openMenu: \"Åbn menu\",\n closeMenu: \"Luk menu\",\n home: \"Forside\",\n language: \"Sprog\",\n couldNotMarkAll: \"Kunne ikke markere alle som læst. Prøv igen.\",\n collapse: \"Skjul sidemenu\",\n expand: \"Vis sidemenu\",\n notifications: \"Notifikationer\",\n markAllRead: \"Markér alle læst\",\n noNotifications: \"Ingen notifikationer endnu.\",\n couldNotLoad: \"Kunne ikke hente notifikationer.\",\n seeAll: \"Vis alle\",\n close: \"Luk\",\n account: \"Konto\",\n signOut: \"Log ud\",\n theme: \"Tema\",\n light: \"Lys\",\n dark: \"Mørk\",\n system: \"System\",\n palette: \"Palet\",\n surfaces: \"Flader\",\n flat: \"Flade\",\n layered: \"Lag\",\n backdrop: \"Baggrund\",\n neurons: \"Neuroner\",\n plain: \"Ren\",\n name: \"Navn\",\n email: \"E-mail\",\n save: \"Gem\",\n saving: \"Gemmer…\",\n saved: \"Gemt\",\n loadingProfile: \"Henter profil…\",\n couldNotLoadProfile: \"Kunne ikke hente din profil.\",\n couldNotSave: \"Kunne ikke gemme. Prøv igen.\",\n reauth: \"Log ind igen for at rette\",\n signInAgain: \"Log ind igen\",\n changePicture: \"Skift billede\",\n removePicture: \"Fjern billede\",\n confirmRemovePicture: \"Fjern dit billede?\",\n remove: \"Fjern\",\n cancel: \"Annuller\",\n pictureSaved: \"Billedet er gemt\",\n pictureRemoved: \"Billedet er fjernet\",\n pictureTooLarge: \"Billedet er for stort — højst 2 MB.\",\n pictureWrongType: \"Vælg et PNG-, JPEG- eller WebP-billede.\",\n bidSecurity: \"Sikkerhed i Broberg ID\",\n },\n en: {\n openMenu: \"Open menu\",\n closeMenu: \"Close menu\",\n home: \"Home\",\n language: \"Language\",\n couldNotMarkAll: \"Could not mark all as read. Try again.\",\n collapse: \"Hide sidebar\",\n expand: \"Show sidebar\",\n notifications: \"Notifications\",\n markAllRead: \"Mark all read\",\n noNotifications: \"No notifications yet.\",\n couldNotLoad: \"Could not load notifications.\",\n seeAll: \"See all\",\n close: \"Close\",\n account: \"Account\",\n signOut: \"Sign out\",\n theme: \"Theme\",\n light: \"Light\",\n dark: \"Dark\",\n system: \"System\",\n palette: \"Palette\",\n surfaces: \"Surfaces\",\n flat: \"Flat\",\n layered: \"Layered\",\n backdrop: \"Backdrop\",\n neurons: \"Neurons\",\n plain: \"Plain\",\n name: \"Name\",\n email: \"Email\",\n save: \"Save\",\n saving: \"Saving…\",\n saved: \"Saved\",\n loadingProfile: \"Loading profile…\",\n couldNotLoadProfile: \"Could not load your profile.\",\n couldNotSave: \"Could not save. Try again.\",\n reauth: \"Sign in again to make changes\",\n signInAgain: \"Sign in again\",\n changePicture: \"Change picture\",\n removePicture: \"Remove picture\",\n confirmRemovePicture: \"Remove your picture?\",\n remove: \"Remove\",\n cancel: \"Cancel\",\n pictureSaved: \"Picture saved\",\n pictureRemoved: \"Picture removed\",\n pictureTooLarge: \"The picture is too large — 2 MB at most.\",\n pictureWrongType: \"Choose a PNG, JPEG or WebP image.\",\n bidSecurity: \"Security in Broberg ID\",\n },\n} as const;\nexport type Lang = keyof typeof TEXT;\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -100,6 +100,58 @@ declare function createMemoryNotificationSource(initial?: NotificationRow[]): No
|
|
|
100
100
|
};
|
|
101
101
|
/** "nu", "5 min", "3 t", "i går", "4 d" (da) or the English equivalents. */
|
|
102
102
|
declare function relativeTime(ts: string | number, lang: "da" | "en", now?: number): string;
|
|
103
|
+
/** What every account call resolves to — the profile AS THE SERVER NOW HOLDS IT. */
|
|
104
|
+
interface AccountProfile {
|
|
105
|
+
sub: string;
|
|
106
|
+
name: string | null;
|
|
107
|
+
picture: string | null;
|
|
108
|
+
email: string | null;
|
|
109
|
+
/** Broberg ID's own account page (password, passkeys, sessions). */
|
|
110
|
+
account_url: string;
|
|
111
|
+
}
|
|
112
|
+
/** Where the account page gets and saves the profile. Swap it to point anywhere. */
|
|
113
|
+
interface AccountAdapter {
|
|
114
|
+
load(): Promise<AccountProfile>;
|
|
115
|
+
saveName(name: string): Promise<AccountProfile>;
|
|
116
|
+
uploadAvatar(file: Blob): Promise<AccountProfile>;
|
|
117
|
+
removeAvatar(): Promise<AccountProfile>;
|
|
118
|
+
}
|
|
119
|
+
/** A failed account call: the HTTP status and the server's `error` code, if any. */
|
|
120
|
+
declare class AccountError extends Error {
|
|
121
|
+
readonly status: number;
|
|
122
|
+
readonly code?: string | undefined;
|
|
123
|
+
constructor(status: number, code?: string | undefined);
|
|
124
|
+
}
|
|
125
|
+
declare const AVATAR_TYPES: readonly ["image/png", "image/jpeg", "image/webp"];
|
|
126
|
+
declare const AVATAR_MAX_BYTES: number;
|
|
127
|
+
/** Checked BEFORE uploading, so a file the server will refuse is never sent. */
|
|
128
|
+
declare function checkAvatarFile(file: {
|
|
129
|
+
size: number;
|
|
130
|
+
type: string;
|
|
131
|
+
}): "tooLarge" | "wrongType" | null;
|
|
132
|
+
/**
|
|
133
|
+
* What a failed call means for the page. `reauth` = the user's session or its
|
|
134
|
+
* scope does not allow the change (401, or 403 insufficient_scope): signing in
|
|
135
|
+
* again is the fix, so the page says that instead of «try again».
|
|
136
|
+
*/
|
|
137
|
+
declare function accountErrorKind(err: unknown): "reauth" | "tooLarge" | "wrongType" | "other";
|
|
138
|
+
/**
|
|
139
|
+
* The default adapter: the app's own backend, shaped after @broberg/sso's
|
|
140
|
+
* `accountRoutes()`.
|
|
141
|
+
*
|
|
142
|
+
* GET {url}/profile → AccountProfile
|
|
143
|
+
* POST {url}/profile {name} → AccountProfile
|
|
144
|
+
* POST {url}/profile/avatar (raw bytes, Content-Type = the image's) → AccountProfile
|
|
145
|
+
* POST {url}/profile/avatar/remove → AccountProfile
|
|
146
|
+
*
|
|
147
|
+
* A non-2xx THROWS an AccountError — a failed save must never look like a
|
|
148
|
+
* saved one.
|
|
149
|
+
*/
|
|
150
|
+
declare function createFetchAccountAdapter(opts?: {
|
|
151
|
+
url?: string;
|
|
152
|
+
fetch?: typeof fetch;
|
|
153
|
+
credentials?: RequestCredentials;
|
|
154
|
+
}): AccountAdapter;
|
|
103
155
|
declare const TEXT: {
|
|
104
156
|
readonly da: {
|
|
105
157
|
readonly openMenu: "Åbn menu";
|
|
@@ -128,6 +180,26 @@ declare const TEXT: {
|
|
|
128
180
|
readonly backdrop: "Baggrund";
|
|
129
181
|
readonly neurons: "Neuroner";
|
|
130
182
|
readonly plain: "Ren";
|
|
183
|
+
readonly name: "Navn";
|
|
184
|
+
readonly email: "E-mail";
|
|
185
|
+
readonly save: "Gem";
|
|
186
|
+
readonly saving: "Gemmer…";
|
|
187
|
+
readonly saved: "Gemt";
|
|
188
|
+
readonly loadingProfile: "Henter profil…";
|
|
189
|
+
readonly couldNotLoadProfile: "Kunne ikke hente din profil.";
|
|
190
|
+
readonly couldNotSave: "Kunne ikke gemme. Prøv igen.";
|
|
191
|
+
readonly reauth: "Log ind igen for at rette";
|
|
192
|
+
readonly signInAgain: "Log ind igen";
|
|
193
|
+
readonly changePicture: "Skift billede";
|
|
194
|
+
readonly removePicture: "Fjern billede";
|
|
195
|
+
readonly confirmRemovePicture: "Fjern dit billede?";
|
|
196
|
+
readonly remove: "Fjern";
|
|
197
|
+
readonly cancel: "Annuller";
|
|
198
|
+
readonly pictureSaved: "Billedet er gemt";
|
|
199
|
+
readonly pictureRemoved: "Billedet er fjernet";
|
|
200
|
+
readonly pictureTooLarge: "Billedet er for stort — højst 2 MB.";
|
|
201
|
+
readonly pictureWrongType: "Vælg et PNG-, JPEG- eller WebP-billede.";
|
|
202
|
+
readonly bidSecurity: "Sikkerhed i Broberg ID";
|
|
131
203
|
};
|
|
132
204
|
readonly en: {
|
|
133
205
|
readonly openMenu: "Open menu";
|
|
@@ -156,8 +228,28 @@ declare const TEXT: {
|
|
|
156
228
|
readonly backdrop: "Backdrop";
|
|
157
229
|
readonly neurons: "Neurons";
|
|
158
230
|
readonly plain: "Plain";
|
|
231
|
+
readonly name: "Name";
|
|
232
|
+
readonly email: "Email";
|
|
233
|
+
readonly save: "Save";
|
|
234
|
+
readonly saving: "Saving…";
|
|
235
|
+
readonly saved: "Saved";
|
|
236
|
+
readonly loadingProfile: "Loading profile…";
|
|
237
|
+
readonly couldNotLoadProfile: "Could not load your profile.";
|
|
238
|
+
readonly couldNotSave: "Could not save. Try again.";
|
|
239
|
+
readonly reauth: "Sign in again to make changes";
|
|
240
|
+
readonly signInAgain: "Sign in again";
|
|
241
|
+
readonly changePicture: "Change picture";
|
|
242
|
+
readonly removePicture: "Remove picture";
|
|
243
|
+
readonly confirmRemovePicture: "Remove your picture?";
|
|
244
|
+
readonly remove: "Remove";
|
|
245
|
+
readonly cancel: "Cancel";
|
|
246
|
+
readonly pictureSaved: "Picture saved";
|
|
247
|
+
readonly pictureRemoved: "Picture removed";
|
|
248
|
+
readonly pictureTooLarge: "The picture is too large — 2 MB at most.";
|
|
249
|
+
readonly pictureWrongType: "Choose a PNG, JPEG or WebP image.";
|
|
250
|
+
readonly bidSecurity: "Security in Broberg ID";
|
|
159
251
|
};
|
|
160
252
|
};
|
|
161
253
|
type Lang = keyof typeof TEXT;
|
|
162
254
|
|
|
163
|
-
export { type Lang, type NavGroup, type NavItem, type NotificationSource, TEXT, activeNavLabel, badgeLabel, createFetchNotificationSource, createMemoryNotificationSource, initials, isActivePath, isExternal, readFlag, readSet, relativeTime, safeNavigate, writeFlag, writeSet };
|
|
255
|
+
export { AVATAR_MAX_BYTES, AVATAR_TYPES, type AccountAdapter, AccountError, type AccountProfile, type Lang, type NavGroup, type NavItem, type NotificationSource, TEXT, accountErrorKind, activeNavLabel, badgeLabel, checkAvatarFile, createFetchAccountAdapter, createFetchNotificationSource, createMemoryNotificationSource, initials, isActivePath, isExternal, readFlag, readSet, relativeTime, safeNavigate, writeFlag, writeSet };
|
package/dist/index.d.ts
CHANGED
|
@@ -100,6 +100,58 @@ declare function createMemoryNotificationSource(initial?: NotificationRow[]): No
|
|
|
100
100
|
};
|
|
101
101
|
/** "nu", "5 min", "3 t", "i går", "4 d" (da) or the English equivalents. */
|
|
102
102
|
declare function relativeTime(ts: string | number, lang: "da" | "en", now?: number): string;
|
|
103
|
+
/** What every account call resolves to — the profile AS THE SERVER NOW HOLDS IT. */
|
|
104
|
+
interface AccountProfile {
|
|
105
|
+
sub: string;
|
|
106
|
+
name: string | null;
|
|
107
|
+
picture: string | null;
|
|
108
|
+
email: string | null;
|
|
109
|
+
/** Broberg ID's own account page (password, passkeys, sessions). */
|
|
110
|
+
account_url: string;
|
|
111
|
+
}
|
|
112
|
+
/** Where the account page gets and saves the profile. Swap it to point anywhere. */
|
|
113
|
+
interface AccountAdapter {
|
|
114
|
+
load(): Promise<AccountProfile>;
|
|
115
|
+
saveName(name: string): Promise<AccountProfile>;
|
|
116
|
+
uploadAvatar(file: Blob): Promise<AccountProfile>;
|
|
117
|
+
removeAvatar(): Promise<AccountProfile>;
|
|
118
|
+
}
|
|
119
|
+
/** A failed account call: the HTTP status and the server's `error` code, if any. */
|
|
120
|
+
declare class AccountError extends Error {
|
|
121
|
+
readonly status: number;
|
|
122
|
+
readonly code?: string | undefined;
|
|
123
|
+
constructor(status: number, code?: string | undefined);
|
|
124
|
+
}
|
|
125
|
+
declare const AVATAR_TYPES: readonly ["image/png", "image/jpeg", "image/webp"];
|
|
126
|
+
declare const AVATAR_MAX_BYTES: number;
|
|
127
|
+
/** Checked BEFORE uploading, so a file the server will refuse is never sent. */
|
|
128
|
+
declare function checkAvatarFile(file: {
|
|
129
|
+
size: number;
|
|
130
|
+
type: string;
|
|
131
|
+
}): "tooLarge" | "wrongType" | null;
|
|
132
|
+
/**
|
|
133
|
+
* What a failed call means for the page. `reauth` = the user's session or its
|
|
134
|
+
* scope does not allow the change (401, or 403 insufficient_scope): signing in
|
|
135
|
+
* again is the fix, so the page says that instead of «try again».
|
|
136
|
+
*/
|
|
137
|
+
declare function accountErrorKind(err: unknown): "reauth" | "tooLarge" | "wrongType" | "other";
|
|
138
|
+
/**
|
|
139
|
+
* The default adapter: the app's own backend, shaped after @broberg/sso's
|
|
140
|
+
* `accountRoutes()`.
|
|
141
|
+
*
|
|
142
|
+
* GET {url}/profile → AccountProfile
|
|
143
|
+
* POST {url}/profile {name} → AccountProfile
|
|
144
|
+
* POST {url}/profile/avatar (raw bytes, Content-Type = the image's) → AccountProfile
|
|
145
|
+
* POST {url}/profile/avatar/remove → AccountProfile
|
|
146
|
+
*
|
|
147
|
+
* A non-2xx THROWS an AccountError — a failed save must never look like a
|
|
148
|
+
* saved one.
|
|
149
|
+
*/
|
|
150
|
+
declare function createFetchAccountAdapter(opts?: {
|
|
151
|
+
url?: string;
|
|
152
|
+
fetch?: typeof fetch;
|
|
153
|
+
credentials?: RequestCredentials;
|
|
154
|
+
}): AccountAdapter;
|
|
103
155
|
declare const TEXT: {
|
|
104
156
|
readonly da: {
|
|
105
157
|
readonly openMenu: "Åbn menu";
|
|
@@ -128,6 +180,26 @@ declare const TEXT: {
|
|
|
128
180
|
readonly backdrop: "Baggrund";
|
|
129
181
|
readonly neurons: "Neuroner";
|
|
130
182
|
readonly plain: "Ren";
|
|
183
|
+
readonly name: "Navn";
|
|
184
|
+
readonly email: "E-mail";
|
|
185
|
+
readonly save: "Gem";
|
|
186
|
+
readonly saving: "Gemmer…";
|
|
187
|
+
readonly saved: "Gemt";
|
|
188
|
+
readonly loadingProfile: "Henter profil…";
|
|
189
|
+
readonly couldNotLoadProfile: "Kunne ikke hente din profil.";
|
|
190
|
+
readonly couldNotSave: "Kunne ikke gemme. Prøv igen.";
|
|
191
|
+
readonly reauth: "Log ind igen for at rette";
|
|
192
|
+
readonly signInAgain: "Log ind igen";
|
|
193
|
+
readonly changePicture: "Skift billede";
|
|
194
|
+
readonly removePicture: "Fjern billede";
|
|
195
|
+
readonly confirmRemovePicture: "Fjern dit billede?";
|
|
196
|
+
readonly remove: "Fjern";
|
|
197
|
+
readonly cancel: "Annuller";
|
|
198
|
+
readonly pictureSaved: "Billedet er gemt";
|
|
199
|
+
readonly pictureRemoved: "Billedet er fjernet";
|
|
200
|
+
readonly pictureTooLarge: "Billedet er for stort — højst 2 MB.";
|
|
201
|
+
readonly pictureWrongType: "Vælg et PNG-, JPEG- eller WebP-billede.";
|
|
202
|
+
readonly bidSecurity: "Sikkerhed i Broberg ID";
|
|
131
203
|
};
|
|
132
204
|
readonly en: {
|
|
133
205
|
readonly openMenu: "Open menu";
|
|
@@ -156,8 +228,28 @@ declare const TEXT: {
|
|
|
156
228
|
readonly backdrop: "Backdrop";
|
|
157
229
|
readonly neurons: "Neurons";
|
|
158
230
|
readonly plain: "Plain";
|
|
231
|
+
readonly name: "Name";
|
|
232
|
+
readonly email: "Email";
|
|
233
|
+
readonly save: "Save";
|
|
234
|
+
readonly saving: "Saving…";
|
|
235
|
+
readonly saved: "Saved";
|
|
236
|
+
readonly loadingProfile: "Loading profile…";
|
|
237
|
+
readonly couldNotLoadProfile: "Could not load your profile.";
|
|
238
|
+
readonly couldNotSave: "Could not save. Try again.";
|
|
239
|
+
readonly reauth: "Sign in again to make changes";
|
|
240
|
+
readonly signInAgain: "Sign in again";
|
|
241
|
+
readonly changePicture: "Change picture";
|
|
242
|
+
readonly removePicture: "Remove picture";
|
|
243
|
+
readonly confirmRemovePicture: "Remove your picture?";
|
|
244
|
+
readonly remove: "Remove";
|
|
245
|
+
readonly cancel: "Cancel";
|
|
246
|
+
readonly pictureSaved: "Picture saved";
|
|
247
|
+
readonly pictureRemoved: "Picture removed";
|
|
248
|
+
readonly pictureTooLarge: "The picture is too large — 2 MB at most.";
|
|
249
|
+
readonly pictureWrongType: "Choose a PNG, JPEG or WebP image.";
|
|
250
|
+
readonly bidSecurity: "Security in Broberg ID";
|
|
159
251
|
};
|
|
160
252
|
};
|
|
161
253
|
type Lang = keyof typeof TEXT;
|
|
162
254
|
|
|
163
|
-
export { type Lang, type NavGroup, type NavItem, type NotificationSource, TEXT, activeNavLabel, badgeLabel, createFetchNotificationSource, createMemoryNotificationSource, initials, isActivePath, isExternal, readFlag, readSet, relativeTime, safeNavigate, writeFlag, writeSet };
|
|
255
|
+
export { AVATAR_MAX_BYTES, AVATAR_TYPES, type AccountAdapter, AccountError, type AccountProfile, type Lang, type NavGroup, type NavItem, type NotificationSource, TEXT, accountErrorKind, activeNavLabel, badgeLabel, checkAvatarFile, createFetchAccountAdapter, createFetchNotificationSource, createMemoryNotificationSource, initials, isActivePath, isExternal, readFlag, readSet, relativeTime, safeNavigate, writeFlag, writeSet };
|