mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-31 21:59:10 +08:00
feat: migrate to blocksuite/affine (#8332)
Use `@blocksuite/affine` package for all blocksuite features in affine. ```ts @blocksuite/store -> @blocksuite/affine/store @blocksuite/global -> @blocksuite/affine/global @blocksuite/block-std -> @blocksuite/affine/block-std @blocksuite/blocks -> @blocksuite/affine/blocks @blocksuite/presets -> @blocksuite/affine/presets ```
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { AffineTextAttributes } from '@blocksuite/blocks';
|
||||
import type { AffineTextAttributes } from '@blocksuite/affine/blocks';
|
||||
import type { DeltaInsert } from '@blocksuite/inline';
|
||||
import { Document } from '@toeverything/infra';
|
||||
import { toHexString } from 'lib0/buffer.js';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { DeepPartial } from '@blocksuite/affine/global/utils';
|
||||
import {
|
||||
createSignalFromObservable,
|
||||
type Signal,
|
||||
} from '@blocksuite/affine-shared/utils';
|
||||
import type { DeepPartial } from '@blocksuite/global/utils';
|
||||
import { Entity, LiveData } from '@toeverything/infra';
|
||||
import { isObject, merge } from 'lodash-es';
|
||||
import type { Observable } from 'rxjs';
|
||||
|
||||
@@ -2,9 +2,12 @@ import type {
|
||||
DocMode,
|
||||
EdgelessRootService,
|
||||
ReferenceParams,
|
||||
} from '@blocksuite/blocks';
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import type {
|
||||
AffineEditorContainer,
|
||||
DocTitle,
|
||||
} from '@blocksuite/affine/presets';
|
||||
import type { InlineEditor } from '@blocksuite/inline';
|
||||
import type { AffineEditorContainer, DocTitle } from '@blocksuite/presets';
|
||||
import type { DocService, WorkspaceService } from '@toeverything/infra';
|
||||
import { Entity, LiveData } from '@toeverything/infra';
|
||||
import { isEqual } from 'lodash-es';
|
||||
|
||||
@@ -17,8 +17,8 @@ import type { Collection } from '@affine/env/filter';
|
||||
import { PublicPageMode } from '@affine/graphql';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import { track } from '@affine/track';
|
||||
import type { DocMeta } from '@blocksuite/affine/store';
|
||||
import { FilterMinusIcon } from '@blocksuite/icons/rc';
|
||||
import type { DocMeta } from '@blocksuite/store';
|
||||
import {
|
||||
DocsService,
|
||||
GlobalContextService,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DocMode } from '@blocksuite/blocks';
|
||||
import type { DocMode } from '@blocksuite/affine/blocks';
|
||||
import { Entity, LiveData } from '@toeverything/infra';
|
||||
|
||||
interface TemplateOptions {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { WorkspaceFlavour } from '@affine/env/workspace';
|
||||
import { type DocMode, ZipTransformer } from '@blocksuite/blocks';
|
||||
import { type DocMode, ZipTransformer } from '@blocksuite/affine/blocks';
|
||||
import type { WorkspaceMetadata, WorkspacesService } from '@toeverything/infra';
|
||||
import { DocsService, Service } from '@toeverything/infra';
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useWorkspaceName } from '@affine/core/components/hooks/use-workspace-in
|
||||
import { WorkspaceSelector } from '@affine/core/components/workspace-selector';
|
||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import type { DocMode } from '@blocksuite/blocks';
|
||||
import type { DocMode } from '@blocksuite/affine/blocks';
|
||||
import { AllDocsIcon } from '@blocksuite/icons/rc';
|
||||
import {
|
||||
useLiveData,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ReferenceParams } from '@blocksuite/blocks';
|
||||
import type { ReferenceParams } from '@blocksuite/affine/blocks';
|
||||
import { isNil, pick, pickBy } from 'lodash-es';
|
||||
import type { ParsedQuery, ParseOptions } from 'query-string';
|
||||
import queryString from 'query-string';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BlockComponent, EditorHost } from '@blocksuite/block-std';
|
||||
import type { BlockComponent, EditorHost } from '@blocksuite/affine/block-std';
|
||||
import type {
|
||||
DocMode,
|
||||
EmbedLinkedDocModel,
|
||||
@@ -6,10 +6,10 @@ import type {
|
||||
ImageBlockModel,
|
||||
SurfaceRefBlockComponent,
|
||||
SurfaceRefBlockModel,
|
||||
} from '@blocksuite/blocks';
|
||||
import { AffineReference } from '@blocksuite/blocks';
|
||||
import type { AIChatBlockModel } from '@blocksuite/presets';
|
||||
import type { BlockModel } from '@blocksuite/store';
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import { AffineReference } from '@blocksuite/affine/blocks';
|
||||
import type { AIChatBlockModel } from '@blocksuite/affine/presets';
|
||||
import type { BlockModel } from '@blocksuite/affine/store';
|
||||
import { Entity, LiveData } from '@toeverything/infra';
|
||||
import type { TemplateResult } from 'lit';
|
||||
import { firstValueFrom, map, race } from 'rxjs';
|
||||
|
||||
@@ -11,9 +11,9 @@ import {
|
||||
type DocMode,
|
||||
type EdgelessRootService,
|
||||
RefNodeSlotsProvider,
|
||||
} from '@blocksuite/blocks';
|
||||
import { Bound, DisposableGroup } from '@blocksuite/global/utils';
|
||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import { Bound, DisposableGroup } from '@blocksuite/affine/global/utils';
|
||||
import type { AffineEditorContainer } from '@blocksuite/affine/presets';
|
||||
import {
|
||||
FrameworkScope,
|
||||
useLiveData,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { toast } from '@affine/component';
|
||||
import { Button, IconButton } from '@affine/component/ui/button';
|
||||
import { useAsyncCallback } from '@affine/core/components/hooks/affine-async-hooks';
|
||||
import type { ImageBlockModel } from '@blocksuite/blocks';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import type { ImageBlockModel } from '@blocksuite/affine/blocks';
|
||||
import { assertExists } from '@blocksuite/affine/global/utils';
|
||||
import type { BlockModel } from '@blocksuite/affine/store';
|
||||
import {
|
||||
ArrowLeftSmallIcon,
|
||||
ArrowRightSmallIcon,
|
||||
@@ -14,7 +15,6 @@ import {
|
||||
PlusIcon,
|
||||
ViewBarIcon,
|
||||
} from '@blocksuite/icons/rc';
|
||||
import type { BlockModel } from '@blocksuite/store';
|
||||
import { useService } from '@toeverything/infra';
|
||||
import clsx from 'clsx';
|
||||
import { fileTypeFromBuffer } from 'file-type';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IconButton } from '@affine/component';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import type { DocMode } from '@blocksuite/blocks';
|
||||
import type { DocMode } from '@blocksuite/affine/blocks';
|
||||
import {
|
||||
CloseIcon,
|
||||
ExpandFullIcon,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { toReactNode } from '@affine/component';
|
||||
import { AIChatBlockPeekViewTemplate } from '@affine/core/blocksuite/presets/ai';
|
||||
import { BlockComponent } from '@blocksuite/block-std';
|
||||
import { BlockComponent } from '@blocksuite/affine/block-std';
|
||||
import { useLiveData, useService } from '@toeverything/infra';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DocMode } from '@blocksuite/blocks';
|
||||
import type { DocMode } from '@blocksuite/affine/blocks';
|
||||
import type { Doc } from '@toeverything/infra';
|
||||
import {
|
||||
DocsService,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
// the adapter is to bridge the workspace rootdoc & native js bindings
|
||||
import { createYProxy, type Y } from '@blocksuite/store';
|
||||
import { createYProxy, type Y } from '@blocksuite/affine/store';
|
||||
import type { WorkspaceService } from '@toeverything/infra';
|
||||
import { LiveData, Service } from '@toeverything/infra';
|
||||
import { defaultsDeep } from 'lodash-es';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Tag } from '@affine/env/filter';
|
||||
import type { DocsPropertiesMeta } from '@blocksuite/store';
|
||||
import type { DocsPropertiesMeta } from '@blocksuite/affine/store';
|
||||
import type { WorkspaceService } from '@toeverything/infra';
|
||||
import { LiveData, Service } from '@toeverything/infra';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
type CommandCategory,
|
||||
PreconditionStrategy,
|
||||
} from '@affine/core/commands';
|
||||
import type { DocMode } from '@blocksuite/blocks';
|
||||
import type { DocMode } from '@blocksuite/affine/blocks';
|
||||
import type { GlobalContextService } from '@toeverything/infra';
|
||||
import { Entity, LiveData } from '@toeverything/infra';
|
||||
import Fuse from 'fuse.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DocMode } from '@blocksuite/blocks';
|
||||
import type { DocMode } from '@blocksuite/affine/blocks';
|
||||
import { EdgelessIcon, PageIcon } from '@blocksuite/icons/rc';
|
||||
import { Entity, LiveData } from '@toeverything/infra';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ReferenceParams } from '@blocksuite/blocks';
|
||||
import type { ReferenceParams } from '@blocksuite/affine/blocks';
|
||||
import { BlockLinkIcon, EdgelessIcon, PageIcon } from '@blocksuite/icons/rc';
|
||||
import type { DocsService, WorkspaceService } from '@toeverything/infra';
|
||||
import { Entity, LiveData } from '@toeverything/infra';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { track } from '@affine/track';
|
||||
import { Text } from '@blocksuite/store';
|
||||
import { Text } from '@blocksuite/affine/store';
|
||||
import type { DocProps, DocsService } from '@toeverything/infra';
|
||||
import { Service } from '@toeverything/infra';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { UserFriendlyError } from '@affine/graphql';
|
||||
import type { DocMode } from '@blocksuite/blocks';
|
||||
import type { DocMode } from '@blocksuite/affine/blocks';
|
||||
import {
|
||||
effect,
|
||||
Entity,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ErrorNames, UserFriendlyError } from '@affine/graphql';
|
||||
import type { DocMode } from '@blocksuite/blocks';
|
||||
import type { DocMode } from '@blocksuite/affine/blocks';
|
||||
import { Store } from '@toeverything/infra';
|
||||
|
||||
import { type FetchService, isBackendError } from '../../cloud';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { toURLSearchParams } from '@affine/core/modules/navigation/utils';
|
||||
import { Unreachable } from '@affine/env/constant';
|
||||
import type { ReferenceParams } from '@blocksuite/blocks';
|
||||
import type { ReferenceParams } from '@blocksuite/affine/blocks';
|
||||
import { Entity, LiveData } from '@toeverything/infra';
|
||||
import { type To } from 'history';
|
||||
import { omit } from 'lodash-es';
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
getIsOwnerQuery,
|
||||
getWorkspacesQuery,
|
||||
} from '@affine/graphql';
|
||||
import { DocCollection } from '@blocksuite/store';
|
||||
import { DocCollection } from '@blocksuite/affine/store';
|
||||
import {
|
||||
ApplicationStarted,
|
||||
type BlobStorage,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { apis } from '@affine/electron-api';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import { assertExists } from '@blocksuite/affine/global/utils';
|
||||
import type { BlobStorage } from '@toeverything/infra';
|
||||
|
||||
import { bufferToBlob } from '../../utils/buffer-to-blob';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { apis } from '@affine/electron-api';
|
||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||
import { DocCollection } from '@blocksuite/store';
|
||||
import { DocCollection } from '@blocksuite/affine/store';
|
||||
import type {
|
||||
BlobStorage,
|
||||
DocStorage,
|
||||
|
||||
Reference in New Issue
Block a user