Commit Graph
15 Commits
Author SHA1 Message Date
DarkSky fdd43a21a1 feat(store,client,desktop): store favorites in userdata table and reorder in sidebar
Store document, folder, collection, and tag favorites in the userdata$<uid>$favorite table with fractional indices and soft-delete removal.
Fall back to legacy docProperties favorite flags when no favorite table exists, and copy them into the table on the first favorite write.
Load and persist the favorite table across SQLite read-write sessions, read-only workspace opens, Web Desktop IndexedDB stores, and cloud sync.
Render and expand favorite documents, folders, collections, and tags in the desktop sidebar Favorites section apart from the Organize tree.
Add menu actions to add or remove favorites and drag reorder for top-level Favorites rows without changing db$folders order.
Copy the database to a separate path before writing a test -wal sidecar in sqlite_wal_blobs to avoid close races.
2026-12-05 10:51:39 +09:00
DarkSky b4548df803 fix(mobile): use grapheme boundaries in field hit tests 2026-12-05 05:52:18 +09:00
DarkSky f150cb5604 fix(mobile,hosts): fix keyboard insets, native selection UI, and lifecycle retries
The shell padded the bottom edge by the keyboard height, and the embedded
page editor lifted its keyboard toolbar by the same height again. In Page
mode the editor now owns the bottom edge. The shell gives the editor its
resolved keyboard height, so the toolbar sits directly on the keyboard.

- Hide the TabBar while the software keyboard is up, as 0.27.5 AppTabs
  does. The accessibility tree follows the same rule.
- Move the focus from the editor to the shell when an overlay sheet opens
  over a page, so the keyboard goes down. The drawer keeps its own focus.
- Add NativeSelectionUi to MobileShellView. The iOS shell lets
  UITextInteraction draw the handles, caret, and selection. The Android
  shell draws the handles natively and keeps the GPU caret.
- Scroll a long Search query or drawer filter only as far as necessary to
  keep the caret or the end of the composition in view. The renderer, the
  scroll, and the IME rects and touch offsets read one shaped layout of
  the line, and place it in the field with one transform. A line that fits
  sits at the start edge of the locale, and its glyphs always run left to
  right in text order, also in RTL locales.
- Retry the Android bootstrap from onResume and onNewIntent while the
  allowlist is empty or the shell has not mounted the workspace that
  bootstrap opened. Stop after three automatic retries.
- Send accessibility events only while an accessibility service runs.
  The system clears the focus after the last service stops, and the
  event send threw at that time.
2026-12-05 04:10:13 +09:00
DarkSky f8e5ff6ea1 feat(mobile): unlock database editing, experimental flags, doc info, and journal strip
Gate Page and Database edits of the embedded editor only by the
Read-only toggle and trash. Gate Edgeless edits also by the
enable_mobile_edgeless_editing flag, which the Settings Experimental
sheet toggles.

Add the View Info sheet to the page menu. It shows the creation and
update times, toggles tags on the document through the workspace
bridge, and counts backlinks and outgoing links. A connected workspace
takes its tag list from the tag options of the workspace root, so the
sheet writes only tag IDs that the root defines.

Show a week strip below the header of a journal. A day with a journal
replaces the open page, and a day without one opens the Journals tab.
Today shows when the journal or the shown week is not today's, and
returns the strip to this week.

Make the drawer filter a text field. It shares the input handler and
the UTF-16 edit rules of the Search query: caret keys, Shift to extend
from a kept anchor,
select all, and a clear button. Both fields draw the caret at the active
end of the selection and highlight the selected text.

Replace the Sync & Offline, Storage, and Notifications switches that
had no backing service with read-only values. Remove the static sync
pill from the page header.
2026-12-05 01:20:23 +09:00
DarkSky 438c5cff16 feat(editor,hosts): add create-linked-doc conversion with subdoc persistence
Page FormatToolbar `Create Linked Doc` opens the `Create linked doc` title
dialog. The dialog shows the first block as the title when that block is a
heading. `Confirm` moves the whole blocks that the selection touches, with
their subtrees and all their properties, into a new linked page. Code
text, table and database cells, marks, and inline references stay intact.
It puts an `affine:embed-linked-doc` card in their place. A blank title
gives `Untitled`. `Cancel`, `Escape`, or a press outside the dialog write
nothing.

The Edgeless `More` menu adds `Turn into linked doc` for one unlocked
note. This puts an `affine:embed-synced-doc` card with the frame, index,
and connectors of the note in its place. The menu also adds `Create linked
doc` for other unlocked selections. This moves the items, selected notes
included, into a new Edgeless document in their paint order. Then it puts
a 364 x 390 `vertical` card at their center. Both actions use the same
title dialog. Each conversion is one undo step in the source document. The
open-document group of the menu comes before the clipboard group. A menu
that does not fit scrolls its rows with the wheel and does not cover the
toolbar or the creation toolbar. `PageDocSession::export_block_tree`
exports a block subtree with every property for these copies and for
Edgeless copy and clone.

`WorkspaceDocDirectory::seed_created_doc` gives the complete Yjs V1 state
of a new document to the host, so that the content persists. The desktop
host replaces the initial blocks of the store with the seed blocks through
`PageDocSession::replace_blocks_update_v1`. It queues the change for the
connected session. The desktop directory keeps the snapshot of each loaded
document, and of a seeded document that the store does not have yet, so
synced cards show the content after a refresh or a reopen. The client
directory queues the seed with the pending updates of the workspace
database (`enqueue_pending_update`). The mobile host keeps the seed as the
cached CRDT state. The mobile bridge adds a document that the shell
created to the workspace root before it merges the content. New mobile
document IDs come from the intent, or from a random value, for each
workspace. They never reuse the ID of a document in the trash.
2026-12-05 01:01:17 +09:00
DarkSky a7a094f7cc perf(mobile): reduce work in the table of contents
Mount the visible outline rows and cache headings by document revision.
Keep every heading available to screen readers.
Correct the scroll offset when the sheet shrinks.
Expand the mode switch targets and translate both labels.
Stop the journal scan after the second match.
2026-12-04 21:41:53 +09:00
DarkSky c16240473c fix(mobile): expose document description in delete confirm accessibility tree
Expose the localized confirmation body on `app.sheet.dialog`. Add static text child nodes before the cancel and confirm buttons. Attach layout bounds probes to the rendered title and body text. Screen readers now read the target document title and action details with matching bounds.
2026-12-04 19:04:02 +09:00
DarkSky cbd18698ad feat(mobile): add detail mode switch, toc sheet, readonly toggle, and journal conflicts
Match the 0.27.5 mobile detail page:

- Open each document in its primary mode. The DocActions sheet starts
  with the Page | Edgeless view switch and adds Default to Edgeless mode
  and Default to Page mode, which write primaryMode to db$docProperties.
- Show the Read only / Editing toggle in the header of an editable page
  in Page mode. The toggle gates Page edits in the embedded editor.
- Add View table of contents. The sheet lists the title and the H1-H6
  headings, marks the heading at the reading position, and scrolls the
  editor to the tapped entry.
- When a date has more than one journal, add the journal conflict list
  to the page menu and to the Journals tab. A tap opens a journal. Its
  operations remove the journal mark or move the journal to trash after
  the Delete doc? confirmation.
- Scroll each sheet over its measured content height instead of a fixed
  360 px range, so a long outline reaches its last heading.
2026-12-04 17:47:47 +09:00
DarkSky b3152da6d7 perf(mobile): virtualize home document list and clamp scroll
The mobile Home tab caches favorites and non-trashed documents in a revision-keyed model. Warm frames reuse this cache without cloning document records.

The Home document list mounts only visible rows plus overscan with exact spacers. Fixed row heights and line clamping keep list coordinates deterministic across deep scrolls and long previews.

Home geometry includes the empty favorites section header height across all viewport sizes. The Home view clamps scroll offsets before rendering, and workspace switches reset Home and Search scroll offsets to zero.

The accessibility tree reads the cached Home model and visible window without mutating scroll state. Scale tests verify fixed row geometry, bottom reachability without favorites, and bounded row counts.
2026-12-02 07:31:19 +09:00
DarkSky af83a5a38c perf(mobile): mount visible explorer rows and drop deleted documents
The mobile shell now removes a document when the document leaves the root document in the workspace session. Another session can trash and delete a document permanently. The shell then drops it from the list, the CRDT cache, the history, and the open page. Drafts that exist only in the shell stay. Documents with the same ID in other workspaces stay.

Workspace documents and CRDT caches change only through accessors. Each change gets a revision stamp that is unique in the process. These stamps key the caches for search hits, drawer sections, Explorer rows, breadcrumb snapshots, and the editor directory. A frame without changes rebuilds none of them.

A document lookup by ID now takes constant time. Explorer lists and folder lists mount only the rows inside the viewport plus a small overscan. The lists use ui_kit::VirtualList, and spacers keep the content height. The accessibility tree reads the same rows and the same window.

The bridge syncs the shell to the session by CRDT revision and by changed document IDs. When nothing changed, it reads no cached bytes. The sync timer repaints the shell only when the projection changed what the shell shows. The timer also checks that the bridge that ran the tick is still bound.

The editor directory keys its snapshot by workspace ID, docs revision, bulk revision, and locale. It refreshes in place only when all keys except the docs revision match. A workspace switch, a bulk change, or a locale change rebuilds it. The directory never lists or previews a trashed document.

The page editor reads the trash state directly. It encodes a state vector only when the document revision advances. The Explorer shows the empty trash text only for the trash target. A pending delete confirmation closes only for a document of the active workspace.

The views share one row_dir helper. The palette reads typed theme fields, and pure white uses ui::white(). The mobile-harness scale-probe command reports frame costs and work counts with 10, 100, and 1,000 documents. The invariants script checks mobile views for test branches. It links the ui-tokens test executable for the linker flag check.
2026-12-02 05:41:17 +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 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 b21a21e30e fix(mobile): polish breadcrumb switcher, blank page placeholders, and delete confirmation sheet
Keep multi-location breadcrumb switcher chips visible with their dropdown chevron across narrow viewports and locales. Preserve the location count suffix while truncating only the owner document title.

Render high-contrast muted placeholders on blank documents using static empty-state copy, keep primary text color for non-empty body previews, and keep display titles in lists, breadcrumbs, trash pages, and accessibility landmarks.

Remove the ambiguous Done button from the permanent delete confirmation sheet in both the view and the accessibility tree.
2026-11-27 06:55:48 +09:00
DarkSky 1bf1a4e31d feat(mobile): finish shell parity and layout fixes
Update mobile shell screens across Home, Explorer, Journals,
Settings, and Trash document pages.

- Explorer and navigation: show active documents in the All Docs root
  with wheel and native touch scroll, and keep the bottom tab bar
  fixed. Scroll Collections and Tags lists, restore scroll on back
  navigation, and add screen-reader scroll actions.

- Scoped actions and Trash: encode workspace and document IDs with a
  byte-length prefix to stop dot collisions, and require confirmation
  before permanent delete. Purge matching history entries with
  NavHistory::remove_target, replay outgoing edges on restore, and
  show a document-not-found state for missing pages.

- Journals and Settings: wrap the 7-day strip into two rows below
  364pt and use a compact landscape layout below 460pt so every day
  pill and CTA reaches 44x44pt. Separate read-only settings rows from
  toggle and cycle controls without chevrons, and use localized
  untitled titles in main landmarks and backlinks.

- Harness and tests: cover Journals and Trash in audit-matrix with
  width and height touch-target checks. Add touch, scroll, collision,
  and accessibility parity tests alongside matching gallery captures.
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