@coffre/ui 0.14.4 → 0.15.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 (115) hide show
  1. package/dist/chunks/{audit-sentence-JgJEwQEC.js → actions-log-DupYCEyV.js} +186 -21
  2. package/dist/chunks/actions-log-DupYCEyV.js.map +1 -0
  3. package/dist/chunks/{connected-apps-IJdunsu8.js → connected-apps-CGUQlFMx.js} +5 -5
  4. package/dist/chunks/{connected-apps-IJdunsu8.js.map → connected-apps-CGUQlFMx.js.map} +1 -1
  5. package/dist/chunks/{delete-place-dIVoK87I.js → delete-place-CswZ-meh.js} +5 -5
  6. package/dist/chunks/{delete-place-dIVoK87I.js.map → delete-place-CswZ-meh.js.map} +1 -1
  7. package/dist/chunks/{directory-BM8yoiJN.js → directory-DrswWQLT.js} +15 -15
  8. package/dist/chunks/directory-DrswWQLT.js.map +1 -0
  9. package/dist/chunks/environment-actions-8rL9Cw6X.js +576 -0
  10. package/dist/chunks/environment-actions-8rL9Cw6X.js.map +1 -0
  11. package/dist/chunks/{folders-D3A1NGpt.js → folders-A6sbR_PG.js} +3 -3
  12. package/dist/chunks/{folders-D3A1NGpt.js.map → folders-A6sbR_PG.js.map} +1 -1
  13. package/dist/chunks/{grants-CjVmOgb2.js → grants-C0cb2oii.js} +8 -8
  14. package/dist/chunks/grants-C0cb2oii.js.map +1 -0
  15. package/dist/chunks/{multi-combobox-B0JzP1QN.js → multi-combobox-B3SEv1gq.js} +3 -3
  16. package/dist/chunks/{multi-combobox-B0JzP1QN.js.map → multi-combobox-B3SEv1gq.js.map} +1 -1
  17. package/dist/chunks/{offboarding-DbozhPym.js → offboarding-C1jbG_dk.js} +72 -67
  18. package/dist/chunks/offboarding-C1jbG_dk.js.map +1 -0
  19. package/dist/chunks/{page-JTORvh-N.js → page-CfhC9Hp1.js} +11 -6
  20. package/dist/chunks/page-CfhC9Hp1.js.map +1 -0
  21. package/dist/chunks/{personal-tokens-zWZOzLIC.js → personal-tokens-xC9wulhg.js} +5 -5
  22. package/dist/chunks/{personal-tokens-zWZOzLIC.js.map → personal-tokens-xC9wulhg.js.map} +1 -1
  23. package/dist/chunks/{principal-DFBswTBr.js → principal-CI17XK13.js} +2 -2
  24. package/dist/chunks/{principal-DFBswTBr.js.map → principal-CI17XK13.js.map} +1 -1
  25. package/dist/chunks/{principal-page-jJ0RVFg8.js → principal-page-CdSeftGD.js} +17 -127
  26. package/dist/chunks/principal-page-CdSeftGD.js.map +1 -0
  27. package/dist/chunks/{project-page-BjwEoXfU.js → project-page-CHxjBE97.js} +3 -3
  28. package/dist/chunks/{project-page-BjwEoXfU.js.map → project-page-CHxjBE97.js.map} +1 -1
  29. package/dist/chunks/{queries-2jdgTwfZ.js → queries-D1JuimTu.js} +82 -26
  30. package/dist/chunks/queries-D1JuimTu.js.map +1 -0
  31. package/dist/chunks/{references-CRT2BsOS.js → references-D5llUGQL.js} +5 -5
  32. package/dist/chunks/{references-CRT2BsOS.js.map → references-D5llUGQL.js.map} +1 -1
  33. package/dist/chunks/{role-field-DswIpPqY.js → role-field-CoCv8wse.js} +5 -5
  34. package/dist/chunks/role-field-CoCv8wse.js.map +1 -0
  35. package/dist/chunks/{row-state-xtRGFnDc.js → row-state-CYH7kZHl.js} +3 -3
  36. package/dist/chunks/{row-state-xtRGFnDc.js.map → row-state-CYH7kZHl.js.map} +1 -1
  37. package/dist/chunks/{theme-Ck45wzWB.js → theme-rF44Wbmm.js} +3 -3
  38. package/dist/chunks/{theme-Ck45wzWB.js.map → theme-rF44Wbmm.js.map} +1 -1
  39. package/dist/chunks/{ui-D-blFWfx.js → ui-CGdORVzW.js} +2 -2
  40. package/dist/chunks/{ui-D-blFWfx.js.map → ui-CGdORVzW.js.map} +1 -1
  41. package/dist/chunks/{use-action-CXEFFjx5.js → use-action-BxrHTBZw.js} +3 -3
  42. package/dist/chunks/{use-action-CXEFFjx5.js.map → use-action-BxrHTBZw.js.map} +1 -1
  43. package/dist/chunks/{use-change-BC4xo02c.js → use-change-BorW2R6C.js} +4 -4
  44. package/dist/chunks/{use-change-BC4xo02c.js.map → use-change-BorW2R6C.js.map} +1 -1
  45. package/dist/chunks/{use-roles-DswiNxBk.js → use-roles-BZnJ9Cq0.js} +56 -13
  46. package/dist/chunks/use-roles-BZnJ9Cq0.js.map +1 -0
  47. package/dist/chunks/{use-shell-zpjE_MKh.js → use-shell-CPskgi1k.js} +3 -3
  48. package/dist/chunks/{use-shell-zpjE_MKh.js.map → use-shell-CPskgi1k.js.map} +1 -1
  49. package/dist/index.d.ts +46 -2
  50. package/dist/index.js +30 -11
  51. package/dist/index.js.map +1 -1
  52. package/dist/pages/account.js +11 -11
  53. package/dist/pages/account.js.map +1 -1
  54. package/dist/pages/approval.js +2 -2
  55. package/dist/pages/audit.js +55 -21
  56. package/dist/pages/audit.js.map +1 -1
  57. package/dist/pages/device-login.js +2 -2
  58. package/dist/pages/environment.js +228 -389
  59. package/dist/pages/environment.js.map +1 -1
  60. package/dist/pages/login.js +3 -3
  61. package/dist/pages/oauth-authorize.js +2 -2
  62. package/dist/pages/project-access.js +11 -11
  63. package/dist/pages/project-environments.js +28 -359
  64. package/dist/pages/project-environments.js.map +1 -1
  65. package/dist/pages/project-settings.js +8 -8
  66. package/dist/pages/project.js +3 -3
  67. package/dist/pages/projects.js +8 -8
  68. package/dist/pages/service-account.js +11 -10
  69. package/dist/pages/service-account.js.map +1 -1
  70. package/dist/pages/service-accounts.js +7 -6
  71. package/dist/pages/service-accounts.js.map +1 -1
  72. package/dist/pages/settings.d.ts +6 -1
  73. package/dist/pages/settings.js +284 -164
  74. package/dist/pages/settings.js.map +1 -1
  75. package/dist/pages/unregistered.js +2 -2
  76. package/dist/pages/user.js +7 -6
  77. package/dist/pages/user.js.map +1 -1
  78. package/dist/pages/users.js +7 -6
  79. package/dist/pages/users.js.map +1 -1
  80. package/package.json +3 -3
  81. package/src/components/actions-log.tsx +61 -8
  82. package/src/components/directory.tsx +5 -5
  83. package/src/components/environment-actions.tsx +508 -0
  84. package/src/components/grants.tsx +2 -2
  85. package/src/components/icons.tsx +2 -0
  86. package/src/components/offboarding.tsx +7 -0
  87. package/src/components/page.tsx +3 -2
  88. package/src/components/principal-page.tsx +1 -1
  89. package/src/components/protected.tsx +52 -39
  90. package/src/components/role-editor.tsx +99 -68
  91. package/src/components/role-field.tsx +1 -1
  92. package/src/lib/audit-sentences.ts +24 -19
  93. package/src/lib/queries.ts +85 -21
  94. package/src/lib/roles.ts +36 -10
  95. package/src/options.ts +19 -3
  96. package/src/pages/account.tsx +1 -1
  97. package/src/pages/audit.tsx +56 -16
  98. package/src/pages/environment.tsx +227 -352
  99. package/src/pages/project-environments.tsx +20 -322
  100. package/src/pages/service-accounts.tsx +1 -1
  101. package/src/pages/settings.tsx +129 -48
  102. package/src/pages/users.tsx +1 -1
  103. package/src/parity.ts +18 -11
  104. package/src/styles/globals.css +271 -89
  105. package/dist/chunks/audit-sentence-JgJEwQEC.js.map +0 -1
  106. package/dist/chunks/directory-BM8yoiJN.js.map +0 -1
  107. package/dist/chunks/grants-CjVmOgb2.js.map +0 -1
  108. package/dist/chunks/offboarding-DbozhPym.js.map +0 -1
  109. package/dist/chunks/page-JTORvh-N.js.map +0 -1
  110. package/dist/chunks/principal-page-jJ0RVFg8.js.map +0 -1
  111. package/dist/chunks/protected-y7KVhtHd.js +0 -77
  112. package/dist/chunks/protected-y7KVhtHd.js.map +0 -1
  113. package/dist/chunks/queries-2jdgTwfZ.js.map +0 -1
  114. package/dist/chunks/role-field-DswIpPqY.js.map +0 -1
  115. package/dist/chunks/use-roles-DswiNxBk.js.map +0 -1
@@ -1,19 +1,19 @@
1
- import { A as isActiveAccessibleEnvironment, O as canRevealSecrets, o as keys, t as affects, x as queries } from "../chunks/queries-2jdgTwfZ.js";
2
- import { a as ErrorLine, c as Notice, d as Tip, g as createCopier, h as breakAfterUnderscores, i as EmptyState, l as Spinner, n as ConfirmDialog, o as MenuPopup, r as CopyButton, s as Modal, t as ConfirmButton, u as Timestamp } from "../chunks/ui-D-blFWfx.js";
1
+ import { A as canRevealSecrets, M as isActiveAccessibleEnvironment, n as affects, o as keys, x as queries } from "../chunks/queries-D1JuimTu.js";
2
+ import { a as ErrorLine, c as Notice, d as Tip, g as createCopier, h as breakAfterUnderscores, i as EmptyState, l as Spinner, n as ConfirmDialog, o as MenuPopup, r as CopyButton, s as Modal, t as ConfirmButton, u as Timestamp } from "../chunks/ui-CGdORVzW.js";
3
3
  import { i as SecretReadOnly } from "../chunks/affordances-Dtyha68j.js";
4
- import { $ as SlashCircle, A as History, D as Generate, E as Folder, G as Plus, H as MoreHorizontal, J as Search, L as Lock, M as Key, S as Clock, T as EyeOff, W as Pencil, Z as Shuffle, _ as Check, g as ArrowRight, h as Archive, i as PageHeader, k as Hash, n as ClosedDoor, nt as Trash, o as failureMessage, p as AlertCircle, q as RotateBack, rt as Upload, st as X, t as Card, tt as Terminal, u as useCoffre, w as Eye, x as ChevronsUpDown, y as ChevronDown } from "../chunks/page-JTORvh-N.js";
5
- import { a as rowClass, i as RowPending, r as RowFailure, t as ItemFailure } from "../chunks/row-state-xtRGFnDc.js";
6
- import { t as useShell } from "../chunks/use-shell-zpjE_MKh.js";
7
- import { A as restoreSecret, B as valueEdit, G as stricter, H as SENSITIVITIES, I as companionsOf, J as regenerateWaits, K as waitsForValue, L as hasSecretEditConflict, P as saveSecrets, R as madeSensitive, S as moveSecret, T as regenerateSecret, U as levelsIn, V as LEVELS, W as markable, Y as regeneratedKeys, _ as forkKey, a as UnsavedEdits, g as environmentId, i as changeOptions, k as restoreMissing, m as dismissMissing, n as useChangeStatus, q as liveGeneration, r as changeKey, s as archiveSecret, t as useChange, x as missingList, z as secretChangeFor } from "../chunks/use-change-BC4xo02c.js";
4
+ import { A as Hash, E as Folder, G as Pencil, J as RotateBack, K as Plus, N as Key, O as Generate, Q as Shuffle, R as Lock, S as Clock, T as EyeOff, U as MoreHorizontal, Y as Search, _ as Check, et as SlashCircle, g as ArrowRight, h as Archive, i as PageHeader, it as Upload, j as History, n as ClosedDoor, nt as Terminal, o as failureMessage, p as AlertCircle, t as Card, u as useCoffre, w as Eye, x as ChevronsUpDown, y as ChevronDown } from "../chunks/page-CfhC9Hp1.js";
5
+ import { a as rowClass, i as RowPending, r as RowFailure, t as ItemFailure } from "../chunks/row-state-CYH7kZHl.js";
6
+ import { t as useShell } from "../chunks/use-shell-CPskgi1k.js";
7
+ import { A as restoreSecret, B as valueEdit, G as stricter, H as SENSITIVITIES, I as companionsOf, J as regenerateWaits, K as waitsForValue, L as hasSecretEditConflict, P as saveSecrets, R as madeSensitive, S as moveSecret, T as regenerateSecret, U as levelsIn, V as LEVELS, W as markable, Y as regeneratedKeys, _ as forkKey, a as UnsavedEdits, g as environmentId, i as changeOptions, k as restoreMissing, m as dismissMissing, n as useChangeStatus, q as liveGeneration, r as changeKey, s as archiveSecret, t as useChange, x as missingList, z as secretChangeFor } from "../chunks/use-change-BorW2R6C.js";
8
8
  import { i as secretKeyProblem, n as folderProblem } from "../chunks/validation-DiHIwZRA.js";
9
9
  import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
10
- import { t as useAction } from "../chunks/use-action-CXEFFjx5.js";
11
- import { t as Protection } from "../chunks/protected-y7KVhtHd.js";
12
- import { n as FolderRow, r as MoveToFolder, t as FolderMenu } from "../chunks/folders-D3A1NGpt.js";
13
- import { t as MultiCombobox } from "../chunks/multi-combobox-B0JzP1QN.js";
14
- import { i as ReferenceValue, n as LentReferences, o as archiveBlockers, r as MakeReference, t as ArchiveBlocked } from "../chunks/references-CRT2BsOS.js";
10
+ import { t as useAction } from "../chunks/use-action-BxrHTBZw.js";
11
+ import { r as Protection, t as EnvironmentMenu } from "../chunks/environment-actions-8rL9Cw6X.js";
12
+ import { i as ReferenceValue, n as LentReferences, o as archiveBlockers, r as MakeReference, t as ArchiveBlocked } from "../chunks/references-D5llUGQL.js";
13
+ import { n as FolderRow, r as MoveToFolder, t as FolderMenu } from "../chunks/folders-A6sbR_PG.js";
14
+ import { t as MultiCombobox } from "../chunks/multi-combobox-B3SEv1gq.js";
15
15
  import { useEffect, useId, useReducer, useRef, useState } from "react";
16
- import { Link, useNavigate } from "@tanstack/react-router";
16
+ import { Link } from "@tanstack/react-router";
17
17
  import { toast } from "sonner";
18
18
  import { Menu } from "@base-ui/react/menu";
19
19
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -808,15 +808,9 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
808
808
  const [changes, setChanges] = useState({});
809
809
  const [editing, setEditing] = useState(() => /* @__PURE__ */ new Set());
810
810
  const [saveError, setSaveError] = useState(null);
811
+ const [attempted, setAttempted] = useState(false);
812
+ if (attempted && drafts.length === 0 && Object.keys(changes).length === 0 && editing.size === 0) setAttempted(false);
811
813
  const [hiding, setHiding] = useState(null);
812
- function confirmingSensitive(drafts, changes, go) {
813
- const keys = madeSensitive(active, drafts, changes);
814
- if (keys.length === 0) go();
815
- else setHiding({
816
- keys,
817
- go
818
- });
819
- }
820
814
  const [query, setQuery] = useState(Route.useSearch().filter ?? "");
821
815
  const [sort, setSort] = useState({
822
816
  by: "key",
@@ -900,54 +894,6 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
900
894
  return rest;
901
895
  });
902
896
  }
903
- /**
904
- * One row's own Save: its change alone goes, and any other row's stays
905
- * pending. A row opened and left as it was just closes.
906
- */
907
- function saveRow(key) {
908
- const change = secretChangeFor(changes, key);
909
- if (change === void 0) return dropChange(key);
910
- confirmingSensitive([], { [key]: change }, () => {
911
- dropChange(key);
912
- sendAlone({
913
- active,
914
- drafts: [],
915
- changes: { [key]: change }
916
- });
917
- });
918
- }
919
- function saveDraft(draft) {
920
- confirmingSensitive([draft], {}, () => {
921
- setDrafts((rows) => rows.filter((row) => row.id !== draft.id));
922
- sendAlone({
923
- active,
924
- drafts: [draft],
925
- changes: {}
926
- });
927
- });
928
- }
929
- /** Whether one row's change could go alone: named, well named, and clashing with nothing. */
930
- function readyAlone(drafts, changes) {
931
- const names = [
932
- ...drafts.map((row) => row.key.trim()),
933
- ...Object.values(changes).flatMap((change) => change.archived ? [] : [change.key.trim()]),
934
- ...companionsOf(active, drafts, changes).map((companion) => companion.key.trim())
935
- ];
936
- return (drafts.length > 0 || Object.keys(changes).length > 0) && names.every((name) => name !== "" && secretKeyProblem(name) === null) && !hasSecretEditConflict(active, drafts, changes) && !active.some((entry) => waitsForValue(entry, secretChangeFor(changes, entry.key)));
937
- }
938
- function sendAlone(batch) {
939
- setSaveError(null);
940
- save(batch, { onError: (error) => {
941
- forgetRefusal(batch);
942
- const left = error instanceof UnsavedEdits ? error.outcome : batch;
943
- setDrafts((rows) => [...rows, ...left.drafts]);
944
- setChanges((current) => ({
945
- ...current,
946
- ...left.changes
947
- }));
948
- setSaveError(failureMessage(error));
949
- } });
950
- }
951
897
  function dropChange(key) {
952
898
  setChanges((current) => {
953
899
  const { [key]: _, ...rest } = current;
@@ -972,6 +918,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
972
918
  setChanges({});
973
919
  setEditing(/* @__PURE__ */ new Set());
974
920
  setSaveError(null);
921
+ setAttempted(false);
975
922
  }
976
923
  /**
977
924
  * A refused save leaves its rows no failure of their own: its edits come
@@ -993,8 +940,12 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
993
940
  * bar under the table says why.
994
941
  */
995
942
  function saveChanges() {
943
+ if (pendingCount === 0) return;
944
+ setAttempted(true);
996
945
  if (!ready) return;
997
- confirmingSensitive(drafts, changes, sendChanges);
946
+ const keys = madeSensitive(active, drafts, changes);
947
+ if (keys.length === 0) sendChanges();
948
+ else setHiding(keys);
998
949
  }
999
950
  function sendChanges() {
1000
951
  const batch = {
@@ -1006,6 +957,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
1006
957
  setChanges({});
1007
958
  setEditing(/* @__PURE__ */ new Set());
1008
959
  setSaveError(null);
960
+ setAttempted(false);
1009
961
  save(batch, { onError: (error) => {
1010
962
  forgetRefusal(batch);
1011
963
  const left = error instanceof UnsavedEdits ? error.outcome : batch;
@@ -1063,60 +1015,31 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
1063
1015
  document.addEventListener("keydown", onKeyDown);
1064
1016
  return () => document.removeEventListener("keydown", onKeyDown);
1065
1017
  }, [pendingCount]);
1066
- const withCompanion = (what, companion) => companion === void 0 ? what : `${what}, with ${companion.key.trim()}`;
1067
- const pending = [...drafts.map((draft) => ({
1068
- key: draft.key.trim() || "unnamed",
1069
- what: withCompanion(existing.has(draft.key.trim()) ? "new version" : "added", draft.companion)
1070
- })), ...changedEntries.map((entry) => {
1071
- const change = secretChangeFor(changes, entry.key);
1072
- if (change.archived) return {
1073
- key: entry.key,
1074
- what: "archived"
1075
- };
1076
- const renamed = change.key.trim() !== entry.key;
1077
- const level = change.sensitivity === void 0 || change.sensitivity === entry.sensitivity ? null : change.sensitivity;
1078
- const written = change.value === null ? level === null ? null : `made ${level}` : withCompanion(level === null ? "new value" : `new value, ${level}`, change.companion);
1079
- if (renamed) return {
1080
- key: entry.key,
1081
- what: written === null ? `→ ${change.key.trim()}` : `→ ${change.key.trim()}, ${written}`
1082
- };
1083
- if (entry.parent !== null && entry.parent.state !== "overridden") return {
1084
- key: entry.key,
1085
- what: withCompanion(`overrides ${entry.parent.from}`, change.companion)
1086
- };
1087
- return {
1088
- key: entry.key,
1089
- what: written ?? "new value"
1090
- };
1091
- })];
1092
- const problem = unnamed ? null : hasConflict ? "Two pending edits would end up with the same name. Secret names are unique in an environment." : invalid ? "Names are letters, digits and underscores, and cannot start with a digit." : waiting !== void 0 ? `${waiting.key} waits for its value: type it again.` : null;
1018
+ const tally = {
1019
+ added: 0,
1020
+ updated: 0,
1021
+ archived: 0
1022
+ };
1023
+ for (const draft of drafts) tally[existing.has(draft.key.trim()) ? "updated" : "added"]++;
1024
+ for (const entry of changedEntries) tally[secretChangeFor(changes, entry.key).archived ? "archived" : "updated"]++;
1093
1025
  const needle = query.trim().toLowerCase();
1094
1026
  const listed = sortKeys(needle === "" ? active : active.filter((entry) => entry.key.toLowerCase().includes(needle)), sort);
1095
1027
  const columns = 6;
1028
+ const unnamedHidden = changedEntries.some((entry) => secretChangeFor(changes, entry.key).key.trim() === "" && !listed.includes(entry));
1029
+ const problem = unnamed ? attempted && unnamedHidden ? "A secret the filter hides needs a name." : null : hasConflict ? "Two pending edits would end up with the same name. Secret names are unique in an environment." : invalid ? "Names are letters, digits and underscores, and cannot start with a digit." : waiting !== void 0 ? `${waiting.key} waits for its value: type it again.` : null;
1096
1030
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1097
1031
  /* @__PURE__ */ jsx(PageHeader, {
1098
1032
  tile: project,
1099
1033
  title: environment,
1100
- aside: inProject !== void 0 && /* @__PURE__ */ jsx(Protection, {
1101
- project,
1102
- environment: inProject
1103
- }),
1104
- actions: personal ? /* @__PURE__ */ jsx(DeletePersonal, {
1034
+ aside: inProject !== void 0 && /* @__PURE__ */ jsx(Protection, { environment: inProject }),
1035
+ actions: /* @__PURE__ */ jsx(EnvironmentMenu, {
1105
1036
  project,
1106
1037
  environment,
1107
- of: parents[0]
1108
- }) : principal?.type === "user" && canList && /* @__PURE__ */ jsxs(Link, {
1109
- className: "btn btn-sm",
1110
- to: "/projects/$project/$environment",
1111
- params: {
1112
- project,
1113
- environment: `${environment}@me`
1114
- },
1115
- children: [
1116
- /* @__PURE__ */ jsx(Key, { size: 14 }),
1117
- "My own ",
1118
- environment
1119
- ]
1038
+ inProject,
1039
+ ownConfig: principal?.type === "user" && canList && !personal,
1040
+ busy: protecting.state === "pending",
1041
+ follow: true,
1042
+ className: "btn btn-sm btn-icon"
1120
1043
  }),
1121
1044
  meta: protecting.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status: protecting }) : protecting.state === "failed" ? /* @__PURE__ */ jsx(ItemFailure, {
1122
1045
  status: protecting,
@@ -1324,9 +1247,8 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
1324
1247
  onEdit: () => setEditing((current) => new Set(current).add(entry.key)),
1325
1248
  onPatch: (patch) => patchChange(entry, patch),
1326
1249
  onUndo: () => dropChange(entry.key),
1327
- onSave: () => saveRow(entry.key),
1328
1250
  versionOf,
1329
- saveReady: change === void 0 || readyAlone([], { [entry.key]: change }),
1251
+ attempted,
1330
1252
  onMarkArchive: () => {
1331
1253
  setEditing((current) => {
1332
1254
  const next = new Set(current);
@@ -1364,15 +1286,14 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
1364
1286
  ...patch
1365
1287
  } : row)),
1366
1288
  onRemove: () => setDrafts((rows) => rows.filter((row) => row.id !== draft.id)),
1367
- onSave: () => saveDraft(draft),
1368
1289
  versionOf,
1369
- saveReady: readyAlone([draft], {})
1290
+ attempted
1370
1291
  }, draft.id))
1371
1292
  ] })]
1372
1293
  })
1373
- }), pendingCount > 0 && /* @__PURE__ */ jsx(PendingBar, {
1374
- pending,
1375
- ready,
1294
+ }), (pendingCount > 0 || editing.size > 0) && /* @__PURE__ */ jsx(PendingBar, {
1295
+ tally,
1296
+ canSave: pendingCount > 0,
1376
1297
  error: saveError ?? problem,
1377
1298
  onDiscard: discardAll,
1378
1299
  onSave: saveChanges
@@ -1381,21 +1302,20 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
1381
1302
  /* @__PURE__ */ jsx(ConfirmDialog, {
1382
1303
  open: hiding !== null,
1383
1304
  onOpenChange: (open) => !open && setHiding(null),
1384
- title: hiding?.keys.length === 1 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
1305
+ title: hiding?.length === 1 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
1385
1306
  "Make ",
1386
1307
  /* @__PURE__ */ jsx("span", {
1387
1308
  className: "mono",
1388
- children: hiding.keys[0]
1309
+ children: hiding[0]
1389
1310
  }),
1390
1311
  " sensitive?"
1391
- ] }) : `Make ${hiding?.keys.length ?? 0} keys sensitive?`,
1392
- body: `${hiding !== null && hiding.keys.length > 1 ? `${hiding.keys.join(", ")}: n` : "N"}obody, Owners included, will see ${hiding?.keys.length === 1 ? "this value" : "these values"} again. Apps use ${hiding?.keys.length === 1 ? "it" : "them"} through the proxy; service accounts still read ${hiding?.keys.length === 1 ? "it" : "them"}.`,
1312
+ ] }) : `Make ${hiding?.length ?? 0} keys sensitive?`,
1313
+ body: `${hiding !== null && hiding.length > 1 ? `${hiding.join(", ")}: n` : "N"}obody, Owners included, will see ${hiding?.length === 1 ? "this value" : "these values"} again. Apps use ${hiding?.length === 1 ? "it" : "them"} through the proxy; service accounts still read ${hiding?.length === 1 ? "it" : "them"}.`,
1393
1314
  confirmLabel: "Make sensitive",
1394
1315
  destructive: false,
1395
1316
  onConfirm: () => {
1396
- const go = hiding?.go;
1397
1317
  setHiding(null);
1398
- go?.();
1318
+ sendChanges();
1399
1319
  }
1400
1320
  }),
1401
1321
  canWrite && /* @__PURE__ */ jsxs("div", {
@@ -1483,12 +1403,19 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
1483
1403
  ] });
1484
1404
  }
1485
1405
  /**
1486
- * The pending edits, at the foot of the table they are made in: what they
1487
- * are, Discard and Save. It sticks to the bottom of the window while the
1488
- * table runs past it, so Save stays in reach of any row.
1406
+ * The pending edits, at the foot of the table they are made in: how many
1407
+ * secrets they add, update and archive, Discard and Save, which go for the
1408
+ * whole table at once. It shows while any row is open for editing, so an
1409
+ * edit opened and left as it was has its Discard too. It sticks to the
1410
+ * bottom of the window while the table runs past it, so Save stays in
1411
+ * reach of any row.
1489
1412
  */
1490
- function PendingBar({ pending, ready, error, onDiscard, onSave }) {
1491
- const count = pending.length;
1413
+ function PendingBar({ tally, canSave, error, onDiscard, onSave }) {
1414
+ const parts = [
1415
+ "added",
1416
+ "updated",
1417
+ "archived"
1418
+ ].filter((what) => tally[what] > 0).map((what) => `${tally[what]} ${what}`);
1492
1419
  return /* @__PURE__ */ jsxs("div", {
1493
1420
  className: "pending-bar",
1494
1421
  role: "region",
@@ -1496,27 +1423,10 @@ function PendingBar({ pending, ready, error, onDiscard, onSave }) {
1496
1423
  children: [
1497
1424
  /* @__PURE__ */ jsxs("span", {
1498
1425
  className: "pending-count",
1499
- children: [
1500
- /* @__PURE__ */ jsx("span", {
1501
- className: "dot",
1502
- "aria-hidden": true
1503
- }),
1504
- count,
1505
- " unsaved change",
1506
- count === 1 ? "" : "s"
1507
- ]
1508
- }),
1509
- /* @__PURE__ */ jsxs("span", {
1510
- className: "pending-summary",
1511
- children: [pending.slice(0, 3).map((item, index) => /* @__PURE__ */ jsxs("span", { children: [
1512
- index > 0 && " · ",
1513
- /* @__PURE__ */ jsx("span", {
1514
- className: "mono",
1515
- children: item.key
1516
- }),
1517
- " ",
1518
- item.what
1519
- ] }, `${item.key}:${index}`)), count > 3 && ` · and ${count - 3} more`]
1426
+ children: [/* @__PURE__ */ jsx("span", {
1427
+ className: "dot",
1428
+ "aria-hidden": true
1429
+ }), parts.length === 0 ? "No changes yet" : parts.join(", ")]
1520
1430
  }),
1521
1431
  /* @__PURE__ */ jsxs("div", {
1522
1432
  className: "pending-actions",
@@ -1524,13 +1434,13 @@ function PendingBar({ pending, ready, error, onDiscard, onSave }) {
1524
1434
  className: "btn btn-sm",
1525
1435
  onClick: onDiscard,
1526
1436
  children: "Discard"
1527
- }), /* @__PURE__ */ jsxs("button", {
1437
+ }), /* @__PURE__ */ jsx("button", {
1528
1438
  className: "btn btn-sm btn-primary",
1529
1439
  onClick: onSave,
1530
- disabled: !ready,
1440
+ disabled: !canSave,
1531
1441
  title: "Save (⌘ Enter or Ctrl Enter)",
1532
1442
  "aria-keyshortcuts": "Meta+Enter Control+Enter",
1533
- children: ["Save ", count === 1 ? "change" : `${count} changes`]
1443
+ children: "Save"
1534
1444
  })]
1535
1445
  }),
1536
1446
  error !== null && /* @__PURE__ */ jsxs("p", {
@@ -1655,9 +1565,10 @@ function AddFolder({ open, onOpenChange, keys, folders, onAdd }) {
1655
1565
  });
1656
1566
  }
1657
1567
  var lineCount = (text) => text.split("\n").length;
1658
- function ValueField({ label, value, start = "", onChange, placeholder, disabled, autoFocus, onEscape, generate, plain = false }) {
1568
+ function ValueField({ label, value, start = "", onChange, placeholder, disabled, autoFocus, onEscape, generate, level, showable }) {
1659
1569
  const [shown, setShown] = useState(false);
1660
1570
  const [generating, setGenerating] = useState(false);
1571
+ const plain = level.value === "plain";
1661
1572
  const [lines, setLines] = useState(() => start.includes("\n") || value.includes("\n"));
1662
1573
  if (!lines && value.includes("\n")) setLines(true);
1663
1574
  const caret = useRef(null);
@@ -1681,7 +1592,7 @@ function ValueField({ label, value, start = "", onChange, placeholder, disabled,
1681
1592
  }
1682
1593
  };
1683
1594
  return /* @__PURE__ */ jsxs("div", {
1684
- className: "input-group has-generate",
1595
+ className: "value-field",
1685
1596
  children: [
1686
1597
  lines ? /* @__PURE__ */ jsx(MaskedTextarea, {
1687
1598
  ...field,
@@ -1708,24 +1619,36 @@ function ValueField({ label, value, start = "", onChange, placeholder, disabled,
1708
1619
  } else field.onKeyDown(event);
1709
1620
  }
1710
1621
  }),
1711
- /* @__PURE__ */ jsx(Tip, {
1712
- label: "Generate a value",
1713
- children: /* @__PURE__ */ jsx("button", {
1714
- type: "button",
1715
- className: "btn btn-quiet btn-sm btn-icon input-addon input-addon-generate",
1716
- "aria-label": `Generate a value for ${generate.name.trim() === "" ? "the new secret" : generate.name.trim()}`,
1717
- disabled,
1718
- onClick: () => setGenerating(true),
1719
- children: /* @__PURE__ */ jsx(Generate, { size: 14 })
1720
- })
1721
- }),
1722
- !plain && /* @__PURE__ */ jsx("button", {
1723
- type: "button",
1724
- className: "btn btn-quiet btn-sm btn-icon input-addon",
1725
- "aria-label": shown ? "Mask the value" : "Show the value",
1726
- "aria-pressed": shown,
1727
- onClick: () => setShown((current) => !current),
1728
- children: shown ? /* @__PURE__ */ jsx(EyeOff, { size: 14 }) : /* @__PURE__ */ jsx(Eye, { size: 14 })
1622
+ /* @__PURE__ */ jsxs("div", {
1623
+ className: "value-field-controls",
1624
+ children: [
1625
+ /* @__PURE__ */ jsx(SensitivityMenu, {
1626
+ name: level.name,
1627
+ value: level.value,
1628
+ levels: level.levels,
1629
+ disabled,
1630
+ onChange: level.onChange
1631
+ }),
1632
+ /* @__PURE__ */ jsx(Tip, {
1633
+ label: "Generate a value",
1634
+ children: /* @__PURE__ */ jsx("button", {
1635
+ type: "button",
1636
+ className: "btn btn-quiet btn-sm btn-icon",
1637
+ "aria-label": `Generate a value for ${generate.name.trim() === "" ? "the new secret" : generate.name.trim()}`,
1638
+ disabled,
1639
+ onClick: () => setGenerating(true),
1640
+ children: /* @__PURE__ */ jsx(Generate, { size: 14 })
1641
+ })
1642
+ }),
1643
+ showable && !plain && /* @__PURE__ */ jsx("button", {
1644
+ type: "button",
1645
+ className: "btn btn-quiet btn-sm btn-icon",
1646
+ "aria-label": shown ? "Mask the value" : "Show the value",
1647
+ "aria-pressed": shown,
1648
+ onClick: () => setShown((current) => !current),
1649
+ children: shown ? /* @__PURE__ */ jsx(EyeOff, { size: 14 }) : /* @__PURE__ */ jsx(Eye, { size: 14 })
1650
+ })
1651
+ ]
1729
1652
  }),
1730
1653
  /* @__PURE__ */ jsx(GenerateValue, {
1731
1654
  open: generating,
@@ -1765,7 +1688,7 @@ function useSecondsLeft(reveal) {
1765
1688
  if (reveal === null) return 0;
1766
1689
  return Math.max(0, Math.ceil(REVEAL_TTL_SECONDS - (now - reveal.at) / 1e3));
1767
1690
  }
1768
- function SecretRow({ number, project, environment, entry, generated, busy, onRegenerate, rotateAfterDays, change, editing, canWrite, canArchive, canReveal, canList, canLoosen, folders, onMove, lent, environments, status, disabled, onDismiss, columns, onFork, onEdit, onPatch, onUndo, onSave, versionOf, saveReady, onMarkArchive, personal }) {
1691
+ function SecretRow({ number, project, environment, entry, generated, busy, onRegenerate, rotateAfterDays, change, editing, canWrite, canArchive, canReveal, canList, canLoosen, folders, onMove, lent, environments, status, disabled, onDismiss, columns, onFork, onEdit, onPatch, onUndo, versionOf, attempted, onMarkArchive, personal }) {
1769
1692
  const [reads, dispatch] = useReducer(rowReads, noReads);
1770
1693
  const { reveal, revealing, error, copyError } = reads;
1771
1694
  const setReveal = (next) => dispatch({
@@ -1910,12 +1833,12 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
1910
1833
  const leaving = change.archived;
1911
1834
  const renamed = change.key !== entry.key;
1912
1835
  const valueChanged = change.value !== null || change.sensitivity !== void 0;
1913
- const keyProblem = editing ? secretKeyProblem(change.key.trim()) : null;
1836
+ const keyProblem = editing ? nameProblem(change.key.trim(), attempted) : null;
1914
1837
  const state = leaving ? " is-leaving" : editing && (renamed || valueChanged) ? " is-changed" : shown !== null ? " is-revealed" : removed ? " is-removed" : inherited ? " is-inherited" : "";
1915
1838
  const version = entry.version ?? 0;
1916
1839
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1917
1840
  /* @__PURE__ */ jsxs("tr", {
1918
- className: `secret-row${state} ${rowClass(status)}`,
1841
+ className: `secret-row${state}${editing ? " is-editing" : ""} ${rowClass(status)}`,
1919
1842
  children: [
1920
1843
  /* @__PURE__ */ jsx("td", {
1921
1844
  className: "n",
@@ -2001,7 +1924,6 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
2001
1924
  value: change.value ?? (loosening ? "" : editBase?.value ?? ""),
2002
1925
  start: loosening ? void 0 : editBase?.value,
2003
1926
  placeholder: loosening ? "Its value, typed again" : editBase !== null ? "Value" : sensitive ? "Type a new value" : error !== null ? "New value; the current one could not be read" : canRead ? "New value" : "New value; the current one is hidden from you",
2004
- plain: level === "plain",
2005
1927
  disabled,
2006
1928
  autoFocus: !focusName,
2007
1929
  onChange: (value) => onPatch({
@@ -2023,23 +1945,23 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
2023
1945
  recipe,
2024
1946
  sensitivity: level === "plain" ? "secret" : level
2025
1947
  })
2026
- }
2027
- }),
2028
- /* @__PURE__ */ jsx(SensitivityField, {
2029
- name: change.key.trim() === "" ? entry.key : change.key.trim(),
2030
- value: level,
2031
- levels: levelsIn(personal),
2032
- disabled,
2033
- onChange: (next) => onPatch({
2034
- ...valueEdit(from(), {
2035
- value: change.value,
2036
- sensitivity: next
2037
- }),
2038
- ...next === "plain" ? {
2039
- companion: void 0,
2040
- recipe: void 0
2041
- } : {}
2042
- })
1948
+ },
1949
+ level: {
1950
+ name: change.key.trim() === "" ? entry.key : change.key.trim(),
1951
+ value: level,
1952
+ levels: levelsIn(personal),
1953
+ onChange: (next) => onPatch({
1954
+ ...valueEdit(from(), {
1955
+ value: change.value,
1956
+ sensitivity: next
1957
+ }),
1958
+ ...next === "plain" ? {
1959
+ companion: void 0,
1960
+ recipe: void 0
1961
+ } : {}
1962
+ })
1963
+ },
1964
+ showable: true
2043
1965
  }),
2044
1966
  waitsForValue(entry, change) && /* @__PURE__ */ jsx("span", {
2045
1967
  className: "edit-note",
@@ -2097,27 +2019,9 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
2097
2019
  "aria-label": sensitive ? "Never shown" : "Hidden",
2098
2020
  children: "••••••••••••"
2099
2021
  })
2100
- }), status.state !== "pending" && /* @__PURE__ */ jsx("div", {
2022
+ }), status.state !== "pending" && !editing && !leaving && /* @__PURE__ */ jsx("div", {
2101
2023
  className: "acts value-acts",
2102
- children: editing || leaving ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Tip, {
2103
- label: leaving ? "Archive now" : "Save",
2104
- children: /* @__PURE__ */ jsx("button", {
2105
- className: "act act-icon act-accent",
2106
- onClick: onSave,
2107
- disabled: disabled || !saveReady,
2108
- "aria-label": `${leaving ? "Archive" : "Save"} ${entry.key} now`,
2109
- children: /* @__PURE__ */ jsx(Check, { size: 15 })
2110
- })
2111
- }), /* @__PURE__ */ jsx(Tip, {
2112
- label: leaving ? "Keep" : "Cancel",
2113
- children: /* @__PURE__ */ jsx("button", {
2114
- className: "act act-icon act-quiet",
2115
- onClick: onUndo,
2116
- disabled,
2117
- "aria-label": leaving ? `Keep ${entry.key}` : `Cancel editing ${entry.key}`,
2118
- children: /* @__PURE__ */ jsx(X, { size: 15 })
2119
- })
2120
- })] }) : removed ? canWrite && /* @__PURE__ */ jsx("button", {
2024
+ children: removed ? canWrite && /* @__PURE__ */ jsx("button", {
2121
2025
  type: "button",
2122
2026
  className: "btn btn-sm",
2123
2027
  onClick: () => onFork("restore"),
@@ -2183,7 +2087,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
2183
2087
  }),
2184
2088
  /* @__PURE__ */ jsx("td", {
2185
2089
  className: "col-actions",
2186
- children: status.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status }) : !removed && (canList || canWrite && !editing && !leaving || canArchive && !leaving && own && !overridden) && /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
2090
+ children: status.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status }) : !removed && (canList || leaving || canWrite && !editing && !leaving || canArchive && !leaving && own && !overridden) && /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
2187
2091
  className: "act act-icon act-quiet",
2188
2092
  "aria-label": `More for ${entry.key}`,
2189
2093
  disabled,
@@ -2255,28 +2159,16 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
2255
2159
  onClick: () => setBreaking(holderPath),
2256
2160
  children: [/* @__PURE__ */ jsx(SlashCircle, { size: 14 }), "Break reference…"]
2257
2161
  }),
2258
- canWrite && !editing && !leaving && markable(entry) && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Menu.Separator, { className: "menu-sep" }), /* @__PURE__ */ jsxs(Menu.RadioGroup, {
2162
+ canWrite && !editing && !leaving && markable(entry) && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Menu.Separator, { className: "menu-sep" }), /* @__PURE__ */ jsx(SensitivityItems, {
2259
2163
  value: entry.sensitivity,
2260
- onValueChange: (next) => chooseLevel(next),
2261
- children: [/* @__PURE__ */ jsx(Menu.GroupLabel, {
2262
- className: "menu-label",
2263
- children: "Who sees it"
2264
- }), SENSITIVITIES.map((each) => /* @__PURE__ */ jsxs(Menu.RadioItem, {
2265
- value: each,
2266
- className: "menu-item menu-item-level",
2267
- closeOnClick: true,
2268
- children: [/* @__PURE__ */ jsxs("span", {
2269
- className: "menu-item-text",
2270
- children: [levelsIn(personal)[each].label, /* @__PURE__ */ jsx("span", {
2271
- className: "menu-item-hint",
2272
- children: levelsIn(personal)[each].hint
2273
- })]
2274
- }), /* @__PURE__ */ jsx(Menu.RadioItemIndicator, {
2275
- className: "menu-check",
2276
- children: /* @__PURE__ */ jsx(Check, { size: 14 })
2277
- })]
2278
- }, each))]
2164
+ levels: levelsIn(personal),
2165
+ onChange: chooseLevel
2279
2166
  })] }),
2167
+ leaving && /* @__PURE__ */ jsxs(Menu.Item, {
2168
+ className: "menu-item",
2169
+ onClick: onUndo,
2170
+ children: [/* @__PURE__ */ jsx(RotateBack, { size: 14 }), "Don't archive"]
2171
+ }),
2280
2172
  canArchive && !leaving && own && !overridden && /* @__PURE__ */ jsxs(Fragment$1, { children: [(canReveal || canWrite) && /* @__PURE__ */ jsx(Menu.Separator, { className: "menu-sep" }), /* @__PURE__ */ jsxs(Menu.Item, {
2281
2173
  className: "menu-item menu-item-danger",
2282
2174
  onClick: () => {
@@ -2435,52 +2327,6 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
2435
2327
  })
2436
2328
  ] });
2437
2329
  }
2438
- /** Delete your personal config, from its page: its values erased; dev itself untouched. */
2439
- function DeletePersonal({ project, environment, of }) {
2440
- const coffre = useCoffre();
2441
- const navigate = useNavigate();
2442
- const [open, setOpen] = useState(false);
2443
- const { error, run } = useAction();
2444
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2445
- /* @__PURE__ */ jsxs("button", {
2446
- type: "button",
2447
- className: "btn btn-sm",
2448
- onClick: () => setOpen(true),
2449
- children: [/* @__PURE__ */ jsx(Trash, { size: 14 }), "Delete…"]
2450
- }),
2451
- error !== null && /* @__PURE__ */ jsx(ErrorLine, { error }),
2452
- /* @__PURE__ */ jsx(ConfirmDialog, {
2453
- open,
2454
- onOpenChange: setOpen,
2455
- title: /* @__PURE__ */ jsxs(Fragment$1, { children: [
2456
- "Delete your own ",
2457
- /* @__PURE__ */ jsx("span", {
2458
- className: "mono",
2459
- children: of
2460
- }),
2461
- "?"
2462
- ] }),
2463
- body: `The values you set in ${project}/${environment} are erased for good. ${project}/${of} is untouched, and ${environment} reads it again.`,
2464
- confirmLabel: "Delete",
2465
- onConfirm: () => void run(() => coffre.environments.delete(`${project}/${environment}`), {
2466
- affects: [...affects.secrets({
2467
- project,
2468
- environment
2469
- }), ...affects.places()],
2470
- onSuccess: () => {
2471
- toast.success(`Your own ${of} is deleted`);
2472
- navigate({
2473
- to: "/projects/$project/$environment",
2474
- params: {
2475
- project,
2476
- environment: of
2477
- }
2478
- });
2479
- }
2480
- })
2481
- })
2482
- ] });
2483
- }
2484
2330
  /**
2485
2331
  * `dev@me` while you have no personal dev: what one is, and Make, which
2486
2332
  * makes it empty; your first write would make it too. A read of
@@ -2664,37 +2510,57 @@ function Written({ entry, rotateAfterDays }) {
2664
2510
  });
2665
2511
  }
2666
2512
  /**
2667
- * Who sees the value being written, loosest first, and beside it what the
2668
- * level pointed at, or else the one chosen, means. Native radios: the arrow
2669
- * keys move the choice, and a screen reader hears one group of three.
2513
+ * Who sees the value being written, as a menu inside its field: the
2514
+ * trigger names the level chosen, and each choice says what it means.
2670
2515
  */
2671
- function SensitivityField({ name, value, levels, disabled, onChange }) {
2672
- const id = useId();
2673
- const [pointed, setPointed] = useState(null);
2674
- return /* @__PURE__ */ jsxs("div", {
2675
- className: "edit-note sensitivity-field",
2676
- children: [/* @__PURE__ */ jsx("div", {
2677
- className: "segmented segmented-sm",
2678
- role: "radiogroup",
2679
- "aria-label": `Who sees ${name}`,
2680
- "aria-describedby": `${id}-hint`,
2681
- children: SENSITIVITIES.map((level) => /* @__PURE__ */ jsxs("label", {
2682
- onPointerEnter: () => setPointed(level),
2683
- onPointerLeave: () => setPointed(null),
2684
- children: [/* @__PURE__ */ jsx("input", {
2685
- type: "radio",
2686
- className: "visually-hidden",
2687
- name: id,
2688
- value: level,
2689
- checked: value === level,
2690
- disabled,
2691
- onChange: () => onChange(level)
2692
- }), levels[level].label]
2693
- }, level))
2694
- }), /* @__PURE__ */ jsx("span", {
2695
- id: `${id}-hint`,
2696
- children: levels[pointed ?? value].hint
2697
- })]
2516
+ function SensitivityMenu({ name, value, levels, disabled, onChange }) {
2517
+ return /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsxs(Menu.Trigger, {
2518
+ className: "value-level",
2519
+ "aria-label": `Who sees ${name}: ${levels[value].label}`,
2520
+ disabled,
2521
+ children: [
2522
+ value === "sensitive" && /* @__PURE__ */ jsx(Lock, {
2523
+ size: 11,
2524
+ "aria-hidden": true
2525
+ }),
2526
+ levels[value].label,
2527
+ /* @__PURE__ */ jsx(ChevronDown, {
2528
+ size: 12,
2529
+ "aria-hidden": true
2530
+ })
2531
+ ]
2532
+ }), /* @__PURE__ */ jsx(MenuPopup, {
2533
+ align: "end",
2534
+ children: /* @__PURE__ */ jsx(SensitivityItems, {
2535
+ value,
2536
+ levels,
2537
+ onChange
2538
+ })
2539
+ })] });
2540
+ }
2541
+ /** The levels as a menu's radio group, loosest first, each with what it means. */
2542
+ function SensitivityItems({ value, levels, onChange }) {
2543
+ return /* @__PURE__ */ jsxs(Menu.RadioGroup, {
2544
+ value,
2545
+ onValueChange: (next) => onChange(next),
2546
+ children: [/* @__PURE__ */ jsx(Menu.GroupLabel, {
2547
+ className: "menu-label",
2548
+ children: "Who sees it"
2549
+ }), SENSITIVITIES.map((each) => /* @__PURE__ */ jsxs(Menu.RadioItem, {
2550
+ value: each,
2551
+ className: "menu-item menu-item-level",
2552
+ closeOnClick: true,
2553
+ children: [/* @__PURE__ */ jsxs("span", {
2554
+ className: "menu-item-text",
2555
+ children: [levels[each].label, /* @__PURE__ */ jsx("span", {
2556
+ className: "menu-item-hint",
2557
+ children: levels[each].hint
2558
+ })]
2559
+ }), /* @__PURE__ */ jsx(Menu.RadioItemIndicator, {
2560
+ className: "menu-check",
2561
+ children: /* @__PURE__ */ jsx(Check, { size: 14 })
2562
+ })]
2563
+ }, each))]
2698
2564
  });
2699
2565
  }
2700
2566
  /**
@@ -2702,15 +2568,15 @@ function SensitivityField({ name, value, levels, disabled, onChange }) {
2702
2568
  *
2703
2569
  * This replaced a separate "Add a secret" form. The form made you look away
2704
2570
  * from the list to add to it, and only ever accepted one key at a time; a row
2705
- * in place accepts as many as you want to queue.
2571
+ * in place accepts as many as you want to queue, saved together from the
2572
+ * bar under the table.
2706
2573
  */
2707
- function DraftRow({ draft, existingVersion, disabled, onChange, onRemove, onSave, versionOf, saveReady, personal }) {
2708
- const [touched, setTouched] = useState(false);
2574
+ function DraftRow({ draft, existingVersion, disabled, onChange, onRemove, versionOf, attempted, personal }) {
2709
2575
  const trimmed = draft.key.trim();
2710
- const keyProblem = trimmed === "" ? touched ? "Give it a name." : null : secretKeyProblem(trimmed);
2576
+ const keyProblem = nameProblem(trimmed, attempted);
2711
2577
  const isNewVersion = trimmed !== "" && existingVersion !== null;
2712
2578
  return /* @__PURE__ */ jsxs("tr", {
2713
- className: "secret-row is-draft",
2579
+ className: "secret-row is-draft is-editing",
2714
2580
  children: [
2715
2581
  /* @__PURE__ */ jsx("td", {
2716
2582
  className: "n",
@@ -2732,89 +2598,57 @@ function DraftRow({ draft, existingVersion, disabled, onChange, onRemove, onSave
2732
2598
  autoComplete: "off",
2733
2599
  value: draft.key,
2734
2600
  disabled,
2735
- onBlur: () => setTouched(true),
2736
2601
  onChange: (event) => onChange({ key: event.target.value }),
2737
2602
  onKeyDown: (event) => {
2738
2603
  if (event.key === "Escape") onRemove();
2739
2604
  }
2740
2605
  }), (keyProblem !== null || isNewVersion) && /* @__PURE__ */ jsx("span", {
2741
2606
  className: `edit-note${keyProblem !== null ? " edit-note-error" : ""}`,
2742
- children: keyProblem ?? "This name exists here already. Saving adds a new version to it."
2607
+ children: keyProblem ?? "Exists here already: saving adds a version."
2743
2608
  })]
2744
2609
  })
2745
2610
  }),
2746
2611
  /* @__PURE__ */ jsx("td", {
2747
2612
  "data-label": "Value",
2748
2613
  children: /* @__PURE__ */ jsxs("div", {
2749
- className: "value-cell",
2750
- children: [/* @__PURE__ */ jsx("div", {
2751
- className: "value-content",
2752
- children: /* @__PURE__ */ jsxs("div", {
2753
- className: "edit-stack",
2754
- children: [
2755
- /* @__PURE__ */ jsx(ValueField, {
2756
- label: `Value for ${trimmed === "" ? "the new secret" : trimmed}`,
2757
- value: draft.value,
2758
- plain: draft.sensitivity === "plain",
2759
- placeholder: "Value",
2760
- disabled,
2761
- onChange: (value) => onChange({
2762
- value,
2763
- companion: void 0,
2764
- recipe: void 0
2765
- }),
2766
- onEscape: onRemove,
2767
- generate: {
2768
- name: draft.key,
2769
- renamable: true,
2770
- companion: draft.companion,
2771
- onUse: ({ value, name, companion, recipe }) => onChange({
2772
- key: name,
2773
- value,
2774
- companion,
2775
- recipe,
2776
- sensitivity: draft.sensitivity === "plain" ? "secret" : draft.sensitivity
2777
- })
2778
- }
2779
- }),
2780
- /* @__PURE__ */ jsx(SensitivityField, {
2781
- name: trimmed === "" ? "the new secret" : trimmed,
2782
- value: draft.sensitivity,
2783
- levels: levelsIn(personal),
2784
- disabled,
2785
- onChange: (sensitivity) => onChange(sensitivity === "plain" ? {
2786
- sensitivity,
2787
- companion: void 0,
2788
- recipe: void 0
2789
- } : { sensitivity })
2790
- }),
2791
- /* @__PURE__ */ jsx(CompanionNote, {
2792
- companion: draft.companion,
2793
- versionOf
2794
- })
2795
- ]
2796
- })
2797
- }), /* @__PURE__ */ jsxs("div", {
2798
- className: "acts value-acts",
2799
- children: [/* @__PURE__ */ jsx(Tip, {
2800
- label: "Save",
2801
- children: /* @__PURE__ */ jsx("button", {
2802
- className: "act act-icon act-accent",
2803
- onClick: onSave,
2804
- disabled: disabled || !saveReady,
2805
- "aria-label": trimmed === "" ? "Save this new secret now" : `Save ${trimmed} now`,
2806
- children: /* @__PURE__ */ jsx(Check, { size: 15 })
2807
- })
2808
- }), /* @__PURE__ */ jsx(Tip, {
2809
- label: "Cancel",
2810
- children: /* @__PURE__ */ jsx("button", {
2811
- className: "act act-icon act-quiet",
2812
- onClick: onRemove,
2813
- disabled,
2814
- "aria-label": trimmed === "" ? "Remove this new secret" : `Remove new secret ${trimmed}`,
2815
- children: /* @__PURE__ */ jsx(X, { size: 15 })
2614
+ className: "edit-stack",
2615
+ children: [/* @__PURE__ */ jsx(ValueField, {
2616
+ label: `Value for ${trimmed === "" ? "the new secret" : trimmed}`,
2617
+ value: draft.value,
2618
+ placeholder: "Value",
2619
+ disabled,
2620
+ onChange: (value) => onChange({
2621
+ value,
2622
+ companion: void 0,
2623
+ recipe: void 0
2624
+ }),
2625
+ onEscape: onRemove,
2626
+ generate: {
2627
+ name: draft.key,
2628
+ renamable: true,
2629
+ companion: draft.companion,
2630
+ onUse: ({ value, name, companion, recipe }) => onChange({
2631
+ key: name,
2632
+ value,
2633
+ companion,
2634
+ recipe,
2635
+ sensitivity: draft.sensitivity === "plain" ? "secret" : draft.sensitivity
2816
2636
  })
2817
- })]
2637
+ },
2638
+ level: {
2639
+ name: trimmed === "" ? "the new secret" : trimmed,
2640
+ value: draft.sensitivity,
2641
+ levels: levelsIn(personal),
2642
+ onChange: (sensitivity) => onChange(sensitivity === "plain" ? {
2643
+ sensitivity,
2644
+ companion: void 0,
2645
+ recipe: void 0
2646
+ } : { sensitivity })
2647
+ },
2648
+ showable: false
2649
+ }), /* @__PURE__ */ jsx(CompanionNote, {
2650
+ companion: draft.companion,
2651
+ versionOf
2818
2652
  })]
2819
2653
  })
2820
2654
  }),
@@ -2842,6 +2676,11 @@ function DraftRow({ draft, existingVersion, disabled, onChange, onRemove, onSave
2842
2676
  ]
2843
2677
  });
2844
2678
  }
2679
+ /** What is wrong with a name being written: a blank one only once a save was asked for, a malformed one as it is typed. */
2680
+ function nameProblem(name, attempted) {
2681
+ if (name === "") return attempted ? "Give it a name." : null;
2682
+ return secretKeyProblem(name);
2683
+ }
2845
2684
  function ArchivedRow({ number, project, environment, entry, canArchive, canList, status: state, onRestore, onDismiss }) {
2846
2685
  const [historyOpen, setHistoryOpen] = useState(false);
2847
2686
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [