@1agh/maude 2.0.4 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/hub/src/project-transactions/kernel.mjs +10 -1
- package/apps/studio/access/closure.ts +156 -16
- package/apps/studio/access/filters.ts +39 -5
- package/apps/studio/access/known-canvases.ts +24 -1
- package/apps/studio/access/refused-inputs.ts +89 -0
- package/apps/studio/actions/agents.ts +59 -0
- package/apps/studio/actions/ctx.ts +3 -0
- package/apps/studio/actions/defs/app.ts +12 -0
- package/apps/studio/actions/defs/sync.ts +13 -0
- package/apps/studio/actions/defs/view.ts +59 -3
- package/apps/studio/actions/keymap.gen.ts +35 -0
- package/apps/studio/actions/menu.ts +2 -0
- package/apps/studio/actions/types.ts +3 -1
- package/apps/studio/actions.manifest.json +148 -1
- package/apps/studio/actions.parity.json +31 -1
- package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
- package/apps/studio/annotations/ui/element-node.tsx +139 -54
- package/apps/studio/annotations/ui/lod.tsx +1 -1
- package/apps/studio/annotations/ui/ride.ts +2 -1
- package/apps/studio/annotations/ui/text-style.ts +1 -1
- package/apps/studio/annotations-context-toolbar.tsx +5 -4
- package/apps/studio/annotations-layer.tsx +4 -15
- package/apps/studio/api.ts +425 -128
- package/apps/studio/artboard-activity-overlay.tsx +4 -4
- package/apps/studio/artboard-ai-copies.tsx +4 -4
- package/apps/studio/artboard-freeze.ts +108 -0
- package/apps/studio/artboard-live-gate.tsx +636 -0
- package/apps/studio/artboard-live.ts +831 -0
- package/apps/studio/artboard-placeholder.ts +197 -0
- package/apps/studio/artboard-still-raster.ts +485 -0
- package/apps/studio/artboard-still-warmup.ts +221 -0
- package/apps/studio/artboard-still.ts +1188 -0
- package/apps/studio/artboard-webgl.ts +669 -0
- package/apps/studio/asset-placeholder.tsx +237 -132
- package/apps/studio/asset-upload-bars.tsx +4 -4
- package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
- package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
- package/apps/studio/bin/_canvas-reasons.mjs +34 -0
- package/apps/studio/bin/_ds-check-live.mjs +37 -0
- package/apps/studio/bin/_ds-check.mjs +4 -1
- package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
- package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
- package/apps/studio/bin/_import-asset.mjs +2 -1
- package/apps/studio/bin/_perf-probe-open.mjs +364 -0
- package/apps/studio/bin/_perf-probe.mjs +2 -1
- package/apps/studio/bin/_perf-shared.mjs +12 -7
- package/apps/studio/bin/_pw-launch.mjs +26 -1
- package/apps/studio/bin/_studio-verb.mjs +24 -3
- package/apps/studio/bin/_thumb-blank.mjs +70 -0
- package/apps/studio/bin/_thumb-cover.mjs +35 -0
- package/apps/studio/bin/_thumbs-playwright.mjs +89 -12
- package/apps/studio/bin/ds-check.sh +5 -1
- package/apps/studio/bin/perf.sh +30 -1
- package/apps/studio/bin/server-up.sh +7 -2
- package/apps/studio/bin/smoke.sh +19 -0
- package/apps/studio/bridge/dgn-protocol.ts +35 -0
- package/apps/studio/canvas-build-sandbox.ts +69 -13
- package/apps/studio/canvas-camera.ts +90 -0
- package/apps/studio/canvas-comment-mount.tsx +9 -9
- package/apps/studio/canvas-lib.tsx +289 -44
- package/apps/studio/canvas-pages-view.tsx +465 -0
- package/apps/studio/canvas-pages.ts +305 -0
- package/apps/studio/canvas-rows.ts +62 -0
- package/apps/studio/canvas-shell.tsx +62 -16
- package/apps/studio/canvas-theme-icons.tsx +41 -0
- package/apps/studio/canvas-theme-pill.tsx +15 -6
- package/apps/studio/canvas-theme.ts +12 -11
- package/apps/studio/client/app.jsx +7 -0
- package/apps/studio/client/canvas-url.js +36 -1
- package/apps/studio/client/home/HomeAccounts.jsx +262 -0
- package/apps/studio/client/home/Shelves.jsx +4 -3
- package/apps/studio/client/home/home-accounts-model.js +121 -0
- package/apps/studio/client/home/home-api.js +6 -0
- package/apps/studio/client/home/home-app.jsx +141 -40
- package/apps/studio/client/home/home-model.js +172 -6
- package/apps/studio/client/home/home.css +169 -5
- package/apps/studio/client/home/shell-mode.js +8 -1
- package/apps/studio/client/hooks/canvas-origin-probe.js +34 -0
- package/apps/studio/client/hooks/use-action-keys.jsx +3 -1
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +1 -1
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +23 -6
- package/apps/studio/client/hooks/use-photo-and-timeline.jsx +16 -8
- package/apps/studio/client/hooks/use-project-data.jsx +13 -2
- package/apps/studio/client/hooks/use-shell-core.jsx +19 -9
- package/apps/studio/client/index-loader.ts +41 -21
- package/apps/studio/client/inspector/inspector-panel.jsx +35 -14
- package/apps/studio/client/panels/ChatPanel.jsx +27 -20
- package/apps/studio/client/panels/CreateProject.jsx +19 -5
- package/apps/studio/client/panels/caps-cache.js +46 -0
- package/apps/studio/client/shell/viewport.jsx +66 -22
- package/apps/studio/client/tree/tree.jsx +17 -0
- package/apps/studio/client/v2/access/access-client.js +2 -0
- package/apps/studio/client/v2/access/access-host.jsx +12 -1
- package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
- package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
- package/apps/studio/client/v2/ai/Composer.jsx +27 -10
- package/apps/studio/client/v2/canvases/canvases-panel.jsx +24 -0
- package/apps/studio/client/v2/canvases/use-canvas-index.js +24 -1
- package/apps/studio/client/v2/code/canvas-error-card.jsx +14 -2
- package/apps/studio/client/v2/code/canvas-imports-card.jsx +19 -14
- package/apps/studio/client/v2/code/canvas-imports-words.js +60 -0
- package/apps/studio/client/v2/code/canvas-waiting-card.jsx +59 -5
- package/apps/studio/client/v2/code/canvas-waiting.js +18 -1
- package/apps/studio/client/v2/code/code-bus.js +5 -0
- package/apps/studio/client/v2/code/code-consent-sheet.jsx +87 -0
- package/apps/studio/client/v2/code/code-consent.js +67 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +62 -10
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +314 -5
- package/apps/studio/client/v2/ds/advanced-host.jsx +11 -26
- package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
- package/apps/studio/client/v2/ds/library-host.jsx +45 -45
- package/apps/studio/client/v2/ds/make-host.jsx +13 -15
- package/apps/studio/client/v2/ds/off-system-host.jsx +18 -19
- package/apps/studio/client/v2/ds/review-host.jsx +7 -1
- package/apps/studio/client/v2/ds/truth-host.jsx +15 -17
- package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
- package/apps/studio/client/v2/history/branch-actions.js +13 -9
- package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
- package/apps/studio/client/v2/history/git-model.js +3 -1
- package/apps/studio/client/v2/history/git-parts.jsx +16 -1
- package/apps/studio/client/v2/layers/artboard-layers.jsx +24 -5
- package/apps/studio/client/v2/layers/layers-request.js +49 -0
- package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +93 -3
- package/apps/studio/client/v2/left-panel/ds-boards.js +39 -0
- package/apps/studio/client/v2/left-panel/left-panel-model.js +13 -0
- package/apps/studio/client/v2/left-panel/left-panel.css +24 -0
- package/apps/studio/client/v2/presence/faces.jsx +42 -14
- package/apps/studio/client/v2/shell/account-card.jsx +10 -4
- package/apps/studio/client/v2/shell/canvas-crash-guard.js +172 -0
- package/apps/studio/client/v2/shell/canvas-mode.js +17 -1
- package/apps/studio/client/v2/shell/floating-panels.css +37 -1
- package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
- package/apps/studio/client/v2/shell/menu-runner.js +11 -0
- package/apps/studio/client/v2/shell/mode-switch.jsx +14 -3
- package/apps/studio/client/v2/shell/opening-skeleton.js +118 -0
- package/apps/studio/client/v2/shell/opening-skeleton.jsx +103 -0
- package/apps/studio/client/v2/shell/pages-pick.js +49 -0
- package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
- package/apps/studio/client/v2/shell/project-account-model.js +182 -0
- package/apps/studio/client/v2/shell/project-menu-model.js +3 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +140 -11
- package/apps/studio/client/v2/shell/share-cluster.css +58 -0
- package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
- package/apps/studio/client/v2/shell/shell-parity.json +8 -0
- package/apps/studio/client/v2/shell/team-switch.js +94 -0
- package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
- package/apps/studio/client/v2/shell/use-account.js +8 -1
- package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +30 -0
- package/apps/studio/collab/persistence.ts +9 -1
- package/apps/studio/collab/registry.ts +32 -0
- package/apps/studio/collab/room.ts +8 -0
- package/apps/studio/comments-overlay.tsx +12 -11
- package/apps/studio/config-reload-wire.ts +56 -0
- package/apps/studio/config.schema.json +6 -0
- package/apps/studio/context.ts +37 -1
- package/apps/studio/dist/client.bundle.js +1198 -1198
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/ds/board/board.css +6 -0
- package/apps/studio/ds/board/ds-bar.tsx +21 -3
- package/apps/studio/ds/board/specimen.tsx +16 -2
- package/apps/studio/ds/board/template.ts +39 -19
- package/apps/studio/ds/canvas-cli.ts +58 -2
- package/apps/studio/ds/check.ts +26 -1
- package/apps/studio/ds/cli.ts +14 -4
- package/apps/studio/ds/component-list.ts +2 -1
- package/apps/studio/ds/convert.ts +34 -6
- package/apps/studio/ds/default.ts +6 -1
- package/apps/studio/ds/ds-resolver.ts +58 -8
- package/apps/studio/ds/ds-verb.ts +13 -0
- package/apps/studio/ds/engine.ts +3 -1
- package/apps/studio/ds/folder-systems.ts +199 -0
- package/apps/studio/ds/pairing-css.ts +2 -1
- package/apps/studio/ds/post-build.ts +38 -0
- package/apps/studio/ds/rename.ts +10 -3
- package/apps/studio/ds/shell-fallbacks.ts +2 -1
- package/apps/studio/ds/upgrade-apply.ts +27 -5
- package/apps/studio/ds/upgrade-cli.ts +22 -2
- package/apps/studio/ds/upgrade-prove.ts +198 -15
- package/apps/studio/ds/upgrade-stage.ts +10 -3
- package/apps/studio/editing/ai-point-ring.tsx +4 -4
- package/apps/studio/editing/ai-scope-outline.tsx +4 -4
- package/apps/studio/editing/align-bar.tsx +4 -4
- package/apps/studio/editing/anchor-report.ts +3 -2
- package/apps/studio/editing/artboard-handles.tsx +4 -4
- package/apps/studio/editing/corner-dots.tsx +4 -4
- package/apps/studio/editing/crop-mode.tsx +4 -4
- package/apps/studio/editing/drop-chip.tsx +4 -4
- package/apps/studio/editing/empty-report.ts +3 -2
- package/apps/studio/editing/focus-model.tsx +4 -4
- package/apps/studio/editing/gap-bands.tsx +3 -3
- package/apps/studio/editing/hold-rings.tsx +4 -4
- package/apps/studio/editing/lock-badge.tsx +3 -3
- package/apps/studio/editing/long-page.ts +23 -1
- package/apps/studio/editing/nudge.tsx +2 -2
- package/apps/studio/editing/page-activity.ts +4 -3
- package/apps/studio/editing/paste-bar.tsx +4 -4
- package/apps/studio/editing/pen/overlay.tsx +4 -3
- package/apps/studio/editing/place-freely.tsx +3 -3
- package/apps/studio/editing/reorder-slot.tsx +3 -3
- package/apps/studio/editing/selection.tsx +4 -4
- package/apps/studio/editing/size-ghost.tsx +4 -4
- package/apps/studio/editing/tab-order.tsx +4 -4
- package/apps/studio/editing/text-in-place.tsx +4 -4
- package/apps/studio/editing/undo-preview.tsx +3 -3
- package/apps/studio/equal-spacing-handles.tsx +3 -3
- package/apps/studio/frame-clock.ts +89 -0
- package/apps/studio/history/trash.ts +6 -0
- package/apps/studio/home/accounts.ts +87 -0
- package/apps/studio/home/index-reader.ts +24 -2
- package/apps/studio/home/routes.ts +19 -0
- package/apps/studio/http.ts +80 -34
- package/apps/studio/index/ds-usage.ts +4 -1
- package/apps/studio/index-cache.ts +272 -0
- package/apps/studio/inspect-overlay.tsx +4 -3
- package/apps/studio/inspect.ts +7 -2
- package/apps/studio/link-chip-overlay.tsx +4 -3
- package/apps/studio/measure-overlay.tsx +4 -3
- package/apps/studio/present/pointer-dot.tsx +3 -2
- package/apps/studio/present/present-media.ts +6 -2
- package/apps/studio/present/present-stage.tsx +3 -2
- package/apps/studio/preview/preview-camera.tsx +3 -2
- package/apps/studio/routes/ds-convert.ts +18 -0
- package/apps/studio/routes/sync.ts +176 -0
- package/apps/studio/routes/trash.ts +16 -1
- package/apps/studio/safe-zones-overlay.tsx +3 -2
- package/apps/studio/server.ts +8 -10
- package/apps/studio/skip-dirs.ts +103 -47
- package/apps/studio/studio-page-host.ts +70 -0
- package/apps/studio/sync/accepted-cold-start.ts +28 -13
- package/apps/studio/sync/asset-push.ts +146 -23
- package/apps/studio/sync/asset-state.ts +3 -2
- package/apps/studio/sync/code-module-consent.ts +86 -0
- package/apps/studio/sync/file-ledger.ts +24 -0
- package/apps/studio/sync/file-membership.ts +28 -3
- package/apps/studio/sync/file-plane.ts +497 -61
- package/apps/studio/sync/file-pull.ts +304 -33
- package/apps/studio/sync/held-deletes.ts +230 -0
- package/apps/studio/sync/hub-link.ts +1 -2
- package/apps/studio/sync/hubs-config.ts +59 -2
- package/apps/studio/sync/index.ts +405 -163
- package/apps/studio/sync/journal-client.ts +94 -5
- package/apps/studio/sync/pending-deletes.ts +100 -0
- package/apps/studio/sync/projection.ts +77 -12
- package/apps/studio/sync/seed-progress.ts +104 -3
- package/apps/studio/sync/settings.ts +36 -1
- package/apps/studio/sync/status.ts +17 -1
- package/apps/studio/sync/writer-registry.ts +5 -0
- package/apps/studio/text-caret.ts +5 -3
- package/apps/studio/thumbs/service.ts +12 -2
- package/apps/studio/thumbs/validate.ts +7 -0
- package/apps/studio/toolbars/toolbar-rect.ts +3 -2
- package/apps/studio/ui-prefs-migrate.ts +4 -0
- package/apps/studio/use-annotation-resize.tsx +4 -3
- package/apps/studio/use-artboard-drag.tsx +3 -2
- package/apps/studio/use-element-resize.tsx +7 -6
- package/apps/studio/use-grid-track-handles.tsx +5 -4
- package/apps/studio/use-selection-set.tsx +64 -4
- package/apps/studio/use-spacing-handles.tsx +7 -6
- package/apps/studio/video-comp.tsx +75 -39
- package/apps/studio/video-play-overlay.tsx +4 -3
- package/apps/studio/whats-new.json +99 -0
- package/cli/commands/design.mjs +5 -2
- package/cli/commands/hub.mjs +10 -1
- package/cli/lib/bash-guard.mjs +27 -1
- package/cli/lib/design-help.gen.mjs +1 -1
- package/cli/lib/design-hook.mjs +20 -0
- package/cli/lib/design-link.mjs +42 -17
- package/cli/lib/hub-purge.mjs +183 -0
- package/cli/lib/studio-locate.mjs +35 -10
- package/package.json +8 -8
- package/plugins/design/templates/_shell.html +164 -1
|
@@ -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';
|
|
@@ -115,6 +114,13 @@ import {
|
|
|
115
114
|
type GuideDefinitions,
|
|
116
115
|
type OverlayVisibility,
|
|
117
116
|
} from './artboard-guides-overlay.tsx';
|
|
117
|
+
import {
|
|
118
|
+
ARTBOARD_LIVE_CSS,
|
|
119
|
+
ArtboardLiveFeed,
|
|
120
|
+
ArtboardLiveGate,
|
|
121
|
+
holdAllLive,
|
|
122
|
+
noteGestureZoom,
|
|
123
|
+
} from './artboard-live-gate.tsx';
|
|
118
124
|
import { ArtboardNewSection, useNewSection } from './artboard-new-section.tsx';
|
|
119
125
|
import {
|
|
120
126
|
ArtboardWarnMark,
|
|
@@ -125,10 +131,12 @@ import {
|
|
|
125
131
|
} from './artboard-warn-mark.tsx';
|
|
126
132
|
import { AssetPlaceholderLayer } from './asset-placeholder.tsx';
|
|
127
133
|
import { modeShows } from './bridge/mode-shows.ts';
|
|
134
|
+
import { cameraShowsContent, defaultCamera, STORED_CAMERA_CHECK_MS } from './canvas-camera.ts';
|
|
128
135
|
import { DsIcon } from './canvas-ds-icons.tsx';
|
|
129
|
-
import { flowRows, isDsCanvasIds } from './canvas-rows.ts';
|
|
136
|
+
import { flowRows, isDsCanvasIds, wrapRows } from './canvas-rows.ts';
|
|
130
137
|
import { CanvasShell } from './canvas-shell.tsx';
|
|
131
138
|
import { registerCanvasThemeSystem } from './canvas-theme.ts';
|
|
139
|
+
import { frameCaf, frameRaf, setFrameFreeze } from './frame-clock.ts';
|
|
132
140
|
import { pressStartsPan } from './input-router.tsx';
|
|
133
141
|
import { summaryWords } from './kinds/warnings.ts';
|
|
134
142
|
import { presentHidesCss, usePresentStage } from './present/present-stage.tsx';
|
|
@@ -215,6 +223,9 @@ import { UndoStackProvider, useUndoSinks, useUndoStackOptional } from './use-und
|
|
|
215
223
|
import { VideoComp } from './video-comp.tsx';
|
|
216
224
|
import { VideoPlayLayer } from './video-play-overlay.tsx';
|
|
217
225
|
|
|
226
|
+
// 2.0.5 — is this artboard running live (near the viewport, not zoomed out to the overview)? Gate a render
|
|
227
|
+
// loop, a simulation or an expensive first mount on it. Always true in captures and exports.
|
|
228
|
+
export { useArtboardActive, useArtboardGesture, useArtboardSeen } from './artboard-live-gate.tsx';
|
|
218
229
|
export type { CompSnapshot, VideoCompMeta, VideoCompProps } from './video-comp.tsx';
|
|
219
230
|
// S7.5 — the comp vocabulary (V2-1.10 §5.3): literal-prop components; the build injects their
|
|
220
231
|
// derived data (`__words`, `__speech`, video/inject.ts). A 1.x build lacks these exports, so a
|
|
@@ -316,6 +327,29 @@ const ZOOM_STEP_OUT = 1 / 1.2;
|
|
|
316
327
|
const WHEEL_ZOOM_K = 0.0035; // larger = more sensitive wheel — tuned to match Figma/FigJam's zoom-per-notch feel
|
|
317
328
|
const SETTLE_MS = 500;
|
|
318
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
|
+
}
|
|
319
353
|
|
|
320
354
|
// WebKit (Safari + the Tauri WKWebView native shell, DDR-106) vs Blink (Chrome).
|
|
321
355
|
// The two engines render the CSS `zoom` property incompatibly (see writeTransform),
|
|
@@ -343,6 +377,8 @@ type DcPerfCounters = {
|
|
|
343
377
|
annotationRenders: number;
|
|
344
378
|
/** Annotation element nodes (re-)rendered — a drag should touch only what moves. */
|
|
345
379
|
annotationNodeRenders?: number;
|
|
380
|
+
/** Section title chips (re-)rendered — a pan/zoom gesture should render none (2.0.5 W2). */
|
|
381
|
+
sectionChipRenders?: number;
|
|
346
382
|
instrumented?: boolean;
|
|
347
383
|
};
|
|
348
384
|
|
|
@@ -474,7 +510,9 @@ const ENGINE_CSS = `
|
|
|
474
510
|
.dc-section-collapsed { display: contents; }
|
|
475
511
|
|
|
476
512
|
.dc-canvas .dc-artboard {
|
|
477
|
-
|
|
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));
|
|
478
516
|
color: var(--fg-0, #2a2520);
|
|
479
517
|
/* Quiet frame chrome — FigJam Section / Figma Frame canonical. The Memphis
|
|
480
518
|
hard-shadow is the Maude brand on USER CONTENT inside artboards; the frame
|
|
@@ -522,6 +560,7 @@ const ENGINE_CSS = `
|
|
|
522
560
|
/* S3.14 - Present draws the work only (04 md-present-*): the editor chrome list is present/present-stage.tsx
|
|
523
561
|
PRESENT_HIDES, keyed on the root attribute the stage sets while any Present is on. */
|
|
524
562
|
${presentHidesCss()}
|
|
563
|
+
${ARTBOARD_LIVE_CSS}
|
|
525
564
|
.dc-canvas .dc-artboard-label {
|
|
526
565
|
flex-shrink: 0;
|
|
527
566
|
background: var(--maude-chrome-bg-2, #e8e3d8);
|
|
@@ -638,7 +677,8 @@ input.dc-artboard-rename {
|
|
|
638
677
|
/* V2-8.8 (WebKit M7) - on the WebKit scale path (transform, see writeTransform) the name and the video badge get
|
|
639
678
|
their OWN compositor layer. They are re-sized every zoom frame by the counter-scale above and paint outside the
|
|
640
679
|
frame, so inside the board's layer (will-change, the per-board raster freeze) they moved its bounds every frame
|
|
641
|
-
and WebKit re-rastered every board on every zoom frame. Blink (CSS zoom) relayouts the world anyway;
|
|
680
|
+
and WebKit re-rastered every board on every zoom frame. Settled Blink (CSS zoom) relayouts the world anyway;
|
|
681
|
+
during a Blink zoom gesture the world is on the transform path too (2.0.5 W2, writeTransform flips the flag). */
|
|
642
682
|
.dc-world[data-dc-scale='transform'] .dc-artboard.dc-positioned > .dc-artboard-label,
|
|
643
683
|
.dc-world[data-dc-scale='transform'] .dc-artboard.dc-positioned > .dc-artboard-video-badge {
|
|
644
684
|
will-change: transform;
|
|
@@ -1103,6 +1143,11 @@ export interface ViewportControllerOptions {
|
|
|
1103
1143
|
worldRef: RefObject<HTMLDivElement | null>;
|
|
1104
1144
|
/** Computes a fit-to-screen viewport for the current artboard set. */
|
|
1105
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;
|
|
1106
1151
|
/**
|
|
1107
1152
|
* Initial viewport. Read once at mount. Return `null` to defer until the
|
|
1108
1153
|
* host has a measured size (the hook will re-init on the first ResizeObserver
|
|
@@ -1243,6 +1288,35 @@ export function getLiveViewport(): ViewportState | null {
|
|
|
1243
1288
|
return liveViewport ? { ...liveViewport } : null;
|
|
1244
1289
|
}
|
|
1245
1290
|
|
|
1291
|
+
/**
|
|
1292
|
+
* 2.0.5 W2 — counter-scaled chrome that sits BELOW a `--dc-zoom` reset. The annotation scene stops the
|
|
1293
|
+
* world's `--dc-zoom` (a custom property inherits, so a zoom frame would otherwise restyle every element
|
|
1294
|
+
* of the board), but a section's title chip still has to hold its screen size, and drawing it from
|
|
1295
|
+
* `useLiveViewport()` re-rendered every chip at ~20 Hz through a gesture. A node given this ref gets
|
|
1296
|
+
* `--dc-zoom` written straight onto it with every camera write (writeTransform), so its CSS
|
|
1297
|
+
* (`scale(calc(1 / var(--dc-zoom, 1)))`) tracks the live zoom with no React work and no inheritance
|
|
1298
|
+
* through the scene. Node → the world it sits in (only that world's writes feed it).
|
|
1299
|
+
*/
|
|
1300
|
+
const screenSizedNodes = new Map<HTMLElement, HTMLElement | null>();
|
|
1301
|
+
/**
|
|
1302
|
+
* True on Blink, where CSS-counter-scaled chrome (`screenSizedRef`) is used. WebKit (Safari + the WKWebView
|
|
1303
|
+
* desktop app) keeps sizing that chrome from `useLiveViewport()`: the per-frame transform was not shown to be
|
|
1304
|
+
* free there, and the desktop app must not regress (2.0.5 W2).
|
|
1305
|
+
*/
|
|
1306
|
+
export function cssCounterScaledChrome(): boolean {
|
|
1307
|
+
return !IS_WEBKIT;
|
|
1308
|
+
}
|
|
1309
|
+
export function screenSizedRef(node: HTMLElement | null): (() => void) | undefined {
|
|
1310
|
+
if (!node) return undefined;
|
|
1311
|
+
const world = node.closest<HTMLElement>('.dc-world');
|
|
1312
|
+
screenSizedNodes.set(node, world);
|
|
1313
|
+
const z = world?.style.getPropertyValue('--dc-zoom');
|
|
1314
|
+
if (z) node.style.setProperty('--dc-zoom', z);
|
|
1315
|
+
return () => {
|
|
1316
|
+
screenSizedNodes.delete(node);
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1246
1320
|
/**
|
|
1247
1321
|
* Viewport for the few consumers that must track a gesture AS IT HAPPENS —
|
|
1248
1322
|
* the minimap indicator and the zoom % readout. Everything else reads the
|
|
@@ -1264,7 +1338,7 @@ let liveVpLastAt = 0;
|
|
|
1264
1338
|
let liveVpLastKey = '';
|
|
1265
1339
|
|
|
1266
1340
|
function liveVpTick(t: number): void {
|
|
1267
|
-
liveVpRaf =
|
|
1341
|
+
liveVpRaf = frameRaf(liveVpTick);
|
|
1268
1342
|
if (t - liveVpLastAt < PUBLISH_MS) return;
|
|
1269
1343
|
liveVpLastAt = t;
|
|
1270
1344
|
const cur = liveViewport;
|
|
@@ -1279,12 +1353,12 @@ function subscribeLiveViewport(fn: (v: ViewportState) => void): () => void {
|
|
|
1279
1353
|
liveVpSubs.add(fn);
|
|
1280
1354
|
if (liveVpRaf === 0 && typeof requestAnimationFrame === 'function') {
|
|
1281
1355
|
liveVpLastKey = '';
|
|
1282
|
-
liveVpRaf =
|
|
1356
|
+
liveVpRaf = frameRaf(liveVpTick);
|
|
1283
1357
|
}
|
|
1284
1358
|
return () => {
|
|
1285
1359
|
liveVpSubs.delete(fn);
|
|
1286
1360
|
if (liveVpSubs.size === 0 && liveVpRaf !== 0) {
|
|
1287
|
-
|
|
1361
|
+
frameCaf(liveVpRaf);
|
|
1288
1362
|
liveVpRaf = 0;
|
|
1289
1363
|
}
|
|
1290
1364
|
};
|
|
@@ -1326,6 +1400,7 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1326
1400
|
hostRef,
|
|
1327
1401
|
worldRef,
|
|
1328
1402
|
computeFit: computeFitFn,
|
|
1403
|
+
computeBoot: computeBootFn,
|
|
1329
1404
|
getInitial,
|
|
1330
1405
|
onSettle,
|
|
1331
1406
|
jumpTargets,
|
|
@@ -1361,10 +1436,14 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1361
1436
|
const publishTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
1362
1437
|
const settleTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
1363
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);
|
|
1364
1441
|
|
|
1365
1442
|
// Stable refs to options that may change between renders.
|
|
1366
1443
|
const computeFitRef = useRef(computeFitFn);
|
|
1367
1444
|
computeFitRef.current = computeFitFn;
|
|
1445
|
+
const computeBootRef = useRef(computeBootFn ?? computeFitFn);
|
|
1446
|
+
computeBootRef.current = computeBootFn ?? computeFitFn;
|
|
1368
1447
|
const onSettleRef = useRef(onSettle);
|
|
1369
1448
|
onSettleRef.current = onSettle;
|
|
1370
1449
|
const jumpTargetsRef = useRef(jumpTargets);
|
|
@@ -1400,6 +1479,18 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1400
1479
|
const el = worldRef.current;
|
|
1401
1480
|
if (!el) return;
|
|
1402
1481
|
const z = v.zoom || 1;
|
|
1482
|
+
// 2.0.5 W2 — a Blink ZOOM gesture scales the already-promoted world layer with `transform` instead:
|
|
1483
|
+
// CSS `zoom` re-laid-out the whole world on every zoom frame (~2.4k layout objects on a 714-element
|
|
1484
|
+
// board, zoom p95 33 ms). The CSS `zoom` the gesture started at is HELD and only the residual scale
|
|
1485
|
+
// (z / held) goes on the transform, so the gesture's first scaling frame lays out nothing either —
|
|
1486
|
+
// dropping `zoom` to '' there re-laid-out the whole world at 1x (and again when a symmetric gesture
|
|
1487
|
+
// came back to its start scale): two full-layout frames inside every zoom, which is the zoom p95.
|
|
1488
|
+
// Only while a burst is changing scale and the write is not the settle one — the settle (`crisp`,
|
|
1489
|
+
// from markInteracting's quiet timer) writes the final CSS `zoom`, so text re-rasters crisp and every
|
|
1490
|
+
// reader of a settled camera (export shims, screenshot, canvas-rects) sees CSS `zoom` exactly as
|
|
1491
|
+
// before. A pure pan (scale unchanged) never leaves CSS `zoom`. WebKit is untouched.
|
|
1492
|
+
const blinkGestureScale =
|
|
1493
|
+
!IS_WEBKIT && !opts?.crisp && interactingRef.current && z !== zoomAtInteractStartRef.current;
|
|
1403
1494
|
if (IS_WEBKIT) {
|
|
1404
1495
|
el.style.zoom = '';
|
|
1405
1496
|
el.style.transformOrigin = '0 0';
|
|
@@ -1408,10 +1499,20 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1408
1499
|
// WebKit re-paints text crisp at the new scale instead of upscaling the
|
|
1409
1500
|
// cached bitmap.
|
|
1410
1501
|
el.style.willChange = opts?.crisp ? 'auto' : 'transform';
|
|
1502
|
+
} else if (blinkGestureScale) {
|
|
1503
|
+
// under `zoom: held` the transform is in pre-zoom px: screen = held·(t + s·world) = x + z·world
|
|
1504
|
+
const held = Number.parseFloat(el.style.zoom) || 1;
|
|
1505
|
+
el.style.transformOrigin = '0 0';
|
|
1506
|
+
el.style.transform = `translate(${v.x / held}px, ${v.y / held}px) scale(${z / held})`;
|
|
1411
1507
|
} else {
|
|
1508
|
+
el.style.transformOrigin = '';
|
|
1412
1509
|
el.style.transform = `translate(${v.x / z}px, ${v.y / z}px)`;
|
|
1413
1510
|
el.style.zoom = String(z);
|
|
1414
1511
|
}
|
|
1512
|
+
// The scale path the world is on RIGHT NOW (CSS keys off it — `[data-dc-scale='transform']`). The JSX
|
|
1513
|
+
// seeds the engine default; on Blink it flips for the length of a zoom gesture.
|
|
1514
|
+
const scaleMode = IS_WEBKIT || blinkGestureScale ? 'transform' : 'zoom';
|
|
1515
|
+
if (el.dataset.dcScale !== scaleMode) el.dataset.dcScale = scaleMode;
|
|
1415
1516
|
// Live zoom for counter-scaled chrome (section labels, connector dots,
|
|
1416
1517
|
// selection bboxes — anything that must stay a constant number of SCREEN px
|
|
1417
1518
|
// while the world scales). It has to be written per frame, right here: the
|
|
@@ -1419,7 +1520,11 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1419
1520
|
// would scale with the world through a pinch and snap back at the end —
|
|
1420
1521
|
// reintroducing exactly the fidelity-pop that was removed once already
|
|
1421
1522
|
// (RCA addendum: the LOD toggle was reverted for visible flicker).
|
|
1422
|
-
|
|
1523
|
+
const zs = String(z);
|
|
1524
|
+
el.style.setProperty('--dc-zoom', zs);
|
|
1525
|
+
for (const [node, world] of screenSizedNodes) {
|
|
1526
|
+
if (world === el) node.style.setProperty('--dc-zoom', zs);
|
|
1527
|
+
}
|
|
1423
1528
|
el.style.visibility = 'visible';
|
|
1424
1529
|
runtimeWorldStyle.set(el, worldStyleKey(el));
|
|
1425
1530
|
}, []);
|
|
@@ -1447,6 +1552,10 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1447
1552
|
// pointer events.
|
|
1448
1553
|
const markInteracting = useCallback(() => {
|
|
1449
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);
|
|
1450
1559
|
if (!isInteractingStateRef.current) {
|
|
1451
1560
|
isInteractingStateRef.current = true;
|
|
1452
1561
|
// Start of a fresh gesture burst — remember the scale so settle can tell
|
|
@@ -1454,12 +1563,26 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1454
1563
|
zoomAtInteractStartRef.current = vpRef.current.zoom;
|
|
1455
1564
|
setIsInteracting(true);
|
|
1456
1565
|
}
|
|
1566
|
+
interactSeqRef.current += 1;
|
|
1567
|
+
const seq = interactSeqRef.current;
|
|
1457
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.
|
|
1458
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 = () => {
|
|
1459
1582
|
interactingRef.current = false;
|
|
1460
1583
|
isInteractingStateRef.current = false;
|
|
1584
|
+
setFrameFreeze(false);
|
|
1461
1585
|
setIsInteracting(false);
|
|
1462
|
-
interactEndTimerRef.current = null;
|
|
1463
1586
|
// Motion has stopped — re-write the world transform in crisp mode so the
|
|
1464
1587
|
// WebKit path drops its compositor layer and re-rasterizes text sharply at
|
|
1465
1588
|
// the settled scale. No-op on the Blink path (CSS `zoom` is already crisp).
|
|
@@ -1474,7 +1597,7 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1474
1597
|
// settle-cadence by design; deferring the publish to here is what keeps
|
|
1475
1598
|
// the whole React tree still while the user is actually moving.
|
|
1476
1599
|
setViewportPublished({ ...vpRef.current });
|
|
1477
|
-
}
|
|
1600
|
+
};
|
|
1478
1601
|
}, [writeTransform]);
|
|
1479
1602
|
|
|
1480
1603
|
const applyViewport = useCallback(
|
|
@@ -1486,6 +1609,8 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1486
1609
|
};
|
|
1487
1610
|
vpRef.current = clamped;
|
|
1488
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);
|
|
1489
1614
|
writeTransform(clamped);
|
|
1490
1615
|
// `defer` is what makes a gesture render-free. A wheel/pinch/drag burst
|
|
1491
1616
|
// writes the transform imperatively every frame (above) and publishes to
|
|
@@ -1560,7 +1685,7 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1560
1685
|
if (interactingRef.current) return;
|
|
1561
1686
|
// r2-export-size-race — a camera someone else wrote into the DOM (a capture at zoom 1) is theirs.
|
|
1562
1687
|
if (!worldPlacedByRuntime(worldRef.current)) return;
|
|
1563
|
-
const next =
|
|
1688
|
+
const next = computeBootRef.current();
|
|
1564
1689
|
vpRef.current = { ...next };
|
|
1565
1690
|
liveViewport = { ...next };
|
|
1566
1691
|
writeTransform(vpRef.current, { crisp: true });
|
|
@@ -1604,7 +1729,7 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1604
1729
|
const animateTo = useCallback(
|
|
1605
1730
|
(target: ViewportState, durationMs = 240) => {
|
|
1606
1731
|
if (animationRef.current != null) {
|
|
1607
|
-
|
|
1732
|
+
frameCaf(animationRef.current);
|
|
1608
1733
|
animationRef.current = null;
|
|
1609
1734
|
}
|
|
1610
1735
|
const dur = prefersReducedMotion() ? 0 : Math.max(0, durationMs);
|
|
@@ -1626,12 +1751,12 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1626
1751
|
zoom: clampZoom(start.zoom + (target.zoom - start.zoom) * e),
|
|
1627
1752
|
});
|
|
1628
1753
|
if (t < 1) {
|
|
1629
|
-
animationRef.current =
|
|
1754
|
+
animationRef.current = frameRaf(tick);
|
|
1630
1755
|
} else {
|
|
1631
1756
|
animationRef.current = null;
|
|
1632
1757
|
}
|
|
1633
1758
|
};
|
|
1634
|
-
animationRef.current =
|
|
1759
|
+
animationRef.current = frameRaf(tick);
|
|
1635
1760
|
},
|
|
1636
1761
|
[applyViewport]
|
|
1637
1762
|
);
|
|
@@ -1669,7 +1794,7 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1669
1794
|
if (interactingRef.current) return; // never re-fit during a gesture
|
|
1670
1795
|
if (!hadSize && host.clientWidth > 0 && host.clientHeight > 0) {
|
|
1671
1796
|
hadSize = true;
|
|
1672
|
-
const refit =
|
|
1797
|
+
const refit = computeBootRef.current();
|
|
1673
1798
|
vpRef.current = { ...refit };
|
|
1674
1799
|
liveViewport = { ...refit };
|
|
1675
1800
|
writeTransform(vpRef.current, { crisp: true });
|
|
@@ -1734,18 +1859,44 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1734
1859
|
// pinch doesn't double-apply (WebKit may emit both event streams).
|
|
1735
1860
|
const gesture = { active: false, lastScale: 1 };
|
|
1736
1861
|
|
|
1862
|
+
// 2.0.5 W2 — the host's box, cached. A wheel event right after a camera write used to read
|
|
1863
|
+
// `getBoundingClientRect()` + `clientWidth`/`clientHeight` here, forcing a synchronous style + layout
|
|
1864
|
+
// of the whole world inside the input handler, every event. Measured at mount and from a
|
|
1865
|
+
// ResizeObserver (delivered after layout, so its read is free); a window resize or scroll can move the
|
|
1866
|
+
// host without resizing it, so those only mark the box stale and the next wheel measures once.
|
|
1867
|
+
const hostBox = { left: 0, top: 0, width: 0, height: 0, fresh: false };
|
|
1868
|
+
const measureHost = () => {
|
|
1869
|
+
const r = host.getBoundingClientRect();
|
|
1870
|
+
hostBox.left = r.left;
|
|
1871
|
+
hostBox.top = r.top;
|
|
1872
|
+
hostBox.width = host.clientWidth;
|
|
1873
|
+
hostBox.height = host.clientHeight;
|
|
1874
|
+
// no observer = nothing tells us it changed: keep the old read-per-event behaviour
|
|
1875
|
+
hostBox.fresh = typeof ResizeObserver !== 'undefined';
|
|
1876
|
+
};
|
|
1877
|
+
const hostGeom = () => {
|
|
1878
|
+
if (!hostBox.fresh) measureHost();
|
|
1879
|
+
return hostBox;
|
|
1880
|
+
};
|
|
1881
|
+
const markHostStale = () => {
|
|
1882
|
+
hostBox.fresh = false;
|
|
1883
|
+
};
|
|
1884
|
+
measureHost();
|
|
1885
|
+
const hostRo = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(measureHost) : null;
|
|
1886
|
+
hostRo?.observe(host);
|
|
1887
|
+
|
|
1737
1888
|
const onWheel = (e: WheelEvent) => {
|
|
1738
1889
|
e.preventDefault();
|
|
1739
|
-
const
|
|
1740
|
-
const cx = e.clientX -
|
|
1741
|
-
const cy = e.clientY -
|
|
1890
|
+
const box = hostGeom();
|
|
1891
|
+
const cx = e.clientX - box.left;
|
|
1892
|
+
const cy = e.clientY - box.top;
|
|
1742
1893
|
// Normalize line/page-mode deltas to pixels before anything below
|
|
1743
1894
|
// reads them — see `wheelDeltaToPixels` (issue #94). Zoom's own
|
|
1744
1895
|
// [-50, 50] clamp already absorbed this for the pinch/ctrl+wheel path,
|
|
1745
1896
|
// but pan had no such clamp so a line-mode mouse wheel panned at only
|
|
1746
1897
|
// a few px per notch.
|
|
1747
|
-
const dx = wheelDeltaToPixels(e.deltaX, e.deltaMode,
|
|
1748
|
-
const dy = wheelDeltaToPixels(e.deltaY, e.deltaMode,
|
|
1898
|
+
const dx = wheelDeltaToPixels(e.deltaX, e.deltaMode, box.width);
|
|
1899
|
+
const dy = wheelDeltaToPixels(e.deltaY, e.deltaMode, box.height);
|
|
1749
1900
|
// Mac trackpad pinch fires wheel with ctrlKey:true automatically, even
|
|
1750
1901
|
// without a physical Ctrl press — so the same branch covers both
|
|
1751
1902
|
// Ctrl+wheel (mouse) and pinch-zoom (trackpad).
|
|
@@ -1794,9 +1945,9 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1794
1945
|
ev.preventDefault();
|
|
1795
1946
|
if (!gesture.active) return;
|
|
1796
1947
|
const e = ev as SafariGestureEvent;
|
|
1797
|
-
const
|
|
1798
|
-
const cx = e.clientX -
|
|
1799
|
-
const cy = e.clientY -
|
|
1948
|
+
const box = hostGeom();
|
|
1949
|
+
const cx = e.clientX - box.left;
|
|
1950
|
+
const cy = e.clientY - box.top;
|
|
1800
1951
|
const s = e.scale || 1;
|
|
1801
1952
|
const factor = gesture.lastScale > 0 ? s / gesture.lastScale : 1;
|
|
1802
1953
|
gesture.lastScale = s;
|
|
@@ -1939,8 +2090,14 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1939
2090
|
host.addEventListener('gesturestart', onGestureStart, { passive: false });
|
|
1940
2091
|
host.addEventListener('gesturechange', onGestureChange, { passive: false });
|
|
1941
2092
|
host.addEventListener('gestureend', onGestureEnd, { passive: false });
|
|
2093
|
+
const win = doc.defaultView;
|
|
2094
|
+
win?.addEventListener('resize', markHostStale);
|
|
2095
|
+
win?.addEventListener('scroll', markHostStale, { capture: true, passive: true });
|
|
1942
2096
|
|
|
1943
2097
|
return () => {
|
|
2098
|
+
hostRo?.disconnect();
|
|
2099
|
+
win?.removeEventListener('resize', markHostStale);
|
|
2100
|
+
win?.removeEventListener('scroll', markHostStale, { capture: true } as EventListenerOptions);
|
|
1944
2101
|
doc.removeEventListener('wheel', captureWheel, { capture: true } as EventListenerOptions);
|
|
1945
2102
|
doc.removeEventListener('keydown', captureKeyDown, { capture: true } as EventListenerOptions);
|
|
1946
2103
|
doc.removeEventListener('keyup', captureKeyUp, { capture: true } as EventListenerOptions);
|
|
@@ -1966,7 +2123,10 @@ export function useViewportController(opts: ViewportControllerOptions): Viewport
|
|
|
1966
2123
|
if (cb) cb({ ...vpRef.current });
|
|
1967
2124
|
}
|
|
1968
2125
|
if (interactEndTimerRef.current != null) clearTimeout(interactEndTimerRef.current);
|
|
1969
|
-
|
|
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);
|
|
1970
2130
|
};
|
|
1971
2131
|
}, []);
|
|
1972
2132
|
|
|
@@ -2200,6 +2360,8 @@ function useExportCaptureBridge() {
|
|
|
2200
2360
|
? m.artboardIds.filter((s): s is string => typeof s === 'string')
|
|
2201
2361
|
: null;
|
|
2202
2362
|
void (async () => {
|
|
2363
|
+
// 2.0.5 — a capture renders every artboard live: wake the sleeping ones for the whole batch.
|
|
2364
|
+
const releaseLive = await holdAllLive();
|
|
2203
2365
|
const savedWorld = resetWorldPlane();
|
|
2204
2366
|
// Hold the chrome suppression across the WHOLE batch. `svgForElement`
|
|
2205
2367
|
// applies it per target too (ref-counted), but a 10-artboard deck would
|
|
@@ -2252,6 +2414,7 @@ function useExportCaptureBridge() {
|
|
|
2252
2414
|
});
|
|
2253
2415
|
} finally {
|
|
2254
2416
|
releaseChrome();
|
|
2417
|
+
releaseLive();
|
|
2255
2418
|
restoreWorldPlane(savedWorld);
|
|
2256
2419
|
busy = false;
|
|
2257
2420
|
}
|
|
@@ -2355,21 +2518,38 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2355
2518
|
});
|
|
2356
2519
|
}, [seeds]);
|
|
2357
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
|
+
|
|
2358
2540
|
// Artboards live in state (not a useMemo) so a drag commit can update
|
|
2359
2541
|
// positions in-place without waiting for an iframe reload to re-read meta.
|
|
2360
2542
|
// Phase 4.2 originally used useMemo([seeds]) — dragging would PATCH the
|
|
2361
2543
|
// server but the local React state stayed frozen at mount-time. Users had
|
|
2362
2544
|
// to switch canvases (forcing a reload) to see the new position.
|
|
2363
|
-
const [artboards, setArtboards] = useState<ArtboardRect[]>(
|
|
2364
|
-
// true once a layout was committed or undone in this session (applyArtboardLayout) — see the row flow below
|
|
2365
|
-
const arrangedRef = useRef(false);
|
|
2545
|
+
const [artboards, setArtboards] = useState<ArtboardRect[]>(seededArtboards);
|
|
2366
2546
|
|
|
2367
2547
|
// Re-seed when JSX children change (HMR after canvas TSX edit). The seed
|
|
2368
2548
|
// signature is identity-stable across renders that don't change the JSX,
|
|
2369
2549
|
// so this won't clobber drag-commit state during normal interaction.
|
|
2370
2550
|
useEffect(() => {
|
|
2371
|
-
setArtboards(
|
|
2372
|
-
}, [
|
|
2551
|
+
setArtboards(seededArtboards());
|
|
2552
|
+
}, [seededArtboards]);
|
|
2373
2553
|
|
|
2374
2554
|
// rc3 r4-12 — every press here tells the shell, so its open menus close (WebKit gives the shell no blur for it)
|
|
2375
2555
|
useEffect(
|
|
@@ -2387,11 +2567,11 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2387
2567
|
useEffect(() => {
|
|
2388
2568
|
if (typeof document === 'undefined') return;
|
|
2389
2569
|
const onRefresh = () => {
|
|
2390
|
-
setArtboards(
|
|
2570
|
+
setArtboards(seededArtboards());
|
|
2391
2571
|
};
|
|
2392
2572
|
document.addEventListener('maude:meta-refreshed', onRefresh);
|
|
2393
2573
|
return () => document.removeEventListener('maude:meta-refreshed', onRefresh);
|
|
2394
|
-
}, [
|
|
2574
|
+
}, [seededArtboards]);
|
|
2395
2575
|
|
|
2396
2576
|
// Stable refs so the controller's callbacks always see the latest values.
|
|
2397
2577
|
const artboardsRef = useRef(artboards);
|
|
@@ -2402,8 +2582,11 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2402
2582
|
// p8-edit-multi-flake — the camera the runtime placed by itself and the host size it fits (null: persisted /
|
|
2403
2583
|
// resumed, or the camera has moved since). A host that grows from a placeholder size re-fits (below).
|
|
2404
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);
|
|
2405
2587
|
const dropAutoFit = useCallback(() => {
|
|
2406
2588
|
autoFitRef.current = null;
|
|
2589
|
+
restoredRef.current = null; // a camera someone moved is theirs, wherever it points
|
|
2407
2590
|
}, []);
|
|
2408
2591
|
|
|
2409
2592
|
const computeFitForArtboards = useCallback((): ViewportState => {
|
|
@@ -2412,6 +2595,15 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2412
2595
|
return computeFit(artboardsRef.current, host, 24, canvasInsets());
|
|
2413
2596
|
}, []);
|
|
2414
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
|
+
|
|
2415
2607
|
const getInitial = useCallback((): ViewportState | null => {
|
|
2416
2608
|
// RC3 — after a soft-reload remount, resume the live camera parked at
|
|
2417
2609
|
// module scope (exact, no settle lag) before falling back to the meta
|
|
@@ -2420,17 +2612,18 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2420
2612
|
const meta = readCanvasMeta();
|
|
2421
2613
|
const v = meta?.viewport;
|
|
2422
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 };
|
|
2423
2616
|
return { x: v.x, y: v.y, zoom: v.zoom };
|
|
2424
2617
|
}
|
|
2425
2618
|
const host = hostRef.current;
|
|
2426
2619
|
if (!host) return null;
|
|
2427
|
-
const fit =
|
|
2620
|
+
const fit = computeBootForArtboards();
|
|
2428
2621
|
// §5.6 I2 — remember the boot fit only if no insets had arrived yet (else it already honours them).
|
|
2429
2622
|
bootFitRef.current =
|
|
2430
2623
|
typeof window !== 'undefined' && canvasModeStore(window).get().insetsSeq < 0 ? fit : null;
|
|
2431
2624
|
autoFitRef.current = { camera: { ...fit }, w: host.clientWidth, h: host.clientHeight };
|
|
2432
2625
|
return fit;
|
|
2433
|
-
}, []);
|
|
2626
|
+
}, [computeBootForArtboards]);
|
|
2434
2627
|
|
|
2435
2628
|
const onSettle = useCallback((v: ViewportState) => {
|
|
2436
2629
|
patchCanvasMeta({ viewport: v });
|
|
@@ -2458,6 +2651,7 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2458
2651
|
hostRef,
|
|
2459
2652
|
worldRef,
|
|
2460
2653
|
computeFit: computeFitForArtboards,
|
|
2654
|
+
computeBoot: computeBootForArtboards,
|
|
2461
2655
|
getInitial,
|
|
2462
2656
|
onSettle,
|
|
2463
2657
|
jumpTargets: artboards,
|
|
@@ -2538,6 +2732,33 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2538
2732
|
return () => ro.disconnect();
|
|
2539
2733
|
}, []);
|
|
2540
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
|
+
|
|
2541
2762
|
// S3.2a — Present · Artboards: inert until the shell's `set-mode` says so (present/present-stage.tsx).
|
|
2542
2763
|
const presentSelection = useSelectionSetOptional();
|
|
2543
2764
|
usePresentStage({ hostRef, worldRef, artboards, controller, selection: presentSelection });
|
|
@@ -2616,11 +2837,6 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2616
2837
|
// only (never written to the meta: heights change with content, and a flow saved there would churn it on every
|
|
2617
2838
|
// open); a person's arrangement is left alone — `flowRows` refuses any layout that is no longer the generated
|
|
2618
2839
|
// grid, and `arrangedRef` stops it for the rest of the session once a layout was committed or undone.
|
|
2619
|
-
const rowFlowOn = useMemo(() => isDsCanvasIds(seeds.map((s) => s.id)), [seeds]);
|
|
2620
|
-
const declaredSizes = useMemo(
|
|
2621
|
-
() => new Map(seeds.map((s) => [s.id, { w: s.w, h: s.h }] as const)),
|
|
2622
|
-
[seeds]
|
|
2623
|
-
);
|
|
2624
2840
|
// biome-ignore lint/correctness/useExhaustiveDependencies: `artboards` is the trigger (a measured height arrived); the setter reads the latest through `prev`.
|
|
2625
2841
|
useEffect(() => {
|
|
2626
2842
|
if (!rowFlowOn || arrangedRef.current) return;
|
|
@@ -2728,9 +2944,11 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2728
2944
|
MORE than the mock — fit + actual-size — so no capability is lost. */}
|
|
2729
2945
|
{showZoom ? <DCZoomToolbar /> : null}
|
|
2730
2946
|
<ViewportZoomReporter />
|
|
2947
|
+
<ArtboardLiveFeed zoom={controller.viewport.zoom} interacting={!!controller.isInteracting} />
|
|
2731
2948
|
{/* ── S8.19 (L1) placeholder frames ── "Waiting for Jonas's Mac" / Missing over a picture
|
|
2732
2949
|
that failed to load; driven only by the shell's dgn `asset-state` (asset-placeholder.tsx). */}
|
|
2733
|
-
|
|
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} />
|
|
2734
2952
|
{/* r5-2 — a play / pause button over a placed or annotation clip (hover / selected), in Edit and Preview. */}
|
|
2735
2953
|
<VideoPlayLayer />
|
|
2736
2954
|
</div>
|
|
@@ -2899,6 +3117,10 @@ function DCArtboardBody({
|
|
|
2899
3117
|
[id]
|
|
2900
3118
|
);
|
|
2901
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
|
+
|
|
2902
3124
|
// Drag hook — always called (hook rules). Inert outside DesignCanvas
|
|
2903
3125
|
// (allRects empty, enabled=false), so specimens / legacy uses get a plain
|
|
2904
3126
|
// fixed-size block as before.
|
|
@@ -3110,7 +3332,17 @@ function DCArtboardBody({
|
|
|
3110
3332
|
>
|
|
3111
3333
|
<header className="dc-artboard-label sku">{label}</header>
|
|
3112
3334
|
<div className="dc-artboard-body" ref={bodyRef} style={bodyStyle}>
|
|
3113
|
-
|
|
3335
|
+
<ArtboardLiveGate
|
|
3336
|
+
id={id}
|
|
3337
|
+
articleRef={articleRef}
|
|
3338
|
+
bodyRef={bodyRef}
|
|
3339
|
+
heightFloor={heightFloor}
|
|
3340
|
+
background={background}
|
|
3341
|
+
pinned={holdsSelection}
|
|
3342
|
+
eager={hasVideo || hasVideoContent}
|
|
3343
|
+
>
|
|
3344
|
+
{children}
|
|
3345
|
+
</ArtboardLiveGate>
|
|
3114
3346
|
</div>
|
|
3115
3347
|
</article>
|
|
3116
3348
|
);
|
|
@@ -3284,7 +3516,20 @@ function DCArtboardBody({
|
|
|
3284
3516
|
containIntrinsicSize: `${rect.w}px ${rect.h}px`,
|
|
3285
3517
|
}}
|
|
3286
3518
|
>
|
|
3287
|
-
{
|
|
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. */}
|
|
3522
|
+
<ArtboardLiveGate
|
|
3523
|
+
id={id}
|
|
3524
|
+
articleRef={articleRef}
|
|
3525
|
+
bodyRef={bodyRef}
|
|
3526
|
+
heightFloor={heightFloor}
|
|
3527
|
+
background={background}
|
|
3528
|
+
pinned={isActive || holdsSelection}
|
|
3529
|
+
eager={hasVideo || hasVideoContent}
|
|
3530
|
+
>
|
|
3531
|
+
{children}
|
|
3532
|
+
</ArtboardLiveGate>
|
|
3288
3533
|
</div>
|
|
3289
3534
|
</article>
|
|
3290
3535
|
{showActivity ? (
|
|
@@ -4111,8 +4356,8 @@ export function PhotoPreviewBridge() {
|
|
|
4111
4356
|
};
|
|
4112
4357
|
scan();
|
|
4113
4358
|
const observer = new MutationObserver(() => {
|
|
4114
|
-
|
|
4115
|
-
raf =
|
|
4359
|
+
frameCaf(raf);
|
|
4360
|
+
raf = frameRaf(scan);
|
|
4116
4361
|
});
|
|
4117
4362
|
observer.observe(document.body, {
|
|
4118
4363
|
childList: true,
|
|
@@ -4122,7 +4367,7 @@ export function PhotoPreviewBridge() {
|
|
|
4122
4367
|
});
|
|
4123
4368
|
return () => {
|
|
4124
4369
|
cancelled = true;
|
|
4125
|
-
|
|
4370
|
+
frameCaf(raf);
|
|
4126
4371
|
observer.disconnect();
|
|
4127
4372
|
};
|
|
4128
4373
|
}, [apply, nextFetchGen, isLatestFetch]);
|