@1agh/maude 2.1.0 → 2.1.1

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 (100) hide show
  1. package/apps/studio/access/request.ts +1 -0
  2. package/apps/studio/actions/agents.ts +27 -0
  3. package/apps/studio/actions/defs/app.ts +28 -1
  4. package/apps/studio/actions/defs/sync.ts +4 -0
  5. package/apps/studio/actions.manifest.json +60 -2
  6. package/apps/studio/actions.parity.json +13 -1
  7. package/apps/studio/bin/_curl-local.mjs +7 -4
  8. package/apps/studio/client/app.jsx +16 -4
  9. package/apps/studio/client/home/HomeAccountsRow.jsx +221 -0
  10. package/apps/studio/client/home/HomeConnection.jsx +111 -0
  11. package/apps/studio/client/home/home-accounts-model.js +110 -1
  12. package/apps/studio/client/home/home-api.js +6 -2
  13. package/apps/studio/client/home/home-app.jsx +74 -12
  14. package/apps/studio/client/home/home-model.js +40 -1
  15. package/apps/studio/client/home/home-where-model.js +105 -0
  16. package/apps/studio/client/home/home.css +233 -1
  17. package/apps/studio/client/hooks/use-palette-and-panels.jsx +3 -1
  18. package/apps/studio/client/hooks/use-tabs.jsx +11 -4
  19. package/apps/studio/client/panels/TeamProjects.jsx +137 -134
  20. package/apps/studio/client/share-link.js +12 -0
  21. package/apps/studio/client/styles/_index.css +4 -0
  22. package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +1 -0
  23. package/apps/studio/client/v2/diagnostics/diagnostics-model.js +32 -2
  24. package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +35 -8
  25. package/apps/studio/client/v2/diagnostics/diagnostics.css +34 -0
  26. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +94 -3
  27. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +187 -4
  28. package/apps/studio/client/v2/link-server/LinkServerDialog.jsx +492 -0
  29. package/apps/studio/client/v2/link-server/LinkServerHost.jsx +42 -0
  30. package/apps/studio/client/v2/link-server/link-server-api.js +142 -0
  31. package/apps/studio/client/v2/link-server/link-server-model.js +438 -0
  32. package/apps/studio/client/v2/link-server/link-server.css +109 -0
  33. package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +31 -86
  34. package/apps/studio/client/v2/onboarding/onboarding-model.js +1 -18
  35. package/apps/studio/client/v2/search/search-keywords.js +3 -2
  36. package/apps/studio/client/v2/settings/account.jsx +4 -2
  37. package/apps/studio/client/v2/settings/advanced-section.jsx +245 -148
  38. package/apps/studio/client/v2/settings/connection-row.jsx +3 -59
  39. package/apps/studio/client/v2/settings/connections-section.jsx +118 -425
  40. package/apps/studio/client/v2/settings/general-section.jsx +138 -43
  41. package/apps/studio/client/v2/settings/project-sync-settings.jsx +4 -3
  42. package/apps/studio/client/v2/settings/reset-section.jsx +14 -3
  43. package/apps/studio/client/v2/settings/settings-card.jsx +142 -0
  44. package/apps/studio/client/v2/settings/settings-cards.js +220 -0
  45. package/apps/studio/client/v2/settings/settings-handlers.js +7 -6
  46. package/apps/studio/client/v2/settings/settings-model.js +91 -31
  47. package/apps/studio/client/v2/settings/settings-sheet.jsx +25 -6
  48. package/apps/studio/client/v2/settings/settings.css +374 -64
  49. package/apps/studio/client/v2/settings/this-project-card.jsx +730 -0
  50. package/apps/studio/client/v2/settings/this-project-model.js +172 -0
  51. package/apps/studio/client/v2/settings/use-connections.js +3 -2
  52. package/apps/studio/client/v2/settings/use-open-card.js +37 -0
  53. package/apps/studio/client/v2/shell/connection-state.js +197 -0
  54. package/apps/studio/client/v2/shell/menu-runner.js +7 -2
  55. package/apps/studio/client/v2/shell/project-account-bus.js +36 -0
  56. package/apps/studio/client/v2/shell/project-account-card.jsx +357 -148
  57. package/apps/studio/client/v2/shell/project-account-model.js +272 -149
  58. package/apps/studio/client/v2/shell/project-account-toast.js +66 -0
  59. package/apps/studio/client/v2/shell/project-account.css +237 -0
  60. package/apps/studio/client/v2/shell/share-cluster-host.jsx +166 -83
  61. package/apps/studio/client/v2/shell/shell-parity.js +3 -2
  62. package/apps/studio/client/v2/shell/shell-parity.json +40 -26
  63. package/apps/studio/client/v2/shell/use-account.js +2 -0
  64. package/apps/studio/client/v2/signin/use-signin.js +1 -1
  65. package/apps/studio/cloud/endpoints.ts +29 -4
  66. package/apps/studio/dist/client.bundle.js +834 -834
  67. package/apps/studio/dist/styles.css +1 -1
  68. package/apps/studio/home/accounts.ts +30 -11
  69. package/apps/studio/home/cloud.ts +6 -1
  70. package/apps/studio/home/hub-health.ts +76 -0
  71. package/apps/studio/home/routes.ts +9 -3
  72. package/apps/studio/http.ts +8 -0
  73. package/apps/studio/migrate/hub.ts +8 -1
  74. package/apps/studio/routes/hub-link-folder.ts +334 -0
  75. package/apps/studio/routes/hub-signin.ts +78 -1
  76. package/apps/studio/routes/index.ts +4 -0
  77. package/apps/studio/routes/sync.ts +22 -4
  78. package/apps/studio/shell/api-key.ts +11 -0
  79. package/apps/studio/sync/accepted-cold-start.ts +144 -8
  80. package/apps/studio/sync/action-stage.ts +18 -1
  81. package/apps/studio/sync/ctl-heal.ts +58 -0
  82. package/apps/studio/sync/file-ledger.ts +38 -4
  83. package/apps/studio/sync/file-plane.ts +226 -19
  84. package/apps/studio/sync/held-deletes.ts +86 -5
  85. package/apps/studio/sync/hub-link.ts +8 -0
  86. package/apps/studio/sync/index.ts +68 -4
  87. package/apps/studio/sync/link-consent.ts +22 -75
  88. package/apps/studio/sync/link-survey.ts +252 -0
  89. package/apps/studio/sync/local-kernel.ts +16 -1
  90. package/apps/studio/sync/seed-progress.ts +12 -0
  91. package/apps/studio/sync/source-recovery.ts +18 -2
  92. package/apps/studio/sync/status.ts +11 -1
  93. package/apps/studio/sync/writer-registry.ts +5 -0
  94. package/apps/studio/whats-new.json +18 -0
  95. package/cli/lib/bash-guard.mjs +19 -0
  96. package/cli/lib/design-help.gen.mjs +1 -1
  97. package/package.json +9 -8
  98. package/apps/studio/client/v2/onboarding/HubSheet.jsx +0 -212
  99. package/apps/studio/client/v2/shell/account-card-model.js +0 -114
  100. package/apps/studio/client/v2/shell/account-card.jsx +0 -189
@@ -1,11 +1,15 @@
1
1
  // client/v2/settings/general-section.jsx — V2-4.7a: Settings › General (02 ob-settings, left card).
2
2
  //
3
- // Account (S9.20, account.jsx) · Look (Theme: Light · Dark · Auto, gate-b-polish2) · Canvas and view · Keyboard · Search (S8.20, search in pictures) · Layout. Everything here is a preference of the person, in every
4
- // shell. Look is 02 ob-settings' one Theme row; the Inspector words left General (06: the inspector's
5
- // Advanced fold is the raw editor, Designer is the only default — the v2 inspector ignores the old switch).
6
- // Terminal (#206): may Claude Code in the terminal open projects in this Maude (a Tauri pref; the desktop app only).
7
- // The rest are today's controls (panels/SettingsPanel.jsx): the four canvas switches, the left/right panel positions and the Layers mode — same props, same
8
- // handlers, same stores. Nothing is stored differently.
3
+ // 2.1.1 T6 (canvas 17 · 08): one column of cards — This project first and open (this-project-card.jsx), then
4
+ // Look · Canvas and view · Terminal · Keyboard · Layout, each closed and saying what is set. A cloud tab has
5
+ // no This project card; its account keeps an Account card of its own (account.jsx).
6
+ //
7
+ // Look is 02 ob-settings' one Theme row (Light · Dark · Auto, gate-b-polish2); the Inspector words left
8
+ // General (06: the inspector's Advanced fold is the raw editor). Terminal (#206): may Claude Code in the
9
+ // terminal open projects in this Maude (a Tauri pref; the desktop app only). Search in pictures (S8.20)
10
+ // sits in Canvas and view. The rest are today's controls (panels/SettingsPanel.jsx): the four canvas
11
+ // switches, the left/right panel positions and the Layers mode — same props, same handlers, same stores.
12
+ // Nothing is stored differently.
9
13
 
10
14
  import { useEffect, useState } from 'react';
11
15
 
@@ -15,7 +19,15 @@ import { DescribeSettingsRow } from '../assets/describe-consent.jsx';
15
19
  import { getPaletteEnv } from '../search/search-env.js';
16
20
  import { useSingleKeys } from '../shell/use-single-keys.js';
17
21
  import { AccountBlock } from './account.jsx';
18
- import { Group, Row, SwitchRow } from './parts.jsx';
22
+ import { Row, SwitchRow } from './parts.jsx';
23
+ import { SettingsCard } from './settings-card.jsx';
24
+ import {
25
+ canvasSummary,
26
+ keyboardSummary,
27
+ layoutSummary,
28
+ lookSummary,
29
+ terminalSummary,
30
+ } from './settings-cards.js';
19
31
  import {
20
32
  pickTheme,
21
33
  systemTheme,
@@ -23,6 +35,8 @@ import {
23
35
  useThemeAutoOn,
24
36
  writeThemeAuto,
25
37
  } from './theme-auto.js';
38
+ import ThisProjectCard from './this-project-card.jsx';
39
+ import { useOpenCard } from './use-open-card.js';
26
40
 
27
41
  const THEMES = [
28
42
  { id: 'light', label: 'Light' },
@@ -65,9 +79,10 @@ export function ThemeSegment({ theme, onSetTheme }) {
65
79
  }
66
80
 
67
81
  /** #206 (DDR-250): a terminal design run may open projects in Maude. DEFAULT ON; the desktop app only. */
68
- function TerminalOpensRow() {
82
+ function useTerminalOpens(enabled) {
69
83
  const [on, setOn] = useState(true);
70
84
  useEffect(() => {
85
+ if (!enabled) return undefined;
71
86
  let alive = true;
72
87
  getTerminalOpens()
73
88
  .then((v) => alive && setOn(v !== false))
@@ -75,24 +90,22 @@ function TerminalOpensRow() {
75
90
  return () => {
76
91
  alive = false;
77
92
  };
78
- }, []);
79
- return (
80
- <SwitchRow
81
- testid="settings-terminal-opens"
82
- label="Let the terminal open projects in Maude"
83
- note="Claude Code in the terminal shows its work here. A folder Maude has not opened before asks you first. Off, the terminal uses its own hidden server."
84
- checked={on}
85
- onChange={(next) => {
86
- setOn(next);
87
- setTerminalOpens(next).catch(() => setOn(!next));
88
- }}
89
- />
90
- );
93
+ }, [enabled]);
94
+ const set = (next) => {
95
+ setOn(next);
96
+ setTerminalOpens(next).catch(() => setOn(!next));
97
+ };
98
+ return [on, set];
91
99
  }
92
100
 
93
101
  export default function GeneralSection({
94
102
  cloud,
95
103
  readOnly = false,
104
+ focus = null,
105
+ syncStatus,
106
+ onLinkedHub,
107
+ onLocalProject,
108
+ onCloseSheet,
96
109
  theme,
97
110
  onSetTheme,
98
111
  minimapVisible,
@@ -112,19 +125,59 @@ export default function GeneralSection({
112
125
  const canvasReason = !hasCanvas ? 'Open a canvas to use this.' : undefined;
113
126
  const [singleKeys, setSingleKeys] = useSingleKeys();
114
127
  const auto = useThemeAutoOn();
128
+ // This project reads this Mac: the desktop and an owner's session only (settings-model `local`)
129
+ const ownMac = cloud === null && !readOnly;
130
+ const terminal = ownMac && isNativeApp();
131
+ const [terminalOn, setTerminalOn] = useTerminalOpens(terminal);
132
+ // a cloud tab keeps its account as a card of its own (the hub told its tab where the dashboard is)
133
+ const accountCard = !!cloud && typeof cloud === 'object' && !!cloud.dashboardUrl;
134
+ // ⌘K's This project row in a shell without that card is the Account card's
135
+ const asked = focus?.card === 'this-project' && !ownMac ? { ...focus, card: 'account' } : focus;
136
+ const { open, toggle } = useOpenCard('general', asked);
137
+ // the default card is This project — a shell without it opens on nothing
138
+ const openId = !ownMac && open === 'this-project' ? null : open;
139
+ const card = (id) => ({ open: openId === id, onToggle: toggle, reveal: asked?.card === id });
115
140
 
116
141
  return (
117
- <>
118
- {/* S9.20 — the Account block (02 ob-settings): plan, Manage, the five account pages */}
119
- <AccountBlock cloud={cloud} readOnly={readOnly} />
142
+ <div className="v2s-cards" data-testid="settings-general-cards">
143
+ {ownMac ? (
144
+ <ThisProjectCard
145
+ {...card('this-project')}
146
+ focus={asked}
147
+ syncStatus={syncStatus}
148
+ onLinkedHub={onLinkedHub}
149
+ onLocalProject={onLocalProject}
150
+ onCloseSheet={onCloseSheet}
151
+ />
152
+ ) : null}
120
153
 
121
- <Group title="Look">
154
+ <SettingsCard
155
+ id="look"
156
+ icon="view"
157
+ title="Look"
158
+ desc="How Maude looks on this Mac."
159
+ summary={lookSummary(theme, auto)}
160
+ {...card('look')}
161
+ >
122
162
  <Row label="Theme" hint={auto ? 'Matches your computer’s appearance.' : undefined}>
123
163
  <ThemeSegment theme={theme} onSetTheme={onSetTheme} />
124
164
  </Row>
125
- </Group>
165
+ </SettingsCard>
126
166
 
127
- <Group title="Canvas and view" testid="settings-canvas-view">
167
+ <SettingsCard
168
+ id="canvas"
169
+ testid="settings-canvas-view"
170
+ icon="frame"
171
+ title="Canvas and view"
172
+ desc="What sits on the canvas with your work."
173
+ summary={canvasSummary({
174
+ minimap: minimapVisible,
175
+ zoom: zoomCtlVisible,
176
+ annotations: annotationsVisible,
177
+ autoInspector: autoOpenInspector,
178
+ })}
179
+ {...card('canvas')}
180
+ >
128
181
  <PrefToggleRow
129
182
  label="Minimap"
130
183
  note="Show the canvas minimap overlay."
@@ -153,15 +206,42 @@ export default function GeneralSection({
153
206
  checked={autoOpenInspector}
154
207
  onChange={() => onToggleAutoOpenInspector?.()}
155
208
  />
156
- </Group>
209
+ {/* S8.20 — Search in pictures: off at once, on through the one sheet; absent where the studio does not
210
+ describe (not before /_config answers: `cloud === undefined` mounts and fetches nothing local) */}
211
+ {cloud !== undefined ? (
212
+ <DescribeSettingsRow project={getPaletteEnv().projectName} Row={PrefToggleRow} />
213
+ ) : null}
214
+ </SettingsCard>
157
215
 
158
- {cloud === null && !readOnly && isNativeApp() ? (
159
- <Group title="Terminal" testid="settings-terminal">
160
- <TerminalOpensRow />
161
- </Group>
216
+ {terminal ? (
217
+ <SettingsCard
218
+ id="terminal"
219
+ testid="settings-terminal"
220
+ icon="code"
221
+ title="Terminal"
222
+ desc="The maude command in your terminal."
223
+ summary={terminalSummary(terminalOn)}
224
+ {...card('terminal')}
225
+ >
226
+ <SwitchRow
227
+ testid="settings-terminal-opens"
228
+ label="Let the terminal open projects in Maude"
229
+ note="Claude Code in the terminal shows its work here. A folder Maude has not opened before asks you first. Off, the terminal uses its own hidden server."
230
+ checked={terminalOn}
231
+ onChange={setTerminalOn}
232
+ />
233
+ </SettingsCard>
162
234
  ) : null}
163
235
 
164
- <Group title="Keyboard" testid="settings-keyboard">
236
+ <SettingsCard
237
+ id="keyboard"
238
+ testid="settings-keyboard"
239
+ icon="type"
240
+ title="Keyboard"
241
+ desc="Shortcuts on the canvas."
242
+ summary={keyboardSummary(singleKeys)}
243
+ {...card('keyboard')}
244
+ >
165
245
  <div data-testid="settings-single-keys">
166
246
  <PrefToggleRow
167
247
  label="Single-key shortcuts"
@@ -170,22 +250,37 @@ export default function GeneralSection({
170
250
  onChange={(on) => setSingleKeys(on)}
171
251
  />
172
252
  </div>
173
- </Group>
174
-
175
- {/* S8.20 — Search in pictures: off at once, on through the one sheet; absent where the studio does not describe */}
176
- {/* (not before /_config answers: `cloud === undefined` mounts and fetches nothing local) */}
177
- {cloud !== undefined ? (
178
- <DescribeSettingsRow project={getPaletteEnv().projectName} Row={PrefToggleRow} />
179
- ) : null}
253
+ </SettingsCard>
180
254
 
181
- <Group title="Layout" testid="settings-layout">
255
+ <SettingsCard
256
+ id="layout"
257
+ testid="settings-layout"
258
+ icon="panel-left"
259
+ title="Layout"
260
+ desc="Where the panels sit."
261
+ summary={layoutSummary(panelSide, layersMode)}
262
+ {...card('layout')}
263
+ >
182
264
  <LayoutTab
183
265
  panelSide={panelSide}
184
266
  onSetPanelSide={onSetPanelSide}
185
267
  layersMode={layersMode}
186
268
  onSetLayersMode={onSetLayersMode}
187
269
  />
188
- </Group>
189
- </>
270
+ </SettingsCard>
271
+
272
+ {accountCard ? (
273
+ <SettingsCard
274
+ id="account"
275
+ icon="cloud"
276
+ title="Account"
277
+ desc="Your account on the web."
278
+ summary={cloud.user?.email ?? null}
279
+ {...card('account')}
280
+ >
281
+ <AccountBlock cloud={cloud} readOnly={readOnly} />
282
+ </SettingsCard>
283
+ ) : null}
284
+ </div>
190
285
  );
191
286
  }
@@ -1,4 +1,5 @@
1
- // client/v2/settings/project-sync-settings.jsx — V2-4.7a: Settings › Advanced › This project.
1
+ // client/v2/settings/project-sync-settings.jsx — V2-4.7a: the project's sync switches. 2.1.1 T6 moved them
2
+ // from Settings › Advanced › This project to Settings › General › This project › Sync details (canvas 17 · 08).
2
3
  //
3
4
  // The sync settings and the .design/ ownership switch used to sit at the foot of the Sync panel
4
5
  // (panels/SyncPanel.jsx, `sync-settings` / `sync-ownership`). Same routes, same bodies, same
@@ -123,8 +124,8 @@ export default function ProjectSyncSettings({ cloud }) {
123
124
  <>
124
125
  {loaded && !settings && (
125
126
  <p className="v2s-hint" data-testid="settings-project-unlinked">
126
- Not linked to a workspace, so there is nothing to sync yet. Connect this project under
127
- Connections and its sync switches appear here.
127
+ Only on this Mac, so there is nothing to sync yet. Put it on Maude Cloud or link your
128
+ server, and its sync switches appear here.
128
129
  </p>
129
130
  )}
130
131
  {settings && (
@@ -97,7 +97,18 @@ function ConfirmResetAll({ onCancel, onConfirm }) {
97
97
  );
98
98
  }
99
99
 
100
- export default function ResetSection({ live = {} }) {
100
+ /** `bare`: inside Advanced's Reset card (2.1.1 T6), whose own title already says Reset — no group heading. */
101
+ function Shell({ bare, children }) {
102
+ return bare ? (
103
+ <div data-testid="settings-reset">{children}</div>
104
+ ) : (
105
+ <Group title="Reset" testid="settings-reset">
106
+ {children}
107
+ </Group>
108
+ );
109
+ }
110
+
111
+ export default function ResetSection({ live = {}, bare = false }) {
101
112
  const [layoutDone, setLayoutDone] = useState(false);
102
113
  const [foldsDone, setFoldsDone] = useState(false);
103
114
  const [asking, setAsking] = useState(false);
@@ -105,7 +116,7 @@ export default function ResetSection({ live = {} }) {
105
116
  // 06 ad-settings › Reset: ONE wrapping row of three buttons (the third in the warning colour) and a hint —
106
117
  // no row labels, no per-fold switch list (each panel's own Advanced fold is where a fold opens or closes).
107
118
  return (
108
- <Group title="Reset" testid="settings-reset">
119
+ <Shell bare={bare}>
109
120
  <div className="v2s-acts">
110
121
  <span data-testid="settings-reset-panel-layout">
111
122
  <button
@@ -159,6 +170,6 @@ export default function ResetSection({ live = {} }) {
159
170
  }}
160
171
  />
161
172
  )}
162
- </Group>
173
+ </Shell>
163
174
  );
164
175
  }
@@ -0,0 +1,142 @@
1
+ // client/v2/settings/settings-card.jsx — 2.1.1 T6: one Settings card (canvas 17 `SCard`), the same in
2
+ // General, Connections and Advanced. Lifted from the Connections row (connection-row.jsx), made expandable:
3
+ //
4
+ // ┌──────────────────────────────────────────────────────────────────────────┐
5
+ // │ (ic) Title extra [Sign in again] › │
6
+ // │ one line that says what it is │
7
+ // │ ● the status line — what is set │
8
+ // ├── open: the rows, then its own › Advanced fold ───────────────────────────┤
9
+ // └──────────────────────────────────────────────────────────────────────────┘
10
+ //
11
+ // The header is one button (Enter / Space toggle it, `aria-expanded`, the kit focus ring); the action sits
12
+ // beside it, outside the button, so a one-click fix stays visible on a CLOSED card. The body stays mounted
13
+ // while closed (`hidden`) — a model download's poll and a half-typed field survive a fold — and ⌘K can
14
+ // still find a row inside it: the sheet opens the card that holds the hit (settings-cards.js).
15
+
16
+ import { useEffect, useRef } from 'react';
17
+
18
+ import { StIcon } from '../../shell/icons.jsx';
19
+ import { AdvancedFold } from '../fold/advanced-fold.jsx';
20
+
21
+ /** The status dot + words (canvas 17 `StatusWord`): a word with a dot, never hue alone. */
22
+ export function StatusLine({ sw, children, testid }) {
23
+ return (
24
+ <span className="v2s-card-s" data-sw={sw || undefined} data-testid={testid}>
25
+ {sw ? <i className="v2s-dot" aria-hidden="true" /> : null}
26
+ <span className="v2s-card-s-t">{children}</span>
27
+ </span>
28
+ );
29
+ }
30
+
31
+ /** One "k · value" row inside an open card (canvas 17 `Row`): label left, value, then its button. */
32
+ export function CardRow({ k, children, action, testid }) {
33
+ return (
34
+ <div className="v2s-card-row" data-testid={testid}>
35
+ <span className="v2s-card-row-k">{k}</span>
36
+ <span className="v2s-card-row-v">{children}</span>
37
+ {action ? <span className="v2s-card-row-a">{action}</span> : null}
38
+ </div>
39
+ );
40
+ }
41
+
42
+ export function SettingsCard({
43
+ id,
44
+ icon,
45
+ /** A node in place of the icon glyph (This project's coloured square). */
46
+ iconNode,
47
+ title,
48
+ /** Words after the title, quieter ("This project Brand site"). */
49
+ titleExtra,
50
+ desc,
51
+ summary,
52
+ /** The status dot: ok · busy · off · error · warn; absent = a plain line. */
53
+ sw,
54
+ /** A broken sign-in: the status line reads in the error ink. */
55
+ bad = false,
56
+ action,
57
+ open,
58
+ onToggle,
59
+ testid,
60
+ /** The card's inner fold: `{ panel, label?, hint?, testid?, body }`. */
61
+ fold,
62
+ /** Scroll the card into view once (⌘K opened it). */
63
+ reveal = false,
64
+ /** The landmark's name when the title is not plain words. */
65
+ label,
66
+ /** The status line's hook (Connections keeps S11.14's `settings-conn-<row>-status`). */
67
+ summaryTestid,
68
+ children,
69
+ }) {
70
+ const ref = useRef(null);
71
+ useEffect(() => {
72
+ if (reveal && open) ref.current?.scrollIntoView?.({ block: 'nearest' });
73
+ }, [reveal, open]);
74
+ const bodyId = `v2s-card-${id}-b`;
75
+ const headId = `v2s-card-${id}-h`;
76
+ return (
77
+ <section
78
+ ref={ref}
79
+ className={bad ? 'v2s-card v2s-card--bad' : 'v2s-card'}
80
+ data-open={open ? 'true' : undefined}
81
+ data-card={id}
82
+ aria-label={`${label ?? (typeof title === 'string' ? title : id)} settings`}
83
+ data-testid={testid ?? `settings-card-${id}`}
84
+ >
85
+ <div className="v2s-card-r">
86
+ <button
87
+ type="button"
88
+ id={headId}
89
+ className="v2s-card-h"
90
+ aria-expanded={!!open}
91
+ aria-controls={bodyId}
92
+ onClick={() => onToggle?.(id)}
93
+ data-testid={`settings-card-${id}-toggle`}
94
+ >
95
+ <span
96
+ className={iconNode ? 'v2s-card-ic v2s-card-ic--bare' : 'v2s-card-ic'}
97
+ aria-hidden="true"
98
+ >
99
+ {iconNode ?? <StIcon name={icon} size={16} />}
100
+ </span>
101
+ <span className="v2s-card-t">
102
+ <strong className="v2s-card-tt">
103
+ {title}
104
+ {titleExtra ? <span className="v2s-card-q">{titleExtra}</span> : null}
105
+ </strong>
106
+ {desc ? <span className="v2s-card-d">{desc}</span> : null}
107
+ {summary !== undefined && summary !== null ? (
108
+ <StatusLine sw={sw} testid={summaryTestid ?? `settings-card-${id}-summary`}>
109
+ {summary}
110
+ </StatusLine>
111
+ ) : null}
112
+ </span>
113
+ </button>
114
+ {action ? <span className="v2s-card-a">{action}</span> : null}
115
+ {/* the chevron is the header's too (a pointer target, not a second stop for the keyboard) */}
116
+ <span className="v2s-card-ch" aria-hidden="true" onClick={() => onToggle?.(id)}>
117
+ <StIcon name="submenu" size={14} />
118
+ </span>
119
+ </div>
120
+ <div
121
+ id={bodyId}
122
+ className="v2s-card-b"
123
+ hidden={!open}
124
+ data-testid={`settings-card-${id}-body`}
125
+ >
126
+ {children}
127
+ {fold ? (
128
+ <div className="v2s-card-fold">
129
+ <AdvancedFold
130
+ panel={fold.panel}
131
+ label={fold.label ?? 'Advanced'}
132
+ hint={fold.hint}
133
+ testid={fold.testid}
134
+ >
135
+ {fold.body}
136
+ </AdvancedFold>
137
+ </div>
138
+ ) : null}
139
+ </div>
140
+ </section>
141
+ );
142
+ }
@@ -0,0 +1,220 @@
1
+ // client/v2/settings/settings-cards.js — 2.1.1 T6: Settings as one column of expandable cards (canvas 17,
2
+ // artboards 08 · 10 · 11). PURE (no DOM, no React).
3
+ //
4
+ // Every tab is one column of cards — today's Connections row made expandable: icon · title · one line ·
5
+ // a status line that says what is set, an action that fixes it in one click, a chevron that opens it.
6
+ // One card is open per tab; which one is remembered per tab for this session (sessionStorage — a
7
+ // window you reopen tomorrow starts on the defaults again). The cards a tab carries, their default,
8
+ // and the one-line summaries live here so the sheet, ⌘K and the tests read one table.
9
+
10
+ import { PANEL_SIDE_DEFAULTS, LAYERS_MODE_DEFAULT } from './settings-model.js';
11
+
12
+ /** The cards per tab, in the order the column draws them (08 · 10 · 11). */
13
+ export const CARDS = Object.freeze({
14
+ general: Object.freeze([
15
+ 'this-project',
16
+ 'look',
17
+ 'canvas',
18
+ 'terminal',
19
+ 'keyboard',
20
+ 'layout',
21
+ // a cloud tab has no This project card: the account the hub signed it in as is its own card
22
+ 'account',
23
+ ]),
24
+ connections: Object.freeze(['claude', 'figma', 'github', 'ai']),
25
+ advanced: Object.freeze([
26
+ 'spend',
27
+ 'this-mac',
28
+ 'claude-code',
29
+ 'decision-memory',
30
+ 'engines',
31
+ 'privacy',
32
+ 'experimental',
33
+ 'reset',
34
+ ]),
35
+ });
36
+
37
+ /** The card a tab opens on before the person picked one (08 This project · 10 Claude · 11 This Mac). */
38
+ export const DEFAULT_OPEN = Object.freeze({
39
+ general: 'this-project',
40
+ connections: 'claude',
41
+ advanced: 'this-mac',
42
+ });
43
+
44
+ export const CARD_STORE = 'maude-settings-card-v1';
45
+
46
+ function storage(store) {
47
+ if (store !== undefined) return store;
48
+ try {
49
+ return typeof sessionStorage !== 'undefined' ? sessionStorage : null;
50
+ } catch {
51
+ return null;
52
+ }
53
+ }
54
+
55
+ /** The open card per tab this session: `{ general: 'look', advanced: null, … }` (null = all closed). */
56
+ export function readOpenCards(store) {
57
+ const s = storage(store);
58
+ try {
59
+ const v = JSON.parse(s?.getItem(CARD_STORE) ?? 'null');
60
+ return v && typeof v === 'object' && !Array.isArray(v) ? v : {};
61
+ } catch {
62
+ return {};
63
+ }
64
+ }
65
+
66
+ /** Which card of `tab` is open: the remembered one (or none, when the person closed it), else the default. */
67
+ export function openCardOf(tab, remembered = {}) {
68
+ const ids = CARDS[tab] ?? [];
69
+ if (Object.hasOwn(remembered, tab)) {
70
+ const v = remembered[tab];
71
+ return v === null || ids.includes(v) ? v : (DEFAULT_OPEN[tab] ?? null);
72
+ }
73
+ return DEFAULT_OPEN[tab] ?? null;
74
+ }
75
+
76
+ /** A click on a card's header: open it (closing the tab's other one), or close it when it was open. */
77
+ export function toggleCard(current, id) {
78
+ return current === id ? null : id;
79
+ }
80
+
81
+ export function writeOpenCard(tab, id, store) {
82
+ const s = storage(store);
83
+ try {
84
+ s?.setItem(CARD_STORE, JSON.stringify({ ...readOpenCards(s), [tab]: id }));
85
+ } catch {
86
+ /* private mode — the choice just isn't remembered */
87
+ }
88
+ }
89
+
90
+ /**
91
+ * ⌘K's Settings result → what the sheet opens on: `"general#look"` (the tab, then the card that holds the
92
+ * row). A plain `"advanced"` (the menu's own Settings…, an older caller) opens the tab alone.
93
+ */
94
+ export function settingsTarget(section, row) {
95
+ return row?.card ? `${section}#${row.card}` : section;
96
+ }
97
+ export function parseSettingsTarget(target) {
98
+ if (typeof target !== 'string' || !target) return { tab: undefined, card: null };
99
+ const [tab, card] = target.split('#');
100
+ return { tab: tab || undefined, card: card && (CARDS[tab] ?? []).includes(card) ? card : null };
101
+ }
102
+
103
+ // ── the closed card says what is set (08 · 11) ─────────────────────────────────────────────────
104
+
105
+ const cap = (s) => (s ? s[0].toUpperCase() + s.slice(1) : s);
106
+ function andList(words) {
107
+ if (words.length <= 1) return words.join('');
108
+ return `${words.slice(0, -1).join(', ')} and ${words[words.length - 1]}`;
109
+ }
110
+
111
+ /** Look: "Dark" · "Light" · "Auto — matches your computer". */
112
+ export function lookSummary(theme, auto = false) {
113
+ if (auto) return 'Auto — matches your computer';
114
+ return theme === 'light' ? 'Light' : 'Dark';
115
+ }
116
+
117
+ /** Canvas and view: "Zoom controls and annotations on · minimap off". */
118
+ export function canvasSummary({ minimap, zoom, annotations, autoInspector } = {}) {
119
+ const flags = [
120
+ ['minimap', minimap],
121
+ ['zoom controls', zoom],
122
+ ['annotations', annotations],
123
+ ['auto-open Inspector', autoInspector],
124
+ ];
125
+ const on = flags.filter(([, v]) => v === true).map(([k]) => k);
126
+ const off = flags.filter(([, v]) => v === false).map(([k]) => k);
127
+ const parts = [];
128
+ if (on.length) parts.push(`${andList(on)} on`);
129
+ if (off.length) parts.push(`${andList(off)} off`);
130
+ return parts.length ? cap(parts.join(' · ')) : '—';
131
+ }
132
+
133
+ /** Terminal (#206): what the terminal does with a project. */
134
+ export function terminalSummary(opens) {
135
+ return opens === false ? 'Uses its own hidden server' : 'Opens projects in Maude';
136
+ }
137
+
138
+ /** Keyboard: the one switch. */
139
+ export function keyboardSummary(singleKeys) {
140
+ return singleKeys === false ? 'Single-key shortcuts off' : 'Single-key shortcuts on';
141
+ }
142
+
143
+ /** Layout: "Panels in their usual places", or what moved. */
144
+ export function layoutSummary(panelSide = {}, layersMode = LAYERS_MODE_DEFAULT) {
145
+ const moved = Object.entries(PANEL_SIDE_DEFAULTS).filter(
146
+ ([id, side]) => (panelSide?.[id] ?? side) !== side
147
+ ).length;
148
+ const parts = [];
149
+ if (moved) parts.push(`${moved} ${moved === 1 ? 'panel' : 'panels'} moved`);
150
+ if (layersMode && layersMode !== LAYERS_MODE_DEFAULT) parts.push('Layers inside the Inspector');
151
+ return parts.length ? parts.join(' · ') : 'Panels in their usual places';
152
+ }
153
+
154
+ const money = (n) => {
155
+ const v = Number(n);
156
+ if (!Number.isFinite(v)) return '—';
157
+ return Number.isInteger(v) ? `$${v}` : `$${v.toFixed(2).replace(/0$/, '')}`;
158
+ };
159
+
160
+ /** Generation spend: "Stops at $5 a session and $20 a day · asks before a job over $2". */
161
+ export function spendSummary({ perRun, perDay, confirmOver } = {}) {
162
+ const ask =
163
+ Number(confirmOver) === 0
164
+ ? 'asks before every job'
165
+ : `asks before a job over ${money(confirmOver)}`;
166
+ return `Stops at ${money(perRun)} a session and ${money(perDay)} a day · ${ask}`;
167
+ }
168
+
169
+ /** This Mac: "Maude 2.1.1 · port 4402 · keys in the macOS Keychain" (an update ready says so first). */
170
+ export function thisMacSummary({ version, port, update } = {}) {
171
+ const parts = [];
172
+ if (update) parts.push(update.version ? `${update.version} is ready` : 'An update is ready');
173
+ parts.push(`Maude ${version}`);
174
+ if (port) parts.push(`port ${port}`);
175
+ parts.push('keys in the macOS Keychain');
176
+ return parts.join(' · ');
177
+ }
178
+
179
+ /** Claude Code: "design 2.1.1 · flow 2.1.1 · installs by itself". */
180
+ export function claudeCodeSummary({ plugins, ownCopy = false, autoSetup = true } = {}) {
181
+ const which = ownCopy ? 'your own plugin copy' : (plugins ?? 'from your own install');
182
+ return `${which} · ${autoSetup === false ? 'shows the install command' : 'installs by itself'}`;
183
+ }
184
+
185
+ /** Engines: what subtitles and keyframes run on (the saved engine names, Auto when none is saved). */
186
+ const SUBTITLE_WORDS = {
187
+ auto: 'Auto',
188
+ whisper: 'on this Mac',
189
+ elevenlabs: 'by ElevenLabs',
190
+ groq: 'by Groq',
191
+ };
192
+ const KEYFRAME_WORDS = {
193
+ auto: 'Auto',
194
+ gemma: 'on this Mac',
195
+ ffmpeg: 'by ffmpeg',
196
+ blind: 'evenly spaced',
197
+ };
198
+ export function enginesSummary(prefs) {
199
+ if (!prefs || typeof prefs !== 'object') return 'Auto picks for you';
200
+ const sub = SUBTITLE_WORDS[prefs.transcriptionProvider] ?? 'Auto';
201
+ const key = KEYFRAME_WORDS[prefs.keyframeEngine] ?? 'Auto';
202
+ if (sub === 'Auto' && key === 'Auto') return 'Auto picks for you';
203
+ return `Subtitles ${sub === 'Auto' ? 'Auto' : sub} · keyframes ${key === 'Auto' ? 'Auto' : key}`;
204
+ }
205
+
206
+ /** Privacy: "No usage data · asks before adding logs to a bug report". */
207
+ export function privacySummary(policy) {
208
+ const logs =
209
+ policy === 'always'
210
+ ? 'adds logs to bug reports'
211
+ : policy === 'never'
212
+ ? 'never adds logs to a bug report'
213
+ : 'asks before adding logs to a bug report';
214
+ return `No usage data · ${logs}`;
215
+ }
216
+
217
+ /** Experimental: "1 preview, off". */
218
+ export function experimentalSummary(teamsOn) {
219
+ return `1 preview, ${teamsOn ? 'on' : 'off'}`;
220
+ }