@1agh/maude 2.0.6 → 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/studio/access/closure.ts +156 -16
- package/apps/studio/access/filters.ts +27 -0
- package/apps/studio/actions/agents.ts +54 -0
- package/apps/studio/actions/ctx.ts +3 -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 +136 -1
- package/apps/studio/actions.parity.json +25 -1
- package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
- package/apps/studio/annotations/ui/ride.ts +2 -1
- package/apps/studio/annotations-context-toolbar.tsx +5 -4
- package/apps/studio/annotations-layer.tsx +4 -3
- package/apps/studio/api.ts +383 -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 +414 -45
- package/apps/studio/artboard-live.ts +526 -31
- 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 +2 -1
- package/apps/studio/asset-placeholder.tsx +237 -132
- package/apps/studio/asset-upload-bars.tsx +4 -4
- package/apps/studio/bin/_perf-probe-open.mjs +364 -0
- package/apps/studio/bin/_perf-shared.mjs +12 -7
- package/apps/studio/bin/_pw-launch.mjs +26 -1
- package/apps/studio/bin/perf.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 +160 -34
- 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 +23 -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 +11 -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/shell/viewport.jsx +32 -16
- package/apps/studio/client/tree/tree.jsx +17 -0
- 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 +7 -3
- package/apps/studio/client/v2/code/canvas-imports-words.js +16 -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-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/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/shell/canvas-crash-guard.js +40 -5
- 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/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-menu-model.js +3 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +3 -1
- package/apps/studio/client/v2/shell/shell-parity.json +8 -0
- package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +30 -0
- package/apps/studio/comments-overlay.tsx +12 -11
- package/apps/studio/config-reload-wire.ts +4 -1
- package/apps/studio/config.schema.json +6 -0
- package/apps/studio/context.ts +37 -1
- package/apps/studio/dist/client.bundle.js +720 -720
- 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 +6 -3
- package/apps/studio/ds/board/template.ts +39 -19
- package/apps/studio/ds/cli.ts +7 -1
- package/apps/studio/ds/component-list.ts +2 -1
- package/apps/studio/ds/default.ts +6 -1
- package/apps/studio/ds/ds-resolver.ts +58 -8
- 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/rename.ts +10 -3
- package/apps/studio/ds/shell-fallbacks.ts +2 -1
- package/apps/studio/ds/upgrade-stage.ts +6 -2
- 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/http.ts +66 -32
- 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/sync.ts +176 -0
- package/apps/studio/safe-zones-overlay.tsx +3 -2
- package/apps/studio/skip-dirs.ts +103 -47
- package/apps/studio/studio-page-host.ts +70 -0
- package/apps/studio/sync/code-module-consent.ts +86 -0
- package/apps/studio/sync/file-ledger.ts +24 -0
- package/apps/studio/sync/file-plane.ts +458 -53
- package/apps/studio/sync/held-deletes.ts +230 -0
- package/apps/studio/sync/hubs-config.ts +59 -2
- package/apps/studio/sync/index.ts +99 -15
- package/apps/studio/sync/seed-progress.ts +92 -2
- package/apps/studio/sync/settings.ts +36 -1
- package/apps/studio/sync/status.ts +15 -1
- package/apps/studio/sync/writer-registry.ts +5 -0
- package/apps/studio/text-caret.ts +5 -3
- package/apps/studio/toolbars/toolbar-rect.ts +3 -2
- 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 +55 -42
- package/apps/studio/video-play-overlay.tsx +4 -3
- package/apps/studio/whats-new.json +27 -0
- package/cli/commands/design.mjs +5 -2
- package/cli/commands/hub.mjs +10 -1
- package/cli/lib/bash-guard.mjs +14 -0
- package/cli/lib/design-help.gen.mjs +1 -1
- package/cli/lib/design-link.mjs +42 -17
- package/cli/lib/hub-purge.mjs +183 -0
- package/package.json +8 -8
- package/plugins/design/templates/_shell.html +164 -1
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import { type GlCandidate, planWebgl, WEBGL_LIVE_CAP } from './artboard-live.ts';
|
|
27
|
+
import { frameRaf } from './frame-clock.ts';
|
|
27
28
|
|
|
28
29
|
type GL = WebGLRenderingContext | WebGL2RenderingContext;
|
|
29
30
|
type LoseExt = { loseContext(): void; restoreContext(): void };
|
|
@@ -190,7 +191,7 @@ export class WebglBudget {
|
|
|
190
191
|
this.frame =
|
|
191
192
|
opts.frame ??
|
|
192
193
|
((fn) => {
|
|
193
|
-
if (typeof requestAnimationFrame === 'function')
|
|
194
|
+
if (typeof requestAnimationFrame === 'function') frameRaf(() => fn());
|
|
194
195
|
else setTimeout(fn, 16);
|
|
195
196
|
});
|
|
196
197
|
}
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
|
|
22
22
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
23
23
|
import { createPortal } from 'react-dom';
|
|
24
|
-
|
|
25
24
|
import { UploadBars } from './asset-upload-bars.tsx';
|
|
26
25
|
import { type AssetStateItem, acceptFromShell } from './bridge/dgn-protocol.ts';
|
|
26
|
+
import { frameCaf, frameRaf } from './frame-clock.ts';
|
|
27
27
|
|
|
28
28
|
/** What a frame says. `null` = draw nothing (the picture is here, or still uploading from here). */
|
|
29
29
|
export interface FrameWords {
|
|
@@ -192,6 +192,8 @@ const CSS = `
|
|
|
192
192
|
position: fixed; inset: 0; z-index: 6; pointer-events: none;
|
|
193
193
|
font: 12px/1.35 var(--font-body, system-ui, -apple-system, sans-serif);
|
|
194
194
|
}
|
|
195
|
+
.dc-absent-ride { position: fixed; left: 0; top: 0; width: 0; height: 0; overflow: visible;
|
|
196
|
+
transform-origin: 0 0; will-change: transform; }
|
|
195
197
|
:root[data-maude-theme="dark"] .dc-absent-layer {
|
|
196
198
|
--dc-absent-bg: oklch(0.25 0.006 250);
|
|
197
199
|
--dc-absent-stripe: oklch(0.3 0.008 250);
|
|
@@ -242,6 +244,34 @@ interface Frame {
|
|
|
242
244
|
words: FrameWords;
|
|
243
245
|
/** r4 img 44: no shell state explained this failure, so the frame names the path it asked for. */
|
|
244
246
|
lost?: boolean;
|
|
247
|
+
/** 2.0.7 — the canvas world the picture sits in: its frame rides the camera (null: a picture outside the world). */
|
|
248
|
+
world: HTMLElement | null;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** The camera the canvas last wrote (canvas-lib `getLiveViewport`): screen = canvas origin + (x, y) + zoom · world. */
|
|
252
|
+
export interface FrameCamera {
|
|
253
|
+
x: number;
|
|
254
|
+
y: number;
|
|
255
|
+
zoom: number;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const sameCamera = (a: FrameCamera, b: FrameCamera) =>
|
|
259
|
+
a.x === b.x && a.y === b.y && a.zoom === b.zoom;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* 2.0.7 — the transform that carries frames measured under camera `at` (world origin `origin` on screen then) to
|
|
263
|
+
* where camera `now` puts them. The world moved by (now − at) and scaled by now.zoom / at.zoom about its origin, so a
|
|
264
|
+
* point p measured then is now at origin' + k·(p − origin): translate(origin' − k·origin) scale(k).
|
|
265
|
+
*/
|
|
266
|
+
export function rideTransform(
|
|
267
|
+
at: FrameCamera,
|
|
268
|
+
origin: { left: number; top: number },
|
|
269
|
+
now: FrameCamera
|
|
270
|
+
): string {
|
|
271
|
+
const k = now.zoom / (at.zoom || 1);
|
|
272
|
+
const ox = origin.left + (now.x - at.x);
|
|
273
|
+
const oy = origin.top + (now.y - at.y);
|
|
274
|
+
return `translate(${ox - k * origin.left}px, ${oy - k * origin.top}px) scale(${k})`;
|
|
245
275
|
}
|
|
246
276
|
|
|
247
277
|
/** A failed picture or clip is asked for again (its first answer may have been refused before the canvas write landed). */
|
|
@@ -250,14 +280,26 @@ const retriable = (el: Media): boolean =>
|
|
|
250
280
|
|
|
251
281
|
const baseName = (rel: string) => rel.slice(rel.lastIndexOf('/') + 1);
|
|
252
282
|
|
|
283
|
+
/** The canvas world (`.dc-world`, canvas-lib) a picture sits in, if any. */
|
|
284
|
+
const worldOf = (el: Element): HTMLElement | null => el.closest<HTMLElement>('.dc-world');
|
|
285
|
+
|
|
253
286
|
/** The layer. Mounted once by DesignCanvas (canvas-lib's named S8.19 block). */
|
|
254
287
|
export function AssetPlaceholderLayer({
|
|
255
288
|
inShell,
|
|
256
289
|
retryDelays = LOST_RETRY_DELAYS_MS,
|
|
290
|
+
camera,
|
|
291
|
+
interacting,
|
|
257
292
|
}: {
|
|
258
293
|
/** Test seam: the layer only judges pictures inside the shell's frame (an export capture carries no frames). */
|
|
259
294
|
inShell?: boolean;
|
|
260
295
|
retryDelays?: readonly number[];
|
|
296
|
+
/**
|
|
297
|
+
* 2.0.7 — the live camera (DesignCanvas passes canvas-lib's `getLiveViewport`). With it, a frame over a picture in
|
|
298
|
+
* the world rides a camera move on one transform instead of a layout read per frame. Omitted: every frame measures.
|
|
299
|
+
*/
|
|
300
|
+
camera?: () => FrameCamera | null;
|
|
301
|
+
/** 2.0.7 — a pan / zoom gesture is running (the controller's `isInteracting`): nothing is measured until it ends. */
|
|
302
|
+
interacting?: boolean;
|
|
261
303
|
} = {}) {
|
|
262
304
|
const [items, setItems] = useState<ReadonlyMap<string, AssetStateItem>>(new Map());
|
|
263
305
|
const [frames, setFrames] = useState<Frame[]>([]);
|
|
@@ -335,7 +377,7 @@ export function AssetPlaceholderLayer({
|
|
|
335
377
|
const rel = known.size ? relOfSrc(raw, resolved, known) : null;
|
|
336
378
|
const words = rel ? frameWords(items.get(rel)) : null;
|
|
337
379
|
if (rel && words) {
|
|
338
|
-
next.push({ key: `${rel}#${i}`, rel, el, words });
|
|
380
|
+
next.push({ key: `${rel}#${i}`, rel, el, words, world: worldOf(el) });
|
|
339
381
|
return;
|
|
340
382
|
}
|
|
341
383
|
if (!inside || !lost.errored.has(el)) return;
|
|
@@ -354,13 +396,17 @@ export function AssetPlaceholderLayer({
|
|
|
354
396
|
relink: false,
|
|
355
397
|
},
|
|
356
398
|
lost: true,
|
|
399
|
+
world: worldOf(el),
|
|
357
400
|
});
|
|
358
401
|
});
|
|
359
402
|
setFrames((prev) =>
|
|
360
403
|
prev.length === next.length &&
|
|
361
404
|
prev.every(
|
|
362
405
|
(p, i) =>
|
|
363
|
-
p.key === next[i]?.key &&
|
|
406
|
+
p.key === next[i]?.key &&
|
|
407
|
+
p.el === next[i]?.el &&
|
|
408
|
+
p.words.line === next[i]?.words.line &&
|
|
409
|
+
p.world === next[i]?.world
|
|
364
410
|
)
|
|
365
411
|
? prev
|
|
366
412
|
: next
|
|
@@ -389,6 +435,17 @@ export function AssetPlaceholderLayer({
|
|
|
389
435
|
if (failed(el) && src && !/\.svg(?:[?#]|$)/i.test(src)) fail(el);
|
|
390
436
|
});
|
|
391
437
|
scan();
|
|
438
|
+
// 2.0.7 — one scan per burst, not one per event: a heavy canvas mounting artboard after artboard fires a
|
|
439
|
+
// mutation and an image `load` per picture, and every scan walks every <img>/<video> of the document
|
|
440
|
+
// (quadratic in pictures while it loads — the mascot canvas spent ~130 ms of a pan here).
|
|
441
|
+
let scanTimer: ReturnType<typeof setTimeout> | null = null;
|
|
442
|
+
const scanSoon = () => {
|
|
443
|
+
if (scanTimer != null) return;
|
|
444
|
+
scanTimer = setTimeout(() => {
|
|
445
|
+
scanTimer = null;
|
|
446
|
+
scan();
|
|
447
|
+
}, 120);
|
|
448
|
+
};
|
|
392
449
|
const onMedia = (ev?: Event) => {
|
|
393
450
|
const el = ev?.target as Media | undefined;
|
|
394
451
|
const isMedia = el instanceof HTMLImageElement || el instanceof HTMLVideoElement;
|
|
@@ -398,8 +455,13 @@ export function AssetPlaceholderLayer({
|
|
|
398
455
|
const t = pending.get(el);
|
|
399
456
|
if (t) clearTimeout(t);
|
|
400
457
|
pending.delete(el);
|
|
401
|
-
} else if (isMedia && ev?.type === 'error')
|
|
402
|
-
|
|
458
|
+
} else if (isMedia && ev?.type === 'error') {
|
|
459
|
+
// a failure is rare and its frame must show at once (r5-1): scan now; loads and mutations batch
|
|
460
|
+
fail(el);
|
|
461
|
+
scan();
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
scanSoon();
|
|
403
465
|
};
|
|
404
466
|
document.addEventListener('error', onMedia, true);
|
|
405
467
|
document.addEventListener('load', onMedia, true);
|
|
@@ -414,160 +476,203 @@ export function AssetPlaceholderLayer({
|
|
|
414
476
|
document.removeEventListener('error', onMedia, true);
|
|
415
477
|
document.removeEventListener('load', onMedia, true);
|
|
416
478
|
mo.disconnect();
|
|
479
|
+
if (scanTimer != null) clearTimeout(scanTimer);
|
|
417
480
|
for (const t of lost.timers) clearTimeout(t);
|
|
418
481
|
lost.timers.clear();
|
|
419
482
|
};
|
|
420
483
|
}, [items, known, inShell, retryDelays]);
|
|
421
484
|
|
|
422
485
|
// One animation-frame loop while any frame exists: follow each element's on-screen rectangle.
|
|
486
|
+
//
|
|
487
|
+
// 2.0.7 — not by reading layout while the camera moves. Measuring every frame was a getBoundingClientRect per
|
|
488
|
+
// missing picture (more for a collapsed one, frameBox walks up) in every frame of a pan or zoom: ~40 ms a frame
|
|
489
|
+
// in WebKit on the mascot canvas (59 missing pictures). The frames stay in this body layer — inside `.dc-world`
|
|
490
|
+
// the input router would claim their buttons (isOverlayTarget refuses anything in the world) — so a frame over a
|
|
491
|
+
// picture in the world rides the camera instead: the wrapper takes one transform computed from the camera
|
|
492
|
+
// numbers (rideTransform), and the frames are measured again on the first frame the camera is still and no
|
|
493
|
+
// gesture runs. With no camera (an older mount, a test page), every frame measures as before.
|
|
494
|
+
const interactingRef = useRef(!!interacting);
|
|
495
|
+
interactingRef.current = !!interacting;
|
|
496
|
+
const cameraRef = useRef(camera);
|
|
497
|
+
cameraRef.current = camera;
|
|
498
|
+
const rideRef = useRef<HTMLDivElement | null>(null);
|
|
499
|
+
const rideWorld = camera ? (frames.find((f) => f.world)?.world ?? null) : null;
|
|
423
500
|
useEffect(() => {
|
|
424
501
|
if (frames.length === 0) return;
|
|
425
502
|
let raf: number | null = null;
|
|
503
|
+
let last: FrameCamera | null = null; // the camera on the previous frame
|
|
504
|
+
let at: FrameCamera | null = null; // the camera the riding frames were last measured under
|
|
505
|
+
let origin = { left: 0, top: 0 }; // the world's origin on screen then
|
|
506
|
+
const written = new Map<HTMLDivElement, string>();
|
|
507
|
+
const place = (f: Frame, div: HTMLDivElement) => {
|
|
508
|
+
const r = f.el.isConnected ? frameBox(f.el) : null;
|
|
509
|
+
const box =
|
|
510
|
+
!r || r.width < 2 || r.height < 2
|
|
511
|
+
? 'none'
|
|
512
|
+
: `${Math.round(r.left)} ${Math.round(r.top)} ${Math.round(r.width)} ${Math.round(r.height)}`;
|
|
513
|
+
if (written.get(div) === box) return;
|
|
514
|
+
written.set(div, box);
|
|
515
|
+
if (!r || box === 'none') {
|
|
516
|
+
div.style.display = 'none';
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
div.style.display = 'grid';
|
|
520
|
+
div.style.left = `${Math.round(r.left)}px`;
|
|
521
|
+
div.style.top = `${Math.round(r.top)}px`;
|
|
522
|
+
div.style.width = `${Math.round(r.width)}px`;
|
|
523
|
+
div.style.height = `${Math.round(r.height)}px`;
|
|
524
|
+
};
|
|
525
|
+
const setRide = (t: string) => {
|
|
526
|
+
const ride = rideRef.current;
|
|
527
|
+
if (ride && ride.style.transform !== t) ride.style.transform = t;
|
|
528
|
+
};
|
|
426
529
|
const tick = () => {
|
|
427
530
|
raf = null;
|
|
531
|
+
const cam = rideWorld ? (cameraRef.current?.() ?? null) : null;
|
|
532
|
+
const moved = !!cam && !!last && !sameCamera(cam, last);
|
|
533
|
+
last = cam;
|
|
534
|
+
const riding = !!cam && (moved || interactingRef.current);
|
|
535
|
+
if (riding && cam) {
|
|
536
|
+
// the camera is moving (or a gesture holds it): carry what was measured, read nothing
|
|
537
|
+
if (at) setRide(rideTransform(at, origin, cam));
|
|
538
|
+
} else if (cam && rideWorld) {
|
|
539
|
+
const o = rideWorld.getBoundingClientRect();
|
|
540
|
+
origin = { left: o.left, top: o.top };
|
|
541
|
+
at = cam;
|
|
542
|
+
setRide('');
|
|
543
|
+
}
|
|
428
544
|
for (const f of frames) {
|
|
545
|
+
if (riding && f.world === rideWorld) continue;
|
|
429
546
|
const div = nodes.current.get(f.key);
|
|
430
|
-
if (
|
|
431
|
-
const r = f.el.isConnected ? frameBox(f.el) : null;
|
|
432
|
-
if (!r || r.width < 2 || r.height < 2) {
|
|
433
|
-
div.style.display = 'none';
|
|
434
|
-
continue;
|
|
435
|
-
}
|
|
436
|
-
div.style.display = 'grid';
|
|
437
|
-
div.style.left = `${Math.round(r.left)}px`;
|
|
438
|
-
div.style.top = `${Math.round(r.top)}px`;
|
|
439
|
-
div.style.width = `${Math.round(r.width)}px`;
|
|
440
|
-
div.style.height = `${Math.round(r.height)}px`;
|
|
547
|
+
if (div) place(f, div);
|
|
441
548
|
}
|
|
442
|
-
raf =
|
|
549
|
+
raf = frameRaf(tick);
|
|
443
550
|
};
|
|
444
|
-
raf =
|
|
551
|
+
raf = frameRaf(tick);
|
|
445
552
|
return () => {
|
|
446
|
-
if (raf != null)
|
|
553
|
+
if (raf != null) frameCaf(raf);
|
|
447
554
|
};
|
|
448
|
-
}, [frames]);
|
|
555
|
+
}, [frames, rideWorld]);
|
|
449
556
|
|
|
450
557
|
if (typeof document === 'undefined') return null;
|
|
451
558
|
// S8.14 — a picture still going up wears a thin bar (asset-upload-bars.tsx); it is a sibling layer, so it needs no frame
|
|
452
559
|
const bars = <UploadBars items={items} relOf={relOfSrc} />;
|
|
453
560
|
if (frames.length === 0) return bars;
|
|
561
|
+
const draw = (f: Frame) => {
|
|
562
|
+
const lfs = f.words.state === 'lfs-pointer' && lfsActions && !f.lost;
|
|
563
|
+
const copyWord = copied.get(f.rel);
|
|
564
|
+
return (
|
|
565
|
+
// biome-ignore lint/a11y/useAriaPropsSupportedByRole: role is `group` or `img` (both take a name)
|
|
566
|
+
<div
|
|
567
|
+
key={f.key}
|
|
568
|
+
ref={(el) => {
|
|
569
|
+
if (el) nodes.current.set(f.key, el);
|
|
570
|
+
else nodes.current.delete(f.key);
|
|
571
|
+
}}
|
|
572
|
+
className="dc-absent"
|
|
573
|
+
data-testid="asset-frame"
|
|
574
|
+
data-rel={f.rel}
|
|
575
|
+
data-state={f.words.state}
|
|
576
|
+
data-lost={f.lost ? '1' : undefined}
|
|
577
|
+
// gate-b-a11y: `img` cannot hold the Relink… button (axe nested-interactive) — a labelled group can
|
|
578
|
+
role={f.words.relink || lfs ? 'group' : 'img'}
|
|
579
|
+
aria-label={
|
|
580
|
+
f.lost && f.words.line === LOST_VIDEO_LINE
|
|
581
|
+
? `${f.words.line} · ${f.rel}`
|
|
582
|
+
: `${f.lost ? f.rel : baseName(f.rel)} · ${f.words.line}`
|
|
583
|
+
}
|
|
584
|
+
>
|
|
585
|
+
<span className="dc-absent-in">
|
|
586
|
+
<svg
|
|
587
|
+
className="dc-absent-ic"
|
|
588
|
+
width="16"
|
|
589
|
+
height="16"
|
|
590
|
+
viewBox="0 0 16 16"
|
|
591
|
+
fill="none"
|
|
592
|
+
stroke="currentColor"
|
|
593
|
+
strokeWidth="1.4"
|
|
594
|
+
strokeLinecap="round"
|
|
595
|
+
strokeLinejoin="round"
|
|
596
|
+
aria-hidden="true"
|
|
597
|
+
>
|
|
598
|
+
<path d="M8 2.2 14.2 13H1.8z" />
|
|
599
|
+
<path d="M8 6.4v3.2" />
|
|
600
|
+
<circle cx="8" cy="11.3" r="0.4" fill="currentColor" />
|
|
601
|
+
</svg>
|
|
602
|
+
<span className="dc-absent-n">{f.lost ? f.rel : baseName(f.rel)}</span>
|
|
603
|
+
<span className="dc-absent-d">{f.words.line}</span>
|
|
604
|
+
{f.words.relink ? (
|
|
605
|
+
<button
|
|
606
|
+
type="button"
|
|
607
|
+
className="dc-absent-btn"
|
|
608
|
+
data-testid="asset-frame-relink"
|
|
609
|
+
onClick={() => {
|
|
610
|
+
// A literal `{ dgn }` so the bridge inventory sees this send site.
|
|
611
|
+
try {
|
|
612
|
+
window.parent.postMessage({ dgn: 'asset-relink-request', rel: f.rel }, '*');
|
|
613
|
+
} catch {
|
|
614
|
+
/* detached */
|
|
615
|
+
}
|
|
616
|
+
}}
|
|
617
|
+
>
|
|
618
|
+
Relink…
|
|
619
|
+
</button>
|
|
620
|
+
) : null}
|
|
621
|
+
{lfs ? (
|
|
622
|
+
<span className="dc-absent-row">
|
|
623
|
+
<button
|
|
624
|
+
type="button"
|
|
625
|
+
className="dc-absent-btn"
|
|
626
|
+
data-testid="asset-frame-lfs-fix"
|
|
627
|
+
onClick={() => {
|
|
628
|
+
// A literal `{ dgn }` so the bridge inventory sees this send site.
|
|
629
|
+
try {
|
|
630
|
+
window.parent.postMessage({ dgn: 'asset-lfs-fix-request', rel: f.rel }, '*');
|
|
631
|
+
} catch {
|
|
632
|
+
/* detached */
|
|
633
|
+
}
|
|
634
|
+
}}
|
|
635
|
+
>
|
|
636
|
+
Fix with AI
|
|
637
|
+
</button>
|
|
638
|
+
<button
|
|
639
|
+
type="button"
|
|
640
|
+
className="dc-absent-btn dc-absent-btn--quiet"
|
|
641
|
+
data-testid="asset-frame-lfs-copy"
|
|
642
|
+
aria-live="polite"
|
|
643
|
+
onClick={() => {
|
|
644
|
+
// A literal `{ dgn }` so the bridge inventory sees this send site.
|
|
645
|
+
try {
|
|
646
|
+
window.parent.postMessage({ dgn: 'asset-lfs-copy-request', rel: f.rel }, '*');
|
|
647
|
+
} catch {
|
|
648
|
+
/* detached */
|
|
649
|
+
}
|
|
650
|
+
}}
|
|
651
|
+
>
|
|
652
|
+
{copyWord === 'copied'
|
|
653
|
+
? 'Copied'
|
|
654
|
+
: copyWord === 'failed'
|
|
655
|
+
? 'Couldn’t copy'
|
|
656
|
+
: 'Copy prompt'}
|
|
657
|
+
</button>
|
|
658
|
+
</span>
|
|
659
|
+
) : null}
|
|
660
|
+
</span>
|
|
661
|
+
</div>
|
|
662
|
+
);
|
|
663
|
+
};
|
|
664
|
+
// 2.0.7 — frames over pictures in the world ride the camera in one wrapper; any other frame is placed directly.
|
|
665
|
+
const riders = frames.filter((f) => rideWorld && f.world === rideWorld);
|
|
666
|
+
const fixed = frames.filter((f) => !(rideWorld && f.world === rideWorld));
|
|
454
667
|
return (
|
|
455
668
|
<>
|
|
456
669
|
{bars}
|
|
457
670
|
{createPortal(
|
|
458
671
|
<div className="dc-absent-layer" data-testid="asset-frames">
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
// biome-ignore lint/a11y/useAriaPropsSupportedByRole: role is `group` or `img` (both take a name)
|
|
464
|
-
<div
|
|
465
|
-
key={f.key}
|
|
466
|
-
ref={(el) => {
|
|
467
|
-
if (el) nodes.current.set(f.key, el);
|
|
468
|
-
else nodes.current.delete(f.key);
|
|
469
|
-
}}
|
|
470
|
-
className="dc-absent"
|
|
471
|
-
data-testid="asset-frame"
|
|
472
|
-
data-rel={f.rel}
|
|
473
|
-
data-state={f.words.state}
|
|
474
|
-
data-lost={f.lost ? '1' : undefined}
|
|
475
|
-
// gate-b-a11y: `img` cannot hold the Relink… button (axe nested-interactive) — a labelled group can
|
|
476
|
-
role={f.words.relink || lfs ? 'group' : 'img'}
|
|
477
|
-
aria-label={
|
|
478
|
-
f.lost && f.words.line === LOST_VIDEO_LINE
|
|
479
|
-
? `${f.words.line} · ${f.rel}`
|
|
480
|
-
: `${f.lost ? f.rel : baseName(f.rel)} · ${f.words.line}`
|
|
481
|
-
}
|
|
482
|
-
>
|
|
483
|
-
<span className="dc-absent-in">
|
|
484
|
-
<svg
|
|
485
|
-
className="dc-absent-ic"
|
|
486
|
-
width="16"
|
|
487
|
-
height="16"
|
|
488
|
-
viewBox="0 0 16 16"
|
|
489
|
-
fill="none"
|
|
490
|
-
stroke="currentColor"
|
|
491
|
-
strokeWidth="1.4"
|
|
492
|
-
strokeLinecap="round"
|
|
493
|
-
strokeLinejoin="round"
|
|
494
|
-
aria-hidden="true"
|
|
495
|
-
>
|
|
496
|
-
<path d="M8 2.2 14.2 13H1.8z" />
|
|
497
|
-
<path d="M8 6.4v3.2" />
|
|
498
|
-
<circle cx="8" cy="11.3" r="0.4" fill="currentColor" />
|
|
499
|
-
</svg>
|
|
500
|
-
<span className="dc-absent-n">{f.lost ? f.rel : baseName(f.rel)}</span>
|
|
501
|
-
<span className="dc-absent-d">{f.words.line}</span>
|
|
502
|
-
{f.words.relink ? (
|
|
503
|
-
<button
|
|
504
|
-
type="button"
|
|
505
|
-
className="dc-absent-btn"
|
|
506
|
-
data-testid="asset-frame-relink"
|
|
507
|
-
onClick={() => {
|
|
508
|
-
// A literal `{ dgn }` so the bridge inventory sees this send site.
|
|
509
|
-
try {
|
|
510
|
-
window.parent.postMessage(
|
|
511
|
-
{ dgn: 'asset-relink-request', rel: f.rel },
|
|
512
|
-
'*'
|
|
513
|
-
);
|
|
514
|
-
} catch {
|
|
515
|
-
/* detached */
|
|
516
|
-
}
|
|
517
|
-
}}
|
|
518
|
-
>
|
|
519
|
-
Relink…
|
|
520
|
-
</button>
|
|
521
|
-
) : null}
|
|
522
|
-
{lfs ? (
|
|
523
|
-
<span className="dc-absent-row">
|
|
524
|
-
<button
|
|
525
|
-
type="button"
|
|
526
|
-
className="dc-absent-btn"
|
|
527
|
-
data-testid="asset-frame-lfs-fix"
|
|
528
|
-
onClick={() => {
|
|
529
|
-
// A literal `{ dgn }` so the bridge inventory sees this send site.
|
|
530
|
-
try {
|
|
531
|
-
window.parent.postMessage(
|
|
532
|
-
{ dgn: 'asset-lfs-fix-request', rel: f.rel },
|
|
533
|
-
'*'
|
|
534
|
-
);
|
|
535
|
-
} catch {
|
|
536
|
-
/* detached */
|
|
537
|
-
}
|
|
538
|
-
}}
|
|
539
|
-
>
|
|
540
|
-
Fix with AI
|
|
541
|
-
</button>
|
|
542
|
-
<button
|
|
543
|
-
type="button"
|
|
544
|
-
className="dc-absent-btn dc-absent-btn--quiet"
|
|
545
|
-
data-testid="asset-frame-lfs-copy"
|
|
546
|
-
aria-live="polite"
|
|
547
|
-
onClick={() => {
|
|
548
|
-
// A literal `{ dgn }` so the bridge inventory sees this send site.
|
|
549
|
-
try {
|
|
550
|
-
window.parent.postMessage(
|
|
551
|
-
{ dgn: 'asset-lfs-copy-request', rel: f.rel },
|
|
552
|
-
'*'
|
|
553
|
-
);
|
|
554
|
-
} catch {
|
|
555
|
-
/* detached */
|
|
556
|
-
}
|
|
557
|
-
}}
|
|
558
|
-
>
|
|
559
|
-
{copyWord === 'copied'
|
|
560
|
-
? 'Copied'
|
|
561
|
-
: copyWord === 'failed'
|
|
562
|
-
? 'Couldn’t copy'
|
|
563
|
-
: 'Copy prompt'}
|
|
564
|
-
</button>
|
|
565
|
-
</span>
|
|
566
|
-
) : null}
|
|
567
|
-
</span>
|
|
568
|
-
</div>
|
|
569
|
-
);
|
|
570
|
-
})}
|
|
672
|
+
<div className="dc-absent-ride" ref={rideRef}>
|
|
673
|
+
{riders.map(draw)}
|
|
674
|
+
</div>
|
|
675
|
+
{fixed.map(draw)}
|
|
571
676
|
</div>,
|
|
572
677
|
document.body
|
|
573
678
|
)}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
10
10
|
import { createPortal } from 'react-dom';
|
|
11
|
-
|
|
12
11
|
import type { AssetStateItem } from './bridge/dgn-protocol.ts';
|
|
12
|
+
import { frameCaf, frameRaf } from './frame-clock.ts';
|
|
13
13
|
|
|
14
14
|
/** rel → progress (0..1, or null when the Mac does not know how far it is) for every `uploading` item. */
|
|
15
15
|
export function uploadingOf(
|
|
@@ -128,11 +128,11 @@ export function UploadBars({
|
|
|
128
128
|
div.style.top = `${Math.round(r.bottom - BAR_PX)}px`;
|
|
129
129
|
div.style.width = `${Math.round(r.width)}px`;
|
|
130
130
|
}
|
|
131
|
-
raf =
|
|
131
|
+
raf = frameRaf(tick);
|
|
132
132
|
};
|
|
133
|
-
raf =
|
|
133
|
+
raf = frameRaf(tick);
|
|
134
134
|
return () => {
|
|
135
|
-
if (raf != null)
|
|
135
|
+
if (raf != null) frameCaf(raf);
|
|
136
136
|
};
|
|
137
137
|
}, [bars]);
|
|
138
138
|
|