@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
|
@@ -265,6 +265,130 @@
|
|
|
265
265
|
.home-top-acct .home-face {
|
|
266
266
|
box-shadow: 0 0 0 2px var(--bg-1);
|
|
267
267
|
}
|
|
268
|
+
/* 2.0.5 W4b — the face is a button that opens every account on this Mac */
|
|
269
|
+
.home-top-acct {
|
|
270
|
+
position: relative;
|
|
271
|
+
}
|
|
272
|
+
.home-top-acct-btn {
|
|
273
|
+
display: inline-flex;
|
|
274
|
+
padding: 0;
|
|
275
|
+
border: 0;
|
|
276
|
+
background: none;
|
|
277
|
+
border-radius: var(--radius-pill);
|
|
278
|
+
cursor: pointer;
|
|
279
|
+
}
|
|
280
|
+
.home-top-acct-btn:focus-visible {
|
|
281
|
+
outline: 2px solid var(--accent);
|
|
282
|
+
outline-offset: 2px;
|
|
283
|
+
}
|
|
284
|
+
.home-accts {
|
|
285
|
+
position: absolute;
|
|
286
|
+
top: calc(100% + var(--space-2));
|
|
287
|
+
right: 0;
|
|
288
|
+
z-index: 50;
|
|
289
|
+
width: 320px;
|
|
290
|
+
max-height: 70vh;
|
|
291
|
+
overflow: auto;
|
|
292
|
+
display: flex;
|
|
293
|
+
flex-direction: column;
|
|
294
|
+
gap: var(--space-2);
|
|
295
|
+
padding: var(--space-3);
|
|
296
|
+
background: var(--bg-1);
|
|
297
|
+
border: 1px solid var(--line-1, var(--bg-3));
|
|
298
|
+
border-radius: var(--radius-lg, 12px);
|
|
299
|
+
box-shadow: var(--shadow-3, 0 8px 24px rgb(0 0 0 / 0.18));
|
|
300
|
+
text-align: left;
|
|
301
|
+
}
|
|
302
|
+
.home-accts-h {
|
|
303
|
+
margin: 0;
|
|
304
|
+
font-size: var(--type-xs);
|
|
305
|
+
font-weight: var(--w-semibold);
|
|
306
|
+
color: var(--fg-2);
|
|
307
|
+
}
|
|
308
|
+
.home-accts-p {
|
|
309
|
+
display: flex;
|
|
310
|
+
flex-direction: column;
|
|
311
|
+
gap: var(--space-1);
|
|
312
|
+
}
|
|
313
|
+
.home-accts-ph {
|
|
314
|
+
display: flex;
|
|
315
|
+
align-items: center;
|
|
316
|
+
gap: var(--space-2);
|
|
317
|
+
margin: 0;
|
|
318
|
+
font-size: var(--type-sm);
|
|
319
|
+
font-weight: var(--w-semibold);
|
|
320
|
+
color: var(--fg-0);
|
|
321
|
+
}
|
|
322
|
+
.home-accts-list {
|
|
323
|
+
display: flex;
|
|
324
|
+
flex-direction: column;
|
|
325
|
+
gap: 2px;
|
|
326
|
+
margin: 0;
|
|
327
|
+
padding: 0;
|
|
328
|
+
list-style: none;
|
|
329
|
+
}
|
|
330
|
+
.home-accts-row {
|
|
331
|
+
display: flex;
|
|
332
|
+
align-items: center;
|
|
333
|
+
gap: var(--space-2);
|
|
334
|
+
padding-left: calc(16px + var(--space-2));
|
|
335
|
+
}
|
|
336
|
+
.home-accts-t {
|
|
337
|
+
flex: 1;
|
|
338
|
+
min-width: 0;
|
|
339
|
+
display: flex;
|
|
340
|
+
flex-direction: column;
|
|
341
|
+
font-size: var(--type-xs);
|
|
342
|
+
color: var(--fg-2);
|
|
343
|
+
}
|
|
344
|
+
.home-accts-t strong {
|
|
345
|
+
font-weight: var(--w-medium, 500);
|
|
346
|
+
color: var(--fg-1);
|
|
347
|
+
overflow: hidden;
|
|
348
|
+
text-overflow: ellipsis;
|
|
349
|
+
white-space: nowrap;
|
|
350
|
+
}
|
|
351
|
+
.home-accts-none,
|
|
352
|
+
.home-accts-note {
|
|
353
|
+
margin: 0;
|
|
354
|
+
padding-left: calc(16px + var(--space-2));
|
|
355
|
+
font-size: var(--type-xs);
|
|
356
|
+
color: var(--fg-2);
|
|
357
|
+
}
|
|
358
|
+
.home-accts-act {
|
|
359
|
+
align-self: flex-start;
|
|
360
|
+
padding: 2px 0 2px calc(16px + var(--space-2));
|
|
361
|
+
border: 0;
|
|
362
|
+
background: none;
|
|
363
|
+
font: inherit;
|
|
364
|
+
font-size: var(--type-xs);
|
|
365
|
+
color: var(--accent);
|
|
366
|
+
cursor: pointer;
|
|
367
|
+
}
|
|
368
|
+
.home-accts-foot {
|
|
369
|
+
display: flex;
|
|
370
|
+
flex-direction: column;
|
|
371
|
+
gap: 2px;
|
|
372
|
+
padding-top: var(--space-2);
|
|
373
|
+
border-top: 1px solid var(--line-1, var(--bg-3));
|
|
374
|
+
}
|
|
375
|
+
.home-accts-foot .home-accts-act {
|
|
376
|
+
padding-left: 0;
|
|
377
|
+
}
|
|
378
|
+
.home-accts-ask {
|
|
379
|
+
display: flex;
|
|
380
|
+
flex-direction: column;
|
|
381
|
+
gap: var(--space-1);
|
|
382
|
+
padding: var(--space-2);
|
|
383
|
+
border-radius: var(--radius-md, 8px);
|
|
384
|
+
background: var(--bg-2);
|
|
385
|
+
font-size: var(--type-xs);
|
|
386
|
+
}
|
|
387
|
+
.home-accts-btns {
|
|
388
|
+
display: flex;
|
|
389
|
+
justify-content: flex-end;
|
|
390
|
+
gap: var(--space-1);
|
|
391
|
+
}
|
|
268
392
|
|
|
269
393
|
/* the Search palette (k-pal.pn-pal): a centred 620 card over a veil, field at --type-md with an esc key */
|
|
270
394
|
.home-pal-veil {
|
|
@@ -861,6 +985,25 @@
|
|
|
861
985
|
align-items: center;
|
|
862
986
|
gap: var(--space-1);
|
|
863
987
|
}
|
|
988
|
+
/* 2.0.5 W4b — how a project is connected, and the folders folded into its row */
|
|
989
|
+
.home-prow-conn {
|
|
990
|
+
display: inline-flex;
|
|
991
|
+
align-items: center;
|
|
992
|
+
gap: var(--space-1);
|
|
993
|
+
min-width: 0;
|
|
994
|
+
overflow: hidden;
|
|
995
|
+
text-overflow: ellipsis;
|
|
996
|
+
}
|
|
997
|
+
.home-prow-copies {
|
|
998
|
+
display: flex;
|
|
999
|
+
flex-wrap: wrap;
|
|
1000
|
+
gap: var(--space-1);
|
|
1001
|
+
/* under the name: past the 44px cover and the row's gap */
|
|
1002
|
+
padding: 0 var(--space-2) var(--space-1) calc(44px + var(--space-3) + var(--space-2));
|
|
1003
|
+
}
|
|
1004
|
+
.home-root .chip.home-prow-copy {
|
|
1005
|
+
font-size: var(--type-xs);
|
|
1006
|
+
}
|
|
864
1007
|
/* live state on a project row (V2-3.3): AI working · Needs you · Resting (canvas 11 pn-bmore-st) */
|
|
865
1008
|
.home-root .chip.home-prow-ai {
|
|
866
1009
|
flex: none;
|
|
@@ -1569,15 +1712,36 @@
|
|
|
1569
1712
|
.home-ghosts > i {
|
|
1570
1713
|
display: block;
|
|
1571
1714
|
height: 84px;
|
|
1715
|
+
min-width: 0;
|
|
1572
1716
|
border-radius: var(--radius-md);
|
|
1573
|
-
background:
|
|
1717
|
+
background: transparent;
|
|
1574
1718
|
box-shadow: inset 0 0 0 1px var(--border-default);
|
|
1719
|
+
opacity: 0.6;
|
|
1720
|
+
}
|
|
1721
|
+
/* a shelf with nothing to draw: one quiet glyph beside the words, no ghost cards (the card stays as
|
|
1722
|
+
short as Recent canvases and Projects) */
|
|
1723
|
+
.home-shelf-row--lone {
|
|
1724
|
+
padding: var(--space-3) var(--space-4);
|
|
1725
|
+
overflow: hidden;
|
|
1726
|
+
}
|
|
1727
|
+
.home-shelf-row--lone .es-e {
|
|
1728
|
+
display: grid;
|
|
1729
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
1730
|
+
align-items: center;
|
|
1731
|
+
column-gap: var(--space-3);
|
|
1732
|
+
row-gap: 2px;
|
|
1575
1733
|
}
|
|
1576
|
-
.home-
|
|
1577
|
-
|
|
1734
|
+
.home-shelf-row--lone .es-e > .es-glyph {
|
|
1735
|
+
grid-row: 1 / span 2;
|
|
1578
1736
|
}
|
|
1579
|
-
.home-
|
|
1580
|
-
|
|
1737
|
+
.home-shelf-row--lone .es-e > :not(.es-glyph) {
|
|
1738
|
+
grid-column: 2;
|
|
1739
|
+
min-width: 0;
|
|
1740
|
+
}
|
|
1741
|
+
@media (max-width: 720px) {
|
|
1742
|
+
.home-two {
|
|
1743
|
+
grid-template-columns: minmax(0, 1fr);
|
|
1744
|
+
}
|
|
1581
1745
|
}
|
|
1582
1746
|
.island.home-shared {
|
|
1583
1747
|
display: flex;
|
|
@@ -30,6 +30,10 @@ export function shellModeHint(win = typeof window !== 'undefined' ? window : und
|
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/** The Home server's `/_config` answer the boot already read (null until then, or for a project). */
|
|
34
|
+
let bootConfig = null;
|
|
35
|
+
export const homeBootConfig = () => bootConfig;
|
|
36
|
+
|
|
33
37
|
/**
|
|
34
38
|
* Calls `render(mode, config)` once. Synchronously for a project the hint already names, so the
|
|
35
39
|
* project shell's first paint is unchanged; after one `/_config` request otherwise.
|
|
@@ -41,7 +45,10 @@ export function bootShellMode(render, win) {
|
|
|
41
45
|
return;
|
|
42
46
|
}
|
|
43
47
|
getConfig().then((r) => {
|
|
44
|
-
if (r.ok && r.json?.mode === 'home')
|
|
48
|
+
if (r.ok && r.json?.mode === 'home') {
|
|
49
|
+
bootConfig = r.json;
|
|
50
|
+
render('home', r.json);
|
|
51
|
+
}
|
|
45
52
|
// the Home window keeps Home even when its server is not answering yet: the page says so
|
|
46
53
|
else if (hint === 'home') render('home', null);
|
|
47
54
|
else render('project', null);
|
|
@@ -24,3 +24,37 @@ export async function probeCanvasOrigin(canvasOrigin, fetchImpl = fetch) {
|
|
|
24
24
|
return 'server';
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
/** 2.0.7 (#2) — how often a loading canvas whose build is still running is asked about again. */
|
|
29
|
+
export const BUILDING_RECHECK_MS = 15000;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The loading cap's question (2.0.7, #2): is this canvas still being built? A cold design system on a
|
|
33
|
+
* team server can need longer than the cap, and its frame now waits for the build (`importWhenBuilt`
|
|
34
|
+
* in _shell.html) — so while the server says `building`, the cap answers `building` and the studio
|
|
35
|
+
* keeps the loading screen instead of raising "can't be drawn right now" over a build that is fine.
|
|
36
|
+
* Otherwise the origin probe's answer, as before: `compile` (the origin is up, the canvas never drew)
|
|
37
|
+
* or `server`. Same-origin `/_api/canvas-errors`, the route the card itself reads.
|
|
38
|
+
*/
|
|
39
|
+
export async function loadCapVerdict({ path, canvasOrigin, fetchImpl = fetch }) {
|
|
40
|
+
try {
|
|
41
|
+
const r = await fetchImpl(`/_api/canvas-errors?canvas=${encodeURIComponent(path)}`, {
|
|
42
|
+
cache: 'no-store',
|
|
43
|
+
});
|
|
44
|
+
if (r.ok) {
|
|
45
|
+
const j = await r.json();
|
|
46
|
+
if (j && j.building === true && !(j.errors && j.errors.length)) return 'building';
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
/* no answer — the origin probe decides */
|
|
50
|
+
}
|
|
51
|
+
return probeCanvasOrigin(canvasOrigin, fetchImpl);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The reason the load-failure card names when the server recorded none (2.0.7): which wait ran out.
|
|
56
|
+
* `no-shell` — the canvas frame never started; `slow` — it started and never drew.
|
|
57
|
+
*/
|
|
58
|
+
export function capReason(shellAlive) {
|
|
59
|
+
return shellAlive ? 'slow' : 'no-shell';
|
|
60
|
+
}
|
|
@@ -24,7 +24,7 @@ import { shellToast, totalCounts } from '../shell/util.js';
|
|
|
24
24
|
import { assetTileSelected } from '../v2/assets/assets-bus.js';
|
|
25
25
|
import { selectionHasTakes } from '../v2/assets/takes.js';
|
|
26
26
|
import { keyOutcome } from '../v2/shell/role-gate.js';
|
|
27
|
-
import { ROLE_DENIAL } from '../v2/shell/use-canvas-mode-lane.js';
|
|
27
|
+
import { ROLE_DENIAL, shellMode } from '../v2/shell/use-canvas-mode-lane.js';
|
|
28
28
|
import { installFocusRescue } from '../v2/shell/modal-focus.js';
|
|
29
29
|
import { useAnnotationPrefsLane } from '../v2/shell/use-annotation-prefs.js';
|
|
30
30
|
import { singleKeysStore, useSingleKeysLane } from '../v2/shell/use-single-keys.js';
|
|
@@ -54,6 +54,8 @@ function shellState(d) {
|
|
|
54
54
|
assetTileSelected: assetTileSelected(),
|
|
55
55
|
// S8.16: the one selected picture has other takes — ← → step them (image.next-take / image.prev-take)
|
|
56
56
|
selectionHasTakes: selectionHasTakes(sel, d.activePath),
|
|
57
|
+
// 2.0.7 B2: the active canvas shows Pages — ⌥⌘P and the Present keys are off (greyed, the key swallowed)
|
|
58
|
+
pagesView: shellMode.get().pages === true,
|
|
57
59
|
};
|
|
58
60
|
}
|
|
59
61
|
|
|
@@ -1338,7 +1338,7 @@ export function useCanvasBridge({
|
|
|
1338
1338
|
// page it names is the open canvas (the frame is the proof, not the `file` it claims), and the
|
|
1339
1339
|
// next `loaded` (Reload canvas) retires it.
|
|
1340
1340
|
if (m.dgn === 'canvas-failed' && activePath)
|
|
1341
|
-
setCanvasError({ path: activePath, kind: 'compile' });
|
|
1341
|
+
setCanvasError({ path: activePath, kind: 'compile', reason: 'frame' });
|
|
1342
1342
|
}
|
|
1343
1343
|
} else if (m.dgn === 'loaded' && m.file) {
|
|
1344
1344
|
stampFollowRef.current.bump(); // a reloaded canvas carries the file's ids (stamp-follow.js)
|
|
@@ -22,7 +22,9 @@ import { menuRunner } from '../v2/shell/menu-runner.js';
|
|
|
22
22
|
import { panelAvailable as panelAvailableIn } from '../v2/shell/panel-availability.js';
|
|
23
23
|
import { keyHint, menuCtx, menuPaletteRows } from '../v2/shell/project-menu-model.js';
|
|
24
24
|
import { roleRefuses } from '../v2/shell/role-gate.js';
|
|
25
|
-
import { ROLE_DENIAL } from '../v2/shell/use-canvas-mode-lane.js';
|
|
25
|
+
import { ROLE_DENIAL, usePagesArtboard, usePagesView } from '../v2/shell/use-canvas-mode-lane.js';
|
|
26
|
+
import { artboardInView } from '../v2/left-panel/left-panel-model.js';
|
|
27
|
+
import { useLayersTreeRequest } from '../v2/layers/layers-request.js';
|
|
26
28
|
import { bindPaletteEnv, sendToAskAI } from '../v2/search/search-env.js';
|
|
27
29
|
import { desktopProjectsEnv } from '../v2/search/search-projects.js';
|
|
28
30
|
import { actionSearchRows, settingsSearchRows } from '../v2/search/search-model.js';
|
|
@@ -334,6 +336,19 @@ export function usePaletteAndPanels({
|
|
|
334
336
|
const clipRowsVersion = useClipRowsVersion(); // S7.16 — the clips of the video on the timeline, by name
|
|
335
337
|
// p8-v1-drop — the systems offered "Bring it up to the schema" (the Canvases panel publishes them)
|
|
336
338
|
const dsUpgradeOffers = useSyncExternalStore(onUpgradeOffers, upgradeOffersKey, upgradeOffersKey);
|
|
339
|
+
const pagesOn = usePagesView(); // 2.0.7 B2 — Preview / Present greyed, Next / Previous page on
|
|
340
|
+
const pagesAt = usePagesArtboard(); // 2.0.7 polish — the artboard on the page: the left panel marks it
|
|
341
|
+
// 2.0.7 fix (decision `v2-207-layers-current`) — Layers marks the artboard you are on and draws only its tree; a
|
|
342
|
+
// tree in hand for another artboard (late, or re-posted by the canvas) is answered by asking again for this one
|
|
343
|
+
const layersOnArtboard = artboardInView({ selected, activePath, pagesAt });
|
|
344
|
+
useLayersTreeRequest({
|
|
345
|
+
activePath,
|
|
346
|
+
want: layersOnArtboard,
|
|
347
|
+
have: layersTree ? (layersTree.artboardId ?? null) : null,
|
|
348
|
+
post: postToActiveCanvas,
|
|
349
|
+
delay: 400,
|
|
350
|
+
skip: activePath === SYSTEM_TAB,
|
|
351
|
+
});
|
|
337
352
|
const paletteActions = useMemo(() => {
|
|
338
353
|
const run = {
|
|
339
354
|
'canvas.new': () => openNewCanvasDialog(),
|
|
@@ -389,6 +404,7 @@ export function usePaletteAndPanels({
|
|
|
389
404
|
linkedHub: !!cloudLinkedHub?.url,
|
|
390
405
|
// p8-v1-drop — "Bring it up to the schema" is a ⌘K row while a system is below Conformant
|
|
391
406
|
dsUpgradeOffered: dsUpgradeOffers !== '',
|
|
407
|
+
pagesView: pagesOn,
|
|
392
408
|
});
|
|
393
409
|
// V2-4 gate (design blocker 6): a row's key is the registry's live chord in this shell, written by
|
|
394
410
|
// `formatChord` (⌥⇧⌘), or none — never v1's display string (New canvas "N" was Sticky's key, the
|
|
@@ -466,6 +482,7 @@ export function usePaletteAndPanels({
|
|
|
466
482
|
return [...v1, ...menuRows, ...leftRows, ...searchRows];
|
|
467
483
|
}, [
|
|
468
484
|
dsUpgradeOffers,
|
|
485
|
+
pagesOn,
|
|
469
486
|
cfg.cloud,
|
|
470
487
|
viewerMode,
|
|
471
488
|
activePath,
|
|
@@ -639,11 +656,9 @@ export function usePaletteAndPanels({
|
|
|
639
656
|
onDuplicateCanvas={duplicateCanvasReq}
|
|
640
657
|
onDeleteFile={deleteFileReq}
|
|
641
658
|
onCopyLink={copyCanvasLink}
|
|
642
|
-
// S1.3 — the artboard in view on the open canvas, so the jump list can highlight it
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
return sel && sel.file === activePath ? (sel.artboardId ?? null) : null;
|
|
646
|
-
})()}
|
|
659
|
+
// S1.3 — the artboard in view on the open canvas, so the jump list can highlight it (2.0.7 polish: in
|
|
660
|
+
// Pages, the artboard on the page)
|
|
661
|
+
activeArtboard={artboardInView({ selected, activePath, pagesAt })}
|
|
647
662
|
onRefresh={refreshTree}
|
|
648
663
|
onToggleShowHidden={() => menuRunner.run('view.hidden-files')}
|
|
649
664
|
refreshing={treeRefreshing}
|
|
@@ -793,6 +808,8 @@ export function usePaletteAndPanels({
|
|
|
793
808
|
// gate-b-polish3 — Layers by artboard: the open canvas's artboards, its name, a row selects one
|
|
794
809
|
layersBoards={id === 'layers' && activeCanvasFile ? boardLabels.get(activePath) : null}
|
|
795
810
|
layersCanvasName={activeCanvasFile ? displayName(basename(activeCanvasFile)) : ''}
|
|
811
|
+
// 2.0.7 fix — the artboard you are on (the page in Pages, else the selection's): Layers marks it
|
|
812
|
+
layersArtboard={layersOnArtboard}
|
|
796
813
|
onSelectArtboard={(artboardId) => postToActiveCanvas({ dgn: 'select-by-id', artboardId })}
|
|
797
814
|
onSelectBySelector={(selector) =>
|
|
798
815
|
postToActiveCanvas({ dgn: 'select-by-selector', v: 1, selector })
|
|
@@ -5,7 +5,12 @@ import { syncAnnotationsHiddenToast } from './annotations-hidden-toast.js';
|
|
|
5
5
|
import { acceptFromCanvas } from '../../bridge/dgn-protocol.ts';
|
|
6
6
|
import { persistUiPrefs, shellToast } from '../shell/util.js';
|
|
7
7
|
import { installDropGuard } from '../shell/drop-guard.js';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
togglePresentCanvas,
|
|
10
|
+
usePagesArtboard,
|
|
11
|
+
usePresentMode,
|
|
12
|
+
} from '../v2/shell/use-canvas-mode-lane.js';
|
|
13
|
+
import { layersArtboardOf, useLayersTreeRequest } from '../v2/layers/layers-request.js';
|
|
9
14
|
import {
|
|
10
15
|
ANNOT_STORE,
|
|
11
16
|
LAYERS_MODE_STORE,
|
|
@@ -662,13 +667,16 @@ export function usePhotoAndTimeline({
|
|
|
662
667
|
// the tree for the viewport-active artboard whenever it (or the canvas)
|
|
663
668
|
// changes, so Layers work in browse mode with no selection at all. Small
|
|
664
669
|
// debounce — the active-artboard signal can flicker during a fast pan.
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
670
|
+
// 2.0.7 fix (decision `v2-207-layers-current`) — asked for the artboard the person is ON (the page in Pages, else
|
|
671
|
+
// the selection's artboard, else the one in view), the same one Layers marks: a Layers pick or a page turn used to
|
|
672
|
+
// leave the tree — and the mark — on the artboard nearest the viewport centre.
|
|
673
|
+
const pagesAt = usePagesArtboard();
|
|
674
|
+
useLayersTreeRequest({
|
|
675
|
+
activePath,
|
|
676
|
+
want: layersArtboardOf({ selected, activePath, pagesAt, inView: canvasActiveArtboard }),
|
|
677
|
+
post: postToActiveCanvas,
|
|
678
|
+
skip: activePath === SYSTEM_TAB,
|
|
679
|
+
});
|
|
672
680
|
|
|
673
681
|
// feature-4 T7b — locked layer keys (`"<cdId>:<index>"`, per-user, per-canvas
|
|
674
682
|
// via view.json). Toggling PATCHes the FULL set (replace semantics) + pushes
|
|
@@ -24,8 +24,14 @@ export function useProjectData({
|
|
|
24
24
|
const loadTree = useCallback(() => treeLoaderRef.current?.reload() ?? Promise.resolve(), []);
|
|
25
25
|
useEffect(() => {
|
|
26
26
|
const loader = createIndexLoader({
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
// #207 — `fresh`: the last answer was a previous run's copy (`indexStale`); this one waits
|
|
28
|
+
// for the server's own build. `partial`: on the first open ever (no copy) the bare listing may
|
|
29
|
+
// answer first (`indexPartial`, also `indexStale`): the tree is drawn, the details follow.
|
|
30
|
+
read: async (signal, { fresh } = { fresh: false }) => {
|
|
31
|
+
const r = await fetch(fresh ? '/_index-data?fresh=1' : '/_index-data?partial=1', {
|
|
32
|
+
signal,
|
|
33
|
+
cache: 'no-store',
|
|
34
|
+
});
|
|
29
35
|
if (!r.ok)
|
|
30
36
|
throw Object.assign(new Error(`Project index request failed: ${r.status}`), {
|
|
31
37
|
status: r.status,
|
|
@@ -37,6 +43,7 @@ export function useProjectData({
|
|
|
37
43
|
}));
|
|
38
44
|
return { data, built };
|
|
39
45
|
},
|
|
46
|
+
isStale: ({ data }) => data?.indexStale === true,
|
|
40
47
|
apply: ({ data, built }) => {
|
|
41
48
|
setProject(data.project || 'Design');
|
|
42
49
|
setGroups(built);
|
|
@@ -63,6 +70,10 @@ export function useProjectData({
|
|
|
63
70
|
dsRevGaps: data.dsRevGaps ?? {},
|
|
64
71
|
// gate-b-c4j — canvases that import another canvas do not render; the stage says why (viewport.jsx).
|
|
65
72
|
canvasImportsCanvases: data.canvasImportsCanvases ?? {},
|
|
73
|
+
// 2.0.5 (#205) — canvases whose built module was refused for a file another canvas owns.
|
|
74
|
+
canvasRefusedInputs: data.canvasRefusedInputs ?? {},
|
|
75
|
+
// 2.0.7 — canvases with an import that resolves to no file: the stage names it (viewport.jsx).
|
|
76
|
+
canvasMissingImports: data.canvasMissingImports ?? {},
|
|
66
77
|
}));
|
|
67
78
|
},
|
|
68
79
|
onError: (error) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// hooks/use-shell-core.jsx — moved verbatim out of client/app.jsx (Maude v2 plan V2-0.2, move-only split).
|
|
2
2
|
|
|
3
3
|
import { editScopeQuery } from './edit-scope-query.js';
|
|
4
|
-
import {
|
|
4
|
+
import { BUILDING_RECHECK_MS, capReason, loadCapVerdict } from './canvas-origin-probe.js';
|
|
5
5
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
import {
|
|
7
7
|
layersTreeOf,
|
|
@@ -448,18 +448,28 @@ export function useShellCore({}) {
|
|
|
448
448
|
// without anything being wrong, so the cap stretches instead of calling it a
|
|
449
449
|
// failure. The shell reports a real build error itself (`canvas-failed`).
|
|
450
450
|
const shellAlive = !!loadingPath && loadedPath === loadingPath;
|
|
451
|
+
// 2.0.7 (#2) — and while the server says the canvas is still BUILDING, the cap waits on (re-asking
|
|
452
|
+
// every BUILDING_RECHECK_MS): a cold design system on a team server can need more than the cap, and
|
|
453
|
+
// its frame waits for the build. When the card does show, it carries which wait ran out (`reason`).
|
|
451
454
|
useEffect(() => {
|
|
452
455
|
if (!loadingPath) return;
|
|
453
456
|
const path = loadingPath;
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
457
|
+
let gone = false;
|
|
458
|
+
let cap;
|
|
459
|
+
const arm = (ms) => {
|
|
460
|
+
cap = setTimeout(async () => {
|
|
461
|
+
const kind = await loadCapVerdict({ path, canvasOrigin: cfg?.canvasOrigin });
|
|
462
|
+
if (gone) return;
|
|
463
|
+
if (kind === 'building') return arm(BUILDING_RECHECK_MS);
|
|
464
|
+
setCanvasError({ path, kind, reason: capReason(shellAlive) });
|
|
458
465
|
setLoadingPath((p) => (p === path ? null : p));
|
|
459
|
-
},
|
|
460
|
-
|
|
461
|
-
);
|
|
462
|
-
return () =>
|
|
466
|
+
}, ms);
|
|
467
|
+
};
|
|
468
|
+
arm(shellAlive ? 60000 : 15000);
|
|
469
|
+
return () => {
|
|
470
|
+
gone = true;
|
|
471
|
+
clearTimeout(cap);
|
|
472
|
+
};
|
|
463
473
|
}, [loadingPath, shellAlive, cfg?.canvasOrigin]);
|
|
464
474
|
// WHO IS SAVING THIS PROJECT — one expression, read by every surface that
|
|
465
475
|
// would otherwise offer to save it, poll for it, or badge it (DDR-218, widened
|
|
@@ -1,31 +1,45 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* One project-index request at a time, with automatic recovery from a real error.
|
|
3
|
+
*
|
|
4
|
+
* #207 — a request that is still pending is never aborted and never asked again: the server keeps
|
|
5
|
+
* every request for the index on ONE build (index-cache.ts), so a client timeout only threw the
|
|
6
|
+
* answer away and showed "taking a while — trying again…" on a project whose files are all local
|
|
7
|
+
* (StudyFi: 13 s per build, a 10 s client timeout). Only a failed request (an error status, a
|
|
8
|
+
* dropped connection) is retried, with a backoff.
|
|
9
|
+
*
|
|
10
|
+
* A previous run's copy (`isStale`) is drawn at once and then asked for again with `fresh`, which
|
|
11
|
+
* the server answers once its own build is done.
|
|
12
|
+
*/
|
|
2
13
|
export function createIndexLoader<T>({
|
|
3
14
|
read,
|
|
4
15
|
apply,
|
|
5
16
|
onError,
|
|
17
|
+
isStale,
|
|
6
18
|
retryDelayMs = 500,
|
|
7
19
|
maxRetryDelayMs = 5000,
|
|
8
|
-
|
|
9
|
-
|
|
20
|
+
staleRetryMs = 250,
|
|
21
|
+
maxStaleRetryMs = 2000,
|
|
10
22
|
}: {
|
|
11
|
-
read: (signal: AbortSignal) => Promise<T>;
|
|
23
|
+
read: (signal: AbortSignal, opts: { fresh: boolean }) => Promise<T>;
|
|
12
24
|
apply: (value: T) => void;
|
|
13
25
|
onError: (error: unknown) => void;
|
|
26
|
+
/** The answer is a previous run's copy: draw it, then ask for a fresh one. */
|
|
27
|
+
isStale?: (value: T) => boolean;
|
|
14
28
|
retryDelayMs?: number;
|
|
15
29
|
maxRetryDelayMs?: number;
|
|
16
|
-
|
|
17
|
-
|
|
30
|
+
staleRetryMs?: number;
|
|
31
|
+
maxStaleRetryMs?: number;
|
|
18
32
|
}) {
|
|
19
33
|
let disposed = false;
|
|
20
34
|
let dirty = false;
|
|
21
35
|
let failures = 0;
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
let timeoutsInARow = 0;
|
|
36
|
+
// A fresh answer is owed (the last one drawn was a copy); how many copies in a row.
|
|
37
|
+
let wantFresh = false;
|
|
38
|
+
let staleInARow = 0;
|
|
26
39
|
// #204 — nothing drawn yet: the first answer is drawn even if a refresh is already queued behind
|
|
27
40
|
// it (a materialising project asks for one per arriving file, so "only the freshest" was never).
|
|
28
41
|
let appliedOnce = false;
|
|
42
|
+
let appliedReal = false;
|
|
29
43
|
let pending: Promise<void> | null = null;
|
|
30
44
|
let retryTimer: ReturnType<typeof setTimeout> | undefined;
|
|
31
45
|
let controller: AbortController | undefined;
|
|
@@ -39,26 +53,33 @@ export function createIndexLoader<T>({
|
|
|
39
53
|
cancelRetry();
|
|
40
54
|
const current = new AbortController();
|
|
41
55
|
controller = current;
|
|
42
|
-
let timedOut = false;
|
|
43
|
-
const patience = Math.min(maxTimeoutMs, timeoutMs * 2 ** Math.min(timeoutsInARow, 10));
|
|
44
|
-
const timeout = setTimeout(() => {
|
|
45
|
-
timedOut = true;
|
|
46
|
-
current.abort();
|
|
47
|
-
}, patience);
|
|
48
56
|
try {
|
|
49
|
-
const value = await read(current.signal);
|
|
50
|
-
|
|
57
|
+
const value = await read(current.signal, { fresh: wantFresh });
|
|
58
|
+
const stale = isStale?.(value) === true;
|
|
51
59
|
// A mutation/refresh requested a newer index during this read. Do not
|
|
52
60
|
// briefly restore the older tree; the next request serves all waiters —
|
|
53
61
|
// unless there is no tree at all yet (#204): then this one is drawn.
|
|
54
62
|
if (!disposed && (!dirty || !appliedOnce)) {
|
|
55
|
-
|
|
63
|
+
// A copy never replaces a real answer already drawn.
|
|
64
|
+
if (!(stale && appliedReal)) apply(value);
|
|
56
65
|
appliedOnce = true;
|
|
66
|
+
if (!stale) appliedReal = true;
|
|
57
67
|
}
|
|
58
68
|
failures = 0;
|
|
69
|
+
if (stale && !disposed) {
|
|
70
|
+
// Ask again for the real one. A server that honours `fresh` answers once its build is
|
|
71
|
+
// done; one that does not (an older server) is asked again with a backoff.
|
|
72
|
+
wantFresh = true;
|
|
73
|
+
const delay = Math.min(maxStaleRetryMs, staleRetryMs * 2 ** Math.min(staleInARow++, 10));
|
|
74
|
+
retryTimer = setTimeout(() => {
|
|
75
|
+
void reload();
|
|
76
|
+
}, delay);
|
|
77
|
+
} else {
|
|
78
|
+
wantFresh = false;
|
|
79
|
+
staleInARow = 0;
|
|
80
|
+
}
|
|
59
81
|
} catch (error) {
|
|
60
82
|
if (disposed) return;
|
|
61
|
-
if (timedOut) timeoutsInARow++;
|
|
62
83
|
onError(error);
|
|
63
84
|
const status = (error as { status?: number } | null)?.status;
|
|
64
85
|
if (status == null || status === 408 || status === 429 || status >= 500) {
|
|
@@ -68,7 +89,6 @@ export function createIndexLoader<T>({
|
|
|
68
89
|
}, delay);
|
|
69
90
|
}
|
|
70
91
|
} finally {
|
|
71
|
-
clearTimeout(timeout);
|
|
72
92
|
if (controller === current) controller = undefined;
|
|
73
93
|
}
|
|
74
94
|
}
|