mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 17:46:18 +08:00
refactor(editor): extract ai item component (#9283)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { AIError } from '@blocksuite/affine-components/ai-item';
|
||||
import {
|
||||
NotificationProvider,
|
||||
ThemeProvider,
|
||||
@@ -23,7 +24,6 @@ import { css, html, nothing, type PropertyValues } from 'lit';
|
||||
import { property, query } from 'lit/decorators.js';
|
||||
import { choose } from 'lit/directives/choose.js';
|
||||
|
||||
import type { AIError } from '../../../_common/components/index.js';
|
||||
import type { EdgelessRootService } from '../../edgeless/edgeless-root-service.js';
|
||||
import { PageRootService } from '../../page/page-root-service.js';
|
||||
import { AFFINE_FORMAT_BAR_WIDGET } from '../format-bar/format-bar.js';
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
AIErrorType,
|
||||
type AIItemGroupConfig,
|
||||
} from '@blocksuite/affine-components/ai-item';
|
||||
import type { EditorHost } from '@blocksuite/block-std';
|
||||
import { WithDisposable } from '@blocksuite/global/utils';
|
||||
import { baseTheme } from '@toeverything/theme';
|
||||
@@ -5,10 +9,6 @@ import { css, html, LitElement, nothing, unsafeCSS } from 'lit';
|
||||
import { property } from 'lit/decorators.js';
|
||||
import { choose } from 'lit/directives/choose.js';
|
||||
|
||||
import {
|
||||
AIErrorType,
|
||||
type AIItemGroupConfig,
|
||||
} from '../../../../../_common/components/index.js';
|
||||
import type { AIPanelErrorConfig, CopyConfig } from '../../type.js';
|
||||
import { filterAIItemGroup } from '../../utils.js';
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import type { nothing, TemplateResult } from 'lit';
|
||||
|
||||
import type {
|
||||
AIError,
|
||||
AIItemGroupConfig,
|
||||
} from '../../../_common/components/ai-item/types.js';
|
||||
} from '@blocksuite/affine-components/ai-item';
|
||||
import type { nothing, TemplateResult } from 'lit';
|
||||
|
||||
export interface CopyConfig {
|
||||
allowed: boolean;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import type { AIItemGroupConfig } from '@blocksuite/affine-components/ai-item';
|
||||
import { isInsidePageEditor } from '@blocksuite/affine-shared/utils';
|
||||
import type { EditorHost } from '@blocksuite/block-std';
|
||||
|
||||
import type { AIItemGroupConfig } from '../../../_common/components/ai-item/types.js';
|
||||
|
||||
export function filterAIItemGroup(
|
||||
host: EditorHost,
|
||||
configs: AIItemGroupConfig[]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { AIItemGroupConfig } from '@blocksuite/affine-components/ai-item';
|
||||
import { scrollbarStyle } from '@blocksuite/affine-shared/styles';
|
||||
import { on, stopPropagation } from '@blocksuite/affine-shared/utils';
|
||||
import type { EditorHost } from '@blocksuite/block-std';
|
||||
@@ -5,7 +6,6 @@ import { WithDisposable } from '@blocksuite/global/utils';
|
||||
import { css, html, LitElement, nothing } from 'lit';
|
||||
import { property } from 'lit/decorators.js';
|
||||
|
||||
import type { AIItemGroupConfig } from '../../../_common/components/ai-item/types.js';
|
||||
import type { EdgelessRootBlockComponent } from '../../edgeless/edgeless-root-block.js';
|
||||
|
||||
export class EdgelessCopilotPanel extends WithDisposable(LitElement) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { AIItemGroupConfig } from '@blocksuite/affine-components/ai-item';
|
||||
import { AIStarIcon } from '@blocksuite/affine-components/icons';
|
||||
import type { EditorHost } from '@blocksuite/block-std';
|
||||
import { isGfxGroupCompatibleModel } from '@blocksuite/block-std/gfx';
|
||||
@@ -5,7 +6,6 @@ import { WithDisposable } from '@blocksuite/global/utils';
|
||||
import { css, html, LitElement } from 'lit';
|
||||
import { property } from 'lit/decorators.js';
|
||||
|
||||
import type { AIItemGroupConfig } from '../../../_common/components/ai-item/types.js';
|
||||
import type { EdgelessRootBlockComponent } from '../../edgeless/edgeless-root-block.js';
|
||||
import type { CopilotTool } from '../../edgeless/gfx-tool/copilot-tool.js';
|
||||
import { sortEdgelessElements } from '../../edgeless/utils/clone-utils.js';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { AIItemGroupConfig } from '@blocksuite/affine-components/ai-item';
|
||||
import type { RootBlockModel } from '@blocksuite/affine-model';
|
||||
import {
|
||||
MOUSE_BUTTON,
|
||||
@@ -18,7 +19,6 @@ import { css, html, nothing } from 'lit';
|
||||
import { query, state } from 'lit/decorators.js';
|
||||
import { styleMap } from 'lit/directives/style-map.js';
|
||||
|
||||
import type { AIItemGroupConfig } from '../../../_common/components/ai-item/types.js';
|
||||
import type { EdgelessRootBlockComponent } from '../../edgeless/edgeless-root-block.js';
|
||||
import {
|
||||
AFFINE_AI_PANEL_WIDGET,
|
||||
|
||||
Reference in New Issue
Block a user