@1agh/maude 2.0.3 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/apps/hub/src/project-transactions/kernel.mjs +10 -1
- package/apps/studio/access/filters.ts +12 -5
- package/apps/studio/access/known-canvases.ts +24 -1
- package/apps/studio/access/refused-inputs.ts +89 -0
- package/apps/studio/access/request.ts +0 -1
- package/apps/studio/acp/adapter-stderr.ts +43 -13
- package/apps/studio/acp/background-tasks.ts +155 -0
- package/apps/studio/acp/bridge.ts +44 -5
- package/apps/studio/acp/connected-fact.ts +15 -4
- package/apps/studio/acp/index.ts +14 -5
- package/apps/studio/actions/agents.ts +10 -0
- package/apps/studio/actions/defs/app.ts +12 -0
- package/apps/studio/actions/defs/view.ts +12 -0
- package/apps/studio/actions.manifest.json +25 -1
- package/apps/studio/actions.parity.json +13 -1
- package/apps/studio/annotations/ui/element-node.tsx +139 -54
- package/apps/studio/annotations/ui/lod.tsx +1 -1
- package/apps/studio/annotations/ui/text-style.ts +1 -1
- package/apps/studio/annotations-layer.tsx +0 -12
- package/apps/studio/api.ts +73 -24
- package/apps/studio/artboard-live-gate.tsx +267 -0
- package/apps/studio/artboard-live.ts +336 -0
- package/apps/studio/artboard-webgl.ts +668 -0
- package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
- package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
- package/apps/studio/bin/_canvas-reasons.mjs +34 -0
- package/apps/studio/bin/_ds-check-live.mjs +37 -0
- package/apps/studio/bin/_ds-check.mjs +4 -1
- package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
- package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
- package/apps/studio/bin/_import-asset.mjs +2 -1
- package/apps/studio/bin/_perf-probe.mjs +2 -1
- package/apps/studio/bin/_png-playwright.mjs +10 -1
- package/apps/studio/bin/_pw-launch.mjs +14 -0
- package/apps/studio/bin/_studio-verb.mjs +24 -3
- package/apps/studio/bin/_thumb-blank.mjs +70 -0
- package/apps/studio/bin/_thumb-cover.mjs +35 -0
- package/apps/studio/bin/_thumbs-playwright.mjs +93 -13
- package/apps/studio/bin/ds-check.sh +5 -1
- package/apps/studio/bin/perf.sh +11 -1
- package/apps/studio/bin/server-up.sh +7 -2
- package/apps/studio/bin/smoke.sh +19 -0
- package/apps/studio/boot-progress.ts +31 -0
- package/apps/studio/canvas-build-sandbox.ts +275 -42
- package/apps/studio/canvas-build-worker.ts +10 -0
- package/apps/studio/canvas-create.ts +24 -0
- package/apps/studio/canvas-lib.tsx +131 -12
- package/apps/studio/canvas-module-cache.ts +93 -0
- package/apps/studio/canvas-source/errors.ts +39 -0
- package/apps/studio/canvas-source/waiting.ts +290 -0
- package/apps/studio/client/actions/shell-key-handlers.js +5 -0
- package/apps/studio/client/app.jsx +19 -9
- package/apps/studio/client/canvas-url.js +13 -0
- package/apps/studio/client/github.js +23 -3
- package/apps/studio/client/home/HomeAccounts.jsx +262 -0
- package/apps/studio/client/home/Shelves.jsx +4 -3
- package/apps/studio/client/home/home-accounts-model.js +121 -0
- package/apps/studio/client/home/home-api.js +36 -19
- package/apps/studio/client/home/home-app.jsx +141 -40
- package/apps/studio/client/home/home-model.js +172 -6
- package/apps/studio/client/home/home.css +169 -5
- package/apps/studio/client/home/shell-mode.js +8 -1
- package/apps/studio/client/hooks/use-git-actions.jsx +2 -1
- package/apps/studio/client/hooks/use-project-data.jsx +2 -0
- package/apps/studio/client/hooks/use-shell-core.jsx +3 -0
- package/apps/studio/client/hooks/use-tabs.jsx +64 -35
- package/apps/studio/client/index-loader.ts +23 -3
- package/apps/studio/client/panels/ChatPanel.jsx +49 -57
- package/apps/studio/client/panels/CreateProject.jsx +19 -5
- package/apps/studio/client/panels/DiffView.jsx +314 -248
- package/apps/studio/client/panels/TeamProjects.jsx +119 -69
- package/apps/studio/client/panels/acp-runtime.js +25 -0
- package/apps/studio/client/panels/caps-cache.js +46 -0
- package/apps/studio/client/panels/chat-finish.js +66 -0
- package/apps/studio/client/shell/frame-cap.js +53 -0
- package/apps/studio/client/shell/viewport.jsx +45 -8
- package/apps/studio/client/styles/_index.css +2 -0
- package/apps/studio/client/tree/tree.jsx +48 -21
- package/apps/studio/client/v2/access/access-client.js +2 -0
- package/apps/studio/client/v2/access/access-host.jsx +12 -1
- package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
- package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
- package/apps/studio/client/v2/ai/BackgroundStrip.jsx +120 -0
- package/apps/studio/client/v2/ai/Composer.jsx +27 -10
- package/apps/studio/client/v2/ai/StoppedDivider.jsx +2 -1
- package/apps/studio/client/v2/ai/ai-run.css +87 -3
- package/apps/studio/client/v2/ai/background-model.js +113 -0
- package/apps/studio/client/v2/ai/needs-you-store.js +2 -1
- package/apps/studio/client/v2/ai/run-api.js +7 -3
- package/apps/studio/client/v2/ai/runs-store.js +2 -1
- package/apps/studio/client/v2/annotations/vote-store.js +11 -5
- package/apps/studio/client/v2/assets/asset-state-lane.js +6 -3
- package/apps/studio/client/v2/assets/assets-bus.js +10 -8
- package/apps/studio/client/v2/assets/browse-view.jsx +2 -0
- package/apps/studio/client/v2/assets/ds-library-view.jsx +47 -0
- package/apps/studio/client/v2/assets/spotlight-model.js +75 -0
- package/apps/studio/client/v2/assets/spotlight.css +153 -0
- package/apps/studio/client/v2/assets/spotlight.jsx +199 -0
- package/apps/studio/client/v2/assets/tile-menu.jsx +3 -1
- package/apps/studio/client/v2/assets/tile.jsx +3 -0
- package/apps/studio/client/v2/assets/use-assets.js +2 -1
- package/apps/studio/client/v2/canvases/canvases-panel.jsx +13 -2
- package/apps/studio/client/v2/canvases/covers.js +11 -5
- package/apps/studio/client/v2/canvases/folder-ask.js +139 -0
- package/apps/studio/client/v2/canvases/folder-dialogs.jsx +150 -0
- package/apps/studio/client/v2/canvases/trash-canvas.js +10 -2
- package/apps/studio/client/v2/canvases/trash-queue.js +152 -0
- package/apps/studio/client/v2/canvases/use-canvas-index.js +42 -18
- package/apps/studio/client/v2/canvases/use-pins.js +2 -1
- package/apps/studio/client/v2/code/canvas-error-card.jsx +70 -5
- package/apps/studio/client/v2/code/canvas-imports-card.jsx +15 -14
- package/apps/studio/client/v2/code/canvas-imports-words.js +44 -0
- package/apps/studio/client/v2/code/canvas-waiting-card.jsx +128 -0
- package/apps/studio/client/v2/code/canvas-waiting.js +164 -0
- package/apps/studio/client/v2/code/code-bus.js +5 -0
- package/apps/studio/client/v2/code/code.css +67 -0
- package/apps/studio/client/v2/code/use-canvas-source.js +19 -4
- package/apps/studio/client/v2/create/NameDialog.jsx +4 -2
- package/apps/studio/client/v2/create/name-dialog.css +10 -0
- package/apps/studio/client/v2/ds/advanced-host.jsx +11 -23
- package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
- package/apps/studio/client/v2/ds/library-host.jsx +45 -45
- package/apps/studio/client/v2/ds/make-host.jsx +13 -12
- package/apps/studio/client/v2/ds/off-system-host.jsx +18 -16
- package/apps/studio/client/v2/ds/review-host.jsx +7 -1
- package/apps/studio/client/v2/ds/truth-host.jsx +15 -14
- package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
- package/apps/studio/client/v2/empty/arriving.jsx +29 -12
- package/apps/studio/client/v2/empty/empty-host.jsx +8 -2
- package/apps/studio/client/v2/empty/not-local.jsx +31 -1
- package/apps/studio/client/v2/empty/use-empty-canvas.js +10 -1
- package/apps/studio/client/v2/export/last-finished.js +2 -1
- package/apps/studio/client/v2/history/branch-actions.js +13 -9
- package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
- package/apps/studio/client/v2/history/git-model.js +21 -5
- package/apps/studio/client/v2/history/git-parts.jsx +76 -43
- package/apps/studio/client/v2/history/history.css +6 -0
- package/apps/studio/client/v2/left-panel/assets-panel.jsx +87 -10
- package/apps/studio/client/v2/left-panel/use-trash.js +2 -1
- package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +100 -33
- package/apps/studio/client/v2/onboarding/HubSheet.jsx +51 -83
- package/apps/studio/client/v2/onboarding/onboarding-model.js +10 -6
- package/apps/studio/client/v2/presence/faces.jsx +42 -14
- package/apps/studio/client/v2/present/order-notes-artboards.js +2 -1
- package/apps/studio/client/v2/search/search-recent.js +3 -1
- package/apps/studio/client/v2/search/search-remote.js +6 -4
- package/apps/studio/client/v2/settings/connections-model.js +1 -1
- package/apps/studio/client/v2/shell/account-card.jsx +10 -4
- package/apps/studio/client/v2/shell/canvas-crash-guard.js +137 -0
- package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
- package/apps/studio/client/v2/shell/menu-runner.js +12 -0
- package/apps/studio/client/v2/shell/occlusion-insets.js +14 -2
- package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
- package/apps/studio/client/v2/shell/project-account-model.js +182 -0
- package/apps/studio/client/v2/shell/recovery-store.js +2 -1
- package/apps/studio/client/v2/shell/served-routes.js +120 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +139 -11
- package/apps/studio/client/v2/shell/share-cluster.css +58 -0
- package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
- package/apps/studio/client/v2/shell/shell-activity.js +19 -0
- package/apps/studio/client/v2/shell/team-switch.js +94 -0
- package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
- package/apps/studio/client/v2/shell/use-account.js +8 -1
- package/apps/studio/client/v2/shell/use-occluded-insets.js +3 -0
- package/apps/studio/client/v2/sync-states/conflict-card.jsx +7 -2
- package/apps/studio/client/v2/undo/use-undo-projection.jsx +3 -1
- package/apps/studio/cloud/endpoints.ts +23 -1
- package/apps/studio/collab/persistence.ts +9 -1
- package/apps/studio/collab/registry.ts +32 -0
- package/apps/studio/collab/room.ts +8 -0
- package/apps/studio/config-reload-wire.ts +53 -0
- package/apps/studio/dist/client.bundle.js +1098 -1102
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/ds/board/specimen.tsx +12 -1
- package/apps/studio/ds/canvas-cli.ts +58 -2
- package/apps/studio/ds/check.ts +26 -1
- package/apps/studio/ds/cli.ts +7 -3
- package/apps/studio/ds/convert.ts +34 -6
- package/apps/studio/ds/ds-verb.ts +13 -0
- package/apps/studio/ds/post-build.ts +38 -0
- package/apps/studio/ds/upgrade-apply.ts +27 -5
- package/apps/studio/ds/upgrade-cli.ts +22 -2
- package/apps/studio/ds/upgrade-prove.ts +198 -15
- package/apps/studio/ds/upgrade-stage.ts +4 -1
- package/apps/studio/editing/minimap-context.tsx +3 -3
- package/apps/studio/editing/page-activity.ts +251 -0
- package/apps/studio/editing/rotate-handle.tsx +9 -5
- package/apps/studio/editing/sticky-name.tsx +4 -4
- package/apps/studio/history/restore-artboard-action.ts +40 -0
- package/apps/studio/history/trash.ts +6 -0
- package/apps/studio/home/accounts.ts +87 -0
- package/apps/studio/home/hub.ts +77 -175
- package/apps/studio/home/index-reader.ts +24 -2
- package/apps/studio/home/routes.ts +66 -8
- package/apps/studio/http.ts +131 -68
- package/apps/studio/index-flight.ts +40 -0
- package/apps/studio/managed-projects.ts +52 -24
- package/apps/studio/migrate/hub.ts +7 -1
- package/apps/studio/routes/canvas-source.ts +44 -2
- package/apps/studio/routes/ds-convert.ts +18 -0
- package/apps/studio/routes/history.ts +28 -5
- package/apps/studio/routes/hub-signin.ts +115 -0
- package/apps/studio/routes/index.ts +4 -0
- package/apps/studio/routes/table.ts +7 -0
- package/apps/studio/routes/trash.ts +19 -1
- package/apps/studio/server.ts +19 -10
- package/apps/studio/sync/accepted-cold-start.ts +54 -16
- package/apps/studio/sync/accepted-link.ts +9 -4
- package/apps/studio/sync/asset-push.ts +146 -23
- package/apps/studio/sync/asset-state.ts +3 -2
- package/apps/studio/sync/code-module-consent.ts +74 -0
- package/apps/studio/sync/file-ledger.ts +35 -0
- package/apps/studio/sync/file-membership.ts +28 -3
- package/apps/studio/sync/file-plane.ts +483 -86
- package/apps/studio/sync/file-pull.ts +304 -33
- package/apps/studio/sync/hub-browser-signin.ts +377 -0
- package/apps/studio/sync/hub-link.ts +1 -2
- package/apps/studio/sync/hub-text-undo.ts +30 -10
- package/apps/studio/sync/index.ts +381 -161
- package/apps/studio/sync/journal-client.ts +94 -5
- package/apps/studio/sync/pending-deletes.ts +100 -0
- package/apps/studio/sync/projection.ts +121 -14
- package/apps/studio/sync/pull-pacer.ts +160 -0
- package/apps/studio/sync/pull-priority.ts +119 -0
- package/apps/studio/sync/seed-progress.ts +58 -3
- package/apps/studio/sync/status.ts +3 -1
- package/apps/studio/sync/transaction-client.ts +71 -6
- package/apps/studio/sync/workspace-signin.ts +6 -256
- package/apps/studio/sync/writer-registry.ts +5 -1
- package/apps/studio/thumbs/service.ts +12 -2
- package/apps/studio/thumbs/validate.ts +7 -0
- package/apps/studio/ui-prefs-migrate.ts +4 -0
- package/apps/studio/video-comp.tsx +23 -0
- package/apps/studio/video-links-overlay.tsx +3 -2
- package/apps/studio/whats-new.json +126 -0
- package/cli/lib/bash-guard.mjs +13 -1
- package/cli/lib/design-help.gen.mjs +1 -1
- package/cli/lib/design-hook.mjs +20 -0
- package/cli/lib/studio-locate.mjs +35 -10
- package/cli/lib/workspace-plan.mjs +14 -0
- package/package.json +8 -8
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// client/v2/onboarding/HubSheet.jsx — "Connect to your own hub" (02 ob-adv-sheets, S6.9). The sheet S11.14's
|
|
2
2
|
// Settings › Connections mounts as "Add a team server…" (G0-D/D12), so it is a view: it owns its fields and
|
|
3
|
-
// calls back; what Test connection and
|
|
3
|
+
// calls back; what Test connection and Sign in DO is the caller's (Home: `/_home/hub/{test,signin/*,prepare}`).
|
|
4
4
|
//
|
|
5
|
-
// <HubSheet onTest={(url) => {ok, version?, error?}}
|
|
6
|
-
//
|
|
7
|
-
//
|
|
5
|
+
// <HubSheet onTest={(url) => {ok, version?, error?}}
|
|
6
|
+
// onSignIn={({url, invite, onWaiting}) => {ok, error?, cancelled?}}
|
|
7
|
+
// onAbortSignIn={() => void} onCancel />
|
|
8
8
|
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
9
|
+
// Issue #204 (decision maude/v2-michal-team-server-signin-via-hub-page): the app owns NO login method for a
|
|
10
|
+
// team server. There is no email or password field here: Sign in opens the hub's OWN sign-in page in the
|
|
11
|
+
// browser (with an invite, the hub's own invite page), the sheet waits (`onWaiting` → "Finish signing in in
|
|
12
|
+
// your browser.", Cancel = `onAbortSignIn`) and the caller opens the project once the browser came back.
|
|
13
|
+
// The invite key is a bearer secret: a masked field, read once on Sign in and emptied at once; an error
|
|
14
|
+
// line is the server's own words, never an echo.
|
|
14
15
|
|
|
15
16
|
import { useEffect, useRef, useState } from 'react';
|
|
16
17
|
|
|
@@ -31,18 +32,17 @@ export function hubOfInviteLink(raw) {
|
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* @param {{ onTest: (url: string) => Promise<{ok: boolean, version?: string|null, error?: string}>,
|
|
34
|
-
*
|
|
35
|
-
*
|
|
35
|
+
* onSignIn: (v: {url: string, invite: string, onWaiting: () => void}) =>
|
|
36
|
+
* Promise<{ok: boolean, error?: string, cancelled?: boolean}>,
|
|
37
|
+
* onAbortSignIn?: () => void,
|
|
36
38
|
* onCancel: () => void, initialUrl?: string }} props
|
|
37
39
|
*/
|
|
38
|
-
export function HubSheet({ onTest,
|
|
40
|
+
export function HubSheet({ onTest, onSignIn, onAbortSignIn, onCancel, initialUrl = '' }) {
|
|
39
41
|
const [url, setUrl] = useState(initialUrl);
|
|
40
|
-
const [mode, setMode] = useState('password'); // 'password' | 'invite'
|
|
41
|
-
const [email, setEmail] = useState('');
|
|
42
|
-
const [password, setPassword] = useState('');
|
|
43
42
|
const [invite, setInvite] = useState('');
|
|
44
43
|
const [test, setTest] = useState({ phase: 'idle', version: null, error: null });
|
|
45
44
|
const [busy, setBusy] = useState(false);
|
|
45
|
+
const [waiting, setWaiting] = useState(false);
|
|
46
46
|
const [error, setError] = useState(null);
|
|
47
47
|
const alive = useRef(true);
|
|
48
48
|
const seq = useRef(0); // an answer for an address that has since changed is dropped
|
|
@@ -70,41 +70,46 @@ export function HubSheet({ onTest, onConnect, onJoin, onCancel, initialUrl = ''
|
|
|
70
70
|
);
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
// read once, empty the fields now — the password (and an invite key) never outlives this call in the page
|
|
76
|
-
const creds = email.trim() || password ? { email: email.trim(), password } : null;
|
|
73
|
+
const signIn = async () => {
|
|
74
|
+
// read once, empty the field now — an invite key never outlives this call in the page
|
|
77
75
|
const key = invite.trim();
|
|
78
|
-
setPassword('');
|
|
79
76
|
setInvite('');
|
|
80
77
|
setError(null);
|
|
81
78
|
setBusy(true);
|
|
82
79
|
let r;
|
|
83
80
|
try {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
r = await onSignIn({
|
|
82
|
+
url: url.trim(),
|
|
83
|
+
invite: key,
|
|
84
|
+
onWaiting: () => {
|
|
85
|
+
if (alive.current) setWaiting(true);
|
|
86
|
+
},
|
|
87
|
+
});
|
|
87
88
|
} catch {
|
|
88
89
|
r = { ok: false, error: W.unreachable };
|
|
89
90
|
}
|
|
90
91
|
if (!alive.current) return;
|
|
91
92
|
setBusy(false);
|
|
92
|
-
|
|
93
|
+
setWaiting(false);
|
|
94
|
+
if (!r?.ok && !r?.cancelled) setError(r?.error || W.unreachable);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const abort = () => {
|
|
98
|
+
setWaiting(false);
|
|
99
|
+
onAbortSignIn?.();
|
|
93
100
|
};
|
|
94
101
|
|
|
95
102
|
return (
|
|
96
|
-
<AdvModal onCancel={onCancel}>
|
|
103
|
+
<AdvModal onCancel={waiting ? abort : onCancel}>
|
|
97
104
|
<AdvSheet
|
|
98
105
|
id="hub"
|
|
99
106
|
title={W.title}
|
|
100
107
|
verb={W.verb}
|
|
101
108
|
busyVerb={W.busy}
|
|
102
109
|
busy={busy}
|
|
103
|
-
canSubmit={
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
onSubmit={connect}
|
|
107
|
-
onCancel={onCancel}
|
|
110
|
+
canSubmit={!!url.trim() && !busy}
|
|
111
|
+
onSubmit={signIn}
|
|
112
|
+
onCancel={waiting ? abort : onCancel}
|
|
108
113
|
>
|
|
109
114
|
<span className="ob-field">
|
|
110
115
|
<label className="ob-field-label" htmlFor="onb-hub-url">
|
|
@@ -122,6 +127,7 @@ export function HubSheet({ onTest, onConnect, onJoin, onCancel, initialUrl = ''
|
|
|
122
127
|
placeholder="https://"
|
|
123
128
|
// biome-ignore lint/a11y/noAutofocus: the sheet opens for this one field
|
|
124
129
|
autoFocus
|
|
130
|
+
disabled={busy}
|
|
125
131
|
value={url}
|
|
126
132
|
onChange={(e) => {
|
|
127
133
|
seq.current += 1;
|
|
@@ -133,7 +139,7 @@ export function HubSheet({ onTest, onConnect, onJoin, onCancel, initialUrl = ''
|
|
|
133
139
|
type="button"
|
|
134
140
|
className="btn btn--sm"
|
|
135
141
|
data-testid="onb-hub-test"
|
|
136
|
-
disabled={!url.trim() || test.phase === 'busy'}
|
|
142
|
+
disabled={!url.trim() || test.phase === 'busy' || busy}
|
|
137
143
|
onClick={runTest}
|
|
138
144
|
>
|
|
139
145
|
{W.test}
|
|
@@ -160,41 +166,20 @@ export function HubSheet({ onTest, onConnect, onJoin, onCancel, initialUrl = ''
|
|
|
160
166
|
) : null}
|
|
161
167
|
</span>
|
|
162
168
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
className="ob-seg-b"
|
|
168
|
-
aria-pressed={inviteMode ? 'false' : 'true'}
|
|
169
|
-
data-testid="onb-hub-mode-password"
|
|
170
|
-
onClick={() => setMode('password')}
|
|
171
|
-
>
|
|
172
|
-
{W.modePassword}
|
|
173
|
-
</button>
|
|
174
|
-
<button
|
|
175
|
-
type="button"
|
|
176
|
-
className="ob-seg-b"
|
|
177
|
-
aria-pressed={inviteMode ? 'true' : 'false'}
|
|
178
|
-
aria-disabled={onJoin ? undefined : 'true'}
|
|
179
|
-
data-testid="onb-hub-mode-invite"
|
|
180
|
-
onClick={() => {
|
|
181
|
-
if (onJoin) setMode('invite');
|
|
182
|
-
}}
|
|
183
|
-
>
|
|
184
|
-
{W.modeInvite}
|
|
185
|
-
</button>
|
|
186
|
-
</span>
|
|
187
|
-
|
|
188
|
-
{inviteMode ? (
|
|
169
|
+
<span className="ob-field">
|
|
170
|
+
<label className="ob-field-label" htmlFor="onb-hub-invite">
|
|
171
|
+
{W.inviteLabel}
|
|
172
|
+
</label>
|
|
189
173
|
<input
|
|
174
|
+
id="onb-hub-invite"
|
|
190
175
|
className="ob-input"
|
|
191
176
|
data-testid="onb-hub-invite"
|
|
192
|
-
// a bearer secret
|
|
177
|
+
// a bearer secret: masked, never drawn back
|
|
193
178
|
type="password"
|
|
194
179
|
autoComplete="off"
|
|
195
180
|
spellCheck={false}
|
|
196
|
-
|
|
197
|
-
|
|
181
|
+
placeholder={W.invitePlaceholder}
|
|
182
|
+
disabled={busy}
|
|
198
183
|
value={invite}
|
|
199
184
|
onChange={(e) => {
|
|
200
185
|
const v = e.target.value;
|
|
@@ -208,30 +193,13 @@ export function HubSheet({ onTest, onConnect, onJoin, onCancel, initialUrl = ''
|
|
|
208
193
|
}
|
|
209
194
|
}}
|
|
210
195
|
/>
|
|
211
|
-
) : null}
|
|
212
|
-
|
|
213
|
-
<span className="ob-row2">
|
|
214
|
-
<input
|
|
215
|
-
className="ob-input"
|
|
216
|
-
data-testid="onb-hub-email"
|
|
217
|
-
type="email"
|
|
218
|
-
autoComplete="off"
|
|
219
|
-
aria-label="Email"
|
|
220
|
-
placeholder="you@alligators.cz"
|
|
221
|
-
value={email}
|
|
222
|
-
onChange={(e) => setEmail(e.target.value)}
|
|
223
|
-
/>
|
|
224
|
-
<input
|
|
225
|
-
className="ob-input"
|
|
226
|
-
data-testid="onb-hub-password"
|
|
227
|
-
type="password"
|
|
228
|
-
autoComplete="off"
|
|
229
|
-
aria-label="Password"
|
|
230
|
-
placeholder="Password"
|
|
231
|
-
value={password}
|
|
232
|
-
onChange={(e) => setPassword(e.target.value)}
|
|
233
|
-
/>
|
|
234
196
|
</span>
|
|
197
|
+
|
|
198
|
+
{waiting ? (
|
|
199
|
+
<p className="ob-ok" role="status" data-testid="onb-hub-waiting">
|
|
200
|
+
<Sw state="busy">{W.waiting}</Sw>
|
|
201
|
+
</p>
|
|
202
|
+
) : null}
|
|
235
203
|
{error ? (
|
|
236
204
|
<p className="ai-conn-err" role="alert" data-testid="onb-hub-error">
|
|
237
205
|
{error}
|
|
@@ -3,17 +3,21 @@
|
|
|
3
3
|
// main button ("Connect to your own hub" → Connect). Advanced language (addresses, commands, keys) is allowed
|
|
4
4
|
// here and only here (the canvas's note 15).
|
|
5
5
|
|
|
6
|
+
// Issue #204: one Sign in — the hub's own page in the browser; no email or password field in the app.
|
|
6
7
|
export const HUB_WORDS = {
|
|
7
|
-
title: '
|
|
8
|
-
verb: '
|
|
9
|
-
busy: '
|
|
8
|
+
title: 'Sign in to your own hub',
|
|
9
|
+
verb: 'Sign in',
|
|
10
|
+
busy: 'Signing in…',
|
|
10
11
|
addressLabel: 'Hub address',
|
|
11
12
|
test: 'Test connection',
|
|
12
13
|
testing: 'Testing…',
|
|
13
14
|
reachable: (version) => (version ? `Reachable — hub ${version}` : 'Reachable'),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
inviteLabel: 'Invite link or key (if you have one)',
|
|
16
|
+
invitePlaceholder: 'Invite link or key',
|
|
17
|
+
waiting: 'Finish signing in in your browser.',
|
|
18
|
+
refused: 'That address can’t be opened. Check the hub address.',
|
|
19
|
+
noBrowser: 'The browser didn’t open. Try again.',
|
|
20
|
+
fine: 'Sign in opens the hub’s own sign-in page in your browser. Maude Cloud stays signed in too.',
|
|
17
21
|
unreachable: "Couldn't reach that hub. Check the address, or whether it's online.",
|
|
18
22
|
};
|
|
19
23
|
|
|
@@ -79,12 +79,35 @@ function toneStyle(name, you = false) {
|
|
|
79
79
|
return { '--face-tone': toneVar(you ? YOU_TONE : toneFor(name)) };
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/** 2.0.5 W4 — your own face is the avatar: a button that opens THIS project's account (the host's card). */
|
|
83
|
+
function YouFace({ face, onYou, youOpen }) {
|
|
84
|
+
return (
|
|
85
|
+
<li className="sh-face-li">
|
|
86
|
+
<button
|
|
87
|
+
type="button"
|
|
88
|
+
className="sh-face is-you"
|
|
89
|
+
style={toneStyle(face.name, true)}
|
|
90
|
+
title={`${face.name} · Account`}
|
|
91
|
+
aria-label={`${face.name} — this project's account`}
|
|
92
|
+
aria-haspopup="dialog"
|
|
93
|
+
aria-expanded={youOpen ? 'true' : 'false'}
|
|
94
|
+
data-testid="share-cluster-face-you"
|
|
95
|
+
data-account-opener="true"
|
|
96
|
+
onClick={() => onYou()}
|
|
97
|
+
>
|
|
98
|
+
{face.initials}
|
|
99
|
+
</button>
|
|
100
|
+
</li>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
82
104
|
/** The pre-S9.23 strip: a peer's face IS the Follow control. */
|
|
83
|
-
function LegacyFaces({ faces, onFollow }) {
|
|
105
|
+
function LegacyFaces({ faces, onFollow, onYou, youOpen }) {
|
|
84
106
|
return (
|
|
85
107
|
<ul className="sh-faces" aria-label="People here" data-testid="share-cluster-faces">
|
|
86
108
|
{faces.map((f) => {
|
|
87
109
|
const key = `${f.you ? 'you' : f.agent ? 'agent' : `peer-${f.clientID}`}:${f.name}`;
|
|
110
|
+
if (f.you && onYou) return <YouFace key={key} face={f} onYou={onYou} youOpen={youOpen} />;
|
|
88
111
|
if (isPeer(f) && onFollow) {
|
|
89
112
|
const label = f.following
|
|
90
113
|
? `Stop following ${firstName(f.name)}`
|
|
@@ -261,7 +284,7 @@ function PeopleList({ peers, presence, close, now, onPick }) {
|
|
|
261
284
|
);
|
|
262
285
|
}
|
|
263
286
|
|
|
264
|
-
export function PresenceFaces({ faces, onFollow, presence = null }) {
|
|
287
|
+
export function PresenceFaces({ faces, onFollow, presence = null, onYou = null, youOpen = false }) {
|
|
265
288
|
const [open, setOpen] = useState(null); // { kind: 'face', clientID } | { kind: 'list' } | null
|
|
266
289
|
const hostRef = useRef(null);
|
|
267
290
|
const openerRef = useRef(null);
|
|
@@ -273,7 +296,8 @@ export function PresenceFaces({ faces, onFollow, presence = null }) {
|
|
|
273
296
|
() => openerRef.current?.focus()
|
|
274
297
|
);
|
|
275
298
|
if (!faces?.length) return null;
|
|
276
|
-
if (!presence)
|
|
299
|
+
if (!presence)
|
|
300
|
+
return <LegacyFaces faces={faces} onFollow={onFollow} onYou={onYou} youOpen={youOpen} />;
|
|
277
301
|
|
|
278
302
|
const lead = faces.filter((f) => !isPeer(f));
|
|
279
303
|
const peers = faces.filter(isPeer);
|
|
@@ -284,17 +308,21 @@ export function PresenceFaces({ faces, onFollow, presence = null }) {
|
|
|
284
308
|
return (
|
|
285
309
|
<span className="sh-faces-host" ref={hostRef}>
|
|
286
310
|
<ul className="sh-faces" aria-label="People here" data-testid="share-cluster-faces">
|
|
287
|
-
{lead.map((f) =>
|
|
288
|
-
|
|
289
|
-
key={
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
311
|
+
{lead.map((f) =>
|
|
312
|
+
f.you && onYou ? (
|
|
313
|
+
<YouFace key={`you:${f.name}`} face={f} onYou={onYou} youOpen={youOpen} />
|
|
314
|
+
) : (
|
|
315
|
+
<li
|
|
316
|
+
key={f.you ? `you:${f.name}` : `agent:${f.name}`}
|
|
317
|
+
className={`sh-face${f.agent ? ' is-agent' : ''}${f.you ? ' is-you' : ''}`}
|
|
318
|
+
style={f.you ? toneStyle(f.name, true) : undefined}
|
|
319
|
+
title={f.name}
|
|
320
|
+
aria-label={f.name}
|
|
321
|
+
>
|
|
322
|
+
{f.agent ? <SparkGlyph size={12} /> : f.initials}
|
|
323
|
+
</li>
|
|
324
|
+
)
|
|
325
|
+
)}
|
|
298
326
|
{shown.map((f) => {
|
|
299
327
|
const idle = typeof f.idleSince === 'number' && f.idleSince > 0;
|
|
300
328
|
const label = `${f.name} — ${whereOf(f, { labelOf: presence.labelOf, roleOf: presence.roleOf, now })}`;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
// row in declared order, so the declared order IS the canvas order.
|
|
10
10
|
|
|
11
11
|
import { canvasOrder } from '../../../present/order.ts';
|
|
12
|
+
import { fetchIfServed } from '../shell/served-routes.js';
|
|
12
13
|
|
|
13
14
|
const finite = (n) => typeof n === 'number' && Number.isFinite(n);
|
|
14
15
|
const text = (v) => (typeof v === 'string' && v.trim() ? v : null);
|
|
@@ -74,7 +75,7 @@ export function indexRowFor(snapshot, path) {
|
|
|
74
75
|
export async function loadOrderNotesArtboards(path, fetchImpl = (...a) => fetch(...a)) {
|
|
75
76
|
const json = async (url) => {
|
|
76
77
|
try {
|
|
77
|
-
const r = await
|
|
78
|
+
const r = await fetchIfServed(url, { cache: 'no-store' }, fetchImpl);
|
|
78
79
|
return r.ok ? await r.json() : null;
|
|
79
80
|
} catch {
|
|
80
81
|
return null;
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
// "Recently opened" order read. The list is "known empty" only when the server ANSWERED with an `opened`
|
|
10
10
|
// object — an offline server or an old build is "don't know", and ⌘K then shows the short list as before.
|
|
11
11
|
|
|
12
|
+
import { fetchIfServed } from '../shell/served-routes.js';
|
|
13
|
+
|
|
12
14
|
/** Recent rows on screen. */
|
|
13
15
|
export const RECENT_CAP = 5;
|
|
14
16
|
|
|
@@ -31,7 +33,7 @@ export async function fetchRecents({ signal, fetchImpl = globalThis.fetch } = {}
|
|
|
31
33
|
const none = { known: false, opened: {} };
|
|
32
34
|
if (!fetchImpl) return none;
|
|
33
35
|
try {
|
|
34
|
-
const r = await
|
|
36
|
+
const r = await fetchIfServed('/_api/pins', { signal, cache: 'no-store' }, fetchImpl);
|
|
35
37
|
if (!r.ok) return none;
|
|
36
38
|
const raw = await r.json();
|
|
37
39
|
if (!raw || typeof raw.opened !== 'object' || raw.opened === null || Array.isArray(raw.opened))
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// the dash in "New artboard — A4" would be a word nothing contains.
|
|
6
6
|
|
|
7
7
|
import { sanitizeQuery } from './search-model.js';
|
|
8
|
+
import { fetchIfServed } from '../shell/served-routes.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @param fetchImpl (url, { signal }) => Promise<Response> — injected so tests need no network
|
|
@@ -14,10 +15,11 @@ export async function searchIndex(query, { signal, fetchImpl = globalThis.fetch
|
|
|
14
15
|
const q = sanitizeQuery(query);
|
|
15
16
|
if (!q || !fetchImpl) return null;
|
|
16
17
|
try {
|
|
17
|
-
const r = await
|
|
18
|
-
|
|
19
|
-
cache: 'no-store',
|
|
20
|
-
|
|
18
|
+
const r = await fetchIfServed(
|
|
19
|
+
`/_api/index?q=${encodeURIComponent(q)}`,
|
|
20
|
+
{ signal, cache: 'no-store' },
|
|
21
|
+
fetchImpl
|
|
22
|
+
);
|
|
21
23
|
if (!r.ok) return null;
|
|
22
24
|
const data = await r.json();
|
|
23
25
|
return Array.isArray(data?.rows) ? data : null;
|
|
@@ -60,7 +60,7 @@ export function hubRow({ linkedHub, cloudUrl, project, lastSyncAt, now = Date.no
|
|
|
60
60
|
return {
|
|
61
61
|
linked: false,
|
|
62
62
|
title: 'Your team’s own server',
|
|
63
|
-
status: 'Sign in
|
|
63
|
+
status: 'Sign in on the server’s own page.',
|
|
64
64
|
tone: '',
|
|
65
65
|
action: 'add',
|
|
66
66
|
};
|
|
@@ -29,7 +29,7 @@ function Face({ initial, tone, size = 'md' }) {
|
|
|
29
29
|
* @param onSwitch () => void — the shell's `account.switch`
|
|
30
30
|
* @param onSignOut () => Promise — the existing sign-out path
|
|
31
31
|
*/
|
|
32
|
-
export function AccountChip({ chip, card, onSwitch, onSignOut }) {
|
|
32
|
+
export function AccountChip({ chip, card, onSwitch, onSignOut, onOpen = null, opened = false }) {
|
|
33
33
|
const [open, setOpen] = useState(false);
|
|
34
34
|
const [asking, setAsking] = useState(false);
|
|
35
35
|
const [busy, setBusy] = useState(false);
|
|
@@ -74,14 +74,20 @@ export function AccountChip({ chip, card, onSwitch, onSignOut }) {
|
|
|
74
74
|
<button
|
|
75
75
|
ref={btn}
|
|
76
76
|
type="button"
|
|
77
|
-
className={`sh-acct-chip${open ? ' is-on' : ''}`}
|
|
77
|
+
className={`sh-acct-chip${open || opened ? ' is-on' : ''}`}
|
|
78
78
|
data-testid="share-cluster-account"
|
|
79
79
|
data-account={chip.id}
|
|
80
|
+
// 2.0.5 W4 — with `onOpen` the chip opens the project's account card (project-account-card.jsx)
|
|
81
|
+
data-account-opener={onOpen ? 'true' : undefined}
|
|
80
82
|
aria-haspopup="dialog"
|
|
81
|
-
aria-expanded={open ? 'true' : 'false'}
|
|
83
|
+
aria-expanded={open || opened ? 'true' : 'false'}
|
|
82
84
|
aria-label={`Account: ${chip.title}`}
|
|
83
85
|
title={chip.title}
|
|
84
|
-
onClick={() =>
|
|
86
|
+
onClick={() => {
|
|
87
|
+
if (onOpen) onOpen();
|
|
88
|
+
else if (open) close(false);
|
|
89
|
+
else setOpen(true);
|
|
90
|
+
}}
|
|
85
91
|
>
|
|
86
92
|
<Face initial={chip.initial} tone={chip.tone} />
|
|
87
93
|
<span className="sh-acct-name">{chip.label}</span>
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// client/v2/shell/canvas-crash-guard.js — 2.0.5: a canvas that crashes the page is not reopened in a loop.
|
|
2
|
+
//
|
|
3
|
+
// When a heavy canvas makes WebKit kill the page's WebContent process, the desktop shell reloads the tab
|
|
4
|
+
// (apps/desktop/src-tauri/src/web_process.rs) and the shell reopened the same canvas — which crashed it
|
|
5
|
+
// again, over and over. No JavaScript runs at the crash, so the guard works backwards: while a canvas is
|
|
6
|
+
// open the shell keeps a "live" mark in localStorage and clears it on a clean `pagehide`. A page that boots
|
|
7
|
+
// and finds the mark still there died with that canvas open. `CRASH_LIMIT` such deaths of the same canvas
|
|
8
|
+
// within `CRASH_WINDOW_MS` and the viewport stops opening it: the tab shows "This canvas is too heavy to
|
|
9
|
+
// show all at once" with the lighter way in (only the artboards near the viewport mounted,
|
|
10
|
+
// `?artboard-live=light`). Pure over a Storage-like object so it is testable without a browser.
|
|
11
|
+
|
|
12
|
+
export const CRASH_LIMIT = 2;
|
|
13
|
+
export const CRASH_WINDOW_MS = 10 * 60 * 1000;
|
|
14
|
+
/** A chosen lighter mode is kept this long for that canvas (it survives the next crash reload). */
|
|
15
|
+
export const LIGHT_KEEP_MS = 24 * 60 * 60 * 1000;
|
|
16
|
+
export const CRASH_KEY = 'maude.canvas-crash.v1';
|
|
17
|
+
|
|
18
|
+
function empty() {
|
|
19
|
+
return { live: null, crashes: {}, light: {} };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function read(storage) {
|
|
23
|
+
try {
|
|
24
|
+
const raw = storage?.getItem(CRASH_KEY);
|
|
25
|
+
if (!raw) return empty();
|
|
26
|
+
const s = JSON.parse(raw);
|
|
27
|
+
if (!s || typeof s !== 'object') return empty();
|
|
28
|
+
return {
|
|
29
|
+
live: typeof s.live === 'string' ? s.live : null,
|
|
30
|
+
crashes: s.crashes && typeof s.crashes === 'object' ? s.crashes : {},
|
|
31
|
+
light: s.light && typeof s.light === 'object' ? s.light : {},
|
|
32
|
+
};
|
|
33
|
+
} catch {
|
|
34
|
+
return empty();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {{ getItem(k: string): string | null, setItem(k: string, v: string): void } | null} storage
|
|
40
|
+
* @param {() => number} [now]
|
|
41
|
+
*/
|
|
42
|
+
export function createCrashGuard(storage, now = Date.now) {
|
|
43
|
+
const s = read(storage);
|
|
44
|
+
const save = () => {
|
|
45
|
+
try {
|
|
46
|
+
storage?.setItem(CRASH_KEY, JSON.stringify(s));
|
|
47
|
+
} catch {
|
|
48
|
+
/* private mode / quota — the guard just forgets */
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const prune = () => {
|
|
52
|
+
const t = now();
|
|
53
|
+
for (const [p, list] of Object.entries(s.crashes)) {
|
|
54
|
+
const kept = Array.isArray(list)
|
|
55
|
+
? list.filter((x) => typeof x === 'number' && t - x < CRASH_WINDOW_MS)
|
|
56
|
+
: [];
|
|
57
|
+
if (kept.length) s.crashes[p] = kept;
|
|
58
|
+
else delete s.crashes[p];
|
|
59
|
+
}
|
|
60
|
+
for (const [p, at] of Object.entries(s.light)) {
|
|
61
|
+
if (typeof at !== 'number' || t - at >= LIGHT_KEEP_MS) delete s.light[p];
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
// Boot: a mark left behind is a page that died with that canvas open.
|
|
65
|
+
if (s.live) {
|
|
66
|
+
const list = s.crashes[s.live] || [];
|
|
67
|
+
list.push(now());
|
|
68
|
+
s.crashes[s.live] = list;
|
|
69
|
+
s.live = null;
|
|
70
|
+
}
|
|
71
|
+
prune();
|
|
72
|
+
save();
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
/** The open canvas (null when none is framed). Called whenever the active frame changes. */
|
|
76
|
+
noteOpen(path) {
|
|
77
|
+
const next = typeof path === 'string' && path ? path : null;
|
|
78
|
+
if (s.live === next) return;
|
|
79
|
+
s.live = next;
|
|
80
|
+
save();
|
|
81
|
+
},
|
|
82
|
+
/** A clean unload (`pagehide`): whatever was open did not crash the page. */
|
|
83
|
+
noteClean() {
|
|
84
|
+
if (s.live === null) return;
|
|
85
|
+
s.live = null;
|
|
86
|
+
save();
|
|
87
|
+
},
|
|
88
|
+
crashCount(path) {
|
|
89
|
+
prune();
|
|
90
|
+
return (s.crashes[path] || []).length;
|
|
91
|
+
},
|
|
92
|
+
/** Too heavy: it crashed the page `CRASH_LIMIT` times recently and no lighter mode was chosen. */
|
|
93
|
+
tooHeavy(path) {
|
|
94
|
+
if (!path) return false;
|
|
95
|
+
prune();
|
|
96
|
+
return (s.crashes[path] || []).length >= CRASH_LIMIT && !(path in s.light);
|
|
97
|
+
},
|
|
98
|
+
isLight(path) {
|
|
99
|
+
prune();
|
|
100
|
+
return !!path && path in s.light;
|
|
101
|
+
},
|
|
102
|
+
/** "Show visible artboards only". */
|
|
103
|
+
chooseLight(path) {
|
|
104
|
+
s.light[path] = now();
|
|
105
|
+
save();
|
|
106
|
+
},
|
|
107
|
+
/** "Show everything": forget the crashes and the lighter mode for this canvas. */
|
|
108
|
+
forgive(path) {
|
|
109
|
+
delete s.crashes[path];
|
|
110
|
+
delete s.light[path];
|
|
111
|
+
save();
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
let shared = null;
|
|
117
|
+
const subs = new Set();
|
|
118
|
+
|
|
119
|
+
/** The page's one guard, on localStorage, cleared on a clean pagehide. */
|
|
120
|
+
export function crashGuard() {
|
|
121
|
+
if (shared) return shared;
|
|
122
|
+
const storage = typeof localStorage === 'undefined' ? null : localStorage;
|
|
123
|
+
const g = createCrashGuard(storage);
|
|
124
|
+
const wrap = (fn) => (path) => {
|
|
125
|
+
fn(path);
|
|
126
|
+
for (const cb of subs) cb();
|
|
127
|
+
};
|
|
128
|
+
shared = { ...g, chooseLight: wrap(g.chooseLight), forgive: wrap(g.forgive) };
|
|
129
|
+
if (typeof window !== 'undefined') window.addEventListener('pagehide', () => g.noteClean());
|
|
130
|
+
return shared;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Re-render on a choice made on the card. */
|
|
134
|
+
export function subscribeCrashGuard(cb) {
|
|
135
|
+
subs.add(cb);
|
|
136
|
+
return () => subs.delete(cb);
|
|
137
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// client/v2/shell/github-signin-host.jsx — 2.0.5 W4: where `account.github-signin` runs.
|
|
2
|
+
//
|
|
3
|
+
// The one GitHub sign-in of a project tab: the shell's device flow (`github_sign_in`, oauth.rs — the
|
|
4
|
+
// calling project's profile, bind-on-sign-in for another account on a shared one), through the SAME hook
|
|
5
|
+
// Settings › Connections uses (useGitHubConnection), and the same code sheet (GitHubDeviceDialog). The
|
|
6
|
+
// menu runner hands the action here over MENU_ACTION_EVENT, the way IdentityBar hears project.new, so the
|
|
7
|
+
// avatar's card, ⌘K, the Versions sheet's "Sign in with GitHub to publish" lines and New project… all
|
|
8
|
+
// start this one flow. Mounted by share-cluster-host.jsx, which every project tab draws.
|
|
9
|
+
|
|
10
|
+
import { useEffect, useRef } from 'react';
|
|
11
|
+
import { GitHubDeviceDialog } from '../../panels/IdentityBar.jsx';
|
|
12
|
+
import { shellToast } from '../../shell/util.js';
|
|
13
|
+
import { useGitHubConnection } from '../settings/use-connections.js';
|
|
14
|
+
import { MENU_ACTION_EVENT } from './menu-runner.js';
|
|
15
|
+
|
|
16
|
+
export function useGitHubSignInHost() {
|
|
17
|
+
const gh = useGitHubConnection();
|
|
18
|
+
const ref = useRef(gh);
|
|
19
|
+
ref.current = gh;
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const on = (e) => {
|
|
22
|
+
if (e.detail?.id !== 'account.github-signin') return;
|
|
23
|
+
const g = ref.current;
|
|
24
|
+
if (!g.native || g.signing) return;
|
|
25
|
+
g.signIn();
|
|
26
|
+
};
|
|
27
|
+
window.addEventListener(MENU_ACTION_EVENT, on);
|
|
28
|
+
return () => window.removeEventListener(MENU_ACTION_EVENT, on);
|
|
29
|
+
}, []);
|
|
30
|
+
// A failed flow says so once (the hook keeps the sentence for Settings' row too).
|
|
31
|
+
const lastErr = useRef('');
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (gh.error && gh.error !== lastErr.current) shellToast(gh.error);
|
|
34
|
+
lastErr.current = gh.error;
|
|
35
|
+
}, [gh.error]);
|
|
36
|
+
return gh;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The device-code sheet while a sign-in started here waits for the browser. */
|
|
40
|
+
export function GitHubSignInSheet({ gh }) {
|
|
41
|
+
return gh?.device ? <GitHubDeviceDialog device={gh.device} onClose={gh.closeDevice} /> : null;
|
|
42
|
+
}
|
|
@@ -274,6 +274,17 @@ export function createMenuHandlers(d) {
|
|
|
274
274
|
'handoff.open': () => d.setExportDialog({ mode: 'handoff' }),
|
|
275
275
|
'canvas.close': () => d.onCloseCanvas(),
|
|
276
276
|
'account.switch': () => d.onSwitchAccount(),
|
|
277
|
+
// 2.0.5 W4 — the GitHub device flow is the mounted host's (github-signin-host.jsx: its code sheet
|
|
278
|
+
// and state); it hears this the way IdentityBar hears project.new. A browser tab has no keychain.
|
|
279
|
+
'account.github-signin': () => {
|
|
280
|
+
if (!d.native) {
|
|
281
|
+
d.toast('Signing in with GitHub needs the Maude desktop app.');
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
window.dispatchEvent(
|
|
285
|
+
new CustomEvent(MENU_ACTION_EVENT, { detail: { id: 'account.github-signin' } })
|
|
286
|
+
);
|
|
287
|
+
},
|
|
277
288
|
// ── Edit ── (select / properties ride the canvas lane; artboards the shell's)
|
|
278
289
|
// S2.20 — Undo / Redo run the ⌘Z projection over the op log (since p8-v1-drop the canvas keeps no
|
|
279
290
|
// stack to fall back to). Undo history… opens the popover.
|
|
@@ -310,6 +321,7 @@ export function createMenuHandlers(d) {
|
|
|
310
321
|
// S8.12 — the picked tile's Place / Show details (the key and the tile menu run the same two functions)
|
|
311
322
|
'assets.place': () => runAssetsAction('assets.place'),
|
|
312
323
|
'assets.details': () => runAssetsAction('assets.details'),
|
|
324
|
+
'assets.spotlight': () => runAssetsAction('assets.spotlight'),
|
|
313
325
|
'assets.trash': () => runAssetsAction('assets.trash'),
|
|
314
326
|
'assets.rename': () => runAssetsAction('assets.rename'),
|
|
315
327
|
// S8.16 — Assets › Generate: the ask lives in the Assets tab, so the tab is shown first
|