snapshot of https://github.com/toeverything/AFFiNE.git (canary, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Build & Test / Analyze (javascript, affine) (push) Failing after 4s
Build & Test / Analyze (typescript, affine) (push) Failing after 3s
Build & Test / Rust test filter (push) Failing after 4s
Build & Test / Check yarn binary (push) Failing after 3s
Build & Test / E2E BlockSuite Test (3) (push) Failing after 3s
Build & Test / Analyze (javascript, blocksuite) (push) Failing after 3s
Build & Test / Analyze (typescript, blocksuite) (push) Failing after 3s
Build & Test / Mobile native build filter (push) Failing after 3s
Build & Test / E2E BlockSuite Test (1) (push) Failing after 4s
Build & Test / E2E BlockSuite Test (2) (push) Failing after 4s
Build & Test / E2E Mobile Test (1) (push) Failing after 3s
Build & Test / Unit Test (1) (push) Has been skipped
Build & Test / Unit Test (2) (push) Has been skipped
Build & Test / Unit Test (3) (push) Has been skipped
Build & Test / Unit Test (4) (push) Has been skipped
Build & Test / Unit Test (5) (push) Has been skipped
Build & Test / Native Unit Test (push) Has been skipped
Build & Test / E2E BlockSuite Test (4) (push) Failing after 3s
Build & Test / E2E BlockSuite Test (5) (push) Failing after 3s
Build & Test / E2E BlockSuite Cross Browser Test (push) Failing after 3s
Build & Test / E2E Mobile Test (2) (push) Failing after 3s
Build & Test / Build AFFiNE native (x86_64-unknown-linux-gnu) (push) Failing after 3s
Build & Test / Build Server native (push) Failing after 3s
Build & Test / Check Git Status (push) Has been skipped
Build & Test / Server Test (0, 4) (push) Has been skipped
Build & Test / Server Test (1, 4) (push) Has been skipped
Build & Test / Server Test (2, 4) (push) Has been skipped
Build & Test / Server Test (3, 4) (push) Has been skipped
Build & Test / Server Test with Elasticsearch (push) Has been skipped
Build & Test / Build @affine/electron renderer (push) Failing after 3s
Build & Test / Copilot test filter (push) Failing after 4s
Build & Test / Lint Rust (push) Has been skipped
Build & Test / Server Test with Embedded Search (push) Has been skipped
Build & Test / Server Test with Manticore Search (push) Has been skipped
Build & Test / Server E2E Test (push) Has been skipped
Build & Test / Cloud Desktop E2E Test (push) Has been skipped
Build & Test / Cloud E2E Test 1/2 (push) Has been skipped
Build & Test / Cloud E2E Test 2/2 (push) Has been skipped
Build & Test / Build Android app (push) Has been skipped
Build & Test / Test Android app (push) Has been skipped
Build & Test / Run native tests (push) Has been skipped
Build & Test / Server Copilot Api Test (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (1, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (2, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (3, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (4, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (5, 5) (push) Has been skipped
Release / Canary Gate (push) Has been skipped
Build & Test / Build AFFiNE native (aarch64-apple-darwin) (push) Has been cancelled
Build & Test / Lint (push) Has been cancelled
Build & Test / Typecheck (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-apple-darwin) (push) Has been cancelled
Build & Test / Desktop Test (ubuntu-latest, linux, x64, x86_64-unknown-linux-gnu, true) (push) Has been cancelled
Build & Test / Desktop Test (windows-latest, windows, x64, x86_64-pc-windows-msvc, true) (push) Has been cancelled
Build & Test / E2E Test (1) (push) Has been cancelled
Build & Test / E2E Test (2) (push) Has been cancelled
Build & Test / E2E Test (3) (push) Has been cancelled
Build & Test / E2E Test (4) (push) Has been cancelled
Build & Test / E2E Test (5) (push) Has been cancelled
Build & Test / Build AFFiNE native (aarch64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, arm64, aarch64-apple-darwin, true) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, x64, x86_64-apple-darwin, false) (push) Has been cancelled
Build & Test / 3, 2, 1 Launch (push) Has been cancelled
Build & Test / Build iOS app (push) Has been cancelled
Copilot Test Automatically / Setup Test (push) Failing after 1s
Release / Prepare (push) Failing after 2s
Release / Release Cloud (push) Has been skipped
Release / Release Desktop (push) Has been skipped
Release / Release Docker Image (push) Has been skipped
Release / Release Mobile (push) Has been skipped

This commit is contained in:
upstream-mirror
2026-09-16 04:01:20 +05:00
commit 702cc698a7
9990 changed files with 1073618 additions and 0 deletions

View File

@@ -0,0 +1,117 @@
[**BlockSuite API Documentation**](../../../../README.md)
***
[BlockSuite API Documentation](../../../../README.md) / [@blocksuite/std](../../README.md) / [gfx](../README.md) / viewportRuntimeConfig
# Variable: viewportRuntimeConfig
> `const` **viewportRuntimeConfig**: `object`
Process-wide defaults applied to every Viewport at construction.
Platforms that need different behavior (e.g. mobile/iOS, which must clamp the
zoom floor and defer DOM mutations during gestures to avoid WKWebView process
termination) override these once at startup, before any editor mounts. This
guarantees both the editor and the readonly preview viewports are born with
the same limits — avoiding the race and wrong-instance problems of patching a
single Viewport asynchronously after it has already mounted.
Desktop leaves these untouched, so its behavior is unchanged.
## Type Declaration
### CANVAS\_DPR\_CAP\_BY\_ZOOM
> **CANVAS\_DPR\_CAP\_BY\_ZOOM**: \[`number`, `number`\][]
Caps the canvas backing-store device-pixel-ratio at low zoom.
Each entry is `[zoomThreshold, dprCap]`, sorted ascending by threshold.
When the live zoom is below a threshold, the corresponding cap bounds the
effective dpr used to size canvases. Far-out zoom makes content tiny on
screen, so a full retina backing store is wasted memory — on iOS that waste
is what pushes WKWebView past its compositing budget and crashes the web
content process during pan/zoom.
Empty (the desktop default) means no cap: canvases always use the raw
`window.devicePixelRatio`, so desktop behavior is unchanged.
### LOW\_ZOOM\_GESTURE\_ACTIVE\_BLOCK\_LIMIT
> **LOW\_ZOOM\_GESTURE\_ACTIVE\_BLOCK\_LIMIT**: `number` = `0`
During low-zoom gesture survival mode, keep only a tiny subset of DOM blocks
as real active DOM (selected + a few nearby blocks). `0` keeps the legacy
behavior where every viewport block remains visually mounted as `survival`.
### LOW\_ZOOM\_GESTURE\_ACTIVE\_DISTANCE\_RATIO
> **LOW\_ZOOM\_GESTURE\_ACTIVE\_DISTANCE\_RATIO**: `number` = `0.35`
Distance threshold (as a fraction of the viewport's shorter side) used to
decide whether an unselected viewport block counts as "nearby" to the
current selection during low-zoom gesture survival mode.
### OVERSCAN\_RATIO
> **OVERSCAN\_RATIO**: `number` = `0`
Fraction by which the *render/activation* viewport bound is enlarged on
every side (see Viewport.overscanViewportBounds). Pre-painting a
margin around the visible area means moderate pan/zoom gestures move into
content that is already mounted and rasterized, so it does not blank out
and wait for the post-gesture refresh.
Memory grows by roughly `(1 + 2 * ratio) ** 2`, so this must stay modest
and be paired with a zoom floor + dpr cap on mobile. `0` (desktop default)
makes Viewport.overscanViewportBounds identical to
Viewport.viewportBounds, leaving desktop behavior unchanged.
This governs the *canvas* render bound only (see
Viewport.overscanViewportBounds). It enlarges the canvas backing
stores, so memory grows with the overscan area. Keep it modest and pair it
with the mobile zoom floor + dpr cap so connectors/elements stay painted
through a gesture without pushing WKWebView over budget.
### OVERSCAN\_RATIO\_BLOCK
> **OVERSCAN\_RATIO\_BLOCK**: `number` = `0`
Like [OVERSCAN\_RATIO](#overscan_ratio) but for the *DOM block mounting* bound (see
Viewport.overscanBlockBounds). This one is expensive: every
mounted block becomes its own composited layer subtree in the WebContent
process, so enlarging it multiplies resident memory and is what pushes the
process toward an iOS jetsam kill. Keep this small (or `0`) even when
[OVERSCAN\_RATIO](#overscan_ratio) is generous. `0` (desktop default) leaves block
mounting on the exact visible bound, unchanged from upstream.
### POST\_GESTURE\_REFRESH\_DELAY
> **POST\_GESTURE\_REFRESH\_DELAY**: `number` = `800`
Delay (ms) before the post-gesture refresh repaints canvases and reactivates
blocks, used only when [SKIP\_REFRESH\_DURING\_GESTURE](#skip_refresh_during_gesture) is true. The same
value drives both the canvas and block refresh timers so they fire together
(avoiding the "blocks appear, then connectors" staggered reveal). Desktop
never enters that code path, so this is mobile-only.
### SKIP\_REFRESH\_DURING\_GESTURE
> **SKIP\_REFRESH\_DURING\_GESTURE**: `boolean` = `false`
### VIEWPORT\_REFRESH\_MAX\_INTERVAL
> **VIEWPORT\_REFRESH\_MAX\_INTERVAL**: `number` = `120`
### VIEWPORT\_REFRESH\_PIXEL\_THRESHOLD
> **VIEWPORT\_REFRESH\_PIXEL\_THRESHOLD**: `number` = `18`
### ZOOM\_MAX
> **ZOOM\_MAX**: `number`
### ZOOM\_MIN
> **ZOOM\_MIN**: `number`