@1agh/maude 2.0.4 → 2.0.8
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/apps/hub/src/project-transactions/kernel.mjs +10 -1
- package/apps/studio/access/closure.ts +156 -16
- package/apps/studio/access/filters.ts +39 -5
- package/apps/studio/access/known-canvases.ts +24 -1
- package/apps/studio/access/refused-inputs.ts +89 -0
- package/apps/studio/actions/agents.ts +59 -0
- package/apps/studio/actions/ctx.ts +3 -0
- package/apps/studio/actions/defs/app.ts +12 -0
- package/apps/studio/actions/defs/sync.ts +13 -0
- package/apps/studio/actions/defs/view.ts +59 -3
- package/apps/studio/actions/keymap.gen.ts +35 -0
- package/apps/studio/actions/menu.ts +2 -0
- package/apps/studio/actions/types.ts +3 -1
- package/apps/studio/actions.manifest.json +148 -1
- package/apps/studio/actions.parity.json +31 -1
- package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
- package/apps/studio/annotations/ui/element-node.tsx +139 -54
- package/apps/studio/annotations/ui/lod.tsx +1 -1
- package/apps/studio/annotations/ui/ride.ts +2 -1
- package/apps/studio/annotations/ui/text-style.ts +1 -1
- package/apps/studio/annotations-context-toolbar.tsx +5 -4
- package/apps/studio/annotations-layer.tsx +4 -15
- package/apps/studio/api.ts +425 -128
- package/apps/studio/artboard-activity-overlay.tsx +4 -4
- package/apps/studio/artboard-ai-copies.tsx +4 -4
- package/apps/studio/artboard-freeze.ts +108 -0
- package/apps/studio/artboard-live-gate.tsx +636 -0
- package/apps/studio/artboard-live.ts +831 -0
- package/apps/studio/artboard-placeholder.ts +197 -0
- package/apps/studio/artboard-still-raster.ts +485 -0
- package/apps/studio/artboard-still-warmup.ts +221 -0
- package/apps/studio/artboard-still.ts +1188 -0
- package/apps/studio/artboard-webgl.ts +669 -0
- package/apps/studio/asset-placeholder.tsx +237 -132
- package/apps/studio/asset-upload-bars.tsx +4 -4
- 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-open.mjs +364 -0
- package/apps/studio/bin/_perf-probe.mjs +2 -1
- package/apps/studio/bin/_perf-shared.mjs +12 -7
- package/apps/studio/bin/_pw-launch.mjs +26 -1
- 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 +89 -12
- package/apps/studio/bin/ds-check.sh +5 -1
- package/apps/studio/bin/perf.sh +30 -1
- package/apps/studio/bin/server-up.sh +7 -2
- package/apps/studio/bin/smoke.sh +19 -0
- package/apps/studio/bridge/dgn-protocol.ts +35 -0
- package/apps/studio/canvas-build-sandbox.ts +69 -13
- package/apps/studio/canvas-camera.ts +90 -0
- package/apps/studio/canvas-comment-mount.tsx +9 -9
- package/apps/studio/canvas-lib.tsx +289 -44
- package/apps/studio/canvas-pages-view.tsx +465 -0
- package/apps/studio/canvas-pages.ts +305 -0
- package/apps/studio/canvas-rows.ts +62 -0
- package/apps/studio/canvas-shell.tsx +62 -16
- package/apps/studio/canvas-theme-icons.tsx +41 -0
- package/apps/studio/canvas-theme-pill.tsx +15 -6
- package/apps/studio/canvas-theme.ts +12 -11
- package/apps/studio/client/app.jsx +7 -0
- package/apps/studio/client/canvas-url.js +36 -1
- 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 +6 -0
- 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/canvas-origin-probe.js +34 -0
- package/apps/studio/client/hooks/use-action-keys.jsx +3 -1
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +1 -1
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +23 -6
- package/apps/studio/client/hooks/use-photo-and-timeline.jsx +16 -8
- package/apps/studio/client/hooks/use-project-data.jsx +13 -2
- package/apps/studio/client/hooks/use-shell-core.jsx +19 -9
- package/apps/studio/client/index-loader.ts +41 -21
- package/apps/studio/client/inspector/inspector-panel.jsx +35 -14
- package/apps/studio/client/panels/ChatPanel.jsx +27 -20
- package/apps/studio/client/panels/CreateProject.jsx +19 -5
- package/apps/studio/client/panels/caps-cache.js +46 -0
- package/apps/studio/client/shell/viewport.jsx +66 -22
- package/apps/studio/client/tree/tree.jsx +17 -0
- 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/Composer.jsx +27 -10
- package/apps/studio/client/v2/canvases/canvases-panel.jsx +24 -0
- package/apps/studio/client/v2/canvases/use-canvas-index.js +24 -1
- package/apps/studio/client/v2/code/canvas-error-card.jsx +14 -2
- package/apps/studio/client/v2/code/canvas-imports-card.jsx +19 -14
- package/apps/studio/client/v2/code/canvas-imports-words.js +60 -0
- package/apps/studio/client/v2/code/canvas-waiting-card.jsx +59 -5
- package/apps/studio/client/v2/code/canvas-waiting.js +18 -1
- package/apps/studio/client/v2/code/code-bus.js +5 -0
- package/apps/studio/client/v2/code/code-consent-sheet.jsx +87 -0
- package/apps/studio/client/v2/code/code-consent.js +67 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +62 -10
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +314 -5
- package/apps/studio/client/v2/ds/advanced-host.jsx +11 -26
- 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 -15
- package/apps/studio/client/v2/ds/off-system-host.jsx +18 -19
- package/apps/studio/client/v2/ds/review-host.jsx +7 -1
- package/apps/studio/client/v2/ds/truth-host.jsx +15 -17
- package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
- 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 +3 -1
- package/apps/studio/client/v2/history/git-parts.jsx +16 -1
- package/apps/studio/client/v2/layers/artboard-layers.jsx +24 -5
- package/apps/studio/client/v2/layers/layers-request.js +49 -0
- package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +93 -3
- package/apps/studio/client/v2/left-panel/ds-boards.js +39 -0
- package/apps/studio/client/v2/left-panel/left-panel-model.js +13 -0
- package/apps/studio/client/v2/left-panel/left-panel.css +24 -0
- package/apps/studio/client/v2/presence/faces.jsx +42 -14
- package/apps/studio/client/v2/shell/account-card.jsx +10 -4
- package/apps/studio/client/v2/shell/canvas-crash-guard.js +172 -0
- package/apps/studio/client/v2/shell/canvas-mode.js +17 -1
- package/apps/studio/client/v2/shell/floating-panels.css +37 -1
- package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
- package/apps/studio/client/v2/shell/menu-runner.js +11 -0
- package/apps/studio/client/v2/shell/mode-switch.jsx +14 -3
- package/apps/studio/client/v2/shell/opening-skeleton.js +118 -0
- package/apps/studio/client/v2/shell/opening-skeleton.jsx +103 -0
- package/apps/studio/client/v2/shell/pages-pick.js +49 -0
- 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/project-menu-model.js +3 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +140 -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-parity.json +8 -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-canvas-mode-lane.js +30 -0
- 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/comments-overlay.tsx +12 -11
- package/apps/studio/config-reload-wire.ts +56 -0
- package/apps/studio/config.schema.json +6 -0
- package/apps/studio/context.ts +37 -1
- package/apps/studio/dist/client.bundle.js +1198 -1198
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/ds/board/board.css +6 -0
- package/apps/studio/ds/board/ds-bar.tsx +21 -3
- package/apps/studio/ds/board/specimen.tsx +16 -2
- package/apps/studio/ds/board/template.ts +39 -19
- package/apps/studio/ds/canvas-cli.ts +58 -2
- package/apps/studio/ds/check.ts +26 -1
- package/apps/studio/ds/cli.ts +14 -4
- package/apps/studio/ds/component-list.ts +2 -1
- package/apps/studio/ds/convert.ts +34 -6
- package/apps/studio/ds/default.ts +6 -1
- package/apps/studio/ds/ds-resolver.ts +58 -8
- package/apps/studio/ds/ds-verb.ts +13 -0
- package/apps/studio/ds/engine.ts +3 -1
- package/apps/studio/ds/folder-systems.ts +199 -0
- package/apps/studio/ds/pairing-css.ts +2 -1
- package/apps/studio/ds/post-build.ts +38 -0
- package/apps/studio/ds/rename.ts +10 -3
- package/apps/studio/ds/shell-fallbacks.ts +2 -1
- 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 +10 -3
- package/apps/studio/editing/ai-point-ring.tsx +4 -4
- package/apps/studio/editing/ai-scope-outline.tsx +4 -4
- package/apps/studio/editing/align-bar.tsx +4 -4
- package/apps/studio/editing/anchor-report.ts +3 -2
- package/apps/studio/editing/artboard-handles.tsx +4 -4
- package/apps/studio/editing/corner-dots.tsx +4 -4
- package/apps/studio/editing/crop-mode.tsx +4 -4
- package/apps/studio/editing/drop-chip.tsx +4 -4
- package/apps/studio/editing/empty-report.ts +3 -2
- package/apps/studio/editing/focus-model.tsx +4 -4
- package/apps/studio/editing/gap-bands.tsx +3 -3
- package/apps/studio/editing/hold-rings.tsx +4 -4
- package/apps/studio/editing/lock-badge.tsx +3 -3
- package/apps/studio/editing/long-page.ts +23 -1
- package/apps/studio/editing/nudge.tsx +2 -2
- package/apps/studio/editing/page-activity.ts +4 -3
- package/apps/studio/editing/paste-bar.tsx +4 -4
- package/apps/studio/editing/pen/overlay.tsx +4 -3
- package/apps/studio/editing/place-freely.tsx +3 -3
- package/apps/studio/editing/reorder-slot.tsx +3 -3
- package/apps/studio/editing/selection.tsx +4 -4
- package/apps/studio/editing/size-ghost.tsx +4 -4
- package/apps/studio/editing/tab-order.tsx +4 -4
- package/apps/studio/editing/text-in-place.tsx +4 -4
- package/apps/studio/editing/undo-preview.tsx +3 -3
- package/apps/studio/equal-spacing-handles.tsx +3 -3
- package/apps/studio/frame-clock.ts +89 -0
- package/apps/studio/history/trash.ts +6 -0
- package/apps/studio/home/accounts.ts +87 -0
- package/apps/studio/home/index-reader.ts +24 -2
- package/apps/studio/home/routes.ts +19 -0
- package/apps/studio/http.ts +80 -34
- package/apps/studio/index/ds-usage.ts +4 -1
- package/apps/studio/index-cache.ts +272 -0
- package/apps/studio/inspect-overlay.tsx +4 -3
- package/apps/studio/inspect.ts +7 -2
- package/apps/studio/link-chip-overlay.tsx +4 -3
- package/apps/studio/measure-overlay.tsx +4 -3
- package/apps/studio/present/pointer-dot.tsx +3 -2
- package/apps/studio/present/present-media.ts +6 -2
- package/apps/studio/present/present-stage.tsx +3 -2
- package/apps/studio/preview/preview-camera.tsx +3 -2
- package/apps/studio/routes/ds-convert.ts +18 -0
- package/apps/studio/routes/sync.ts +176 -0
- package/apps/studio/routes/trash.ts +16 -1
- package/apps/studio/safe-zones-overlay.tsx +3 -2
- package/apps/studio/server.ts +8 -10
- package/apps/studio/skip-dirs.ts +103 -47
- package/apps/studio/studio-page-host.ts +70 -0
- package/apps/studio/sync/accepted-cold-start.ts +28 -13
- 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 +86 -0
- package/apps/studio/sync/file-ledger.ts +24 -0
- package/apps/studio/sync/file-membership.ts +28 -3
- package/apps/studio/sync/file-plane.ts +497 -61
- package/apps/studio/sync/file-pull.ts +304 -33
- package/apps/studio/sync/held-deletes.ts +230 -0
- package/apps/studio/sync/hub-link.ts +1 -2
- package/apps/studio/sync/hubs-config.ts +59 -2
- package/apps/studio/sync/index.ts +405 -163
- package/apps/studio/sync/journal-client.ts +94 -5
- package/apps/studio/sync/pending-deletes.ts +100 -0
- package/apps/studio/sync/projection.ts +77 -12
- package/apps/studio/sync/seed-progress.ts +104 -3
- package/apps/studio/sync/settings.ts +36 -1
- package/apps/studio/sync/status.ts +17 -1
- package/apps/studio/sync/writer-registry.ts +5 -0
- package/apps/studio/text-caret.ts +5 -3
- package/apps/studio/thumbs/service.ts +12 -2
- package/apps/studio/thumbs/validate.ts +7 -0
- package/apps/studio/toolbars/toolbar-rect.ts +3 -2
- package/apps/studio/ui-prefs-migrate.ts +4 -0
- package/apps/studio/use-annotation-resize.tsx +4 -3
- package/apps/studio/use-artboard-drag.tsx +3 -2
- package/apps/studio/use-element-resize.tsx +7 -6
- package/apps/studio/use-grid-track-handles.tsx +5 -4
- package/apps/studio/use-selection-set.tsx +64 -4
- package/apps/studio/use-spacing-handles.tsx +7 -6
- package/apps/studio/video-comp.tsx +75 -39
- package/apps/studio/video-play-overlay.tsx +4 -3
- package/apps/studio/whats-new.json +99 -0
- package/cli/commands/design.mjs +5 -2
- package/cli/commands/hub.mjs +10 -1
- package/cli/lib/bash-guard.mjs +27 -1
- package/cli/lib/design-help.gen.mjs +1 -1
- package/cli/lib/design-hook.mjs +20 -0
- package/cli/lib/design-link.mjs +42 -17
- package/cli/lib/hub-purge.mjs +183 -0
- package/cli/lib/studio-locate.mjs +35 -10
- package/package.json +8 -8
- package/plugins/design/templates/_shell.html +164 -1
|
@@ -280,6 +280,30 @@ export function CanvasesPanel({
|
|
|
280
280
|
}
|
|
281
281
|
}, [activePath, rows, layout]);
|
|
282
282
|
|
|
283
|
+
// 2.0.7 polish — the artboard in view moved (Pages' ‹ › and keys turn it, a jump picks it): its row in the open
|
|
284
|
+
// list scrolls into view, once per artboard (a list opened later scrolls to it then)
|
|
285
|
+
const lastBoard = useRef(null);
|
|
286
|
+
useEffect(() => {
|
|
287
|
+
const key = activePath && currentBoard ? `${activePath}#${currentBoard}` : null;
|
|
288
|
+
if (!key) {
|
|
289
|
+
lastBoard.current = null;
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (lastBoard.current === key) return;
|
|
293
|
+
const isCur = (r) => r.type === 'board' && r.current;
|
|
294
|
+
let i = rows.findIndex((r) => isCur(r) && !r.inPinned && !r.inRecent);
|
|
295
|
+
if (i < 0) i = rows.findIndex(isCur);
|
|
296
|
+
if (i < 0) return;
|
|
297
|
+
lastBoard.current = key;
|
|
298
|
+
const el = treeRef.current;
|
|
299
|
+
if (!el) return;
|
|
300
|
+
const next = scrollToReveal(rows, layout, i, el.scrollTop, el.clientHeight);
|
|
301
|
+
if (next !== el.scrollTop) {
|
|
302
|
+
el.scrollTop = next;
|
|
303
|
+
setScrollTop(next);
|
|
304
|
+
}
|
|
305
|
+
}, [activePath, currentBoard, rows, layout]);
|
|
306
|
+
|
|
283
307
|
const setOpen = useCallback((path, v) => expansion?.setOpen(path, v), [expansion]);
|
|
284
308
|
const toggleJump = useCallback((row) => {
|
|
285
309
|
setJumpOpen((m) => new Map(m).set(row.path, !row.jumpOpen));
|
|
@@ -7,12 +7,34 @@
|
|
|
7
7
|
// the panel foot kept "21 artboards" after one was trashed). If the server has
|
|
8
8
|
// no index (an older server, a cloud tab that does not serve it) the panel is simply without badges.
|
|
9
9
|
|
|
10
|
-
import { useEffect, useRef, useState } from 'react';
|
|
10
|
+
import { useEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
11
11
|
import { fetchIfServed } from '../shell/served-routes.js';
|
|
12
12
|
|
|
13
13
|
/** The shell's relay of the socket's `index-changed { seq, rels }` (client/app.jsx). */
|
|
14
14
|
export const INDEX_CHANGED_EVENT = 'maude:index-changed';
|
|
15
15
|
|
|
16
|
+
// 2.0.7 — the last snapshot the panel read, for the surfaces that need the same rows without asking the
|
|
17
|
+
// server again: the pinned Design system rows (their artboards) and the opening skeletons (artboard sizes).
|
|
18
|
+
let lastSnapshot = null;
|
|
19
|
+
const snapshotSubs = new Set();
|
|
20
|
+
export const indexSnapshotNow = {
|
|
21
|
+
get: () => lastSnapshot,
|
|
22
|
+
subscribe(fn) {
|
|
23
|
+
snapshotSubs.add(fn);
|
|
24
|
+
return () => snapshotSubs.delete(fn);
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
/** Publish a snapshot read (tests call it to seed one). */
|
|
28
|
+
export function publishIndexSnapshot(snap) {
|
|
29
|
+
if (snap === lastSnapshot) return;
|
|
30
|
+
lastSnapshot = snap;
|
|
31
|
+
for (const fn of [...snapshotSubs]) fn();
|
|
32
|
+
}
|
|
33
|
+
/** The last index snapshot the Canvases panel read (null until the first answer). */
|
|
34
|
+
export function useIndexSnapshotNow() {
|
|
35
|
+
return useSyncExternalStore(indexSnapshotNow.subscribe, indexSnapshotNow.get, () => null);
|
|
36
|
+
}
|
|
37
|
+
|
|
16
38
|
export function useCanvasIndex({ stamp, fetchImpl } = {}) {
|
|
17
39
|
const [snapshot, setSnapshot] = useState(null);
|
|
18
40
|
const [moved, setMoved] = useState(0);
|
|
@@ -55,6 +77,7 @@ export function useCanvasIndex({ stamp, fetchImpl } = {}) {
|
|
|
55
77
|
if (!data?.unchanged && Array.isArray(data?.canvases)) {
|
|
56
78
|
seq.current = data.writer?.seq || 0;
|
|
57
79
|
setSnapshot(data);
|
|
80
|
+
publishIndexSnapshot(data);
|
|
58
81
|
}
|
|
59
82
|
} while (f.again);
|
|
60
83
|
} catch {
|
|
@@ -23,7 +23,7 @@ import { AdvancedFold } from '../fold/advanced-fold.jsx';
|
|
|
23
23
|
import { Check, Copy, Spark } from '../ai/icons.jsx';
|
|
24
24
|
import { INDEX_CHANGED_EVENT } from '../canvases/use-canvas-index.js';
|
|
25
25
|
import { projectRel } from '../shell/native-doors.js';
|
|
26
|
-
import { BUILD_FAILURE_BODY, buildFailureReason } from './canvas-waiting.js';
|
|
26
|
+
import { BUILD_FAILURE_BODY, buildFailureReason, loadReasonWords } from './canvas-waiting.js';
|
|
27
27
|
import { CanvasBuildingCard, CanvasWaitingCard } from './canvas-waiting-card.jsx';
|
|
28
28
|
import { registerErrorCard } from './code-bus.js';
|
|
29
29
|
import {
|
|
@@ -152,6 +152,8 @@ export function CanvasErrorCard({
|
|
|
152
152
|
askAiAvailable = true,
|
|
153
153
|
/** #189 — the build stopped outside the code (`{ class, count? }`): no Ask AI, the reason under the fold. */
|
|
154
154
|
buildFailure = null,
|
|
155
|
+
/** 2.0.7 — which of the studio's waits ran out (`canvasError.reason`), named when nothing else is. */
|
|
156
|
+
loadReason = null,
|
|
155
157
|
/** The fold starts open (a test / a caller that wants the details up front). */
|
|
156
158
|
detailsOpen = false,
|
|
157
159
|
}) {
|
|
@@ -274,6 +276,13 @@ export function CanvasErrorCard({
|
|
|
274
276
|
{buildFailureReason(buildFailure)}
|
|
275
277
|
</span>
|
|
276
278
|
</div>
|
|
279
|
+
) : loadReasonWords(loadReason) ? (
|
|
280
|
+
<div className="v2-err-row">
|
|
281
|
+
<span className="v2-err-k">Reason</span>
|
|
282
|
+
<span className="v2-err-v" data-testid="canvas-error-load-reason">
|
|
283
|
+
{loadReasonWords(loadReason)}
|
|
284
|
+
</span>
|
|
285
|
+
</div>
|
|
277
286
|
) : (
|
|
278
287
|
<p className="v2-err-none" data-testid="canvas-error-none">
|
|
279
288
|
No details were reported. Reload the canvas, or ask AI to look.
|
|
@@ -388,6 +397,8 @@ export function CanvasLoadFailure({
|
|
|
388
397
|
fetchImpl,
|
|
389
398
|
/** How often the waiting card re-asks (a file landing also re-asks at once). */
|
|
390
399
|
watchMs = WAITING_WATCH_MS,
|
|
400
|
+
/** 2.0.7 — passed to the card: which wait ran out. */
|
|
401
|
+
loadReason = null,
|
|
391
402
|
}) {
|
|
392
403
|
const [stamp, setStamp] = useState(0);
|
|
393
404
|
const err = useCanvasError({ canvas, stamp, quiet: true, fetchImpl });
|
|
@@ -449,7 +460,7 @@ export function CanvasLoadFailure({
|
|
|
449
460
|
);
|
|
450
461
|
}
|
|
451
462
|
// files it imports haven't reached this Mac, or are held back: not a mistake in its code
|
|
452
|
-
if (waiting) return <CanvasWaitingCard canvas={canvas} waiting={waiting} />;
|
|
463
|
+
if (waiting) return <CanvasWaitingCard canvas={canvas} waiting={waiting} fetchImpl={fetchImpl} />;
|
|
453
464
|
if (building) return <CanvasBuildingCard canvas={canvas} />;
|
|
454
465
|
return (
|
|
455
466
|
<>
|
|
@@ -466,6 +477,7 @@ export function CanvasLoadFailure({
|
|
|
466
477
|
onReload={onReload}
|
|
467
478
|
onCopy={onCopy}
|
|
468
479
|
buildFailure={buildFailure}
|
|
480
|
+
loadReason={loadReason}
|
|
469
481
|
/>
|
|
470
482
|
</>
|
|
471
483
|
);
|
|
@@ -6,25 +6,30 @@
|
|
|
6
6
|
// (`/_index-data` `canvasImportsCanvases`, canvas-url.js `canvasImportsOf`) and says so on the stage
|
|
7
7
|
// (shell/viewport.jsx), in place of the generic "can't be drawn" card. What happened · what to do; no
|
|
8
8
|
// action — the fix is in the code (move the shared part into a component file).
|
|
9
|
+
//
|
|
10
|
+
// 2.0.5 (#205): a walk the closure did not block can still be refused AFTER the build, when the module inlined
|
|
11
|
+
// a design-root file the frame does not admit (http.ts `canvasInputsGate`). The server keeps those files per
|
|
12
|
+
// canvas and the index reports them (`canvasRefusedInputs`, canvas-url.js `canvasRefusedOf`): the card names
|
|
13
|
+
// them too — "This canvas uses <file>, which belongs to another canvas."
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const dir =
|
|
14
|
-
String(componentDir || 'ui/components').replace(/^\.?\/+|\/+$/g, '') || 'ui/components';
|
|
15
|
-
return {
|
|
16
|
-
title: names.length
|
|
17
|
-
? `This canvas imports another canvas (${names.join(', ')}).`
|
|
18
|
-
: 'This canvas imports another canvas.',
|
|
19
|
-
body: `Move the shared part into a component file (e.g. ${dir}/…) to render it here.`,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
15
|
+
import { canvasImportsText, canvasMissingText } from './canvas-imports-words.js';
|
|
16
|
+
|
|
17
|
+
export { canvasImportsText };
|
|
22
18
|
|
|
23
|
-
export function CanvasImportsCard({ imports, componentDir }) {
|
|
24
|
-
|
|
19
|
+
export function CanvasImportsCard({ imports, refused, missing, componentDir }) {
|
|
20
|
+
// 2.0.7 — a canvas whose only trouble is a missing import names that file (canvasMissingText)
|
|
21
|
+
const onlyMissing = !imports?.length && !refused?.length && missing?.length;
|
|
22
|
+
const { title, also, body } = onlyMissing
|
|
23
|
+
? canvasMissingText(missing)
|
|
24
|
+
: canvasImportsText(imports, componentDir, refused);
|
|
25
25
|
return (
|
|
26
26
|
<div className="sh-canvas-error-card" data-testid="canvas-imports-card">
|
|
27
27
|
<div className="sh-canvas-error-title">{title}</div>
|
|
28
|
+
{also.map((line) => (
|
|
29
|
+
<div key={line} className="sh-canvas-error-body">
|
|
30
|
+
{line}
|
|
31
|
+
</div>
|
|
32
|
+
))}
|
|
28
33
|
<div className="sh-canvas-error-body">{body}</div>
|
|
29
34
|
</div>
|
|
30
35
|
);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// client/v2/code/canvas-imports-words.js — the words for a canvas whose frame refuses its module because it
|
|
2
|
+
// reaches another canvas's code (gate-b-c4j) or, 2.0.5 (#205), because its built module inlined a file another
|
|
3
|
+
// canvas owns. Pure: the shell's card (canvas-imports-card.jsx), `maude design ds-check` (ds/canvas-cli.ts) and
|
|
4
|
+
// `/design:smoke` (bin/_canvas-reasons.mjs) say the same thing.
|
|
5
|
+
|
|
6
|
+
/** "a.tsx", "a.tsx and b.tsx", "a.tsx, b.tsx and c.tsx" */
|
|
7
|
+
function listWords(names) {
|
|
8
|
+
if (names.length < 2) return names[0] ?? '';
|
|
9
|
+
return `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const namesOf = (list) =>
|
|
13
|
+
Array.isArray(list) ? list.filter((x) => typeof x === 'string' && x) : [];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The card's lines. `imports`: designRoot-relative canvases it imports that the viewer may see (may be empty);
|
|
17
|
+
* `refused` (2.0.5, #205): the design-root files its built module was refused for — a file another canvas owns.
|
|
18
|
+
* `title` is the first reason, `also` the other one (when both are on record), `body` what to do.
|
|
19
|
+
*/
|
|
20
|
+
export function canvasImportsText(imports, componentDir, refused = []) {
|
|
21
|
+
const names = namesOf(imports);
|
|
22
|
+
const uses = namesOf(refused);
|
|
23
|
+
const dir =
|
|
24
|
+
String(componentDir || 'ui/components').replace(/^\.?\/+|\/+$/g, '') || 'ui/components';
|
|
25
|
+
const importsLine = names.length
|
|
26
|
+
? `This canvas imports another canvas (${names.join(', ')}).`
|
|
27
|
+
: 'This canvas imports another canvas.';
|
|
28
|
+
const usesLine = uses.length
|
|
29
|
+
? `This canvas uses ${listWords(uses)}, which ${uses.length > 1 ? 'belong' : 'belongs'} to another canvas.`
|
|
30
|
+
: null;
|
|
31
|
+
const lines = names.length || !usesLine ? [importsLine, usesLine] : [usesLine];
|
|
32
|
+
const [title, ...also] = lines.filter(Boolean);
|
|
33
|
+
return {
|
|
34
|
+
title,
|
|
35
|
+
also,
|
|
36
|
+
body: `Move the shared part into a component file (e.g. ${dir}/…) to render it here.`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 2.0.7 — the words for a canvas that imports a file which is not in the project (deleted, renamed, or not on
|
|
42
|
+
* this Mac yet). Its frame is refused before it builds, so without these the card could only say it "didn't
|
|
43
|
+
* finish loading". `missing`: designRoot-relative paths, from the index's `canvasMissingImports`.
|
|
44
|
+
*/
|
|
45
|
+
export function canvasMissingText(missing) {
|
|
46
|
+
const names = namesOf(missing);
|
|
47
|
+
return {
|
|
48
|
+
title: names.length
|
|
49
|
+
? `This canvas imports ${listWords(names)}, which ${names.length > 1 ? 'are' : 'is'} not in the project.`
|
|
50
|
+
: 'This canvas imports a file that is not in the project.',
|
|
51
|
+
also: [],
|
|
52
|
+
body: 'Put the file back, or remove the import, to draw the canvas.',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** The card's words as plain lines (title, the other reason, what to do) — for a terminal or a report. */
|
|
57
|
+
export function canvasImportsLines(imports, componentDir, refused = []) {
|
|
58
|
+
const { title, also, body } = canvasImportsText(imports, componentDir, refused);
|
|
59
|
+
return [title, ...also, body];
|
|
60
|
+
}
|
|
@@ -5,14 +5,17 @@
|
|
|
5
5
|
// files) · the project's sync (Project sync: 5,029 of 5,041 files) · the names it waits
|
|
6
6
|
// for (five, then "and N more"). No button: the canvas opens by itself when they land
|
|
7
7
|
// (CanvasLoadFailure watches and reloads it).
|
|
8
|
-
// refused "Uniformy-2027 can't open on this Mac yet." · why, in plain words; for the code consent
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// sync consent, and nothing in the code is wrong.
|
|
8
|
+
// refused "Uniformy-2027 can't open on this Mac yet." · why, in plain words; for the code consent
|
|
9
|
+
// (fix/207) the card's one button, Allow shared code…, opens the confirm sheet (a Maude
|
|
10
|
+
// Cloud project opened from Home accepts by itself). No "Ask AI to fix it": AI can't change
|
|
11
|
+
// a sync consent, and nothing in the code is wrong.
|
|
12
12
|
//
|
|
13
13
|
// Same card frame as the broken-canvas card (`.v2-err`); the words are canvas-waiting.js's.
|
|
14
14
|
|
|
15
|
+
import { useEffect, useState } from 'react';
|
|
15
16
|
import { StIcon } from '../../shell/icons.jsx';
|
|
17
|
+
import { readCodeConsent } from './code-consent.js';
|
|
18
|
+
import { CodeConsentSheet } from './code-consent-sheet.jsx';
|
|
16
19
|
import {
|
|
17
20
|
BUILDING_BODY,
|
|
18
21
|
baseName,
|
|
@@ -28,9 +31,59 @@ import {
|
|
|
28
31
|
} from './canvas-waiting.js';
|
|
29
32
|
import { canvasTitle } from './use-canvas-source.js';
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
/** fix/207 — the card's one action for held shared code; drawn only where this Mac may answer. */
|
|
35
|
+
function AllowCodeAction({ fetchImpl }) {
|
|
36
|
+
const [consent, setConsent] = useState(null);
|
|
37
|
+
const [open, setOpen] = useState(false);
|
|
38
|
+
const [said, setSaid] = useState('');
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
let live = true;
|
|
41
|
+
readCodeConsent(fetchImpl).then((c) => {
|
|
42
|
+
if (live) setConsent(c);
|
|
43
|
+
});
|
|
44
|
+
return () => {
|
|
45
|
+
live = false;
|
|
46
|
+
};
|
|
47
|
+
}, [fetchImpl]);
|
|
48
|
+
if (said)
|
|
49
|
+
return (
|
|
50
|
+
<p className="v2-err-lg" role="status" data-testid="canvas-waiting-allowed">
|
|
51
|
+
{said}
|
|
52
|
+
</p>
|
|
53
|
+
);
|
|
54
|
+
if (!consent?.changeable || consent.allowed) return null;
|
|
55
|
+
return (
|
|
56
|
+
<div className="v2-err-acts">
|
|
57
|
+
<button
|
|
58
|
+
type="button"
|
|
59
|
+
className="btn btn--primary"
|
|
60
|
+
data-action="sync.allow-code"
|
|
61
|
+
data-testid="canvas-waiting-allow-code"
|
|
62
|
+
onClick={() => setOpen(true)}
|
|
63
|
+
>
|
|
64
|
+
Allow shared code…
|
|
65
|
+
</button>
|
|
66
|
+
{open ? (
|
|
67
|
+
<CodeConsentSheet
|
|
68
|
+
mode="allow"
|
|
69
|
+
host={consent.host}
|
|
70
|
+
fetchImpl={fetchImpl}
|
|
71
|
+
onClose={() => setOpen(false)}
|
|
72
|
+
onDone={(c) => {
|
|
73
|
+
setOpen(false);
|
|
74
|
+
setConsent(c);
|
|
75
|
+
setSaid('Shared code is allowed. The canvas opens once it arrives.');
|
|
76
|
+
}}
|
|
77
|
+
/>
|
|
78
|
+
) : null}
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function CanvasWaitingCard({ canvas, waiting, fetchImpl = globalThis.fetch }) {
|
|
32
84
|
const name = canvasTitle(canvas);
|
|
33
85
|
const held = !!refusedFile(waiting);
|
|
86
|
+
const codeHeld = refusedFile(waiting)?.reason === 'code-consent';
|
|
34
87
|
const { need, progress } = waiting;
|
|
35
88
|
const shown = waiting.files.slice(0, SHOWN_FILES);
|
|
36
89
|
const more = moreCount(waiting);
|
|
@@ -54,6 +107,7 @@ export function CanvasWaitingCard({ canvas, waiting }) {
|
|
|
54
107
|
<p className="v2-err-d" data-testid="canvas-waiting-body">
|
|
55
108
|
{waitingBody(waiting)}
|
|
56
109
|
</p>
|
|
110
|
+
{codeHeld ? <AllowCodeAction fetchImpl={fetchImpl} /> : null}
|
|
57
111
|
{need && !held ? (
|
|
58
112
|
<div className="v2-err-prog" data-testid="canvas-waiting-progress">
|
|
59
113
|
<span
|
|
@@ -89,7 +89,8 @@ export function waitingBody(waiting) {
|
|
|
89
89
|
const file = baseName(held.rel);
|
|
90
90
|
switch (held.reason) {
|
|
91
91
|
case 'code-consent':
|
|
92
|
-
|
|
92
|
+
// fix/207 — the card carries the answer itself (Allow shared code…), so the sentence names it
|
|
93
|
+
return `This Mac hasn't allowed shared code from this project yet (${file}). Nothing is lost. Allow shared code to open it.`;
|
|
93
94
|
case 'too-large':
|
|
94
95
|
return `${file} is too big to sync, so it can't reach this Mac. Nothing is lost.`;
|
|
95
96
|
case 'quota':
|
|
@@ -162,3 +163,19 @@ export function buildFailureReason(b) {
|
|
|
162
163
|
return '';
|
|
163
164
|
}
|
|
164
165
|
}
|
|
166
|
+
|
|
167
|
+
// ── 2.0.7: the load stopped and the server recorded nothing ──────────────────────────────────────
|
|
168
|
+
|
|
169
|
+
/** Which of the studio's own waits ran out (`canvasError.reason`), in words; '' when unknown. */
|
|
170
|
+
export function loadReasonWords(reason) {
|
|
171
|
+
switch (reason) {
|
|
172
|
+
case 'slow':
|
|
173
|
+
return "It didn't finish opening within a minute";
|
|
174
|
+
case 'no-shell':
|
|
175
|
+
return "Its frame didn't start within 15 seconds";
|
|
176
|
+
case 'frame':
|
|
177
|
+
return 'It stopped loading before it was drawn';
|
|
178
|
+
default:
|
|
179
|
+
return '';
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -47,6 +47,11 @@ export function registerErrorCard(handlers) {
|
|
|
47
47
|
return () => cards.delete(key);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/** Whether a broken-canvas card is showing (2.0.5: the design-system slow read waits while one is). */
|
|
51
|
+
export function errorCardShown() {
|
|
52
|
+
return cards.size > 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
50
55
|
/** Run `op` ('copy' | 'ask-ai' | 'last-good') on the newest mounted card. @returns whether one answered */
|
|
51
56
|
export function runErrorOp(op) {
|
|
52
57
|
const handlers = [...cards.values()].at(-1);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// client/v2/code/code-consent-sheet.jsx — fix/207: the confirm sheet for shared code from the
|
|
2
|
+
// project's hub. `mode` 'allow' → "Allow shared code from <host>?" · Allow shared code / Cancel;
|
|
3
|
+
// 'stop' → "Stop allowing shared code from <host>?" · Stop allowing / Cancel. The primary runs
|
|
4
|
+
// `sync.allow-code` / `sync.stop-code` (POST /_api/sync/code-consent/set); `onDone(consent)` gets
|
|
5
|
+
// the server's new answer. Same dialog frame as the design-system sheets (`dsr-*`, review.css).
|
|
6
|
+
|
|
7
|
+
import { useRef, useState } from 'react';
|
|
8
|
+
import { useModalFocus } from '../shell/modal-focus.js';
|
|
9
|
+
import { CONSENT_FAILED, consentWords, requestCodeConsent } from './code-consent.js';
|
|
10
|
+
|
|
11
|
+
export function CodeConsentSheet({
|
|
12
|
+
mode = 'allow',
|
|
13
|
+
host = '',
|
|
14
|
+
onClose,
|
|
15
|
+
onDone,
|
|
16
|
+
fetchImpl = fetch,
|
|
17
|
+
}) {
|
|
18
|
+
const words = consentWords(mode, host);
|
|
19
|
+
const [busy, setBusy] = useState(false);
|
|
20
|
+
const [error, setError] = useState('');
|
|
21
|
+
const cancelRef = useRef(null);
|
|
22
|
+
// Focus starts on Cancel: a yes to running code is pressed on purpose, never by a stray Return.
|
|
23
|
+
const ref = useModalFocus({ onClose, initialRef: cancelRef });
|
|
24
|
+
const go = async () => {
|
|
25
|
+
if (busy) return;
|
|
26
|
+
setBusy(true);
|
|
27
|
+
setError('');
|
|
28
|
+
const r = await requestCodeConsent(mode !== 'stop', fetchImpl);
|
|
29
|
+
if (!r.ok) {
|
|
30
|
+
setBusy(false);
|
|
31
|
+
setError(r.message || CONSENT_FAILED);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
onDone?.(r.consent);
|
|
35
|
+
};
|
|
36
|
+
return (
|
|
37
|
+
<div className="dsr-scrim" data-testid="code-consent-scrim">
|
|
38
|
+
<div
|
|
39
|
+
ref={ref}
|
|
40
|
+
className="island dsr-dialog"
|
|
41
|
+
role="dialog"
|
|
42
|
+
aria-modal="true"
|
|
43
|
+
aria-labelledby="code-consent-title"
|
|
44
|
+
tabIndex={-1}
|
|
45
|
+
data-testid="code-consent-sheet"
|
|
46
|
+
data-mode={mode}
|
|
47
|
+
>
|
|
48
|
+
<h2 id="code-consent-title" className="dsr-title" data-testid="code-consent-title">
|
|
49
|
+
{words.title}
|
|
50
|
+
</h2>
|
|
51
|
+
<div className="dsr-body">
|
|
52
|
+
{words.lines.map((l) => (
|
|
53
|
+
<p key={l}>{l}</p>
|
|
54
|
+
))}
|
|
55
|
+
{words.fine ? <p className="dsr-fine">{words.fine}</p> : null}
|
|
56
|
+
{error ? (
|
|
57
|
+
<p className="dsr-err" role="alert" data-testid="code-consent-error">
|
|
58
|
+
{error}
|
|
59
|
+
</p>
|
|
60
|
+
) : null}
|
|
61
|
+
</div>
|
|
62
|
+
<div className="dsr-acts">
|
|
63
|
+
<button
|
|
64
|
+
ref={cancelRef}
|
|
65
|
+
type="button"
|
|
66
|
+
className="btn"
|
|
67
|
+
disabled={busy}
|
|
68
|
+
data-testid="code-consent-cancel"
|
|
69
|
+
onClick={onClose}
|
|
70
|
+
>
|
|
71
|
+
Cancel
|
|
72
|
+
</button>
|
|
73
|
+
<button
|
|
74
|
+
type="button"
|
|
75
|
+
className="btn btn--primary"
|
|
76
|
+
disabled={busy}
|
|
77
|
+
data-action={mode === 'stop' ? 'sync.stop-code' : 'sync.allow-code'}
|
|
78
|
+
data-testid="code-consent-go"
|
|
79
|
+
onClick={go}
|
|
80
|
+
>
|
|
81
|
+
{words.go}
|
|
82
|
+
</button>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// client/v2/code/code-consent.js — fix/207: this Mac's answer to "may the project's hub deliver
|
|
2
|
+
// shared code here?", in words and two fetches.
|
|
3
|
+
//
|
|
4
|
+
// Shared code is the `.ts`/`.js` modules a team adds to a project (helpers, components canvases
|
|
5
|
+
// import). It lands OUTSIDE the canvas sandbox — AI and the maude helpers read it, and canvases run
|
|
6
|
+
// it — so a Mac takes it only once the person says yes (DDR-054). The answer lives in the profile's
|
|
7
|
+
// hubs.json; the studio writes it (`POST /_api/sync/code-consent/set`, the window's own fetch only).
|
|
8
|
+
// Reached from Sync details' held row and the canvas-waiting card; registry actions
|
|
9
|
+
// `sync.allow-code` / `sync.stop-code`.
|
|
10
|
+
|
|
11
|
+
/** The sheet's words for `mode` 'allow' | 'stop', naming the hub by its host (CONTRACT §4). */
|
|
12
|
+
export function consentWords(mode, host) {
|
|
13
|
+
const from = host ? ` from ${host}` : '';
|
|
14
|
+
if (mode === 'stop')
|
|
15
|
+
return {
|
|
16
|
+
title: `Stop allowing shared code${from}?`,
|
|
17
|
+
lines: [
|
|
18
|
+
'Shared code already on this Mac stays. New or changed shared code from this project waits until you allow it again.',
|
|
19
|
+
'Canvases that need code that hasn’t arrived can’t open until then.',
|
|
20
|
+
],
|
|
21
|
+
go: 'Stop allowing',
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
title: `Allow shared code${from}?`,
|
|
25
|
+
lines: [
|
|
26
|
+
'Shared code is the .ts and .js files the people in this project add to it — helpers and components its canvases import.',
|
|
27
|
+
'It runs on this Mac, outside the canvas sandbox: canvases run it when they open, and AI and the Maude tools read it. Allow it only if you trust the people who share this project.',
|
|
28
|
+
'Shared code you deleted on this Mac stays deleted.',
|
|
29
|
+
],
|
|
30
|
+
fine: 'You can stop allowing it any time in Sync details.',
|
|
31
|
+
go: 'Allow shared code',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const CONSENT_FAILED = 'That didn’t work. Nothing changed on this Mac.';
|
|
36
|
+
|
|
37
|
+
/** GET /_api/sync/code-consent → the view, or null (not syncing, or unreachable). */
|
|
38
|
+
export async function readCodeConsent(fetchImpl = globalThis.fetch) {
|
|
39
|
+
try {
|
|
40
|
+
const r = await fetchImpl('/_api/sync/code-consent', { cache: 'no-store' });
|
|
41
|
+
if (!r.ok) return null;
|
|
42
|
+
const j = await r.json();
|
|
43
|
+
return j && typeof j.consent === 'object' ? j.consent : null;
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** POST /_api/sync/code-consent/set → { ok: true, consent } | { ok: false, message }. */
|
|
50
|
+
export async function requestCodeConsent(allow, fetchImpl = globalThis.fetch) {
|
|
51
|
+
try {
|
|
52
|
+
const r = await fetchImpl('/_api/sync/code-consent/set', {
|
|
53
|
+
method: 'POST',
|
|
54
|
+
headers: { 'Content-Type': 'application/json' },
|
|
55
|
+
body: JSON.stringify({ allow: allow === true }),
|
|
56
|
+
});
|
|
57
|
+
const j = await r.json().catch(() => ({}));
|
|
58
|
+
if (r.ok && j.ok) return { ok: true, consent: j.consent ?? null };
|
|
59
|
+
const said = typeof j.detail === 'string' ? j.detail : j.message;
|
|
60
|
+
return {
|
|
61
|
+
ok: false,
|
|
62
|
+
message: typeof said === 'string' && said.length <= 200 ? said : CONSENT_FAILED,
|
|
63
|
+
};
|
|
64
|
+
} catch {
|
|
65
|
+
return { ok: false, message: 'Maude isn’t reachable right now.' };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -103,6 +103,9 @@ export const DELIVERY_WORD = Object.freeze({
|
|
|
103
103
|
stuck: 'stuck',
|
|
104
104
|
'referenced-but-unoffered': 'used, never received',
|
|
105
105
|
'local-only': 'only on this Mac',
|
|
106
|
+
// Issue #207 (7b) — a delete waiting for the person's answer, and a file they kept on the hub.
|
|
107
|
+
'delete-held': 'deleted on this Mac — waiting for your answer',
|
|
108
|
+
'hub-only': 'on the hub only',
|
|
106
109
|
});
|
|
107
110
|
|
|
108
111
|
const thousands = (n) => String(n).replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
|
|
@@ -153,6 +156,31 @@ export function syncDetailsModel(
|
|
|
153
156
|
const held = Array.isArray(files?.held)
|
|
154
157
|
? files.held.filter((h) => h && typeof h.kind === 'string')
|
|
155
158
|
: [];
|
|
159
|
+
// Issue #207 (7b) — Deleted on this Mac, held: a card with its own answer (Delete on the hub too ·
|
|
160
|
+
// Keep on the hub), naming the folders and the count. While the owner's purge of them runs, the
|
|
161
|
+
// card says how far it is (or why it stopped).
|
|
162
|
+
const deletesOut = held.find((h) => h.kind === 'delete-out' && isCount(h.count) && h.count > 0);
|
|
163
|
+
if (deletesOut) {
|
|
164
|
+
needs.push({
|
|
165
|
+
kind: 'deletes-held',
|
|
166
|
+
count: deletesOut.count,
|
|
167
|
+
detail: cleanName(deletesOut.detail, 'Files deleted on this Mac are held.', HELD_DETAIL_MAX),
|
|
168
|
+
folders: (Array.isArray(deletesOut.folders) ? deletesOut.folders : [])
|
|
169
|
+
.filter((f) => f && typeof f.folder === 'string' && isCount(f.count))
|
|
170
|
+
.slice(0, 10)
|
|
171
|
+
.map((f) => ({ folder: f.folder, count: f.count })),
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
const purge = files?.deletePurge;
|
|
175
|
+
if (purge && isCount(purge.total) && isCount(purge.done)) {
|
|
176
|
+
needs.push({
|
|
177
|
+
kind: 'deletes-purging',
|
|
178
|
+
total: purge.total,
|
|
179
|
+
done: Math.min(purge.done, purge.total),
|
|
180
|
+
running: purge.running === true,
|
|
181
|
+
error: typeof purge.error === 'string' ? cleanName(purge.error, '', HELD_DETAIL_MAX) : '',
|
|
182
|
+
});
|
|
183
|
+
}
|
|
156
184
|
const rateLimited = files?.rateLimited
|
|
157
185
|
? isCount(files.rateLimited.waiting)
|
|
158
186
|
? files.rateLimited.waiting
|
|
@@ -160,11 +188,15 @@ export function syncDetailsModel(
|
|
|
160
188
|
: 0;
|
|
161
189
|
const failed = files && isCount(files.failed) ? files.failed : 0;
|
|
162
190
|
const attention = [];
|
|
191
|
+
const hubOnly = [];
|
|
163
192
|
const delivery = status?.files?.delivery;
|
|
164
193
|
if (delivery && typeof delivery === 'object' && !Array.isArray(delivery)) {
|
|
165
|
-
for (const [rel, state] of Object.entries(delivery))
|
|
194
|
+
for (const [rel, state] of Object.entries(delivery)) {
|
|
166
195
|
if (typeof state === 'string' && ATTENTION.has(state)) attention.push([rel, state]);
|
|
196
|
+
if (state === 'hub-only') hubOnly.push(rel);
|
|
197
|
+
}
|
|
167
198
|
attention.sort((a, b) => a[0].localeCompare(b[0]));
|
|
199
|
+
hubOnly.sort((a, b) => a.localeCompare(b));
|
|
168
200
|
}
|
|
169
201
|
|
|
170
202
|
const counts = [];
|
|
@@ -174,7 +206,10 @@ export function syncDetailsModel(
|
|
|
174
206
|
'Project files',
|
|
175
207
|
progress.remaining > 0
|
|
176
208
|
? `${thousands(progress.delivered)} of ${thousands(progress.tracked)}`
|
|
177
|
-
:
|
|
209
|
+
: hubOnly.length > 0
|
|
210
|
+
? // 2.0.7 — files kept on the hub (Keep on the hub) are not here: say both numbers
|
|
211
|
+
`${thousands(Math.max(0, progress.tracked - hubOnly.length))} here · ${thousands(hubOnly.length)} on the hub only`
|
|
212
|
+
: `${thousands(progress.tracked)} · all here`,
|
|
178
213
|
]);
|
|
179
214
|
} else if (files) {
|
|
180
215
|
counts.push(['files', 'Project files', `${thousands(files.synced)} · all here`]);
|
|
@@ -196,23 +231,40 @@ export function syncDetailsModel(
|
|
|
196
231
|
]);
|
|
197
232
|
}
|
|
198
233
|
|
|
234
|
+
// A purge still running is news, not a question: it needs the person only once it stopped short.
|
|
235
|
+
const asking = needs.filter((n) => !(n.kind === 'deletes-purging' && !n.error)).length;
|
|
199
236
|
return {
|
|
200
237
|
title: `Sync · ${cleanName(project, 'this project')}`,
|
|
201
|
-
needWord:
|
|
238
|
+
needWord: asking ? `${asking} need you` : null,
|
|
202
239
|
needs,
|
|
203
240
|
moving,
|
|
204
241
|
counts,
|
|
205
242
|
lists: {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
:
|
|
212
|
-
|
|
243
|
+
// `delete-out` is the Needs you card above (its own answer), not a second row here.
|
|
244
|
+
held: held
|
|
245
|
+
.filter((h) => !(deletesOut && h === deletesOut))
|
|
246
|
+
.map((h) => ({
|
|
247
|
+
kind: h.kind,
|
|
248
|
+
detail: cleanName(h.detail, 'Sync paused — nothing was removed.', HELD_DETAIL_MAX),
|
|
249
|
+
paths: Array.isArray(h.paths)
|
|
250
|
+
? h.paths.filter((p) => typeof p === 'string').slice(0, 50)
|
|
251
|
+
: [],
|
|
252
|
+
})),
|
|
213
253
|
rateLimited: files?.rateLimited ? { waiting: rateLimited } : null,
|
|
214
254
|
failed,
|
|
215
255
|
attention: attention.slice(0, 50),
|
|
256
|
+
// Issue #207 (7b) — deleted on this Mac and kept on the hub: listed, never "waiting".
|
|
257
|
+
hubOnly: { count: hubOnly.length, paths: hubOnly.slice(0, 50) },
|
|
258
|
+
// Issue #207 — a long run of pictures going up (a render sequence), and the folders this
|
|
259
|
+
// project leaves out. Both from the server's status; cleaned here like every other list.
|
|
260
|
+
sequences: (Array.isArray(files?.largeSequences) ? files.largeSequences : [])
|
|
261
|
+
.filter((s) => s && typeof s.folder === 'string' && isCount(s.files) && isCount(s.bytes))
|
|
262
|
+
.slice(0, 5)
|
|
263
|
+
.map((s) => ({ folder: s.folder, files: s.files, bytes: s.bytes })),
|
|
264
|
+
ignoredFolders: (Array.isArray(files?.ignoreFolders) ? files.ignoreFolders : [])
|
|
265
|
+
.filter((f) => typeof f === 'string' && f.length > 0)
|
|
266
|
+
.slice(0, 50),
|
|
267
|
+
ignoredFiles: isCount(progress?.ignored) ? progress.ignored : 0,
|
|
216
268
|
},
|
|
217
269
|
signIn: refused && !cloud && native,
|
|
218
270
|
};
|