refactor(editor): store should not rely on inline (#11017)

This commit is contained in:
Saul-Mirone
2025-03-20 01:33:29 +00:00
parent ee337a16af
commit 258c70cf07
82 changed files with 140 additions and 141 deletions
@@ -5,7 +5,7 @@ import {
CODE_BLOCK_WRAP_KEY, CODE_BLOCK_WRAP_KEY,
HastUtils, HastUtils,
} from '@blocksuite/affine-shared/adapters'; } from '@blocksuite/affine-shared/adapters';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import { nanoid } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store';
import { bundledLanguagesInfo, codeToHast } from 'shiki'; import { bundledLanguagesInfo, codeToHast } from 'shiki';
@@ -5,7 +5,7 @@ import {
CODE_BLOCK_WRAP_KEY, CODE_BLOCK_WRAP_KEY,
type MarkdownAST, type MarkdownAST,
} from '@blocksuite/affine-shared/adapters'; } from '@blocksuite/affine-shared/adapters';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import { nanoid } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store';
import type { Code } from 'mdast'; import type { Code } from 'mdast';
@@ -3,7 +3,7 @@ import {
BlockPlainTextAdapterExtension, BlockPlainTextAdapterExtension,
type BlockPlainTextAdapterMatcher, type BlockPlainTextAdapterMatcher,
} from '@blocksuite/affine-shared/adapters'; } from '@blocksuite/affine-shared/adapters';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
export const codeBlockPlainTextAdapterMatcher: BlockPlainTextAdapterMatcher = { export const codeBlockPlainTextAdapterMatcher: BlockPlainTextAdapterMatcher = {
flavour: CodeBlockSchema.model.flavour, flavour: CodeBlockSchema.model.flavour,
@@ -1,7 +1,8 @@
import { affineTextStyles } from '@blocksuite/affine-rich-text'; import { affineTextStyles } from '@blocksuite/affine-rich-text';
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types'; import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
import { ShadowlessElement } from '@blocksuite/block-std'; import { ShadowlessElement } from '@blocksuite/block-std';
import { type DeltaInsert, ZERO_WIDTH_SPACE } from '@blocksuite/inline'; import { ZERO_WIDTH_SPACE } from '@blocksuite/inline';
import type { DeltaInsert } from '@blocksuite/store';
import { html } from 'lit'; import { html } from 'lit';
import { property } from 'lit/decorators.js'; import { property } from 'lit/decorators.js';
import { styleMap } from 'lit/directives/style-map.js'; import { styleMap } from 'lit/directives/style-map.js';
@@ -1,6 +1,5 @@
import type { ColumnDataType, SerializedCells } from '@blocksuite/affine-model'; import type { ColumnDataType, SerializedCells } from '@blocksuite/affine-model';
import type { DeltaInsert } from '@blocksuite/inline'; import type { BlockSnapshot, DeltaInsert } from '@blocksuite/store';
import type { BlockSnapshot } from '@blocksuite/store';
import { databaseBlockModels } from '../properties/model'; import { databaseBlockModels } from '../properties/model';
@@ -12,7 +12,7 @@ import { createDefaultDoc, matchModels } from '@blocksuite/affine-shared/utils';
import { type EditorHost, ShadowlessElement } from '@blocksuite/block-std'; import { type EditorHost, ShadowlessElement } from '@blocksuite/block-std';
import type { DetailSlotProps, SingleView } from '@blocksuite/data-view'; import type { DetailSlotProps, SingleView } from '@blocksuite/data-view';
import { SignalWatcher, WithDisposable } from '@blocksuite/global/lit'; import { SignalWatcher, WithDisposable } from '@blocksuite/global/lit';
import type { BaseTextAttributes } from '@blocksuite/inline'; import type { BaseTextAttributes } from '@blocksuite/store';
import { computed } from '@preact/signals-core'; import { computed } from '@preact/signals-core';
import { css, html } from 'lit'; import { css, html } from 'lit';
import { property } from 'lit/decorators.js'; import { property } from 'lit/decorators.js';
@@ -18,8 +18,7 @@ import {
createIcon, createIcon,
} from '@blocksuite/data-view'; } from '@blocksuite/data-view';
import { IS_MAC } from '@blocksuite/global/env'; import { IS_MAC } from '@blocksuite/global/env';
import type { DeltaInsert } from '@blocksuite/inline'; import type { BlockSnapshot, DeltaInsert } from '@blocksuite/store';
import type { BlockSnapshot } from '@blocksuite/store';
import { Text } from '@blocksuite/store'; import { Text } from '@blocksuite/store';
import { computed, effect, signal } from '@preact/signals-core'; import { computed, effect, signal } from '@preact/signals-core';
import { ref } from 'lit/directives/ref.js'; import { ref } from 'lit/directives/ref.js';
@@ -1,6 +1,6 @@
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types'; import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
import { propertyType, t } from '@blocksuite/data-view'; import { propertyType, t } from '@blocksuite/data-view';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import { Text } from '@blocksuite/store'; import { Text } from '@blocksuite/store';
import * as Y from 'yjs'; import * as Y from 'yjs';
import zod from 'zod'; import zod from 'zod';
@@ -13,8 +13,7 @@ import {
import { BaseCellRenderer } from '@blocksuite/data-view'; import { BaseCellRenderer } from '@blocksuite/data-view';
import { IS_MAC } from '@blocksuite/global/env'; import { IS_MAC } from '@blocksuite/global/env';
import { LinkedPageIcon } from '@blocksuite/icons/lit'; import { LinkedPageIcon } from '@blocksuite/icons/lit';
import type { DeltaInsert } from '@blocksuite/inline'; import type { BlockSnapshot, DeltaInsert, Text } from '@blocksuite/store';
import type { BlockSnapshot, Text } from '@blocksuite/store';
import { signal } from '@preact/signals-core'; import { signal } from '@preact/signals-core';
import { property } from 'lit/decorators.js'; import { property } from 'lit/decorators.js';
import { createRef, ref } from 'lit/directives/ref.js'; import { createRef, ref } from 'lit/directives/ref.js';
@@ -5,7 +5,7 @@ import {
type BlockHtmlAdapterMatcher, type BlockHtmlAdapterMatcher,
HastUtils, HastUtils,
} from '@blocksuite/affine-shared/adapters'; } from '@blocksuite/affine-shared/adapters';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import { nanoid } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store';
import type { Element } from 'hast'; import type { Element } from 'hast';
@@ -5,7 +5,7 @@ import {
type BlockMarkdownAdapterMatcher, type BlockMarkdownAdapterMatcher,
type MarkdownAST, type MarkdownAST,
} from '@blocksuite/affine-shared/adapters'; } from '@blocksuite/affine-shared/adapters';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import { nanoid } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store';
import type { List } from 'mdast'; import type { List } from 'mdast';
@@ -4,7 +4,7 @@ import {
type BlockNotionHtmlAdapterMatcher, type BlockNotionHtmlAdapterMatcher,
HastUtils, HastUtils,
} from '@blocksuite/affine-shared/adapters'; } from '@blocksuite/affine-shared/adapters';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import { nanoid } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store';
const listBlockMatchTags = new Set(['ul', 'ol', 'li']); const listBlockMatchTags = new Set(['ul', 'ol', 'li']);
@@ -3,7 +3,7 @@ import {
BlockPlainTextAdapterExtension, BlockPlainTextAdapterExtension,
type BlockPlainTextAdapterMatcher, type BlockPlainTextAdapterMatcher,
} from '@blocksuite/affine-shared/adapters'; } from '@blocksuite/affine-shared/adapters';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
export const listBlockPlainTextAdapterMatcher: BlockPlainTextAdapterMatcher = { export const listBlockPlainTextAdapterMatcher: BlockPlainTextAdapterMatcher = {
flavour: ListBlockSchema.model.flavour, flavour: ListBlockSchema.model.flavour,
@@ -5,8 +5,8 @@ import {
HastUtils, HastUtils,
type HtmlAST, type HtmlAST,
} from '@blocksuite/affine-shared/adapters'; } from '@blocksuite/affine-shared/adapters';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert, NodeProps } from '@blocksuite/store';
import { nanoid, type NodeProps } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store';
const paragraphBlockMatchTags = new Set([ const paragraphBlockMatchTags = new Set([
'p', 'p',
@@ -4,7 +4,7 @@ import {
type BlockMarkdownAdapterMatcher, type BlockMarkdownAdapterMatcher,
type MarkdownAST, type MarkdownAST,
} from '@blocksuite/affine-shared/adapters'; } from '@blocksuite/affine-shared/adapters';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import { nanoid } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store';
import type { Heading } from 'mdast'; import type { Heading } from 'mdast';
@@ -3,7 +3,7 @@ import {
BlockPlainTextAdapterExtension, BlockPlainTextAdapterExtension,
type BlockPlainTextAdapterMatcher, type BlockPlainTextAdapterMatcher,
} from '@blocksuite/affine-shared/adapters'; } from '@blocksuite/affine-shared/adapters';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
export const paragraphBlockPlainTextAdapterMatcher: BlockPlainTextAdapterMatcher = export const paragraphBlockPlainTextAdapterMatcher: BlockPlainTextAdapterMatcher =
{ {
@@ -3,7 +3,7 @@ import {
BlockMarkdownAdapterExtension, BlockMarkdownAdapterExtension,
type BlockMarkdownAdapterMatcher, type BlockMarkdownAdapterMatcher,
} from '@blocksuite/affine-shared/adapters'; } from '@blocksuite/affine-shared/adapters';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
export const rootBlockMarkdownAdapterMatcher: BlockMarkdownAdapterMatcher = { export const rootBlockMarkdownAdapterMatcher: BlockMarkdownAdapterMatcher = {
flavour: RootBlockSchema.model.flavour, flavour: RootBlockSchema.model.flavour,
@@ -1,4 +1,4 @@
import type { DeltaInsert } from '@blocksuite/inline/types'; import type { DeltaInsert } from '@blocksuite/store';
import type { MindMapTreeNode } from '../types/mindmap.js'; import type { MindMapTreeNode } from '../types/mindmap.js';
import { buildMindMapTree } from './mindmap.js'; import { buildMindMapTree } from './mindmap.js';
@@ -7,7 +7,7 @@ import {
BlockPlainTextAdapterExtension, BlockPlainTextAdapterExtension,
type BlockPlainTextAdapterMatcher, type BlockPlainTextAdapterMatcher,
} from '@blocksuite/affine-shared/adapters'; } from '@blocksuite/affine-shared/adapters';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import { nanoid } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store';
import { createTableProps, formatTable, processTable } from './utils.js'; import { createTableProps, formatTable, processTable } from './utils.js';
@@ -10,7 +10,7 @@ import {
} from '@blocksuite/affine-shared/adapters'; } from '@blocksuite/affine-shared/adapters';
import { HastUtils } from '@blocksuite/affine-shared/adapters'; import { HastUtils } from '@blocksuite/affine-shared/adapters';
import { generateFractionalIndexingKeyBetween } from '@blocksuite/affine-shared/utils'; import { generateFractionalIndexingKeyBetween } from '@blocksuite/affine-shared/utils';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import { nanoid } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store';
import type { Element } from 'hast'; import type { Element } from 'hast';
import type { Table as MarkdownTable } from 'mdast'; import type { Table as MarkdownTable } from 'mdast';
@@ -14,8 +14,7 @@ import { ShadowlessElement } from '@blocksuite/block-std';
import { SignalWatcher, WithDisposable } from '@blocksuite/global/lit'; import { SignalWatcher, WithDisposable } from '@blocksuite/global/lit';
import { noop } from '@blocksuite/global/utils'; import { noop } from '@blocksuite/global/utils';
import { LinkedPageIcon } from '@blocksuite/icons/lit'; import { LinkedPageIcon } from '@blocksuite/icons/lit';
import type { DeltaInsert } from '@blocksuite/inline'; import type { BlockModel, DeltaInsert } from '@blocksuite/store';
import type { BlockModel } from '@blocksuite/store';
import { consume } from '@lit/context'; import { consume } from '@lit/context';
import { html, nothing } from 'lit'; import { html, nothing } from 'lit';
import { property } from 'lit/decorators.js'; import { property } from 'lit/decorators.js';
@@ -1,5 +1,4 @@
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert, Text } from '@blocksuite/store';
import type { Text } from '@blocksuite/store';
import { import {
BlockModel, BlockModel,
BlockSchemaExtension, BlockSchemaExtension,
@@ -6,11 +6,13 @@ import {
} from '@blocksuite/global/di'; } from '@blocksuite/global/di';
import { import {
type AttributeRenderer, type AttributeRenderer,
baseTextAttributes,
type DeltaInsert,
getDefaultAttributeRenderer, getDefaultAttributeRenderer,
} from '@blocksuite/inline'; } from '@blocksuite/inline';
import type { ExtensionType } from '@blocksuite/store'; import {
baseTextAttributes,
type DeltaInsert,
type ExtensionType,
} from '@blocksuite/store';
import { z, type ZodObject, type ZodTypeAny } from 'zod'; import { z, type ZodObject, type ZodTypeAny } from 'zod';
import { MarkdownMatcherIdentifier } from './markdown-matcher.js'; import { MarkdownMatcherIdentifier } from './markdown-matcher.js';
@@ -1,10 +1,9 @@
import type { import type {
AttributeRenderer, AttributeRenderer,
BaseTextAttributes,
DeltaInsert,
InlineEditor, InlineEditor,
InlineRange, InlineRange,
} from '@blocksuite/inline'; } from '@blocksuite/inline';
import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store';
import type * as Y from 'yjs'; import type * as Y from 'yjs';
import type { ZodTypeAny } from 'zod'; import type { ZodTypeAny } from 'zod';
@@ -1,6 +1,7 @@
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types'; import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
import { ShadowlessElement } from '@blocksuite/block-std'; import { ShadowlessElement } from '@blocksuite/block-std';
import { type DeltaInsert, ZERO_WIDTH_SPACE } from '@blocksuite/inline'; import { ZERO_WIDTH_SPACE } from '@blocksuite/inline';
import type { DeltaInsert } from '@blocksuite/store';
import { html } from 'lit'; import { html } from 'lit';
import { property } from 'lit/decorators.js'; import { property } from 'lit/decorators.js';
import { type StyleInfo, styleMap } from 'lit/directives/style-map.js'; import { type StyleInfo, styleMap } from 'lit/directives/style-map.js';
@@ -10,12 +10,12 @@ import {
} from '@blocksuite/block-std'; } from '@blocksuite/block-std';
import { WithDisposable } from '@blocksuite/global/lit'; import { WithDisposable } from '@blocksuite/global/lit';
import { import {
type DeltaInsert,
INLINE_ROOT_ATTR, INLINE_ROOT_ATTR,
type InlineRootElement, type InlineRootElement,
ZERO_WIDTH_NON_JOINER, ZERO_WIDTH_NON_JOINER,
ZERO_WIDTH_SPACE, ZERO_WIDTH_SPACE,
} from '@blocksuite/inline'; } from '@blocksuite/inline';
import type { DeltaInsert } from '@blocksuite/store';
import { shift } from '@floating-ui/dom'; import { shift } from '@floating-ui/dom';
import { baseTheme } from '@toeverything/theme'; import { baseTheme } from '@toeverything/theme';
import { css, html, nothing, unsafeCSS } from 'lit'; import { css, html, nothing, unsafeCSS } from 'lit';
@@ -1,6 +1,7 @@
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types'; import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
import { ShadowlessElement } from '@blocksuite/block-std'; import { ShadowlessElement } from '@blocksuite/block-std';
import { type DeltaInsert, ZERO_WIDTH_SPACE } from '@blocksuite/inline'; import { ZERO_WIDTH_SPACE } from '@blocksuite/inline';
import type { DeltaInsert } from '@blocksuite/store';
import { html } from 'lit'; import { html } from 'lit';
import { property } from 'lit/decorators.js'; import { property } from 'lit/decorators.js';
import { styleMap } from 'lit/directives/style-map.js'; import { styleMap } from 'lit/directives/style-map.js';
@@ -8,11 +8,11 @@ import {
} from '@blocksuite/block-std'; } from '@blocksuite/block-std';
import { SignalWatcher, WithDisposable } from '@blocksuite/global/lit'; import { SignalWatcher, WithDisposable } from '@blocksuite/global/lit';
import { import {
type DeltaInsert,
type InlineEditor, type InlineEditor,
ZERO_WIDTH_NON_JOINER, ZERO_WIDTH_NON_JOINER,
ZERO_WIDTH_SPACE, ZERO_WIDTH_SPACE,
} from '@blocksuite/inline'; } from '@blocksuite/inline';
import type { DeltaInsert } from '@blocksuite/store';
import { signal } from '@preact/signals-core'; import { signal } from '@preact/signals-core';
import katex from 'katex'; import katex from 'katex';
import { css, html, render } from 'lit'; import { css, html, render } from 'lit';
@@ -9,11 +9,11 @@ import type { BlockComponent, BlockStdScope } from '@blocksuite/block-std';
import { BLOCK_ID_ATTR, ShadowlessElement } from '@blocksuite/block-std'; import { BLOCK_ID_ATTR, ShadowlessElement } from '@blocksuite/block-std';
import { WithDisposable } from '@blocksuite/global/lit'; import { WithDisposable } from '@blocksuite/global/lit';
import { import {
type DeltaInsert,
INLINE_ROOT_ATTR, INLINE_ROOT_ATTR,
type InlineRootElement, type InlineRootElement,
ZERO_WIDTH_SPACE, ZERO_WIDTH_SPACE,
} from '@blocksuite/inline'; } from '@blocksuite/inline';
import type { DeltaInsert } from '@blocksuite/store';
import { css, html } from 'lit'; import { css, html } from 'lit';
import { property } from 'lit/decorators.js'; import { property } from 'lit/decorators.js';
import { type StyleInfo, styleMap } from 'lit/directives/style-map.js'; import { type StyleInfo, styleMap } from 'lit/directives/style-map.js';
@@ -19,13 +19,12 @@ import { BLOCK_ID_ATTR, ShadowlessElement } from '@blocksuite/block-std';
import { WithDisposable } from '@blocksuite/global/lit'; import { WithDisposable } from '@blocksuite/global/lit';
import { LinkedPageIcon } from '@blocksuite/icons/lit'; import { LinkedPageIcon } from '@blocksuite/icons/lit';
import { import {
type DeltaInsert,
INLINE_ROOT_ATTR, INLINE_ROOT_ATTR,
type InlineRootElement, type InlineRootElement,
ZERO_WIDTH_NON_JOINER, ZERO_WIDTH_NON_JOINER,
ZERO_WIDTH_SPACE, ZERO_WIDTH_SPACE,
} from '@blocksuite/inline'; } from '@blocksuite/inline';
import type { DocMeta, Store } from '@blocksuite/store'; import type { DeltaInsert, DocMeta, Store } from '@blocksuite/store';
import { css, html, nothing } from 'lit'; import { css, html, nothing } from 'lit';
import { property, state } from 'lit/decorators.js'; import { property, state } from 'lit/decorators.js';
import { choose } from 'lit/directives/choose.js'; import { choose } from 'lit/directives/choose.js';
+1 -1
View File
@@ -3,12 +3,12 @@ import { ShadowlessElement } from '@blocksuite/block-std';
import { WithDisposable } from '@blocksuite/global/lit'; import { WithDisposable } from '@blocksuite/global/lit';
import { import {
type AttributeRenderer, type AttributeRenderer,
type DeltaInsert,
InlineEditor, InlineEditor,
type InlineRange, type InlineRange,
type InlineRangeProvider, type InlineRangeProvider,
type VLine, type VLine,
} from '@blocksuite/inline'; } from '@blocksuite/inline';
import type { DeltaInsert } from '@blocksuite/store';
import { Text } from '@blocksuite/store'; import { Text } from '@blocksuite/store';
import { effect, signal } from '@preact/signals-core'; import { effect, signal } from '@preact/signals-core';
import { css, html, type TemplateResult } from 'lit'; import { css, html, type TemplateResult } from 'lit';
@@ -3,8 +3,7 @@ import {
type ServiceIdentifier, type ServiceIdentifier,
type ServiceProvider, type ServiceProvider,
} from '@blocksuite/global/di'; } from '@blocksuite/global/di';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert, ExtensionType } from '@blocksuite/store';
import type { ExtensionType } from '@blocksuite/store';
import type { AffineTextAttributes } from '../../types/index.js'; import type { AffineTextAttributes } from '../../types/index.js';
import { import {
@@ -2,8 +2,7 @@ import {
createIdentifier, createIdentifier,
type ServiceIdentifier, type ServiceIdentifier,
} from '@blocksuite/global/di'; } from '@blocksuite/global/di';
import type { DeltaInsert } from '@blocksuite/inline/types'; import type { DeltaInsert, ExtensionType } from '@blocksuite/store';
import type { ExtensionType } from '@blocksuite/store';
import type { PhrasingContent } from 'mdast'; import type { PhrasingContent } from 'mdast';
import type { AffineTextAttributes } from '../../types/index.js'; import type { AffineTextAttributes } from '../../types/index.js';
@@ -1,12 +1,12 @@
import { DefaultTheme, NoteDisplayMode } from '@blocksuite/affine-model'; import { DefaultTheme, NoteDisplayMode } from '@blocksuite/affine-model';
import type { ServiceProvider } from '@blocksuite/global/di'; import type { ServiceProvider } from '@blocksuite/global/di';
import type { DeltaInsert } from '@blocksuite/inline';
import { import {
type AssetsManager, type AssetsManager,
ASTWalker, ASTWalker,
BaseAdapter, BaseAdapter,
type BlockSnapshot, type BlockSnapshot,
BlockSnapshotSchema, BlockSnapshotSchema,
type DeltaInsert,
type DocSnapshot, type DocSnapshot,
type ExtensionType, type ExtensionType,
type FromBlockSnapshotPayload, type FromBlockSnapshotPayload,
@@ -2,8 +2,7 @@ import {
createIdentifier, createIdentifier,
type ServiceIdentifier, type ServiceIdentifier,
} from '@blocksuite/global/di'; } from '@blocksuite/global/di';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert, ExtensionType } from '@blocksuite/store';
import type { ExtensionType } from '@blocksuite/store';
import isEqual from 'lodash-es/isEqual'; import isEqual from 'lodash-es/isEqual';
import type { AffineTextAttributes } from '../../types/index.js'; import type { AffineTextAttributes } from '../../types/index.js';
@@ -1,10 +1,10 @@
import { DefaultTheme } from '@blocksuite/affine-model'; import { DefaultTheme } from '@blocksuite/affine-model';
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
import type { DeltaInsert } from '@blocksuite/inline';
import { import {
type AssetsManager, type AssetsManager,
BaseAdapter, BaseAdapter,
type BlockSnapshot, type BlockSnapshot,
type DeltaInsert,
type DocSnapshot, type DocSnapshot,
type ExtensionType, type ExtensionType,
type FromBlockSnapshotResult, type FromBlockSnapshotResult,
@@ -2,8 +2,7 @@ import {
createIdentifier, createIdentifier,
type ServiceIdentifier, type ServiceIdentifier,
} from '@blocksuite/global/di'; } from '@blocksuite/global/di';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert, ExtensionType } from '@blocksuite/store';
import type { ExtensionType } from '@blocksuite/store';
import type { AffineTextAttributes } from '../../types/index.js'; import type { AffineTextAttributes } from '../../types/index.js';
import { import {
@@ -1,12 +1,13 @@
import { createIdentifier, type ServiceProvider } from '@blocksuite/global/di'; import { createIdentifier, type ServiceProvider } from '@blocksuite/global/di';
import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/inline';
import { import {
type AssetsManager, type AssetsManager,
type ASTWalker, type ASTWalker,
type ASTWalkerContext, type ASTWalkerContext,
type BaseAdapter, type BaseAdapter,
type BaseTextAttributes,
type BlockSnapshot, type BlockSnapshot,
BlockSnapshotSchema, BlockSnapshotSchema,
type DeltaInsert,
type NodeProps, type NodeProps,
type Transformer, type Transformer,
} from '@blocksuite/store'; } from '@blocksuite/store';
@@ -1,5 +1,5 @@
import type { ReferenceParams } from '@blocksuite/affine-model'; import type { ReferenceParams } from '@blocksuite/affine-model';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import isEqual from 'lodash-es/isEqual'; import isEqual from 'lodash-es/isEqual';
const mergeDeltas = ( const mergeDeltas = (
@@ -15,8 +15,7 @@ import {
TomorrowIcon, TomorrowIcon,
YesterdayIcon, YesterdayIcon,
} from '@blocksuite/icons/lit'; } from '@blocksuite/icons/lit';
import type { DeltaInsert } from '@blocksuite/inline'; import { type DeltaInsert, Slice, Text } from '@blocksuite/store';
import { Slice, Text } from '@blocksuite/store';
import { slashMenuToolTips } from './tooltips'; import { slashMenuToolTips } from './tooltips';
import type { SlashMenuConfig } from './types'; import type { SlashMenuConfig } from './types';
+1
View File
@@ -23,6 +23,7 @@
}, },
"dependencies": { "dependencies": {
"@blocksuite/global": "workspace:*", "@blocksuite/global": "workspace:*",
"@blocksuite/store": "workspace:*",
"@preact/signals-core": "^1.8.0", "@preact/signals-core": "^1.8.0",
"lit": "^3.2.0", "lit": "^3.2.0",
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
@@ -1,6 +1,7 @@
import type { DeltaInsert } from '@blocksuite/store';
import { expect, type Page } from '@playwright/test'; import { expect, type Page } from '@playwright/test';
import type { DeltaInsert, InlineEditor, InlineRange } from '../index.js'; import type { InlineEditor, InlineRange } from '../index.js';
const defaultPlaygroundURL = new URL( const defaultPlaygroundURL = new URL(
`http://localhost:${process.env.CI ? 4173 : 5173}/` `http://localhost:${process.env.CI ? 4173 : 5173}/`
@@ -1,6 +1,7 @@
import { DisposableGroup } from '@blocksuite/global/disposable'; import { DisposableGroup } from '@blocksuite/global/disposable';
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
import { SignalWatcher } from '@blocksuite/global/lit'; import { SignalWatcher } from '@blocksuite/global/lit';
import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store';
import { effect, signal } from '@preact/signals-core'; import { effect, signal } from '@preact/signals-core';
import { html, LitElement } from 'lit'; import { html, LitElement } from 'lit';
import { property } from 'lit/decorators.js'; import { property } from 'lit/decorators.js';
@@ -8,8 +9,6 @@ import { styleMap } from 'lit/directives/style-map.js';
import { ZERO_WIDTH_SPACE } from '../consts.js'; import { ZERO_WIDTH_SPACE } from '../consts.js';
import type { InlineEditor } from '../inline-editor.js'; import type { InlineEditor } from '../inline-editor.js';
import type { DeltaInsert } from '../types.js';
import type { BaseTextAttributes } from '../utils/base-attributes.js';
import { isInlineRangeIntersect } from '../utils/inline-range.js'; import { isInlineRangeIntersect } from '../utils/inline-range.js';
export class VElement< export class VElement<
@@ -1,11 +1,11 @@
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
import type { DeltaInsert } from '@blocksuite/store';
import { html, LitElement, type TemplateResult } from 'lit'; import { html, LitElement, type TemplateResult } from 'lit';
import { property } from 'lit/decorators.js'; import { property } from 'lit/decorators.js';
import { styleMap } from 'lit/directives/style-map.js'; import { styleMap } from 'lit/directives/style-map.js';
import { INLINE_ROOT_ATTR, ZERO_WIDTH_SPACE } from '../consts.js'; import { INLINE_ROOT_ATTR, ZERO_WIDTH_SPACE } from '../consts.js';
import type { InlineRootElement } from '../inline-editor.js'; import type { InlineRootElement } from '../inline-editor.js';
import type { DeltaInsert } from '../types.js';
import { EmbedGap } from './embed-gap.js'; import { EmbedGap } from './embed-gap.js';
export class VLine extends LitElement { export class VLine extends LitElement {
@@ -1,5 +1,6 @@
import { DisposableGroup } from '@blocksuite/global/disposable'; import { DisposableGroup } from '@blocksuite/global/disposable';
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store';
import { type Signal, signal } from '@preact/signals-core'; import { type Signal, signal } from '@preact/signals-core';
import { nothing, render, type TemplateResult } from 'lit'; import { nothing, render, type TemplateResult } from 'lit';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
@@ -16,12 +17,8 @@ import {
} from './services/index.js'; } from './services/index.js';
import { RenderService } from './services/render.js'; import { RenderService } from './services/render.js';
import { InlineTextService } from './services/text.js'; import { InlineTextService } from './services/text.js';
import type { DeltaInsert, InlineRange } from './types.js'; import type { InlineRange } from './types.js';
import { import { nativePointToTextPoint, textPointToDomPoint } from './utils/index.js';
type BaseTextAttributes,
nativePointToTextPoint,
textPointToDomPoint,
} from './utils/index.js';
import { getTextNodesFromElement } from './utils/text.js'; import { getTextNodesFromElement } from './utils/text.js';
export type InlineRootElement< export type InlineRootElement<
@@ -1,19 +1,16 @@
import { type BaseTextAttributes, baseTextAttributes } from '@blocksuite/store';
import type { z, ZodTypeDef } from 'zod'; import type { z, ZodTypeDef } from 'zod';
import type { InlineEditor } from '../inline-editor.js'; import type { InlineEditor } from '../inline-editor.js';
import type { AttributeRenderer, InlineRange } from '../types.js'; import type { AttributeRenderer, InlineRange } from '../types.js';
import type { BaseTextAttributes } from '../utils/index.js'; import { getDefaultAttributeRenderer } from '../utils/index.js';
import {
baseTextAttributes,
getDefaultAttributeRenderer,
} from '../utils/index.js';
export class AttributeService<TextAttributes extends BaseTextAttributes> { export class AttributeService<TextAttributes extends BaseTextAttributes> {
private _attributeRenderer: AttributeRenderer<TextAttributes> = private _attributeRenderer: AttributeRenderer<TextAttributes> =
getDefaultAttributeRenderer<TextAttributes>(); getDefaultAttributeRenderer<TextAttributes>();
private _attributeSchema: z.ZodSchema<TextAttributes, ZodTypeDef, unknown> = private _attributeSchema: z.ZodSchema<TextAttributes, ZodTypeDef, unknown> =
baseTextAttributes as z.ZodSchema<TextAttributes, ZodTypeDef, unknown>; baseTextAttributes as never;
private _marks: TextAttributes | null = null; private _marks: TextAttributes | null = null;
@@ -1,6 +1,7 @@
import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store';
import type { InlineEditor } from '../inline-editor.js'; import type { InlineEditor } from '../inline-editor.js';
import type { DeltaEntry, DeltaInsert, InlineRange } from '../types.js'; import type { DeltaEntry, InlineRange } from '../types.js';
import type { BaseTextAttributes } from '../utils/index.js';
import { transformDeltasToEmbedDeltas } from '../utils/index.js'; import { transformDeltasToEmbedDeltas } from '../utils/index.js';
export class DeltaService<TextAttributes extends BaseTextAttributes> { export class DeltaService<TextAttributes extends BaseTextAttributes> {
@@ -1,7 +1,8 @@
import type { BaseTextAttributes } from '@blocksuite/store';
import type { InlineEditor } from '../inline-editor.js'; import type { InlineEditor } from '../inline-editor.js';
import type { InlineRange } from '../types.js'; import type { InlineRange } from '../types.js';
import { import {
type BaseTextAttributes,
isInEmbedElement, isInEmbedElement,
isInEmbedGap, isInEmbedGap,
isInEmptyLine, isInEmptyLine,
@@ -115,7 +116,7 @@ export class EventService<TextAttributes extends BaseTextAttributes> {
ctx.data, ctx.data,
ctx.attributes, ctx.attributes,
ctx.inlineRange, ctx.inlineRange,
this.editor as InlineEditor this.editor as never
); );
this.editor.slots.inputting.next(); this.editor.slots.inputting.next();
@@ -1,6 +1,7 @@
import type { BaseTextAttributes } from '@blocksuite/store';
import type { InlineEditor } from '../inline-editor.js'; import type { InlineEditor } from '../inline-editor.js';
import type { InlineRange } from '../types.js'; import type { InlineRange } from '../types.js';
import type { BaseTextAttributes } from '../utils/base-attributes.js';
export interface BeforeinputHookCtx<TextAttributes extends BaseTextAttributes> { export interface BeforeinputHookCtx<TextAttributes extends BaseTextAttributes> {
inlineEditor: InlineEditor<TextAttributes>; inlineEditor: InlineEditor<TextAttributes>;
@@ -1,10 +1,10 @@
import type { BaseTextAttributes } from '@blocksuite/store';
import { effect } from '@preact/signals-core'; import { effect } from '@preact/signals-core';
import * as Y from 'yjs'; import * as Y from 'yjs';
import type { VLine } from '../components/v-line.js'; import type { VLine } from '../components/v-line.js';
import type { InlineEditor } from '../inline-editor.js'; import type { InlineEditor } from '../inline-editor.js';
import type { InlineRange, TextPoint } from '../types.js'; import type { InlineRange, TextPoint } from '../types.js';
import type { BaseTextAttributes } from '../utils/base-attributes.js';
import { isInEmbedGap } from '../utils/embed.js'; import { isInEmbedGap } from '../utils/embed.js';
import { isMaybeInlineRangeEqual } from '../utils/inline-range.js'; import { isMaybeInlineRangeEqual } from '../utils/inline-range.js';
import { import {
@@ -1,4 +1,5 @@
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
import type { BaseTextAttributes } from '@blocksuite/store';
import { html, render } from 'lit'; import { html, render } from 'lit';
import { repeat } from 'lit/directives/repeat.js'; import { repeat } from 'lit/directives/repeat.js';
import * as Y from 'yjs'; import * as Y from 'yjs';
@@ -6,7 +7,6 @@ import * as Y from 'yjs';
import type { VLine } from '../components/v-line.js'; import type { VLine } from '../components/v-line.js';
import type { InlineEditor } from '../inline-editor.js'; import type { InlineEditor } from '../inline-editor.js';
import type { InlineRange } from '../types.js'; import type { InlineRange } from '../types.js';
import type { BaseTextAttributes } from '../utils/base-attributes.js';
import { deltaInsertsToChunks } from '../utils/delta-convert.js'; import { deltaInsertsToChunks } from '../utils/delta-convert.js';
export class RenderService<TextAttributes extends BaseTextAttributes> { export class RenderService<TextAttributes extends BaseTextAttributes> {
@@ -1,6 +1,7 @@
import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store';
import type { InlineEditor } from '../inline-editor.js'; import type { InlineEditor } from '../inline-editor.js';
import type { DeltaInsert, InlineRange } from '../types.js'; import type { InlineRange } from '../types.js';
import type { BaseTextAttributes } from '../utils/base-attributes.js';
import { intersectInlineRange } from '../utils/inline-range.js'; import { intersectInlineRange } from '../utils/inline-range.js';
export class InlineTextService<TextAttributes extends BaseTextAttributes> { export class InlineTextService<TextAttributes extends BaseTextAttributes> {
+1 -8
View File
@@ -1,14 +1,7 @@
import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store';
import type { TemplateResult } from 'lit'; import type { TemplateResult } from 'lit';
import type { InlineEditor } from './inline-editor.js'; import type { InlineEditor } from './inline-editor.js';
import type { BaseTextAttributes } from './utils/index.js';
export type DeltaInsert<
TextAttributes extends BaseTextAttributes = BaseTextAttributes,
> = {
insert: string;
attributes?: TextAttributes;
};
export type AttributeRenderer< export type AttributeRenderer<
TextAttributes extends BaseTextAttributes = BaseTextAttributes, TextAttributes extends BaseTextAttributes = BaseTextAttributes,
@@ -1,8 +1,8 @@
import type { BaseTextAttributes } from '@blocksuite/store';
import { html } from 'lit'; import { html } from 'lit';
import { styleMap } from 'lit/directives/style-map.js'; import { styleMap } from 'lit/directives/style-map.js';
import type { AttributeRenderer } from '../types.js'; import type { AttributeRenderer } from '../types.js';
import type { BaseTextAttributes } from './base-attributes.js';
function inlineTextStyles( function inlineTextStyles(
props: BaseTextAttributes props: BaseTextAttributes
@@ -1,5 +1,4 @@
import type { DeltaInsert } from '../types.js'; import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store';
import type { BaseTextAttributes } from './base-attributes.js';
export function transformDelta<TextAttributes extends BaseTextAttributes>( export function transformDelta<TextAttributes extends BaseTextAttributes>(
delta: DeltaInsert<TextAttributes> delta: DeltaInsert<TextAttributes>
@@ -1,7 +1,7 @@
import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store';
import { VElement } from '../components/v-element.js'; import { VElement } from '../components/v-element.js';
import type { InlineEditor } from '../inline-editor.js'; import type { InlineEditor } from '../inline-editor.js';
import type { DeltaInsert } from '../types.js';
import type { BaseTextAttributes } from './base-attributes.js';
export function isInEmbedElement(node: Node): boolean { export function isInEmbedElement(node: Node): boolean {
if (node instanceof Element) { if (node instanceof Element) {
@@ -1,5 +1,4 @@
export * from './attribute-renderer.js'; export * from './attribute-renderer.js';
export * from './base-attributes.js';
export * from './delta-convert.js'; export * from './delta-convert.js';
export * from './embed.js'; export * from './embed.js';
export * from './guard.js'; export * from './guard.js';
@@ -1,8 +1,6 @@
import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store';
import { html, type TemplateResult } from 'lit'; import { html, type TemplateResult } from 'lit';
import type { DeltaInsert } from '../types.js';
import type { BaseTextAttributes } from './base-attributes.js';
export function renderElement<TextAttributes extends BaseTextAttributes>( export function renderElement<TextAttributes extends BaseTextAttributes>(
delta: DeltaInsert<TextAttributes>, delta: DeltaInsert<TextAttributes>,
parseAttributes: ( parseAttributes: (
@@ -1,6 +1,7 @@
import type { BaseTextAttributes } from '@blocksuite/store';
import type { InlineEditor } from '../inline-editor.js'; import type { InlineEditor } from '../inline-editor.js';
import type { InlineRange } from '../types.js'; import type { InlineRange } from '../types.js';
import type { BaseTextAttributes } from './base-attributes.js';
function handleInsertText<TextAttributes extends BaseTextAttributes>( function handleInsertText<TextAttributes extends BaseTextAttributes>(
inlineRange: InlineRange, inlineRange: InlineRange,
+1 -1
View File
@@ -6,5 +6,5 @@
"tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo" "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [{ "path": "../global" }] "references": [{ "path": "../global" }, { "path": "../store" }]
} }
-1
View File
@@ -11,7 +11,6 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@blocksuite/global": "workspace:*", "@blocksuite/global": "workspace:*",
"@blocksuite/inline": "workspace:*",
"@blocksuite/sync": "workspace:*", "@blocksuite/sync": "workspace:*",
"@preact/signals-core": "^1.8.0", "@preact/signals-core": "^1.8.0",
"@types/lodash.ismatch": "^4.4.9", "@types/lodash.ismatch": "^4.4.9",
@@ -10,7 +10,7 @@ import {
internalPrimitives, internalPrimitives,
} from '../model/block/index.js'; } from '../model/block/index.js';
import type { YBlock } from '../model/block/types.js'; import type { YBlock } from '../model/block/types.js';
import type { Text } from '../reactive/text.js'; import type { Text } from '../reactive/text/index.js';
import { createAutoIncrementIdGenerator } from '../test/index.js'; import { createAutoIncrementIdGenerator } from '../test/index.js';
import { TestWorkspace } from '../test/test-workspace.js'; import { TestWorkspace } from '../test/test-workspace.js';
@@ -3,7 +3,7 @@ import { assert, beforeEach, describe, expect, it, vi } from 'vitest';
import { applyUpdate, type Doc, encodeStateAsUpdate } from 'yjs'; import { applyUpdate, type Doc, encodeStateAsUpdate } from 'yjs';
import type { BlockModel, DocMeta, Store } from '../index.js'; import type { BlockModel, DocMeta, Store } from '../index.js';
import { Text } from '../reactive/text.js'; import { Text } from '../reactive/text/index.js';
import { createAutoIncrementIdGenerator } from '../test/index.js'; import { createAutoIncrementIdGenerator } from '../test/index.js';
import { TestWorkspace } from '../test/test-workspace.js'; import { TestWorkspace } from '../test/test-workspace.js';
import { import {
@@ -4,5 +4,5 @@ export * from './is-pure-object.js';
export * from './native-y.js'; export * from './native-y.js';
export * from './proxy.js'; export * from './proxy.js';
export * from './stash-pop.js'; export * from './stash-pop.js';
export * from './text.js'; export * from './text/index.js';
export * from './types.js'; export * from './types.js';
@@ -2,7 +2,7 @@ import { Array as YArray, Map as YMap, Text as YText } from 'yjs';
import { Boxed } from './boxed.js'; import { Boxed } from './boxed.js';
import { isPureObject } from './is-pure-object.js'; import { isPureObject } from './is-pure-object.js';
import { Text } from './text.js'; import { Text } from './text/index.js';
import type { Native2Y, TransformOptions } from './types.js'; import type { Native2Y, TransformOptions } from './types.js';
export function native2Y<T>( export function native2Y<T>(
@@ -6,7 +6,7 @@ import { BaseReactiveYData } from './base-reactive-data.js';
import { Boxed, type OnBoxedChange } from './boxed.js'; import { Boxed, type OnBoxedChange } from './boxed.js';
import { proxies } from './memory.js'; import { proxies } from './memory.js';
import { native2Y, y2Native } from './native-y.js'; import { native2Y, y2Native } from './native-y.js';
import { type OnTextChange, Text } from './text.js'; import { type OnTextChange, Text } from './text/index.js';
import type { ProxyOptions, TransformOptions, UnRecord } from './types.js'; import type { ProxyOptions, TransformOptions, UnRecord } from './types.js';
export class ReactiveYArray extends BaseReactiveYData< export class ReactiveYArray extends BaseReactiveYData<
@@ -0,0 +1,3 @@
export * from './attributes';
export * from './text';
export * from './types';
@@ -1,19 +1,8 @@
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
import type { DeltaInsert } from '@blocksuite/inline';
import { type Signal, signal } from '@preact/signals-core'; import { type Signal, signal } from '@preact/signals-core';
import * as Y from 'yjs'; import * as Y from 'yjs';
export interface OptionalAttributes { import type { DeltaInsert, DeltaOperation, OnTextChange } from './types';
attributes?: Record<string, any>;
}
export type DeltaOperation = {
insert?: string;
delete?: number;
retain?: number;
} & OptionalAttributes;
export type OnTextChange = (data: Y.Text, isLocal: boolean) => void;
/** /**
* Text is an abstraction of Y.Text. * Text is an abstraction of Y.Text.
@@ -0,0 +1,22 @@
import type * as Y from 'yjs';
import type { BaseTextAttributes } from './attributes';
export interface OptionalAttributes {
attributes?: Record<string, any>;
}
export type DeltaOperation = {
insert?: string;
delete?: number;
retain?: number;
} & OptionalAttributes;
export type OnTextChange = (data: Y.Text, isLocal: boolean) => void;
export type DeltaInsert<
TextAttributes extends BaseTextAttributes = BaseTextAttributes,
> = {
insert: string;
attributes?: TextAttributes;
};
+1 -5
View File
@@ -6,9 +6,5 @@
"tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo" "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [{ "path": "../global" }, { "path": "../sync" }]
{ "path": "../global" },
{ "path": "../inline" },
{ "path": "../sync" }
]
} }
@@ -34,7 +34,6 @@ import {
ErrorCode, ErrorCode,
} from '@blocksuite/affine/global/exceptions'; } from '@blocksuite/affine/global/exceptions';
import type { SerializedXYWH } from '@blocksuite/affine/global/gfx'; import type { SerializedXYWH } from '@blocksuite/affine/global/gfx';
import type { DeltaInsert } from '@blocksuite/affine/inline/types';
import { ColorScheme, type DocMode } from '@blocksuite/affine/model'; import { ColorScheme, type DocMode } from '@blocksuite/affine/model';
import { import {
docLinkBaseURLMiddleware, docLinkBaseURLMiddleware,
@@ -51,7 +50,11 @@ import {
StyleVariables, StyleVariables,
} from '@blocksuite/affine/shared/theme'; } from '@blocksuite/affine/shared/theme';
import { openFileOrFiles, printToPdf } from '@blocksuite/affine/shared/utils'; import { openFileOrFiles, printToPdf } from '@blocksuite/affine/shared/utils';
import { Text, type Workspace } from '@blocksuite/affine/store'; import {
type DeltaInsert,
Text,
type Workspace,
} from '@blocksuite/affine/store';
import { NotionHtmlAdapter } from '@blocksuite/affine-shared/adapters'; import { NotionHtmlAdapter } from '@blocksuite/affine-shared/adapters';
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types'; import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
import { TestAffineEditorContainer } from '@blocksuite/integration-test'; import { TestAffineEditorContainer } from '@blocksuite/integration-test';
@@ -3,12 +3,14 @@ import '@shoelace-style/shoelace';
import { ShadowlessElement } from '@blocksuite/affine/block-std'; import { ShadowlessElement } from '@blocksuite/affine/block-std';
import { import {
type AttributeRenderer, type AttributeRenderer,
type BaseTextAttributes,
baseTextAttributes,
InlineEditor, InlineEditor,
ZERO_WIDTH_NON_JOINER, ZERO_WIDTH_NON_JOINER,
} from '@blocksuite/affine/inline'; } from '@blocksuite/affine/inline';
import { effects } from '@blocksuite/affine/inline/effects'; import { effects } from '@blocksuite/affine/inline/effects';
import {
type BaseTextAttributes,
baseTextAttributes,
} from '@blocksuite/affine/store';
import { effect } from '@preact/signals-core'; import { effect } from '@preact/signals-core';
import { css, html, nothing } from 'lit'; import { css, html, nothing } from 'lit';
import { customElement, property, query } from 'lit/decorators.js'; import { customElement, property, query } from 'lit/decorators.js';
@@ -1,6 +1,9 @@
import type { DeltaInsert } from '@blocksuite/affine/inline';
import type { AffineTextAttributes } from '@blocksuite/affine/shared/types'; import type { AffineTextAttributes } from '@blocksuite/affine/shared/types';
import { Text, type Workspace } from '@blocksuite/affine/store'; import {
type DeltaInsert,
Text,
type Workspace,
} from '@blocksuite/affine/store';
import { useCallback } from 'react'; import { useCallback } from 'react';
export function useReferenceLinkHelper(docCollection: Workspace) { export function useReferenceLinkHelper(docCollection: Workspace) {
@@ -1,9 +1,9 @@
import { DebugLogger } from '@affine/debug'; import { DebugLogger } from '@affine/debug';
import { Unreachable } from '@affine/env/constant'; import { Unreachable } from '@affine/env/constant';
import type { DeltaInsert } from '@blocksuite/affine/inline';
import type { DocMode } from '@blocksuite/affine/model'; import type { DocMode } from '@blocksuite/affine/model';
import { replaceIdMiddleware } from '@blocksuite/affine/shared/adapters'; import { replaceIdMiddleware } from '@blocksuite/affine/shared/adapters';
import type { AffineTextAttributes } from '@blocksuite/affine/shared/types'; import type { AffineTextAttributes } from '@blocksuite/affine/shared/types';
import type { DeltaInsert } from '@blocksuite/affine/store';
import { Slice, Text, Transformer } from '@blocksuite/affine/store'; import { Slice, Text, Transformer } from '@blocksuite/affine/store';
import { LiveData, ObjectPool, Service } from '@toeverything/infra'; import { LiveData, ObjectPool, Service } from '@toeverything/infra';
import { omitBy } from 'lodash-es'; import { omitBy } from 'lodash-es';
@@ -21,7 +21,7 @@ import {
type TransformerMiddleware, type TransformerMiddleware,
type YBlock, type YBlock,
} from '@blocksuite/affine/store'; } from '@blocksuite/affine/store';
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import { Document } from '@toeverything/infra'; import { Document } from '@toeverything/infra';
import { toHexString } from 'lib0/buffer.js'; import { toHexString } from 'lib0/buffer.js';
import { digest as lib0Digest } from 'lib0/hash/sha256'; import { digest as lib0Digest } from 'lib0/hash/sha256';
+1 -1
View File
@@ -1,4 +1,4 @@
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { import {
+1 -1
View File
@@ -1,4 +1,4 @@
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { import {
@@ -1,8 +1,5 @@
import type { import type { DeltaInsert } from '@blocksuite/affine/store';
DeltaInsert, import type { InlineEditor, InlineRange } from '@blocksuite/inline';
InlineEditor,
InlineRange,
} from '@blocksuite/inline';
import { ZERO_WIDTH_SPACE } from '@blocksuite/inline'; import { ZERO_WIDTH_SPACE } from '@blocksuite/inline';
import { expect, type Page, test } from '@playwright/test'; import { expect, type Page, test } from '@playwright/test';
+1 -1
View File
@@ -1,4 +1,4 @@
import type { DeltaInsert } from '@blocksuite/inline'; import type { DeltaInsert } from '@blocksuite/store';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { import {
+4 -2
View File
@@ -607,14 +607,16 @@ export const PackageList = [
{ {
location: 'blocksuite/framework/inline', location: 'blocksuite/framework/inline',
name: '@blocksuite/inline', name: '@blocksuite/inline',
workspaceDependencies: ['blocksuite/framework/global'], workspaceDependencies: [
'blocksuite/framework/global',
'blocksuite/framework/store',
],
}, },
{ {
location: 'blocksuite/framework/store', location: 'blocksuite/framework/store',
name: '@blocksuite/store', name: '@blocksuite/store',
workspaceDependencies: [ workspaceDependencies: [
'blocksuite/framework/global', 'blocksuite/framework/global',
'blocksuite/framework/inline',
'blocksuite/framework/sync', 'blocksuite/framework/sync',
], ],
}, },
+1 -1
View File
@@ -3413,6 +3413,7 @@ __metadata:
resolution: "@blocksuite/inline@workspace:blocksuite/framework/inline" resolution: "@blocksuite/inline@workspace:blocksuite/framework/inline"
dependencies: dependencies:
"@blocksuite/global": "workspace:*" "@blocksuite/global": "workspace:*"
"@blocksuite/store": "workspace:*"
"@preact/signals-core": "npm:^1.8.0" "@preact/signals-core": "npm:^1.8.0"
lit: "npm:^3.2.0" lit: "npm:^3.2.0"
rxjs: "npm:^7.8.1" rxjs: "npm:^7.8.1"
@@ -3490,7 +3491,6 @@ __metadata:
resolution: "@blocksuite/store@workspace:blocksuite/framework/store" resolution: "@blocksuite/store@workspace:blocksuite/framework/store"
dependencies: dependencies:
"@blocksuite/global": "workspace:*" "@blocksuite/global": "workspace:*"
"@blocksuite/inline": "workspace:*"
"@blocksuite/sync": "workspace:*" "@blocksuite/sync": "workspace:*"
"@preact/signals-core": "npm:^1.8.0" "@preact/signals-core": "npm:^1.8.0"
"@types/lodash.clonedeep": "npm:^4.5.9" "@types/lodash.clonedeep": "npm:^4.5.9"