@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
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// The camera a canvas opens on when nobody chose one (2.0.7 fix #6). Pure and React-free, so
|
|
2
|
+
// canvas-lib and the tests share one function.
|
|
3
|
+
//
|
|
4
|
+
// Michal (desktop 2.0.6, StudyFi): the Design system canvas opened as an empty canvas, and only
|
|
5
|
+
// zoom-to-fit showed the artboards — at 2 %, scattered over a huge area. Two causes:
|
|
6
|
+
// · with no stored camera the runtime fitted EVERYTHING, and a canvas 43 000 px wide fits at 2 %:
|
|
7
|
+
// on screen, but nothing on it can be read;
|
|
8
|
+
// · a stored camera (`_canvas-state/<slug>.view.json`, per machine) from an older layout was
|
|
9
|
+
// restored as-is, and pointed at a spot where no artboard is any more.
|
|
10
|
+
// So: fit-all while it is readable, else the top row, else the first artboard; and a stored camera
|
|
11
|
+
// that frames no artboard once the layout has settled is treated as no camera at all.
|
|
12
|
+
|
|
13
|
+
/** The slice of an artboard rect the camera reads. */
|
|
14
|
+
export interface CameraRect {
|
|
15
|
+
id: string;
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
w: number;
|
|
19
|
+
h: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface Camera {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
zoom: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Below this zoom a fit shows only thumbnails: a 1 440 px page is 144 screen px wide and its text
|
|
30
|
+
* is a grey line. A fit-all that small is not a view of the content, so the default camera frames
|
|
31
|
+
* less of it instead (⌘0 still fits everything).
|
|
32
|
+
*/
|
|
33
|
+
export const READABLE_ZOOM = 0.1;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* How long the layout must stay still before a restored camera is judged (ms). Hugging artboards
|
|
37
|
+
* report their heights and the Design system canvas re-pitches its rows in the first frames; a
|
|
38
|
+
* camera is only "on nothing" once that is done.
|
|
39
|
+
*/
|
|
40
|
+
export const STORED_CAMERA_CHECK_MS = 400;
|
|
41
|
+
|
|
42
|
+
const finite = (n: unknown): n is number => typeof n === 'number' && Number.isFinite(n);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The top row: the artboard nearest the top (then the left) and every artboard beside it — the
|
|
46
|
+
* ones whose vertical span overlaps its own — left to right.
|
|
47
|
+
*/
|
|
48
|
+
export function topRow<T extends CameraRect>(rects: readonly T[]): T[] {
|
|
49
|
+
if (rects.length === 0) return [];
|
|
50
|
+
let anchor = rects[0] as T;
|
|
51
|
+
for (const r of rects) if (r.y < anchor.y || (r.y === anchor.y && r.x < anchor.x)) anchor = r;
|
|
52
|
+
return rects
|
|
53
|
+
.filter((r) => r.y < anchor.y + anchor.h && r.y + r.h > anchor.y)
|
|
54
|
+
.slice()
|
|
55
|
+
.sort((a, b) => a.x - b.x);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The camera a canvas opens on with no camera of its own. `fit` is the runtime's own fit (host size,
|
|
60
|
+
* padding and the shell's occluded insets already applied).
|
|
61
|
+
*/
|
|
62
|
+
export function defaultCamera<T extends CameraRect>(
|
|
63
|
+
rects: readonly T[],
|
|
64
|
+
fit: (rects: T[]) => Camera
|
|
65
|
+
): Camera {
|
|
66
|
+
const all = fit(rects.slice());
|
|
67
|
+
if (rects.length <= 1 || all.zoom >= READABLE_ZOOM) return all;
|
|
68
|
+
const row = topRow(rects);
|
|
69
|
+
const r = fit(row);
|
|
70
|
+
if (row.length <= 1 || r.zoom >= READABLE_ZOOM) return r;
|
|
71
|
+
return fit([row[0] as T]);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** True when the camera, on a `w` x `h` host, shows any part of any artboard. */
|
|
75
|
+
export function cameraShowsContent(
|
|
76
|
+
camera: Camera,
|
|
77
|
+
w: number,
|
|
78
|
+
h: number,
|
|
79
|
+
rects: readonly CameraRect[]
|
|
80
|
+
): boolean {
|
|
81
|
+
if (!finite(camera.x) || !finite(camera.y) || !finite(camera.zoom) || camera.zoom <= 0)
|
|
82
|
+
return false;
|
|
83
|
+
if (!(w > 0) || !(h > 0)) return false;
|
|
84
|
+
// screen = world * zoom + offset → the world rect on screen
|
|
85
|
+
const x0 = -camera.x / camera.zoom;
|
|
86
|
+
const y0 = -camera.y / camera.zoom;
|
|
87
|
+
const x1 = x0 + w / camera.zoom;
|
|
88
|
+
const y1 = y0 + h / camera.zoom;
|
|
89
|
+
return rects.some((r) => r.x < x1 && r.x + r.w > x0 && r.y < y1 && r.y + r.h > y0);
|
|
90
|
+
}
|
|
@@ -38,11 +38,11 @@ import {
|
|
|
38
38
|
useState,
|
|
39
39
|
} from 'react';
|
|
40
40
|
import { createRoot } from 'react-dom/client';
|
|
41
|
-
|
|
42
41
|
import { acceptFromShell } from './bridge/dgn-protocol.ts';
|
|
43
42
|
import { annotationElement, annotationIdAt, clientToWorld } from './comment-anchor.ts';
|
|
44
43
|
import { CommentsOverlay } from './comments-overlay.tsx';
|
|
45
44
|
import { deriveFile, hoverTargetToSelection } from './dom-selection.ts';
|
|
45
|
+
import { frameCaf, frameRaf } from './frame-clock.ts';
|
|
46
46
|
import {
|
|
47
47
|
type HoverTarget,
|
|
48
48
|
isOverlayTarget,
|
|
@@ -173,10 +173,10 @@ function CommentHost({ children, file }: { children: ReactNode; file: string | u
|
|
|
173
173
|
// re-check on the next frame + a short timeout before deciding.
|
|
174
174
|
const check = () => setIsSpecimen(isBareSpecimen());
|
|
175
175
|
check();
|
|
176
|
-
const raf =
|
|
176
|
+
const raf = frameRaf(check);
|
|
177
177
|
const t = setTimeout(check, 120);
|
|
178
178
|
return () => {
|
|
179
|
-
|
|
179
|
+
frameCaf(raf);
|
|
180
180
|
clearTimeout(t);
|
|
181
181
|
};
|
|
182
182
|
}, []);
|
|
@@ -321,11 +321,11 @@ function MountSelectionHalo({ el }: { el: HTMLElement }) {
|
|
|
321
321
|
} else if (div) {
|
|
322
322
|
div.style.display = 'none';
|
|
323
323
|
}
|
|
324
|
-
rafRef.current =
|
|
324
|
+
rafRef.current = frameRaf(tick);
|
|
325
325
|
};
|
|
326
|
-
rafRef.current =
|
|
326
|
+
rafRef.current = frameRaf(tick);
|
|
327
327
|
return () => {
|
|
328
|
-
if (rafRef.current != null)
|
|
328
|
+
if (rafRef.current != null) frameCaf(rafRef.current);
|
|
329
329
|
};
|
|
330
330
|
}, []);
|
|
331
331
|
|
|
@@ -377,11 +377,11 @@ function MountHoverHalo({ el }: { el: HTMLElement }) {
|
|
|
377
377
|
} else if (div) {
|
|
378
378
|
div.style.display = 'none';
|
|
379
379
|
}
|
|
380
|
-
rafRef.current =
|
|
380
|
+
rafRef.current = frameRaf(tick);
|
|
381
381
|
};
|
|
382
|
-
rafRef.current =
|
|
382
|
+
rafRef.current = frameRaf(tick);
|
|
383
383
|
return () => {
|
|
384
|
-
if (rafRef.current != null)
|
|
384
|
+
if (rafRef.current != null) frameCaf(rafRef.current);
|
|
385
385
|
};
|
|
386
386
|
}, []);
|
|
387
387
|
|
|
@@ -103,7 +103,6 @@ import {
|
|
|
103
103
|
useState,
|
|
104
104
|
useSyncExternalStore,
|
|
105
105
|
} from 'react';
|
|
106
|
-
|
|
107
106
|
import { canvasKeyIndex, resolveCanvasKey } from './actions/canvas-keys.ts';
|
|
108
107
|
import { ArtboardActivityOverlay } from './artboard-activity-overlay.tsx';
|
|
109
108
|
import { ArtboardConvertMarks } from './artboard-convert-marks.tsx';
|
|
@@ -120,6 +119,7 @@ import {
|
|
|
120
119
|
ArtboardLiveFeed,
|
|
121
120
|
ArtboardLiveGate,
|
|
122
121
|
holdAllLive,
|
|
122
|
+
noteGestureZoom,
|
|
123
123
|
} from './artboard-live-gate.tsx';
|
|
124
124
|
import { ArtboardNewSection, useNewSection } from './artboard-new-section.tsx';
|
|
125
125
|
import {
|
|
@@ -131,10 +131,12 @@ import {
|
|
|
131
131
|
} from './artboard-warn-mark.tsx';
|
|
132
132
|
import { AssetPlaceholderLayer } from './asset-placeholder.tsx';
|
|
133
133
|
import { modeShows } from './bridge/mode-shows.ts';
|
|
134
|
+
import { cameraShowsContent, defaultCamera, STORED_CAMERA_CHECK_MS } from './canvas-camera.ts';
|
|
134
135
|
import { DsIcon } from './canvas-ds-icons.tsx';
|
|
135
|
-
import { flowRows, isDsCanvasIds } from './canvas-rows.ts';
|
|
136
|
+
import { flowRows, isDsCanvasIds, wrapRows } from './canvas-rows.ts';
|
|
136
137
|
import { CanvasShell } from './canvas-shell.tsx';
|
|
137
138
|
import { registerCanvasThemeSystem } from './canvas-theme.ts';
|
|
139
|
+
import { frameCaf, frameRaf, setFrameFreeze } from './frame-clock.ts';
|
|
138
140
|
import { pressStartsPan } from './input-router.tsx';
|
|
139
141
|
import { summaryWords } from './kinds/warnings.ts';
|
|
140
142
|
import { presentHidesCss, usePresentStage } from './present/present-stage.tsx';
|
|
@@ -223,7 +225,7 @@ import { VideoPlayLayer } from './video-play-overlay.tsx';
|
|
|
223
225
|
|
|
224
226
|
// 2.0.5 — is this artboard running live (near the viewport, not zoomed out to the overview)? Gate a render
|
|
225
227
|
// loop, a simulation or an expensive first mount on it. Always true in captures and exports.
|
|
226
|
-
export { useArtboardActive, useArtboardSeen } from './artboard-live-gate.tsx';
|
|
228
|
+
export { useArtboardActive, useArtboardGesture, useArtboardSeen } from './artboard-live-gate.tsx';
|
|
227
229
|
export type { CompSnapshot, VideoCompMeta, VideoCompProps } from './video-comp.tsx';
|
|
228
230
|
// S7.5 — the comp vocabulary (V2-1.10 §5.3): literal-prop components; the build injects their
|
|
229
231
|
// derived data (`__words`, `__speech`, video/inject.ts). A 1.x build lacks these exports, so a
|
|
@@ -325,6 +327,29 @@ const ZOOM_STEP_OUT = 1 / 1.2;
|
|
|
325
327
|
const WHEEL_ZOOM_K = 0.0035; // larger = more sensitive wheel — tuned to match Figma/FigJam's zoom-per-notch feel
|
|
326
328
|
const SETTLE_MS = 500;
|
|
327
329
|
const PUBLISH_MS = 50;
|
|
330
|
+
/**
|
|
331
|
+
* Runs `fn` after the next frame and one task more (2.0.7): input that queued behind a long frame is handled
|
|
332
|
+
* before it, so a gesture's quiet timer that came due during that frame does not end the gesture. A hidden
|
|
333
|
+
* document gets no frames: there it runs after a task; `fallbackMs` bounds a frame that never comes.
|
|
334
|
+
*/
|
|
335
|
+
function afterQuietFrame(fn: () => void, fallbackMs = 1000): void {
|
|
336
|
+
if (
|
|
337
|
+
typeof requestAnimationFrame !== 'function' ||
|
|
338
|
+
(typeof document !== 'undefined' && document.visibilityState === 'hidden')
|
|
339
|
+
) {
|
|
340
|
+
setTimeout(fn, 0);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
let done = false;
|
|
344
|
+
const run = () => {
|
|
345
|
+
if (done) return;
|
|
346
|
+
done = true;
|
|
347
|
+
clearTimeout(fallback);
|
|
348
|
+
fn();
|
|
349
|
+
};
|
|
350
|
+
const fallback = setTimeout(run, fallbackMs);
|
|
351
|
+
frameRaf(() => setTimeout(run, 0));
|
|
352
|
+
}
|
|
328
353
|
|
|
329
354
|
// WebKit (Safari + the Tauri WKWebView native shell, DDR-106) vs Blink (Chrome).
|
|
330
355
|
// The two engines render the CSS `zoom` property incompatibly (see writeTransform),
|
|
@@ -485,7 +510,9 @@ const ENGINE_CSS = `
|
|
|
485
510
|
.dc-section-collapsed { display: contents; }
|
|
486
511
|
|
|
487
512
|
.dc-canvas .dc-artboard {
|
|
488
|
-
|
|
513
|
+
/* 2.0.7 - the artboard's own colour once known (artboard-live-gate.tsx): an unpainted body or WebKit tile shows it,
|
|
514
|
+
never the design system's --bg-0 (a black square on a dark one). */
|
|
515
|
+
background: var(--dc-own-bg, var(--bg-0, #ffffff));
|
|
489
516
|
color: var(--fg-0, #2a2520);
|
|
490
517
|
/* Quiet frame chrome — FigJam Section / Figma Frame canonical. The Memphis
|
|
491
518
|
hard-shadow is the Maude brand on USER CONTENT inside artboards; the frame
|
|
@@ -1116,6 +1143,11 @@ export interface ViewportControllerOptions {
|
|
|
1116
1143
|
worldRef: RefObject<HTMLDivElement | null>;
|
|
1117
1144
|
/** Computes a fit-to-screen viewport for the current artboard set. */
|
|
1118
1145
|
computeFit: () => ViewportState;
|
|
1146
|
+
/**
|
|
1147
|
+
* 2.0.7 fix #6 — the camera the runtime places by itself (the zero-size re-fit, `refitBoot`). Omit
|
|
1148
|
+
* for `computeFit`. ⌘0 (`fit`) always uses `computeFit`: a person asking for Fit gets everything.
|
|
1149
|
+
*/
|
|
1150
|
+
computeBoot?: () => ViewportState;
|
|
1119
1151
|
/**
|
|
1120
1152
|
* Initial viewport. Read once at mount. Return `null` to defer until the
|
|
1121
1153
|
* host has a measured size (the hook will re-init on the first ResizeObserver
|
|
@@ -1306,7 +1338,7 @@ let liveVpLastAt = 0;
|
|
|
1306
1338
|
let liveVpLastKey = '';
|
|
1307
1339
|
|
|
1308
1340
|
function liveVpTick(t: number): void {
|
|
1309
|
-
liveVpRaf =
|
|
1341
|
+
liveVpRaf = frameRaf(liveVpTick);
|
|
1310
1342
|
if (t - liveVpLastAt < PUBLISH_MS) return;
|
|
1311
1343
|
liveVpLastAt = t;
|
|
1312
1344
|
const cur = liveViewport;
|
|
@@ -1321,12 +1353,12 @@ function subscribeLiveViewport(fn: (v: ViewportState) => void): () => void {
|
|
|
1321
1353
|
liveVpSubs.add(fn);
|
|
1322
1354
|
if (liveVpRaf === 0 && typeof requestAnimationFrame === 'function') {
|
|
1323
1355
|
liveVpLastKey = '';
|
|
1324
|
-
liveVpRaf =
|
|
1356
|
+
liveVpRaf = frameRaf(liveVpTick);
|
|
1325
1357
|
}
|
|
1326
1358
|
return () => {
|
|
1327
1359
|
liveVpSubs.delete(fn);
|
|
1328
1360
|
if (liveVpSubs.size === 0 && liveVpRaf !== 0) {
|
|
1329
|
-
|
|
1361
|
+
frameCaf(liveVpRaf);
|
|
1330
1362
|
liveVpRaf = 0;
|
|
1331
1363
|
}
|
|
1332
1364
|
};
|
|
@@ -1368,6 +1400,7 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1368
1400
|
hostRef,
|
|
1369
1401
|
worldRef,
|
|
1370
1402
|
computeFit: computeFitFn,
|
|
1403
|
+
computeBoot: computeBootFn,
|
|
1371
1404
|
getInitial,
|
|
1372
1405
|
onSettle,
|
|
1373
1406
|
jumpTargets,
|
|
@@ -1403,10 +1436,14 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1403
1436
|
const publishTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
1404
1437
|
const settleTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
1405
1438
|
const interactEndTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
1439
|
+
// Bumped by every input of a gesture (markInteracting); the quiet check compares it (2.0.7).
|
|
1440
|
+
const interactSeqRef = useRef(0);
|
|
1406
1441
|
|
|
1407
1442
|
// Stable refs to options that may change between renders.
|
|
1408
1443
|
const computeFitRef = useRef(computeFitFn);
|
|
1409
1444
|
computeFitRef.current = computeFitFn;
|
|
1445
|
+
const computeBootRef = useRef(computeBootFn ?? computeFitFn);
|
|
1446
|
+
computeBootRef.current = computeBootFn ?? computeFitFn;
|
|
1410
1447
|
const onSettleRef = useRef(onSettle);
|
|
1411
1448
|
onSettleRef.current = onSettle;
|
|
1412
1449
|
const jumpTargetsRef = useRef(jumpTargets);
|
|
@@ -1515,6 +1552,10 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1515
1552
|
// pointer events.
|
|
1516
1553
|
const markInteracting = useCallback(() => {
|
|
1517
1554
|
interactingRef.current = true;
|
|
1555
|
+
// 2.0.7 — the gesture freeze: artboards' own frame callbacks, animations and silent videos wait until the
|
|
1556
|
+
// camera stops (frame-clock.ts, artboard-freeze.ts). Every input renews it; the shell's watchdog thaws a
|
|
1557
|
+
// freeze nobody renews.
|
|
1558
|
+
setFrameFreeze(true);
|
|
1518
1559
|
if (!isInteractingStateRef.current) {
|
|
1519
1560
|
isInteractingStateRef.current = true;
|
|
1520
1561
|
// Start of a fresh gesture burst — remember the scale so settle can tell
|
|
@@ -1522,12 +1563,26 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1522
1563
|
zoomAtInteractStartRef.current = vpRef.current.zoom;
|
|
1523
1564
|
setIsInteracting(true);
|
|
1524
1565
|
}
|
|
1566
|
+
interactSeqRef.current += 1;
|
|
1567
|
+
const seq = interactSeqRef.current;
|
|
1525
1568
|
if (interactEndTimerRef.current != null) clearTimeout(interactEndTimerRef.current);
|
|
1569
|
+
// 2.0.7 — the quiet timer alone does not end the gesture: it can come due while a long frame blocks the
|
|
1570
|
+
// main thread, BEFORE the wheel that queued behind that frame is handled (a due timer runs first). On the
|
|
1571
|
+
// mascot canvas at 10 % a WebKit frame took 200-450 ms, so a pan+zoom settled 4-18 times mid-gesture
|
|
1572
|
+
// (each one a published viewport, a crisp re-raster and a fresh layer on the next wheel). The end waits
|
|
1573
|
+
// for a frame and a task with no new input (`afterQuietFrame`); a wheel in between keeps the gesture.
|
|
1526
1574
|
interactEndTimerRef.current = setTimeout(() => {
|
|
1575
|
+
interactEndTimerRef.current = null;
|
|
1576
|
+
afterQuietFrame(() => {
|
|
1577
|
+
if (interactSeqRef.current !== seq) return; // input came in after the timer: still the same gesture
|
|
1578
|
+
endInteracting();
|
|
1579
|
+
});
|
|
1580
|
+
}, 220);
|
|
1581
|
+
const endInteracting = () => {
|
|
1527
1582
|
interactingRef.current = false;
|
|
1528
1583
|
isInteractingStateRef.current = false;
|
|
1584
|
+
setFrameFreeze(false);
|
|
1529
1585
|
setIsInteracting(false);
|
|
1530
|
-
interactEndTimerRef.current = null;
|
|
1531
1586
|
// Motion has stopped — re-write the world transform in crisp mode so the
|
|
1532
1587
|
// WebKit path drops its compositor layer and re-rasterizes text sharply at
|
|
1533
1588
|
// the settled scale. No-op on the Blink path (CSS `zoom` is already crisp).
|
|
@@ -1542,7 +1597,7 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1542
1597
|
// settle-cadence by design; deferring the publish to here is what keeps
|
|
1543
1598
|
// the whole React tree still while the user is actually moving.
|
|
1544
1599
|
setViewportPublished({ ...vpRef.current });
|
|
1545
|
-
}
|
|
1600
|
+
};
|
|
1546
1601
|
}, [writeTransform]);
|
|
1547
1602
|
|
|
1548
1603
|
const applyViewport = useCallback(
|
|
@@ -1554,6 +1609,8 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1554
1609
|
};
|
|
1555
1610
|
vpRef.current = clamped;
|
|
1556
1611
|
liveViewport = clamped; // RC3 — survives the soft-reload remount
|
|
1612
|
+
// 2.0.7 — a zoom step swaps small artboards to their stills before this frame paints (artboard-still.ts)
|
|
1613
|
+
noteGestureZoom(clamped.zoom);
|
|
1557
1614
|
writeTransform(clamped);
|
|
1558
1615
|
// `defer` is what makes a gesture render-free. A wheel/pinch/drag burst
|
|
1559
1616
|
// writes the transform imperatively every frame (above) and publishes to
|
|
@@ -1628,7 +1685,7 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1628
1685
|
if (interactingRef.current) return;
|
|
1629
1686
|
// r2-export-size-race — a camera someone else wrote into the DOM (a capture at zoom 1) is theirs.
|
|
1630
1687
|
if (!worldPlacedByRuntime(worldRef.current)) return;
|
|
1631
|
-
const next =
|
|
1688
|
+
const next = computeBootRef.current();
|
|
1632
1689
|
vpRef.current = { ...next };
|
|
1633
1690
|
liveViewport = { ...next };
|
|
1634
1691
|
writeTransform(vpRef.current, { crisp: true });
|
|
@@ -1672,7 +1729,7 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1672
1729
|
const animateTo = useCallback(
|
|
1673
1730
|
(target: ViewportState, durationMs = 240) => {
|
|
1674
1731
|
if (animationRef.current != null) {
|
|
1675
|
-
|
|
1732
|
+
frameCaf(animationRef.current);
|
|
1676
1733
|
animationRef.current = null;
|
|
1677
1734
|
}
|
|
1678
1735
|
const dur = prefersReducedMotion() ? 0 : Math.max(0, durationMs);
|
|
@@ -1694,12 +1751,12 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1694
1751
|
zoom: clampZoom(start.zoom + (target.zoom - start.zoom) * e),
|
|
1695
1752
|
});
|
|
1696
1753
|
if (t < 1) {
|
|
1697
|
-
animationRef.current =
|
|
1754
|
+
animationRef.current = frameRaf(tick);
|
|
1698
1755
|
} else {
|
|
1699
1756
|
animationRef.current = null;
|
|
1700
1757
|
}
|
|
1701
1758
|
};
|
|
1702
|
-
animationRef.current =
|
|
1759
|
+
animationRef.current = frameRaf(tick);
|
|
1703
1760
|
},
|
|
1704
1761
|
[applyViewport]
|
|
1705
1762
|
);
|
|
@@ -1737,7 +1794,7 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1737
1794
|
if (interactingRef.current) return; // never re-fit during a gesture
|
|
1738
1795
|
if (!hadSize && host.clientWidth > 0 && host.clientHeight > 0) {
|
|
1739
1796
|
hadSize = true;
|
|
1740
|
-
const refit =
|
|
1797
|
+
const refit = computeBootRef.current();
|
|
1741
1798
|
vpRef.current = { ...refit };
|
|
1742
1799
|
liveViewport = { ...refit };
|
|
1743
1800
|
writeTransform(vpRef.current, { crisp: true });
|
|
@@ -2066,7 +2123,10 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
2066
2123
|
if (cb) cb({ ...vpRef.current });
|
|
2067
2124
|
}
|
|
2068
2125
|
if (interactEndTimerRef.current != null) clearTimeout(interactEndTimerRef.current);
|
|
2069
|
-
|
|
2126
|
+
interactSeqRef.current += 1; // a quiet check still in flight ends nothing after unmount
|
|
2127
|
+
// that ended check would have thawed the artboards: an unmount mid-gesture (a soft reload) thaws them now
|
|
2128
|
+
if (interactingRef.current) setFrameFreeze(false);
|
|
2129
|
+
if (animationRef.current != null) frameCaf(animationRef.current);
|
|
2070
2130
|
};
|
|
2071
2131
|
}, []);
|
|
2072
2132
|
|
|
@@ -2458,21 +2518,38 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2458
2518
|
});
|
|
2459
2519
|
}, [seeds]);
|
|
2460
2520
|
|
|
2521
|
+
// r3-ds-rows / 2.0.7 fix #6 — the Design system canvas is a generated grid (see the row flow below).
|
|
2522
|
+
const rowFlowOn = useMemo(() => isDsCanvasIds(seeds.map((s) => s.id)), [seeds]);
|
|
2523
|
+
const declaredSizes = useMemo(
|
|
2524
|
+
() => new Map(seeds.map((s) => [s.id, { w: s.w, h: s.h }] as const)),
|
|
2525
|
+
[seeds]
|
|
2526
|
+
);
|
|
2527
|
+
// true once a layout was committed or undone in this session (applyArtboardLayout) — see the row flow below
|
|
2528
|
+
const arrangedRef = useRef(false);
|
|
2529
|
+
// 2.0.7 fix #6 — an older converted system put each section's pages in ONE row (StudyFi: 29 pages,
|
|
2530
|
+
// 43 000 px; fit-all 2 %). Its untouched grid wraps at MAX_ROW_COLUMNS as it is seeded — before the
|
|
2531
|
+
// boot camera is computed, so the camera frames the grid the person sees. Run time only, like the row
|
|
2532
|
+
// flow: nothing is written to the versioned meta on open, and an arranged layout is never wrapped.
|
|
2533
|
+
const seededArtboards = useCallback((): ArtboardRect[] => {
|
|
2534
|
+
const seeded = initialArtboards();
|
|
2535
|
+
return rowFlowOn && !arrangedRef.current
|
|
2536
|
+
? wrapRows(seeded, { declared: declaredSizes })
|
|
2537
|
+
: seeded;
|
|
2538
|
+
}, [initialArtboards, rowFlowOn, declaredSizes]);
|
|
2539
|
+
|
|
2461
2540
|
// Artboards live in state (not a useMemo) so a drag commit can update
|
|
2462
2541
|
// positions in-place without waiting for an iframe reload to re-read meta.
|
|
2463
2542
|
// Phase 4.2 originally used useMemo([seeds]) — dragging would PATCH the
|
|
2464
2543
|
// server but the local React state stayed frozen at mount-time. Users had
|
|
2465
2544
|
// to switch canvases (forcing a reload) to see the new position.
|
|
2466
|
-
const [artboards, setArtboards] = useState<ArtboardRect[]>(
|
|
2467
|
-
// true once a layout was committed or undone in this session (applyArtboardLayout) — see the row flow below
|
|
2468
|
-
const arrangedRef = useRef(false);
|
|
2545
|
+
const [artboards, setArtboards] = useState<ArtboardRect[]>(seededArtboards);
|
|
2469
2546
|
|
|
2470
2547
|
// Re-seed when JSX children change (HMR after canvas TSX edit). The seed
|
|
2471
2548
|
// signature is identity-stable across renders that don't change the JSX,
|
|
2472
2549
|
// so this won't clobber drag-commit state during normal interaction.
|
|
2473
2550
|
useEffect(() => {
|
|
2474
|
-
setArtboards(
|
|
2475
|
-
}, [
|
|
2551
|
+
setArtboards(seededArtboards());
|
|
2552
|
+
}, [seededArtboards]);
|
|
2476
2553
|
|
|
2477
2554
|
// rc3 r4-12 — every press here tells the shell, so its open menus close (WebKit gives the shell no blur for it)
|
|
2478
2555
|
useEffect(
|
|
@@ -2490,11 +2567,11 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2490
2567
|
useEffect(() => {
|
|
2491
2568
|
if (typeof document === 'undefined') return;
|
|
2492
2569
|
const onRefresh = () => {
|
|
2493
|
-
setArtboards(
|
|
2570
|
+
setArtboards(seededArtboards());
|
|
2494
2571
|
};
|
|
2495
2572
|
document.addEventListener('maude:meta-refreshed', onRefresh);
|
|
2496
2573
|
return () => document.removeEventListener('maude:meta-refreshed', onRefresh);
|
|
2497
|
-
}, [
|
|
2574
|
+
}, [seededArtboards]);
|
|
2498
2575
|
|
|
2499
2576
|
// Stable refs so the controller's callbacks always see the latest values.
|
|
2500
2577
|
const artboardsRef = useRef(artboards);
|
|
@@ -2505,8 +2582,11 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2505
2582
|
// p8-edit-multi-flake — the camera the runtime placed by itself and the host size it fits (null: persisted /
|
|
2506
2583
|
// resumed, or the camera has moved since). A host that grows from a placeholder size re-fits (below).
|
|
2507
2584
|
const autoFitRef = useRef<AutoFit | null>(null);
|
|
2585
|
+
// 2.0.7 fix #6 — a camera restored from view state, until the layout settles and it is judged (below).
|
|
2586
|
+
const restoredRef = useRef<ViewportState | null>(null);
|
|
2508
2587
|
const dropAutoFit = useCallback(() => {
|
|
2509
2588
|
autoFitRef.current = null;
|
|
2589
|
+
restoredRef.current = null; // a camera someone moved is theirs, wherever it points
|
|
2510
2590
|
}, []);
|
|
2511
2591
|
|
|
2512
2592
|
const computeFitForArtboards = useCallback((): ViewportState => {
|
|
@@ -2515,6 +2595,15 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2515
2595
|
return computeFit(artboardsRef.current, host, 24, canvasInsets());
|
|
2516
2596
|
}, []);
|
|
2517
2597
|
|
|
2598
|
+
// 2.0.7 fix #6 — the camera the runtime places by itself: fit-all while it is readable, else the top
|
|
2599
|
+
// row, else the first artboard (canvas-camera.ts). ⌘0 still fits everything (computeFitForArtboards).
|
|
2600
|
+
const computeBootForArtboards = useCallback((): ViewportState => {
|
|
2601
|
+
const host = hostRef.current;
|
|
2602
|
+
if (!host) return { x: 0, y: 0, zoom: 1 };
|
|
2603
|
+
const insets = canvasInsets();
|
|
2604
|
+
return defaultCamera(artboardsRef.current, (rects) => computeFit(rects, host, 24, insets));
|
|
2605
|
+
}, []);
|
|
2606
|
+
|
|
2518
2607
|
const getInitial = useCallback((): ViewportState | null => {
|
|
2519
2608
|
// RC3 — after a soft-reload remount, resume the live camera parked at
|
|
2520
2609
|
// module scope (exact, no settle lag) before falling back to the meta
|
|
@@ -2523,17 +2612,18 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2523
2612
|
const meta = readCanvasMeta();
|
|
2524
2613
|
const v = meta?.viewport;
|
|
2525
2614
|
if (v && Number.isFinite(v.x) && Number.isFinite(v.y) && Number.isFinite(v.zoom)) {
|
|
2615
|
+
restoredRef.current = { x: v.x, y: v.y, zoom: v.zoom };
|
|
2526
2616
|
return { x: v.x, y: v.y, zoom: v.zoom };
|
|
2527
2617
|
}
|
|
2528
2618
|
const host = hostRef.current;
|
|
2529
2619
|
if (!host) return null;
|
|
2530
|
-
const fit =
|
|
2620
|
+
const fit = computeBootForArtboards();
|
|
2531
2621
|
// §5.6 I2 — remember the boot fit only if no insets had arrived yet (else it already honours them).
|
|
2532
2622
|
bootFitRef.current =
|
|
2533
2623
|
typeof window !== 'undefined' && canvasModeStore(window).get().insetsSeq < 0 ? fit : null;
|
|
2534
2624
|
autoFitRef.current = { camera: { ...fit }, w: host.clientWidth, h: host.clientHeight };
|
|
2535
2625
|
return fit;
|
|
2536
|
-
}, []);
|
|
2626
|
+
}, [computeBootForArtboards]);
|
|
2537
2627
|
|
|
2538
2628
|
const onSettle = useCallback((v: ViewportState) => {
|
|
2539
2629
|
patchCanvasMeta({ viewport: v });
|
|
@@ -2561,6 +2651,7 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2561
2651
|
hostRef,
|
|
2562
2652
|
worldRef,
|
|
2563
2653
|
computeFit: computeFitForArtboards,
|
|
2654
|
+
computeBoot: computeBootForArtboards,
|
|
2564
2655
|
getInitial,
|
|
2565
2656
|
onSettle,
|
|
2566
2657
|
jumpTargets: artboards,
|
|
@@ -2641,6 +2732,33 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2641
2732
|
return () => ro.disconnect();
|
|
2642
2733
|
}, []);
|
|
2643
2734
|
|
|
2735
|
+
// 2.0.7 fix #6 — a restored camera that shows nothing. The view state is per machine and outlives the
|
|
2736
|
+
// layout it was taken on (Michal's StudyFi Design system canvas opened on an empty spot: the camera
|
|
2737
|
+
// pointed below rows that had since moved up). Once the layout has been still for a moment (hugging
|
|
2738
|
+
// artboards have reported their heights, the row flow has run), a restored camera that is still where
|
|
2739
|
+
// it was put and frames no artboard is replaced by the default camera — placed like the boot fit
|
|
2740
|
+
// (crisp, nothing persisted). A camera anyone moved is never touched (`dropAutoFit` clears the record).
|
|
2741
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: `artboards` is the trigger (the layout changed); the check reads refs.
|
|
2742
|
+
useEffect(() => {
|
|
2743
|
+
if (!restoredRef.current) return;
|
|
2744
|
+
const t = setTimeout(() => {
|
|
2745
|
+
const restored = restoredRef.current;
|
|
2746
|
+
const host = hostRef.current;
|
|
2747
|
+
if (!restored || !host || !(host.clientWidth > 0 && host.clientHeight > 0)) return;
|
|
2748
|
+
restoredRef.current = null;
|
|
2749
|
+
const c = controllerRef.current;
|
|
2750
|
+
const now = getLiveViewport();
|
|
2751
|
+
if (!now || c.isInteracting) return;
|
|
2752
|
+
if (now.x !== restored.x || now.y !== restored.y || now.zoom !== restored.zoom) return;
|
|
2753
|
+
if (cameraShowsContent(now, host.clientWidth, host.clientHeight, artboardsRef.current))
|
|
2754
|
+
return;
|
|
2755
|
+
c.refitBoot();
|
|
2756
|
+
const after = getLiveViewport();
|
|
2757
|
+
if (after) autoFitRef.current = { camera: after, w: host.clientWidth, h: host.clientHeight };
|
|
2758
|
+
}, STORED_CAMERA_CHECK_MS);
|
|
2759
|
+
return () => clearTimeout(t);
|
|
2760
|
+
}, [artboards]);
|
|
2761
|
+
|
|
2644
2762
|
// S3.2a — Present · Artboards: inert until the shell's `set-mode` says so (present/present-stage.tsx).
|
|
2645
2763
|
const presentSelection = useSelectionSetOptional();
|
|
2646
2764
|
usePresentStage({ hostRef, worldRef, artboards, controller, selection: presentSelection });
|
|
@@ -2719,11 +2837,6 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2719
2837
|
// only (never written to the meta: heights change with content, and a flow saved there would churn it on every
|
|
2720
2838
|
// open); a person's arrangement is left alone — `flowRows` refuses any layout that is no longer the generated
|
|
2721
2839
|
// grid, and `arrangedRef` stops it for the rest of the session once a layout was committed or undone.
|
|
2722
|
-
const rowFlowOn = useMemo(() => isDsCanvasIds(seeds.map((s) => s.id)), [seeds]);
|
|
2723
|
-
const declaredSizes = useMemo(
|
|
2724
|
-
() => new Map(seeds.map((s) => [s.id, { w: s.w, h: s.h }] as const)),
|
|
2725
|
-
[seeds]
|
|
2726
|
-
);
|
|
2727
2840
|
// biome-ignore lint/correctness/useExhaustiveDependencies: `artboards` is the trigger (a measured height arrived); the setter reads the latest through `prev`.
|
|
2728
2841
|
useEffect(() => {
|
|
2729
2842
|
if (!rowFlowOn || arrangedRef.current) return;
|
|
@@ -2834,7 +2947,8 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2834
2947
|
<ArtboardLiveFeed zoom={controller.viewport.zoom} interacting={!!controller.isInteracting} />
|
|
2835
2948
|
{/* ── S8.19 (L1) placeholder frames ── "Waiting for Jonas's Mac" / Missing over a picture
|
|
2836
2949
|
that failed to load; driven only by the shell's dgn `asset-state` (asset-placeholder.tsx). */}
|
|
2837
|
-
|
|
2950
|
+
{/* 2.0.7 — the frames ride the live camera through a pan / zoom instead of a layout read per frame. */}
|
|
2951
|
+
<AssetPlaceholderLayer camera={getLiveViewport} interacting={!!controller.isInteracting} />
|
|
2838
2952
|
{/* r5-2 — a play / pause button over a placed or annotation clip (hover / selected), in Edit and Preview. */}
|
|
2839
2953
|
<VideoPlayLayer />
|
|
2840
2954
|
</div>
|
|
@@ -3003,6 +3117,10 @@ function DCArtboardBody({
|
|
|
3003
3117
|
[id]
|
|
3004
3118
|
);
|
|
3005
3119
|
|
|
3120
|
+
// 2.0.7 — the mount ring never releases the artboard the selection is in (it, or an element inside it): the
|
|
3121
|
+
// shell's panels (Transcript, Re-frame, the timeline, the inspector) and Present-from-selection work in its DOM.
|
|
3122
|
+
const holdsSelection = !!selSet?.selected.some((s) => s.artboardId === id);
|
|
3123
|
+
|
|
3006
3124
|
// Drag hook — always called (hook rules). Inert outside DesignCanvas
|
|
3007
3125
|
// (allRects empty, enabled=false), so specimens / legacy uses get a plain
|
|
3008
3126
|
// fixed-size block as before.
|
|
@@ -3219,6 +3337,9 @@ function DCArtboardBody({
|
|
|
3219
3337
|
articleRef={articleRef}
|
|
3220
3338
|
bodyRef={bodyRef}
|
|
3221
3339
|
heightFloor={heightFloor}
|
|
3340
|
+
background={background}
|
|
3341
|
+
pinned={holdsSelection}
|
|
3342
|
+
eager={hasVideo || hasVideoContent}
|
|
3222
3343
|
>
|
|
3223
3344
|
{children}
|
|
3224
3345
|
</ArtboardLiveGate>
|
|
@@ -3395,12 +3516,17 @@ function DCArtboardBody({
|
|
|
3395
3516
|
containIntrinsicSize: `${rect.w}px ${rect.h}px`,
|
|
3396
3517
|
}}
|
|
3397
3518
|
>
|
|
3398
|
-
{/* 2.0.5 — offscreen / zoomed-out artboards sleep (artboard-live.ts); captures run everything live
|
|
3519
|
+
{/* 2.0.5 — offscreen / zoomed-out artboards sleep (artboard-live.ts); captures run everything live.
|
|
3520
|
+
2.0.7 — far ones are released to a same-size placeholder in their own colours; the active one and the
|
|
3521
|
+
one holding the selection never. */}
|
|
3399
3522
|
<ArtboardLiveGate
|
|
3400
3523
|
id={id}
|
|
3401
3524
|
articleRef={articleRef}
|
|
3402
3525
|
bodyRef={bodyRef}
|
|
3403
3526
|
heightFloor={heightFloor}
|
|
3527
|
+
background={background}
|
|
3528
|
+
pinned={isActive || holdsSelection}
|
|
3529
|
+
eager={hasVideo || hasVideoContent}
|
|
3404
3530
|
>
|
|
3405
3531
|
{children}
|
|
3406
3532
|
</ArtboardLiveGate>
|
|
@@ -4230,8 +4356,8 @@ export function PhotoPreviewBridge() {
|
|
|
4230
4356
|
};
|
|
4231
4357
|
scan();
|
|
4232
4358
|
const observer = new MutationObserver(() => {
|
|
4233
|
-
|
|
4234
|
-
raf =
|
|
4359
|
+
frameCaf(raf);
|
|
4360
|
+
raf = frameRaf(scan);
|
|
4235
4361
|
});
|
|
4236
4362
|
observer.observe(document.body, {
|
|
4237
4363
|
childList: true,
|
|
@@ -4241,7 +4367,7 @@ export function PhotoPreviewBridge() {
|
|
|
4241
4367
|
});
|
|
4242
4368
|
return () => {
|
|
4243
4369
|
cancelled = true;
|
|
4244
|
-
|
|
4370
|
+
frameCaf(raf);
|
|
4245
4371
|
observer.disconnect();
|
|
4246
4372
|
};
|
|
4247
4373
|
}, [apply, nextFetchGen, isLatestFetch]);
|