@coffre/ui 0.0.0 → 0.1.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/LICENSE +21 -0
- package/README.md +7 -3
- package/dist/client/.assetsignore +2 -0
- package/dist/client/_coffre/assets/account-C3Zo1l5A.js +1 -0
- package/dist/client/_coffre/assets/account-C4bNbeO7.js +2 -0
- package/dist/client/_coffre/assets/affordances-DiuJIiR2.js +1 -0
- package/dist/client/_coffre/assets/audit-1xLyuxGz.js +2 -0
- package/dist/client/_coffre/assets/audit-Dab2GuRj.js +1 -0
- package/dist/client/_coffre/assets/auth.device-BfCfeBWe.js +2 -0
- package/dist/client/_coffre/assets/auth.device-D2pCLF-X.js +1 -0
- package/dist/client/_coffre/assets/coffre-C7qL3HGR.js +1 -0
- package/dist/client/_coffre/assets/directory-C2Ou4SQv.js +1 -0
- package/dist/client/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
- package/dist/client/_coffre/assets/grants-fqTtJ-aW.js +1 -0
- package/dist/client/_coffre/assets/index-BpGwbjmM.js +12 -0
- 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/login-CR9CBXlw.js +2 -0
- package/dist/client/_coffre/assets/login-DZizFxa4.js +1 -0
- package/dist/client/_coffre/assets/offboarding-DOLJQcXU.js +1 -0
- package/dist/client/_coffre/assets/page-BxW2MwaX.js +1 -0
- package/dist/client/_coffre/assets/preload-helper-BHuP8_FL.js +46 -0
- package/dist/client/_coffre/assets/principal-page-xnBZVURr.js +1 -0
- package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +1 -0
- package/dist/client/_coffre/assets/projects._project._environment-CrWjQmIA.js +2 -0
- package/dist/client/_coffre/assets/projects._project._environment-CwRVG9Ne.js +3 -0
- package/dist/client/_coffre/assets/projects._project.index-CCDEuE-z.js +2 -0
- package/dist/client/_coffre/assets/projects._project.index-DCJsmnD7.js +1 -0
- package/dist/client/_coffre/assets/projects.index-B8eV8JIn.js +1 -0
- package/dist/client/_coffre/assets/projects.index-BNEC7Oz8.js +2 -0
- package/dist/client/_coffre/assets/settings-2BPsenNM.js +2 -0
- package/dist/client/_coffre/assets/settings-BrS0-wEt.js +1 -0
- package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +1 -0
- package/dist/client/_coffre/assets/tokens._token-B3-YwuKp.js +2 -0
- package/dist/client/_coffre/assets/tokens._token-D_hsbHx6.js +1 -0
- package/dist/client/_coffre/assets/tokens.index-BdKE2Jv8.js +2 -0
- package/dist/client/_coffre/assets/tokens.index-XvA4XRxh.js +1 -0
- package/dist/client/_coffre/assets/unregistered-CTRMtBIy.js +1 -0
- package/dist/client/_coffre/assets/use-action-DgAf-tiX.js +1 -0
- package/dist/client/_coffre/assets/users._user-BFPXcJ4y.js +2 -0
- package/dist/client/_coffre/assets/users._user-DEtMeSoh.js +1 -0
- package/dist/client/_coffre/assets/users.index-B03beUHq.js +1 -0
- package/dist/client/_coffre/assets/users.index-D8hwzM6P.js +2 -0
- package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/server/.vite/manifest.json +572 -0
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-B6CZDfrB.js +133 -0
- package/dist/server/_coffre/assets/account-B71_b5xc.js +296 -0
- package/dist/server/_coffre/assets/account-BoO6ZqMc.js +176 -0
- package/dist/server/_coffre/assets/affordances-BNaXjMOb.js +46 -0
- package/dist/server/_coffre/assets/async-local-storage-C0cwgkEr.js +3107 -0
- package/dist/server/_coffre/assets/audit-CwRFnSAY.js +74 -0
- package/dist/server/_coffre/assets/audit-t1sYjtrf.js +964 -0
- package/dist/server/_coffre/assets/auth.device-1IcJ475s.js +208 -0
- package/dist/server/_coffre/assets/auth.device-CJwZYYtn.js +29 -0
- package/dist/server/_coffre/assets/coffre-1hxT2E_U.js +278 -0
- package/dist/server/_coffre/assets/directory-wm_JQUfk.js +396 -0
- package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +5 -0
- package/dist/server/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
- package/dist/server/_coffre/assets/grants-BmhEY1vz.js +243 -0
- 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/login-B5O5LPXV.js +100 -0
- package/dist/server/_coffre/assets/login-Bvc4gp0X.js +22 -0
- package/dist/server/_coffre/assets/offboarding-CvSilnSm.js +330 -0
- package/dist/server/_coffre/assets/page-BjXk0Ehu.js +2003 -0
- package/dist/server/_coffre/assets/principal-page-DkwNGzM2.js +617 -0
- package/dist/server/_coffre/assets/project-environments-lEzFHUt4.js +9 -0
- package/dist/server/_coffre/assets/projects._project._environment-7grhqlgq.js +2227 -0
- package/dist/server/_coffre/assets/projects._project._environment-ByEf6pmz.js +55 -0
- package/dist/server/_coffre/assets/projects._project.index-B1bjowP-.js +932 -0
- package/dist/server/_coffre/assets/projects._project.index-DU8wtoHD.js +22 -0
- package/dist/server/_coffre/assets/projects.index-B0DoHbCz.js +280 -0
- package/dist/server/_coffre/assets/projects.index-kMDA6pMy.js +54 -0
- package/dist/server/_coffre/assets/react-dom-qCTiwGGR.js +1352 -0
- package/dist/server/_coffre/assets/router-ChU_CwCX.js +2028 -0
- package/dist/server/_coffre/assets/settings-CM9-h7in.js +18 -0
- package/dist/server/_coffre/assets/settings-Cg5qOGij.js +60 -0
- package/dist/server/_coffre/assets/signin-errors-BEFlVDbQ.js +28 -0
- package/dist/server/_coffre/assets/start-DR3rN0St.js +4 -0
- package/dist/server/_coffre/assets/tokens._token-CCpaPMAk.js +268 -0
- package/dist/server/_coffre/assets/tokens._token-Di4OZdAA.js +18 -0
- package/dist/server/_coffre/assets/tokens.index-Do3OHR31.js +34 -0
- package/dist/server/_coffre/assets/tokens.index-tDKq4AFh.js +10 -0
- package/dist/server/_coffre/assets/ui-BNzhIAQP.js +15710 -0
- package/dist/server/_coffre/assets/unregistered-BqaWYFJK.js +51 -0
- package/dist/server/_coffre/assets/use-action-BkJXC5JM.js +953 -0
- package/dist/server/_coffre/assets/useStore-DWGPqzXR.js +892 -0
- package/dist/server/_coffre/assets/users._user-BenYva93.js +15 -0
- package/dist/server/_coffre/assets/users._user-Cp039Va-.js +10 -0
- package/dist/server/_coffre/assets/users.index-BrzG1Ecq.js +10 -0
- package/dist/server/_coffre/assets/users.index-DQ_45DQl.js +34 -0
- package/dist/server/_coffre/assets/validation-BQtqPe2V.js +27 -0
- package/dist/server/index.js +13910 -0
- package/package.json +58 -5
- package/src/components/affordances.ts +80 -0
- package/src/components/agentation.tsx +34 -0
- package/src/components/command-palette.tsx +271 -0
- package/src/components/directory.tsx +448 -0
- package/src/components/grants.tsx +204 -0
- package/src/components/icons.tsx +283 -0
- package/src/components/offboarding.tsx +286 -0
- package/src/components/page.tsx +128 -0
- package/src/components/principal-page.tsx +549 -0
- package/src/components/principal-picker.tsx +168 -0
- package/src/components/principal.tsx +53 -0
- package/src/components/route-states.tsx +60 -0
- package/src/components/service-tokens.tsx +212 -0
- package/src/components/shell.tsx +641 -0
- package/src/components/syncs.tsx +581 -0
- package/src/components/theme.tsx +141 -0
- package/src/components/tile.tsx +22 -0
- package/src/components/ui.tsx +440 -0
- package/src/entry.ts +19 -0
- package/src/lib/access-plan.ts +201 -0
- package/src/lib/audit-sentences.ts +468 -0
- package/src/lib/capabilities.ts +45 -0
- package/src/lib/coffre.ts +57 -0
- package/src/lib/project-access.ts +95 -0
- package/src/lib/project-environments.ts +23 -0
- package/src/lib/reveal.ts +21 -0
- package/src/lib/secret-edit-batch.ts +181 -0
- package/src/lib/signin-errors.ts +33 -0
- package/src/lib/use-action.ts +50 -0
- package/src/lib/validation.ts +27 -0
- package/src/routeTree.gen.ts +367 -0
- package/src/router.tsx +84 -0
- package/src/routes/__root.tsx +192 -0
- package/src/routes/access.tsx +11 -0
- package/src/routes/account.tsx +359 -0
- package/src/routes/audit.tsx +545 -0
- package/src/routes/auth.device.tsx +200 -0
- package/src/routes/index.tsx +15 -0
- package/src/routes/login.tsx +129 -0
- package/src/routes/projects.$project.$environment.tsx +1659 -0
- package/src/routes/projects.$project.index.tsx +917 -0
- package/src/routes/projects.index.tsx +353 -0
- package/src/routes/settings.tsx +72 -0
- package/src/routes/tokens.$token.tsx +35 -0
- package/src/routes/tokens.index.tsx +37 -0
- package/src/routes/unregistered.tsx +59 -0
- package/src/routes/users.$user.tsx +13 -0
- package/src/routes/users.index.tsx +37 -0
- package/src/shared/models.ts +55 -0
- package/src/styles/globals.css +4118 -0
- package/src/types.ts +21 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
//#region \0tanstack-start-manifest:v
|
|
2
|
+
var tsrStartManifest = () => ({ routes: {
|
|
3
|
+
__root__: {
|
|
4
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/__root.tsx",
|
|
5
|
+
children: [
|
|
6
|
+
"/",
|
|
7
|
+
"/access",
|
|
8
|
+
"/account",
|
|
9
|
+
"/audit",
|
|
10
|
+
"/login",
|
|
11
|
+
"/settings",
|
|
12
|
+
"/unregistered",
|
|
13
|
+
"/auth/device",
|
|
14
|
+
"/tokens/$token",
|
|
15
|
+
"/users/$user",
|
|
16
|
+
"/projects/",
|
|
17
|
+
"/tokens/",
|
|
18
|
+
"/users/",
|
|
19
|
+
"/projects/$project/$environment",
|
|
20
|
+
"/projects/$project/"
|
|
21
|
+
],
|
|
22
|
+
preloads: [
|
|
23
|
+
"/_coffre/assets/index-BpGwbjmM.js",
|
|
24
|
+
"/_coffre/assets/page-BxW2MwaX.js",
|
|
25
|
+
"/_coffre/assets/preload-helper-BHuP8_FL.js",
|
|
26
|
+
"/_coffre/assets/coffre-C7qL3HGR.js",
|
|
27
|
+
"/_coffre/assets/use-action-DgAf-tiX.js",
|
|
28
|
+
"/_coffre/assets/affordances-DiuJIiR2.js",
|
|
29
|
+
"/_coffre/assets/project-environments-CfIH5kFM.js",
|
|
30
|
+
"/_coffre/assets/account-C4bNbeO7.js",
|
|
31
|
+
"/_coffre/assets/audit-1xLyuxGz.js",
|
|
32
|
+
"/_coffre/assets/login-CR9CBXlw.js",
|
|
33
|
+
"/_coffre/assets/settings-2BPsenNM.js",
|
|
34
|
+
"/_coffre/assets/auth.device-BfCfeBWe.js",
|
|
35
|
+
"/_coffre/assets/projects.index-BNEC7Oz8.js",
|
|
36
|
+
"/_coffre/assets/tokens.index-BdKE2Jv8.js",
|
|
37
|
+
"/_coffre/assets/tokens._token-B3-YwuKp.js",
|
|
38
|
+
"/_coffre/assets/users.index-D8hwzM6P.js",
|
|
39
|
+
"/_coffre/assets/users._user-BFPXcJ4y.js",
|
|
40
|
+
"/_coffre/assets/projects._project.index-CCDEuE-z.js",
|
|
41
|
+
"/_coffre/assets/projects._project._environment-CrWjQmIA.js"
|
|
42
|
+
],
|
|
43
|
+
scripts: [{ attrs: {
|
|
44
|
+
type: "module",
|
|
45
|
+
async: !0,
|
|
46
|
+
src: "/_coffre/assets/index-BpGwbjmM.js"
|
|
47
|
+
} }]
|
|
48
|
+
},
|
|
49
|
+
"/account": {
|
|
50
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/account.tsx",
|
|
51
|
+
children: void 0,
|
|
52
|
+
preloads: [
|
|
53
|
+
"/_coffre/assets/account-C3Zo1l5A.js",
|
|
54
|
+
"/_coffre/assets/directory-C2Ou4SQv.js",
|
|
55
|
+
"/_coffre/assets/signin-errors-CroZWZgm.js"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
"/audit": {
|
|
59
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/audit.tsx",
|
|
60
|
+
children: void 0,
|
|
61
|
+
preloads: ["/_coffre/assets/audit-Dab2GuRj.js"]
|
|
62
|
+
},
|
|
63
|
+
"/login": {
|
|
64
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/login.tsx",
|
|
65
|
+
children: void 0,
|
|
66
|
+
preloads: ["/_coffre/assets/login-DZizFxa4.js", "/_coffre/assets/signin-errors-CroZWZgm.js"]
|
|
67
|
+
},
|
|
68
|
+
"/settings": {
|
|
69
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/settings.tsx",
|
|
70
|
+
children: void 0,
|
|
71
|
+
preloads: ["/_coffre/assets/settings-BrS0-wEt.js"]
|
|
72
|
+
},
|
|
73
|
+
"/unregistered": {
|
|
74
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/unregistered.tsx",
|
|
75
|
+
children: void 0,
|
|
76
|
+
preloads: ["/_coffre/assets/unregistered-CTRMtBIy.js"]
|
|
77
|
+
},
|
|
78
|
+
"/auth/device": {
|
|
79
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/auth.device.tsx",
|
|
80
|
+
children: void 0,
|
|
81
|
+
preloads: ["/_coffre/assets/auth.device-D2pCLF-X.js"]
|
|
82
|
+
},
|
|
83
|
+
"/tokens/$token": {
|
|
84
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/tokens.$token.tsx",
|
|
85
|
+
children: void 0,
|
|
86
|
+
preloads: ["/_coffre/assets/tokens._token-D_hsbHx6.js", "/_coffre/assets/principal-page-xnBZVURr.js"]
|
|
87
|
+
},
|
|
88
|
+
"/users/$user": {
|
|
89
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/users.$user.tsx",
|
|
90
|
+
children: void 0,
|
|
91
|
+
preloads: ["/_coffre/assets/users._user-DEtMeSoh.js", "/_coffre/assets/principal-page-xnBZVURr.js"]
|
|
92
|
+
},
|
|
93
|
+
"/projects/": {
|
|
94
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/projects.index.tsx",
|
|
95
|
+
children: void 0,
|
|
96
|
+
preloads: ["/_coffre/assets/projects.index-B8eV8JIn.js", "/_coffre/assets/validation-9Cl_XS-l.js"]
|
|
97
|
+
},
|
|
98
|
+
"/tokens/": {
|
|
99
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/tokens.index.tsx",
|
|
100
|
+
children: void 0,
|
|
101
|
+
preloads: [
|
|
102
|
+
"/_coffre/assets/tokens.index-XvA4XRxh.js",
|
|
103
|
+
"/_coffre/assets/directory-C2Ou4SQv.js",
|
|
104
|
+
"/_coffre/assets/offboarding-DOLJQcXU.js"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"/users/": {
|
|
108
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/users.index.tsx",
|
|
109
|
+
children: void 0,
|
|
110
|
+
preloads: [
|
|
111
|
+
"/_coffre/assets/users.index-B03beUHq.js",
|
|
112
|
+
"/_coffre/assets/directory-C2Ou4SQv.js",
|
|
113
|
+
"/_coffre/assets/offboarding-DOLJQcXU.js"
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"/projects/$project/$environment": {
|
|
117
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/projects.$project.$environment.tsx",
|
|
118
|
+
children: void 0,
|
|
119
|
+
preloads: ["/_coffre/assets/projects._project._environment-CwRVG9Ne.js", "/_coffre/assets/validation-9Cl_XS-l.js"]
|
|
120
|
+
},
|
|
121
|
+
"/projects/$project/": {
|
|
122
|
+
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/projects.$project.index.tsx",
|
|
123
|
+
children: void 0,
|
|
124
|
+
preloads: [
|
|
125
|
+
"/_coffre/assets/projects._project.index-DCJsmnD7.js",
|
|
126
|
+
"/_coffre/assets/directory-C2Ou4SQv.js",
|
|
127
|
+
"/_coffre/assets/grants-fqTtJ-aW.js",
|
|
128
|
+
"/_coffre/assets/validation-9Cl_XS-l.js"
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
} });
|
|
132
|
+
//#endregion
|
|
133
|
+
export { tsrStartManifest };
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { o as require_jsx_runtime } from "./useStore-DWGPqzXR.js";
|
|
2
|
+
import { a as ErrorLine, i as EmptyState, l as Timestamp, s as Notice, t as ConfirmButton } from "./ui-BNzhIAQP.js";
|
|
3
|
+
import { W as SignOut, Y as Terminal, et as X, i as PageHeader, j as Monitor, r as Fact, t as Card, tt as useLoaderData, z as ProviderMark } from "./page-BjXk0Ehu.js";
|
|
4
|
+
import { s as useCoffre } from "./coffre-1hxT2E_U.js";
|
|
5
|
+
import { r as toast, t as useAction } from "./use-action-BkJXC5JM.js";
|
|
6
|
+
import { n as ThemeCards, t as Route } from "./account-BoO6ZqMc.js";
|
|
7
|
+
import { r as InstanceRole } from "./directory-wm_JQUfk.js";
|
|
8
|
+
import { t as signinErrorMessage } from "./signin-errors-BEFlVDbQ.js";
|
|
9
|
+
//#region src/routes/account.tsx?tsr-split=component
|
|
10
|
+
/**
|
|
11
|
+
* Your own settings: how coffre looks here, who it takes you for and, when
|
|
12
|
+
* coffre runs its own sign-in, which accounts you sign in with and where you
|
|
13
|
+
* are signed in. The sidebar's Settings is the workspace's; this page is
|
|
14
|
+
* reached from your account at the sidebar's foot.
|
|
15
|
+
*/
|
|
16
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
17
|
+
function AccountPage() {
|
|
18
|
+
const { principal, instanceRole } = useLoaderData({ from: "__root__" });
|
|
19
|
+
const signin = Route.useLoaderData();
|
|
20
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
21
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageHeader, {
|
|
22
|
+
title: "Account",
|
|
23
|
+
actions: principal !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SignOutButton, {})
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
|
|
26
|
+
labelledBy: "appearance",
|
|
27
|
+
title: "Appearance",
|
|
28
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
29
|
+
className: "card-body",
|
|
30
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeCards, {})
|
|
31
|
+
})
|
|
32
|
+
}),
|
|
33
|
+
principal !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
|
|
34
|
+
labelledBy: "identity",
|
|
35
|
+
title: "Identity",
|
|
36
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dl", {
|
|
37
|
+
className: "facts",
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fact, {
|
|
40
|
+
label: principal.type === "user" ? "Email" : "Name",
|
|
41
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
42
|
+
className: "mono",
|
|
43
|
+
children: principal.id
|
|
44
|
+
})
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fact, {
|
|
47
|
+
label: "Kind",
|
|
48
|
+
children: principal.type === "user" ? "User" : "Token"
|
|
49
|
+
}),
|
|
50
|
+
principal.type === "user" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fact, {
|
|
51
|
+
label: "Instance role",
|
|
52
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InstanceRole, { principal: {
|
|
53
|
+
principalType: "user",
|
|
54
|
+
principalId: principal.id,
|
|
55
|
+
instanceRole: instanceRole ?? "user",
|
|
56
|
+
isRootAdmin: instanceRole === "root-admin"
|
|
57
|
+
} })
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
!signin.ok ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error: signin.error }) : signin.signin && principal?.type === "user" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SigninAccounts, {
|
|
63
|
+
email: principal.id,
|
|
64
|
+
...signin
|
|
65
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sessions, {
|
|
66
|
+
sessions: signin.sessions,
|
|
67
|
+
providers: signin.providers
|
|
68
|
+
})] })
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Sign-out is a form post: a GET could be triggered by any image tag on any
|
|
73
|
+
* page, and the server's origin check covers form posts.
|
|
74
|
+
*/
|
|
75
|
+
function SignOutButton() {
|
|
76
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", {
|
|
77
|
+
method: "post",
|
|
78
|
+
action: "/auth/signout",
|
|
79
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
80
|
+
className: "btn",
|
|
81
|
+
type: "submit",
|
|
82
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SignOut, { size: 14 }), "Sign out"]
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function providerLabel(providers, id) {
|
|
87
|
+
return providers.find((provider) => provider.id === id)?.label ?? id ?? "unknown";
|
|
88
|
+
}
|
|
89
|
+
function SigninAccounts({ email, providers, identities }) {
|
|
90
|
+
const { linked, error } = Route.useSearch();
|
|
91
|
+
const message = signinErrorMessage(error);
|
|
92
|
+
const coffre = useCoffre();
|
|
93
|
+
const { pending, error: actionError, run } = useAction();
|
|
94
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, {
|
|
95
|
+
labelledBy: "signin-accounts",
|
|
96
|
+
title: "Sign-in accounts",
|
|
97
|
+
description: "coffre recognises you by these accounts, never by an email address alone. A new account is linked here, while you are signed in.",
|
|
98
|
+
children: [
|
|
99
|
+
(linked !== void 0 || message !== null || actionError !== null) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
100
|
+
className: "card-body",
|
|
101
|
+
children: [linked !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Notice, {
|
|
102
|
+
tone: "good",
|
|
103
|
+
children: [providerLabel(providers, linked), " account linked."]
|
|
104
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error: message ?? actionError })]
|
|
105
|
+
}),
|
|
106
|
+
identities.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyState, {
|
|
107
|
+
title: "No account linked",
|
|
108
|
+
children: [
|
|
109
|
+
"Your next sign-in with a verified ",
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
111
|
+
className: "mono",
|
|
112
|
+
children: email
|
|
113
|
+
}),
|
|
114
|
+
" links that account."
|
|
115
|
+
]
|
|
116
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
117
|
+
className: "dt-wrap",
|
|
118
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", {
|
|
119
|
+
className: "dt",
|
|
120
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "Account" }),
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
123
|
+
className: "col-shrink",
|
|
124
|
+
children: "Linked (UTC)"
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
127
|
+
className: "col-shrink",
|
|
128
|
+
children: "Last sign-in"
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
131
|
+
className: "col-actions",
|
|
132
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
133
|
+
className: "visually-hidden",
|
|
134
|
+
children: "Actions"
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: identities.map((identity) => {
|
|
138
|
+
const label = providerLabel(providers, identity.provider);
|
|
139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
141
|
+
className: "cell-account",
|
|
142
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProviderMark, { brand: providers.find((p) => p.id === identity.provider)?.brand ?? "oidc" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
143
|
+
className: "cell-stack",
|
|
144
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: label }), identity.email !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
|
|
145
|
+
className: "mono",
|
|
146
|
+
children: identity.email
|
|
147
|
+
})]
|
|
148
|
+
})]
|
|
149
|
+
}) }),
|
|
150
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
151
|
+
className: "nowrap",
|
|
152
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, { iso: identity.createdAt })
|
|
153
|
+
}),
|
|
154
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
155
|
+
className: "nowrap cell-muted",
|
|
156
|
+
children: identity.lastSignInAt === null ? "Never" : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, {
|
|
157
|
+
iso: identity.lastSignInAt,
|
|
158
|
+
display: "relative"
|
|
159
|
+
})
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
162
|
+
className: "col-actions",
|
|
163
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfirmButton, {
|
|
164
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
165
|
+
className: "act",
|
|
166
|
+
disabled: pending,
|
|
167
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { size: 13 }), "Unlink"]
|
|
168
|
+
}),
|
|
169
|
+
title: `Unlink this ${label} account?`,
|
|
170
|
+
body: identities.length === 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
171
|
+
"It stops signing you in, and every session it opened ends now, this one included if you signed in with it. Your next sign-in with any account whose verified email is",
|
|
172
|
+
" ",
|
|
173
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
174
|
+
className: "mono",
|
|
175
|
+
children: email
|
|
176
|
+
}),
|
|
177
|
+
" links that account instead."
|
|
178
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "It stops signing you in, and every session it opened ends now, this one included if you signed in with it." }),
|
|
179
|
+
confirmLabel: "Unlink",
|
|
180
|
+
onConfirm: () => run(() => coffre.identities.unlink(identity.id), () => toast.success(`${label} account unlinked`))
|
|
181
|
+
})
|
|
182
|
+
})
|
|
183
|
+
] }, identity.id);
|
|
184
|
+
}) })]
|
|
185
|
+
})
|
|
186
|
+
}),
|
|
187
|
+
providers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
188
|
+
className: "card-foot",
|
|
189
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
190
|
+
className: "hint",
|
|
191
|
+
children: "Link another account"
|
|
192
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
193
|
+
className: "link-providers",
|
|
194
|
+
children: providers.map((provider) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", {
|
|
195
|
+
className: "btn btn-sm",
|
|
196
|
+
href: `/auth/signin/${encodeURIComponent(provider.id)}?link=1`,
|
|
197
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProviderMark, {
|
|
198
|
+
brand: provider.brand,
|
|
199
|
+
size: 14
|
|
200
|
+
}), provider.label]
|
|
201
|
+
}, provider.id))
|
|
202
|
+
})]
|
|
203
|
+
})
|
|
204
|
+
]
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function Sessions({ sessions, providers }) {
|
|
208
|
+
const coffre = useCoffre();
|
|
209
|
+
const { pending, error, run } = useAction();
|
|
210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, {
|
|
211
|
+
labelledBy: "sessions",
|
|
212
|
+
title: "Sessions",
|
|
213
|
+
description: "Browsers and command lines signed in as you. Ending one signs it out at its next request.",
|
|
214
|
+
children: [error !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
215
|
+
className: "card-body",
|
|
216
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error })
|
|
217
|
+
}), sessions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, {
|
|
218
|
+
title: "No sessions",
|
|
219
|
+
children: "Nothing is signed in as you right now."
|
|
220
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
221
|
+
className: "dt-wrap",
|
|
222
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", {
|
|
223
|
+
className: "dt",
|
|
224
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
225
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "Where" }),
|
|
226
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
227
|
+
className: "col-shrink",
|
|
228
|
+
children: "Last active"
|
|
229
|
+
}),
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
231
|
+
className: "col-shrink",
|
|
232
|
+
children: "Expires"
|
|
233
|
+
}),
|
|
234
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
235
|
+
className: "col-actions",
|
|
236
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
237
|
+
className: "visually-hidden",
|
|
238
|
+
children: "Actions"
|
|
239
|
+
})
|
|
240
|
+
})
|
|
241
|
+
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
242
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
243
|
+
className: "cell-account",
|
|
244
|
+
children: [session.kind === "cli" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Terminal, { size: 15 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Monitor, { size: 15 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
245
|
+
className: "cell-stack",
|
|
246
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
247
|
+
session.label ?? (session.kind === "cli" ? "Command line" : "Browser"),
|
|
248
|
+
" ",
|
|
249
|
+
session.current && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
250
|
+
className: "tag tag-blue",
|
|
251
|
+
children: "this browser"
|
|
252
|
+
})
|
|
253
|
+
] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("small", { children: [session.kind === "cli" ? "coffre login" : `via ${providerLabel(providers, session.provider)}`, session.lastUsedIp !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" · ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
254
|
+
className: "mono",
|
|
255
|
+
children: session.lastUsedIp
|
|
256
|
+
})] })] })]
|
|
257
|
+
})]
|
|
258
|
+
}) }),
|
|
259
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
260
|
+
className: "nowrap cell-muted",
|
|
261
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, {
|
|
262
|
+
iso: session.lastUsedAt ?? session.createdAt,
|
|
263
|
+
display: "relative"
|
|
264
|
+
})
|
|
265
|
+
}),
|
|
266
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
267
|
+
className: "nowrap cell-muted",
|
|
268
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, {
|
|
269
|
+
iso: session.expiresAt,
|
|
270
|
+
display: "relative"
|
|
271
|
+
})
|
|
272
|
+
}),
|
|
273
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
274
|
+
className: "col-actions",
|
|
275
|
+
children: session.current ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", {
|
|
276
|
+
method: "post",
|
|
277
|
+
action: "/auth/signout",
|
|
278
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
279
|
+
className: "act",
|
|
280
|
+
type: "submit",
|
|
281
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SignOut, { size: 13 }), "Sign out"]
|
|
282
|
+
})
|
|
283
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
284
|
+
className: "act",
|
|
285
|
+
disabled: pending,
|
|
286
|
+
onClick: () => run(() => coffre.sessions.revoke(session.id), () => toast.success("Session ended")),
|
|
287
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { size: 13 }), "End"]
|
|
288
|
+
})
|
|
289
|
+
})
|
|
290
|
+
] }, session.id)) })]
|
|
291
|
+
})
|
|
292
|
+
})]
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
export { AccountPage as component };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { C as require_react, E as __toESM, o as require_jsx_runtime } from "./useStore-DWGPqzXR.js";
|
|
2
|
+
import { C as lazyRouteComponent, h as dropdown_menu_exports, w as createFileRoute } from "./ui-BNzhIAQP.js";
|
|
3
|
+
import { K as Sun, M as Moon, j as Monitor, u as Check } from "./page-BjXk0Ehu.js";
|
|
4
|
+
import { o as uiResult } from "./coffre-1hxT2E_U.js";
|
|
5
|
+
//#region src/components/theme.tsx
|
|
6
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
7
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
8
|
+
var STORAGE_KEY = "coffre-theme";
|
|
9
|
+
var CHANGE_EVENT = "coffre-theme-change";
|
|
10
|
+
/**
|
|
11
|
+
* Applied before first paint, inlined in <head>.
|
|
12
|
+
*
|
|
13
|
+
* Without this the page renders in the system palette and then snaps to the
|
|
14
|
+
* stored choice once React hydrates -- a full-screen flash on every load for
|
|
15
|
+
* anyone who overrode it. Kept as a string so it runs synchronously; there is
|
|
16
|
+
* no way to do this correctly from a component.
|
|
17
|
+
*/
|
|
18
|
+
var themeBootScript = `(function(){try{var t=localStorage.getItem(${JSON.stringify(STORAGE_KEY)});if(t==="light"||t==="dark"){document.documentElement.setAttribute("data-theme",t)}}catch(e){}})()`;
|
|
19
|
+
function stored() {
|
|
20
|
+
try {
|
|
21
|
+
const value = localStorage.getItem(STORAGE_KEY);
|
|
22
|
+
return value === "light" || value === "dark" ? value : "system";
|
|
23
|
+
} catch {
|
|
24
|
+
return "system";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function apply(theme) {
|
|
28
|
+
const root = document.documentElement;
|
|
29
|
+
try {
|
|
30
|
+
if (theme === "system") localStorage.removeItem(STORAGE_KEY);
|
|
31
|
+
else localStorage.setItem(STORAGE_KEY, theme);
|
|
32
|
+
} catch {}
|
|
33
|
+
if (theme === "system") root.removeAttribute("data-theme");
|
|
34
|
+
else root.setAttribute("data-theme", theme);
|
|
35
|
+
window.dispatchEvent(new CustomEvent(CHANGE_EVENT));
|
|
36
|
+
}
|
|
37
|
+
var OPTIONS = [
|
|
38
|
+
{
|
|
39
|
+
value: "system",
|
|
40
|
+
label: "Match system",
|
|
41
|
+
Icon: Monitor
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
value: "light",
|
|
45
|
+
label: "Light",
|
|
46
|
+
Icon: Sun
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
value: "dark",
|
|
50
|
+
label: "Dark",
|
|
51
|
+
Icon: Moon
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
/**
|
|
55
|
+
* The stored choice, kept in step with changes made elsewhere (the command
|
|
56
|
+
* palette, another tab).
|
|
57
|
+
*
|
|
58
|
+
* Server-rendered markup cannot know the stored preference, so it starts on
|
|
59
|
+
* "system" and corrects itself on mount. Any other approach hydration-mismatches.
|
|
60
|
+
*/
|
|
61
|
+
function useTheme() {
|
|
62
|
+
const [theme, setThemeState] = (0, import_react.useState)("system");
|
|
63
|
+
(0, import_react.useEffect)(() => {
|
|
64
|
+
const sync = () => setThemeState(stored());
|
|
65
|
+
sync();
|
|
66
|
+
window.addEventListener(CHANGE_EVENT, sync);
|
|
67
|
+
window.addEventListener("storage", sync);
|
|
68
|
+
return () => {
|
|
69
|
+
window.removeEventListener(CHANGE_EVENT, sync);
|
|
70
|
+
window.removeEventListener("storage", sync);
|
|
71
|
+
};
|
|
72
|
+
}, []);
|
|
73
|
+
return theme;
|
|
74
|
+
}
|
|
75
|
+
/** The theme as a radio group inside a dropdown menu (the account menu). */
|
|
76
|
+
function ThemeMenuItems() {
|
|
77
|
+
const theme = useTheme();
|
|
78
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.RadioGroup, {
|
|
79
|
+
value: theme,
|
|
80
|
+
onValueChange: (value) => apply(value),
|
|
81
|
+
children: OPTIONS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.RadioItem, {
|
|
82
|
+
value,
|
|
83
|
+
className: "menu-item",
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { size: 15 }),
|
|
86
|
+
label,
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.ItemIndicator, {
|
|
88
|
+
className: "menu-check",
|
|
89
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { size: 14 })
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
}, value))
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Three glyphs, one of them pressed, for pages without the account menu.
|
|
97
|
+
* A menu for a three-way choice costs a click to find out the current value.
|
|
98
|
+
*/
|
|
99
|
+
function ThemeToggle() {
|
|
100
|
+
const theme = useTheme();
|
|
101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
102
|
+
className: "theme-choice",
|
|
103
|
+
role: "group",
|
|
104
|
+
"aria-label": "Colour scheme",
|
|
105
|
+
children: OPTIONS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
106
|
+
type: "button",
|
|
107
|
+
"aria-pressed": theme === value,
|
|
108
|
+
"aria-label": label,
|
|
109
|
+
title: label,
|
|
110
|
+
onClick: () => apply(value),
|
|
111
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { size: 14 })
|
|
112
|
+
}, value))
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/** Imperative theme setter, so the command palette can offer the same options. */
|
|
116
|
+
function setTheme(theme) {
|
|
117
|
+
apply(theme);
|
|
118
|
+
}
|
|
119
|
+
/** The theme as three large choices, for the Settings page. */
|
|
120
|
+
function ThemeCards() {
|
|
121
|
+
const theme = useTheme();
|
|
122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
123
|
+
className: "choice-grid",
|
|
124
|
+
role: "group",
|
|
125
|
+
"aria-label": "Colour scheme",
|
|
126
|
+
children: OPTIONS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
127
|
+
type: "button",
|
|
128
|
+
className: "choice",
|
|
129
|
+
"aria-pressed": theme === value,
|
|
130
|
+
onClick: () => apply(value),
|
|
131
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { size: 16 }), label]
|
|
132
|
+
}, value))
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/routes/account.tsx
|
|
137
|
+
var $$splitComponentImporter = () => import("./account-B71_b5xc.js");
|
|
138
|
+
/**
|
|
139
|
+
* Your own settings: how coffre looks here, who it takes you for and, when
|
|
140
|
+
* coffre runs its own sign-in, which accounts you sign in with and where you
|
|
141
|
+
* are signed in. The sidebar's Settings is the workspace's; this page is
|
|
142
|
+
* reached from your account at the sidebar's foot.
|
|
143
|
+
*/
|
|
144
|
+
var Route = createFileRoute("/account")({
|
|
145
|
+
validateSearch: (search) => {
|
|
146
|
+
const out = {};
|
|
147
|
+
for (const name of ["linked", "error"]) {
|
|
148
|
+
const value = search[name];
|
|
149
|
+
if (typeof value === "string" && /^[a-z0-9_-]{1,40}$/.test(value)) out[name] = value;
|
|
150
|
+
}
|
|
151
|
+
return out;
|
|
152
|
+
},
|
|
153
|
+
loader: async ({ context: { client }, parentMatchPromise }) => {
|
|
154
|
+
const auth = (await parentMatchPromise).loaderData?.auth;
|
|
155
|
+
if (auth === void 0 || auth.signin === null) return {
|
|
156
|
+
ok: true,
|
|
157
|
+
signin: false,
|
|
158
|
+
providers: [],
|
|
159
|
+
identities: [],
|
|
160
|
+
sessions: []
|
|
161
|
+
};
|
|
162
|
+
const { providers } = auth.signin;
|
|
163
|
+
return uiResult(async () => {
|
|
164
|
+
const [{ identities }, { sessions }] = await Promise.all([client.identities.list(), client.sessions.list()]);
|
|
165
|
+
return {
|
|
166
|
+
signin: true,
|
|
167
|
+
providers,
|
|
168
|
+
identities,
|
|
169
|
+
sessions
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
174
|
+
});
|
|
175
|
+
//#endregion
|
|
176
|
+
export { setTheme as a, ThemeToggle as i, ThemeCards as n, themeBootScript as o, ThemeMenuItems as r, Route as t };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { C as require_react, E as __toESM } from "./useStore-DWGPqzXR.js";
|
|
2
|
+
//#region src/lib/capabilities.ts
|
|
3
|
+
var NONE = {
|
|
4
|
+
canManageGrants: false,
|
|
5
|
+
canReadAudit: false,
|
|
6
|
+
canCreateProject: false
|
|
7
|
+
};
|
|
8
|
+
function deriveUiCapabilities(me, projects) {
|
|
9
|
+
if (me === null) return NONE;
|
|
10
|
+
const canManageInstance = me.instanceRole === "owner" || me.instanceRole === "root-admin";
|
|
11
|
+
return {
|
|
12
|
+
canManageGrants: canManageInstance,
|
|
13
|
+
canReadAudit: me.canReadAudit,
|
|
14
|
+
canCreateProject: canManageInstance
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** Secret values are available only where the API reports secret.read. */
|
|
18
|
+
function canRevealSecrets(permissions) {
|
|
19
|
+
return permissions.includes("secret.read");
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/components/affordances.ts
|
|
23
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
24
|
+
/** The shared ordering and visibility rule for administration destinations. */
|
|
25
|
+
function AdministrationItems({ capabilities, users, audit }) {
|
|
26
|
+
return (0, import_react.createElement)(import_react.Fragment, null, capabilities.canManageGrants ? users : null, capabilities.canReadAudit ? audit : null);
|
|
27
|
+
}
|
|
28
|
+
function hasAdministrationItems(capabilities) {
|
|
29
|
+
return capabilities.canManageGrants || capabilities.canReadAudit;
|
|
30
|
+
}
|
|
31
|
+
/** Project creation exists before a grantable resource, so it is owner-only. */
|
|
32
|
+
function RootAdminOnly({ capabilities, children }) {
|
|
33
|
+
return capabilities.canCreateProject ? children : null;
|
|
34
|
+
}
|
|
35
|
+
/** Empty project copy must distinguish an empty instance from archived-only state. */
|
|
36
|
+
function ProjectEmptyStateCopy({ capabilities, hasArchivedProjects }) {
|
|
37
|
+
if (hasArchivedProjects) return capabilities.canCreateProject ? "No active projects. Start a new one, or restore one from the archive below." : "No active projects. Your archived projects appear below.";
|
|
38
|
+
if (capabilities.canCreateProject) return "No projects exist yet. Start the first one with New project.";
|
|
39
|
+
return (0, import_react.createElement)(import_react.Fragment, null, "No project is visible to you. Someone holding ", (0, import_react.createElement)("span", { className: "mono" }, "grant.manage"), " on a project can add you.");
|
|
40
|
+
}
|
|
41
|
+
/** Reveal- and history-shaped controls require secret.read in this environment. */
|
|
42
|
+
function SecretReadOnly({ canReveal, children }) {
|
|
43
|
+
return canReveal ? children : null;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { hasAdministrationItems as a, SecretReadOnly as i, ProjectEmptyStateCopy as n, canRevealSecrets as o, RootAdminOnly as r, deriveUiCapabilities as s, AdministrationItems as t };
|