@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.
Files changed (168) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -3
  3. package/dist/client/.assetsignore +2 -0
  4. package/dist/client/_coffre/assets/account-C3Zo1l5A.js +1 -0
  5. package/dist/client/_coffre/assets/account-C4bNbeO7.js +2 -0
  6. package/dist/client/_coffre/assets/affordances-DiuJIiR2.js +1 -0
  7. package/dist/client/_coffre/assets/audit-1xLyuxGz.js +2 -0
  8. package/dist/client/_coffre/assets/audit-Dab2GuRj.js +1 -0
  9. package/dist/client/_coffre/assets/auth.device-BfCfeBWe.js +2 -0
  10. package/dist/client/_coffre/assets/auth.device-D2pCLF-X.js +1 -0
  11. package/dist/client/_coffre/assets/coffre-C7qL3HGR.js +1 -0
  12. package/dist/client/_coffre/assets/directory-C2Ou4SQv.js +1 -0
  13. package/dist/client/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
  14. package/dist/client/_coffre/assets/grants-fqTtJ-aW.js +1 -0
  15. package/dist/client/_coffre/assets/index-BpGwbjmM.js +12 -0
  16. package/dist/client/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
  17. package/dist/client/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
  18. package/dist/client/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
  19. package/dist/client/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
  20. package/dist/client/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
  21. package/dist/client/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
  22. package/dist/client/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
  23. package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  24. package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  25. package/dist/client/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  26. package/dist/client/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  27. package/dist/client/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  28. package/dist/client/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  29. package/dist/client/_coffre/assets/login-CR9CBXlw.js +2 -0
  30. package/dist/client/_coffre/assets/login-DZizFxa4.js +1 -0
  31. package/dist/client/_coffre/assets/offboarding-DOLJQcXU.js +1 -0
  32. package/dist/client/_coffre/assets/page-BxW2MwaX.js +1 -0
  33. package/dist/client/_coffre/assets/preload-helper-BHuP8_FL.js +46 -0
  34. package/dist/client/_coffre/assets/principal-page-xnBZVURr.js +1 -0
  35. package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +1 -0
  36. package/dist/client/_coffre/assets/projects._project._environment-CrWjQmIA.js +2 -0
  37. package/dist/client/_coffre/assets/projects._project._environment-CwRVG9Ne.js +3 -0
  38. package/dist/client/_coffre/assets/projects._project.index-CCDEuE-z.js +2 -0
  39. package/dist/client/_coffre/assets/projects._project.index-DCJsmnD7.js +1 -0
  40. package/dist/client/_coffre/assets/projects.index-B8eV8JIn.js +1 -0
  41. package/dist/client/_coffre/assets/projects.index-BNEC7Oz8.js +2 -0
  42. package/dist/client/_coffre/assets/settings-2BPsenNM.js +2 -0
  43. package/dist/client/_coffre/assets/settings-BrS0-wEt.js +1 -0
  44. package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +1 -0
  45. package/dist/client/_coffre/assets/tokens._token-B3-YwuKp.js +2 -0
  46. package/dist/client/_coffre/assets/tokens._token-D_hsbHx6.js +1 -0
  47. package/dist/client/_coffre/assets/tokens.index-BdKE2Jv8.js +2 -0
  48. package/dist/client/_coffre/assets/tokens.index-XvA4XRxh.js +1 -0
  49. package/dist/client/_coffre/assets/unregistered-CTRMtBIy.js +1 -0
  50. package/dist/client/_coffre/assets/use-action-DgAf-tiX.js +1 -0
  51. package/dist/client/_coffre/assets/users._user-BFPXcJ4y.js +2 -0
  52. package/dist/client/_coffre/assets/users._user-DEtMeSoh.js +1 -0
  53. package/dist/client/_coffre/assets/users.index-B03beUHq.js +1 -0
  54. package/dist/client/_coffre/assets/users.index-D8hwzM6P.js +2 -0
  55. package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +1 -0
  56. package/dist/index.d.ts +19 -0
  57. package/dist/server/.vite/manifest.json +572 -0
  58. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-B6CZDfrB.js +133 -0
  59. package/dist/server/_coffre/assets/account-B71_b5xc.js +296 -0
  60. package/dist/server/_coffre/assets/account-BoO6ZqMc.js +176 -0
  61. package/dist/server/_coffre/assets/affordances-BNaXjMOb.js +46 -0
  62. package/dist/server/_coffre/assets/async-local-storage-C0cwgkEr.js +3107 -0
  63. package/dist/server/_coffre/assets/audit-CwRFnSAY.js +74 -0
  64. package/dist/server/_coffre/assets/audit-t1sYjtrf.js +964 -0
  65. package/dist/server/_coffre/assets/auth.device-1IcJ475s.js +208 -0
  66. package/dist/server/_coffre/assets/auth.device-CJwZYYtn.js +29 -0
  67. package/dist/server/_coffre/assets/coffre-1hxT2E_U.js +278 -0
  68. package/dist/server/_coffre/assets/directory-wm_JQUfk.js +396 -0
  69. package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +5 -0
  70. package/dist/server/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
  71. package/dist/server/_coffre/assets/grants-BmhEY1vz.js +243 -0
  72. package/dist/server/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
  73. package/dist/server/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
  74. package/dist/server/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
  75. package/dist/server/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
  76. package/dist/server/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
  77. package/dist/server/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
  78. package/dist/server/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
  79. package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  80. package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  81. package/dist/server/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  82. package/dist/server/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  83. package/dist/server/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  84. package/dist/server/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  85. package/dist/server/_coffre/assets/login-B5O5LPXV.js +100 -0
  86. package/dist/server/_coffre/assets/login-Bvc4gp0X.js +22 -0
  87. package/dist/server/_coffre/assets/offboarding-CvSilnSm.js +330 -0
  88. package/dist/server/_coffre/assets/page-BjXk0Ehu.js +2003 -0
  89. package/dist/server/_coffre/assets/principal-page-DkwNGzM2.js +617 -0
  90. package/dist/server/_coffre/assets/project-environments-lEzFHUt4.js +9 -0
  91. package/dist/server/_coffre/assets/projects._project._environment-7grhqlgq.js +2227 -0
  92. package/dist/server/_coffre/assets/projects._project._environment-ByEf6pmz.js +55 -0
  93. package/dist/server/_coffre/assets/projects._project.index-B1bjowP-.js +932 -0
  94. package/dist/server/_coffre/assets/projects._project.index-DU8wtoHD.js +22 -0
  95. package/dist/server/_coffre/assets/projects.index-B0DoHbCz.js +280 -0
  96. package/dist/server/_coffre/assets/projects.index-kMDA6pMy.js +54 -0
  97. package/dist/server/_coffre/assets/react-dom-qCTiwGGR.js +1352 -0
  98. package/dist/server/_coffre/assets/router-ChU_CwCX.js +2028 -0
  99. package/dist/server/_coffre/assets/settings-CM9-h7in.js +18 -0
  100. package/dist/server/_coffre/assets/settings-Cg5qOGij.js +60 -0
  101. package/dist/server/_coffre/assets/signin-errors-BEFlVDbQ.js +28 -0
  102. package/dist/server/_coffre/assets/start-DR3rN0St.js +4 -0
  103. package/dist/server/_coffre/assets/tokens._token-CCpaPMAk.js +268 -0
  104. package/dist/server/_coffre/assets/tokens._token-Di4OZdAA.js +18 -0
  105. package/dist/server/_coffre/assets/tokens.index-Do3OHR31.js +34 -0
  106. package/dist/server/_coffre/assets/tokens.index-tDKq4AFh.js +10 -0
  107. package/dist/server/_coffre/assets/ui-BNzhIAQP.js +15710 -0
  108. package/dist/server/_coffre/assets/unregistered-BqaWYFJK.js +51 -0
  109. package/dist/server/_coffre/assets/use-action-BkJXC5JM.js +953 -0
  110. package/dist/server/_coffre/assets/useStore-DWGPqzXR.js +892 -0
  111. package/dist/server/_coffre/assets/users._user-BenYva93.js +15 -0
  112. package/dist/server/_coffre/assets/users._user-Cp039Va-.js +10 -0
  113. package/dist/server/_coffre/assets/users.index-BrzG1Ecq.js +10 -0
  114. package/dist/server/_coffre/assets/users.index-DQ_45DQl.js +34 -0
  115. package/dist/server/_coffre/assets/validation-BQtqPe2V.js +27 -0
  116. package/dist/server/index.js +13910 -0
  117. package/package.json +58 -5
  118. package/src/components/affordances.ts +80 -0
  119. package/src/components/agentation.tsx +34 -0
  120. package/src/components/command-palette.tsx +271 -0
  121. package/src/components/directory.tsx +448 -0
  122. package/src/components/grants.tsx +204 -0
  123. package/src/components/icons.tsx +283 -0
  124. package/src/components/offboarding.tsx +286 -0
  125. package/src/components/page.tsx +128 -0
  126. package/src/components/principal-page.tsx +549 -0
  127. package/src/components/principal-picker.tsx +168 -0
  128. package/src/components/principal.tsx +53 -0
  129. package/src/components/route-states.tsx +60 -0
  130. package/src/components/service-tokens.tsx +212 -0
  131. package/src/components/shell.tsx +641 -0
  132. package/src/components/syncs.tsx +581 -0
  133. package/src/components/theme.tsx +141 -0
  134. package/src/components/tile.tsx +22 -0
  135. package/src/components/ui.tsx +440 -0
  136. package/src/entry.ts +19 -0
  137. package/src/lib/access-plan.ts +201 -0
  138. package/src/lib/audit-sentences.ts +468 -0
  139. package/src/lib/capabilities.ts +45 -0
  140. package/src/lib/coffre.ts +57 -0
  141. package/src/lib/project-access.ts +95 -0
  142. package/src/lib/project-environments.ts +23 -0
  143. package/src/lib/reveal.ts +21 -0
  144. package/src/lib/secret-edit-batch.ts +181 -0
  145. package/src/lib/signin-errors.ts +33 -0
  146. package/src/lib/use-action.ts +50 -0
  147. package/src/lib/validation.ts +27 -0
  148. package/src/routeTree.gen.ts +367 -0
  149. package/src/router.tsx +84 -0
  150. package/src/routes/__root.tsx +192 -0
  151. package/src/routes/access.tsx +11 -0
  152. package/src/routes/account.tsx +359 -0
  153. package/src/routes/audit.tsx +545 -0
  154. package/src/routes/auth.device.tsx +200 -0
  155. package/src/routes/index.tsx +15 -0
  156. package/src/routes/login.tsx +129 -0
  157. package/src/routes/projects.$project.$environment.tsx +1659 -0
  158. package/src/routes/projects.$project.index.tsx +917 -0
  159. package/src/routes/projects.index.tsx +353 -0
  160. package/src/routes/settings.tsx +72 -0
  161. package/src/routes/tokens.$token.tsx +35 -0
  162. package/src/routes/tokens.index.tsx +37 -0
  163. package/src/routes/unregistered.tsx +59 -0
  164. package/src/routes/users.$user.tsx +13 -0
  165. package/src/routes/users.index.tsx +37 -0
  166. package/src/shared/models.ts +55 -0
  167. package/src/styles/globals.css +4118 -0
  168. package/src/types.ts +21 -0
@@ -0,0 +1,283 @@
1
+ import type { LucideIcon } from 'lucide-react';
2
+ import {
3
+ Activity as ActivityGlyph,
4
+ ArrowRight as ArrowRightGlyph,
5
+ Archive as ArchiveGlyph,
6
+ Ban,
7
+ Check as CheckGlyph,
8
+ ChevronDown as ChevronDownGlyph,
9
+ ChevronRight as ChevronRightGlyph,
10
+ ChevronsUpDown as ChevronsUpDownGlyph,
11
+ CircleAlert,
12
+ CircleCheck,
13
+ Clock as ClockGlyph,
14
+ Cloud as CloudGlyph,
15
+ Copy as CopyGlyph,
16
+ Ellipsis,
17
+ Eye as EyeGlyph,
18
+ EyeOff as EyeOffGlyph,
19
+ Folder as FolderGlyph,
20
+ Hash as HashGlyph,
21
+ History as HistoryGlyph,
22
+ Inbox as InboxGlyph,
23
+ Info as InfoGlyph,
24
+ KeyRound,
25
+ Layers as LayersGlyph,
26
+ Link as LinkGlyph,
27
+ LoaderCircle,
28
+ Lock as LockGlyph,
29
+ LogOut,
30
+ Menu as MenuGlyph,
31
+ Monitor as MonitorGlyph,
32
+ Moon as MoonGlyph,
33
+ PanelLeft as PanelLeftGlyph,
34
+ Pause as PauseGlyph,
35
+ Pencil as PencilGlyph,
36
+ Play as PlayGlyph,
37
+ Plus as PlusGlyph,
38
+ RefreshCw,
39
+ RotateCcw,
40
+ ScrollText,
41
+ Search as SearchGlyph,
42
+ Settings as SettingsGlyph,
43
+ ShieldCheck as ShieldCheckGlyph,
44
+ Sun as SunGlyph,
45
+ Terminal as TerminalGlyph,
46
+ TrainFront,
47
+ TriangleAlert,
48
+ Upload as UploadGlyph,
49
+ User as UserGlyph,
50
+ UserRoundCog,
51
+ Users as UsersGlyph,
52
+ X as XGlyph,
53
+ } from 'lucide-react';
54
+
55
+ /**
56
+ * One icon vocabulary for the whole app: Lucide, at one stroke weight.
57
+ *
58
+ * Mixing icon families is the fastest way to make a product UI feel assembled
59
+ * rather than designed, so every glyph comes through here and call sites never
60
+ * import Lucide themselves: changing one is a line in this file. The
61
+ * exceptions are marks that are not ours to redraw: coffre's keyhole and the
62
+ * sign-in providers' logos.
63
+ */
64
+
65
+ type IconProps = {
66
+ size?: number;
67
+ className?: string;
68
+ style?: React.CSSProperties;
69
+ /** Icons are decorative by default; pass a label when one carries meaning. */
70
+ label?: string;
71
+ };
72
+
73
+ function Svg({
74
+ size = 16,
75
+ className,
76
+ style,
77
+ label,
78
+ children,
79
+ }: IconProps & { children: React.ReactNode }) {
80
+ return (
81
+ <svg
82
+ width={size}
83
+ height={size}
84
+ viewBox="0 0 24 24"
85
+ fill="none"
86
+ stroke="currentColor"
87
+ strokeWidth={1.6}
88
+ strokeLinecap="round"
89
+ strokeLinejoin="round"
90
+ className={className}
91
+ style={style}
92
+ aria-hidden={label === undefined}
93
+ aria-label={label}
94
+ role={label === undefined ? undefined : 'img'}
95
+ >
96
+ {children}
97
+ </svg>
98
+ );
99
+ }
100
+
101
+ /**
102
+ * The mark: a keyhole, drawn solid so it holds up white-on-ink inside the
103
+ * brand tile at 16px. `MARK_SVG` below is the tile and keyhole together, for
104
+ * the favicon.
105
+ */
106
+ export function Mark(props: IconProps) {
107
+ return (
108
+ <Svg {...props}>
109
+ <circle cx="12" cy="9.5" r="3.4" fill="currentColor" stroke="none" />
110
+ <path d="M10.35 11.2h3.3l1.15 7.3h-5.6Z" fill="currentColor" stroke="none" />
111
+ </Svg>
112
+ );
113
+ }
114
+
115
+ export const MARK_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="8" fill="#171717"/><circle cx="16" cy="13" r="4.3" fill="#fafafa"/><path d="M13.9 15.2h4.2l1.45 9.2h-7.1Z" fill="#fafafa"/></svg>`;
116
+
117
+ /**
118
+ * Lucide draws on a 24-unit grid with a 2-unit stroke. At the 14-16px these
119
+ * are shown, 1.75 sits closer to Inter's weight beside them.
120
+ */
121
+ const STROKE = 1.75;
122
+
123
+ function lucide(Glyph: LucideIcon) {
124
+ // Lucide hides a glyph from assistive technology unless it is labelled.
125
+ return function Icon({ size = 16, className, style, label }: IconProps) {
126
+ return (
127
+ <Glyph
128
+ size={size}
129
+ strokeWidth={STROKE}
130
+ className={className}
131
+ style={style}
132
+ {...(label === undefined ? {} : { 'aria-label': label, role: 'img' })}
133
+ />
134
+ );
135
+ };
136
+ }
137
+
138
+ // Places
139
+ export const Folder = lucide(FolderGlyph);
140
+ export const Layers = lucide(LayersGlyph);
141
+ export const Users = lucide(UsersGlyph);
142
+ export const User = lucide(UserGlyph);
143
+ /** Your own settings, so they never share the workspace's gear. */
144
+ export const UserCog = lucide(UserRoundCog);
145
+ export const Key = lucide(KeyRound);
146
+ export const Ledger = lucide(ScrollText);
147
+ export const Settings = lucide(SettingsGlyph);
148
+
149
+ // Secrets
150
+ export const Eye = lucide(EyeGlyph);
151
+ export const EyeOff = lucide(EyeOffGlyph);
152
+ export const Copy = lucide(CopyGlyph);
153
+ export const Pencil = lucide(PencilGlyph);
154
+ export const Archive = lucide(ArchiveGlyph);
155
+ export const History = lucide(HistoryGlyph);
156
+ export const RotateBack = lucide(RotateCcw);
157
+ export const Upload = lucide(UploadGlyph);
158
+ export const Sync = lucide(RefreshCw);
159
+ export const Pause = lucide(PauseGlyph);
160
+ export const Play = lucide(PlayGlyph);
161
+ export const Lock = lucide(LockGlyph);
162
+ export const Terminal = lucide(TerminalGlyph);
163
+ export const Hash = lucide(HashGlyph);
164
+ export const Clock = lucide(ClockGlyph);
165
+
166
+ // Outcomes
167
+ export const Check = lucide(CheckGlyph);
168
+ export const CheckCircle = lucide(CircleCheck);
169
+ export const SlashCircle = lucide(Ban);
170
+ export const ShieldCheck = lucide(ShieldCheckGlyph);
171
+ export const AlertTriangle = lucide(TriangleAlert);
172
+ export const AlertCircle = lucide(CircleAlert);
173
+ export const Info = lucide(InfoGlyph);
174
+ export const Activity = lucide(ActivityGlyph);
175
+ export const Inbox = lucide(InboxGlyph);
176
+ export const Loader = lucide(LoaderCircle);
177
+
178
+ // Controls
179
+ export const X = lucide(XGlyph);
180
+ export const Plus = lucide(PlusGlyph);
181
+ export const Search = lucide(SearchGlyph);
182
+ export const Menu = lucide(MenuGlyph);
183
+ export const PanelLeft = lucide(PanelLeftGlyph);
184
+ export const MoreHorizontal = lucide(Ellipsis);
185
+ export const ChevronRight = lucide(ChevronRightGlyph);
186
+ export const ChevronDown = lucide(ChevronDownGlyph);
187
+ export const ChevronsUpDown = lucide(ChevronsUpDownGlyph);
188
+ export const ArrowRight = lucide(ArrowRightGlyph);
189
+ export const Link = lucide(LinkGlyph);
190
+ export const SignOut = lucide(LogOut);
191
+
192
+ // Theme
193
+ export const Sun = lucide(SunGlyph);
194
+ export const Moon = lucide(MoonGlyph);
195
+ export const Monitor = lucide(MonitorGlyph);
196
+
197
+ /**
198
+ * GitHub's mark, drawn as GitHub publishes it: a filled shape on its own
199
+ * 16-unit grid, since a brand is not ours to redraw in the stroke style.
200
+ */
201
+ export function GitHub({ size = 16, className, style }: IconProps) {
202
+ return (
203
+ <svg
204
+ width={size}
205
+ height={size}
206
+ viewBox="0 0 16 16"
207
+ fill="currentColor"
208
+ className={className}
209
+ style={style}
210
+ aria-hidden
211
+ >
212
+ <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z" />
213
+ </svg>
214
+ );
215
+ }
216
+
217
+ /** Google's "G", in its four colours, as Google's sign-in guidelines require. */
218
+ export function Google({ size = 16, className, style }: IconProps) {
219
+ return (
220
+ <svg width={size} height={size} viewBox="0 0 48 48" className={className} style={style} aria-hidden>
221
+ <path fill="#EA4335" d="M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z" />
222
+ <path fill="#4285F4" d="M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z" />
223
+ <path fill="#FBBC05" d="M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z" />
224
+ <path fill="#34A853" d="M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z" />
225
+ </svg>
226
+ );
227
+ }
228
+
229
+ /** Microsoft's four squares. */
230
+ export function Microsoft({ size = 16, className, style }: IconProps) {
231
+ return (
232
+ <svg width={size} height={size} viewBox="0 0 21 21" className={className} style={style} aria-hidden>
233
+ <rect x="0" y="0" width="10" height="10" fill="#F25022" />
234
+ <rect x="11" y="0" width="10" height="10" fill="#7FBA00" />
235
+ <rect x="0" y="11" width="10" height="10" fill="#00A4EF" />
236
+ <rect x="11" y="11" width="10" height="10" fill="#FFB900" />
237
+ </svg>
238
+ );
239
+ }
240
+
241
+ /** Vercel's triangle. */
242
+ export function Vercel({ size = 16, className, style }: IconProps) {
243
+ return (
244
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="currentColor" className={className} style={style} aria-hidden>
245
+ <path d="M12 2.5 23 21.5H1Z" />
246
+ </svg>
247
+ );
248
+ }
249
+
250
+ // Railway and Cloudflare marks are detailed enough that a redraw would be a
251
+ // guess; a plain glyph stands in for them.
252
+ const Cloud = lucide(CloudGlyph);
253
+ const Train = lucide(TrainFront);
254
+
255
+ /** The mark beside a sync provider; any other brand gets the sync glyph. */
256
+ export function SyncMark({ brand, size = 16 }: { brand: string; size?: number }) {
257
+ switch (brand) {
258
+ case 'github':
259
+ return <GitHub size={size} />;
260
+ case 'vercel':
261
+ return <Vercel size={size} />;
262
+ case 'railway':
263
+ return <Train size={size} />;
264
+ case 'cloudflare':
265
+ return <Cloud size={size} />;
266
+ default:
267
+ return <Sync size={size} />;
268
+ }
269
+ }
270
+
271
+ /** The mark on a provider's button; any other OpenID Connect issuer gets a key. */
272
+ export function ProviderMark({ brand, size = 16 }: { brand: string; size?: number }) {
273
+ switch (brand) {
274
+ case 'github':
275
+ return <GitHub size={size} />;
276
+ case 'google':
277
+ return <Google size={size} />;
278
+ case 'microsoft':
279
+ return <Microsoft size={size} />;
280
+ default:
281
+ return <Key size={size} />;
282
+ }
283
+ }
@@ -0,0 +1,286 @@
1
+ import { Link } from '@tanstack/react-router';
2
+ import type { PrincipalReport, RemovedPrincipal } from '../shared/models';
3
+ import { Card } from './page';
4
+ import { EmptyState, Notice, Timestamp } from './ui';
5
+ import { PrincipalLink } from './principal';
6
+ import { ChevronRight, Key, SyncMark, User } from './icons';
7
+
8
+ /**
9
+ * The part of a user's or token's page that answers "if they left, what would
10
+ * we have to change?". Owners only, and most useful once someone is removed:
11
+ * everything that let them in is gone by then, but what they saw is not.
12
+ */
13
+ export function PrincipalReportCards({ report }: { report: PrincipalReport }) {
14
+ const removed = report.status === 'removed';
15
+ const person = report.principalType === 'user';
16
+ return (
17
+ <>
18
+ <SeenValues report={report} removed={removed} person={person} />
19
+ {report.syncs.length > 0 && <CreatedSyncs report={report} person={person} />}
20
+ {report.issuedTokens.length > 0 && <IssuedTokens report={report} />}
21
+ </>
22
+ );
23
+ }
24
+
25
+ export function RemovedNotice({ report }: { report: PrincipalReport }) {
26
+ const person = report.principalType === 'user';
27
+ return (
28
+ <div className="report-notice">
29
+ <Notice>
30
+ Removed
31
+ {report.removedBy !== null && (
32
+ <>
33
+ {' '}by <span className="mono">{report.removedBy}</span>
34
+ </>
35
+ )}
36
+ {report.removedAt !== null && (
37
+ <>
38
+ {' '}on <Timestamp iso={report.removedAt} />
39
+ </>
40
+ )}
41
+ .{' '}
42
+ {person
43
+ ? 'Their project access, sessions, CLI logins and linked sign-in accounts were revoked at the same time, so adding them again starts from nothing.'
44
+ : 'Its project access and every token issued to it were revoked at the same time, so adding it again starts from nothing.'}
45
+ </Notice>
46
+ </div>
47
+ );
48
+ }
49
+
50
+ /**
51
+ * The people or tokens removed from the directory, under the live ones.
52
+ * Removal ends their access but not the work it leaves, so they stay one click
53
+ * away until every value they saw has been rotated.
54
+ */
55
+ export function RemovedList({
56
+ principalType,
57
+ removed,
58
+ }: {
59
+ principalType: RemovedPrincipal['principalType'];
60
+ removed: RemovedPrincipal[];
61
+ }) {
62
+ const users = principalType === 'user';
63
+ const rows = removed.filter((principal) => principal.principalType === principalType);
64
+ if (rows.length === 0) return null;
65
+ return (
66
+ <>
67
+ <h2 className="section-title">Removed</h2>
68
+ <section className="card" aria-label={users ? 'Removed users' : 'Removed tokens'}>
69
+ <div className="dt-wrap">
70
+ <table className="dt directory stacks">
71
+ <thead>
72
+ <tr>
73
+ <th className="n">#</th>
74
+ <th className="col-principal">
75
+ <span className="th">
76
+ {users ? <User size={14} /> : <Key size={14} />}
77
+ {users ? 'Email' : 'Name'}
78
+ </span>
79
+ </th>
80
+ <th className="col-role">Still to rotate</th>
81
+ <th className="col-actions">
82
+ <span className="visually-hidden">Report</span>
83
+ </th>
84
+ </tr>
85
+ </thead>
86
+ <tbody>
87
+ {rows.map((principal, index) => (
88
+ <tr key={principal.principalId} className="row-link">
89
+ <td className="n">{index + 1}</td>
90
+ <td className="col-lead" data-label={users ? 'Email' : 'Name'}>
91
+ <PrincipalLink type={principal.principalType} id={principal.principalId} stretch />
92
+ </td>
93
+ <td className="col-role" data-label="Still to rotate">
94
+ {principal.toRotate === 0 ? (
95
+ <span className="cell-muted">Nothing</span>
96
+ ) : (
97
+ `${principal.toRotate} ${principal.toRotate === 1 ? 'value' : 'values'}`
98
+ )}
99
+ </td>
100
+ {/* The row opens the report; the chevron says it does. */}
101
+ <td className="col-actions col-open cell-muted" aria-hidden="true">
102
+ <ChevronRight size={16} />
103
+ </td>
104
+ </tr>
105
+ ))}
106
+ </tbody>
107
+ </table>
108
+ </div>
109
+ </section>
110
+ <p className="hint section-foot">
111
+ {users ? 'They' : 'These'} can no longer sign in. Each page lists the values{' '}
112
+ {users ? 'they' : 'it'} saw that nobody has changed since.
113
+ </p>
114
+ </>
115
+ );
116
+ }
117
+
118
+ function SeenValues({
119
+ report,
120
+ removed,
121
+ person,
122
+ }: {
123
+ report: PrincipalReport;
124
+ removed: boolean;
125
+ person: boolean;
126
+ }) {
127
+ const they = person ? 'they' : 'it';
128
+ const description = removed
129
+ ? `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.`
130
+ : `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.`;
131
+
132
+ return (
133
+ <Card
134
+ labelledBy="seen-values"
135
+ title={removed ? 'Still to rotate' : 'Values seen'}
136
+ description={description}
137
+ actions={
138
+ report.rotated > 0 && (
139
+ <span className="card-aside">{report.rotated} already rotated</span>
140
+ )
141
+ }
142
+ >
143
+ {report.exposed.length === 0 ? (
144
+ <EmptyState title={removed ? 'Nothing left to rotate' : 'No current values seen'}>
145
+ {report.rotated > 0
146
+ ? `Every value ${they} saw has had a new version since.`
147
+ : `${person ? 'They have' : 'It has'} not read or written a value that is still current.`}
148
+ </EmptyState>
149
+ ) : (
150
+ <div className="dt-wrap">
151
+ <table className="dt report-values">
152
+ <thead>
153
+ <tr>
154
+ <th>Secret</th>
155
+ <th className="col-shrink">Version</th>
156
+ <th className="col-shrink">Last seen</th>
157
+ </tr>
158
+ </thead>
159
+ <tbody>
160
+ {report.exposed.map((secret) => (
161
+ <tr key={`${secret.project}/${secret.environment}/${secret.key}`}>
162
+ <td>
163
+ <Link
164
+ className="cell-link mono"
165
+ to="/projects/$project/$environment"
166
+ params={{ project: secret.project, environment: secret.environment }}
167
+ search={{ filter: secret.key }}
168
+ >
169
+ <span className="report-path">
170
+ {secret.project}/{secret.environment}/
171
+ </span>
172
+ {secret.key}
173
+ </Link>
174
+ </td>
175
+ <td className="col-shrink cell-mono cell-muted">v{secret.version}</td>
176
+ <td className="col-shrink nowrap">
177
+ {secret.how === 'wrote' ? 'Wrote' : 'Read'}{' '}
178
+ <Timestamp iso={secret.at} display="relative" />
179
+ </td>
180
+ </tr>
181
+ ))}
182
+ </tbody>
183
+ </table>
184
+ </div>
185
+ )}
186
+ </Card>
187
+ );
188
+ }
189
+
190
+ function CreatedSyncs({ report, person }: { report: PrincipalReport; person: boolean }) {
191
+ return (
192
+ <Card
193
+ labelledBy="created-syncs"
194
+ title={person ? 'Syncs they set up' : 'Syncs it set up'}
195
+ description="A sync keeps pushing every change to the destination it names, whoever set it up. Check each one still points somewhere you control."
196
+ >
197
+ <div className="dt-wrap">
198
+ <table className="dt syncs">
199
+ <thead>
200
+ <tr>
201
+ <th>Destination</th>
202
+ <th className="col-shrink">From</th>
203
+ <th className="col-shrink col-hide-narrow">Token</th>
204
+ </tr>
205
+ </thead>
206
+ <tbody>
207
+ {report.syncs.map((sync) => (
208
+ <tr key={sync.id}>
209
+ <td>
210
+ <span className="cell-account">
211
+ <SyncMark brand={sync.brand} size={15} />
212
+ <span className="cell-stack">
213
+ <span>
214
+ {sync.providerLabel}
215
+ {sync.paused && <span className="tag">Paused</span>}
216
+ </span>
217
+ <small className="mono">{sync.destination}</small>
218
+ </span>
219
+ </span>
220
+ </td>
221
+ <td className="col-shrink">
222
+ <Link
223
+ className="cell-link mono"
224
+ to="/projects/$project/$environment"
225
+ params={{ project: sync.project, environment: sync.environment }}
226
+ >
227
+ {sync.project}/{sync.environment}
228
+ </Link>
229
+ </td>
230
+ <td className="col-shrink col-hide-narrow cell-mono cell-muted">{sync.credential}</td>
231
+ </tr>
232
+ ))}
233
+ </tbody>
234
+ </table>
235
+ </div>
236
+ </Card>
237
+ );
238
+ }
239
+
240
+ function IssuedTokens({ report }: { report: PrincipalReport }) {
241
+ return (
242
+ <Card
243
+ labelledBy="issued-tokens"
244
+ title="Tokens they issued"
245
+ 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."
246
+ >
247
+ <div className="dt-wrap">
248
+ <table className="dt report-tokens">
249
+ <thead>
250
+ <tr>
251
+ <th>Token</th>
252
+ <th className="col-shrink">Expires</th>
253
+ <th className="col-shrink col-hide-narrow">Last used</th>
254
+ </tr>
255
+ </thead>
256
+ <tbody>
257
+ {report.issuedTokens.map((token) => (
258
+ <tr key={token.id}>
259
+ <td>
260
+ <span className="cell-stack">
261
+ <Link className="cell-link mono" to="/tokens/$token" params={{ token: token.service }}>
262
+ {token.service}
263
+ </Link>
264
+ <small>
265
+ {token.label ?? 'No label'} · <span className="mono">{token.hint}</span>
266
+ </small>
267
+ </span>
268
+ </td>
269
+ <td className="col-shrink nowrap">
270
+ <Timestamp iso={token.expiresAt} display="relative" />
271
+ </td>
272
+ <td className="col-shrink col-hide-narrow nowrap">
273
+ {token.lastUsedAt === null ? (
274
+ <span className="cell-muted">Never</span>
275
+ ) : (
276
+ <Timestamp iso={token.lastUsedAt} display="relative" />
277
+ )}
278
+ </td>
279
+ </tr>
280
+ ))}
281
+ </tbody>
282
+ </table>
283
+ </div>
284
+ </Card>
285
+ );
286
+ }
@@ -0,0 +1,128 @@
1
+ import type { ReactNode } from 'react';
2
+ import { Tile } from './tile';
3
+
4
+ /**
5
+ * The head of every page: an optional project tile, the title with a muted
6
+ * aside, one line of description or facts, and the page's own actions.
7
+ *
8
+ * Where you are is already in the top bar's path, so the head does not repeat
9
+ * it; it says what this page is.
10
+ */
11
+ export function PageHeader({
12
+ tile,
13
+ lead,
14
+ title,
15
+ aside,
16
+ description,
17
+ meta,
18
+ actions,
19
+ }: {
20
+ tile?: string;
21
+ /** Stands where the tile would, for pages that are not about a project. */
22
+ lead?: ReactNode;
23
+ title: ReactNode;
24
+ aside?: ReactNode;
25
+ description?: ReactNode;
26
+ meta?: ReactNode;
27
+ actions?: ReactNode;
28
+ }) {
29
+ return (
30
+ <header className="page-head">
31
+ <div className="page-head-text">
32
+ {tile !== undefined && <Tile name={tile} size="lg" />}
33
+ {lead}
34
+ <div style={{ minWidth: 0 }}>
35
+ <h1 className="page-title">
36
+ <span>{title}</span>
37
+ {aside !== undefined && aside !== null && (
38
+ <span className="page-title-aside">{aside}</span>
39
+ )}
40
+ </h1>
41
+ {description !== undefined && <p className="page-desc">{description}</p>}
42
+ {meta !== undefined && <div className="page-meta">{meta}</div>}
43
+ </div>
44
+ </div>
45
+ {actions !== undefined && actions !== false && (
46
+ <div className="page-actions">{actions}</div>
47
+ )}
48
+ </header>
49
+ );
50
+ }
51
+
52
+ /** A bordered panel with a titled head; tables inside it run edge to edge. */
53
+ export function Card({
54
+ title,
55
+ description,
56
+ actions,
57
+ children,
58
+ labelledBy,
59
+ tone,
60
+ }: {
61
+ title: ReactNode;
62
+ description?: ReactNode;
63
+ actions?: ReactNode;
64
+ children: ReactNode;
65
+ labelledBy: string;
66
+ tone?: 'danger';
67
+ }) {
68
+ return (
69
+ <section
70
+ className={`card${tone === 'danger' ? ' card-danger' : ''}`}
71
+ aria-labelledby={labelledBy}
72
+ >
73
+ <div className="card-head">
74
+ <div>
75
+ <h2 className="card-title" id={labelledBy}>
76
+ {title}
77
+ </h2>
78
+ {description !== undefined && <p className="card-desc">{description}</p>}
79
+ </div>
80
+ {actions}
81
+ </div>
82
+ {children}
83
+ </section>
84
+ );
85
+ }
86
+
87
+ /** One labelled fact in a card's `dl.facts`. */
88
+ export function Fact({ label, children }: { label: string; children: ReactNode }) {
89
+ return (
90
+ <div className="fact">
91
+ <dt>{label}</dt>
92
+ <dd>{children}</dd>
93
+ </div>
94
+ );
95
+ }
96
+
97
+ /**
98
+ * A page that cannot be shown: no access, no such thing, or no session.
99
+ *
100
+ * It says which page, why in a sentence, and offers the one useful way out.
101
+ */
102
+ export function ClosedDoor({
103
+ icon,
104
+ label,
105
+ title,
106
+ children,
107
+ actions,
108
+ }: {
109
+ icon?: ReactNode;
110
+ label?: ReactNode;
111
+ title: ReactNode;
112
+ children: ReactNode;
113
+ actions?: ReactNode;
114
+ }) {
115
+ return (
116
+ <div className="closed" role="status">
117
+ {icon !== undefined && (
118
+ <div className="closed-icon" aria-hidden>
119
+ {icon}
120
+ </div>
121
+ )}
122
+ {label !== undefined && <p className="closed-label">{label}</p>}
123
+ <h1 className="closed-title">{title}</h1>
124
+ <div className="closed-body">{children}</div>
125
+ {actions !== undefined && <div className="closed-actions">{actions}</div>}
126
+ </div>
127
+ );
128
+ }