#### PR Dependency Tree
* **PR #14243** 👈
This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Batch management API for coordinated document mutations and change
tracking.
* New document accessors (IDs, state snapshots, change/delete set
queries) and subscriber count.
* **Chores**
* Upgraded Rust edition across packages to 2024.
* Repository-wide formatting, stylistic cleanups and test adjustments.
* **Breaking Changes**
* Removed the Node native bindings package and its JS/TS declarations
and tests (no longer published/available).
<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
#### PR Dependency Tree
* **PR #12948** 👈
* **PR #12980**
This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Introduced inline comment functionality, allowing users to add,
resolve, and highlight comments directly within text.
* Added a new toolbar action for inserting comments when supported.
* Inline comments are visually highlighted and can be interacted with in
the editor.
* **Enhancements**
* Integrated a feature flag to enable or disable the comment feature.
* Improved inline manager rendering to support wrapper specs for
advanced formatting.
* **Developer Tools**
* Added mock comment provider for testing and development environments.
* **Chores**
* Updated dependencies and project references to support the new inline
comment module.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Closes: [BS-2539](https://linear.app/affine-design/issue/BS-2539/为-affine-添加-ef,并且支持在-affine-预览对应的功能)
> [!warning]
> This feature is only available in the canary build and is intended for debugging purposes.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Introduced an "Adapter Panel" feature with a new sidebar tab for previewing document content in multiple formats (Markdown, PlainText, HTML, Snapshot), controllable via a feature flag.
- Added a fully integrated adapter panel component with reactive UI elements for selecting adapters, toggling HTML preview modes, and updating content.
- Provided a customizable adapter panel for both main app and playground environments, supporting content transformation pipelines and export previews.
- Enabled seamless toggling and live updating of adapter panel content through intuitive menus and controls.
- **Localization**
- Added English translations and descriptive settings for the Adapter Panel feature.
- **Chores**
- Added new package and workspace dependencies along with TypeScript project references to support the Adapter Panel modules and components.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Introduced two new widgets: Edgeless Dragging Area and Note Slicer, now available for use.
- Added extension support for these widgets, enabling enhanced interaction and integration within the application.
- **Chores**
- Updated package configurations and workspace settings to include the new widgets and their dependencies.
- Added project references and configuration files to support modular development and build processes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Introduced the Edgeless Selected Rectangle widget, providing enhanced selection and interaction capabilities in edgeless mode.
- Added rotation-aware resize cursors for improved usability when resizing selections.
- Integrated new autocomplete panels and selection components for a smoother user experience.
- **Refactor**
- Modularized the Edgeless Selected Rectangle widget as a standalone package for better maintainability and integration.
- Updated internal references and imports to utilize the new widget package.
- **Chores**
- Updated project and package configurations to include the new widget and ensure proper build and type-checking across the workspace.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Closes: BS-3393
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Introduced a new "Embed Doc" block, enabling embedding and rendering of linked and synced documents within cards, including support for banners and note previews.
- Added new toolbar and quick search options for inserting embedded linked and synced documents.
- **Improvements**
- Updated dependencies and internal references to support the new embed doc functionality across related blocks and components.
- Enhanced support for edgeless environments with new clipboard and configuration options for embedded docs.
- **Refactor**
- Streamlined and reorganized embed-related code, moving linked and synced doc logic into a dedicated embed doc module.
- Removed obsolete adapter and utility files to simplify maintenance.
- **Chores**
- Updated project and TypeScript configuration files to include the new embed doc module in builds and references.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Closes: BS-3368
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Introduced a new link tool extension, enabling enhanced link-related functionality within the edgeless workspace.
- Added a new view extension for link tools, improving integration and usability in edgeless mode.
- **Chores**
- Added a new package for link tool functionality with appropriate dependencies and exports.
- Registered new custom elements for edgeless toolbars and link tools to support modular UI components.
- Updated project configurations and workspace dependencies to include the new link tool module.
- **Refactor**
- Removed unused quick tool exports and toolbar component registrations to streamline the edgeless extension codebase.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Closes: BS-3364
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Introduced a new "Page Dragging Area" widget, enabling enhanced block selection and drag area detection within the user interface.
- Added utilities for more precise block selection based on rectangular selection areas.
- **Improvements**
- Integrated the new widget into the view extension system for consistent behavior across supported views.
- Enhanced clipboard handling with comprehensive adapter configurations for various data types.
- **Refactor**
- Streamlined widget registration and block selection logic for improved maintainability and modularity.
- Removed legacy widget exports and registrations to centralize widget management.
- **Chores**
- Updated workspace and TypeScript configurations to support the new widget module.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Closes: BS-3360
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Introduced a new viewport overlay widget, making it available as part of the workspace and enabling its integration into supported pages.
- **Refactor**
- Updated internal imports and exports to utilize the new viewport overlay widget package.
- Streamlined widget registration and extension mechanisms for improved modularity.
- **Chores**
- Added configuration and project references to support the new viewport overlay widget package in the build system.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Introduced the Affine Foundation package, providing a centralized layer for initializing core UI effects, custom elements, and foundational services.
- Added new foundational store and view extensions to improve core service registration and UI effect setup.
- **Refactor**
- Streamlined and reorganized block, store, and view extension arrays to rely on the new foundation layer, reducing duplication and simplifying extension management.
- Removed redundant or now-centralized services and UI effects from existing modules.
- **Chores**
- Updated configuration files and workspace dependencies to support the new Affine Foundation package.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Introduced a new pointer graphics module with tools and quick tool integration for edgeless surfaces.
- Added a quick tool button for pointer interactions in edgeless mode.
- Exposed new extension points for pointer graphics and effects.
- **Improvements**
- Integrated pointer graphics as a dependency into related packages.
- Enhanced toolbar context to support additional surface alignment modes.
- Added conditional clipboard configuration registrations for edgeless contexts across multiple block types.
- **Removals**
- Removed legacy tool and effect definitions and related quick tool exports from edgeless components.
- Streamlined extension arrays and removed unused exports for a cleaner codebase.
- Deleted obsolete utility functions and component registrations.
- **Chores**
- Updated workspace and TypeScript project references to include the new pointer graphics module.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Closes: BS-3186
# @blocksuite/affine-ext-loader
Blocksuite extension loader system for AFFiNE, providing a structured way to manage and load extensions in different contexts.
## Usage
### Basic Extension Provider
```typescript
import { BaseExtensionProvider } from '@blocksuite/affine-ext-loader';
import { z } from 'zod';
// Create a custom provider with options
class MyProvider extends BaseExtensionProvider<'my-scope', { enabled: boolean }> {
name = 'MyProvider';
schema = z.object({
enabled: z.boolean(),
});
setup(context: Context<'my-scope'>, options?: { enabled: boolean }) {
super.setup(context, options);
// Custom setup logic
}
}
```
### Store Extensions
```typescript
import { StoreExtensionProvider, StoreExtensionManager } from '@blocksuite/affine-ext-loader';
import { z } from 'zod';
// Create a store provider with custom options
class MyStoreProvider extends StoreExtensionProvider<{ cacheSize: number }> {
override name = 'MyStoreProvider';
override schema = z.object({
cacheSize: z.number().min(0),
});
override setup(context: StoreExtensionContext, options?: { cacheSize: number }) {
super.setup(context, options);
context.register([Ext1, Ext2, Ext3]);
}
}
// Create and use the store extension manager
const manager = new StoreExtensionManager([MyStoreProvider]);
manager.configure(MyStoreProvider, { cacheSize: 100 });
const extensions = manager.get('store');
```
### View Extensions
```typescript
import { ViewExtensionProvider, ViewExtensionManager } from '@blocksuite/affine-ext-loader';
import { z } from 'zod';
// Create a view provider with custom options
class MyViewProvider extends ViewExtensionProvider<{ theme: string }> {
override name = 'MyViewProvider';
override schema = z.object({
theme: z.enum(['light', 'dark']),
});
override setup(context: ViewExtensionContext, options?: { theme: string }) {
super.setup(context, options);
context.register([CommonExt]);
if (context.scope === 'page') {
context.register([PageExt]);
} else if (context.scope === 'edgeless') {
context.register([EdgelessExt]);
}
if (options?.theme === 'dark') {
context.register([DarkModeExt]);
}
}
// Override effect to run one-time initialization logic
override effect() {
// This will only run once per provider class
console.log('Initializing MyViewProvider');
// Register lit elements
this.registerLitElements();
}
}
// Create and use the view extension manager
const manager = new ViewExtensionManager([MyViewProvider]);
manager.configure(MyViewProvider, { theme: 'dark' });
// Get extensions for different view scopes
const pageExtensions = manager.get('page');
const edgelessExtensions = manager.get('edgeless');
```
### One-time Initialization with Effect
View extensions support one-time initialization through the `effect` method. This method is called automatically during setup, but only once per provider class. It's useful for:
- Initializing global state
- Registering lit elements
- Setting up shared resources
```typescript
class MyViewProvider extends ViewExtensionProvider {
override effect() {
// This will only run once, even if multiple instances are created
initializeGlobalState();
registerLitElements();
setupGlobalEventListeners();
}
}
```
### Available View Scopes
The view extension system supports the following scopes:
- `page` - Standard page view
- `edgeless` - Edgeless (whiteboard) view
- `preview-page` - Page preview view
- `preview-edgeless` - Edgeless preview view
- `mobile-page` - Mobile page view
- `mobile-edgeless` - Mobile edgeless view
### Extension Configuration
Extensions can be configured using the `configure` method:
```typescript
// Set configuration directly
manager.configure(MyProvider, { enabled: true });
// Update configuration using a function
manager.configure(MyProvider, prev => {
if (!prev) return prev;
return {
...prev,
enabled: !prev.enabled,
};
});
// Remove configuration
manager.configure(MyProvider, undefined);
```
### Dependency Injection
Both store and view extension managers support dependency injection:
```typescript
// Access the manager through the di container
const viewManager = std.get(ViewExtensionManagerIdentifier);
const pagePreviewExtension = viewManager.get('preview-page');
```
The `ViewportTurboRendererExtension` is now extracted from `@blocksuite/affine-shared` to `@blocksuite/affine-gfx-turbo-renderer` with minimal dependencies, mirroring the gfx text package in #10378.
This PR performs a significant architectural refactoring by extracting rich text functionality into a dedicated package. Here are the key changes:
1. **New Package Creation**
- Created a new package `@blocksuite/affine-rich-text` to house rich text related functionality
- Moved rich text components, utilities, and types from `@blocksuite/affine-components` to this new package
2. **Dependency Updates**
- Updated multiple block packages to include the new `@blocksuite/affine-rich-text` as a direct dependency:
- block-callout
- block-code
- block-database
- block-edgeless-text
- block-embed
- block-list
- block-note
- block-paragraph
3. **Import Path Updates**
- Refactored all imports that previously referenced rich text functionality from `@blocksuite/affine-components/rich-text` to now use `@blocksuite/affine-rich-text`
- Updated imports for components like:
- DefaultInlineManagerExtension
- RichText types and interfaces
- Text manipulation utilities (focusTextModel, textKeymap, etc.)
- Reference node components and providers
4. **Build Configuration Updates**
- Added references to the new rich text package in the `tsconfig.json` files of all affected packages
- Maintained workspace dependencies using the `workspace:*` version specifier
The primary motivation appears to be:
1. Better separation of concerns by isolating rich text functionality
2. Improved maintainability through more modular package structure
3. Clearer dependencies between packages
4. Potential for better tree-shaking and bundle optimization
This is primarily an architectural improvement that should make the codebase more maintainable and better organized.
### TL;DR
Moved outline functionality into a dedicated fragment package and updated vanilla-extract CSS dependency.
### What changed?
- Created new `@blocksuite/affine-fragment-outline` package
- Relocated outline-related code from presets to the new fragment package
- Updated imports across affected files to reference the new package location
- Upgraded `@vanilla-extract/css` dependency from 1.14.0/1.16.1 to 1.17.0
- Added necessary package configuration and TypeScript setup for the new fragment
### How to test?
1. Verify outline functionality works as expected in both desktop and mobile views
2. Check that outline panel, viewer, and mobile menu components render correctly
3. Ensure outline navigation and interactions continue to work
4. Confirm no regressions in outline-related features
### Why make this change?
This change improves code organization by isolating outline functionality into a dedicated package, following the modular architecture pattern. This makes the codebase more maintainable and allows for better separation of concerns. The vanilla-extract CSS upgrade ensures consistency across packages and provides access to the latest features and fixes.