Commit Graph
29 Commits
Author SHA1 Message Date
DarkSky 7ebdec91c7 fix(desktop): preserve database backlink order and limits
Keep discovery order when database names compare equal. Count rows that
link to their own document before the search removes them.
2026-12-05 06:30:02 +09:00
DarkSky b4548df803 fix(mobile): use grapheme boundaries in field hit tests 2026-12-05 05:52:18 +09:00
DarkSky 7605b96e7b feat(hosts): mount MobileShellView in iOS and Android native runtimes
The iOS and Android hosts now start on the mobile product shell (Home,
Explorer, Journals, Search, Settings, and the Page route) instead of one
bare page editor.

- Add a runtime root that is a bare PlaygroundView or a MobileShellView.
  Editor calls go to the root editor, or to the shell's embedded page
  editor while the Page route shows with no sheet or drawer above it.
  Otherwise the focused shell input handler (Search or the drawer
  filter) takes UITextInput and InputConnection text.
- Send every shell touch to Rust outside the page editor, and ask for
  the software keyboard when a touch focuses a shell text field.
- Let the page editor close its overlay on back first, then run
  MobileBackCoordinator. A tab other than Home steps back to Home
  before the app exits.
- Mount the local workspace that bootstrap opened through
  SqliteWorkspaceStore and MobileWorkspaceBridge on every bootstrap
  path. The mount reads only the root document and db tables, and each
  page loads when the shell opens it. A failed load retries the next
  time the shell shows the page.
- Commit shell edits every second on the scheduler clock, and again
  when the app goes to the background. A commit without pending
  changes does no SQLite access.
- Drop text and composition edits while a sheet covers the shell,
  except in the drawer once its filter holds focus.
- Follow the system dark mode while the app runs, and publish the
  shell accessibility tree as Android virtual views with stable IDs
  and accessibility focus.
- Read the allowlist again on a retried Android bootstrap while no
  shell workspace is mounted.
- Keep the bare editor C ABI and JNI entry points for editor tests.
- Add Rust, Swift, and Kotlin tests for routes, IME, Search, sheets,
  back, lazy page loads, autosave, and a SQLite reopen.
2026-12-05 01:38:56 +09:00
DarkSky c496a1bdd1 perf(frontend): remove unused desktop dependencies
Use the workspace y-octo features in the editor and playground.
2026-12-03 14:03:27 +09:00
DarkSky 445a1092e9 feat(desktop): keep Web Desktop workspaces in IndexedDB
Read and write each workspace through its IndexedDB v3 store.
Keep document edits and deletions in order across retries and reloads.
Seed empty workspaces under the startup lock and release it if a write
cannot start or the connection closes.

Wait for pending transactions and read the stored clocks before each
retry. Cancel queued retries when the connection closes. Compact a
document only when its snapshot and all source updates still match.
2026-12-02 15:10:57 +09:00
DarkSky 2814923c96 perf(playground): parse block links with the browser URL on the Web
On the Web, read block links with the browser URL parser. Other targets
keep the url crate. Both targets share the path, query and encoding
rules, so the playground crate drops percent-encoding.

The Wasm bundle drops url, IDNA and Unicode normalization tables.
Block links keep the same WHATWG origin, path and query rules.

Send read-only link taps on Page and Edgeless through the block link
host. Format Markdown from the current text when the user clicks Copy
as Markdown. Cancel a pending copy if the active document changes.

Clamp a stored toolbar scroll offset when its row gets narrower. Clear
toolbar measurements, block toolbar submenus and the table axis menu
scroll when the document changes.

Skip the redraw if the table axis menu scroll stays in place.
2026-12-02 09:09:29 +09:00
DarkSky e85ab555be fix(editor): open workspace block links and keep toolbar actions in reach 2026-12-02 02:26:12 +09:00
DarkSky 6dbd463e67 feat(frontend): connect workspace sync to the native shells and fit embedded editors 2026-12-01 23:05:25 +09:00
DarkSky cfbfed3211 feat(store,client,android,edgeless): atomic draft persistence, share inbox orphan sweep, and lazy doc hydration 2026-12-01 10:05:23 +09:00
DarkSky 2b94d66b97 perf(editor): skip snapshot markers and reuse static icon strings 2026-12-01 08:22:39 +09:00
DarkSky 737fb5831d perf(frontend): enable Wasm SIMD, remove unused UI code, and add a browser lifecycle harness
Build the playground bundle and the four preview workers with `simd128`.
Pass the path remaps to the playground build. Pass `--enable-simd` to each `wasm-opt` call.

Remove the Taffy `grid` feature and the grid style API. No caller uses them.
Remove the unused wgpu `surface` pipeline and its shader entry points.
Remove the unused `SwipeMenu` component.
Remove the unused typography radii from the generated tokens.
Share one progress bar function between the database table and the kanban card.

Add `chromium-harness.mjs` for the browser verification scripts.
The harness owns the work directory and each process group that a script starts.
A normal end, a failed assertion, `SIGINT`, and `SIGTERM` stop each process group. Then the harness removes the directory.
Chromium keeps its temporary files in the work directory.

Use the harness in the two dual-shell verification scripts.
Correct the repository root path in `verify-canary-dual-shell-e2e.mjs` and `stage-canary-dual-shell.mjs`.

Record the SIMD worker sizes and the build flags in the preview `BENCHMARK.md`.
2026-12-01 04:24:06 +09:00
DarkSky 7dbb4efe41 perf(frontend): generate shadow tables and restore Mermaid ELK routing
Generate shadow tables from CSS tokens. Validate numeric ranges.
Preserve fractional color channels. Remove the runtime parser and cache.
Drop unused palette slices and typography fields.

Restore ELK layout. Test the geometry of nine directed edges.
Record the Wasm sizes. Remove unused frontend dependencies.
2026-11-30 16:25:12 +00:00
DarkSky d6a4b05c96 perf(frontend,ui,preview): slim Wasm, native bundles, and Mermaid layout
Reduce WebAssembly, Android, and iOS artifact sizes across the native client workspace without dropping editor features.

1. Switch the playground WebAssembly build to the size profile without LTO.
2. Add a fat-LTO cdylib profile with path remapping for the four preview workers.
3. Remove unused SVG font and emoji regex fallback code from `ui`.
4. Deduplicate shared WGSL shader source in `.rodata` and pass `Path` by borrow in `Window::paint_path`.

5. Decouple `svg-text` from `blocksuite-preview` worker features and call `merman::Renderer::render_svg_data`.
6. Disable ELK layout in `merman` so all 35 diagram families use Dagre or Cytoscape.
7. Strip `libaffine_android_host.so` with NDK `llvm-strip` in `package-debug-apk.sh`.
8. Remove redundant `opt-level=0` overrides from the iOS CI workflow and bump its cache key.
2026-11-30 10:29:44 +00:00
DarkSky 4e66722b44 feat(mobile): mount native GPU BlockSuite editor in iOS and Android hosts
- Add orthogonal PointerKind, FormFactor, and EditorCapabilities matrix in blocksuite-editor, decoupling database_readonly from edgeless_readonly and enforcing page_readonly across command/toolbar paths
- Attach cross-platform CJK and emoji FontFallbacks to blocksuite-editor text runs so iOS CoreText and Android CosmicTextSystem render CJK and emoji glyphs cleanly
- Wire real WgpuRenderer and CosmicTextSystem into Android ANativeWindow via SwappableAtlas, deterministic ui::clock_now() dispatch_after timer draining, single-JNI UTF-16 reads, surrogate-pair composing alignment, requestCursorUpdates + Matrix CursorAnchorInfo, historical ACTION_MOVE samples, hardware keyboard/scroll forwarding, and zero shadow-buffer pollution
- Frame iOS MetalHostView and SelectionOverlayView inside safeAreaInsets, gate software keyboard responder on PlaygroundView::wants_software_keyboard and pan-slop tap detection, avoid double safe_bottom subtraction on KeyboardToolbar insets, prevent spurious UITextInputDelegate textWillChange/textDidChange echo during IME composition, yield hardware pressesBegan during marked text, and guard UIEditMenuInteraction with explicit actions
- Enable wgpu/cosmic-text for target_os = "android" in packages/ui/ui and add Linux fontconfig/freetype packages to np-mobile CI workflow
2026-11-28 06:11:09 +09:00
DarkSky f7150b2191 feat(blocksuite): add affine:database CRDT codec and Table/Kanban/Calendar views 2026-11-28 00:33:36 +09:00
DarkSky 3d7c480933 perf(preview,playground): drop unused wasm exports and serve validated web fonts statically
Gate wasm-bindgen worker exports per preview target, externalize the four bundled UI/script fonts from the web playground Wasm bundle into static web assets, and validate fetched font bytes through the text system's fontdb loader so empty or HTML fallback responses fail closed with usable-face checks.
2026-11-28 00:31:40 +09:00
DarkSky 05caa146a1 fix(editor): align code, table, paste, list collapse, CJK word selection, and edgeless authoring
- Indent and outdent code block lines on Tab and Shift+Tab by exact two-space indents in one undo step without deleting selection.
- Keep Tab and Shift+Tab inside focused table cells and insert newlines on Enter.
- Unwrap outer affine:note and affine:page wrappers during note paste while preserving Slice containers on parse.
- Compute gutter collapse chevrons during layout for normal lists and paragraphs with children and allow expanding collapsed lists.
- Match 0.27.5 edgeless Ctrl/Cmd+wheel zoom direction, 5-shape picker, shape/connector Curve defaults and live preview, unclamped centered shape text editing, and CJK compound word selection.
2026-11-27 16:31:07 +09:00
DarkSky a6bb03e702 feat(editor): restore 0.27.5 mobile keyboard toolbar, native previews, and fold CRDT codecs 2026-11-27 08:18:25 +09:00
DarkSky 531da7466d feat(editor): add S3 rich blocks, live CRDT table cells, and mobile input
Add the S3 PageEditor stack on top of darksky/np/mobile:

- Read and render seven rich block kinds (callout, table, attachment,
  LaTeX, embed linked doc, embed synced doc, and surface ref) with pure
  Rust RaTeX math layout, syntax highlighting, Hayro PDF previews, and
  shared premultiplied RGBA-to-BGRA conversion via ui::swap_rgba_pa_to_bgra.
- Replace offline table cell string diffing and the conflict popover
  with direct in-place Y.Text CRDT splicing, O(1) read_table_block with
  zero-clone replacement, split_delta preedit, and RichParagraph cells.
- Share insertion_marks_at across paragraphs, table cells, surface
  elements, and block titles via single-delta splice_live_text; share
  AnchoredInlineInput and finish_inline_targets across table cells and
  Edgeless labels with unselected root-input suppression and same-target
  preedit commit on pointer press.
- Land mobile keyboard toolbar with 0.27.5 @blocksuite/icons tokens,
  bidi selection, touch gestures, native web clipboard paste, shared
  HTML/Markdown slice builders, and host-layer Emoji font registration.
2026-11-27 06:55:48 +09:00
DarkSky 65a2c9b097 refactor(mobile): remove duplicated logic across store and hosts
Remove eight duplicated or defensive code paths across affine-store,
affine-client, affine-mobile, and the web, iOS, and Android hosts:

- Remove explicit create recovery journals in store and client, and
  require WorkspaceDb::from_root_update_v1 to receive initial db$*
  tables at construction time instead of returning DbTableNotResolved.
- Consolidate auth protocol parsing, url::Url canonicalization,
  legacy_storage_endpoint_key (unbracketed IPv6 for 0.27.5 storage
  keys), chrono RFC3339 UTC Z normalization, Bearer checks, and
  permanent error codes into affine_store::auth while keeping iOS and
  Android 0.27.5 storage formats.
- Replace the duplicated legacy storage engine in affine-ios-host with
  affine-legacy-import, preserve malformed affine-local-workspace raw
  strings in one place, propagate iOS write-back serialization errors,
  delegate Android sentinel evaluation and probe filtering to Rust via
  a single JNI entry, and remove hardcoded Swift and Kotlin key lists.
- Remove the pure JS Yjs v1 decoder from hosts/web/src/idb-storage.js,
  expose a safe Rust wasm-codec cdylib from affine-store reusing
  merge_crdt_updates_v1, share a strict wasm-scalar-rpc.js loader with
  preview workers, wire crdt-wasm-client through index.html,
  worker-loader, host.js, stage-preview-workers, CI, and real-browser
  IDB E2E, and migrate real Yjs v1 fixtures to affine-store tests.
- Remove the 12-iteration blind SQLite retry loop in sqlite/doc.rs
  while preserving single-row empty-update registration.
- Upgrade SqliteDocStorage::checkpoint_passive to return WAL counts and
  remove duplicate maintenance pools from iOS and Android hosts.
- Remove top-level mirrored workspace fields and workspace-switch
  cloning in MobileAppState, and use generate_key_between for ordering.
- Remove pixel-fallback selection drag paths in iOS and Android hosts
  so text-layout endpoints remain the single drag authority.
2026-11-27 06:55:48 +09:00
DarkSky 9a3195bf81 feat(mobile): add S3 mobile shell, breadcrumb engine, and outbound doc refs
Implement the S3-Shell deliverables across L1 to L4:
- Add read-only outbound document reference extraction in `blocksuite/crates/doc/src/refs.rs` with zero-writeback tests.
- Add baked keyframe micro-icons, domain-neutral Breadcrumb layout, and RTL mirror tests in `packages/ui/kit`.
- Add sanitized FolderForest caching, NavHistory with 128-entry cap, pure breadcrumb derivation, and LinkGraph backlinks in `packages/frontend/client`.
- Add `affine-mobile` with interactive 4-TabBar routes, 10-section Settings, Location and Trail sheet, and `mobile-harness`.
2026-11-27 06:55:48 +09:00
DarkSky 698c268e3a feat(android-host): implement S2 Android surface, SQLite co-storage, and auth bridge
Upgrade the thin Android host from S1 to S2 across four areas:

- Present real pixel frames via NDK EGL/GLES3 (`glClear` + `eglSwapBuffers`)
  with automatic `EGLSurface` teardown and `CpuFallback` downgrade when EGL
  is unavailable, retaining `pending_frame` on failure until a frame presents.
  Full `wgpu` Vulkan-to-GLES3 rendering lands in `S3-Android`.
- Open in-place `0.27.5` SQLite WAL databases through `affine-store` with
  `busy_timeout = 5000ms` and `onStop()` `PASSIVE` checkpoints. Gate local
  workspaces by the ordered `affine-local-workspace` allowlist with zero disk
  scanning, evict unlisted local handles on shrink, and allow cloud workspaces
  and userspaces directly.
- Implement a file-locked atomic Jetpack Preferences DataStore protobuf codec
  with zero silent corruption wipes, single-lock `getOrCreateInstallationId`,
  pure-Kotlin RFC 4648 Base64 for API 24+, `v1:` AES-GCM envelopes, process-wide
  single-flight `refreshSession` with idempotent `x-affine-refresh-attempt`
  reuse and disk-write retry caching, a default `HttpUrlConnectionRefreshTransport`
  sending `refreshToken` only in the JSON body, `INTERNET` manifest permission,
  and exact `0.27.5` three-cookie plus `affine.preferences_pb` auth cleanup.
- Wire `AndroidBootstrapCoordinator` in `MainActivity.onCreate` with unified
  `WebViewStorageSentinel` validation, active `indexedDB` interception,
  lossless raw preservation of malformed workspace lists, and explicit partial
  mount failure reporting with allowlist-synced retry and write-back gating.
2026-11-27 06:55:48 +09:00
DarkSky 24e1b5d202 feat(ios-host): add in-place SQLite WAL, 2001-epoch auth, and zero-IDB localStorage bridge
Add the iOS host storage, authentication, and upgrade/rollback bridges under packages/frontend/hosts/ios:

- Wire affine-store and blocksuite-playground-doc into affine-ios-host for in-place SQLite WAL workspace and userspace databases under <Documents>/workspaces/<spaceType>/<sanitizedPeer>/<spaceId>.db, failing closed on missing or malformed affine-local-workspace allowlists so deleted local .db files never resurrect.
- Configure explicit SQLite busy_timeout (5000 ms), split remote_clock_ms from local_now_ms in apply_remote_update, add non-blocking PASSIVE WAL checkpoints on background entry, preserve dirty state whenever Metal drawables or render encoders are unavailable, and skip idle Metal draws.
- Align LegacyAuthBridge.swift and src/auth.rs with Keychain service app.affine.pro.auth-token (2001 reference-epoch f64 accessExpiresAt, shared process-level actor single-flight refresh with mutationEpochs across bridge instances, corrupt-entry self-healing, permanent invalidation cleanup, HTTP and WebKit auth cookie cleanup), UserDefaults key app.affine.pro.auth-installation-id, and /api/auth/session/{exchange,refresh,revoke} headers (x-affine-client-kind: native, x-affine-version).
- Unify LegacyLocalStorageProbe.swift and src/legacy_storage.rs on the WebViewStorageSentinel contract (all keys, whitelisted entries, idbAccessCount == 0, corrupt affine-local-workspace raw preservation, strict write-back whitelist guard, stopLoading and timeout cleanup) and wire HostBootstrapCoordinator (with allowlist eviction, rollback state sync, partial-mount error reporting, and retryable bootstrap) into MetalHostViewController with executable Swift and Rust smoke tests.
2026-11-27 06:55:48 +09:00
DarkSky d63b1c7d3b feat(frontend): add IDB v3/V1 store, legacy import, and L3 client core
Add the Wasm IndexedDB v3/V1 storage model, cross-tab BroadcastChannel codec,
frozen v0.27.5 REST and GraphQL request/response codecs, and SQLite inbound
sync batch persistence in affine-store.

Add the pure-Rust affine-legacy-import crate for allowlisted Capacitor WebView
localStorage parsing, positive sentinel validation, and rollback-window
writeback serialization.

Add the device-neutral affine-client L3 domain crate with HostBridge,
ServerRegistry (enforcing F3 on Web hosts), AuthController,
StoreBackedDocDirectory (closing root registration, anti-resurrection, and
restart recovery invariants), workspace domain services, exact substring
weighted search, 25-language i18n catalog, and production PlatformAccessibility
first-frame semantic root entry.
2026-11-27 06:55:48 +09:00
DarkSky ed72cca4a3 feat(mobile): deliver S1 thin hosts, Mermaid font measurer, and release probes
Add thin Web, iOS, and Android mobile hosts, harden the blocksuite-preview
Mermaid renderer and Wasm exports, and add S1 release performance probes
with CI artifact and native host linking gates.

- Preview: use FontPoolWidthMeasurer with variable-font HVAR weight
  instantiation, integer pixel ceil widths, front-matter theme injection,
  high-contrast Light and Dark palettes, premultiplied RGBA PNG compositing,
  and Wasm theme parameters.
- Probes and CI: add s1_sqlite_probe and s1_probes release tests, record
  measured latency and peak RSS in BENCHMARK.md, add timeout-minutes on all
  np-mobile jobs, upload s1-probes-artifacts, and link Android NDK .so,
  kotlinc Activity, and iOS Simulator swiftc executable in CI.
- Web host: use an offscreen canvas GPU probe, add OAuth redirect-loop and
  runtime GPU loss guards, restrict embed URLs and sandbox tokens, match
  /api/auth/captcha Turnstile headers, and launch four independent ES module
  Blob workers pinned to site root.
- iOS host: add affine-ios-host staticlib crate implementing all C-ABI
  functions with surrogate-pair safe UTF-16 editing, weak DisplayLinkProxy,
  absolute ime_bottom contract, and in-memory LegacyCapacitorSchemeHandler.
- Android host: implement hand-written JNI bridge with absolute ime_bottom
  logical-dp conversion, predictive and legacy back gesture handling, and a
  pure Android platform SDK MainActivity and LegacyLocalStorageProbe.
2026-11-27 06:55:47 +09:00
DarkSky 8e0b345036 feat(editor): extract ui-tokens, ui-kit, and blocksuite-editor crates
Add the zero-dependency ui-tokens crate to export generated theme tokens,
icon definitions, and bundled font bytes without cross-tree include_bytes!
paths.

Add the domain-neutral ui-kit crate with logical geometry helpers, SafeArea,
VirtualList, SwipeDialog, and SwipeMenu state machines backed by scheduler
time and four-rate replay invariance tests.

Extract blocksuite-editor from playground with the WorkspaceDocDirectory
host port, exact substring UTF-16 highlight matching, and LTR/RTL logical
start/end block flow layout. Slim playground to the demo and harness host.
Update workspace manifests, static invariant guards, CI workflows, and
AGENTS.md files.
2026-11-27 06:55:47 +09:00
DarkSky d619bfbcda feat(preview): add pure-Rust offline preview kernel crate 2026-11-27 06:55:47 +09:00
DarkSky eff3ff6d56 feat(store): integrate affine-store into frontend workspace and harden sync
Integrate `packages/common/store` (`affine-store`) into the unified
`packages/frontend` workspace and close cross-client compatibility and
crash-recovery invariants against `0.27.5`:

- Encode page creation identity via `PageIdSource` and `CreateDocId`
  (`DerivedFromOp` vs `Explicit`), derive deterministic 10-character
  URL-safe NanoIDs from `(space_id, op_id)` without sidecar tables or
  extra keys in shared Yjs `meta.pages`, and reject `page_id` collisions
  with the root `space_id`.
- Keep `DocMode::Page` writing only the root document, require
  `db$docProperties` to be resolved before non-`Page` creation
  (returning `StoreError::DbTableNotResolved` so retry intent survives
  restarts), gate explicit non-`Page` crash-replay backfill on a
  client-local `export_explicit_create_journal` /
  `import_explicit_create_journal` record so legacy `0.27.5` pages
  without `DocProperties` rows keep `DocMode::Page`, preserve existing
  live or soft-deleted `DocProperties` rows independently of root page
  repair, and start `SqliteDocStorage::push_updates_batch` with
  `BEGIN IMMEDIATE` to prevent `SQLITE_BUSY_SNAPSHOT` on pooled WAL
  connections.
- Capture unacknowledged `in_flight` and deferred `JoinDocs` updates in
  `SpaceSyncEngine::snapshot()` ahead of `offline_queue` while keeping
  live local writes gated on `waiting_for_id_converter`.
- Wire `vars.NP_ALLOW_PERF_BOOTSTRAP` in `native-playground.yml` and
  document the three `perf/accepted.json` lifecycle actions in
  `packages/frontend/AGENTS.md`.
2026-11-27 06:55:47 +09:00
DarkSky 6f9f1cace5 refactor(workspace): dissolve native-playground into domain directories 2026-11-27 06:55:47 +09:00