@1agh/maude 1.6.3 → 1.6.5
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/studio/api.ts +76 -13
- package/apps/studio/client/app.jsx +63 -14
- package/apps/studio/client/panels/file-preview.jsx +93 -6
- package/apps/studio/client/styles/3-shell-maude.css +54 -2
- package/apps/studio/dist/client.bundle.js +744 -744
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/materialize-client.ts +75 -0
- package/apps/studio/sync/index.ts +38 -7
- package/apps/studio/whats-new.json +9 -0
- package/package.json +8 -8
- package/plugins/design/templates/_shell.html +132 -0
package/apps/studio/api.ts
CHANGED
|
@@ -124,6 +124,7 @@ import {
|
|
|
124
124
|
} from './generation/audio-library.ts';
|
|
125
125
|
import { createHistory } from './history.ts';
|
|
126
126
|
import { clearLocatorSlug, readLocator, writeLocator } from './locator.ts';
|
|
127
|
+
import { listMaterializable } from './materialize-client.ts';
|
|
127
128
|
import { STICKERS_DIR } from './paths.ts';
|
|
128
129
|
import { getPaperPreset, MAX_PRINT_MM } from './print/units.ts';
|
|
129
130
|
import { sessionDir } from './session-scope.ts';
|
|
@@ -240,6 +241,66 @@ export async function findHtmlFiles(absRoot: string, prefixUnderRepo: string): P
|
|
|
240
241
|
* traversal instead of adding a second full walk of `system/` (the largest
|
|
241
242
|
* group) just to enumerate directories.
|
|
242
243
|
*/
|
|
244
|
+
/**
|
|
245
|
+
* Fold the cell's materializable media into a group's checkout listing.
|
|
246
|
+
*
|
|
247
|
+
* On a materializing cell the checkout is not where media lives (DDR-243): a
|
|
248
|
+
* fresh container holds none of it, and the materializer never writes it at
|
|
249
|
+
* its checkout path. Walking the disk alone listed every photo FOLDER and none
|
|
250
|
+
* of the photos. `rels` is the hub journal's answer (designRoot-relative); a
|
|
251
|
+
* path joins the group when it sits under the group, carries an extension the
|
|
252
|
+
* group lists, and would have survived `findFiles`' own skips. Mutates
|
|
253
|
+
* `filePaths` / `dirs` in place, keeps both sorted and duplicate-free.
|
|
254
|
+
*/
|
|
255
|
+
export function mergeMaterializable(
|
|
256
|
+
filePaths: string[],
|
|
257
|
+
dirs: string[],
|
|
258
|
+
rels: readonly string[],
|
|
259
|
+
{ designRel, groupPath, exts }: { designRel: string; groupPath: string; exts: readonly string[] }
|
|
260
|
+
): void {
|
|
261
|
+
const groupSegs = groupPath.split('/').filter(Boolean);
|
|
262
|
+
const groupPrefix = `${groupSegs.join('/')}/`;
|
|
263
|
+
const have = new Set(filePaths);
|
|
264
|
+
const haveDirs = new Set(dirs);
|
|
265
|
+
let added = false;
|
|
266
|
+
for (const rel of rels) {
|
|
267
|
+
if (!rel.startsWith(groupPrefix)) continue;
|
|
268
|
+
const lower = rel.toLowerCase();
|
|
269
|
+
if (!exts.some((x) => lower.endsWith(x))) continue;
|
|
270
|
+
const segs = rel.split('/');
|
|
271
|
+
// The same skips `findFiles` applies on the way down.
|
|
272
|
+
if (
|
|
273
|
+
segs.some(
|
|
274
|
+
(seg) =>
|
|
275
|
+
!seg ||
|
|
276
|
+
seg === '..' ||
|
|
277
|
+
seg.startsWith('_') ||
|
|
278
|
+
(seg.startsWith('.') && !HIDDEN_OK.has(seg)) ||
|
|
279
|
+
SKIP_DIRS.has(seg)
|
|
280
|
+
)
|
|
281
|
+
) {
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
const full = path.posix.join(designRel, rel);
|
|
285
|
+
if (have.has(full)) continue;
|
|
286
|
+
have.add(full);
|
|
287
|
+
filePaths.push(full);
|
|
288
|
+
added = true;
|
|
289
|
+
// Every folder between the group and the file, so the tree can nest it.
|
|
290
|
+
for (let i = groupSegs.length + 1; i < segs.length; i++) {
|
|
291
|
+
const dir = path.posix.join(designRel, ...segs.slice(0, i));
|
|
292
|
+
if (!haveDirs.has(dir)) {
|
|
293
|
+
haveDirs.add(dir);
|
|
294
|
+
dirs.push(dir);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (added) {
|
|
299
|
+
filePaths.sort((a, b) => a.localeCompare(b));
|
|
300
|
+
dirs.sort((a, b) => a.localeCompare(b));
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
243
304
|
export async function findFiles(
|
|
244
305
|
absRoot: string,
|
|
245
306
|
prefix: string,
|
|
@@ -6481,6 +6542,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
6481
6542
|
// we also include sibling .md / .css / .json so README, SKILL, and the
|
|
6482
6543
|
// tokens CSS file render in the tree per CV-08 mock. Inert at click time
|
|
6483
6544
|
// (FileRow non-HTML branch).
|
|
6545
|
+
// Cell materializer — the media the hub can serve although this checkout
|
|
6546
|
+
// does not hold it. `null` everywhere else (desktop, self-hosted hub).
|
|
6547
|
+
const materializable = await listMaterializable();
|
|
6484
6548
|
for (const g of cfg.canvasGroups) {
|
|
6485
6549
|
const groupAbs = path.join(paths.designRoot, g.path);
|
|
6486
6550
|
const groupRel = path.posix.join(paths.designRel, g.path);
|
|
@@ -6497,19 +6561,18 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
6497
6561
|
// traversal, so a freshly `mkdir`'d folder with no files yet is still
|
|
6498
6562
|
// representable in the tree.
|
|
6499
6563
|
const dirs: string[] = [];
|
|
6500
|
-
const
|
|
6501
|
-
?
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
);
|
|
6564
|
+
const groupExts = isDs
|
|
6565
|
+
? ['.tsx', '.html', '.md', '.css', '.json', ...PREVIEW_ASSET_EXTS]
|
|
6566
|
+
: ['.tsx', '.html', '.css', '.json', ...PREVIEW_ASSET_EXTS];
|
|
6567
|
+
const filePaths = await findFiles(groupAbs, groupRel, groupExts, dirs);
|
|
6568
|
+
// A materializing cell lists media its checkout does not hold.
|
|
6569
|
+
if (materializable) {
|
|
6570
|
+
mergeMaterializable(filePaths, dirs, materializable, {
|
|
6571
|
+
designRel: paths.designRel,
|
|
6572
|
+
groupPath: g.path,
|
|
6573
|
+
exts: PREVIEW_ASSET_EXTS,
|
|
6574
|
+
});
|
|
6575
|
+
}
|
|
6513
6576
|
// DDR-093 — record each `.tsx` canvas's design system. canvasUrl() only
|
|
6514
6577
|
// injects tokens for `.tsx`, so skip everything else. Path-owned DS wins
|
|
6515
6578
|
// (system/<ds>/…); otherwise the sidecar's `meta.designSystem`, defaulting
|
|
@@ -67,7 +67,7 @@ import { ReadinessDialog } from './panels/ReadinessList.jsx';
|
|
|
67
67
|
import IntroVideoDialog from './panels/IntroVideoDialog.jsx';
|
|
68
68
|
import BrandUploadPanel from './panels/BrandUploadPanel.jsx';
|
|
69
69
|
import FigmaImportPanel from './panels/FigmaImportPanel.jsx';
|
|
70
|
-
import { FilePreview, sanitizeDisplayText } from './panels/file-preview.jsx';
|
|
70
|
+
import { FilePreview, prefetchPreviewImage, sanitizeDisplayText } from './panels/file-preview.jsx';
|
|
71
71
|
import SetupChecklistDialog, { useSetupReadiness } from './panels/SetupChecklist.jsx';
|
|
72
72
|
import TimelinePanel from './panels/TimelinePanel.jsx';
|
|
73
73
|
import { parseCompTimeline } from './panels/timeline-parse.js';
|
|
@@ -239,6 +239,9 @@ function DockSlot({ side, width, open, ids, activeId, onPick, children, labels =
|
|
|
239
239
|
);
|
|
240
240
|
}
|
|
241
241
|
const CANVAS_EXT_RE = /\.(tsx|html?)$/i;
|
|
242
|
+
// A canvas the shell builds as a module and that reports `canvas-rendered`
|
|
243
|
+
// itself, as opposed to a legacy .html canvas that is drawn on `load`.
|
|
244
|
+
const isModuleCanvasPath = (p) => /\.(tsx|jsx)$/i.test(String(p || ''));
|
|
242
245
|
// feature-studio-file-preview — classifies a non-canvas tree row so FileRow
|
|
243
246
|
// can open an inline preview instead of the old inert no-op. Kept in sync
|
|
244
247
|
// with apps/studio/api.ts's PREVIEW_ASSET_EXTS (server won't list anything
|
|
@@ -2372,6 +2375,8 @@ function FileRow({
|
|
|
2372
2375
|
if (isCanvas) onOpen(file.path);
|
|
2373
2376
|
else if (pKind) onPreview?.(file.path);
|
|
2374
2377
|
}}
|
|
2378
|
+
onPointerEnter={pKind === 'image' ? () => prefetchPreviewImage(file.path) : undefined}
|
|
2379
|
+
onFocus={pKind === 'image' ? () => prefetchPreviewImage(file.path) : undefined}
|
|
2375
2380
|
onContextMenu={
|
|
2376
2381
|
canShare
|
|
2377
2382
|
? (e) =>
|
|
@@ -4842,14 +4847,7 @@ function Viewport({
|
|
|
4842
4847
|
// DS skeletons recipe — calm .skel pulse while the canvas-shell compiles
|
|
4843
4848
|
// the TSX. Cleared by the iframe's dgn:'loaded' message (or the onLoad
|
|
4844
4849
|
// fallback timer for legacy .html canvases that never post it).
|
|
4845
|
-
<
|
|
4846
|
-
<div className="st-skel-card">
|
|
4847
|
-
<div className="st-skel-cap st-mono">compiling canvas…</div>
|
|
4848
|
-
<span className="skel st-skel-thumb" />
|
|
4849
|
-
<span className="skel st-skel-line" style={{ width: '72%' }} />
|
|
4850
|
-
<span className="skel st-skel-line" style={{ width: '46%' }} />
|
|
4851
|
-
</div>
|
|
4852
|
-
</div>
|
|
4850
|
+
<CanvasLoading key={loadingPath} path={loadingPath} cloud={!!cfg?.cloud} />
|
|
4853
4851
|
)}
|
|
4854
4852
|
{canvasError && canvasError.path === activePath && (
|
|
4855
4853
|
// issue #115 — what the blank pane used to be. Names which of the two
|
|
@@ -4894,6 +4892,39 @@ function Viewport({
|
|
|
4894
4892
|
);
|
|
4895
4893
|
}
|
|
4896
4894
|
|
|
4895
|
+
// The canvas loading screen. OPAQUE on purpose: until the canvas reports
|
|
4896
|
+
// `canvas-rendered` the frame underneath is the bare shell — a white page,
|
|
4897
|
+
// and on a canvas with comments, pins floating over nothing — which reads as
|
|
4898
|
+
// "something broke". The card fades in after a beat so a warm canvas that
|
|
4899
|
+
// renders in a few hundred ms never flashes it; the hint after a few seconds
|
|
4900
|
+
// says why a cold canvas is slow instead of leaving the user to wonder.
|
|
4901
|
+
function CanvasLoading({ path, cloud }) {
|
|
4902
|
+
const [slow, setSlow] = useState(false);
|
|
4903
|
+
useEffect(() => {
|
|
4904
|
+
const t = setTimeout(() => setSlow(true), 4000);
|
|
4905
|
+
return () => clearTimeout(t);
|
|
4906
|
+
}, []);
|
|
4907
|
+
const name = sanitizeDisplayText(basename(path || '').replace(/\.(tsx|jsx|html?)$/i, ''));
|
|
4908
|
+
return (
|
|
4909
|
+
<div className="st-canvas-loading" role="status" aria-live="polite" data-testid="canvas-loading">
|
|
4910
|
+
<div className="st-skel-card">
|
|
4911
|
+
<div className="st-canvas-loading-head">
|
|
4912
|
+
<span className="st-canvas-loading-spinner" aria-hidden="true" />
|
|
4913
|
+
<span className="st-canvas-loading-title">Opening {name}…</span>
|
|
4914
|
+
</div>
|
|
4915
|
+
<span className="skel st-skel-thumb" aria-hidden="true" />
|
|
4916
|
+
<span className="skel st-skel-line" style={{ width: '72%' }} aria-hidden="true" />
|
|
4917
|
+
<span className="skel st-skel-line" style={{ width: '46%' }} aria-hidden="true" />
|
|
4918
|
+
<div className={'st-canvas-loading-hint' + (slow ? ' is-shown' : '')}>
|
|
4919
|
+
{cloud
|
|
4920
|
+
? 'Still working — the first open of a canvas fetches its images and fonts from cloud storage. It is quicker next time.'
|
|
4921
|
+
: 'Still working — large canvases take a moment to build.'}
|
|
4922
|
+
</div>
|
|
4923
|
+
</div>
|
|
4924
|
+
</div>
|
|
4925
|
+
);
|
|
4926
|
+
}
|
|
4927
|
+
|
|
4897
4928
|
// ---------- SystemView ----------
|
|
4898
4929
|
//
|
|
4899
4930
|
// DDR-048 — the System view renders the USER's design-system tokens. It does
|
|
@@ -10225,6 +10256,10 @@ function App() {
|
|
|
10225
10256
|
// the iframe load event arms a short fallback for legacy .html canvases that
|
|
10226
10257
|
// never post it; a hard cap guards against a canvas that dies mid-compile.
|
|
10227
10258
|
const onIframeLoad = useCallback((path) => {
|
|
10259
|
+
// A module canvas reports its own render; the iframe `load` event fires
|
|
10260
|
+
// long before it has drawn anything, so a timer here would only bring
|
|
10261
|
+
// back the white pane.
|
|
10262
|
+
if (isModuleCanvasPath(path)) return;
|
|
10228
10263
|
clearTimeout(loadFallbackTimer.current);
|
|
10229
10264
|
loadFallbackTimer.current = setTimeout(() => {
|
|
10230
10265
|
setLoadingPath((p) => (p === path ? null : p));
|
|
@@ -10266,6 +10301,11 @@ function App() {
|
|
|
10266
10301
|
// was written for. It reached the branch because the PR carried a merge
|
|
10267
10302
|
// conflict, which stops GitHub from building a merge ref, which means the
|
|
10268
10303
|
// client-boot gate never ran on it (issue #112 close-out).
|
|
10304
|
+
// Once the shell has said `loaded` the origin is demonstrably up and the
|
|
10305
|
+
// wait is the canvas building — on a cold cloud canvas that can outlast 15 s
|
|
10306
|
+
// without anything being wrong, so the cap stretches instead of calling it a
|
|
10307
|
+
// failure. The shell reports a real build error itself (`canvas-failed`).
|
|
10308
|
+
const shellAlive = !!loadingPath && loadedPath === loadingPath;
|
|
10269
10309
|
useEffect(() => {
|
|
10270
10310
|
if (!loadingPath) return;
|
|
10271
10311
|
const path = loadingPath;
|
|
@@ -10281,9 +10321,9 @@ function App() {
|
|
|
10281
10321
|
}
|
|
10282
10322
|
setCanvasError({ path, kind });
|
|
10283
10323
|
setLoadingPath((p) => (p === path ? null : p));
|
|
10284
|
-
}, 15000);
|
|
10324
|
+
}, shellAlive ? 60000 : 15000);
|
|
10285
10325
|
return () => clearTimeout(cap);
|
|
10286
|
-
}, [loadingPath, cfg?.canvasOrigin]);
|
|
10326
|
+
}, [loadingPath, shellAlive, cfg?.canvasOrigin]);
|
|
10287
10327
|
// WHO IS SAVING THIS PROJECT — one expression, read by every surface that
|
|
10288
10328
|
// would otherwise offer to save it, poll for it, or badge it (DDR-218, widened
|
|
10289
10329
|
// by feature-cloud-managed-git-posture).
|
|
@@ -13964,10 +14004,19 @@ function App() {
|
|
|
13964
14004
|
if (typeof m.artboardId === 'string') setCanvasActiveArtboard(m.artboardId.slice(0, 120));
|
|
13965
14005
|
setTimelineOpen(true);
|
|
13966
14006
|
}
|
|
13967
|
-
} else if (m.dgn === '
|
|
13968
|
-
//
|
|
13969
|
-
//
|
|
14007
|
+
} else if ((m.dgn === 'canvas-rendered' || m.dgn === 'canvas-failed') && m.file) {
|
|
14008
|
+
// The canvas drew (or its shell is now showing its own build error) —
|
|
14009
|
+
// only now drop the loading screen. See `loaded` below for why that
|
|
14010
|
+
// one is not enough.
|
|
13970
14011
|
setLoadingPath((p) => (p === m.file ? null : p));
|
|
14012
|
+
} else if (m.dgn === 'loaded' && m.file) {
|
|
14013
|
+
// The shell document ran — push current comments + carry over the
|
|
14014
|
+
// focused pin. For a TSX/JSX canvas this is NOT "drawn": the module
|
|
14015
|
+
// still has to build and render, which on a cold cloud canvas takes
|
|
14016
|
+
// seconds, and dropping the loading screen here showed a white pane
|
|
14017
|
+
// with bare comment pins. Those canvases clear it on `canvas-rendered`
|
|
14018
|
+
// / `canvas-failed`; a legacy .html canvas has nothing to wait for.
|
|
14019
|
+
if (!isModuleCanvasPath(m.file)) setLoadingPath((p) => (p === m.file ? null : p));
|
|
13971
14020
|
setLoadedPath(m.file);
|
|
13972
14021
|
// …and retire any #115 error panel for this canvas: it just proved it
|
|
13973
14022
|
// can load (a late load, or a successful Retry).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// static byte-serving route (no new server endpoint) and the chat panel's
|
|
4
4
|
// hand-rolled Markdown renderer — no new dependency.
|
|
5
5
|
|
|
6
|
-
import { useEffect, useState } from 'react';
|
|
6
|
+
import { useEffect, useRef, useState } from 'react';
|
|
7
7
|
import { Markdown } from './chat-markdown.jsx';
|
|
8
8
|
|
|
9
9
|
const TEXT_PREVIEW_MAX_BYTES = 2 * 1024 * 1024; // 2 MB — beyond this, just show a size note
|
|
@@ -91,6 +91,97 @@ function FontPreview({ url, name }) {
|
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
// On a cloud workspace an image the tree lists may not be on the cell's disk
|
|
95
|
+
// yet: the first request makes the hub fetch it from storage, and while that
|
|
96
|
+
// runs the static route answers 503 (retry shortly). An <img> treats that as
|
|
97
|
+
// a final failure and shows nothing — so retry with backoff and say what is
|
|
98
|
+
// happening, instead of leaving an empty frame.
|
|
99
|
+
const IMAGE_RETRY_DELAYS_MS = [1000, 2000, 3000, 4000, 6000, 8000, 10000];
|
|
100
|
+
|
|
101
|
+
function ImagePreview({ url, name }) {
|
|
102
|
+
const [attempt, setAttempt] = useState(0);
|
|
103
|
+
const [state, setState] = useState('loading'); // loading | loaded | error
|
|
104
|
+
const timer = useRef(null);
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
setAttempt(0);
|
|
107
|
+
setState('loading');
|
|
108
|
+
return () => clearTimeout(timer.current);
|
|
109
|
+
}, [url]);
|
|
110
|
+
const src = attempt === 0 ? url : `${url}?retry=${attempt}`;
|
|
111
|
+
const onError = () => {
|
|
112
|
+
if (attempt >= IMAGE_RETRY_DELAYS_MS.length) {
|
|
113
|
+
setState('error');
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
clearTimeout(timer.current);
|
|
117
|
+
timer.current = setTimeout(() => setAttempt((a) => a + 1), IMAGE_RETRY_DELAYS_MS[attempt]);
|
|
118
|
+
};
|
|
119
|
+
const retry = () => {
|
|
120
|
+
setState('loading');
|
|
121
|
+
setAttempt((a) => a + 1);
|
|
122
|
+
};
|
|
123
|
+
return (
|
|
124
|
+
<div className={'st-file-preview-image-wrap is-' + state} aria-busy={state === 'loading'}>
|
|
125
|
+
{state !== 'error' && (
|
|
126
|
+
<img
|
|
127
|
+
key={src}
|
|
128
|
+
src={src}
|
|
129
|
+
alt={`Preview: ${name}`}
|
|
130
|
+
className="st-file-preview-image"
|
|
131
|
+
decoding="async"
|
|
132
|
+
onLoad={() => setState('loaded')}
|
|
133
|
+
onError={onError}
|
|
134
|
+
/>
|
|
135
|
+
)}
|
|
136
|
+
{state === 'loading' && (
|
|
137
|
+
<div className="st-file-preview-loading" role="status" aria-live="polite">
|
|
138
|
+
<span className="st-file-preview-spinner" aria-hidden="true" />
|
|
139
|
+
<span>{attempt === 0 ? `Loading ${name}…` : 'Still fetching the photo — the first open of a large file can take a moment…'}</span>
|
|
140
|
+
</div>
|
|
141
|
+
)}
|
|
142
|
+
{state === 'error' && (
|
|
143
|
+
<div className="st-file-preview-loading st-file-preview-error" role="alert">
|
|
144
|
+
<span>Couldn't load {name}.</span>
|
|
145
|
+
<button type="button" className="btn btn--ghost" onClick={retry}>
|
|
146
|
+
Try again
|
|
147
|
+
</button>
|
|
148
|
+
</div>
|
|
149
|
+
)}
|
|
150
|
+
</div>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Warm the next photo before it is clicked: hovering a row starts the fetch,
|
|
155
|
+
// so by the time the click lands the bytes are on their way (or cached).
|
|
156
|
+
// One fetch per URL per session, at most two at once.
|
|
157
|
+
const prefetched = new Set();
|
|
158
|
+
const prefetchQueue = [];
|
|
159
|
+
let prefetchInFlight = 0;
|
|
160
|
+
function pumpPrefetch() {
|
|
161
|
+
while (prefetchInFlight < 2 && prefetchQueue.length) {
|
|
162
|
+
const u = prefetchQueue.shift();
|
|
163
|
+
prefetchInFlight++;
|
|
164
|
+
const img = new Image();
|
|
165
|
+
img.decoding = 'async';
|
|
166
|
+
const done = () => {
|
|
167
|
+
prefetchInFlight--;
|
|
168
|
+
// A cloud miss answers 503 while it fills — let a later hover try again.
|
|
169
|
+
if (!img.naturalWidth) prefetched.delete(u);
|
|
170
|
+
pumpPrefetch();
|
|
171
|
+
};
|
|
172
|
+
img.onload = done;
|
|
173
|
+
img.onerror = done;
|
|
174
|
+
img.src = u;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
export function prefetchPreviewImage(path) {
|
|
178
|
+
const u = `/${path}`;
|
|
179
|
+
if (prefetched.has(u)) return;
|
|
180
|
+
prefetched.add(u);
|
|
181
|
+
prefetchQueue.push(u);
|
|
182
|
+
pumpPrefetch();
|
|
183
|
+
}
|
|
184
|
+
|
|
94
185
|
export function FilePreview({ path, kind }) {
|
|
95
186
|
if (!path || !kind) return null;
|
|
96
187
|
const url = `/${path}`;
|
|
@@ -101,11 +192,7 @@ export function FilePreview({ path, kind }) {
|
|
|
101
192
|
<div className="st-file-preview-body">
|
|
102
193
|
{kind === 'markdown' && <TextPreview url={url} name={name} as="markdown" />}
|
|
103
194
|
{kind === 'text' && <TextPreview url={url} name={name} as="text" />}
|
|
104
|
-
{kind === 'image' &&
|
|
105
|
-
<div className="st-file-preview-image-wrap">
|
|
106
|
-
<img src={url} alt={`Preview: ${name}`} className="st-file-preview-image" />
|
|
107
|
-
</div>
|
|
108
|
-
)}
|
|
195
|
+
{kind === 'image' && <ImagePreview url={url} name={name} />}
|
|
109
196
|
{kind === 'video' && <video key={url} src={url} controls className="st-file-preview-media" />}
|
|
110
197
|
{kind === 'audio' && <audio key={url} src={url} controls className="st-file-preview-audio" />}
|
|
111
198
|
{kind === 'font' && <FontPreview url={url} name={name} />}
|
|
@@ -469,7 +469,28 @@
|
|
|
469
469
|
background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
|
|
470
470
|
border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
|
|
471
471
|
}
|
|
472
|
-
.st-file-preview-image {
|
|
472
|
+
.st-file-preview-image-wrap { position: relative; }
|
|
473
|
+
.st-file-preview-image-wrap.is-loading { min-height: 50vh; }
|
|
474
|
+
.st-file-preview-image {
|
|
475
|
+
max-width: 100%; max-height: 70vh; object-fit: contain;
|
|
476
|
+
transition: opacity var(--dur-soft) var(--ease-out);
|
|
477
|
+
}
|
|
478
|
+
/* Until it has fully arrived the photo stays hidden behind the status line —
|
|
479
|
+
* a half-painted or failed <img> reads as broken. */
|
|
480
|
+
.st-file-preview-image-wrap.is-loading .st-file-preview-image { opacity: 0; }
|
|
481
|
+
.st-file-preview-loading {
|
|
482
|
+
position: absolute; inset: 0;
|
|
483
|
+
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
484
|
+
gap: var(--space-3);
|
|
485
|
+
font-size: var(--type-sm); color: var(--fg-2);
|
|
486
|
+
}
|
|
487
|
+
.st-file-preview-image-wrap.is-error .st-file-preview-loading { position: static; padding: var(--space-6); }
|
|
488
|
+
.st-file-preview-spinner {
|
|
489
|
+
width: 20px; height: 20px; border-radius: 50%;
|
|
490
|
+
border: 2px solid var(--bg-3); border-top-color: var(--accent);
|
|
491
|
+
animation: st-spin 0.8s linear infinite;
|
|
492
|
+
}
|
|
493
|
+
@media (prefers-reduced-motion: reduce) { .st-file-preview-spinner { animation-duration: 2.4s; } }
|
|
473
494
|
.st-file-preview-media { max-width: 100%; max-height: 70vh; display: block; }
|
|
474
495
|
.st-file-preview-audio { width: 100%; }
|
|
475
496
|
.st-file-preview-font { display: flex; flex-direction: column; gap: var(--space-4); }
|
|
@@ -1554,11 +1575,42 @@ body.st-scrubbing, body.st-scrubbing * { cursor: ew-resize !important; user-sele
|
|
|
1554
1575
|
display: grid; place-items: center;
|
|
1555
1576
|
pointer-events: none;
|
|
1556
1577
|
z-index: 5;
|
|
1557
|
-
/*
|
|
1578
|
+
/* OPAQUE from the first frame — the frame underneath is the bare shell (a
|
|
1579
|
+
* white page, comment pins over nothing) until the canvas reports rendered. */
|
|
1580
|
+
background: var(--canvas-bg);
|
|
1581
|
+
}
|
|
1582
|
+
/* 180ms appearance delay on the CARD — warm canvases mount in <150ms and never
|
|
1583
|
+
* flash it; the backdrop above is immediate so nothing white shows through. */
|
|
1584
|
+
.st-canvas-loading > .st-skel-card {
|
|
1558
1585
|
opacity: 0;
|
|
1559
1586
|
animation: st-loading-in var(--dur-soft) var(--ease-out) 180ms forwards;
|
|
1560
1587
|
}
|
|
1561
1588
|
@keyframes st-loading-in { to { opacity: 1; } }
|
|
1589
|
+
.st-canvas-loading-head {
|
|
1590
|
+
display: flex; align-items: center; gap: var(--space-2);
|
|
1591
|
+
min-width: 0;
|
|
1592
|
+
}
|
|
1593
|
+
.st-canvas-loading-title {
|
|
1594
|
+
font-size: var(--type-sm); color: var(--fg-1);
|
|
1595
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
1596
|
+
}
|
|
1597
|
+
.st-canvas-loading-spinner {
|
|
1598
|
+
flex: none;
|
|
1599
|
+
width: 14px; height: 14px;
|
|
1600
|
+
border-radius: 50%;
|
|
1601
|
+
border: 2px solid var(--bg-3);
|
|
1602
|
+
border-top-color: var(--accent);
|
|
1603
|
+
animation: st-spin 0.8s linear infinite;
|
|
1604
|
+
}
|
|
1605
|
+
@keyframes st-spin { to { transform: rotate(360deg); } }
|
|
1606
|
+
.st-canvas-loading-hint {
|
|
1607
|
+
font-size: var(--type-xs); line-height: 1.45; color: var(--fg-2);
|
|
1608
|
+
opacity: 0; transition: opacity var(--dur-soft) var(--ease-out);
|
|
1609
|
+
}
|
|
1610
|
+
.st-canvas-loading-hint.is-shown { opacity: 1; }
|
|
1611
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1612
|
+
.st-canvas-loading-spinner { animation-duration: 2.4s; }
|
|
1613
|
+
}
|
|
1562
1614
|
.st-skel-card {
|
|
1563
1615
|
width: 300px;
|
|
1564
1616
|
display: flex; flex-direction: column; gap: var(--space-3);
|