diff --git a/blocksuite/affine/blocks/block-code/src/adapters/html.ts b/blocksuite/affine/blocks/block-code/src/adapters/html.ts index 9f908fe5d5..5663db387d 100644 --- a/blocksuite/affine/blocks/block-code/src/adapters/html.ts +++ b/blocksuite/affine/blocks/block-code/src/adapters/html.ts @@ -5,7 +5,7 @@ import { CODE_BLOCK_WRAP_KEY, HastUtils, } from '@blocksuite/affine-shared/adapters'; -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store'; import { bundledLanguagesInfo, codeToHast } from 'shiki'; diff --git a/blocksuite/affine/blocks/block-code/src/adapters/markdown.ts b/blocksuite/affine/blocks/block-code/src/adapters/markdown.ts index a54ad1ee80..b9b470d04e 100644 --- a/blocksuite/affine/blocks/block-code/src/adapters/markdown.ts +++ b/blocksuite/affine/blocks/block-code/src/adapters/markdown.ts @@ -5,7 +5,7 @@ import { CODE_BLOCK_WRAP_KEY, type MarkdownAST, } from '@blocksuite/affine-shared/adapters'; -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store'; import type { Code } from 'mdast'; diff --git a/blocksuite/affine/blocks/block-code/src/adapters/plain-text.ts b/blocksuite/affine/blocks/block-code/src/adapters/plain-text.ts index 6fc4aa9eec..75774abddd 100644 --- a/blocksuite/affine/blocks/block-code/src/adapters/plain-text.ts +++ b/blocksuite/affine/blocks/block-code/src/adapters/plain-text.ts @@ -3,7 +3,7 @@ import { BlockPlainTextAdapterExtension, type BlockPlainTextAdapterMatcher, } from '@blocksuite/affine-shared/adapters'; -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; export const codeBlockPlainTextAdapterMatcher: BlockPlainTextAdapterMatcher = { flavour: CodeBlockSchema.model.flavour, diff --git a/blocksuite/affine/blocks/block-code/src/highlight/affine-code-unit.ts b/blocksuite/affine/blocks/block-code/src/highlight/affine-code-unit.ts index 4579e46a2c..ec170c4b8a 100644 --- a/blocksuite/affine/blocks/block-code/src/highlight/affine-code-unit.ts +++ b/blocksuite/affine/blocks/block-code/src/highlight/affine-code-unit.ts @@ -1,7 +1,8 @@ import { affineTextStyles } from '@blocksuite/affine-rich-text'; import type { AffineTextAttributes } from '@blocksuite/affine-shared/types'; 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 { property } from 'lit/decorators.js'; import { styleMap } from 'lit/directives/style-map.js'; diff --git a/blocksuite/affine/blocks/block-database/src/adapters/utils.ts b/blocksuite/affine/blocks/block-database/src/adapters/utils.ts index 0807b2ad00..2d95046a29 100644 --- a/blocksuite/affine/blocks/block-database/src/adapters/utils.ts +++ b/blocksuite/affine/blocks/block-database/src/adapters/utils.ts @@ -1,6 +1,5 @@ import type { ColumnDataType, SerializedCells } from '@blocksuite/affine-model'; -import type { DeltaInsert } from '@blocksuite/inline'; -import type { BlockSnapshot } from '@blocksuite/store'; +import type { BlockSnapshot, DeltaInsert } from '@blocksuite/store'; import { databaseBlockModels } from '../properties/model'; diff --git a/blocksuite/affine/blocks/block-database/src/detail-panel/note-renderer.ts b/blocksuite/affine/blocks/block-database/src/detail-panel/note-renderer.ts index f80016a584..a374b4690a 100644 --- a/blocksuite/affine/blocks/block-database/src/detail-panel/note-renderer.ts +++ b/blocksuite/affine/blocks/block-database/src/detail-panel/note-renderer.ts @@ -12,7 +12,7 @@ import { createDefaultDoc, matchModels } from '@blocksuite/affine-shared/utils'; import { type EditorHost, ShadowlessElement } from '@blocksuite/block-std'; import type { DetailSlotProps, SingleView } from '@blocksuite/data-view'; 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 { css, html } from 'lit'; import { property } from 'lit/decorators.js'; diff --git a/blocksuite/affine/blocks/block-database/src/properties/rich-text/cell-renderer.ts b/blocksuite/affine/blocks/block-database/src/properties/rich-text/cell-renderer.ts index 94a39e0d97..26a796d329 100644 --- a/blocksuite/affine/blocks/block-database/src/properties/rich-text/cell-renderer.ts +++ b/blocksuite/affine/blocks/block-database/src/properties/rich-text/cell-renderer.ts @@ -18,8 +18,7 @@ import { createIcon, } from '@blocksuite/data-view'; import { IS_MAC } from '@blocksuite/global/env'; -import type { DeltaInsert } from '@blocksuite/inline'; -import type { BlockSnapshot } from '@blocksuite/store'; +import type { BlockSnapshot, DeltaInsert } from '@blocksuite/store'; import { Text } from '@blocksuite/store'; import { computed, effect, signal } from '@preact/signals-core'; import { ref } from 'lit/directives/ref.js'; diff --git a/blocksuite/affine/blocks/block-database/src/properties/rich-text/define.ts b/blocksuite/affine/blocks/block-database/src/properties/rich-text/define.ts index b861ba2d95..96c1297c26 100644 --- a/blocksuite/affine/blocks/block-database/src/properties/rich-text/define.ts +++ b/blocksuite/affine/blocks/block-database/src/properties/rich-text/define.ts @@ -1,6 +1,6 @@ import type { AffineTextAttributes } from '@blocksuite/affine-shared/types'; 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 * as Y from 'yjs'; import zod from 'zod'; diff --git a/blocksuite/affine/blocks/block-database/src/properties/title/text.ts b/blocksuite/affine/blocks/block-database/src/properties/title/text.ts index 6da55b2f8f..f50f4efcca 100644 --- a/blocksuite/affine/blocks/block-database/src/properties/title/text.ts +++ b/blocksuite/affine/blocks/block-database/src/properties/title/text.ts @@ -13,8 +13,7 @@ import { import { BaseCellRenderer } from '@blocksuite/data-view'; import { IS_MAC } from '@blocksuite/global/env'; import { LinkedPageIcon } from '@blocksuite/icons/lit'; -import type { DeltaInsert } from '@blocksuite/inline'; -import type { BlockSnapshot, Text } from '@blocksuite/store'; +import type { BlockSnapshot, DeltaInsert, Text } from '@blocksuite/store'; import { signal } from '@preact/signals-core'; import { property } from 'lit/decorators.js'; import { createRef, ref } from 'lit/directives/ref.js'; diff --git a/blocksuite/affine/blocks/block-list/src/adapters/html.ts b/blocksuite/affine/blocks/block-list/src/adapters/html.ts index 4dcb66f6c7..fbe7217157 100644 --- a/blocksuite/affine/blocks/block-list/src/adapters/html.ts +++ b/blocksuite/affine/blocks/block-list/src/adapters/html.ts @@ -5,7 +5,7 @@ import { type BlockHtmlAdapterMatcher, HastUtils, } from '@blocksuite/affine-shared/adapters'; -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store'; import type { Element } from 'hast'; diff --git a/blocksuite/affine/blocks/block-list/src/adapters/markdown.ts b/blocksuite/affine/blocks/block-list/src/adapters/markdown.ts index 47ddf70e69..b2f99c89c8 100644 --- a/blocksuite/affine/blocks/block-list/src/adapters/markdown.ts +++ b/blocksuite/affine/blocks/block-list/src/adapters/markdown.ts @@ -5,7 +5,7 @@ import { type BlockMarkdownAdapterMatcher, type MarkdownAST, } from '@blocksuite/affine-shared/adapters'; -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store'; import type { List } from 'mdast'; diff --git a/blocksuite/affine/blocks/block-list/src/adapters/notion-html.ts b/blocksuite/affine/blocks/block-list/src/adapters/notion-html.ts index 389ea32dea..0603eb7612 100644 --- a/blocksuite/affine/blocks/block-list/src/adapters/notion-html.ts +++ b/blocksuite/affine/blocks/block-list/src/adapters/notion-html.ts @@ -4,7 +4,7 @@ import { type BlockNotionHtmlAdapterMatcher, HastUtils, } from '@blocksuite/affine-shared/adapters'; -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store'; const listBlockMatchTags = new Set(['ul', 'ol', 'li']); diff --git a/blocksuite/affine/blocks/block-list/src/adapters/plain-text.ts b/blocksuite/affine/blocks/block-list/src/adapters/plain-text.ts index a0352e64d4..f48455f65a 100644 --- a/blocksuite/affine/blocks/block-list/src/adapters/plain-text.ts +++ b/blocksuite/affine/blocks/block-list/src/adapters/plain-text.ts @@ -3,7 +3,7 @@ import { BlockPlainTextAdapterExtension, type BlockPlainTextAdapterMatcher, } from '@blocksuite/affine-shared/adapters'; -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; export const listBlockPlainTextAdapterMatcher: BlockPlainTextAdapterMatcher = { flavour: ListBlockSchema.model.flavour, diff --git a/blocksuite/affine/blocks/block-paragraph/src/adapters/html.ts b/blocksuite/affine/blocks/block-paragraph/src/adapters/html.ts index 3e52c62adc..6fd51bbba9 100644 --- a/blocksuite/affine/blocks/block-paragraph/src/adapters/html.ts +++ b/blocksuite/affine/blocks/block-paragraph/src/adapters/html.ts @@ -5,8 +5,8 @@ import { HastUtils, type HtmlAST, } from '@blocksuite/affine-shared/adapters'; -import type { DeltaInsert } from '@blocksuite/inline'; -import { nanoid, type NodeProps } from '@blocksuite/store'; +import type { DeltaInsert, NodeProps } from '@blocksuite/store'; +import { nanoid } from '@blocksuite/store'; const paragraphBlockMatchTags = new Set([ 'p', diff --git a/blocksuite/affine/blocks/block-paragraph/src/adapters/markdown.ts b/blocksuite/affine/blocks/block-paragraph/src/adapters/markdown.ts index ce043d9ca5..d01622d941 100644 --- a/blocksuite/affine/blocks/block-paragraph/src/adapters/markdown.ts +++ b/blocksuite/affine/blocks/block-paragraph/src/adapters/markdown.ts @@ -4,7 +4,7 @@ import { type BlockMarkdownAdapterMatcher, type MarkdownAST, } from '@blocksuite/affine-shared/adapters'; -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store'; import type { Heading } from 'mdast'; diff --git a/blocksuite/affine/blocks/block-paragraph/src/adapters/plain-text.ts b/blocksuite/affine/blocks/block-paragraph/src/adapters/plain-text.ts index 0c05db26bc..fa95130906 100644 --- a/blocksuite/affine/blocks/block-paragraph/src/adapters/plain-text.ts +++ b/blocksuite/affine/blocks/block-paragraph/src/adapters/plain-text.ts @@ -3,7 +3,7 @@ import { BlockPlainTextAdapterExtension, type BlockPlainTextAdapterMatcher, } from '@blocksuite/affine-shared/adapters'; -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; export const paragraphBlockPlainTextAdapterMatcher: BlockPlainTextAdapterMatcher = { diff --git a/blocksuite/affine/blocks/block-root/src/adapters/markdown.ts b/blocksuite/affine/blocks/block-root/src/adapters/markdown.ts index c10879bd16..71170d8986 100644 --- a/blocksuite/affine/blocks/block-root/src/adapters/markdown.ts +++ b/blocksuite/affine/blocks/block-root/src/adapters/markdown.ts @@ -3,7 +3,7 @@ import { BlockMarkdownAdapterExtension, type BlockMarkdownAdapterMatcher, } from '@blocksuite/affine-shared/adapters'; -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; export const rootBlockMarkdownAdapterMatcher: BlockMarkdownAdapterMatcher = { flavour: RootBlockSchema.model.flavour, diff --git a/blocksuite/affine/blocks/block-surface/src/adapters/utils/text.ts b/blocksuite/affine/blocks/block-surface/src/adapters/utils/text.ts index 220ad4f428..0ef98b96b2 100644 --- a/blocksuite/affine/blocks/block-surface/src/adapters/utils/text.ts +++ b/blocksuite/affine/blocks/block-surface/src/adapters/utils/text.ts @@ -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 { buildMindMapTree } from './mindmap.js'; diff --git a/blocksuite/affine/blocks/block-table/src/adapters/plain-text.ts b/blocksuite/affine/blocks/block-table/src/adapters/plain-text.ts index dbb7bbdd2d..dbc9bce2d7 100644 --- a/blocksuite/affine/blocks/block-table/src/adapters/plain-text.ts +++ b/blocksuite/affine/blocks/block-table/src/adapters/plain-text.ts @@ -7,7 +7,7 @@ import { BlockPlainTextAdapterExtension, type BlockPlainTextAdapterMatcher, } from '@blocksuite/affine-shared/adapters'; -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store'; import { createTableProps, formatTable, processTable } from './utils.js'; diff --git a/blocksuite/affine/blocks/block-table/src/adapters/utils.ts b/blocksuite/affine/blocks/block-table/src/adapters/utils.ts index 179e073ed3..d7a6b87a29 100644 --- a/blocksuite/affine/blocks/block-table/src/adapters/utils.ts +++ b/blocksuite/affine/blocks/block-table/src/adapters/utils.ts @@ -10,7 +10,7 @@ import { } from '@blocksuite/affine-shared/adapters'; import { HastUtils } from '@blocksuite/affine-shared/adapters'; 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 type { Element } from 'hast'; import type { Table as MarkdownTable } from 'mdast'; diff --git a/blocksuite/affine/fragments/fragment-outline/src/card/outline-preview.ts b/blocksuite/affine/fragments/fragment-outline/src/card/outline-preview.ts index 674c0ceb0d..1fb4711b43 100644 --- a/blocksuite/affine/fragments/fragment-outline/src/card/outline-preview.ts +++ b/blocksuite/affine/fragments/fragment-outline/src/card/outline-preview.ts @@ -14,8 +14,7 @@ import { ShadowlessElement } from '@blocksuite/block-std'; import { SignalWatcher, WithDisposable } from '@blocksuite/global/lit'; import { noop } from '@blocksuite/global/utils'; import { LinkedPageIcon } from '@blocksuite/icons/lit'; -import type { DeltaInsert } from '@blocksuite/inline'; -import type { BlockModel } from '@blocksuite/store'; +import type { BlockModel, DeltaInsert } from '@blocksuite/store'; import { consume } from '@lit/context'; import { html, nothing } from 'lit'; import { property } from 'lit/decorators.js'; diff --git a/blocksuite/affine/model/src/blocks/table/table-model.ts b/blocksuite/affine/model/src/blocks/table/table-model.ts index b044426443..6ee88bfe96 100644 --- a/blocksuite/affine/model/src/blocks/table/table-model.ts +++ b/blocksuite/affine/model/src/blocks/table/table-model.ts @@ -1,5 +1,4 @@ -import type { DeltaInsert } from '@blocksuite/inline'; -import type { Text } from '@blocksuite/store'; +import type { DeltaInsert, Text } from '@blocksuite/store'; import { BlockModel, BlockSchemaExtension, diff --git a/blocksuite/affine/rich-text/src/extension/inline-manager.ts b/blocksuite/affine/rich-text/src/extension/inline-manager.ts index b5b6da37de..701da09a5a 100644 --- a/blocksuite/affine/rich-text/src/extension/inline-manager.ts +++ b/blocksuite/affine/rich-text/src/extension/inline-manager.ts @@ -6,11 +6,13 @@ import { } from '@blocksuite/global/di'; import { type AttributeRenderer, - baseTextAttributes, - type DeltaInsert, getDefaultAttributeRenderer, } 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 { MarkdownMatcherIdentifier } from './markdown-matcher.js'; diff --git a/blocksuite/affine/rich-text/src/extension/type.ts b/blocksuite/affine/rich-text/src/extension/type.ts index 0842f33eb2..a585d9b720 100644 --- a/blocksuite/affine/rich-text/src/extension/type.ts +++ b/blocksuite/affine/rich-text/src/extension/type.ts @@ -1,10 +1,9 @@ import type { AttributeRenderer, - BaseTextAttributes, - DeltaInsert, InlineEditor, InlineRange, } from '@blocksuite/inline'; +import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store'; import type * as Y from 'yjs'; import type { ZodTypeAny } from 'zod'; diff --git a/blocksuite/affine/rich-text/src/inline/presets/nodes/affine-text.ts b/blocksuite/affine/rich-text/src/inline/presets/nodes/affine-text.ts index 1ee82a2a20..08986803fa 100644 --- a/blocksuite/affine/rich-text/src/inline/presets/nodes/affine-text.ts +++ b/blocksuite/affine/rich-text/src/inline/presets/nodes/affine-text.ts @@ -1,6 +1,7 @@ import type { AffineTextAttributes } from '@blocksuite/affine-shared/types'; 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 { property } from 'lit/decorators.js'; import { type StyleInfo, styleMap } from 'lit/directives/style-map.js'; diff --git a/blocksuite/affine/rich-text/src/inline/presets/nodes/footnote-node/footnote-node.ts b/blocksuite/affine/rich-text/src/inline/presets/nodes/footnote-node/footnote-node.ts index 16bd090900..12b91d741e 100644 --- a/blocksuite/affine/rich-text/src/inline/presets/nodes/footnote-node/footnote-node.ts +++ b/blocksuite/affine/rich-text/src/inline/presets/nodes/footnote-node/footnote-node.ts @@ -10,12 +10,12 @@ import { } from '@blocksuite/block-std'; import { WithDisposable } from '@blocksuite/global/lit'; import { - type DeltaInsert, INLINE_ROOT_ATTR, type InlineRootElement, ZERO_WIDTH_NON_JOINER, ZERO_WIDTH_SPACE, } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { shift } from '@floating-ui/dom'; import { baseTheme } from '@toeverything/theme'; import { css, html, nothing, unsafeCSS } from 'lit'; diff --git a/blocksuite/affine/rich-text/src/inline/presets/nodes/latex-node/latex-editor-unit.ts b/blocksuite/affine/rich-text/src/inline/presets/nodes/latex-node/latex-editor-unit.ts index bf13db7645..fc27f66dec 100644 --- a/blocksuite/affine/rich-text/src/inline/presets/nodes/latex-node/latex-editor-unit.ts +++ b/blocksuite/affine/rich-text/src/inline/presets/nodes/latex-node/latex-editor-unit.ts @@ -1,6 +1,7 @@ import type { AffineTextAttributes } from '@blocksuite/affine-shared/types'; 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 { property } from 'lit/decorators.js'; import { styleMap } from 'lit/directives/style-map.js'; diff --git a/blocksuite/affine/rich-text/src/inline/presets/nodes/latex-node/latex-node.ts b/blocksuite/affine/rich-text/src/inline/presets/nodes/latex-node/latex-node.ts index bf3c014f61..a8f65a9d4f 100644 --- a/blocksuite/affine/rich-text/src/inline/presets/nodes/latex-node/latex-node.ts +++ b/blocksuite/affine/rich-text/src/inline/presets/nodes/latex-node/latex-node.ts @@ -8,11 +8,11 @@ import { } from '@blocksuite/block-std'; import { SignalWatcher, WithDisposable } from '@blocksuite/global/lit'; import { - type DeltaInsert, type InlineEditor, ZERO_WIDTH_NON_JOINER, ZERO_WIDTH_SPACE, } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { signal } from '@preact/signals-core'; import katex from 'katex'; import { css, html, render } from 'lit'; diff --git a/blocksuite/affine/rich-text/src/inline/presets/nodes/link-node/affine-link.ts b/blocksuite/affine/rich-text/src/inline/presets/nodes/link-node/affine-link.ts index b1dff8b460..715834284b 100644 --- a/blocksuite/affine/rich-text/src/inline/presets/nodes/link-node/affine-link.ts +++ b/blocksuite/affine/rich-text/src/inline/presets/nodes/link-node/affine-link.ts @@ -9,11 +9,11 @@ import type { BlockComponent, BlockStdScope } from '@blocksuite/block-std'; import { BLOCK_ID_ATTR, ShadowlessElement } from '@blocksuite/block-std'; import { WithDisposable } from '@blocksuite/global/lit'; import { - type DeltaInsert, INLINE_ROOT_ATTR, type InlineRootElement, ZERO_WIDTH_SPACE, } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { css, html } from 'lit'; import { property } from 'lit/decorators.js'; import { type StyleInfo, styleMap } from 'lit/directives/style-map.js'; diff --git a/blocksuite/affine/rich-text/src/inline/presets/nodes/reference-node/reference-node.ts b/blocksuite/affine/rich-text/src/inline/presets/nodes/reference-node/reference-node.ts index caa1e20975..37a17b2da5 100644 --- a/blocksuite/affine/rich-text/src/inline/presets/nodes/reference-node/reference-node.ts +++ b/blocksuite/affine/rich-text/src/inline/presets/nodes/reference-node/reference-node.ts @@ -19,13 +19,12 @@ import { BLOCK_ID_ATTR, ShadowlessElement } from '@blocksuite/block-std'; import { WithDisposable } from '@blocksuite/global/lit'; import { LinkedPageIcon } from '@blocksuite/icons/lit'; import { - type DeltaInsert, INLINE_ROOT_ATTR, type InlineRootElement, ZERO_WIDTH_NON_JOINER, ZERO_WIDTH_SPACE, } 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 { property, state } from 'lit/decorators.js'; import { choose } from 'lit/directives/choose.js'; diff --git a/blocksuite/affine/rich-text/src/rich-text.ts b/blocksuite/affine/rich-text/src/rich-text.ts index b5465d518c..62ed1e845d 100644 --- a/blocksuite/affine/rich-text/src/rich-text.ts +++ b/blocksuite/affine/rich-text/src/rich-text.ts @@ -3,12 +3,12 @@ import { ShadowlessElement } from '@blocksuite/block-std'; import { WithDisposable } from '@blocksuite/global/lit'; import { type AttributeRenderer, - type DeltaInsert, InlineEditor, type InlineRange, type InlineRangeProvider, type VLine, } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { Text } from '@blocksuite/store'; import { effect, signal } from '@preact/signals-core'; import { css, html, type TemplateResult } from 'lit'; diff --git a/blocksuite/affine/shared/src/adapters/html/delta-converter.ts b/blocksuite/affine/shared/src/adapters/html/delta-converter.ts index c607f8578e..6b5c6d9308 100644 --- a/blocksuite/affine/shared/src/adapters/html/delta-converter.ts +++ b/blocksuite/affine/shared/src/adapters/html/delta-converter.ts @@ -3,8 +3,7 @@ import { type ServiceIdentifier, type ServiceProvider, } from '@blocksuite/global/di'; -import type { DeltaInsert } from '@blocksuite/inline'; -import type { ExtensionType } from '@blocksuite/store'; +import type { DeltaInsert, ExtensionType } from '@blocksuite/store'; import type { AffineTextAttributes } from '../../types/index.js'; import { diff --git a/blocksuite/affine/shared/src/adapters/markdown/delta-converter.ts b/blocksuite/affine/shared/src/adapters/markdown/delta-converter.ts index 016e050db4..3dd10e6491 100644 --- a/blocksuite/affine/shared/src/adapters/markdown/delta-converter.ts +++ b/blocksuite/affine/shared/src/adapters/markdown/delta-converter.ts @@ -2,8 +2,7 @@ import { createIdentifier, type ServiceIdentifier, } from '@blocksuite/global/di'; -import type { DeltaInsert } from '@blocksuite/inline/types'; -import type { ExtensionType } from '@blocksuite/store'; +import type { DeltaInsert, ExtensionType } from '@blocksuite/store'; import type { PhrasingContent } from 'mdast'; import type { AffineTextAttributes } from '../../types/index.js'; diff --git a/blocksuite/affine/shared/src/adapters/mix-text.ts b/blocksuite/affine/shared/src/adapters/mix-text.ts index 7169f43662..481023e23a 100644 --- a/blocksuite/affine/shared/src/adapters/mix-text.ts +++ b/blocksuite/affine/shared/src/adapters/mix-text.ts @@ -1,12 +1,12 @@ import { DefaultTheme, NoteDisplayMode } from '@blocksuite/affine-model'; import type { ServiceProvider } from '@blocksuite/global/di'; -import type { DeltaInsert } from '@blocksuite/inline'; import { type AssetsManager, ASTWalker, BaseAdapter, type BlockSnapshot, BlockSnapshotSchema, + type DeltaInsert, type DocSnapshot, type ExtensionType, type FromBlockSnapshotPayload, diff --git a/blocksuite/affine/shared/src/adapters/notion-html/delta-converter.ts b/blocksuite/affine/shared/src/adapters/notion-html/delta-converter.ts index 4683e46bfe..079ca72881 100644 --- a/blocksuite/affine/shared/src/adapters/notion-html/delta-converter.ts +++ b/blocksuite/affine/shared/src/adapters/notion-html/delta-converter.ts @@ -2,8 +2,7 @@ import { createIdentifier, type ServiceIdentifier, } from '@blocksuite/global/di'; -import type { DeltaInsert } from '@blocksuite/inline'; -import type { ExtensionType } from '@blocksuite/store'; +import type { DeltaInsert, ExtensionType } from '@blocksuite/store'; import isEqual from 'lodash-es/isEqual'; import type { AffineTextAttributes } from '../../types/index.js'; diff --git a/blocksuite/affine/shared/src/adapters/notion-text.ts b/blocksuite/affine/shared/src/adapters/notion-text.ts index e6f8508777..2443af7b86 100644 --- a/blocksuite/affine/shared/src/adapters/notion-text.ts +++ b/blocksuite/affine/shared/src/adapters/notion-text.ts @@ -1,10 +1,10 @@ import { DefaultTheme } from '@blocksuite/affine-model'; import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; -import type { DeltaInsert } from '@blocksuite/inline'; import { type AssetsManager, BaseAdapter, type BlockSnapshot, + type DeltaInsert, type DocSnapshot, type ExtensionType, type FromBlockSnapshotResult, diff --git a/blocksuite/affine/shared/src/adapters/plain-text/delta-converter.ts b/blocksuite/affine/shared/src/adapters/plain-text/delta-converter.ts index c0d0604f8d..2d60a528d1 100644 --- a/blocksuite/affine/shared/src/adapters/plain-text/delta-converter.ts +++ b/blocksuite/affine/shared/src/adapters/plain-text/delta-converter.ts @@ -2,8 +2,7 @@ import { createIdentifier, type ServiceIdentifier, } from '@blocksuite/global/di'; -import type { DeltaInsert } from '@blocksuite/inline'; -import type { ExtensionType } from '@blocksuite/store'; +import type { DeltaInsert, ExtensionType } from '@blocksuite/store'; import type { AffineTextAttributes } from '../../types/index.js'; import { diff --git a/blocksuite/affine/shared/src/adapters/types/adapter.ts b/blocksuite/affine/shared/src/adapters/types/adapter.ts index d438532487..69d7ad4b1d 100644 --- a/blocksuite/affine/shared/src/adapters/types/adapter.ts +++ b/blocksuite/affine/shared/src/adapters/types/adapter.ts @@ -1,12 +1,13 @@ import { createIdentifier, type ServiceProvider } from '@blocksuite/global/di'; -import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/inline'; import { type AssetsManager, type ASTWalker, type ASTWalkerContext, type BaseAdapter, + type BaseTextAttributes, type BlockSnapshot, BlockSnapshotSchema, + type DeltaInsert, type NodeProps, type Transformer, } from '@blocksuite/store'; diff --git a/blocksuite/affine/shared/src/adapters/utils/text.ts b/blocksuite/affine/shared/src/adapters/utils/text.ts index 6c3bb19d54..c881af8a6f 100644 --- a/blocksuite/affine/shared/src/adapters/utils/text.ts +++ b/blocksuite/affine/shared/src/adapters/utils/text.ts @@ -1,5 +1,5 @@ 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'; const mergeDeltas = ( diff --git a/blocksuite/affine/widgets/widget-slash-menu/src/config.ts b/blocksuite/affine/widgets/widget-slash-menu/src/config.ts index e48ab57e3f..bcea7c4ec2 100644 --- a/blocksuite/affine/widgets/widget-slash-menu/src/config.ts +++ b/blocksuite/affine/widgets/widget-slash-menu/src/config.ts @@ -15,8 +15,7 @@ import { TomorrowIcon, YesterdayIcon, } from '@blocksuite/icons/lit'; -import type { DeltaInsert } from '@blocksuite/inline'; -import { Slice, Text } from '@blocksuite/store'; +import { type DeltaInsert, Slice, Text } from '@blocksuite/store'; import { slashMenuToolTips } from './tooltips'; import type { SlashMenuConfig } from './types'; diff --git a/blocksuite/framework/inline/package.json b/blocksuite/framework/inline/package.json index 120e05cd20..9c5a705811 100644 --- a/blocksuite/framework/inline/package.json +++ b/blocksuite/framework/inline/package.json @@ -23,6 +23,7 @@ }, "dependencies": { "@blocksuite/global": "workspace:*", + "@blocksuite/store": "workspace:*", "@preact/signals-core": "^1.8.0", "lit": "^3.2.0", "rxjs": "^7.8.1", diff --git a/blocksuite/framework/inline/src/__tests__/utils.ts b/blocksuite/framework/inline/src/__tests__/utils.ts index 3bdeddcd11..6bc8be9312 100644 --- a/blocksuite/framework/inline/src/__tests__/utils.ts +++ b/blocksuite/framework/inline/src/__tests__/utils.ts @@ -1,6 +1,7 @@ +import type { DeltaInsert } from '@blocksuite/store'; 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( `http://localhost:${process.env.CI ? 4173 : 5173}/` diff --git a/blocksuite/framework/inline/src/components/v-element.ts b/blocksuite/framework/inline/src/components/v-element.ts index 8ae0c9ed49..530913b413 100644 --- a/blocksuite/framework/inline/src/components/v-element.ts +++ b/blocksuite/framework/inline/src/components/v-element.ts @@ -1,6 +1,7 @@ import { DisposableGroup } from '@blocksuite/global/disposable'; import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; import { SignalWatcher } from '@blocksuite/global/lit'; +import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store'; import { effect, signal } from '@preact/signals-core'; import { html, LitElement } from 'lit'; 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 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'; export class VElement< diff --git a/blocksuite/framework/inline/src/components/v-line.ts b/blocksuite/framework/inline/src/components/v-line.ts index 0d32fcacad..1c9ec99e52 100644 --- a/blocksuite/framework/inline/src/components/v-line.ts +++ b/blocksuite/framework/inline/src/components/v-line.ts @@ -1,11 +1,11 @@ import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; +import type { DeltaInsert } from '@blocksuite/store'; import { html, LitElement, type TemplateResult } from 'lit'; import { property } from 'lit/decorators.js'; import { styleMap } from 'lit/directives/style-map.js'; import { INLINE_ROOT_ATTR, ZERO_WIDTH_SPACE } from '../consts.js'; import type { InlineRootElement } from '../inline-editor.js'; -import type { DeltaInsert } from '../types.js'; import { EmbedGap } from './embed-gap.js'; export class VLine extends LitElement { diff --git a/blocksuite/framework/inline/src/inline-editor.ts b/blocksuite/framework/inline/src/inline-editor.ts index 71a3b51bc6..8d22c7eef4 100644 --- a/blocksuite/framework/inline/src/inline-editor.ts +++ b/blocksuite/framework/inline/src/inline-editor.ts @@ -1,5 +1,6 @@ import { DisposableGroup } from '@blocksuite/global/disposable'; import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; +import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store'; import { type Signal, signal } from '@preact/signals-core'; import { nothing, render, type TemplateResult } from 'lit'; import { Subject } from 'rxjs'; @@ -16,12 +17,8 @@ import { } from './services/index.js'; import { RenderService } from './services/render.js'; import { InlineTextService } from './services/text.js'; -import type { DeltaInsert, InlineRange } from './types.js'; -import { - type BaseTextAttributes, - nativePointToTextPoint, - textPointToDomPoint, -} from './utils/index.js'; +import type { InlineRange } from './types.js'; +import { nativePointToTextPoint, textPointToDomPoint } from './utils/index.js'; import { getTextNodesFromElement } from './utils/text.js'; export type InlineRootElement< diff --git a/blocksuite/framework/inline/src/services/attribute.ts b/blocksuite/framework/inline/src/services/attribute.ts index cd2d4409ab..07c6c59779 100644 --- a/blocksuite/framework/inline/src/services/attribute.ts +++ b/blocksuite/framework/inline/src/services/attribute.ts @@ -1,19 +1,16 @@ +import { type BaseTextAttributes, baseTextAttributes } from '@blocksuite/store'; import type { z, ZodTypeDef } from 'zod'; import type { InlineEditor } from '../inline-editor.js'; import type { AttributeRenderer, InlineRange } from '../types.js'; -import type { BaseTextAttributes } from '../utils/index.js'; -import { - baseTextAttributes, - getDefaultAttributeRenderer, -} from '../utils/index.js'; +import { getDefaultAttributeRenderer } from '../utils/index.js'; export class AttributeService { private _attributeRenderer: AttributeRenderer = getDefaultAttributeRenderer(); private _attributeSchema: z.ZodSchema = - baseTextAttributes as z.ZodSchema; + baseTextAttributes as never; private _marks: TextAttributes | null = null; diff --git a/blocksuite/framework/inline/src/services/delta.ts b/blocksuite/framework/inline/src/services/delta.ts index 72b5cf5ac3..7e5614a789 100644 --- a/blocksuite/framework/inline/src/services/delta.ts +++ b/blocksuite/framework/inline/src/services/delta.ts @@ -1,6 +1,7 @@ +import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store'; + import type { InlineEditor } from '../inline-editor.js'; -import type { DeltaEntry, DeltaInsert, InlineRange } from '../types.js'; -import type { BaseTextAttributes } from '../utils/index.js'; +import type { DeltaEntry, InlineRange } from '../types.js'; import { transformDeltasToEmbedDeltas } from '../utils/index.js'; export class DeltaService { diff --git a/blocksuite/framework/inline/src/services/event.ts b/blocksuite/framework/inline/src/services/event.ts index 6caf722956..636a1113fd 100644 --- a/blocksuite/framework/inline/src/services/event.ts +++ b/blocksuite/framework/inline/src/services/event.ts @@ -1,7 +1,8 @@ +import type { BaseTextAttributes } from '@blocksuite/store'; + import type { InlineEditor } from '../inline-editor.js'; import type { InlineRange } from '../types.js'; import { - type BaseTextAttributes, isInEmbedElement, isInEmbedGap, isInEmptyLine, @@ -115,7 +116,7 @@ export class EventService { ctx.data, ctx.attributes, ctx.inlineRange, - this.editor as InlineEditor + this.editor as never ); this.editor.slots.inputting.next(); diff --git a/blocksuite/framework/inline/src/services/hook.ts b/blocksuite/framework/inline/src/services/hook.ts index 16c8d596ec..1447156141 100644 --- a/blocksuite/framework/inline/src/services/hook.ts +++ b/blocksuite/framework/inline/src/services/hook.ts @@ -1,6 +1,7 @@ +import type { BaseTextAttributes } from '@blocksuite/store'; + import type { InlineEditor } from '../inline-editor.js'; import type { InlineRange } from '../types.js'; -import type { BaseTextAttributes } from '../utils/base-attributes.js'; export interface BeforeinputHookCtx { inlineEditor: InlineEditor; diff --git a/blocksuite/framework/inline/src/services/range.ts b/blocksuite/framework/inline/src/services/range.ts index ec9b896bad..e1436cb959 100644 --- a/blocksuite/framework/inline/src/services/range.ts +++ b/blocksuite/framework/inline/src/services/range.ts @@ -1,10 +1,10 @@ +import type { BaseTextAttributes } from '@blocksuite/store'; import { effect } from '@preact/signals-core'; import * as Y from 'yjs'; import type { VLine } from '../components/v-line.js'; import type { InlineEditor } from '../inline-editor.js'; import type { InlineRange, TextPoint } from '../types.js'; -import type { BaseTextAttributes } from '../utils/base-attributes.js'; import { isInEmbedGap } from '../utils/embed.js'; import { isMaybeInlineRangeEqual } from '../utils/inline-range.js'; import { diff --git a/blocksuite/framework/inline/src/services/render.ts b/blocksuite/framework/inline/src/services/render.ts index dca607b4f4..0626ce347a 100644 --- a/blocksuite/framework/inline/src/services/render.ts +++ b/blocksuite/framework/inline/src/services/render.ts @@ -1,4 +1,5 @@ import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; +import type { BaseTextAttributes } from '@blocksuite/store'; import { html, render } from 'lit'; import { repeat } from 'lit/directives/repeat.js'; import * as Y from 'yjs'; @@ -6,7 +7,6 @@ import * as Y from 'yjs'; import type { VLine } from '../components/v-line.js'; import type { InlineEditor } from '../inline-editor.js'; import type { InlineRange } from '../types.js'; -import type { BaseTextAttributes } from '../utils/base-attributes.js'; import { deltaInsertsToChunks } from '../utils/delta-convert.js'; export class RenderService { diff --git a/blocksuite/framework/inline/src/services/text.ts b/blocksuite/framework/inline/src/services/text.ts index 63ff2cdebb..bbcbb625ed 100644 --- a/blocksuite/framework/inline/src/services/text.ts +++ b/blocksuite/framework/inline/src/services/text.ts @@ -1,6 +1,7 @@ +import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store'; + import type { InlineEditor } from '../inline-editor.js'; -import type { DeltaInsert, InlineRange } from '../types.js'; -import type { BaseTextAttributes } from '../utils/base-attributes.js'; +import type { InlineRange } from '../types.js'; import { intersectInlineRange } from '../utils/inline-range.js'; export class InlineTextService { diff --git a/blocksuite/framework/inline/src/types.ts b/blocksuite/framework/inline/src/types.ts index 533ba2b6b5..ac5b531cfb 100644 --- a/blocksuite/framework/inline/src/types.ts +++ b/blocksuite/framework/inline/src/types.ts @@ -1,14 +1,7 @@ +import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store'; import type { TemplateResult } from 'lit'; 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< TextAttributes extends BaseTextAttributes = BaseTextAttributes, diff --git a/blocksuite/framework/inline/src/utils/attribute-renderer.ts b/blocksuite/framework/inline/src/utils/attribute-renderer.ts index cc3eac02ca..0ccd98a277 100644 --- a/blocksuite/framework/inline/src/utils/attribute-renderer.ts +++ b/blocksuite/framework/inline/src/utils/attribute-renderer.ts @@ -1,8 +1,8 @@ +import type { BaseTextAttributes } from '@blocksuite/store'; import { html } from 'lit'; import { styleMap } from 'lit/directives/style-map.js'; import type { AttributeRenderer } from '../types.js'; -import type { BaseTextAttributes } from './base-attributes.js'; function inlineTextStyles( props: BaseTextAttributes diff --git a/blocksuite/framework/inline/src/utils/delta-convert.ts b/blocksuite/framework/inline/src/utils/delta-convert.ts index 808859b67b..94590946c7 100644 --- a/blocksuite/framework/inline/src/utils/delta-convert.ts +++ b/blocksuite/framework/inline/src/utils/delta-convert.ts @@ -1,5 +1,4 @@ -import type { DeltaInsert } from '../types.js'; -import type { BaseTextAttributes } from './base-attributes.js'; +import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store'; export function transformDelta( delta: DeltaInsert diff --git a/blocksuite/framework/inline/src/utils/embed.ts b/blocksuite/framework/inline/src/utils/embed.ts index 7b2964f80e..d24c806a53 100644 --- a/blocksuite/framework/inline/src/utils/embed.ts +++ b/blocksuite/framework/inline/src/utils/embed.ts @@ -1,7 +1,7 @@ +import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store'; + import { VElement } from '../components/v-element.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 { if (node instanceof Element) { diff --git a/blocksuite/framework/inline/src/utils/index.ts b/blocksuite/framework/inline/src/utils/index.ts index cac07e09d6..b16acd5436 100644 --- a/blocksuite/framework/inline/src/utils/index.ts +++ b/blocksuite/framework/inline/src/utils/index.ts @@ -1,5 +1,4 @@ export * from './attribute-renderer.js'; -export * from './base-attributes.js'; export * from './delta-convert.js'; export * from './embed.js'; export * from './guard.js'; diff --git a/blocksuite/framework/inline/src/utils/renderer.ts b/blocksuite/framework/inline/src/utils/renderer.ts index 4f1d2bf0e6..94c2812680 100644 --- a/blocksuite/framework/inline/src/utils/renderer.ts +++ b/blocksuite/framework/inline/src/utils/renderer.ts @@ -1,8 +1,6 @@ +import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store'; import { html, type TemplateResult } from 'lit'; -import type { DeltaInsert } from '../types.js'; -import type { BaseTextAttributes } from './base-attributes.js'; - export function renderElement( delta: DeltaInsert, parseAttributes: ( diff --git a/blocksuite/framework/inline/src/utils/transform-input.ts b/blocksuite/framework/inline/src/utils/transform-input.ts index 41bd3dc2cd..097544cf1f 100644 --- a/blocksuite/framework/inline/src/utils/transform-input.ts +++ b/blocksuite/framework/inline/src/utils/transform-input.ts @@ -1,6 +1,7 @@ +import type { BaseTextAttributes } from '@blocksuite/store'; + import type { InlineEditor } from '../inline-editor.js'; import type { InlineRange } from '../types.js'; -import type { BaseTextAttributes } from './base-attributes.js'; function handleInsertText( inlineRange: InlineRange, diff --git a/blocksuite/framework/inline/tsconfig.json b/blocksuite/framework/inline/tsconfig.json index fc09da4980..a4ef79f252 100644 --- a/blocksuite/framework/inline/tsconfig.json +++ b/blocksuite/framework/inline/tsconfig.json @@ -6,5 +6,5 @@ "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo" }, "include": ["./src"], - "references": [{ "path": "../global" }] + "references": [{ "path": "../global" }, { "path": "../store" }] } diff --git a/blocksuite/framework/store/package.json b/blocksuite/framework/store/package.json index 2f926304dc..26e1bc72fc 100644 --- a/blocksuite/framework/store/package.json +++ b/blocksuite/framework/store/package.json @@ -11,7 +11,6 @@ "license": "MIT", "dependencies": { "@blocksuite/global": "workspace:*", - "@blocksuite/inline": "workspace:*", "@blocksuite/sync": "workspace:*", "@preact/signals-core": "^1.8.0", "@types/lodash.ismatch": "^4.4.9", diff --git a/blocksuite/framework/store/src/__tests__/block.unit.spec.ts b/blocksuite/framework/store/src/__tests__/block.unit.spec.ts index 0b1adf01b8..750bd0510f 100644 --- a/blocksuite/framework/store/src/__tests__/block.unit.spec.ts +++ b/blocksuite/framework/store/src/__tests__/block.unit.spec.ts @@ -10,7 +10,7 @@ import { internalPrimitives, } from '../model/block/index.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 { TestWorkspace } from '../test/test-workspace.js'; diff --git a/blocksuite/framework/store/src/__tests__/collection.unit.spec.ts b/blocksuite/framework/store/src/__tests__/collection.unit.spec.ts index 131f35e772..56c42dc22b 100644 --- a/blocksuite/framework/store/src/__tests__/collection.unit.spec.ts +++ b/blocksuite/framework/store/src/__tests__/collection.unit.spec.ts @@ -3,7 +3,7 @@ import { assert, beforeEach, describe, expect, it, vi } from 'vitest'; import { applyUpdate, type Doc, encodeStateAsUpdate } from 'yjs'; 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 { TestWorkspace } from '../test/test-workspace.js'; import { diff --git a/blocksuite/framework/store/src/reactive/index.ts b/blocksuite/framework/store/src/reactive/index.ts index 09c06baadd..84328efbb1 100644 --- a/blocksuite/framework/store/src/reactive/index.ts +++ b/blocksuite/framework/store/src/reactive/index.ts @@ -4,5 +4,5 @@ export * from './is-pure-object.js'; export * from './native-y.js'; export * from './proxy.js'; export * from './stash-pop.js'; -export * from './text.js'; +export * from './text/index.js'; export * from './types.js'; diff --git a/blocksuite/framework/store/src/reactive/native-y.ts b/blocksuite/framework/store/src/reactive/native-y.ts index 89c9d6d518..d01c3f2535 100644 --- a/blocksuite/framework/store/src/reactive/native-y.ts +++ b/blocksuite/framework/store/src/reactive/native-y.ts @@ -2,7 +2,7 @@ import { Array as YArray, Map as YMap, Text as YText } from 'yjs'; import { Boxed } from './boxed.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'; export function native2Y( diff --git a/blocksuite/framework/store/src/reactive/proxy.ts b/blocksuite/framework/store/src/reactive/proxy.ts index 358d51b035..d60188ad28 100644 --- a/blocksuite/framework/store/src/reactive/proxy.ts +++ b/blocksuite/framework/store/src/reactive/proxy.ts @@ -6,7 +6,7 @@ import { BaseReactiveYData } from './base-reactive-data.js'; import { Boxed, type OnBoxedChange } from './boxed.js'; import { proxies } from './memory.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'; export class ReactiveYArray extends BaseReactiveYData< diff --git a/blocksuite/framework/inline/src/utils/base-attributes.ts b/blocksuite/framework/store/src/reactive/text/attributes.ts similarity index 100% rename from blocksuite/framework/inline/src/utils/base-attributes.ts rename to blocksuite/framework/store/src/reactive/text/attributes.ts diff --git a/blocksuite/framework/store/src/reactive/text/index.ts b/blocksuite/framework/store/src/reactive/text/index.ts new file mode 100644 index 0000000000..670f10d1ab --- /dev/null +++ b/blocksuite/framework/store/src/reactive/text/index.ts @@ -0,0 +1,3 @@ +export * from './attributes'; +export * from './text'; +export * from './types'; diff --git a/blocksuite/framework/store/src/reactive/text.ts b/blocksuite/framework/store/src/reactive/text/text.ts similarity index 97% rename from blocksuite/framework/store/src/reactive/text.ts rename to blocksuite/framework/store/src/reactive/text/text.ts index 1e49f14d21..d1245051fa 100644 --- a/blocksuite/framework/store/src/reactive/text.ts +++ b/blocksuite/framework/store/src/reactive/text/text.ts @@ -1,19 +1,8 @@ import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; -import type { DeltaInsert } from '@blocksuite/inline'; import { type Signal, signal } from '@preact/signals-core'; import * as Y from 'yjs'; -export interface OptionalAttributes { - attributes?: Record; -} - -export type DeltaOperation = { - insert?: string; - delete?: number; - retain?: number; -} & OptionalAttributes; - -export type OnTextChange = (data: Y.Text, isLocal: boolean) => void; +import type { DeltaInsert, DeltaOperation, OnTextChange } from './types'; /** * Text is an abstraction of Y.Text. diff --git a/blocksuite/framework/store/src/reactive/text/types.ts b/blocksuite/framework/store/src/reactive/text/types.ts new file mode 100644 index 0000000000..ede7be4179 --- /dev/null +++ b/blocksuite/framework/store/src/reactive/text/types.ts @@ -0,0 +1,22 @@ +import type * as Y from 'yjs'; + +import type { BaseTextAttributes } from './attributes'; + +export interface OptionalAttributes { + attributes?: Record; +} + +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; +}; diff --git a/blocksuite/framework/store/tsconfig.json b/blocksuite/framework/store/tsconfig.json index d1f5670428..5c8839b12d 100644 --- a/blocksuite/framework/store/tsconfig.json +++ b/blocksuite/framework/store/tsconfig.json @@ -6,9 +6,5 @@ "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo" }, "include": ["./src"], - "references": [ - { "path": "../global" }, - { "path": "../inline" }, - { "path": "../sync" } - ] + "references": [{ "path": "../global" }, { "path": "../sync" }] } diff --git a/blocksuite/playground/apps/_common/components/starter-debug-menu.ts b/blocksuite/playground/apps/_common/components/starter-debug-menu.ts index addbca99c1..706cc19bb4 100644 --- a/blocksuite/playground/apps/_common/components/starter-debug-menu.ts +++ b/blocksuite/playground/apps/_common/components/starter-debug-menu.ts @@ -34,7 +34,6 @@ import { ErrorCode, } from '@blocksuite/affine/global/exceptions'; 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 { docLinkBaseURLMiddleware, @@ -51,7 +50,11 @@ import { StyleVariables, } from '@blocksuite/affine/shared/theme'; 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 type { AffineTextAttributes } from '@blocksuite/affine-shared/types'; import { TestAffineEditorContainer } from '@blocksuite/integration-test'; diff --git a/blocksuite/playground/examples/inline/test-page.ts b/blocksuite/playground/examples/inline/test-page.ts index 01310f8b22..66f140e2e3 100644 --- a/blocksuite/playground/examples/inline/test-page.ts +++ b/blocksuite/playground/examples/inline/test-page.ts @@ -3,12 +3,14 @@ import '@shoelace-style/shoelace'; import { ShadowlessElement } from '@blocksuite/affine/block-std'; import { type AttributeRenderer, - type BaseTextAttributes, - baseTextAttributes, InlineEditor, ZERO_WIDTH_NON_JOINER, } from '@blocksuite/affine/inline'; import { effects } from '@blocksuite/affine/inline/effects'; +import { + type BaseTextAttributes, + baseTextAttributes, +} from '@blocksuite/affine/store'; import { effect } from '@preact/signals-core'; import { css, html, nothing } from 'lit'; import { customElement, property, query } from 'lit/decorators.js'; diff --git a/packages/frontend/core/src/components/hooks/affine/use-reference-link-helper.ts b/packages/frontend/core/src/components/hooks/affine/use-reference-link-helper.ts index f5b17057dc..64c10904bd 100644 --- a/packages/frontend/core/src/components/hooks/affine/use-reference-link-helper.ts +++ b/packages/frontend/core/src/components/hooks/affine/use-reference-link-helper.ts @@ -1,6 +1,9 @@ -import type { DeltaInsert } from '@blocksuite/affine/inline'; 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'; export function useReferenceLinkHelper(docCollection: Workspace) { diff --git a/packages/frontend/core/src/modules/doc/services/docs.ts b/packages/frontend/core/src/modules/doc/services/docs.ts index c37f227fb5..aa9834ec03 100644 --- a/packages/frontend/core/src/modules/doc/services/docs.ts +++ b/packages/frontend/core/src/modules/doc/services/docs.ts @@ -1,9 +1,9 @@ import { DebugLogger } from '@affine/debug'; import { Unreachable } from '@affine/env/constant'; -import type { DeltaInsert } from '@blocksuite/affine/inline'; import type { DocMode } from '@blocksuite/affine/model'; import { replaceIdMiddleware } from '@blocksuite/affine/shared/adapters'; import type { AffineTextAttributes } from '@blocksuite/affine/shared/types'; +import type { DeltaInsert } from '@blocksuite/affine/store'; import { Slice, Text, Transformer } from '@blocksuite/affine/store'; import { LiveData, ObjectPool, Service } from '@toeverything/infra'; import { omitBy } from 'lodash-es'; diff --git a/packages/frontend/core/src/modules/docs-search/worker/in-worker.ts b/packages/frontend/core/src/modules/docs-search/worker/in-worker.ts index 5e62ab1893..9c72b3e08f 100644 --- a/packages/frontend/core/src/modules/docs-search/worker/in-worker.ts +++ b/packages/frontend/core/src/modules/docs-search/worker/in-worker.ts @@ -21,7 +21,7 @@ import { type TransformerMiddleware, type YBlock, } from '@blocksuite/affine/store'; -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { Document } from '@toeverything/infra'; import { toHexString } from 'lib0/buffer.js'; import { digest as lib0Digest } from 'lib0/hash/sha256'; diff --git a/tests/blocksuite/e2e/basic.spec.ts b/tests/blocksuite/e2e/basic.spec.ts index 21d1dc8d5c..1815c894c1 100644 --- a/tests/blocksuite/e2e/basic.spec.ts +++ b/tests/blocksuite/e2e/basic.spec.ts @@ -1,4 +1,4 @@ -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { expect } from '@playwright/test'; import { diff --git a/tests/blocksuite/e2e/format-bar.spec.ts b/tests/blocksuite/e2e/format-bar.spec.ts index 76bcd9ceb4..c600b1c3cd 100644 --- a/tests/blocksuite/e2e/format-bar.spec.ts +++ b/tests/blocksuite/e2e/format-bar.spec.ts @@ -1,4 +1,4 @@ -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { expect } from '@playwright/test'; import { diff --git a/tests/blocksuite/e2e/inline/inline-editor.spec.ts b/tests/blocksuite/e2e/inline/inline-editor.spec.ts index 2639a410e7..b9576de625 100644 --- a/tests/blocksuite/e2e/inline/inline-editor.spec.ts +++ b/tests/blocksuite/e2e/inline/inline-editor.spec.ts @@ -1,8 +1,5 @@ -import type { - DeltaInsert, - InlineEditor, - InlineRange, -} from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/affine/store'; +import type { InlineEditor, InlineRange } from '@blocksuite/inline'; import { ZERO_WIDTH_SPACE } from '@blocksuite/inline'; import { expect, type Page, test } from '@playwright/test'; diff --git a/tests/blocksuite/e2e/paragraph.spec.ts b/tests/blocksuite/e2e/paragraph.spec.ts index a82dc965e4..be53c8f054 100644 --- a/tests/blocksuite/e2e/paragraph.spec.ts +++ b/tests/blocksuite/e2e/paragraph.spec.ts @@ -1,4 +1,4 @@ -import type { DeltaInsert } from '@blocksuite/inline'; +import type { DeltaInsert } from '@blocksuite/store'; import { expect } from '@playwright/test'; import { diff --git a/tools/utils/src/workspace.gen.ts b/tools/utils/src/workspace.gen.ts index cb6384eda1..102618bdaa 100644 --- a/tools/utils/src/workspace.gen.ts +++ b/tools/utils/src/workspace.gen.ts @@ -607,14 +607,16 @@ export const PackageList = [ { location: 'blocksuite/framework/inline', name: '@blocksuite/inline', - workspaceDependencies: ['blocksuite/framework/global'], + workspaceDependencies: [ + 'blocksuite/framework/global', + 'blocksuite/framework/store', + ], }, { location: 'blocksuite/framework/store', name: '@blocksuite/store', workspaceDependencies: [ 'blocksuite/framework/global', - 'blocksuite/framework/inline', 'blocksuite/framework/sync', ], }, diff --git a/yarn.lock b/yarn.lock index 80f8a1210f..e68d8759f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3413,6 +3413,7 @@ __metadata: resolution: "@blocksuite/inline@workspace:blocksuite/framework/inline" dependencies: "@blocksuite/global": "workspace:*" + "@blocksuite/store": "workspace:*" "@preact/signals-core": "npm:^1.8.0" lit: "npm:^3.2.0" rxjs: "npm:^7.8.1" @@ -3490,7 +3491,6 @@ __metadata: resolution: "@blocksuite/store@workspace:blocksuite/framework/store" dependencies: "@blocksuite/global": "workspace:*" - "@blocksuite/inline": "workspace:*" "@blocksuite/sync": "workspace:*" "@preact/signals-core": "npm:^1.8.0" "@types/lodash.clonedeep": "npm:^4.5.9"