@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,7 +1,7 @@
|
|
|
1
1
|
// client/v2/ds/off-system-host.jsx — S10.17: the shell's side of the off-system question (13 · ds-edge-suggest).
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
// hand-picked colours on the lines changed since the last commit (`GET /_api/ds/off-system`, the S1 rule of S10 Q12)
|
|
3
|
+
// When a canvas that follows a design system opens, has drawn again, or the system was written (ds-refresh.js,
|
|
4
|
+
// 2.0.5 — never on a clock), it asks the server for the hand-picked colours on the lines changed since the last commit (`GET /_api/ds/off-system`, the S1 rule of S10 Q12)
|
|
5
5
|
// and draws the first one the person has not put away as ONE quiet question. "Use <closest>" is an edit on the element
|
|
6
6
|
// that carries the colour (`ds.use-nearest`, one ⌘Z); "Add it to the system" is a waiting new colour (`ds.add-colour`);
|
|
7
7
|
// "Not now" puts the question away until the canvas is opened again. Mounted once, inside the DS review host.
|
|
@@ -12,10 +12,10 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
12
12
|
import { canvasDsSystem } from '../../canvas-url.js';
|
|
13
13
|
import { EDGE_WORDS, findingKey, nextFinding } from './edge-model.js';
|
|
14
14
|
import { addColourNow, fetchOffSystem, applyNearestNow } from './edge-write.js';
|
|
15
|
+
import { dsRefresh } from './ds-refresh.js';
|
|
15
16
|
import { OffSystemQuestion } from './off-system.jsx';
|
|
16
17
|
import { openCanvasRel } from './switch-host.jsx';
|
|
17
18
|
|
|
18
|
-
export const OFF_SYSTEM_POLL_MS = 8000;
|
|
19
19
|
/** the first look comes a moment after the canvas opens: the question is a courtesy, never in the way */
|
|
20
20
|
export const OFF_SYSTEM_FIRST_MS = 2500;
|
|
21
21
|
|
|
@@ -30,7 +30,7 @@ export function DsOffSystemHost({
|
|
|
30
30
|
activePath,
|
|
31
31
|
toast,
|
|
32
32
|
fetchImpl,
|
|
33
|
-
|
|
33
|
+
frameFor,
|
|
34
34
|
firstMs = OFF_SYSTEM_FIRST_MS,
|
|
35
35
|
}) {
|
|
36
36
|
const rel = openCanvasRel(activePath, cfg);
|
|
@@ -40,36 +40,38 @@ export function DsOffSystemHost({
|
|
|
40
40
|
const [answer, setAnswer] = useState(null);
|
|
41
41
|
const [, bump] = useState(0);
|
|
42
42
|
const dismissed = useRef(new Set());
|
|
43
|
-
const live = useRef({ toast, fetchImpl });
|
|
44
|
-
live.current = { toast, fetchImpl };
|
|
43
|
+
const live = useRef({ toast, fetchImpl, frameFor });
|
|
44
|
+
live.current = { toast, fetchImpl, frameFor };
|
|
45
45
|
const f = () => live.current.fetchImpl ?? globalThis.fetch;
|
|
46
46
|
const refreshRef = useRef(null);
|
|
47
47
|
|
|
48
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: the canvas and the
|
|
48
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: the canvas and the first delay are the triggers
|
|
49
49
|
useEffect(() => {
|
|
50
50
|
dismissed.current = new Set();
|
|
51
51
|
setAnswer(null);
|
|
52
52
|
if (!canvas) return undefined;
|
|
53
53
|
let dead = false;
|
|
54
54
|
let seq = 0;
|
|
55
|
-
const
|
|
56
|
-
if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return;
|
|
55
|
+
const read = async (fetchImpl) => {
|
|
57
56
|
const n = ++seq;
|
|
58
|
-
const got = await fetchOffSystem({ canvas },
|
|
57
|
+
const got = await fetchOffSystem({ canvas }, fetchImpl);
|
|
59
58
|
if (dead || n !== seq) return;
|
|
60
59
|
// a refusal or an unreachable studio says nothing: the question is a courtesy, never an error
|
|
61
60
|
setAnswer(got.ok ? got.answer : null);
|
|
62
61
|
};
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
62
|
+
// 2.0.5: a moment after the canvas opens, then on a redraw, a write or a return to the window
|
|
63
|
+
const reads = dsRefresh(read, {
|
|
64
|
+
fetchImpl: f,
|
|
65
|
+
firstMs,
|
|
66
|
+
frameFor: () => live.current.frameFor?.() ?? null,
|
|
67
|
+
});
|
|
68
|
+
refreshRef.current = reads.now;
|
|
66
69
|
return () => {
|
|
67
70
|
dead = true;
|
|
68
|
-
|
|
69
|
-
clearInterval(t);
|
|
71
|
+
reads.stop();
|
|
70
72
|
refreshRef.current = null;
|
|
71
73
|
};
|
|
72
|
-
}, [canvas,
|
|
74
|
+
}, [canvas, firstMs]);
|
|
73
75
|
|
|
74
76
|
const finding = nextFinding(answer?.findings, dismissed.current);
|
|
75
77
|
const putAway = useCallback((fd) => {
|
|
@@ -342,7 +342,13 @@ export function DsReviewHost({
|
|
|
342
342
|
<DsSwitchHost cfg={cfg} activePath={activePath} toast={toast} fetchImpl={fetchImpl} />
|
|
343
343
|
{/* S10.15b — "Bring <system> up to the schema?": the amber dot, the row's menu and the switch's level-11 refusal */}
|
|
344
344
|
<DsUpgradeHost cfg={cfg} toast={toast} fetchImpl={fetchImpl} />
|
|
345
|
-
<DsOffSystemHost
|
|
345
|
+
<DsOffSystemHost
|
|
346
|
+
cfg={cfg}
|
|
347
|
+
activePath={activePath}
|
|
348
|
+
toast={toast}
|
|
349
|
+
frameFor={frameFor}
|
|
350
|
+
fetchImpl={fetchImpl}
|
|
351
|
+
/>
|
|
346
352
|
{/* S10.16b — "Make a design system": the three-input sheet, the filling sections, the ready card */}
|
|
347
353
|
<DsMakeHost
|
|
348
354
|
cfg={cfg}
|
|
@@ -12,17 +12,20 @@
|
|
|
12
12
|
//
|
|
13
13
|
// Every write is the server's to refuse (Can edit on the whole project, rule 12): a refusal comes back as a code
|
|
14
14
|
// and becomes the person's words. The system comes from the canvas the person has open, never from a message.
|
|
15
|
-
// The studio does not push `ds:outside` to the page yet, so
|
|
16
|
-
//
|
|
15
|
+
// The studio does not push `ds:outside` to the page yet, so this is the ONE design-system read on a clock
|
|
16
|
+
// (ds-refresh.js, 2.0.5): once a minute while the window is looked at and the canvas has drawn, plus on a write,
|
|
17
|
+
// a redraw and a return to the window. A file edited outside Maude has no other event.
|
|
17
18
|
|
|
18
19
|
import { useEffect, useRef } from 'react';
|
|
19
20
|
import { contrastLine } from './contrast.js';
|
|
20
21
|
import { fetchBoard } from './token-write.js';
|
|
22
|
+
import { DS_STATE_CHANGED } from './door-write.js';
|
|
23
|
+
import { DS_SLOW_POLL_MS, dsRefresh } from './ds-refresh.js';
|
|
21
24
|
import { getTruth, setTruth, setTruthActions } from './truth-store.js';
|
|
22
25
|
import { headValueName, ownSystemOf, refusalWords, TRUTH_WORDS, truthOf } from './truth-model.js';
|
|
23
26
|
import { bodyOf } from './update-available.jsx';
|
|
24
27
|
|
|
25
|
-
export const TRUTH_POLL_MS =
|
|
28
|
+
export const TRUTH_POLL_MS = DS_SLOW_POLL_MS;
|
|
26
29
|
const JSON_HEADERS = { 'content-type': 'application/json' };
|
|
27
30
|
|
|
28
31
|
async function call(fetchImpl, method, url, body) {
|
|
@@ -150,6 +153,7 @@ export function DsTruthHost({
|
|
|
150
153
|
}
|
|
151
154
|
let dead = false;
|
|
152
155
|
let seq = 0;
|
|
156
|
+
let refresh = async () => {};
|
|
153
157
|
|
|
154
158
|
const tell = (marks) => {
|
|
155
159
|
const frame = live.current.frameFor?.() ?? null;
|
|
@@ -158,10 +162,9 @@ export function DsTruthHost({
|
|
|
158
162
|
postDsMarks(frame, marks, origin);
|
|
159
163
|
};
|
|
160
164
|
|
|
161
|
-
const
|
|
162
|
-
if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return;
|
|
165
|
+
const read = async (fetchImpl) => {
|
|
163
166
|
const n = ++seq;
|
|
164
|
-
const got = await loadTruth(ds,
|
|
167
|
+
const got = await loadTruth(ds, fetchImpl);
|
|
165
168
|
if (dead || n !== seq) return;
|
|
166
169
|
setTruth(got ? { ...got, busy: false, note: null } : null);
|
|
167
170
|
tell(got ? got.truth.marks : { outside: [], conflicts: [] });
|
|
@@ -174,6 +177,8 @@ export function DsTruthHost({
|
|
|
174
177
|
if (dead) return;
|
|
175
178
|
if (r.ok) {
|
|
176
179
|
say(done());
|
|
180
|
+
// the other hosts (the system's files, the make state) read again too
|
|
181
|
+
window.dispatchEvent(new Event(DS_STATE_CHANGED));
|
|
177
182
|
await refresh();
|
|
178
183
|
} else {
|
|
179
184
|
setTruth((t) => (t ? { ...t, busy: false, note: r.message } : t));
|
|
@@ -211,12 +216,9 @@ export function DsTruthHost({
|
|
|
211
216
|
),
|
|
212
217
|
});
|
|
213
218
|
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
if (document.visibilityState === 'visible') refresh();
|
|
218
|
-
};
|
|
219
|
-
document.addEventListener('visibilitychange', onVisible);
|
|
219
|
+
// 2.0.5: once, then on a write, a redraw or a return to the window; one slow clock for outside edits
|
|
220
|
+
const reads = dsRefresh(read, { fetchImpl: f, slowMs: pollMs });
|
|
221
|
+
refresh = reads.now;
|
|
220
222
|
// a canvas that reloaded forgot its marks: when it says it has loaded, tell it again
|
|
221
223
|
const onLoaded = (e) => {
|
|
222
224
|
const frame = live.current.frameFor?.() ?? null;
|
|
@@ -227,8 +229,7 @@ export function DsTruthHost({
|
|
|
227
229
|
window.addEventListener('message', onLoaded);
|
|
228
230
|
return () => {
|
|
229
231
|
dead = true;
|
|
230
|
-
|
|
231
|
-
document.removeEventListener('visibilitychange', onVisible);
|
|
232
|
+
reads.stop();
|
|
232
233
|
window.removeEventListener('message', onLoaded);
|
|
233
234
|
setTruthActions(null);
|
|
234
235
|
setTruth(null);
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
14
14
|
import { getPaletteEnv } from '../search/search-env.js';
|
|
15
15
|
import { canvasesIn } from './switch-host.jsx';
|
|
16
|
+
import { dsRefresh } from './ds-refresh.js';
|
|
16
17
|
import { onDsUpgradeRequest } from './upgrade-bus.js';
|
|
17
18
|
import {
|
|
18
19
|
appliedWords,
|
|
@@ -24,8 +25,15 @@ import {
|
|
|
24
25
|
import { DsUpgradeSheet } from './upgrade-sheet.jsx';
|
|
25
26
|
|
|
26
27
|
const JSON_HEADERS = { 'content-type': 'application/json' };
|
|
27
|
-
/**
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* 2.0.5 (#205): the sheet asks again when something it shows may have moved — the window is looked at, the shell
|
|
30
|
+
* wrote a system, the AI run registry moved (`maude:ai-runs`), an action landed (`maude:project-action`) — and
|
|
31
|
+
* after a failed read (5 s doubling to 5 min). The ONE clock left is `TICK_MS`, only while the AI or the check is
|
|
32
|
+
* working with the sheet open: a proof's progress ("2 of 6 canvases checked") has no push. A settled sheet reads
|
|
33
|
+
* on events only.
|
|
34
|
+
*/
|
|
35
|
+
export const TICK_MS = 5000;
|
|
36
|
+
export const UPGRADE_EVENTS = ['maude:ai-runs', 'maude:project-action'];
|
|
29
37
|
/** A request the AI was sent off with is remembered this long, so closing and reopening does not ask twice. */
|
|
30
38
|
const ASKED_MS = 30 * 60 * 1000;
|
|
31
39
|
const askedAt = new Map();
|
|
@@ -80,9 +88,9 @@ export async function cancelUpgrade(ds, stage, fetchImpl = globalThis.fetch) {
|
|
|
80
88
|
}
|
|
81
89
|
|
|
82
90
|
/**
|
|
83
|
-
* @param {{ cfg: any, toast?: (m: string) => void, fetchImpl?: typeof fetch,
|
|
91
|
+
* @param {{ cfg: any, toast?: (m: string) => void, fetchImpl?: typeof fetch, tickMs?: number }} props
|
|
84
92
|
*/
|
|
85
|
-
export function DsUpgradeHost({ cfg, toast, fetchImpl,
|
|
93
|
+
export function DsUpgradeHost({ cfg, toast, fetchImpl, tickMs = TICK_MS }) {
|
|
86
94
|
const [sheet, setSheet] = useState(null);
|
|
87
95
|
const live = useRef({ cfg, toast, fetchImpl, sheet: null });
|
|
88
96
|
live.current = { cfg, toast, fetchImpl, sheet };
|
|
@@ -111,10 +119,10 @@ export function DsUpgradeHost({ cfg, toast, fetchImpl, pollMs = POLL_MS }) {
|
|
|
111
119
|
);
|
|
112
120
|
|
|
113
121
|
// biome-ignore lint/correctness/useExhaustiveDependencies: `f` reads the live ref
|
|
114
|
-
const refresh = useCallback(async () => {
|
|
122
|
+
const refresh = useCallback(async (fx) => {
|
|
115
123
|
const s = live.current.sheet;
|
|
116
124
|
if (!s) return;
|
|
117
|
-
const r = await loadUpgradeStatus(s.ds, s.label, f());
|
|
125
|
+
const r = await loadUpgradeStatus(s.ds, s.label, typeof fx === 'function' ? fx : f());
|
|
118
126
|
// the sheet may have been closed (or reopened on another system) while the answer was on its way
|
|
119
127
|
if (r.ok && live.current.sheet?.ds === s.ds)
|
|
120
128
|
setSheet((cur) => (cur && cur.ds === s.ds ? { ...cur, status: r.status } : cur));
|
|
@@ -133,13 +141,21 @@ export function DsUpgradeHost({ cfg, toast, fetchImpl, pollMs = POLL_MS }) {
|
|
|
133
141
|
})
|
|
134
142
|
: null;
|
|
135
143
|
|
|
136
|
-
// while the AI or the check works
|
|
144
|
+
// while the AI or the check works the sheet follows events, with one slow tick for the proof's progress; a
|
|
145
|
+
// settled sheet (ask, review, converted) hears nothing between events
|
|
137
146
|
const busyView = view?.kind === 'working' || view?.kind === 'proving';
|
|
147
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: `f` reads the live ref
|
|
138
148
|
useEffect(() => {
|
|
139
149
|
if (!busyView) return undefined;
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
150
|
+
const r = dsRefresh((fx) => refresh(fx), {
|
|
151
|
+
fetchImpl: () => live.current.fetchImpl ?? globalThis.fetch,
|
|
152
|
+
events: UPGRADE_EVENTS,
|
|
153
|
+
slowMs: tickMs,
|
|
154
|
+
skipFirst: true,
|
|
155
|
+
paused: () => false,
|
|
156
|
+
});
|
|
157
|
+
return () => r.stop();
|
|
158
|
+
}, [busyView, refresh, tickMs]);
|
|
143
159
|
|
|
144
160
|
const close = useCallback(() => setSheet(null), []);
|
|
145
161
|
|
|
@@ -118,8 +118,22 @@ async function readAvailability(fetchImpl) {
|
|
|
118
118
|
* Mount once in the Canvases panel. `groups` is the panel's index (its change re-asks, throttled).
|
|
119
119
|
* @param {{ groups: object[], designRel: string, fetchImpl?: typeof fetch }} o
|
|
120
120
|
*/
|
|
121
|
+
// #204 R — the cadence is the PAGE's, not a mount's. It lived in the hook's useRef, so a panel that mounted
|
|
122
|
+
// again started with no "last asked" and asked at once: a remounting panel asked once per mount, however
|
|
123
|
+
// fast (the report: ~100 in a few seconds against a cell). The last answer, the request in flight and when
|
|
124
|
+
// it was asked are kept here; a mount draws the last answer at once and asks only when the gap allows.
|
|
125
|
+
const poll = { model: null, carried: new Map(), inFlight: false, last: 0 };
|
|
126
|
+
|
|
127
|
+
/** Tests only: forget the page's last answer and when it was asked. */
|
|
128
|
+
export function resetArrivingPoll() {
|
|
129
|
+
poll.model = null;
|
|
130
|
+
poll.carried = new Map();
|
|
131
|
+
poll.inFlight = false;
|
|
132
|
+
poll.last = 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
121
135
|
export function useArrivingRows({ groups, designRel, fetchImpl }) {
|
|
122
|
-
const state = useRef({
|
|
136
|
+
const state = useRef({ timer: null });
|
|
123
137
|
const indexed = useRef(new Set());
|
|
124
138
|
indexed.current = indexedPaths(groups, designRel);
|
|
125
139
|
|
|
@@ -127,12 +141,12 @@ export function useArrivingRows({ groups, designRel, fetchImpl }) {
|
|
|
127
141
|
const s = state.current;
|
|
128
142
|
let alive = true;
|
|
129
143
|
const publish = () => {
|
|
130
|
-
const out = arrivingSlots(
|
|
144
|
+
const out = arrivingSlots(poll.model, {
|
|
131
145
|
indexed: indexed.current,
|
|
132
|
-
carried:
|
|
146
|
+
carried: poll.carried,
|
|
133
147
|
localOnly,
|
|
134
148
|
});
|
|
135
|
-
|
|
149
|
+
poll.carried = out.carried;
|
|
136
150
|
setGhostRows('sync', out.ghosts);
|
|
137
151
|
setFootSlot('arriving', out.foot);
|
|
138
152
|
};
|
|
@@ -141,23 +155,26 @@ export function useArrivingRows({ groups, designRel, fetchImpl }) {
|
|
|
141
155
|
s.timer = setTimeout(ask, Math.max(ms, MIN_GAP_MS));
|
|
142
156
|
};
|
|
143
157
|
async function ask() {
|
|
144
|
-
if (!alive
|
|
145
|
-
|
|
158
|
+
if (!alive) return;
|
|
159
|
+
// another mount's read is out: its answer lands in `poll`; look again after the gap
|
|
160
|
+
if (poll.inFlight) return schedule(MIN_GAP_MS);
|
|
161
|
+
const since = Date.now() - poll.last;
|
|
146
162
|
if (since < MIN_GAP_MS) return schedule(MIN_GAP_MS - since);
|
|
147
|
-
|
|
148
|
-
|
|
163
|
+
poll.inFlight = true;
|
|
164
|
+
poll.last = Date.now();
|
|
149
165
|
const model = await readAvailability(fetchImpl);
|
|
150
|
-
|
|
151
|
-
if (!alive) return;
|
|
166
|
+
poll.inFlight = false;
|
|
152
167
|
// A failed read keeps the last answer (never "nothing is coming" because one request failed).
|
|
153
|
-
if (model)
|
|
168
|
+
if (model) poll.model = model;
|
|
169
|
+
if (!alive) return;
|
|
154
170
|
publish();
|
|
155
|
-
schedule(NEXT_MS[
|
|
171
|
+
schedule(NEXT_MS[poll.model?.phase] ?? NEXT_MS.complete);
|
|
156
172
|
}
|
|
157
173
|
s.ask = ask;
|
|
158
174
|
s.publish = publish;
|
|
159
175
|
const onLocalOnly = () => publish();
|
|
160
176
|
localOnlyListeners.add(onLocalOnly);
|
|
177
|
+
if (poll.model) publish();
|
|
161
178
|
void ask();
|
|
162
179
|
return () => {
|
|
163
180
|
alive = false;
|
|
@@ -41,7 +41,7 @@ const modeNow = () => shellMode.get().mode;
|
|
|
41
41
|
|
|
42
42
|
export function EmptyHost() {
|
|
43
43
|
const {
|
|
44
|
-
shellCore: { activePath, cfg, iframesRef, syncStatus, viewerMode },
|
|
44
|
+
shellCore: { activePath, cfg, iframesRef, loadingPath, syncStatus, viewerMode },
|
|
45
45
|
} = useShellStore();
|
|
46
46
|
const canvasOpen = !!activePath && activePath !== SYSTEM_TAB;
|
|
47
47
|
const mode = useSyncExternalStore(shellMode.subscribe, modeNow, modeNow);
|
|
@@ -59,8 +59,14 @@ export function EmptyHost() {
|
|
|
59
59
|
canvasOrigin: cfg?.canvasOrigin,
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
+
// #204 — the shell's own "this canvas is still loading" (cleared on `canvas-rendered`): no invitation
|
|
63
|
+
// over a canvas that has not finished drawing, and a load starts with no count from before.
|
|
64
|
+
const canvasLoading = !!loadingPath && loadingPath === activePath;
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (loadingPath) lane.loadStarted(loadingPath);
|
|
67
|
+
}, [lane, loadingPath]);
|
|
62
68
|
const model = canvasOpen
|
|
63
|
-
? emptyCanvasModel({ count, mode, canEdit, online, claude, canAsk })
|
|
69
|
+
? emptyCanvasModel({ count, mode, canEdit, online, claude, canAsk, loading: canvasLoading })
|
|
64
70
|
: null;
|
|
65
71
|
// rc3-h (#182): a run of yours on this empty canvas — the ghost where the first artboard lands, not the invitation
|
|
66
72
|
const { view: runsView } = useAiRuns();
|
|
@@ -65,6 +65,36 @@ const askAvailability = (path, fetchImpl) =>
|
|
|
65
65
|
.then((r) => (r.ok ? r.json() : null))
|
|
66
66
|
.then((body) => body?.canvas?.state ?? 'unknown');
|
|
67
67
|
|
|
68
|
+
// #204 R — one ask per canvas per OPEN, not per render: a tab that flips between canvases (or a viewport
|
|
69
|
+
// that mounts again) asked on every flip. An open shares the ask in flight for its path and reuses an
|
|
70
|
+
// answer younger than OPEN_REUSE_MS. Keyed by the fetch it went through (tests inject their own).
|
|
71
|
+
export const OPEN_REUSE_MS = 1000;
|
|
72
|
+
const DEFAULT_FETCH = {};
|
|
73
|
+
let asks = new WeakMap();
|
|
74
|
+
|
|
75
|
+
function askOnOpen(path, fetchImpl) {
|
|
76
|
+
const key = fetchImpl || DEFAULT_FETCH;
|
|
77
|
+
let byPath = asks.get(key);
|
|
78
|
+
if (!byPath) {
|
|
79
|
+
byPath = new Map();
|
|
80
|
+
asks.set(key, byPath);
|
|
81
|
+
}
|
|
82
|
+
const hit = byPath.get(path);
|
|
83
|
+
if (hit && (hit.pending || Date.now() - hit.at < OPEN_REUSE_MS)) return hit.answer;
|
|
84
|
+
const entry = { at: Date.now(), pending: true, answer: null };
|
|
85
|
+
entry.answer = askAvailability(path, fetchImpl).finally(() => {
|
|
86
|
+
entry.pending = false;
|
|
87
|
+
entry.at = Date.now();
|
|
88
|
+
});
|
|
89
|
+
byPath.set(path, entry);
|
|
90
|
+
return entry.answer;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Tests only: forget every recent ask. */
|
|
94
|
+
export function resetAvailabilityAsks() {
|
|
95
|
+
asks = new WeakMap();
|
|
96
|
+
}
|
|
97
|
+
|
|
68
98
|
/**
|
|
69
99
|
* One canvas's availability, asked once per path (and again when `stamp` changes — the tab's reload key).
|
|
70
100
|
* A canvas that is `arriving` is asked again every `recheckMs` until it is here (no flicker: the answer
|
|
@@ -82,7 +112,7 @@ export function useCanvasAvailability(
|
|
|
82
112
|
if (!path) return;
|
|
83
113
|
let alive = true;
|
|
84
114
|
setState(null);
|
|
85
|
-
|
|
115
|
+
askOnOpen(path, fetchImpl)
|
|
86
116
|
.then((s) => alive && setState(s))
|
|
87
117
|
.catch(() => alive && setState('unknown'));
|
|
88
118
|
return () => {
|
|
@@ -41,12 +41,15 @@ export function hubAway(syncStatus) {
|
|
|
41
41
|
* Which empty-canvas situation applies — or null (nothing to show).
|
|
42
42
|
*
|
|
43
43
|
* @param {{ count: number|null|undefined, mode: string, canEdit: boolean, online: boolean,
|
|
44
|
-
* claude: 'present'|'absent'|'unknown', canAsk: boolean }} f
|
|
44
|
+
* claude: 'present'|'absent'|'unknown', canAsk: boolean, loading?: boolean }} f
|
|
45
45
|
* `count` is what the CANVAS reported (null until it has: no flash while it loads). `canEdit` false =
|
|
46
46
|
* Can view / Can comment: no create affordance at all. `canAsk`: the AI chat exists here (desktop app).
|
|
47
47
|
*/
|
|
48
48
|
export function emptyCanvasModel(f) {
|
|
49
49
|
if (f.count !== 0) return null;
|
|
50
|
+
// #204 — only for a canvas KNOWN to be empty once its load has finished: a 0 said while the canvas is
|
|
51
|
+
// still loading (before its artboards mount) put the invitation over artboards drawn a moment later.
|
|
52
|
+
if (f.loading) return null;
|
|
50
53
|
if (f.mode !== 'edit') return null;
|
|
51
54
|
if (!f.canEdit) return null;
|
|
52
55
|
const offline = f.online === false;
|
|
@@ -170,6 +173,12 @@ export function createEmptyLane(deps) {
|
|
|
170
173
|
switched() {
|
|
171
174
|
set({ count: countOf(), hint: null });
|
|
172
175
|
},
|
|
176
|
+
/** #204 — a canvas started (re)loading: what its last document said about it is not about the next. */
|
|
177
|
+
loadStarted(path) {
|
|
178
|
+
if (!path || !counts.has(path)) return;
|
|
179
|
+
counts.delete(path);
|
|
180
|
+
set({ ...state, count: countOf() });
|
|
181
|
+
},
|
|
173
182
|
/** A canvas left the project / was closed. */
|
|
174
183
|
forget(path) {
|
|
175
184
|
counts.delete(path);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
import { indexMeta } from '../canvases/tree-model.js';
|
|
7
|
+
import { fetchIfServed } from '../shell/served-routes.js';
|
|
7
8
|
|
|
8
9
|
/** @returns ms, or null (no index, no such canvas, or the sheet is closed) */
|
|
9
10
|
export function useLastFinishedAt({ open, activePath, designRel, fetchImpl }) {
|
|
@@ -17,7 +18,7 @@ export function useLastFinishedAt({ open, activePath, designRel, fetchImpl }) {
|
|
|
17
18
|
const doFetch = fetchImpl || ((...a) => fetch(...a));
|
|
18
19
|
(async () => {
|
|
19
20
|
try {
|
|
20
|
-
const r = await
|
|
21
|
+
const r = await fetchIfServed('/_api/index', { cache: 'no-store' }, doFetch);
|
|
21
22
|
if (!r.ok || cancelled) return;
|
|
22
23
|
const snapshot = await r.json();
|
|
23
24
|
const row = indexMeta(snapshot, designRel).get(activePath);
|
|
@@ -52,7 +52,13 @@ export function useBranchActions({
|
|
|
52
52
|
const [downloading, setDownloading] = useState(false);
|
|
53
53
|
const [folding, setFolding] = useState('');
|
|
54
54
|
const [busy, setBusy] = useState(false);
|
|
55
|
-
const [err,
|
|
55
|
+
const [err, setErrText] = useState('');
|
|
56
|
+
// 2.0.5 W4 — the error asks for a GitHub sign-in (a 401 / authRequired): the sheet draws the button
|
|
57
|
+
const [errAuth, setErrAuth] = useState(false);
|
|
58
|
+
const setErr = useCallback((text, auth = false) => {
|
|
59
|
+
setErrText(text);
|
|
60
|
+
setErrAuth(!!text && auth);
|
|
61
|
+
}, []);
|
|
56
62
|
const [refreshing, setRefreshing] = useState(false);
|
|
57
63
|
const [fetchedAt, setFetchedAt] = useState(0);
|
|
58
64
|
const [chatGuard, setChatGuard] = useState(null); // { count, verb, action }
|
|
@@ -136,10 +142,10 @@ export function useBranchActions({
|
|
|
136
142
|
await reloadBranches();
|
|
137
143
|
} else if (r.timedOut || r.json?.timedOut) {
|
|
138
144
|
setErr(W.errFetchTimeout);
|
|
145
|
+
} else if (r.status === 401 || r.json?.authRequired) {
|
|
146
|
+
setErr(W.errFetchAuth, true);
|
|
139
147
|
} else {
|
|
140
|
-
setErr(
|
|
141
|
-
r.status === 401 || r.json?.authRequired ? W.errFetchAuth : r.json?.error || W.errFetch
|
|
142
|
-
);
|
|
148
|
+
setErr(r.json?.error || W.errFetch);
|
|
143
149
|
}
|
|
144
150
|
setRefreshing(false);
|
|
145
151
|
}
|
|
@@ -168,11 +174,8 @@ export function useBranchActions({
|
|
|
168
174
|
reload(); // added directly (no remote)
|
|
169
175
|
return;
|
|
170
176
|
}
|
|
171
|
-
setErr(
|
|
172
|
-
|
|
173
|
-
? `Sign in with GitHub to add “${branch}” to ${shared}.`
|
|
174
|
-
: j?.error || W.errAdd
|
|
175
|
-
);
|
|
177
|
+
if (r.status === 401) setErr(`Sign in with GitHub to add “${branch}” to ${shared}.`, true);
|
|
178
|
+
else setErr(j?.error || W.errAdd);
|
|
176
179
|
setFolding('');
|
|
177
180
|
}
|
|
178
181
|
|
|
@@ -196,6 +199,7 @@ export function useBranchActions({
|
|
|
196
199
|
folding,
|
|
197
200
|
busy,
|
|
198
201
|
err,
|
|
202
|
+
errAuth,
|
|
199
203
|
setErr,
|
|
200
204
|
refreshing,
|
|
201
205
|
fetchedAt,
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
26
26
|
import { useOnline } from '../empty/use-empty-canvas.js';
|
|
27
|
-
import { MENU_ACTION_EVENT } from '../shell/menu-runner.js';
|
|
27
|
+
import { MENU_ACTION_EVENT, menuRunner } from '../shell/menu-runner.js';
|
|
28
28
|
import { useBranchActions } from './branch-actions.js';
|
|
29
29
|
import { COMPARE_PICTURES_WORDS as CW } from './compare-words.js';
|
|
30
30
|
import { loadBranches, loadSourceAt } from './git-io.js';
|
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
BranchDialog,
|
|
52
52
|
ChangedList,
|
|
53
53
|
CopyButton,
|
|
54
|
+
GitHubSignInButton,
|
|
54
55
|
GitRow,
|
|
55
56
|
GitSub,
|
|
56
57
|
GuardDialog,
|
|
@@ -138,6 +139,8 @@ function GitBody({ canvas, version, versionRow, role, canView, git, fetchImpl })
|
|
|
138
139
|
const cloudHistory = git.historySource === 'cloud';
|
|
139
140
|
const [branches, setBranches] = useState([]);
|
|
140
141
|
const [banner, setBanner] = useState(null);
|
|
142
|
+
// 2.0.5 W4 — every "Sign in with GitHub to …" line starts the one sign-in (`account.github-signin`)
|
|
143
|
+
const signInGitHub = useCallback(() => menuRunner.run('account.github-signin'), []);
|
|
141
144
|
const [busy, setBusy] = useState(null);
|
|
142
145
|
const [dialog, setDialog] = useState(null); // 'save' | 'branch' | 'add'
|
|
143
146
|
const [resumeDismissed, setResumeDismissed] = useState(false);
|
|
@@ -263,6 +266,7 @@ function GitBody({ canvas, version, versionRow, role, canView, git, fetchImpl })
|
|
|
263
266
|
busy={busy}
|
|
264
267
|
onGetLatest={getLatest}
|
|
265
268
|
onDismiss={() => setBanner(null)}
|
|
269
|
+
onSignIn={signInGitHub}
|
|
266
270
|
/>
|
|
267
271
|
|
|
268
272
|
{surface.mode === 'cloud' || surface.mode === 'cloud-saving' ? versions : null}
|
|
@@ -334,6 +338,9 @@ function GitBody({ canvas, version, versionRow, role, canView, git, fetchImpl })
|
|
|
334
338
|
{actions.err}
|
|
335
339
|
</p>
|
|
336
340
|
) : null}
|
|
341
|
+
{actions.err && actions.errAuth && !dialog ? (
|
|
342
|
+
<GitHubSignInButton onSignIn={signInGitHub} />
|
|
343
|
+
) : null}
|
|
337
344
|
|
|
338
345
|
{versionRow ? (
|
|
339
346
|
<>
|
|
@@ -318,11 +318,25 @@ export function unitCheck(unit, unchecked) {
|
|
|
318
318
|
return on === 0 ? 'none' : on === unit.paths.length ? 'all' : 'some';
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
/**
|
|
321
|
+
/**
|
|
322
|
+
* The words of the discard ask (the shell's own yes/no dialog — `window.confirm` always answers no in the
|
|
323
|
+
* desktop app): the question names the file, the line under it says it can't be undone.
|
|
324
|
+
*/
|
|
325
|
+
export function discardAsk(unit) {
|
|
326
|
+
return {
|
|
327
|
+
title: unit.supporting.length
|
|
328
|
+
? `Discard your changes to “${unit.name}” and its supporting files?`
|
|
329
|
+
: `Discard your changes to “${unit.name}”?`,
|
|
330
|
+
body: "This can't be undone.",
|
|
331
|
+
confirm: GIT_WORDS.discard,
|
|
332
|
+
busy: 'Discarding…',
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** The same ask as one sentence. */
|
|
322
337
|
export function discardConfirm(unit) {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
: `Discard your changes to “${unit.name}”? This can't be undone.`;
|
|
338
|
+
const a = discardAsk(unit);
|
|
339
|
+
return `${a.title} ${a.body}`;
|
|
326
340
|
}
|
|
327
341
|
|
|
328
342
|
// ── "Changed in this version" ──────────────────────────────────────────────────────────────────────────────
|
|
@@ -482,7 +496,9 @@ export function versionRows(entries, nowMs = Date.now()) {
|
|
|
482
496
|
*/
|
|
483
497
|
export function outcomeBanner(kind, res, ok) {
|
|
484
498
|
if (res?.ok) return ok ?? null;
|
|
485
|
-
|
|
499
|
+
// 2.0.5 W4 — the sign-in line carries its button (`account.github-signin`), never only words
|
|
500
|
+
if (res?.authRequired)
|
|
501
|
+
return { variant: 'info', text: res.error || GIT_WORDS.signIn, signIn: true };
|
|
486
502
|
if (res?.conflict)
|
|
487
503
|
return kind === 'getLatest'
|
|
488
504
|
? {
|