mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix: remove bs shared and components in affine (#9792)
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
"@affine/i18n": "workspace:*",
|
||||
"@affine/nbstore": "workspace:*",
|
||||
"@blocksuite/affine": "workspace:*",
|
||||
"@blocksuite/affine-components": "workspace:*",
|
||||
"@blocksuite/icons": "2.2.2",
|
||||
"@capacitor/app": "^6.0.2",
|
||||
"@capacitor/browser": "^6.0.4",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NavigationGestureService } from '@affine/core/mobile/modules/navigation-gesture';
|
||||
import { onMenuOpen } from '@blocksuite/affine-components/context-menu';
|
||||
import { onMenuOpen } from '@blocksuite/affine/blocks';
|
||||
import { useService } from '@toeverything/infra';
|
||||
import { type PropsWithChildren, useCallback, useEffect, useRef } from 'react';
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
{ "path": "../../i18n" },
|
||||
{ "path": "../../../common/nbstore" },
|
||||
{ "path": "../../../../blocksuite/affine/all" },
|
||||
{ "path": "../../../../blocksuite/affine/components" },
|
||||
{ "path": "../../../common/infra" },
|
||||
{ "path": "../../native" }
|
||||
]
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
"@affine/templates": "workspace:*",
|
||||
"@affine/track": "workspace:*",
|
||||
"@blocksuite/affine": "workspace:*",
|
||||
"@blocksuite/affine-components": "workspace:*",
|
||||
"@blocksuite/affine-shared": "workspace:*",
|
||||
"@blocksuite/icons": "2.2.2",
|
||||
"@capacitor/app": "^6.0.2",
|
||||
"@capacitor/browser": "^6.0.4",
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import { stopPropagation } from '@affine/core/utils';
|
||||
import type { EditorHost } from '@blocksuite/affine/block-std';
|
||||
import { type AIError, openFileOrFiles } from '@blocksuite/affine/blocks';
|
||||
import {
|
||||
type AIError,
|
||||
openFileOrFiles,
|
||||
unsafeCSSVarV2,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import {
|
||||
assertExists,
|
||||
SignalWatcher,
|
||||
WithDisposable,
|
||||
} from '@blocksuite/affine/global/utils';
|
||||
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
|
||||
import { ImageIcon, PublishIcon } from '@blocksuite/icons/lit';
|
||||
import { css, html, LitElement, nothing } from 'lit';
|
||||
import { property, query, state } from 'lit/decorators.js';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ShadowlessElement } from '@blocksuite/affine/block-std';
|
||||
import { getAttachmentFileIcons } from '@blocksuite/affine/blocks';
|
||||
import { SignalWatcher, WithDisposable } from '@blocksuite/affine/global/utils';
|
||||
import { getAttachmentFileIcons } from '@blocksuite/affine-components/icons';
|
||||
import { html } from 'lit';
|
||||
import { property } from 'lit/decorators.js';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { FetchUtils } from '@blocksuite/affine/blocks';
|
||||
import { assertExists } from '@blocksuite/affine/global/utils';
|
||||
import { FetchUtils } from '@blocksuite/affine-shared/adapters';
|
||||
|
||||
export async function fetchImageToFile(
|
||||
url: string,
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
type DocMode,
|
||||
type NoteBlockModel,
|
||||
NoteDisplayMode,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import { type DocMode, getLastNoteBlock } from '@blocksuite/affine/blocks';
|
||||
import { Slot } from '@blocksuite/affine/global/utils';
|
||||
import type {
|
||||
AffineEditorContainer,
|
||||
@@ -10,7 +6,7 @@ import type {
|
||||
EdgelessEditor,
|
||||
PageEditor,
|
||||
} from '@blocksuite/affine/presets';
|
||||
import { type BlockModel, type Store } from '@blocksuite/affine/store';
|
||||
import { type Store } from '@blocksuite/affine/store';
|
||||
import clsx from 'clsx';
|
||||
import type React from 'react';
|
||||
import {
|
||||
@@ -189,32 +185,3 @@ export const BlocksuiteEditorContainer = forwardRef<
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
// copy from '@blocksuite/affine-shared/utils'
|
||||
export function getLastNoteBlock(doc: Store) {
|
||||
let note: NoteBlockModel | null = null;
|
||||
if (!doc.root) return null;
|
||||
const { children } = doc.root;
|
||||
for (let i = children.length - 1; i >= 0; i--) {
|
||||
const child = children[i];
|
||||
if (
|
||||
matchFlavours(child, ['affine:note']) &&
|
||||
child.displayMode !== NoteDisplayMode.EdgelessOnly
|
||||
) {
|
||||
note = child as NoteBlockModel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return note;
|
||||
}
|
||||
export function matchFlavours<Key extends (keyof BlockSuite.BlockModels)[]>(
|
||||
model: BlockModel | null,
|
||||
expected: Key
|
||||
): model is BlockSuite.BlockModels[Key[number]] {
|
||||
return (
|
||||
!!model &&
|
||||
expected.some(
|
||||
key => (model.flavour as keyof BlockSuite.BlockModels) === key
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import type {
|
||||
DatabaseBlockModel,
|
||||
MenuOptions,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import { menu } from '@blocksuite/affine-components/context-menu';
|
||||
import { menu } from '@blocksuite/affine/blocks';
|
||||
import { LinkIcon } from '@blocksuite/icons/lit';
|
||||
import type { FrameworkProvider } from '@toeverything/infra';
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import type {
|
||||
DocDisplayMetaExtension,
|
||||
DocDisplayMetaParams,
|
||||
RootBlockConfig,
|
||||
Signal,
|
||||
SpecBuilder,
|
||||
TelemetryEventMap,
|
||||
ThemeExtension,
|
||||
@@ -25,21 +26,18 @@ import type {
|
||||
import {
|
||||
CodeBlockSpec,
|
||||
ColorScheme,
|
||||
createSignalFromObservable,
|
||||
DocDisplayMetaProvider,
|
||||
EditorSettingExtension,
|
||||
ImageBlockSpec,
|
||||
ParagraphBlockSpec,
|
||||
referenceToNode,
|
||||
SpecProvider,
|
||||
TelemetryProvider,
|
||||
ThemeExtensionIdentifier,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import type { Container } from '@blocksuite/affine/global/di';
|
||||
import type { ExtensionType } from '@blocksuite/affine/store';
|
||||
import {
|
||||
createSignalFromObservable,
|
||||
referenceToNode,
|
||||
type Signal,
|
||||
SpecProvider,
|
||||
} from '@blocksuite/affine-shared/utils';
|
||||
import { LinkedPageIcon, PageIcon } from '@blocksuite/icons/lit';
|
||||
import { type FrameworkProvider } from '@toeverything/infra';
|
||||
import type { TemplateResult } from 'lit';
|
||||
|
||||
@@ -12,8 +12,7 @@ import type {
|
||||
GfxBlockElementModel,
|
||||
GfxPrimitiveElementModel,
|
||||
} from '@blocksuite/affine/block-std/gfx';
|
||||
import { type MenuContext } from '@blocksuite/affine/blocks';
|
||||
import type { MenuItemGroup } from '@blocksuite/affine-components/toolbar';
|
||||
import type { MenuContext, MenuItemGroup } from '@blocksuite/affine/blocks';
|
||||
import { LinkIcon } from '@blocksuite/icons/lit';
|
||||
import type { FrameworkProvider } from '@toeverything/infra';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AffineTextAttributes } from '@blocksuite/affine/blocks';
|
||||
import type { DeltaInsert } from '@blocksuite/affine/inline';
|
||||
import { Text, type Workspace } from '@blocksuite/affine/store';
|
||||
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
export function useReferenceLinkHelper(docCollection: Workspace) {
|
||||
|
||||
@@ -15,13 +15,13 @@ import type {
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import {
|
||||
ColorScheme,
|
||||
createSignalFromObservable,
|
||||
SpecProvider,
|
||||
ThemeExtensionIdentifier,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import type { Container } from '@blocksuite/affine/global/di';
|
||||
import { Bound } from '@blocksuite/affine/global/utils';
|
||||
import type { Block, Store } from '@blocksuite/affine/store';
|
||||
import { createSignalFromObservable } from '@blocksuite/affine-shared/utils';
|
||||
import type { Signal } from '@preact/signals-core';
|
||||
import type { FrameworkProvider } from '@toeverything/infra';
|
||||
import { useFramework } from '@toeverything/infra';
|
||||
|
||||
@@ -3,11 +3,11 @@ import { AINetworkSearchService } from '@affine/core/modules/ai-button/services/
|
||||
import { DocDisplayMetaService } from '@affine/core/modules/doc-display-meta';
|
||||
import { WorkspaceService } from '@affine/core/modules/workspace';
|
||||
import {
|
||||
createSignalFromObservable,
|
||||
DocModeProvider,
|
||||
RefNodeSlotsProvider,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import type { AffineEditorContainer } from '@blocksuite/affine/presets';
|
||||
import { createSignalFromObservable } from '@blocksuite/affine-shared/utils';
|
||||
import { useFramework } from '@toeverything/infra';
|
||||
import { forwardRef, useEffect, useRef } from 'react';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
createSignalFromObservable,
|
||||
type Signal,
|
||||
} from '@blocksuite/affine-shared/utils';
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import { LiveData, Service } from '@toeverything/infra';
|
||||
|
||||
import type { FeatureFlagService } from '../../feature-flag';
|
||||
|
||||
@@ -4,6 +4,7 @@ import track from '@affine/track';
|
||||
import type { EditorHost } from '@blocksuite/affine/block-std';
|
||||
import {
|
||||
type AffineInlineEditor,
|
||||
createSignalFromObservable,
|
||||
type DocMode,
|
||||
type LinkedMenuGroup,
|
||||
type LinkedMenuItem,
|
||||
@@ -12,7 +13,6 @@ import {
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import type { DocMeta } from '@blocksuite/affine/store';
|
||||
import { Text } from '@blocksuite/affine/store';
|
||||
import { createSignalFromObservable } from '@blocksuite/affine-shared/utils';
|
||||
import {
|
||||
DateTimeIcon,
|
||||
NewXxxEdgelessIcon,
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { DebugLogger } from '@affine/debug';
|
||||
import { Unreachable } from '@affine/env/constant';
|
||||
import { type DocMode, replaceIdMiddleware } from '@blocksuite/affine/blocks';
|
||||
import {
|
||||
type AffineTextAttributes,
|
||||
type DocMode,
|
||||
replaceIdMiddleware,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import type { DeltaInsert } from '@blocksuite/affine/inline';
|
||||
import { Slice, Text, Transformer } from '@blocksuite/affine/store';
|
||||
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
|
||||
import { LiveData, ObjectPool, Service } from '@toeverything/infra';
|
||||
import { omitBy } from 'lodash-es';
|
||||
import { combineLatest, map } from 'rxjs';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type {
|
||||
AffineTextAttributes,
|
||||
AttachmentBlockModel,
|
||||
BookmarkBlockModel,
|
||||
EmbedBlockModel,
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
type TransformerMiddleware,
|
||||
type YBlock,
|
||||
} from '@blocksuite/affine/store';
|
||||
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
|
||||
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';
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import type { DeepPartial } from '@blocksuite/affine/global/utils';
|
||||
import { Entity, LiveData } from '@toeverything/infra';
|
||||
import { isObject, merge } from 'lodash-es';
|
||||
import type { Observable } from 'rxjs';
|
||||
@@ -14,7 +14,7 @@ import { EditorSettingSchema } from '../schema';
|
||||
type SettingItem<T> = {
|
||||
readonly value: T;
|
||||
set: (value: T) => void;
|
||||
// eslint-disable-next-line rxjs/finnish
|
||||
|
||||
$: LiveData<T>;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GeneralSettingSchema } from '@blocksuite/affine-shared/services';
|
||||
import { GeneralSettingSchema } from '@blocksuite/affine/blocks';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const BSEditorSettingSchema = GeneralSettingSchema;
|
||||
|
||||
@@ -16,11 +16,6 @@
|
||||
{ "path": "../../common/nbstore" },
|
||||
{ "path": "../track" },
|
||||
{ "path": "../../../blocksuite/affine/all" },
|
||||
{ "path": "../../../blocksuite/affine/components" },
|
||||
{ "path": "../../../blocksuite/affine/shared" },
|
||||
{ "path": "../../../blocksuite/framework/block-std" },
|
||||
{ "path": "../../../blocksuite/framework/global" },
|
||||
{ "path": "../../../blocksuite/framework/store" },
|
||||
{ "path": "../../common/infra" }
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user