@coffre/ui 0.1.18 → 0.2.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 +23 -3
- package/dist/{server/_coffre/assets/affordances-CKANXDTG.js → chunks/affordances-DAvsVz7u.js} +12 -7
- package/dist/chunks/affordances-DAvsVz7u.js.map +1 -0
- package/dist/chunks/directory-CSjWWUQ1.js +370 -0
- package/dist/chunks/directory-CSjWWUQ1.js.map +1 -0
- package/dist/{server/_coffre/assets/grants-DdKT11Ny.js → chunks/grants-saMQagmG.js} +41 -39
- package/dist/chunks/grants-saMQagmG.js.map +1 -0
- package/dist/chunks/icons-D-PfAfnH.js +203 -0
- package/dist/chunks/icons-D-PfAfnH.js.map +1 -0
- package/dist/chunks/mounted-jJmqqV_n.js +17 -0
- package/dist/chunks/mounted-jJmqqV_n.js.map +1 -0
- package/dist/{server/_coffre/assets/offboarding-CRz-K82H.js → chunks/offboarding-C6l30DZR.js} +70 -69
- package/dist/chunks/offboarding-C6l30DZR.js.map +1 -0
- package/dist/chunks/page-C5HcNqf2.js +190 -0
- package/dist/chunks/page-C5HcNqf2.js.map +1 -0
- package/dist/chunks/page-route-Drfw7lmn.js +20 -0
- package/dist/chunks/page-route-Drfw7lmn.js.map +1 -0
- package/dist/{server/_coffre/assets/principal-page-C-EFwJQw.js → chunks/principal-page-D_91OA0l.js} +105 -103
- package/dist/chunks/principal-page-D_91OA0l.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/project-environments-lEzFHUt4.js +2 -0
- package/dist/chunks/project-environments-lEzFHUt4.js.map +1 -0
- package/dist/chunks/queries-CQ81o4so.js +376 -0
- package/dist/chunks/queries-CQ81o4so.js.map +1 -0
- package/dist/{server/_coffre/assets/row-state-C2P57xT1.js → chunks/row-state-0PsrEzOL.js} +22 -21
- package/dist/chunks/row-state-0PsrEzOL.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/signin-errors-BEFlVDbQ.js +2 -0
- package/dist/chunks/signin-errors-BEFlVDbQ.js.map +1 -0
- package/dist/chunks/theme-B2vQolVR.js +86 -0
- package/dist/chunks/theme-B2vQolVR.js.map +1 -0
- package/dist/chunks/ui-DixXLQvQ.js +405 -0
- package/dist/chunks/ui-DixXLQvQ.js.map +1 -0
- package/dist/{server/_coffre/assets/use-action-B-xpvVRO.js → chunks/use-action-CWsg_YWU.js} +8 -6
- package/dist/chunks/use-action-CWsg_YWU.js.map +1 -0
- package/dist/{server/_coffre/assets/use-change-C8BCf3oU.js → chunks/use-change-c6CeLRin.js} +10 -474
- package/dist/chunks/use-change-c6CeLRin.js.map +1 -0
- package/dist/chunks/use-shell-jxd7Tzd-.js +26 -0
- package/dist/chunks/use-shell-jxd7Tzd-.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/validation-BQtqPe2V.js +2 -0
- package/dist/chunks/validation-BQtqPe2V.js.map +1 -0
- package/dist/index.d.ts +386 -18
- package/dist/index.js +1147 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/account.d.ts +9 -0
- package/dist/pages/account.js +334 -0
- package/dist/pages/account.js.map +1 -0
- package/dist/pages/audit.d.ts +3 -0
- package/dist/{server/_coffre/assets/audit-qB9G2AQJ.js → pages/audit.js} +102 -100
- package/dist/pages/audit.js.map +1 -0
- package/dist/pages/device-login.d.ts +9 -0
- package/dist/pages/device-login.js +211 -0
- package/dist/pages/device-login.js.map +1 -0
- package/dist/pages/environment.d.ts +3 -0
- package/dist/{server/_coffre/assets/projects._project._environment-C6uybzeU.js → pages/environment.js} +323 -469
- package/dist/pages/environment.js.map +1 -0
- package/dist/pages/login.d.ts +10 -0
- package/dist/pages/login.js +104 -0
- package/dist/pages/login.js.map +1 -0
- package/dist/pages/project.d.ts +2 -0
- package/dist/{server/_coffre/assets/projects._project.index-3CXwkyTh.js → pages/project.js} +223 -225
- package/dist/pages/project.js.map +1 -0
- package/dist/pages/projects.d.ts +3 -0
- package/dist/{server/_coffre/assets/projects.index-iSoBpRFz.js → pages/projects.js} +83 -81
- package/dist/pages/projects.js.map +1 -0
- package/dist/pages/settings.d.ts +3 -0
- package/dist/{server/_coffre/assets/settings-BDQTF5XW.js → pages/settings.js} +20 -18
- package/dist/pages/settings.js.map +1 -0
- package/dist/pages/token.d.ts +3 -0
- package/dist/{server/_coffre/assets/tokens._token-CrBMpcbN.js → pages/token.js} +195 -265
- package/dist/pages/token.js.map +1 -0
- package/dist/pages/tokens.d.ts +3 -0
- package/dist/pages/tokens.js +39 -0
- package/dist/pages/tokens.js.map +1 -0
- package/dist/pages/unregistered.d.ts +8 -0
- package/dist/pages/unregistered.js +54 -0
- package/dist/pages/unregistered.js.map +1 -0
- package/dist/pages/user.d.ts +3 -0
- package/dist/pages/user.js +16 -0
- package/dist/pages/user.js.map +1 -0
- package/dist/pages/users.d.ts +3 -0
- package/dist/pages/users.js +39 -0
- package/dist/pages/users.js.map +1 -0
- package/dist/project-BqIy8gYR.d.ts +5 -0
- package/dist/vite.d.ts +16 -0
- package/dist/vite.js +52 -0
- package/package.json +36 -21
- package/src/assets/icon.svg +1 -0
- package/src/components/affordances.ts +10 -4
- package/src/components/command-palette.tsx +229 -203
- package/src/components/directory.tsx +34 -38
- package/src/components/principal.tsx +7 -3
- package/src/components/shell.tsx +89 -127
- package/src/components/theme.tsx +14 -81
- package/src/components/ui.tsx +97 -68
- package/src/index.ts +29 -0
- package/src/layout.tsx +113 -0
- package/src/lib/coffre.ts +8 -4
- package/src/lib/mounted.ts +13 -0
- package/src/lib/page-context.ts +31 -0
- package/src/lib/page-route.ts +22 -0
- package/src/lib/preferences.tsx +46 -0
- package/src/options.ts +240 -0
- package/src/{routes → pages}/account.tsx +7 -24
- package/src/{routes → pages}/audit.tsx +5 -16
- package/src/{routes/auth.device.tsx → pages/device-login.tsx} +8 -21
- package/src/{routes/projects.$project.$environment.tsx → pages/environment.tsx} +43 -52
- package/src/{routes → pages}/login.tsx +5 -16
- package/src/{routes/projects.$project.index.tsx → pages/project.tsx} +38 -50
- package/src/{routes/projects.index.tsx → pages/projects.tsx} +2 -7
- package/src/{routes → pages}/settings.tsx +3 -10
- package/src/{routes/tokens.$token.tsx → pages/token.tsx} +6 -7
- package/src/{routes/tokens.index.tsx → pages/tokens.tsx} +3 -8
- package/src/{routes → pages}/unregistered.tsx +1 -6
- package/src/pages/user.tsx +10 -0
- package/src/{routes/users.index.tsx → pages/users.tsx} +3 -8
- package/src/register.ts +55 -0
- package/src/router.tsx +31 -62
- package/src/styles/globals.css +104 -46
- package/src/vite.ts +78 -0
- package/dist/client/.assetsignore +0 -2
- package/dist/client/_coffre/assets/account-BoLGAxbD.js +0 -2
- package/dist/client/_coffre/assets/account-CnnuRTDB.js +0 -1
- package/dist/client/_coffre/assets/affordances-CEafRJcN.js +0 -1
- package/dist/client/_coffre/assets/audit-CHSvKLWX.js +0 -1
- package/dist/client/_coffre/assets/audit-Cn4hmS4u.js +0 -2
- package/dist/client/_coffre/assets/auth.device-Co5vrpaA.js +0 -2
- package/dist/client/_coffre/assets/auth.device-DAlqWacc.js +0 -1
- package/dist/client/_coffre/assets/directory-H8Eh3MnS.js +0 -1
- package/dist/client/_coffre/assets/dist-Braunv_x.js +0 -1
- package/dist/client/_coffre/assets/globals-CpMrgkV6.css +0 -1
- package/dist/client/_coffre/assets/grants-DPDxJXU1.js +0 -1
- package/dist/client/_coffre/assets/icons-Dc_-t0lp.js +0 -1
- package/dist/client/_coffre/assets/index-sUCIXRgJ.js +0 -12
- package/dist/client/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/client/_coffre/assets/link-DBINMwm6.js +0 -1
- package/dist/client/_coffre/assets/login-BZFYfL1Y.js +0 -1
- package/dist/client/_coffre/assets/login-CYCKWTOD.js +0 -2
- package/dist/client/_coffre/assets/offboarding-Bwpftp3g.js +0 -1
- package/dist/client/_coffre/assets/page-C_hnzdaR.js +0 -1
- package/dist/client/_coffre/assets/preload-helper-CLkO85Nq.js +0 -1
- package/dist/client/_coffre/assets/principal-page-DLho8TSJ.js +0 -1
- package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +0 -1
- package/dist/client/_coffre/assets/projects._project._environment-DHRRvQw0.js +0 -3
- package/dist/client/_coffre/assets/projects._project._environment-TLI-RjBZ.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-BO-8FZIY.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-DGl921dP.js +0 -1
- package/dist/client/_coffre/assets/projects.index-BDn7Bhoo.js +0 -1
- package/dist/client/_coffre/assets/row-state-DJ-KLamZ.js +0 -1
- package/dist/client/_coffre/assets/settings-q9G1QvR_.js +0 -1
- package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +0 -1
- package/dist/client/_coffre/assets/suspense-O8sP0mEC.js +0 -1
- package/dist/client/_coffre/assets/tokens._token-B_qczpT9.js +0 -2
- package/dist/client/_coffre/assets/tokens._token-T-sqwMbz.js +0 -2
- package/dist/client/_coffre/assets/tokens.index-CcXSZnAG.js +0 -1
- package/dist/client/_coffre/assets/ui-BXP2IqrW.js +0 -46
- package/dist/client/_coffre/assets/unregistered-D2JXJ90x.js +0 -1
- package/dist/client/_coffre/assets/use-action-BpzKWhgg.js +0 -1
- package/dist/client/_coffre/assets/use-change-CKj3Inq9.js +0 -1
- package/dist/client/_coffre/assets/use-shell-W0SusPkz.js +0 -1
- package/dist/client/_coffre/assets/useQuery-B-lxFSES.js +0 -1
- package/dist/client/_coffre/assets/useSuspenseQuery-BZ-nzHST.js +0 -1
- package/dist/client/_coffre/assets/users._user-Bb3BGYHl.js +0 -1
- package/dist/client/_coffre/assets/users._user-DXmvKrzE.js +0 -2
- package/dist/client/_coffre/assets/users.index-BvzP3qwW.js +0 -1
- package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +0 -1
- package/dist/server/.vite/manifest.json +0 -668
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-GsKnGGRy.js +0 -162
- package/dist/server/_coffre/assets/account-CV-a2IU2.js +0 -329
- package/dist/server/_coffre/assets/account-hk6wcIXU.js +0 -162
- package/dist/server/_coffre/assets/async-local-storage-C10uQtMM.js +0 -3108
- package/dist/server/_coffre/assets/audit-C1_Ej6YB.js +0 -31
- package/dist/server/_coffre/assets/auth.device-6JRrWbSV.js +0 -210
- package/dist/server/_coffre/assets/auth.device-CLoAxC2T.js +0 -29
- package/dist/server/_coffre/assets/directory-B-_rqsPx.js +0 -371
- package/dist/server/_coffre/assets/dist-CnnV3t2g.js +0 -908
- package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +0 -5
- package/dist/server/_coffre/assets/globals-CpMrgkV6.css +0 -1
- package/dist/server/_coffre/assets/icons-DOFT-eWB.js +0 -1704
- package/dist/server/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/server/_coffre/assets/lazyRouteComponent-CqBNCGuZ.js +0 -480
- package/dist/server/_coffre/assets/link-42ZWdjzZ.js +0 -422
- package/dist/server/_coffre/assets/login-DRKUKkaW.js +0 -22
- package/dist/server/_coffre/assets/login-DnwxVl4Y.js +0 -102
- package/dist/server/_coffre/assets/matchContext-qLfYbC6_.js +0 -56
- package/dist/server/_coffre/assets/page-D6n45dcK.js +0 -3561
- package/dist/server/_coffre/assets/projects._project._environment-CS8DdSMY.js +0 -48
- package/dist/server/_coffre/assets/projects._project.index-BGfcNpj0.js +0 -23
- package/dist/server/_coffre/assets/react-dom-bBoJXlK2.js +0 -1718
- package/dist/server/_coffre/assets/router-9BTgJhWG.js +0 -2322
- package/dist/server/_coffre/assets/start-DR3rN0St.js +0 -4
- package/dist/server/_coffre/assets/suspense-C-2QfDd2.js +0 -602
- package/dist/server/_coffre/assets/tokens._token-rY86Cjgp.js +0 -10
- package/dist/server/_coffre/assets/tokens.index-Bq5qDW9q.js +0 -37
- package/dist/server/_coffre/assets/ui-Cc0CGMtr.js +0 -14881
- package/dist/server/_coffre/assets/unregistered-D9ZKLOPJ.js +0 -53
- package/dist/server/_coffre/assets/use-shell-DwOzEi87.js +0 -462
- package/dist/server/_coffre/assets/useQuery-CTe86qFq.js +0 -8
- package/dist/server/_coffre/assets/useRouter-CaUSUNsw.js +0 -473
- package/dist/server/_coffre/assets/useSuspenseQuery-CSoHzrMb.js +0 -117
- package/dist/server/_coffre/assets/users._user-BmLKYeo_.js +0 -10
- package/dist/server/_coffre/assets/users._user-BmiHwQx3.js +0 -14
- package/dist/server/_coffre/assets/users.index-BiEax90r.js +0 -37
- package/dist/server/index.js +0 -13911
- package/src/assets/favicon-32.png +0 -0
- package/src/components/agentation.tsx +0 -34
- package/src/entry.ts +0 -19
- package/src/routeTree.gen.ts +0 -367
- package/src/routes/__root.tsx +0 -169
- package/src/routes/access.tsx +0 -11
- package/src/routes/index.tsx +0 -15
- package/src/routes/users.$user.tsx +0 -13
- package/src/types.ts +0 -21
package/dist/{server/_coffre/assets/offboarding-CRz-K82H.js → chunks/offboarding-C6l30DZR.js}
RENAMED
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as Card } from "./page-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { c as Notice, i as EmptyState, u as Timestamp } from "./ui-DixXLQvQ.js";
|
|
2
|
+
import { H as User, s as ChevronRight, v as Key } from "./icons-D-PfAfnH.js";
|
|
3
|
+
import { t as Card } from "./page-C5HcNqf2.js";
|
|
4
|
+
import { s as PrincipalLink } from "./directory-CSjWWUQ1.js";
|
|
5
|
+
import { Link } from "@tanstack/react-router";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/offboarding.tsx
|
|
8
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
9
8
|
/**
|
|
10
9
|
* The part of a user's or token's page that answers "if they left, what would
|
|
11
10
|
* we have to change?". Owners only, and most useful once someone is removed:
|
|
12
11
|
* everything that let them in is gone by then, but what they saw is not.
|
|
13
12
|
*/
|
|
14
13
|
function PrincipalReportCards({ report }) {
|
|
15
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SeenValues, {
|
|
16
15
|
report,
|
|
17
16
|
removed: report.status === "removed",
|
|
18
17
|
person: report.principalType === "user"
|
|
19
|
-
}), report.issuedTokens.length > 0 && /* @__PURE__ */
|
|
18
|
+
}), report.issuedTokens.length > 0 && /* @__PURE__ */ jsx(IssuedTokens, { report })] });
|
|
20
19
|
}
|
|
21
20
|
function RemovedNotice({ report }) {
|
|
22
21
|
const person = report.principalType === "user";
|
|
23
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ jsx("div", {
|
|
24
23
|
className: "report-notice",
|
|
25
|
-
children: /* @__PURE__ */
|
|
24
|
+
children: /* @__PURE__ */ jsxs(Notice, { children: [
|
|
26
25
|
"Removed",
|
|
27
|
-
report.removedBy !== null && /* @__PURE__ */
|
|
26
|
+
report.removedBy !== null && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
28
27
|
" ",
|
|
29
28
|
"by ",
|
|
30
|
-
/* @__PURE__ */
|
|
29
|
+
/* @__PURE__ */ jsx("span", {
|
|
31
30
|
className: "mono",
|
|
32
31
|
children: report.removedBy
|
|
33
32
|
})
|
|
34
33
|
] }),
|
|
35
|
-
report.removedAt !== null && /* @__PURE__ */
|
|
34
|
+
report.removedAt !== null && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
35
|
" ",
|
|
37
36
|
"on ",
|
|
38
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ jsx(Timestamp, { iso: report.removedAt })
|
|
39
38
|
] }),
|
|
40
39
|
".",
|
|
41
40
|
" ",
|
|
@@ -52,76 +51,76 @@ function RemovedList({ principalType, removed }) {
|
|
|
52
51
|
const users = principalType === "user";
|
|
53
52
|
const rows = removed.filter((principal) => principal.principalType === principalType);
|
|
54
53
|
if (rows.length === 0) return null;
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55
|
+
/* @__PURE__ */ jsx("h2", {
|
|
57
56
|
className: "section-title",
|
|
58
57
|
children: "Removed"
|
|
59
58
|
}),
|
|
60
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ jsx("section", {
|
|
61
60
|
className: "card",
|
|
62
61
|
"aria-label": users ? "Removed users" : "Removed tokens",
|
|
63
|
-
children: /* @__PURE__ */
|
|
62
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
64
63
|
className: "dt-wrap",
|
|
65
|
-
children: /* @__PURE__ */
|
|
64
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
66
65
|
className: "dt directory stacks",
|
|
67
|
-
children: [/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
66
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
67
|
+
/* @__PURE__ */ jsx("th", {
|
|
69
68
|
className: "n",
|
|
70
69
|
children: "#"
|
|
71
70
|
}),
|
|
72
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ jsx("th", {
|
|
73
72
|
className: "col-principal",
|
|
74
|
-
children: /* @__PURE__ */
|
|
73
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
75
74
|
className: "th",
|
|
76
|
-
children: [users ? /* @__PURE__ */
|
|
75
|
+
children: [users ? /* @__PURE__ */ jsx(User, { size: 14 }) : /* @__PURE__ */ jsx(Key, { size: 14 }), users ? "Email" : "Name"]
|
|
77
76
|
})
|
|
78
77
|
}),
|
|
79
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ jsx("th", {
|
|
80
79
|
className: "col-role",
|
|
81
80
|
children: "Still to rotate"
|
|
82
81
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ jsx("th", {
|
|
84
83
|
className: "col-actions",
|
|
85
|
-
children: /* @__PURE__ */
|
|
84
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
86
85
|
className: "visually-hidden",
|
|
87
86
|
children: "Report"
|
|
88
87
|
})
|
|
89
88
|
})
|
|
90
|
-
] }) }), /* @__PURE__ */
|
|
89
|
+
] }) }), /* @__PURE__ */ jsx("tbody", { children: rows.map((principal, index) => /* @__PURE__ */ jsxs("tr", {
|
|
91
90
|
className: "row-link",
|
|
92
91
|
children: [
|
|
93
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ jsx("td", {
|
|
94
93
|
className: "n",
|
|
95
94
|
children: index + 1
|
|
96
95
|
}),
|
|
97
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ jsx("td", {
|
|
98
97
|
className: "col-lead",
|
|
99
98
|
"data-label": users ? "Email" : "Name",
|
|
100
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ jsx(PrincipalLink, {
|
|
101
100
|
type: principal.principalType,
|
|
102
101
|
id: principal.principalId,
|
|
103
102
|
stretch: true
|
|
104
103
|
})
|
|
105
104
|
}),
|
|
106
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ jsx("td", {
|
|
107
106
|
className: "col-role",
|
|
108
107
|
"data-label": "Still to rotate",
|
|
109
|
-
children: principal.toRotate === 0 ? /* @__PURE__ */
|
|
108
|
+
children: principal.toRotate === 0 ? /* @__PURE__ */ jsx("span", {
|
|
110
109
|
className: "cell-muted",
|
|
111
110
|
children: "Nothing"
|
|
112
111
|
}) : `${principal.toRotate} ${principal.toRotate === 1 ? "value" : "values"}`
|
|
113
112
|
}),
|
|
114
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ jsx("td", {
|
|
115
114
|
className: "col-actions col-open cell-muted",
|
|
116
115
|
"aria-hidden": "true",
|
|
117
|
-
children: /* @__PURE__ */
|
|
116
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { size: 16 })
|
|
118
117
|
})
|
|
119
118
|
]
|
|
120
119
|
}, principal.principalId)) })]
|
|
121
120
|
})
|
|
122
121
|
})
|
|
123
122
|
}),
|
|
124
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ jsxs("p", {
|
|
125
124
|
className: "hint section-foot",
|
|
126
125
|
children: [
|
|
127
126
|
users ? "They" : "These",
|
|
@@ -136,33 +135,33 @@ function RemovedList({ principalType, removed }) {
|
|
|
136
135
|
function SeenValues({ report, removed, person }) {
|
|
137
136
|
const they = person ? "they" : "it";
|
|
138
137
|
const description = removed ? `Values ${they} read or wrote that nobody has changed since, so ${they} may still hold them. Rotate each where it comes from, such as a new API key or database password, then save the new value here and it leaves this list.` : `Current values ${they} ${person ? "have" : "has"} read or written: the ones to rotate if ${they} ${person ? "leave" : "is retired"}. Saving a new version takes a value off.`;
|
|
139
|
-
return /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ jsx(Card, {
|
|
140
139
|
labelledBy: "seen-values",
|
|
141
140
|
title: removed ? "Still to rotate" : "Values seen",
|
|
142
141
|
description,
|
|
143
|
-
actions: report.rotated > 0 && /* @__PURE__ */
|
|
142
|
+
actions: report.rotated > 0 && /* @__PURE__ */ jsxs("span", {
|
|
144
143
|
className: "card-aside",
|
|
145
144
|
children: [report.rotated, " already rotated"]
|
|
146
145
|
}),
|
|
147
|
-
children: report.exposed.length === 0 ? /* @__PURE__ */
|
|
146
|
+
children: report.exposed.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
148
147
|
title: removed ? "Nothing left to rotate" : "No current values seen",
|
|
149
148
|
children: report.rotated > 0 ? `Every value ${they} saw has had a new version since.` : `${person ? "They have" : "It has"} not read or written a value that is still current.`
|
|
150
|
-
}) : /* @__PURE__ */
|
|
149
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
151
150
|
className: "dt-wrap",
|
|
152
|
-
children: /* @__PURE__ */
|
|
151
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
153
152
|
className: "dt report-values",
|
|
154
|
-
children: [/* @__PURE__ */
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
/* @__PURE__ */
|
|
153
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
154
|
+
/* @__PURE__ */ jsx("th", { children: "Secret" }),
|
|
155
|
+
/* @__PURE__ */ jsx("th", {
|
|
157
156
|
className: "col-shrink",
|
|
158
157
|
children: "Version"
|
|
159
158
|
}),
|
|
160
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ jsx("th", {
|
|
161
160
|
className: "col-shrink",
|
|
162
161
|
children: "Last seen"
|
|
163
162
|
})
|
|
164
|
-
] }) }), /* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
163
|
+
] }) }), /* @__PURE__ */ jsx("tbody", { children: report.exposed.map((secret) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
164
|
+
/* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsxs(Link, {
|
|
166
165
|
className: "cell-link mono",
|
|
167
166
|
to: "/projects/$project/$environment",
|
|
168
167
|
params: {
|
|
@@ -170,7 +169,7 @@ function SeenValues({ report, removed, person }) {
|
|
|
170
169
|
environment: secret.environment
|
|
171
170
|
},
|
|
172
171
|
search: { filter: secret.key },
|
|
173
|
-
children: [/* @__PURE__ */
|
|
172
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
174
173
|
className: "report-path",
|
|
175
174
|
children: [
|
|
176
175
|
secret.project,
|
|
@@ -180,16 +179,16 @@ function SeenValues({ report, removed, person }) {
|
|
|
180
179
|
]
|
|
181
180
|
}), secret.key]
|
|
182
181
|
}) }),
|
|
183
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ jsxs("td", {
|
|
184
183
|
className: "col-shrink cell-mono cell-muted",
|
|
185
184
|
children: ["v", secret.version]
|
|
186
185
|
}),
|
|
187
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ jsxs("td", {
|
|
188
187
|
className: "col-shrink nowrap",
|
|
189
188
|
children: [
|
|
190
189
|
secret.how === "wrote" ? "Wrote" : "Read",
|
|
191
190
|
" ",
|
|
192
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ jsx(Timestamp, {
|
|
193
192
|
iso: secret.at,
|
|
194
193
|
display: "relative"
|
|
195
194
|
})
|
|
@@ -201,54 +200,54 @@ function SeenValues({ report, removed, person }) {
|
|
|
201
200
|
});
|
|
202
201
|
}
|
|
203
202
|
function IssuedTokens({ report }) {
|
|
204
|
-
return /* @__PURE__ */
|
|
203
|
+
return /* @__PURE__ */ jsx(Card, {
|
|
205
204
|
labelledBy: "issued-tokens",
|
|
206
205
|
title: "Tokens they issued",
|
|
207
206
|
description: "Service tokens they created that still work. Each was shown to them once, when it was made; revoke any they may have kept a copy of.",
|
|
208
|
-
children: /* @__PURE__ */
|
|
207
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
209
208
|
className: "dt-wrap",
|
|
210
|
-
children: /* @__PURE__ */
|
|
209
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
211
210
|
className: "dt report-tokens",
|
|
212
|
-
children: [/* @__PURE__ */
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
/* @__PURE__ */
|
|
211
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
212
|
+
/* @__PURE__ */ jsx("th", { children: "Token" }),
|
|
213
|
+
/* @__PURE__ */ jsx("th", {
|
|
215
214
|
className: "col-shrink",
|
|
216
215
|
children: "Expires"
|
|
217
216
|
}),
|
|
218
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ jsx("th", {
|
|
219
218
|
className: "col-shrink col-hide-narrow",
|
|
220
219
|
children: "Last used"
|
|
221
220
|
})
|
|
222
|
-
] }) }), /* @__PURE__ */
|
|
223
|
-
/* @__PURE__ */
|
|
221
|
+
] }) }), /* @__PURE__ */ jsx("tbody", { children: report.issuedTokens.map((token) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
222
|
+
/* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsxs("span", {
|
|
224
223
|
className: "cell-stack",
|
|
225
|
-
children: [/* @__PURE__ */
|
|
224
|
+
children: [/* @__PURE__ */ jsx(Link, {
|
|
226
225
|
className: "cell-link mono",
|
|
227
226
|
to: "/tokens/$token",
|
|
228
227
|
params: { token: token.service },
|
|
229
228
|
children: token.service
|
|
230
|
-
}), /* @__PURE__ */
|
|
229
|
+
}), /* @__PURE__ */ jsxs("small", { children: [
|
|
231
230
|
token.label ?? "No label",
|
|
232
231
|
" · ",
|
|
233
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ jsx("span", {
|
|
234
233
|
className: "mono",
|
|
235
234
|
children: token.hint
|
|
236
235
|
})
|
|
237
236
|
] })]
|
|
238
237
|
}) }),
|
|
239
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ jsx("td", {
|
|
240
239
|
className: "col-shrink nowrap",
|
|
241
|
-
children: /* @__PURE__ */
|
|
240
|
+
children: /* @__PURE__ */ jsx(Timestamp, {
|
|
242
241
|
iso: token.expiresAt,
|
|
243
242
|
display: "relative"
|
|
244
243
|
})
|
|
245
244
|
}),
|
|
246
|
-
/* @__PURE__ */
|
|
245
|
+
/* @__PURE__ */ jsx("td", {
|
|
247
246
|
className: "col-shrink col-hide-narrow nowrap",
|
|
248
|
-
children: token.lastUsedAt === null ? /* @__PURE__ */
|
|
247
|
+
children: token.lastUsedAt === null ? /* @__PURE__ */ jsx("span", {
|
|
249
248
|
className: "cell-muted",
|
|
250
249
|
children: "Never"
|
|
251
|
-
}) : /* @__PURE__ */
|
|
250
|
+
}) : /* @__PURE__ */ jsx(Timestamp, {
|
|
252
251
|
iso: token.lastUsedAt,
|
|
253
252
|
display: "relative"
|
|
254
253
|
})
|
|
@@ -260,3 +259,5 @@ function IssuedTokens({ report }) {
|
|
|
260
259
|
}
|
|
261
260
|
//#endregion
|
|
262
261
|
export { RemovedList as n, RemovedNotice as r, PrincipalReportCards as t };
|
|
262
|
+
|
|
263
|
+
//# sourceMappingURL=offboarding-C6l30DZR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offboarding-C6l30DZR.js","names":[],"sources":["../../src/components/offboarding.tsx"],"sourcesContent":["import { Link } from '@tanstack/react-router';\nimport type { PrincipalReport, RemovedPrincipal } from '../shared/models';\nimport { Card } from './page';\nimport { EmptyState, Notice, Timestamp } from './ui';\nimport { PrincipalLink } from './principal';\nimport { ChevronRight, Key, User } from './icons';\n\n/**\n * The part of a user's or token's page that answers \"if they left, what would\n * we have to change?\". Owners only, and most useful once someone is removed:\n * everything that let them in is gone by then, but what they saw is not.\n */\nexport function PrincipalReportCards({ report }: { report: PrincipalReport }) {\n const removed = report.status === 'removed';\n const person = report.principalType === 'user';\n return (\n <>\n <SeenValues report={report} removed={removed} person={person} />\n {report.issuedTokens.length > 0 && <IssuedTokens report={report} />}\n </>\n );\n}\n\nexport function RemovedNotice({ report }: { report: PrincipalReport }) {\n const person = report.principalType === 'user';\n return (\n <div className=\"report-notice\">\n <Notice>\n Removed\n {report.removedBy !== null && (\n <>\n {' '}by <span className=\"mono\">{report.removedBy}</span>\n </>\n )}\n {report.removedAt !== null && (\n <>\n {' '}on <Timestamp iso={report.removedAt} />\n </>\n )}\n .{' '}\n {person\n ? 'Their project access, sessions, CLI logins and linked sign-in accounts were revoked at the same time, so adding them again starts from nothing.'\n : 'Its project access and every token issued to it were revoked at the same time, so adding it again starts from nothing.'}\n </Notice>\n </div>\n );\n}\n\n/**\n * The people or tokens removed from the directory, under the live ones.\n * Removal ends their access but not the work it leaves, so they stay one click\n * away until every value they saw has been rotated.\n */\nexport function RemovedList({\n principalType,\n removed,\n}: {\n principalType: RemovedPrincipal['principalType'];\n removed: RemovedPrincipal[];\n}) {\n const users = principalType === 'user';\n const rows = removed.filter((principal) => principal.principalType === principalType);\n if (rows.length === 0) return null;\n return (\n <>\n <h2 className=\"section-title\">Removed</h2>\n <section className=\"card\" aria-label={users ? 'Removed users' : 'Removed tokens'}>\n <div className=\"dt-wrap\">\n <table className=\"dt directory stacks\">\n <thead>\n <tr>\n <th className=\"n\">#</th>\n <th className=\"col-principal\">\n <span className=\"th\">\n {users ? <User size={14} /> : <Key size={14} />}\n {users ? 'Email' : 'Name'}\n </span>\n </th>\n <th className=\"col-role\">Still to rotate</th>\n <th className=\"col-actions\">\n <span className=\"visually-hidden\">Report</span>\n </th>\n </tr>\n </thead>\n <tbody>\n {rows.map((principal, index) => (\n <tr key={principal.principalId} className=\"row-link\">\n <td className=\"n\">{index + 1}</td>\n <td className=\"col-lead\" data-label={users ? 'Email' : 'Name'}>\n <PrincipalLink type={principal.principalType} id={principal.principalId} stretch />\n </td>\n <td className=\"col-role\" data-label=\"Still to rotate\">\n {principal.toRotate === 0 ? (\n <span className=\"cell-muted\">Nothing</span>\n ) : (\n `${principal.toRotate} ${principal.toRotate === 1 ? 'value' : 'values'}`\n )}\n </td>\n {/* The row opens the report; the chevron says it does. */}\n <td className=\"col-actions col-open cell-muted\" aria-hidden=\"true\">\n <ChevronRight size={16} />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </section>\n <p className=\"hint section-foot\">\n {users ? 'They' : 'These'} can no longer sign in. Each page lists the values{' '}\n {users ? 'they' : 'it'} saw that nobody has changed since.\n </p>\n </>\n );\n}\n\nfunction SeenValues({\n report,\n removed,\n person,\n}: {\n report: PrincipalReport;\n removed: boolean;\n person: boolean;\n}) {\n const they = person ? 'they' : 'it';\n const description = removed\n ? `Values ${they} read or wrote that nobody has changed since, so ${they} may still hold them. Rotate each where it comes from, such as a new API key or database password, then save the new value here and it leaves this list.`\n : `Current values ${they} ${person ? 'have' : 'has'} read or written: the ones to rotate if ${they} ${person ? 'leave' : 'is retired'}. Saving a new version takes a value off.`;\n\n return (\n <Card\n labelledBy=\"seen-values\"\n title={removed ? 'Still to rotate' : 'Values seen'}\n description={description}\n actions={\n report.rotated > 0 && (\n <span className=\"card-aside\">{report.rotated} already rotated</span>\n )\n }\n >\n {report.exposed.length === 0 ? (\n <EmptyState title={removed ? 'Nothing left to rotate' : 'No current values seen'}>\n {report.rotated > 0\n ? `Every value ${they} saw has had a new version since.`\n : `${person ? 'They have' : 'It has'} not read or written a value that is still current.`}\n </EmptyState>\n ) : (\n <div className=\"dt-wrap\">\n <table className=\"dt report-values\">\n <thead>\n <tr>\n <th>Secret</th>\n <th className=\"col-shrink\">Version</th>\n <th className=\"col-shrink\">Last seen</th>\n </tr>\n </thead>\n <tbody>\n {report.exposed.map((secret) => (\n <tr key={`${secret.project}/${secret.environment}/${secret.key}`}>\n <td>\n <Link\n className=\"cell-link mono\"\n to=\"/projects/$project/$environment\"\n params={{ project: secret.project, environment: secret.environment }}\n search={{ filter: secret.key }}\n >\n <span className=\"report-path\">\n {secret.project}/{secret.environment}/\n </span>\n {secret.key}\n </Link>\n </td>\n <td className=\"col-shrink cell-mono cell-muted\">v{secret.version}</td>\n <td className=\"col-shrink nowrap\">\n {secret.how === 'wrote' ? 'Wrote' : 'Read'}{' '}\n <Timestamp iso={secret.at} display=\"relative\" />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </Card>\n );\n}\n\nfunction IssuedTokens({ report }: { report: PrincipalReport }) {\n return (\n <Card\n labelledBy=\"issued-tokens\"\n title=\"Tokens they issued\"\n description=\"Service tokens they created that still work. Each was shown to them once, when it was made; revoke any they may have kept a copy of.\"\n >\n <div className=\"dt-wrap\">\n <table className=\"dt report-tokens\">\n <thead>\n <tr>\n <th>Token</th>\n <th className=\"col-shrink\">Expires</th>\n <th className=\"col-shrink col-hide-narrow\">Last used</th>\n </tr>\n </thead>\n <tbody>\n {report.issuedTokens.map((token) => (\n <tr key={token.id}>\n <td>\n <span className=\"cell-stack\">\n <Link className=\"cell-link mono\" to=\"/tokens/$token\" params={{ token: token.service }}>\n {token.service}\n </Link>\n <small>\n {token.label ?? 'No label'} · <span className=\"mono\">{token.hint}</span>\n </small>\n </span>\n </td>\n <td className=\"col-shrink nowrap\">\n <Timestamp iso={token.expiresAt} display=\"relative\" />\n </td>\n <td className=\"col-shrink col-hide-narrow nowrap\">\n {token.lastUsedAt === null ? (\n <span className=\"cell-muted\">Never</span>\n ) : (\n <Timestamp iso={token.lastUsedAt} display=\"relative\" />\n )}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </Card>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAgB,qBAAqB,EAAE,UAAuC;CAG5E,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,YAAD;EAAoB;EAAiB,SAJzB,OAAO,WAAW;EAIwB,QAH3C,OAAO,kBAAkB;CAG2B,CAAA,GAC9D,OAAO,aAAa,SAAS,KAAK,oBAAC,cAAD,EAAsB,OAAS,CAAA,CAClE,EAAA,CAAA;AAEN;AAEA,SAAgB,cAAc,EAAE,UAAuC;CACrE,MAAM,SAAS,OAAO,kBAAkB;CACxC,OACE,oBAAC,OAAD;EAAK,WAAU;YACb,qBAAC,QAAD,EAAA,UAAA;GAAQ;GAEL,OAAO,cAAc,QACpB,qBAAA,UAAA,EAAA,UAAA;IACG;IAAI;IAAG,oBAAC,QAAD;KAAM,WAAU;eAAQ,OAAO;IAAgB,CAAA;GACvD,EAAA,CAAA;GAEH,OAAO,cAAc,QACpB,qBAAA,UAAA,EAAA,UAAA;IACG;IAAI;IAAG,oBAAC,WAAD,EAAW,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,UAAA;KACE,oBAAC,MAAD,EAAA,UACE,qBAAC,QAAD;MAAM,WAAU;gBAAhB,CACE,oBAAC,MAAD;OAAM,WAAU;OAAiB,IAAG;OAAiB,QAAQ,EAAE,OAAO,MAAM,QAAQ;iBACjF,MAAM;MACH,CAAA,GACN,qBAAC,SAAD,EAAA,UAAA;OACG,MAAM,SAAS;OAAW;OAAG,oBAAC,QAAD;QAAM,WAAU;kBAAQ,MAAM;OAAW,CAAA;MAClE,EAAA,CAAA,CACH;QACJ,CAAA;KACJ,oBAAC,MAAD;MAAI,WAAU;gBACZ,oBAAC,WAAD;OAAW,KAAK,MAAM;OAAW,SAAQ;MAAY,CAAA;KACnD,CAAA;KACJ,oBAAC,MAAD;MAAI,WAAU;gBACX,MAAM,eAAe,OACpB,oBAAC,QAAD;OAAM,WAAU;iBAAa;MAAW,CAAA,IAExC,oBAAC,WAAD;OAAW,KAAK,MAAM;OAAY,SAAQ;MAAY,CAAA;KAEtD,CAAA;IACF,EAAA,GArBK,MAAM,EAqBX,CACL,EACI,CAAA,CACF;;EACJ,CAAA;CACD,CAAA;AAEV"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { useRouter } from "@tanstack/react-router";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CoffreError } from "@coffre/client";
|
|
4
|
+
//#region src/components/tile.tsx
|
|
5
|
+
var HUES = [
|
|
6
|
+
"blue",
|
|
7
|
+
"green",
|
|
8
|
+
"amber",
|
|
9
|
+
"violet"
|
|
10
|
+
];
|
|
11
|
+
/** The same name always lands on the same tint, on every screen (FNV-1a). */
|
|
12
|
+
function tileHue(name) {
|
|
13
|
+
let hash = 2166136261;
|
|
14
|
+
for (const char of name) hash = Math.imul(hash ^ char.charCodeAt(0), 16777619) >>> 0;
|
|
15
|
+
return HUES[hash % HUES.length];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A letter on a tint, standing in for a project wherever its name appears.
|
|
19
|
+
*
|
|
20
|
+
* It is a recognition aid, not information: the name is always beside it, so
|
|
21
|
+
* the tile is hidden from assistive technology.
|
|
22
|
+
*/
|
|
23
|
+
function Tile({ name, size = "sm" }) {
|
|
24
|
+
return /* @__PURE__ */ jsx("span", {
|
|
25
|
+
className: `tile tile-${tileHue(name)}${size === "lg" ? " tile-lg" : ""}`,
|
|
26
|
+
"aria-hidden": true,
|
|
27
|
+
children: name.slice(0, 1)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/lib/coffre.ts
|
|
32
|
+
/**
|
|
33
|
+
* The API as whoever is looking at the page, with their permissions: what
|
|
34
|
+
* coffre's pages call, and a deployment's own may too. In the browser this
|
|
35
|
+
* is plain `fetch` to `/api`, carrying the session cookie; on the server,
|
|
36
|
+
* the API in process. Components call it from event handlers; loaders read
|
|
37
|
+
* the same client as `context.coffre`.
|
|
38
|
+
*/
|
|
39
|
+
function useCoffre() {
|
|
40
|
+
return useRouter().options.context.coffre;
|
|
41
|
+
}
|
|
42
|
+
/** A refusal the page words itself, shown as it is. */
|
|
43
|
+
var Refusal = class extends Error {};
|
|
44
|
+
/** The HTTP status of an API error; undefined when the request never got an answer. */
|
|
45
|
+
function statusOf(error) {
|
|
46
|
+
return error instanceof CoffreError ? error.status : void 0;
|
|
47
|
+
}
|
|
48
|
+
/** What to tell the person when a call fails. */
|
|
49
|
+
function failureMessage(error) {
|
|
50
|
+
if (error instanceof Refusal) return error.message;
|
|
51
|
+
if (!(error instanceof CoffreError)) return "The request could not be sent. Nothing was changed.";
|
|
52
|
+
if (error.status === 401) return "Your session has ended. Sign in again, then retry.";
|
|
53
|
+
if (error.code === "cross_origin") return "coffre refused a change that did not come from this page. Reload, then retry.";
|
|
54
|
+
if (error.status === 403) return "You hold no grant that covers this. Someone with grant.manage on the project can add one.";
|
|
55
|
+
if (error.status === 404) return "Not found. It may have been renamed or archived.";
|
|
56
|
+
if (error.status === 400 || error.status === 409) return error.message;
|
|
57
|
+
return "coffre is unavailable. Nothing was read or written.";
|
|
58
|
+
}
|
|
59
|
+
function uiFailure(error) {
|
|
60
|
+
return {
|
|
61
|
+
ok: false,
|
|
62
|
+
error: failureMessage(error),
|
|
63
|
+
signedOut: statusOf(error) === 401
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** A loader's answer: what it read, or what to say instead. */
|
|
67
|
+
async function uiResult(operation) {
|
|
68
|
+
try {
|
|
69
|
+
return {
|
|
70
|
+
ok: true,
|
|
71
|
+
...await operation()
|
|
72
|
+
};
|
|
73
|
+
} catch (error) {
|
|
74
|
+
return uiFailure(error);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** How the API names a member: `user:ada@acme.example`, `token:ci-deploy`. */
|
|
78
|
+
function memberRef(principalType, principalId) {
|
|
79
|
+
return `${principalType === "user" ? "user" : "token"}:${principalId}`;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/components/page.tsx
|
|
83
|
+
/**
|
|
84
|
+
* The head of every page: an optional project tile, the title with a muted
|
|
85
|
+
* aside, one line of description or facts, and the page's own actions.
|
|
86
|
+
*
|
|
87
|
+
* Where you are is already in the top bar's path, so the head does not repeat
|
|
88
|
+
* it; it says what this page is.
|
|
89
|
+
*/
|
|
90
|
+
function PageHeader({ tile, lead, title, aside, description, meta, actions }) {
|
|
91
|
+
return /* @__PURE__ */ jsxs("header", {
|
|
92
|
+
className: "page-head",
|
|
93
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
94
|
+
className: "page-head-text",
|
|
95
|
+
children: [
|
|
96
|
+
tile !== void 0 && /* @__PURE__ */ jsx(Tile, {
|
|
97
|
+
name: tile,
|
|
98
|
+
size: "lg"
|
|
99
|
+
}),
|
|
100
|
+
lead,
|
|
101
|
+
/* @__PURE__ */ jsxs("div", {
|
|
102
|
+
style: { minWidth: 0 },
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsxs("h1", {
|
|
105
|
+
className: "page-title",
|
|
106
|
+
children: [/* @__PURE__ */ jsx("span", { children: title }), aside !== void 0 && aside !== null && /* @__PURE__ */ jsx("span", {
|
|
107
|
+
className: "page-title-aside",
|
|
108
|
+
children: aside
|
|
109
|
+
})]
|
|
110
|
+
}),
|
|
111
|
+
description !== void 0 && /* @__PURE__ */ jsx("p", {
|
|
112
|
+
className: "page-desc",
|
|
113
|
+
children: description
|
|
114
|
+
}),
|
|
115
|
+
meta !== void 0 && /* @__PURE__ */ jsx("div", {
|
|
116
|
+
className: "page-meta",
|
|
117
|
+
children: meta
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
}), actions !== void 0 && actions !== false && /* @__PURE__ */ jsx("div", {
|
|
123
|
+
className: "page-actions",
|
|
124
|
+
children: actions
|
|
125
|
+
})]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/** A bordered panel with a titled head; tables inside it run edge to edge. */
|
|
129
|
+
function Card({ title, description, actions, children, labelledBy, tone }) {
|
|
130
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
131
|
+
className: `card${tone === "danger" ? " card-danger" : ""}`,
|
|
132
|
+
"aria-labelledby": labelledBy,
|
|
133
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
134
|
+
className: "card-head",
|
|
135
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
|
|
136
|
+
className: "card-title",
|
|
137
|
+
id: labelledBy,
|
|
138
|
+
children: title
|
|
139
|
+
}), description !== void 0 && /* @__PURE__ */ jsx("p", {
|
|
140
|
+
className: "card-desc",
|
|
141
|
+
children: description
|
|
142
|
+
})] }), actions]
|
|
143
|
+
}), children]
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/** One labelled fact in a card's `dl.facts`. */
|
|
147
|
+
function Fact({ label, children }) {
|
|
148
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
149
|
+
className: "fact",
|
|
150
|
+
children: [/* @__PURE__ */ jsx("dt", { children: label }), /* @__PURE__ */ jsx("dd", { children })]
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* A page that cannot be shown: no access, no such thing, or no session.
|
|
155
|
+
*
|
|
156
|
+
* It says which page, why in a sentence, and offers the one useful way out.
|
|
157
|
+
*/
|
|
158
|
+
function ClosedDoor({ icon, label, title, children, actions }) {
|
|
159
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
160
|
+
className: "closed",
|
|
161
|
+
role: "status",
|
|
162
|
+
children: [
|
|
163
|
+
icon !== void 0 && /* @__PURE__ */ jsx("div", {
|
|
164
|
+
className: "closed-icon",
|
|
165
|
+
"aria-hidden": true,
|
|
166
|
+
children: icon
|
|
167
|
+
}),
|
|
168
|
+
label !== void 0 && /* @__PURE__ */ jsx("p", {
|
|
169
|
+
className: "closed-label",
|
|
170
|
+
children: label
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ jsx("h1", {
|
|
173
|
+
className: "closed-title",
|
|
174
|
+
children: title
|
|
175
|
+
}),
|
|
176
|
+
/* @__PURE__ */ jsx("div", {
|
|
177
|
+
className: "closed-body",
|
|
178
|
+
children
|
|
179
|
+
}),
|
|
180
|
+
actions !== void 0 && /* @__PURE__ */ jsx("div", {
|
|
181
|
+
className: "closed-actions",
|
|
182
|
+
children: actions
|
|
183
|
+
})
|
|
184
|
+
]
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
export { Refusal as a, statusOf as c, Tile as d, PageHeader as i, uiResult as l, ClosedDoor as n, failureMessage as o, Fact as r, memberRef as s, Card as t, useCoffre as u };
|
|
189
|
+
|
|
190
|
+
//# sourceMappingURL=page-C5HcNqf2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-C5HcNqf2.js","names":[],"sources":["../../src/components/tile.tsx","../../src/lib/coffre.ts","../../src/components/page.tsx"],"sourcesContent":["const HUES = ['blue', 'green', 'amber', 'violet'] as const;\n\n/** The same name always lands on the same tint, on every screen (FNV-1a). */\nexport function tileHue(name: string): (typeof HUES)[number] {\n let hash = 0x811c9dc5;\n for (const char of name) hash = Math.imul(hash ^ char.charCodeAt(0), 0x01000193) >>> 0;\n return HUES[hash % HUES.length];\n}\n\n/**\n * A letter on a tint, standing in for a project wherever its name appears.\n *\n * It is a recognition aid, not information: the name is always beside it, so\n * the tile is hidden from assistive technology.\n */\nexport function Tile({ name, size = 'sm' }: { name: string; size?: 'sm' | 'lg' }) {\n return (\n <span className={`tile tile-${tileHue(name)}${size === 'lg' ? ' tile-lg' : ''}`} aria-hidden>\n {name.slice(0, 1)}\n </span>\n );\n}\n","import { CoffreError, type CoffreClient } from '@coffre/client';\nimport { useRouter } from '@tanstack/react-router';\n\nimport type { CoffreContext } from '../options';\n\n/**\n * The API as whoever is looking at the page, with their permissions: what\n * coffre's pages call, and a deployment's own may too. In the browser this\n * is plain `fetch` to `/api`, carrying the session cookie; on the server,\n * the API in process. Components call it from event handlers; loaders read\n * the same client as `context.coffre`.\n */\nexport function useCoffre(): CoffreClient {\n return (useRouter().options.context as CoffreContext).coffre;\n}\n\n/** A refusal the page words itself, shown as it is. */\nexport class Refusal extends Error {}\n\n/** A call that failed: what to say, and whether signing in again would help, which it does only for an ended session. */\ntype Failure = { ok: false; error: string; signedOut: boolean };\n\n/** The HTTP status of an API error; undefined when the request never got an answer. */\nexport function statusOf(error: unknown): number | undefined {\n return error instanceof CoffreError ? error.status : undefined;\n}\n\n/** What to tell the person when a call fails. */\nexport function failureMessage(error: unknown): string {\n if (error instanceof Refusal) return error.message;\n if (!(error instanceof CoffreError)) return 'The request could not be sent. Nothing was changed.';\n if (error.status === 401) return 'Your session has ended. Sign in again, then retry.';\n if (error.code === 'cross_origin') return 'coffre refused a change that did not come from this page. Reload, then retry.';\n if (error.status === 403) {\n return 'You hold no grant that covers this. Someone with grant.manage on the project can add one.';\n }\n if (error.status === 404) return 'Not found. It may have been renamed or archived.';\n // A 400 or 409 carries a sentence written for the person, such as which\n // field of a request is wrong. Anything unexpected stays generic.\n if (error.status === 400 || error.status === 409) return error.message;\n return 'coffre is unavailable. Nothing was read or written.';\n}\n\nexport function uiFailure(error: unknown): Failure {\n return { ok: false, error: failureMessage(error), signedOut: statusOf(error) === 401 };\n}\n\n/** A loader's answer: what it read, or what to say instead. */\nexport async function uiResult<T extends object>(\n operation: () => Promise<T>,\n): Promise<({ ok: true } & T) | Failure> {\n try {\n return { ok: true, ...(await operation()) };\n } catch (error) {\n return uiFailure(error);\n }\n}\n\n/** How the API names a member: `user:ada@acme.example`, `token:ci-deploy`. */\nexport function memberRef(principalType: 'user' | 'service', principalId: string): string {\n return `${principalType === 'user' ? 'user' : 'token'}:${principalId}`;\n}\n","import type { ReactNode } from 'react';\nimport { Tile } from './tile';\n\n/**\n * The head of every page: an optional project tile, the title with a muted\n * aside, one line of description or facts, and the page's own actions.\n *\n * Where you are is already in the top bar's path, so the head does not repeat\n * it; it says what this page is.\n */\nexport function PageHeader({\n tile,\n lead,\n title,\n aside,\n description,\n meta,\n actions,\n}: {\n tile?: string;\n /** Stands where the tile would, for pages that are not about a project. */\n lead?: ReactNode;\n title: ReactNode;\n aside?: ReactNode;\n description?: ReactNode;\n meta?: ReactNode;\n actions?: ReactNode;\n}) {\n return (\n <header className=\"page-head\">\n <div className=\"page-head-text\">\n {tile !== undefined && <Tile name={tile} size=\"lg\" />}\n {lead}\n <div style={{ minWidth: 0 }}>\n <h1 className=\"page-title\">\n <span>{title}</span>\n {aside !== undefined && aside !== null && (\n <span className=\"page-title-aside\">{aside}</span>\n )}\n </h1>\n {description !== undefined && <p className=\"page-desc\">{description}</p>}\n {meta !== undefined && <div className=\"page-meta\">{meta}</div>}\n </div>\n </div>\n {actions !== undefined && actions !== false && (\n <div className=\"page-actions\">{actions}</div>\n )}\n </header>\n );\n}\n\n/** A bordered panel with a titled head; tables inside it run edge to edge. */\nexport function Card({\n title,\n description,\n actions,\n children,\n labelledBy,\n tone,\n}: {\n title: ReactNode;\n description?: ReactNode;\n actions?: ReactNode;\n children: ReactNode;\n labelledBy: string;\n tone?: 'danger';\n}) {\n return (\n <section\n className={`card${tone === 'danger' ? ' card-danger' : ''}`}\n aria-labelledby={labelledBy}\n >\n <div className=\"card-head\">\n <div>\n <h2 className=\"card-title\" id={labelledBy}>\n {title}\n </h2>\n {description !== undefined && <p className=\"card-desc\">{description}</p>}\n </div>\n {actions}\n </div>\n {children}\n </section>\n );\n}\n\n/** One labelled fact in a card's `dl.facts`. */\nexport function Fact({ label, children }: { label: string; children: ReactNode }) {\n return (\n <div className=\"fact\">\n <dt>{label}</dt>\n <dd>{children}</dd>\n </div>\n );\n}\n\n/**\n * A page that cannot be shown: no access, no such thing, or no session.\n *\n * It says which page, why in a sentence, and offers the one useful way out.\n */\nexport function ClosedDoor({\n icon,\n label,\n title,\n children,\n actions,\n}: {\n icon?: ReactNode;\n label?: ReactNode;\n title: ReactNode;\n children: ReactNode;\n actions?: ReactNode;\n}) {\n return (\n <div className=\"closed\" role=\"status\">\n {icon !== undefined && (\n <div className=\"closed-icon\" aria-hidden>\n {icon}\n </div>\n )}\n {label !== undefined && <p className=\"closed-label\">{label}</p>}\n <h1 className=\"closed-title\">{title}</h1>\n <div className=\"closed-body\">{children}</div>\n {actions !== undefined && <div className=\"closed-actions\">{actions}</div>}\n </div>\n );\n}\n"],"mappings":";;;;AAAA,IAAM,OAAO;CAAC;CAAQ;CAAS;CAAS;AAAQ;;AAGhD,SAAgB,QAAQ,MAAqC;CAC3D,IAAI,OAAO;CACX,KAAK,MAAM,QAAQ,MAAM,OAAO,KAAK,KAAK,OAAO,KAAK,WAAW,CAAC,GAAG,QAAU,MAAM;CACrF,OAAO,KAAK,OAAO,KAAK;AAC1B;;;;;;;AAQA,SAAgB,KAAK,EAAE,MAAM,OAAO,QAA8C;CAChF,OACE,oBAAC,QAAD;EAAM,WAAW,aAAa,QAAQ,IAAI,IAAI,SAAS,O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S,CAAA;GAC9D,oBAAC,MAAD;IAAI,WAAU;cAAgB;GAAU,CAAA;GACxC,oBAAC,OAAD;IAAK,WAAU;IAAe;GAAc,CAAA;GAC3C,YAAY,KAAA,KAAa,oBAAC,OAAD;IAAK,WAAU;cAAkB;GAAa,CAAA;EACrE;;AAET"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useLoaderData, useParams, useSearch } from "@tanstack/react-router";
|
|
2
|
+
//#region src/lib/page-route.ts
|
|
3
|
+
/** Untyped, as the router gives it for a match it cannot name. */
|
|
4
|
+
var read = (value) => value;
|
|
5
|
+
/**
|
|
6
|
+
* What a page's component reads of its route, wherever the deployment put
|
|
7
|
+
* it, typed by the page's options: the match it renders in, its loader's
|
|
8
|
+
* data, its params and its search. `pageRoute<typeof project>()`.
|
|
9
|
+
*/
|
|
10
|
+
function pageRoute() {
|
|
11
|
+
return {
|
|
12
|
+
useLoaderData: () => read(useLoaderData({ strict: false })),
|
|
13
|
+
useParams: () => read(useParams({ strict: false })),
|
|
14
|
+
useSearch: () => read(useSearch({ strict: false }))
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { pageRoute as t };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=page-route-Drfw7lmn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-route-Drfw7lmn.js","names":[],"sources":["../../src/lib/page-route.ts"],"sourcesContent":["import { useLoaderData, useParams, useSearch } from '@tanstack/react-router';\n\n/** A page's route options, as `../options.ts` has them. */\ntype PageOptions = { loader?: (context: never) => unknown; validateSearch?: (search: never) => unknown };\n\ntype Params<TOptions extends PageOptions> = Parameters<NonNullable<TOptions['loader']>>[0] extends { params: infer P } ? P : object;\n\n/** Untyped, as the router gives it for a match it cannot name. */\nconst read = (value: unknown) => value;\n\n/**\n * What a page's component reads of its route, wherever the deployment put\n * it, typed by the page's options: the match it renders in, its loader's\n * data, its params and its search. `pageRoute<typeof project>()`.\n */\nexport function pageRoute<TOptions extends PageOptions>() {\n return {\n useLoaderData: () => read(useLoaderData({ strict: false })) as Awaited<ReturnType<NonNullable<TOptions['loader']>>>,\n useParams: () => read(useParams({ strict: false })) as Params<TOptions>,\n useSearch: () => read(useSearch({ strict: false })) as ReturnType<NonNullable<TOptions['validateSearch']>>,\n };\n}\n"],"mappings":";;;AAQA,IAAM,QAAQ,UAAmB;;;;;;AAOjC,SAAgB,YAA0C;CACxD,OAAO;EACL,qBAAqB,KAAK,cAAc,EAAE,QAAQ,MAAM,CAAC,CAAC;EAC1D,iBAAiB,KAAK,UAAU,EAAE,QAAQ,MAAM,CAAC,CAAC;EAClD,iBAAiB,KAAK,UAAU,EAAE,QAAQ,MAAM,CAAC,CAAC;CACpD;AACF"}
|