From efcf1fcaa0be6eaa864251df1808cb9849b02f3a Mon Sep 17 00:00:00 2001 From: Himself65 Date: Wed, 15 Mar 2023 11:58:43 -0500 Subject: [PATCH] style: restrict type import (#1589) --- .eslintrc.js | 1 + apps/web/src/atoms/index.ts | 4 ++-- apps/web/src/blocksuite/index.ts | 2 +- .../web/src/blocksuite/providers/affine/index.ts | 3 ++- .../providers/broad-cast-channel/index.ts | 9 +++++---- .../providers/broad-cast-channel/type.ts | 2 +- apps/web/src/blocksuite/providers/index.ts | 2 +- .../src/components/__debug__/client/Editor.tsx | 8 +++++--- .../__tests__/ProviderComposer.spec.tsx | 3 ++- .../__tests__/WorkSpaceSliderBar.spec.tsx | 3 ++- .../components/affine/affine-error-eoundary.tsx | 8 +++++--- .../affine/enable-affine-cloud-modal/index.tsx | 2 +- .../index.tsx | 2 +- .../affine/workspace-setting-detail/index.tsx | 16 +++++----------- .../panel/collaboration/index.tsx | 12 +++++------- .../collaboration/invite-member-modal/index.tsx | 3 ++- .../panel/general/delete/index.tsx | 6 ++---- .../panel/general/index.tsx | 5 +++-- .../panel/publish/index.tsx | 9 +++++---- .../panel/sync/index.tsx | 4 ++-- .../blocksuite/block-suite-page-list/index.tsx | 4 ++-- .../block-suite-page-list/page-list/DateCell.tsx | 5 +++-- .../page-list/OperationCell.tsx | 5 +++-- .../block-suite-page-list/page-list/index.tsx | 7 ++++--- .../header/editor-mode-switch/CustomLottie.tsx | 3 ++- .../header/editor-mode-switch/index.tsx | 4 ++-- .../header/editor-mode-switch/switch-items.tsx | 4 +++- .../header/header-right-items/SyncUser.tsx | 4 ++-- .../src/components/blocksuite/header/header.tsx | 11 +++-------- .../src/components/blocksuite/header/index.tsx | 8 +++++--- .../src/components/blocksuite/header/utils.tsx | 3 ++- apps/web/src/components/page-detail-editor.tsx | 8 +++++--- apps/web/src/components/provider-composer.tsx | 3 ++- .../pure/create-workspace-modal/index.tsx | 2 +- .../src/components/pure/file-upload/index.tsx | 4 +++- apps/web/src/components/pure/footer/index.tsx | 5 +++-- .../src/components/pure/message-center/index.tsx | 5 +++-- .../pure/quick-search-button/index.tsx | 3 ++- .../pure/quick-search-modal/Footer.tsx | 6 +++--- .../pure/quick-search-modal/PublishedResults.tsx | 5 +++-- .../pure/quick-search-modal/Results.tsx | 8 +++++--- .../components/pure/quick-search-modal/config.ts | 3 ++- .../components/pure/quick-search-modal/index.tsx | 7 ++++--- .../components/pure/workspace-avatar/index.tsx | 2 +- .../src/components/pure/workspace-card/index.tsx | 6 ++++-- .../pure/workspace-list-modal/index.tsx | 4 ++-- .../pure/workspace-list-modal/language-menu.tsx | 3 ++- .../WorkspaceSelector/WorkspaceSelector.tsx | 4 ++-- .../pure/workspace-slider-bar/index.tsx | 7 ++++--- .../components/pure/workspace-title/index.tsx | 3 ++- apps/web/src/hooks/__tests__/index.spec.tsx | 9 +++------ .../use-blocksuite-workspace-helper.spec.ts | 2 +- .../src/hooks/affine/use-is-workspace-owner.ts | 2 +- apps/web/src/hooks/affine/use-members.ts | 2 +- apps/web/src/hooks/affine/use-recent-views.ts | 2 +- .../hooks/affine/use-toggle-workspace-publish.ts | 2 +- .../web/src/hooks/current/use-current-page-id.ts | 2 +- apps/web/src/hooks/current/use-current-user.ts | 2 +- .../src/hooks/current/use-current-workspace.ts | 2 +- .../hooks/use-blocksuite-workspace-avatar-url.ts | 2 +- .../src/hooks/use-blocksuite-workspace-helper.ts | 2 +- .../src/hooks/use-blocksuite-workspace-name.ts | 2 +- .../hooks/use-blocksuite-workspace-page-title.ts | 2 +- apps/web/src/hooks/use-page-meta.ts | 4 ++-- apps/web/src/hooks/use-router-helper.ts | 4 ++-- apps/web/src/hooks/use-router-title.ts | 2 +- ...ync-router-with-current-workspace-and-page.ts | 5 +++-- .../use-sync-router-with-current-workspace.ts | 2 +- apps/web/src/hooks/use-transform-workspace.ts | 2 +- apps/web/src/hooks/use-workspace-blob.ts | 4 ++-- apps/web/src/hooks/use-workspaces.ts | 3 ++- apps/web/src/layouts/index.tsx | 3 ++- apps/web/src/pages/_app.tsx | 9 +++++---- apps/web/src/pages/_debug/broadcast.dev.tsx | 5 +++-- apps/web/src/pages/_debug/init-page.dev.tsx | 2 +- apps/web/src/pages/_document.tsx | 9 ++------- apps/web/src/pages/index.tsx | 2 +- apps/web/src/pages/invite/[invite_code].tsx | 5 +++-- apps/web/src/pages/preview/[previewId].tsx | 4 ++-- .../src/pages/public-workspace/[workspaceId].tsx | 5 +++-- .../public-workspace/[workspaceId]/[pageId].tsx | 5 +++-- .../pages/workspace/[workspaceId]/[pageId].tsx | 10 ++++------ .../src/pages/workspace/[workspaceId]/all.tsx | 4 ++-- .../pages/workspace/[workspaceId]/favorite.tsx | 2 +- .../pages/workspace/[workspaceId]/setting.tsx | 6 ++++-- .../src/pages/workspace/[workspaceId]/trash.tsx | 2 +- apps/web/src/plugins/affine/fetcher.ts | 3 ++- apps/web/src/plugins/affine/index.tsx | 4 ++-- apps/web/src/plugins/index.tsx | 6 +++--- apps/web/src/plugins/local/index.tsx | 4 ++-- .../src/providers/AffineSWRConfigProvider.tsx | 3 ++- apps/web/src/providers/ModalProvider.tsx | 3 ++- apps/web/src/providers/ThemeProvider.tsx | 2 +- apps/web/src/shared/index.ts | 6 +++--- apps/web/src/utils/blocksuite.ts | 4 ++-- .../block-suite-editor/index.stories.tsx | 10 ++++++---- .../src/components/block-suite-editor/index.tsx | 5 +++-- .../src/stories/Breadcrumbs.stories.tsx | 2 +- .../component/src/stories/Button.stories.tsx | 4 ++-- packages/component/src/styles/styled.tsx | 2 +- packages/component/src/styles/theme.ts | 2 +- packages/component/src/styles/types.ts | 4 ++-- .../src/styles/utils/localStorageThemeHelper.ts | 2 +- .../src/styles/utils/systemThemeHelper.ts | 2 +- packages/component/src/ui/button/Button.tsx | 2 +- packages/component/src/ui/button/IconButton.tsx | 10 ++-------- packages/component/src/ui/button/Loading.tsx | 2 +- packages/component/src/ui/button/TextButton.tsx | 2 +- packages/component/src/ui/button/interface.ts | 2 +- packages/component/src/ui/button/styles.ts | 4 ++-- packages/component/src/ui/button/utils.ts | 10 +++------- packages/component/src/ui/confirm/Confirm.tsx | 3 ++- packages/component/src/ui/empty/Empty.tsx | 2 +- packages/component/src/ui/empty/EmptySVG.tsx | 3 ++- packages/component/src/ui/input/Input.tsx | 5 ++--- packages/component/src/ui/layout/Content.tsx | 2 +- packages/component/src/ui/menu/Menu.tsx | 4 ++-- packages/component/src/ui/menu/MenuItem.tsx | 9 ++------- packages/component/src/ui/menu/styles.ts | 2 +- packages/component/src/ui/modal/Modal.tsx | 2 +- .../component/src/ui/modal/ModalCloseButton.tsx | 5 +++-- packages/component/src/ui/modal/ModalWrapper.tsx | 2 +- packages/component/src/ui/modal/styles.ts | 2 +- .../component/src/ui/popper/PopoverArrow.tsx | 5 +++-- packages/component/src/ui/popper/Popper.tsx | 2 +- packages/component/src/ui/shared/Container.tsx | 2 +- packages/component/src/ui/table/Table.tsx | 3 ++- packages/component/src/ui/table/TableBody.tsx | 2 +- packages/component/src/ui/table/TableCell.tsx | 2 +- packages/component/src/ui/table/TableHead.tsx | 2 +- packages/component/src/ui/table/TableRow.tsx | 2 +- packages/component/src/ui/table/interface.ts | 2 +- packages/component/src/ui/table/styles.ts | 2 +- packages/component/src/ui/toast/toast.ts | 3 ++- packages/data-center/src/datacenter.ts | 2 +- packages/data-center/src/message/message.ts | 2 +- .../data-center/src/provider/affine/affine.ts | 6 +++--- .../src/provider/affine/apis/google.ts | 5 +++-- .../src/provider/affine/apis/index.ts | 5 +++-- .../src/provider/affine/apis/request.ts | 2 +- .../data-center/src/provider/affine/apis/user.ts | 2 +- .../src/provider/affine/apis/workspace.ts | 4 ++-- .../data-center/src/provider/affine/channel.ts | 2 +- packages/data-center/src/provider/base.ts | 10 +++++----- packages/data-center/src/provider/local/local.ts | 3 ++- .../provider/tauri-ipc/__tests__/mock-apis.ts | 8 ++++---- .../data-center/src/provider/tauri-ipc/index.ts | 11 +++++++---- .../src/provider/tauri-ipc/ipc/methods.ts | 8 ++++---- packages/data-center/src/provider/utils.ts | 2 +- packages/data-center/src/types/index.ts | 4 ++-- packages/data-center/src/utils/index.ts | 6 ++---- packages/data-center/src/workspace-unit.ts | 2 +- packages/i18n/src/index.ts | 3 ++- tests/libs/sidebar.ts | 2 +- 154 files changed, 332 insertions(+), 307 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 0b9f30dfeb..b8d843a785 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -37,6 +37,7 @@ module.exports = { 'no-func-assign': 'off', 'no-cond-assign': 'off', 'react/prop-types': 'off', + '@typescript-eslint/consistent-type-imports': 'error', '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-empty-function': 'off', diff --git a/apps/web/src/atoms/index.ts b/apps/web/src/atoms/index.ts index 200a085c83..31ea9b25e7 100644 --- a/apps/web/src/atoms/index.ts +++ b/apps/web/src/atoms/index.ts @@ -1,11 +1,11 @@ -import { EditorContainer } from '@blocksuite/editor'; +import type { EditorContainer } from '@blocksuite/editor'; import { assertExists } from '@blocksuite/store'; import { atom, createStore } from 'jotai'; import { atomWithStorage } from 'jotai/utils'; import { unstable_batchedUpdates } from 'react-dom'; import { WorkspacePlugins } from '../plugins'; -import { RemWorkspace, RemWorkspaceFlavour } from '../shared'; +import type { RemWorkspace, RemWorkspaceFlavour } from '../shared'; // workspace necessary atoms export const currentWorkspaceIdAtom = atom(null); export const currentPageIdAtom = atom(null); diff --git a/apps/web/src/blocksuite/index.ts b/apps/web/src/blocksuite/index.ts index 8bacc7f5a7..aa5a3d9d75 100644 --- a/apps/web/src/blocksuite/index.ts +++ b/apps/web/src/blocksuite/index.ts @@ -1,6 +1,6 @@ import { config } from '@affine/env'; -import { BlockSuiteWorkspace, Provider } from '../shared'; +import type { BlockSuiteWorkspace, Provider } from '../shared'; import { createAffineWebSocketProvider, createBroadCastChannelProvider, diff --git a/apps/web/src/blocksuite/providers/affine/index.ts b/apps/web/src/blocksuite/providers/affine/index.ts index 671624a8ee..d75d32d65f 100644 --- a/apps/web/src/blocksuite/providers/affine/index.ts +++ b/apps/web/src/blocksuite/providers/affine/index.ts @@ -1,6 +1,7 @@ import { assertExists } from '@blocksuite/store'; -import { AffineDownloadProvider, BlockSuiteWorkspace } from '../../../shared'; +import type { AffineDownloadProvider } from '../../../shared'; +import { BlockSuiteWorkspace } from '../../../shared'; import { apis } from '../../../shared/apis'; import { providerLogger } from '../../logger'; diff --git a/apps/web/src/blocksuite/providers/broad-cast-channel/index.ts b/apps/web/src/blocksuite/providers/broad-cast-channel/index.ts index f3d01e3359..01b9cc9de2 100644 --- a/apps/web/src/blocksuite/providers/broad-cast-channel/index.ts +++ b/apps/web/src/blocksuite/providers/broad-cast-channel/index.ts @@ -1,18 +1,19 @@ import { assertExists } from '@blocksuite/store'; +import type { Awareness } from 'y-protocols/awareness'; import { applyAwarenessUpdate, - Awareness, encodeAwarenessUpdate, } from 'y-protocols/awareness'; -import { BlockSuiteWorkspace, BroadCastChannelProvider } from '../../../shared'; +import type { BroadCastChannelProvider } from '../../../shared'; +import { BlockSuiteWorkspace } from '../../../shared'; import { providerLogger } from '../../logger'; -import { +import type { AwarenessChanges, BroadcastChannelMessageEvent, - getClients, TypedBroadcastChannel, } from './type'; +import { getClients } from './type'; export const createBroadCastChannelProvider = ( blockSuiteWorkspace: BlockSuiteWorkspace diff --git a/apps/web/src/blocksuite/providers/broad-cast-channel/type.ts b/apps/web/src/blocksuite/providers/broad-cast-channel/type.ts index ecdbddff93..a7830089d3 100644 --- a/apps/web/src/blocksuite/providers/broad-cast-channel/type.ts +++ b/apps/web/src/blocksuite/providers/broad-cast-channel/type.ts @@ -1,4 +1,4 @@ -import { Awareness as YAwareness } from 'y-protocols/awareness'; +import type { Awareness as YAwareness } from 'y-protocols/awareness'; export type ClientId = YAwareness['clientID']; // eslint-disable-next-line @typescript-eslint/ban-types diff --git a/apps/web/src/blocksuite/providers/index.ts b/apps/web/src/blocksuite/providers/index.ts index 3e53017ecc..2b21ad88d2 100644 --- a/apps/web/src/blocksuite/providers/index.ts +++ b/apps/web/src/blocksuite/providers/index.ts @@ -2,7 +2,7 @@ import { WebsocketProvider } from '@affine/datacenter'; import { assertExists } from '@blocksuite/store'; import { IndexeddbPersistence } from 'y-indexeddb'; -import { +import type { AffineWebSocketProvider, BlockSuiteWorkspace, LocalIndexedDBProvider, diff --git a/apps/web/src/components/__debug__/client/Editor.tsx b/apps/web/src/components/__debug__/client/Editor.tsx index db3fbf3e8e..363a987fa5 100644 --- a/apps/web/src/components/__debug__/client/Editor.tsx +++ b/apps/web/src/components/__debug__/client/Editor.tsx @@ -1,7 +1,9 @@ 'use client'; -import { EditorContainer } from '@blocksuite/editor'; -import { assertEquals, assertExists, Generator, Page } from '@blocksuite/store'; -import React, { useCallback, useEffect, useRef, useState } from 'react'; +import type { EditorContainer } from '@blocksuite/editor'; +import type { Page } from '@blocksuite/store'; +import { assertEquals, assertExists, Generator } from '@blocksuite/store'; +import type React from 'react'; +import { useCallback, useEffect, useRef, useState } from 'react'; import { createEmptyBlockSuiteWorkspace } from '../../../utils'; import { BlockSuiteEditor } from '../../blocksuite/block-suite-editor'; diff --git a/apps/web/src/components/__tests__/ProviderComposer.spec.tsx b/apps/web/src/components/__tests__/ProviderComposer.spec.tsx index 9fc3942185..424ec07b2e 100644 --- a/apps/web/src/components/__tests__/ProviderComposer.spec.tsx +++ b/apps/web/src/components/__tests__/ProviderComposer.spec.tsx @@ -2,7 +2,8 @@ * @vitest-environment happy-dom */ import { render } from '@testing-library/react'; -import React, { createContext, useContext } from 'react'; +import type React from 'react'; +import { createContext, useContext } from 'react'; import { expect, test } from 'vitest'; import { ProviderComposer } from '../provider-composer'; diff --git a/apps/web/src/components/__tests__/WorkSpaceSliderBar.spec.tsx b/apps/web/src/components/__tests__/WorkSpaceSliderBar.spec.tsx index 7f79e059e2..7ae7c001c9 100644 --- a/apps/web/src/components/__tests__/WorkSpaceSliderBar.spec.tsx +++ b/apps/web/src/components/__tests__/WorkSpaceSliderBar.spec.tsx @@ -7,7 +7,8 @@ import { assertExists } from '@blocksuite/store'; import { render, renderHook } from '@testing-library/react'; import { createStore, getDefaultStore, Provider } from 'jotai'; import { useRouter } from 'next/router'; -import React, { useCallback } from 'react'; +import type React from 'react'; +import { useCallback } from 'react'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import { workspacesAtom } from '../../atoms'; diff --git a/apps/web/src/components/affine/affine-error-eoundary.tsx b/apps/web/src/components/affine/affine-error-eoundary.tsx index 951b35d29f..9141c69f4a 100644 --- a/apps/web/src/components/affine/affine-error-eoundary.tsx +++ b/apps/web/src/components/affine/affine-error-eoundary.tsx @@ -1,8 +1,10 @@ import { RequestError } from '@affine/datacenter'; -import { NextRouter } from 'next/router'; -import React, { Component, ErrorInfo } from 'react'; +import type { NextRouter } from 'next/router'; +import type { ErrorInfo } from 'react'; +import type React from 'react'; +import { Component } from 'react'; -import { BlockSuiteWorkspace } from '../../shared'; +import type { BlockSuiteWorkspace } from '../../shared'; export type AffineErrorBoundaryProps = React.PropsWithChildren<{ router: NextRouter; diff --git a/apps/web/src/components/affine/enable-affine-cloud-modal/index.tsx b/apps/web/src/components/affine/enable-affine-cloud-modal/index.tsx index 3b7f4fc775..e85e1a80a4 100644 --- a/apps/web/src/components/affine/enable-affine-cloud-modal/index.tsx +++ b/apps/web/src/components/affine/enable-affine-cloud-modal/index.tsx @@ -1,7 +1,7 @@ import { IconButton, Modal, ModalWrapper } from '@affine/component'; import { useTranslation } from '@affine/i18n'; import { CloseIcon } from '@blocksuite/icons'; -import React from 'react'; +import type React from 'react'; import { useCurrentUser } from '../../../hooks/current/use-current-user'; import { Content, ContentTitle, Header, StyleButton, StyleTips } from './style'; diff --git a/apps/web/src/components/affine/transform-workspace-to-affine-modal/index.tsx b/apps/web/src/components/affine/transform-workspace-to-affine-modal/index.tsx index c7c38c31e9..67562b44c0 100644 --- a/apps/web/src/components/affine/transform-workspace-to-affine-modal/index.tsx +++ b/apps/web/src/components/affine/transform-workspace-to-affine-modal/index.tsx @@ -1,7 +1,7 @@ import { IconButton, Modal, ModalWrapper } from '@affine/component'; import { useTranslation } from '@affine/i18n'; import { CloseIcon } from '@blocksuite/icons'; -import React from 'react'; +import type React from 'react'; import { useCurrentUser } from '../../../hooks/current/use-current-user'; import { Content, ContentTitle, Header, StyleButton, StyleTips } from './style'; diff --git a/apps/web/src/components/affine/workspace-setting-detail/index.tsx b/apps/web/src/components/affine/workspace-setting-detail/index.tsx index 2662636b8e..6430aede73 100644 --- a/apps/web/src/components/affine/workspace-setting-detail/index.tsx +++ b/apps/web/src/components/affine/workspace-setting-detail/index.tsx @@ -1,23 +1,17 @@ import { useTranslation } from '@affine/i18n'; -import React, { - MouseEvent, - Suspense, - useCallback, - useEffect, - useMemo, - useRef, -} from 'react'; +import type { MouseEvent } from 'react'; +import type React from 'react'; +import { Suspense, useCallback, useEffect, useMemo, useRef } from 'react'; import { preload } from 'swr'; import { useIsWorkspaceOwner } from '../../../hooks/affine/use-is-workspace-owner'; import { fetcher, QueryKey } from '../../../plugins/affine/fetcher'; -import { +import type { AffineOfficialWorkspace, FlavourToWorkspace, - RemWorkspaceFlavour, SettingPanel, - settingPanel, } from '../../../shared'; +import { RemWorkspaceFlavour, settingPanel } from '../../../shared'; import { CollaborationPanel } from './panel/collaboration'; import { ExportPanel } from './panel/export'; import { GeneralPanel } from './panel/general'; diff --git a/apps/web/src/components/affine/workspace-setting-detail/panel/collaboration/index.tsx b/apps/web/src/components/affine/workspace-setting-detail/panel/collaboration/index.tsx index 1f89f3cce0..687653ce8d 100644 --- a/apps/web/src/components/affine/workspace-setting-detail/panel/collaboration/index.tsx +++ b/apps/web/src/components/affine/workspace-setting-detail/panel/collaboration/index.tsx @@ -13,17 +13,15 @@ import { EmailIcon, MoreVerticalIcon, } from '@blocksuite/icons'; -import React, { useCallback, useState } from 'react'; +import type React from 'react'; +import { useCallback, useState } from 'react'; import { useMembers } from '../../../../../hooks/affine/use-members'; -import { - AffineWorkspace, - LocalWorkspace, - RemWorkspaceFlavour, -} from '../../../../../shared'; +import type { AffineWorkspace, LocalWorkspace } from '../../../../../shared'; +import { RemWorkspaceFlavour } from '../../../../../shared'; import { Unreachable } from '../../../affine-error-eoundary'; import { TransformWorkspaceToAffineModal } from '../../../transform-workspace-to-affine-modal'; -import { PanelProps } from '../../index'; +import type { PanelProps } from '../../index'; import { InviteMemberModal } from './invite-member-modal'; import { StyledMemberAvatar, diff --git a/apps/web/src/components/affine/workspace-setting-detail/panel/collaboration/invite-member-modal/index.tsx b/apps/web/src/components/affine/workspace-setting-detail/panel/collaboration/invite-member-modal/index.tsx index 33116636e0..92ba89998d 100644 --- a/apps/web/src/components/affine/workspace-setting-detail/panel/collaboration/invite-member-modal/index.tsx +++ b/apps/web/src/components/affine/workspace-setting-detail/panel/collaboration/invite-member-modal/index.tsx @@ -5,7 +5,8 @@ import { Input } from '@affine/component'; import { MuiAvatar } from '@affine/component'; import { useTranslation } from '@affine/i18n'; import { EmailIcon } from '@blocksuite/icons'; -import React, { Suspense, useCallback, useState } from 'react'; +import type React from 'react'; +import { Suspense, useCallback, useState } from 'react'; import { useMembers } from '../../../../../../hooks/affine/use-members'; import { useUsersByEmail } from '../../../../../../hooks/affine/use-users-by-email'; diff --git a/apps/web/src/components/affine/workspace-setting-detail/panel/general/delete/index.tsx b/apps/web/src/components/affine/workspace-setting-detail/panel/general/delete/index.tsx index d590d21c6d..12f24d801d 100644 --- a/apps/web/src/components/affine/workspace-setting-detail/panel/general/delete/index.tsx +++ b/apps/web/src/components/affine/workspace-setting-detail/panel/general/delete/index.tsx @@ -3,10 +3,8 @@ import { Trans, useTranslation } from '@affine/i18n'; import { useCallback, useState } from 'react'; import { useBlockSuiteWorkspaceName } from '../../../../../../hooks/use-blocksuite-workspace-name'; -import { - AffineOfficialWorkspace, - RemWorkspaceFlavour, -} from '../../../../../../shared'; +import type { AffineOfficialWorkspace } from '../../../../../../shared'; +import { RemWorkspaceFlavour } from '../../../../../../shared'; import { StyledButtonContent, StyledInputContent, diff --git a/apps/web/src/components/affine/workspace-setting-detail/panel/general/index.tsx b/apps/web/src/components/affine/workspace-setting-detail/panel/general/index.tsx index 8ba9069d7f..02a6e6998d 100644 --- a/apps/web/src/components/affine/workspace-setting-detail/panel/general/index.tsx +++ b/apps/web/src/components/affine/workspace-setting-detail/panel/general/index.tsx @@ -1,6 +1,7 @@ import { Button, FlexWrapper, MuiFade } from '@affine/component'; import { useTranslation } from '@affine/i18n'; -import React, { useState } from 'react'; +import type React from 'react'; +import { useState } from 'react'; import { useIsWorkspaceOwner } from '../../../../../hooks/affine/use-is-workspace-owner'; import { useBlockSuiteWorkspaceAvatarUrl } from '../../../../../hooks/use-blocksuite-workspace-avatar-url'; @@ -13,7 +14,7 @@ import { LocalWorkspaceIcon, } from '../../../../pure/icons'; import { WorkspaceAvatar } from '../../../../pure/workspace-avatar'; -import { PanelProps } from '../../index'; +import type { PanelProps } from '../../index'; import { StyledRow, StyledSettingKey } from '../../style'; import { WorkspaceDeleteModal } from './delete'; import { CameraIcon } from './icons'; diff --git a/apps/web/src/components/affine/workspace-setting-detail/panel/publish/index.tsx b/apps/web/src/components/affine/workspace-setting-detail/panel/publish/index.tsx index 003826d776..dde88a3335 100644 --- a/apps/web/src/components/affine/workspace-setting-detail/panel/publish/index.tsx +++ b/apps/web/src/components/affine/workspace-setting-detail/panel/publish/index.tsx @@ -8,18 +8,19 @@ import { } from '@affine/component'; import { useTranslation } from '@affine/i18n'; import { Box } from '@mui/material'; -import React, { useCallback, useEffect, useState } from 'react'; +import type React from 'react'; +import { useCallback, useEffect, useState } from 'react'; import { useToggleWorkspacePublish } from '../../../../../hooks/affine/use-toggle-workspace-publish'; -import { +import type { AffineOfficialWorkspace, AffineWorkspace, LocalWorkspace, - RemWorkspaceFlavour, } from '../../../../../shared'; +import { RemWorkspaceFlavour } from '../../../../../shared'; import { Unreachable } from '../../../affine-error-eoundary'; import { EnableAffineCloudModal } from '../../../enable-affine-cloud-modal'; -import { WorkspaceSettingDetailProps } from '../../index'; +import type { WorkspaceSettingDetailProps } from '../../index'; export type PublishPanelProps = WorkspaceSettingDetailProps & { workspace: AffineOfficialWorkspace; diff --git a/apps/web/src/components/affine/workspace-setting-detail/panel/sync/index.tsx b/apps/web/src/components/affine/workspace-setting-detail/panel/sync/index.tsx index df1e86d3d0..69a6164661 100644 --- a/apps/web/src/components/affine/workspace-setting-detail/panel/sync/index.tsx +++ b/apps/web/src/components/affine/workspace-setting-detail/panel/sync/index.tsx @@ -1,13 +1,13 @@ import { Content, FlexWrapper, styled } from '@affine/component'; import { Trans, useTranslation } from '@affine/i18n'; -import React from 'react'; +import type React from 'react'; import { useCurrentUser } from '../../../../../hooks/current/use-current-user'; import { useBlockSuiteWorkspaceAvatarUrl } from '../../../../../hooks/use-blocksuite-workspace-avatar-url'; import { useBlockSuiteWorkspaceName } from '../../../../../hooks/use-blocksuite-workspace-name'; import { RemWorkspaceFlavour } from '../../../../../shared'; import { WorkspaceAvatar } from '../../../../pure/footer'; -import { PanelProps } from '../../index'; +import type { PanelProps } from '../../index'; export const StyledWorkspaceName = styled('span')(({ theme }) => { return { diff --git a/apps/web/src/components/blocksuite/block-suite-page-list/index.tsx b/apps/web/src/components/blocksuite/block-suite-page-list/index.tsx index 1a570528ee..500741c0b4 100644 --- a/apps/web/src/components/blocksuite/block-suite-page-list/index.tsx +++ b/apps/web/src/components/blocksuite/block-suite-page-list/index.tsx @@ -1,6 +1,6 @@ -import React from 'react'; +import type React from 'react'; -import { BlockSuiteWorkspace } from '../../../shared'; +import type { BlockSuiteWorkspace } from '../../../shared'; import PageList from './page-list'; export type BlockSuitePageListProps = { diff --git a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/DateCell.tsx b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/DateCell.tsx index 254db694e7..f4f9ccb5ff 100644 --- a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/DateCell.tsx +++ b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/DateCell.tsx @@ -1,5 +1,6 @@ -import { TableCell, TableCellProps } from '@affine/component'; -import { PageMeta } from '@blocksuite/store'; +import type { TableCellProps } from '@affine/component'; +import { TableCell } from '@affine/component'; +import type { PageMeta } from '@blocksuite/store'; import dayjs from 'dayjs'; import localizedFormat from 'dayjs/plugin/localizedFormat'; import React from 'react'; diff --git a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/OperationCell.tsx b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/OperationCell.tsx index 513860ddf7..80d86458b4 100644 --- a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/OperationCell.tsx +++ b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/OperationCell.tsx @@ -17,8 +17,9 @@ import { OpenInNewIcon, ResetIcon, } from '@blocksuite/icons'; -import { PageMeta } from '@blocksuite/store'; -import React, { useState } from 'react'; +import type { PageMeta } from '@blocksuite/store'; +import type React from 'react'; +import { useState } from 'react'; export type OperationCellProps = { pageMeta: PageMeta; diff --git a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/index.tsx b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/index.tsx index c304745d8c..d9ca00a39b 100644 --- a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/index.tsx +++ b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/index.tsx @@ -13,19 +13,20 @@ import { FavoriteIcon, PageIcon, } from '@blocksuite/icons'; -import { PageMeta } from '@blocksuite/store'; +import type { PageMeta } from '@blocksuite/store'; import { useMediaQuery, useTheme as useMuiTheme, useTheme, } from '@mui/material'; -import React, { useMemo } from 'react'; +import type React from 'react'; +import { useMemo } from 'react'; import { usePageMeta, usePageMetaHelper, } from '../../../../hooks/use-page-meta'; -import { BlockSuiteWorkspace } from '../../../../shared'; +import type { BlockSuiteWorkspace } from '../../../../shared'; import DateCell from './DateCell'; import Empty from './Empty'; import { OperationCell, TrashOperationCell } from './OperationCell'; diff --git a/apps/web/src/components/blocksuite/header/editor-mode-switch/CustomLottie.tsx b/apps/web/src/components/blocksuite/header/editor-mode-switch/CustomLottie.tsx index e9d2f7ca1d..ba1a9904a3 100644 --- a/apps/web/src/components/blocksuite/header/editor-mode-switch/CustomLottie.tsx +++ b/apps/web/src/components/blocksuite/header/editor-mode-switch/CustomLottie.tsx @@ -1,5 +1,6 @@ import lottie from 'lottie-web'; -import { FC, useEffect, useRef } from 'react'; +import type { FC } from 'react'; +import { useEffect, useRef } from 'react'; type CustomLottieProps = { options: { diff --git a/apps/web/src/components/blocksuite/header/editor-mode-switch/index.tsx b/apps/web/src/components/blocksuite/header/editor-mode-switch/index.tsx index 1ebab98798..c184085cf3 100644 --- a/apps/web/src/components/blocksuite/header/editor-mode-switch/index.tsx +++ b/apps/web/src/components/blocksuite/header/editor-mode-switch/index.tsx @@ -1,12 +1,12 @@ import { toast } from '@affine/component'; import { assertExists } from '@blocksuite/store'; -import { CSSProperties } from 'react'; +import type { CSSProperties } from 'react'; import { usePageMeta, usePageMetaHelper, } from '../../../../hooks/use-page-meta'; -import { BlockSuiteWorkspace } from '../../../../shared'; +import type { BlockSuiteWorkspace } from '../../../../shared'; import { StyledEditorModeSwitch } from './style'; import { EdgelessSwitchItem, PageSwitchItem } from './switch-items'; diff --git a/apps/web/src/components/blocksuite/header/editor-mode-switch/switch-items.tsx b/apps/web/src/components/blocksuite/header/editor-mode-switch/switch-items.tsx index 270ee107ba..6e2969a6cc 100644 --- a/apps/web/src/components/blocksuite/header/editor-mode-switch/switch-items.tsx +++ b/apps/web/src/components/blocksuite/header/editor-mode-switch/switch-items.tsx @@ -1,4 +1,6 @@ -import React, { cloneElement, HTMLAttributes, useState } from 'react'; +import type { HTMLAttributes } from 'react'; +import type React from 'react'; +import { cloneElement, useState } from 'react'; import Lottie from './CustomLottie'; import { StyledSwitchItem } from './style'; diff --git a/apps/web/src/components/blocksuite/header/header-right-items/SyncUser.tsx b/apps/web/src/components/blocksuite/header/header-right-items/SyncUser.tsx index 1af8584cca..bacb6f63c5 100644 --- a/apps/web/src/components/blocksuite/header/header-right-items/SyncUser.tsx +++ b/apps/web/src/components/blocksuite/header/header-right-items/SyncUser.tsx @@ -11,11 +11,11 @@ import React, { useEffect, useState } from 'react'; import { useCurrentWorkspace } from '../../../../hooks/current/use-current-workspace'; import { useTransformWorkspace } from '../../../../hooks/use-transform-workspace'; -import { +import type { AffineOfficialWorkspace, LocalWorkspace, - RemWorkspaceFlavour, } from '../../../../shared'; +import { RemWorkspaceFlavour } from '../../../../shared'; import { apis } from '../../../../shared/apis'; import { TransformWorkspaceToAffineModal } from '../../../affine/transform-workspace-to-affine-modal'; diff --git a/apps/web/src/components/blocksuite/header/header.tsx b/apps/web/src/components/blocksuite/header/header.tsx index 6ca5e920d2..bd8c80c5a0 100644 --- a/apps/web/src/components/blocksuite/header/header.tsx +++ b/apps/web/src/components/blocksuite/header/header.tsx @@ -1,13 +1,8 @@ import { useTranslation } from '@affine/i18n'; import { CloseIcon } from '@blocksuite/icons'; -import React, { - forwardRef, - HTMLAttributes, - PropsWithChildren, - useEffect, - useMemo, - useState, -} from 'react'; +import type { HTMLAttributes, PropsWithChildren } from 'react'; +import type React from 'react'; +import { forwardRef, useEffect, useMemo, useState } from 'react'; import { useSidebarStatus } from '../../../hooks/affine/use-sidebar-status'; import { SidebarSwitch } from '../../affine/sidebar-switch'; diff --git a/apps/web/src/components/blocksuite/header/index.tsx b/apps/web/src/components/blocksuite/header/index.tsx index b4c8ac2e3e..e948223729 100644 --- a/apps/web/src/components/blocksuite/header/index.tsx +++ b/apps/web/src/components/blocksuite/header/index.tsx @@ -1,15 +1,17 @@ -import { PopperProps, QuickSearchTips } from '@affine/component'; +import type { PopperProps } from '@affine/component'; +import { QuickSearchTips } from '@affine/component'; import { getEnvironment } from '@affine/env'; import { ArrowDownSmallIcon } from '@blocksuite/icons'; import { assertExists } from '@blocksuite/store'; import { useAtomValue, useSetAtom } from 'jotai'; -import { forwardRef, HTMLAttributes, useCallback, useRef } from 'react'; +import type { HTMLAttributes } from 'react'; +import { forwardRef, useCallback, useRef } from 'react'; import { currentEditorAtom, openQuickSearchModalAtom } from '../../../atoms'; import { useOpenTips } from '../../../hooks/affine/use-is-first-load'; import { usePageMeta } from '../../../hooks/use-page-meta'; import { useElementResizeEffect } from '../../../hooks/use-workspaces'; -import { BlockSuiteWorkspace } from '../../../shared'; +import type { BlockSuiteWorkspace } from '../../../shared'; import { PageNotFoundError } from '../../affine/affine-error-eoundary'; import { QuickSearchButton } from '../../pure/quick-search-button'; import { EditorModeSwitch } from './editor-mode-switch'; diff --git a/apps/web/src/components/blocksuite/header/utils.tsx b/apps/web/src/components/blocksuite/header/utils.tsx index 026e16b976..5aecfe0ebd 100644 --- a/apps/web/src/components/blocksuite/header/utils.tsx +++ b/apps/web/src/components/blocksuite/header/utils.tsx @@ -1,6 +1,7 @@ import { getEnvironment } from '@affine/env'; import { Trans, useTranslation } from '@affine/i18n'; -import React, { useEffect, useState } from 'react'; +import type React from 'react'; +import { useEffect, useState } from 'react'; const minimumChromeVersion = 102; diff --git a/apps/web/src/components/page-detail-editor.tsx b/apps/web/src/components/page-detail-editor.tsx index d835ff2dd6..4d2fed085e 100644 --- a/apps/web/src/components/page-detail-editor.tsx +++ b/apps/web/src/components/page-detail-editor.tsx @@ -1,14 +1,16 @@ import type { EditorContainer } from '@blocksuite/editor'; -import { assertExists, Page } from '@blocksuite/store'; +import type { Page } from '@blocksuite/store'; +import { assertExists } from '@blocksuite/store'; import { useSetAtom } from 'jotai'; import dynamic from 'next/dynamic'; import Head from 'next/head'; -import React, { useCallback } from 'react'; +import type React from 'react'; +import { useCallback } from 'react'; import { currentEditorAtom } from '../atoms'; import { useBlockSuiteWorkspacePageTitle } from '../hooks/use-blocksuite-workspace-page-title'; import { usePageMeta } from '../hooks/use-page-meta'; -import { BlockSuiteWorkspace } from '../shared'; +import type { BlockSuiteWorkspace } from '../shared'; import { PageNotFoundError } from './affine/affine-error-eoundary'; import { BlockSuiteEditorHeader } from './blocksuite/header'; diff --git a/apps/web/src/components/provider-composer.tsx b/apps/web/src/components/provider-composer.tsx index 935b89f602..098b61f62f 100644 --- a/apps/web/src/components/provider-composer.tsx +++ b/apps/web/src/components/provider-composer.tsx @@ -1,4 +1,5 @@ -import { cloneElement, FC, PropsWithChildren, ReactNode } from 'react'; +import type { FC, PropsWithChildren, ReactNode } from 'react'; +import { cloneElement } from 'react'; export const ProviderComposer: FC< PropsWithChildren<{ diff --git a/apps/web/src/components/pure/create-workspace-modal/index.tsx b/apps/web/src/components/pure/create-workspace-modal/index.tsx index 949710d4f0..9908a1315c 100644 --- a/apps/web/src/components/pure/create-workspace-modal/index.tsx +++ b/apps/web/src/components/pure/create-workspace-modal/index.tsx @@ -3,8 +3,8 @@ import { Modal, ModalCloseButton, ModalWrapper } from '@affine/component'; import { Button } from '@affine/component'; import { Input } from '@affine/component'; import { useTranslation } from '@affine/i18n'; +import type { KeyboardEvent } from 'react'; import { useCallback, useRef, useState } from 'react'; -import { KeyboardEvent } from 'react'; interface ModalProps { open: boolean; diff --git a/apps/web/src/components/pure/file-upload/index.tsx b/apps/web/src/components/pure/file-upload/index.tsx index c8c4211e25..d502ef5f47 100644 --- a/apps/web/src/components/pure/file-upload/index.tsx +++ b/apps/web/src/components/pure/file-upload/index.tsx @@ -1,7 +1,9 @@ import { Button } from '@affine/component'; import { styled } from '@affine/component'; import { useTranslation } from '@affine/i18n'; -import React, { ChangeEvent, useRef } from 'react'; +import type { ChangeEvent } from 'react'; +import type React from 'react'; +import { useRef } from 'react'; export type UploadProps = React.PropsWithChildren<{ uploadType?: string; diff --git a/apps/web/src/components/pure/footer/index.tsx b/apps/web/src/components/pure/footer/index.tsx index 29c30b6668..7a96c9b3da 100644 --- a/apps/web/src/components/pure/footer/index.tsx +++ b/apps/web/src/components/pure/footer/index.tsx @@ -1,10 +1,11 @@ import { FlexWrapper } from '@affine/component'; import { IconButton } from '@affine/component'; import { Tooltip } from '@affine/component'; -import { AccessTokenMessage } from '@affine/datacenter'; +import type { AccessTokenMessage } from '@affine/datacenter'; import { useTranslation } from '@affine/i18n'; import { CloudWorkspaceIcon, SignOutIcon } from '@blocksuite/icons'; -import React, { CSSProperties } from 'react'; +import type { CSSProperties } from 'react'; +import type React from 'react'; import { stringToColour } from '../../../utils'; import { StyledFooter, StyledSignInButton, StyleUserInfo } from './styles'; diff --git a/apps/web/src/components/pure/message-center/index.tsx b/apps/web/src/components/pure/message-center/index.tsx index 53208643b0..56cd1da60d 100644 --- a/apps/web/src/components/pure/message-center/index.tsx +++ b/apps/web/src/components/pure/message-center/index.tsx @@ -1,7 +1,8 @@ import { toast } from '@affine/component'; -import { MessageCode } from '@affine/datacenter'; +import type { MessageCode } from '@affine/datacenter'; import { messages } from '@affine/datacenter'; -import React, { useEffect } from 'react'; +import type React from 'react'; +import { useEffect } from 'react'; declare global { interface DocumentEventMap { diff --git a/apps/web/src/components/pure/quick-search-button/index.tsx b/apps/web/src/components/pure/quick-search-button/index.tsx index 7e26cf42ae..372e7f0985 100644 --- a/apps/web/src/components/pure/quick-search-button/index.tsx +++ b/apps/web/src/components/pure/quick-search-button/index.tsx @@ -1,4 +1,5 @@ -import { IconButton, IconButtonProps } from '@affine/component'; +import type { IconButtonProps } from '@affine/component'; +import { IconButton } from '@affine/component'; import { styled } from '@affine/component'; import { ArrowDownSmallIcon } from '@blocksuite/icons'; diff --git a/apps/web/src/components/pure/quick-search-modal/Footer.tsx b/apps/web/src/components/pure/quick-search-modal/Footer.tsx index b9905995a4..a9f94c6414 100644 --- a/apps/web/src/components/pure/quick-search-modal/Footer.tsx +++ b/apps/web/src/components/pure/quick-search-modal/Footer.tsx @@ -3,12 +3,12 @@ import type { PageBlockModel } from '@blocksuite/blocks'; import { PlusIcon } from '@blocksuite/icons'; import { assertEquals, nanoid } from '@blocksuite/store'; import { Command } from 'cmdk'; -import { NextRouter } from 'next/router'; -import React from 'react'; +import type { NextRouter } from 'next/router'; +import type React from 'react'; import { useBlockSuiteWorkspaceHelper } from '../../../hooks/use-blocksuite-workspace-helper'; import { useRouterHelper } from '../../../hooks/use-router-helper'; -import { BlockSuiteWorkspace } from '../../../shared'; +import type { BlockSuiteWorkspace } from '../../../shared'; import { StyledModalFooterContent } from './style'; export type FooterProps = { diff --git a/apps/web/src/components/pure/quick-search-modal/PublishedResults.tsx b/apps/web/src/components/pure/quick-search-modal/PublishedResults.tsx index 2fb305d344..5537e41706 100644 --- a/apps/web/src/components/pure/quick-search-modal/PublishedResults.tsx +++ b/apps/web/src/components/pure/quick-search-modal/PublishedResults.tsx @@ -2,10 +2,11 @@ import { useTranslation } from '@affine/i18n'; import { EdgelessIcon, PageIcon } from '@blocksuite/icons'; import { Command } from 'cmdk'; import { useRouter } from 'next/router'; -import React, { useEffect, useMemo, useState } from 'react'; +import type React from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { usePageMeta } from '../../../hooks/use-page-meta'; -import { BlockSuiteWorkspace } from '../../../shared'; +import type { BlockSuiteWorkspace } from '../../../shared'; import { NoResultSVG } from './NoResultSVG'; import { StyledListItem, StyledNotFound } from './style'; diff --git a/apps/web/src/components/pure/quick-search-modal/Results.tsx b/apps/web/src/components/pure/quick-search-modal/Results.tsx index d2c6057c8f..53072314b8 100644 --- a/apps/web/src/components/pure/quick-search-modal/Results.tsx +++ b/apps/web/src/components/pure/quick-search-modal/Results.tsx @@ -3,14 +3,16 @@ import { useTranslation } from '@affine/i18n'; import { EdgelessIcon, PageIcon } from '@blocksuite/icons'; import { assertExists } from '@blocksuite/store'; import { Command } from 'cmdk'; -import { NextRouter } from 'next/router'; -import React, { Dispatch, SetStateAction, useEffect } from 'react'; +import type { NextRouter } from 'next/router'; +import type { Dispatch, SetStateAction } from 'react'; +import type React from 'react'; +import { useEffect } from 'react'; import { useRecentlyViewed } from '../../../hooks/affine/use-recent-views'; import { useBlockSuiteWorkspaceHelper } from '../../../hooks/use-blocksuite-workspace-helper'; import { usePageMeta } from '../../../hooks/use-page-meta'; import { useRouterHelper } from '../../../hooks/use-router-helper'; -import { BlockSuiteWorkspace } from '../../../shared'; +import type { BlockSuiteWorkspace } from '../../../shared'; import { useSwitchToConfig } from './config'; import { NoResultSVG } from './NoResultSVG'; import { StyledListItem, StyledNotFound } from './style'; diff --git a/apps/web/src/components/pure/quick-search-modal/config.ts b/apps/web/src/components/pure/quick-search-modal/config.ts index e7aafee937..cc2b8955b7 100644 --- a/apps/web/src/components/pure/quick-search-modal/config.ts +++ b/apps/web/src/components/pure/quick-search-modal/config.ts @@ -5,7 +5,8 @@ import { FolderIcon, SettingsIcon, } from '@blocksuite/icons'; -import { FC, SVGProps, useMemo } from 'react'; +import type { FC, SVGProps } from 'react'; +import { useMemo } from 'react'; import { pathGenerator } from '../../../shared'; export const useSwitchToConfig = ( diff --git a/apps/web/src/components/pure/quick-search-modal/index.tsx b/apps/web/src/components/pure/quick-search-modal/index.tsx index befc678918..1ace2027ea 100644 --- a/apps/web/src/components/pure/quick-search-modal/index.tsx +++ b/apps/web/src/components/pure/quick-search-modal/index.tsx @@ -2,8 +2,9 @@ import { Modal, ModalWrapper } from '@affine/component'; import { getEnvironment } from '@affine/env'; import { useTranslation } from '@affine/i18n'; import { Command } from 'cmdk'; -import { NextRouter } from 'next/router'; -import React, { +import type { NextRouter } from 'next/router'; +import type React from 'react'; +import { useCallback, useEffect, useMemo, @@ -12,7 +13,7 @@ import React, { useTransition, } from 'react'; -import { BlockSuiteWorkspace } from '../../../shared'; +import type { BlockSuiteWorkspace } from '../../../shared'; import { Footer } from './Footer'; import { PublishedResults } from './PublishedResults'; import { Results } from './Results'; diff --git a/apps/web/src/components/pure/workspace-avatar/index.tsx b/apps/web/src/components/pure/workspace-avatar/index.tsx index c2ef888598..af1559cccd 100644 --- a/apps/web/src/components/pure/workspace-avatar/index.tsx +++ b/apps/web/src/components/pure/workspace-avatar/index.tsx @@ -2,7 +2,7 @@ import { UNTITLED_WORKSPACE_NAME } from '@affine/env'; import React from 'react'; import { useBlockSuiteWorkspaceAvatarUrl } from '../../../hooks/use-blocksuite-workspace-avatar-url'; -import { BlockSuiteWorkspace, RemWorkspace } from '../../../shared'; +import type { BlockSuiteWorkspace, RemWorkspace } from '../../../shared'; import { stringToColour } from '../../../utils'; interface AvatarProps { diff --git a/apps/web/src/components/pure/workspace-card/index.tsx b/apps/web/src/components/pure/workspace-card/index.tsx index f08c3d8381..15b295de51 100644 --- a/apps/web/src/components/pure/workspace-card/index.tsx +++ b/apps/web/src/components/pure/workspace-card/index.tsx @@ -1,10 +1,12 @@ import { PermissionType } from '@affine/datacenter'; import { useTranslation } from '@affine/i18n'; import { SettingsIcon } from '@blocksuite/icons'; -import React, { useCallback } from 'react'; +import type React from 'react'; +import { useCallback } from 'react'; import { useBlockSuiteWorkspaceName } from '../../../hooks/use-blocksuite-workspace-name'; -import { RemWorkspace, RemWorkspaceFlavour } from '../../../shared'; +import type { RemWorkspace } from '../../../shared'; +import { RemWorkspaceFlavour } from '../../../shared'; import { CloudWorkspaceIcon, JoinedWorkspaceIcon, diff --git a/apps/web/src/components/pure/workspace-list-modal/index.tsx b/apps/web/src/components/pure/workspace-list-modal/index.tsx index b0d508950f..449d06a47d 100644 --- a/apps/web/src/components/pure/workspace-list-modal/index.tsx +++ b/apps/web/src/components/pure/workspace-list-modal/index.tsx @@ -4,11 +4,11 @@ import { ModalWrapper, Tooltip, } from '@affine/component'; -import { AccessTokenMessage } from '@affine/datacenter'; +import type { AccessTokenMessage } from '@affine/datacenter'; import { useTranslation } from '@affine/i18n'; import { HelpIcon, PlusIcon } from '@blocksuite/icons'; -import { RemWorkspace } from '../../../shared'; +import type { RemWorkspace } from '../../../shared'; import { Footer } from '../footer'; import { WorkspaceCard } from '../workspace-card'; import { LanguageMenu } from './language-menu'; diff --git a/apps/web/src/components/pure/workspace-list-modal/language-menu.tsx b/apps/web/src/components/pure/workspace-list-modal/language-menu.tsx index 2fc5621af4..1736cb52fa 100644 --- a/apps/web/src/components/pure/workspace-list-modal/language-menu.tsx +++ b/apps/web/src/components/pure/workspace-list-modal/language-menu.tsx @@ -2,7 +2,8 @@ import { Button, Menu, MenuItem, styled } from '@affine/component'; import { LOCALES } from '@affine/i18n'; import { useTranslation } from '@affine/i18n'; import { ArrowDownSmallIcon } from '@blocksuite/icons'; -import React, { useCallback } from 'react'; +import type React from 'react'; +import { useCallback } from 'react'; const LanguageMenuContent: React.FC = () => { const { i18n } = useTranslation(); diff --git a/apps/web/src/components/pure/workspace-slider-bar/WorkspaceSelector/WorkspaceSelector.tsx b/apps/web/src/components/pure/workspace-slider-bar/WorkspaceSelector/WorkspaceSelector.tsx index f0f99f4c09..6c357afe4d 100644 --- a/apps/web/src/components/pure/workspace-slider-bar/WorkspaceSelector/WorkspaceSelector.tsx +++ b/apps/web/src/components/pure/workspace-slider-bar/WorkspaceSelector/WorkspaceSelector.tsx @@ -1,7 +1,7 @@ -import React from 'react'; +import type React from 'react'; import { useBlockSuiteWorkspaceName } from '../../../../hooks/use-blocksuite-workspace-name'; -import { RemWorkspace } from '../../../../shared'; +import type { RemWorkspace } from '../../../../shared'; import { WorkspaceAvatar } from '../../workspace-avatar'; import { SelectorWrapper, WorkspaceName } from './styles'; diff --git a/apps/web/src/components/pure/workspace-slider-bar/index.tsx b/apps/web/src/components/pure/workspace-slider-bar/index.tsx index 7820ea30cf..2085dec7df 100644 --- a/apps/web/src/components/pure/workspace-slider-bar/index.tsx +++ b/apps/web/src/components/pure/workspace-slider-bar/index.tsx @@ -10,14 +10,15 @@ import { SearchIcon, SettingsIcon, } from '@blocksuite/icons'; -import { PageMeta } from '@blocksuite/store'; +import type { PageMeta } from '@blocksuite/store'; import Link from 'next/link'; import { useRouter } from 'next/router'; -import React, { useCallback, useMemo, useState } from 'react'; +import type React from 'react'; +import { useCallback, useMemo, useState } from 'react'; import { useSidebarStatus } from '../../../hooks/affine/use-sidebar-status'; import { usePageMeta } from '../../../hooks/use-page-meta'; -import { RemWorkspace } from '../../../shared'; +import type { RemWorkspace } from '../../../shared'; import { SidebarSwitch } from '../../affine/sidebar-switch'; import { StyledLink, diff --git a/apps/web/src/components/pure/workspace-title/index.tsx b/apps/web/src/components/pure/workspace-title/index.tsx index dbd17a0986..619214eefb 100644 --- a/apps/web/src/components/pure/workspace-title/index.tsx +++ b/apps/web/src/components/pure/workspace-title/index.tsx @@ -1,5 +1,6 @@ import { useSetAtom } from 'jotai'; -import React, { ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import type React from 'react'; import { openQuickSearchModalAtom } from '../../../atoms'; import Header from '../../blocksuite/header/header'; diff --git a/apps/web/src/hooks/__tests__/index.spec.tsx b/apps/web/src/hooks/__tests__/index.spec.tsx index 251ae532d2..3f30b11c6a 100644 --- a/apps/web/src/hooks/__tests__/index.spec.tsx +++ b/apps/web/src/hooks/__tests__/index.spec.tsx @@ -12,7 +12,7 @@ import { createStore, Provider } from 'jotai'; import { useRouter } from 'next/router'; import routerMock from 'next-router-mock'; import { createDynamicRouteParser } from 'next-router-mock/dynamic-routes'; -import React from 'react'; +import type React from 'react'; import { beforeAll, beforeEach, describe, expect, test, vi } from 'vitest'; import { @@ -21,11 +21,8 @@ import { workspacesAtom, } from '../../atoms'; import { LocalPlugin } from '../../plugins/local'; -import { - BlockSuiteWorkspace, - LocalWorkspace, - RemWorkspaceFlavour, -} from '../../shared'; +import type { LocalWorkspace } from '../../shared'; +import { BlockSuiteWorkspace, RemWorkspaceFlavour } from '../../shared'; import { useIsFirstLoad, useOpenTips } from '../affine/use-is-first-load'; import { useRecentlyViewed, diff --git a/apps/web/src/hooks/__tests__/use-blocksuite-workspace-helper.spec.ts b/apps/web/src/hooks/__tests__/use-blocksuite-workspace-helper.spec.ts index 24ba469fbf..d55ac6dc1f 100644 --- a/apps/web/src/hooks/__tests__/use-blocksuite-workspace-helper.spec.ts +++ b/apps/web/src/hooks/__tests__/use-blocksuite-workspace-helper.spec.ts @@ -4,7 +4,7 @@ import 'fake-indexeddb/auto'; import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models'; -import { Page } from '@blocksuite/store'; +import type { Page } from '@blocksuite/store'; import { renderHook } from '@testing-library/react'; import { beforeEach, describe, expect, test, vi } from 'vitest'; diff --git a/apps/web/src/hooks/affine/use-is-workspace-owner.ts b/apps/web/src/hooks/affine/use-is-workspace-owner.ts index 908704c418..0a78200483 100644 --- a/apps/web/src/hooks/affine/use-is-workspace-owner.ts +++ b/apps/web/src/hooks/affine/use-is-workspace-owner.ts @@ -1,6 +1,6 @@ import { PermissionType } from '@affine/datacenter'; -import { AffineOfficialWorkspace } from '../../shared'; +import type { AffineOfficialWorkspace } from '../../shared'; export function useIsWorkspaceOwner(workspace: AffineOfficialWorkspace) { if (workspace.flavour === 'local') return true; diff --git a/apps/web/src/hooks/affine/use-members.ts b/apps/web/src/hooks/affine/use-members.ts index 1c4b5f837a..37e576adb9 100644 --- a/apps/web/src/hooks/affine/use-members.ts +++ b/apps/web/src/hooks/affine/use-members.ts @@ -1,4 +1,4 @@ -import { Member } from '@affine/datacenter'; +import type { Member } from '@affine/datacenter'; import { useCallback } from 'react'; import useSWR from 'swr'; diff --git a/apps/web/src/hooks/affine/use-recent-views.ts b/apps/web/src/hooks/affine/use-recent-views.ts index 39054d2a1f..356d67a4ea 100644 --- a/apps/web/src/hooks/affine/use-recent-views.ts +++ b/apps/web/src/hooks/affine/use-recent-views.ts @@ -1,5 +1,5 @@ import { useAtomValue, useSetAtom } from 'jotai'; -import { NextRouter } from 'next/router'; +import type { NextRouter } from 'next/router'; import { useEffect } from 'react'; import { diff --git a/apps/web/src/hooks/affine/use-toggle-workspace-publish.ts b/apps/web/src/hooks/affine/use-toggle-workspace-publish.ts index b297725de6..270ed4969d 100644 --- a/apps/web/src/hooks/affine/use-toggle-workspace-publish.ts +++ b/apps/web/src/hooks/affine/use-toggle-workspace-publish.ts @@ -3,7 +3,7 @@ import useSWR from 'swr'; import { jotaiStore, jotaiWorkspacesAtom } from '../../atoms'; import { QueryKey } from '../../plugins/affine/fetcher'; -import { AffineWorkspace } from '../../shared'; +import type { AffineWorkspace } from '../../shared'; import { apis } from '../../shared/apis'; export function useToggleWorkspacePublish(workspace: AffineWorkspace) { diff --git a/apps/web/src/hooks/current/use-current-page-id.ts b/apps/web/src/hooks/current/use-current-page-id.ts index 540dea5637..8c98c2de79 100644 --- a/apps/web/src/hooks/current/use-current-page-id.ts +++ b/apps/web/src/hooks/current/use-current-page-id.ts @@ -1,4 +1,4 @@ -import { Page } from '@blocksuite/store'; +import type { Page } from '@blocksuite/store'; import { atom, useAtom, useAtomValue } from 'jotai'; import { currentPageIdAtom } from '../../atoms'; diff --git a/apps/web/src/hooks/current/use-current-user.ts b/apps/web/src/hooks/current/use-current-user.ts index d299674f94..7204d2cec6 100644 --- a/apps/web/src/hooks/current/use-current-user.ts +++ b/apps/web/src/hooks/current/use-current-user.ts @@ -1,4 +1,4 @@ -import { AccessTokenMessage } from '@affine/datacenter'; +import type { AccessTokenMessage } from '@affine/datacenter'; import useSWR from 'swr'; import { QueryKey } from '../../plugins/affine/fetcher'; diff --git a/apps/web/src/hooks/current/use-current-workspace.ts b/apps/web/src/hooks/current/use-current-workspace.ts index d9f3092df0..f59d5ac7c3 100644 --- a/apps/web/src/hooks/current/use-current-workspace.ts +++ b/apps/web/src/hooks/current/use-current-workspace.ts @@ -7,7 +7,7 @@ import { currentWorkspaceIdAtom, workspacesAtom, } from '../../atoms'; -import { RemWorkspace } from '../../shared'; +import type { RemWorkspace } from '../../shared'; export const currentWorkspaceAtom = atom>( async get => { diff --git a/apps/web/src/hooks/use-blocksuite-workspace-avatar-url.ts b/apps/web/src/hooks/use-blocksuite-workspace-avatar-url.ts index 8945384e78..4216539d26 100644 --- a/apps/web/src/hooks/use-blocksuite-workspace-avatar-url.ts +++ b/apps/web/src/hooks/use-blocksuite-workspace-avatar-url.ts @@ -3,7 +3,7 @@ import { useCallback } from 'react'; import useSWR from 'swr'; import { QueryKey } from '../plugins/affine/fetcher'; -import { BlockSuiteWorkspace } from '../shared'; +import type { BlockSuiteWorkspace } from '../shared'; export function useBlockSuiteWorkspaceAvatarUrl( // todo: remove `null` from type diff --git a/apps/web/src/hooks/use-blocksuite-workspace-helper.ts b/apps/web/src/hooks/use-blocksuite-workspace-helper.ts index c0de60fe22..ff671b18ac 100644 --- a/apps/web/src/hooks/use-blocksuite-workspace-helper.ts +++ b/apps/web/src/hooks/use-blocksuite-workspace-helper.ts @@ -1,7 +1,7 @@ import { assertExists } from '@blocksuite/store'; import { useMemo } from 'react'; -import { BlockSuiteWorkspace } from '../shared'; +import type { BlockSuiteWorkspace } from '../shared'; export function useBlockSuiteWorkspaceHelper( blockSuiteWorkspace: BlockSuiteWorkspace | null diff --git a/apps/web/src/hooks/use-blocksuite-workspace-name.ts b/apps/web/src/hooks/use-blocksuite-workspace-name.ts index c375d42313..76c81969fd 100644 --- a/apps/web/src/hooks/use-blocksuite-workspace-name.ts +++ b/apps/web/src/hooks/use-blocksuite-workspace-name.ts @@ -2,7 +2,7 @@ import { UNTITLED_WORKSPACE_NAME } from '@affine/env'; import { assertExists } from '@blocksuite/store'; import { useCallback, useEffect, useState } from 'react'; -import { BlockSuiteWorkspace } from '../shared'; +import type { BlockSuiteWorkspace } from '../shared'; export function useBlockSuiteWorkspaceName( blockSuiteWorkspace: BlockSuiteWorkspace | null diff --git a/apps/web/src/hooks/use-blocksuite-workspace-page-title.ts b/apps/web/src/hooks/use-blocksuite-workspace-page-title.ts index 239a05a38b..a642a0750b 100644 --- a/apps/web/src/hooks/use-blocksuite-workspace-page-title.ts +++ b/apps/web/src/hooks/use-blocksuite-workspace-page-title.ts @@ -1,7 +1,7 @@ import { assertExists } from '@blocksuite/store'; import { useEffect, useState } from 'react'; -import { BlockSuiteWorkspace } from '../shared'; +import type { BlockSuiteWorkspace } from '../shared'; export function useBlockSuiteWorkspacePageTitle( blockSuiteWorkspace: BlockSuiteWorkspace, diff --git a/apps/web/src/hooks/use-page-meta.ts b/apps/web/src/hooks/use-page-meta.ts index 0156655f15..93d6b115f5 100644 --- a/apps/web/src/hooks/use-page-meta.ts +++ b/apps/web/src/hooks/use-page-meta.ts @@ -1,7 +1,7 @@ -import { PageMeta } from '@blocksuite/store'; +import type { PageMeta } from '@blocksuite/store'; import { useEffect, useMemo, useState } from 'react'; -import { BlockSuiteWorkspace } from '../shared'; +import type { BlockSuiteWorkspace } from '../shared'; declare module '@blocksuite/store' { interface PageMeta { diff --git a/apps/web/src/hooks/use-router-helper.ts b/apps/web/src/hooks/use-router-helper.ts index 405ba20d0d..eda05b2cdd 100644 --- a/apps/web/src/hooks/use-router-helper.ts +++ b/apps/web/src/hooks/use-router-helper.ts @@ -1,7 +1,7 @@ -import { NextRouter } from 'next/router'; +import type { NextRouter } from 'next/router'; import { useMemo } from 'react'; -import { WorkspaceSubPath } from '../shared'; +import type { WorkspaceSubPath } from '../shared'; export const enum RouteLogic { REPLACE = 'replace', diff --git a/apps/web/src/hooks/use-router-title.ts b/apps/web/src/hooks/use-router-title.ts index 66befd9543..141951ff0f 100644 --- a/apps/web/src/hooks/use-router-title.ts +++ b/apps/web/src/hooks/use-router-title.ts @@ -1,4 +1,4 @@ -import { NextRouter } from 'next/router'; +import type { NextRouter } from 'next/router'; import { useMemo } from 'react'; import { WorkspaceSubPathName } from '../shared'; diff --git a/apps/web/src/hooks/use-sync-router-with-current-workspace-and-page.ts b/apps/web/src/hooks/use-sync-router-with-current-workspace-and-page.ts index 24017d2b61..cfed36f66c 100644 --- a/apps/web/src/hooks/use-sync-router-with-current-workspace-and-page.ts +++ b/apps/web/src/hooks/use-sync-router-with-current-workspace-and-page.ts @@ -1,8 +1,9 @@ -import { NextRouter } from 'next/router'; +import type { NextRouter } from 'next/router'; import { useEffect } from 'react'; import { currentPageIdAtom, jotaiStore } from '../atoms'; -import { RemWorkspace, RemWorkspaceFlavour } from '../shared'; +import type { RemWorkspace } from '../shared'; +import { RemWorkspaceFlavour } from '../shared'; import { useCurrentPageId } from './current/use-current-page-id'; import { useCurrentWorkspace } from './current/use-current-workspace'; import { useWorkspaces } from './use-workspaces'; diff --git a/apps/web/src/hooks/use-sync-router-with-current-workspace.ts b/apps/web/src/hooks/use-sync-router-with-current-workspace.ts index b66c2af226..c1751aad96 100644 --- a/apps/web/src/hooks/use-sync-router-with-current-workspace.ts +++ b/apps/web/src/hooks/use-sync-router-with-current-workspace.ts @@ -1,4 +1,4 @@ -import { NextRouter } from 'next/router'; +import type { NextRouter } from 'next/router'; import { useEffect } from 'react'; import { useCurrentWorkspace } from './current/use-current-workspace'; diff --git a/apps/web/src/hooks/use-transform-workspace.ts b/apps/web/src/hooks/use-transform-workspace.ts index c9178dfd16..37574e40e7 100644 --- a/apps/web/src/hooks/use-transform-workspace.ts +++ b/apps/web/src/hooks/use-transform-workspace.ts @@ -3,7 +3,7 @@ import { useCallback } from 'react'; import { jotaiWorkspacesAtom } from '../atoms'; import { WorkspacePlugins } from '../plugins'; -import { FlavourToWorkspace, RemWorkspaceFlavour } from '../shared'; +import type { FlavourToWorkspace, RemWorkspaceFlavour } from '../shared'; /** * Transform workspace from one flavour to another diff --git a/apps/web/src/hooks/use-workspace-blob.ts b/apps/web/src/hooks/use-workspace-blob.ts index f6f59b5a63..befc7835e6 100644 --- a/apps/web/src/hooks/use-workspace-blob.ts +++ b/apps/web/src/hooks/use-workspace-blob.ts @@ -1,7 +1,7 @@ -import { BlobStorage } from '@blocksuite/store'; +import type { BlobStorage } from '@blocksuite/store'; import { useEffect, useState } from 'react'; -import { BlockSuiteWorkspace } from '../shared'; +import type { BlockSuiteWorkspace } from '../shared'; export function useWorkspaceBlob( blockSuiteWorkspace: BlockSuiteWorkspace diff --git a/apps/web/src/hooks/use-workspaces.ts b/apps/web/src/hooks/use-workspaces.ts index 46d6aa9955..455d8be2d1 100644 --- a/apps/web/src/hooks/use-workspaces.ts +++ b/apps/web/src/hooks/use-workspaces.ts @@ -5,7 +5,8 @@ import { useCallback, useEffect } from 'react'; import { jotaiWorkspacesAtom, workspacesAtom } from '../atoms'; import { WorkspacePlugins } from '../plugins'; import { LocalPlugin } from '../plugins/local'; -import { LocalWorkspace, RemWorkspace, RemWorkspaceFlavour } from '../shared'; +import type { LocalWorkspace, RemWorkspace } from '../shared'; +import { RemWorkspaceFlavour } from '../shared'; import { createEmptyBlockSuiteWorkspace } from '../utils'; export function useWorkspaces(): RemWorkspace[] { diff --git a/apps/web/src/layouts/index.tsx b/apps/web/src/layouts/index.tsx index fdf65b900a..48d4ddd155 100644 --- a/apps/web/src/layouts/index.tsx +++ b/apps/web/src/layouts/index.tsx @@ -6,7 +6,8 @@ import { useAtom, useAtomValue, useSetAtom } from 'jotai'; import dynamic from 'next/dynamic'; import Head from 'next/head'; import { useRouter } from 'next/router'; -import React, { Suspense, useCallback, useEffect } from 'react'; +import type React from 'react'; +import { Suspense, useCallback, useEffect } from 'react'; import { currentWorkspaceIdAtom, diff --git a/apps/web/src/pages/_app.tsx b/apps/web/src/pages/_app.tsx index fe684e7469..68a54f9740 100644 --- a/apps/web/src/pages/_app.tsx +++ b/apps/web/src/pages/_app.tsx @@ -2,14 +2,15 @@ import '../styles/globals.css'; import { config, setupGlobal } from '@affine/env'; import { createI18n, I18nextProvider } from '@affine/i18n'; -import { EmotionCache } from '@emotion/cache'; +import type { EmotionCache } from '@emotion/cache'; import { CacheProvider } from '@emotion/react'; import { Provider } from 'jotai'; import { useAtomsDebugValue } from 'jotai-devtools'; -import { AppProps } from 'next/app'; +import type { AppProps } from 'next/app'; import Head from 'next/head'; import { useRouter } from 'next/router'; -import React, { memo, ReactElement, Suspense, useEffect, useMemo } from 'react'; +import type { ReactElement } from 'react'; +import React, { memo, Suspense, useEffect, useMemo } from 'react'; import { jotaiStore } from '../atoms'; import { AffineErrorBoundary } from '../components/affine/affine-error-eoundary'; @@ -18,7 +19,7 @@ import { PageLoading } from '../components/pure/loading'; import { MessageCenter } from '../components/pure/message-center'; import { AffineSWRConfigProvider } from '../providers/AffineSWRConfigProvider'; import { ThemeProvider } from '../providers/ThemeProvider'; -import { NextPageWithLayout } from '../shared'; +import type { NextPageWithLayout } from '../shared'; import createEmotionCache from '../utils/create-emotion-cache'; setupGlobal(); diff --git a/apps/web/src/pages/_debug/broadcast.dev.tsx b/apps/web/src/pages/_debug/broadcast.dev.tsx index d3e1e3cf22..d560863612 100644 --- a/apps/web/src/pages/_debug/broadcast.dev.tsx +++ b/apps/web/src/pages/_debug/broadcast.dev.tsx @@ -2,12 +2,13 @@ import { Button, toast } from '@affine/component'; import { DebugLogger } from '@affine/debug'; import { nanoid } from '@blocksuite/store'; import { Typography } from '@mui/material'; -import React, { useEffect, useMemo, useState } from 'react'; +import type React from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { createBroadCastChannelProvider } from '../../blocksuite/providers'; import PageList from '../../components/blocksuite/block-suite-page-list/page-list'; import { StyledPage, StyledWrapper } from '../../layouts/styles'; -import { BroadCastChannelProvider } from '../../shared'; +import type { BroadCastChannelProvider } from '../../shared'; import { createEmptyBlockSuiteWorkspace } from '../../utils'; const logger = new DebugLogger('broadcast'); diff --git a/apps/web/src/pages/_debug/init-page.dev.tsx b/apps/web/src/pages/_debug/init-page.dev.tsx index 5f6602b45e..2321c5baed 100644 --- a/apps/web/src/pages/_debug/init-page.dev.tsx +++ b/apps/web/src/pages/_debug/init-page.dev.tsx @@ -3,7 +3,7 @@ import dynamic from 'next/dynamic'; import { useRouter } from 'next/router'; import { StyledPage, StyledWrapper } from '../../layouts/styles'; -import { NextPageWithLayout } from '../../shared'; +import type { NextPageWithLayout } from '../../shared'; import { initPage } from '../../utils/blocksuite'; const Editor = dynamic( diff --git a/apps/web/src/pages/_document.tsx b/apps/web/src/pages/_document.tsx index 91ee6f5613..f8f8d45191 100644 --- a/apps/web/src/pages/_document.tsx +++ b/apps/web/src/pages/_document.tsx @@ -1,12 +1,7 @@ import type { EmotionJSX } from '@emotion/react/types/jsx-namespace'; import createEmotionServer from '@emotion/server/create-instance'; -import Document, { - DocumentContext, - Head, - Html, - Main, - NextScript, -} from 'next/document'; +import type { DocumentContext } from 'next/document'; +import Document, { Head, Html, Main, NextScript } from 'next/document'; import * as React from 'react'; import createEmotionCache from '../utils/create-emotion-cache'; diff --git a/apps/web/src/pages/index.tsx b/apps/web/src/pages/index.tsx index bcda1fb9f4..a6d578eb8d 100644 --- a/apps/web/src/pages/index.tsx +++ b/apps/web/src/pages/index.tsx @@ -1,4 +1,4 @@ -import { NextPage } from 'next'; +import type { NextPage } from 'next'; import { useRouter } from 'next/router'; import React, { Suspense, useEffect } from 'react'; diff --git a/apps/web/src/pages/invite/[invite_code].tsx b/apps/web/src/pages/invite/[invite_code].tsx index 6b3ef3fe5b..2a35c36726 100644 --- a/apps/web/src/pages/invite/[invite_code].tsx +++ b/apps/web/src/pages/invite/[invite_code].tsx @@ -1,6 +1,6 @@ import { displayFlex, styled } from '@affine/component'; import { Button } from '@affine/component'; -import { Permission } from '@affine/datacenter'; +import type { Permission } from '@affine/datacenter'; import { SucessfulDuotoneIcon, UnsucessfulDuotoneIcon, @@ -16,7 +16,8 @@ import inviteSuccess from '../../../public/imgs/invite-success.svg'; import { PageLoading } from '../../components/pure/loading'; import { RouteLogic, useRouterHelper } from '../../hooks/use-router-helper'; import { QueryKey } from '../../plugins/affine/fetcher'; -import { NextPageWithLayout, WorkspaceSubPath } from '../../shared'; +import type { NextPageWithLayout } from '../../shared'; +import { WorkspaceSubPath } from '../../shared'; const InvitePage: NextPageWithLayout = () => { const router = useRouter(); diff --git a/apps/web/src/pages/preview/[previewId].tsx b/apps/web/src/pages/preview/[previewId].tsx index 47ec55d111..d27209c280 100644 --- a/apps/web/src/pages/preview/[previewId].tsx +++ b/apps/web/src/pages/preview/[previewId].tsx @@ -1,4 +1,4 @@ -import { +import type { GetStaticPaths, GetStaticProps, InferGetStaticPropsType, @@ -14,7 +14,7 @@ import { StyledToolWrapper, StyledWrapper, } from '../../layouts/styles'; -import { BlockSuiteWorkspace } from '../../shared'; +import type { BlockSuiteWorkspace } from '../../shared'; import { createEmptyBlockSuiteWorkspace } from '../../utils'; export type PreviewPageProps = { diff --git a/apps/web/src/pages/public-workspace/[workspaceId].tsx b/apps/web/src/pages/public-workspace/[workspaceId].tsx index 567f7196ec..3bbd7069c4 100644 --- a/apps/web/src/pages/public-workspace/[workspaceId].tsx +++ b/apps/web/src/pages/public-workspace/[workspaceId].tsx @@ -4,7 +4,8 @@ import { Box } from '@mui/material'; import { useAtomValue, useSetAtom } from 'jotai'; import dynamic from 'next/dynamic'; import { useRouter } from 'next/router'; -import React, { Suspense, useCallback, useEffect } from 'react'; +import type React from 'react'; +import { Suspense, useCallback, useEffect } from 'react'; import { currentWorkspaceIdAtom, openQuickSearchModalAtom } from '../../atoms'; import { @@ -18,7 +19,7 @@ import { PageLoading } from '../../components/pure/loading'; import { useBlockSuiteWorkspaceAvatarUrl } from '../../hooks/use-blocksuite-workspace-avatar-url'; import { useBlockSuiteWorkspaceName } from '../../hooks/use-blocksuite-workspace-name'; import { WorkspaceLayout } from '../../layouts'; -import { NextPageWithLayout } from '../../shared'; +import type { NextPageWithLayout } from '../../shared'; import { NavContainer, StyledBreadcrumbs } from './[workspaceId]/[pageId]'; const BlockSuitePublicPageList = dynamic( diff --git a/apps/web/src/pages/public-workspace/[workspaceId]/[pageId].tsx b/apps/web/src/pages/public-workspace/[workspaceId]/[pageId].tsx index 41e9f5ee12..9db8823726 100644 --- a/apps/web/src/pages/public-workspace/[workspaceId]/[pageId].tsx +++ b/apps/web/src/pages/public-workspace/[workspaceId]/[pageId].tsx @@ -9,7 +9,8 @@ import { PageIcon } from '@blocksuite/icons'; import { useAtomValue, useSetAtom } from 'jotai'; import Link from 'next/link'; import { useRouter } from 'next/router'; -import React, { Suspense, useEffect } from 'react'; +import type React from 'react'; +import { Suspense, useEffect } from 'react'; import { publicBlockSuiteAtom, @@ -22,7 +23,7 @@ import { PageLoading } from '../../../components/pure/loading'; import { useBlockSuiteWorkspaceAvatarUrl } from '../../../hooks/use-blocksuite-workspace-avatar-url'; import { useBlockSuiteWorkspaceName } from '../../../hooks/use-blocksuite-workspace-name'; import { WorkspaceLayout } from '../../../layouts'; -import { NextPageWithLayout } from '../../../shared'; +import type { NextPageWithLayout } from '../../../shared'; import { initPage } from '../../../utils/blocksuite'; export const NavContainer = styled('div')(({ theme }) => { diff --git a/apps/web/src/pages/workspace/[workspaceId]/[pageId].tsx b/apps/web/src/pages/workspace/[workspaceId]/[pageId].tsx index b1566fc300..43c0f75a54 100644 --- a/apps/web/src/pages/workspace/[workspaceId]/[pageId].tsx +++ b/apps/web/src/pages/workspace/[workspaceId]/[pageId].tsx @@ -1,5 +1,6 @@ import { useRouter } from 'next/router'; -import React, { useEffect } from 'react'; +import type React from 'react'; +import { useEffect } from 'react'; import { Unreachable } from '../../../components/affine/affine-error-eoundary'; import { PageLoading } from '../../../components/pure/loading'; @@ -9,11 +10,8 @@ import { useCurrentWorkspace } from '../../../hooks/current/use-current-workspac import { useSyncRouterWithCurrentWorkspaceAndPage } from '../../../hooks/use-sync-router-with-current-workspace-and-page'; import { WorkspaceLayout } from '../../../layouts'; import { WorkspacePlugins } from '../../../plugins'; -import { - BlockSuiteWorkspace, - NextPageWithLayout, - RemWorkspaceFlavour, -} from '../../../shared'; +import type { BlockSuiteWorkspace, NextPageWithLayout } from '../../../shared'; +import { RemWorkspaceFlavour } from '../../../shared'; function enableFullFlags(blockSuiteWorkspace: BlockSuiteWorkspace) { blockSuiteWorkspace.awarenessStore.setFlag('enable_set_remote_flag', false); diff --git a/apps/web/src/pages/workspace/[workspaceId]/all.tsx b/apps/web/src/pages/workspace/[workspaceId]/all.tsx index e6d0b71684..b48b9c44ce 100644 --- a/apps/web/src/pages/workspace/[workspaceId]/all.tsx +++ b/apps/web/src/pages/workspace/[workspaceId]/all.tsx @@ -16,11 +16,11 @@ import { useRouterHelper } from '../../../hooks/use-router-helper'; import { useSyncRouterWithCurrentWorkspace } from '../../../hooks/use-sync-router-with-current-workspace'; import { WorkspaceLayout } from '../../../layouts'; import { WorkspacePlugins } from '../../../plugins'; -import { +import type { LocalIndexedDBProvider, NextPageWithLayout, - RemWorkspaceFlavour, } from '../../../shared'; +import { RemWorkspaceFlavour } from '../../../shared'; const AllPage: NextPageWithLayout = () => { const router = useRouter(); diff --git a/apps/web/src/pages/workspace/[workspaceId]/favorite.tsx b/apps/web/src/pages/workspace/[workspaceId]/favorite.tsx index 07f42e7dfb..780ae87de7 100644 --- a/apps/web/src/pages/workspace/[workspaceId]/favorite.tsx +++ b/apps/web/src/pages/workspace/[workspaceId]/favorite.tsx @@ -12,7 +12,7 @@ import { useCurrentWorkspace } from '../../../hooks/current/use-current-workspac import { useRouterHelper } from '../../../hooks/use-router-helper'; import { useSyncRouterWithCurrentWorkspace } from '../../../hooks/use-sync-router-with-current-workspace'; import { WorkspaceLayout } from '../../../layouts'; -import { NextPageWithLayout } from '../../../shared'; +import type { NextPageWithLayout } from '../../../shared'; const FavouritePage: NextPageWithLayout = () => { const router = useRouter(); diff --git a/apps/web/src/pages/workspace/[workspaceId]/setting.tsx b/apps/web/src/pages/workspace/[workspaceId]/setting.tsx index cc21ee8299..159df1009b 100644 --- a/apps/web/src/pages/workspace/[workspaceId]/setting.tsx +++ b/apps/web/src/pages/workspace/[workspaceId]/setting.tsx @@ -16,11 +16,13 @@ import { useTransformWorkspace } from '../../../hooks/use-transform-workspace'; import { useWorkspacesHelper } from '../../../hooks/use-workspaces'; import { WorkspaceLayout } from '../../../layouts'; import { WorkspacePlugins } from '../../../plugins'; -import { +import type { FlavourToWorkspace, NextPageWithLayout, - RemWorkspaceFlavour, SettingPanel, +} from '../../../shared'; +import { + RemWorkspaceFlavour, settingPanel, settingPanelValues, } from '../../../shared'; diff --git a/apps/web/src/pages/workspace/[workspaceId]/trash.tsx b/apps/web/src/pages/workspace/[workspaceId]/trash.tsx index 570ef52673..8b32c32085 100644 --- a/apps/web/src/pages/workspace/[workspaceId]/trash.tsx +++ b/apps/web/src/pages/workspace/[workspaceId]/trash.tsx @@ -12,7 +12,7 @@ import { useCurrentWorkspace } from '../../../hooks/current/use-current-workspac import { useRouterHelper } from '../../../hooks/use-router-helper'; import { useSyncRouterWithCurrentWorkspace } from '../../../hooks/use-sync-router-with-current-workspace'; import { WorkspaceLayout } from '../../../layouts'; -import { NextPageWithLayout } from '../../../shared'; +import type { NextPageWithLayout } from '../../../shared'; const TrashPage: NextPageWithLayout = () => { const router = useRouter(); diff --git a/apps/web/src/plugins/affine/fetcher.ts b/apps/web/src/plugins/affine/fetcher.ts index 64e875ab35..3ff0f4c1bb 100644 --- a/apps/web/src/plugins/affine/fetcher.ts +++ b/apps/web/src/plugins/affine/fetcher.ts @@ -3,7 +3,8 @@ import { assertExists } from '@blocksuite/store'; import { jotaiStore, workspacesAtom } from '../../atoms'; import { createAffineProviders } from '../../blocksuite'; import { Unreachable } from '../../components/affine/affine-error-eoundary'; -import { AffineWorkspace, RemWorkspaceFlavour } from '../../shared'; +import type { AffineWorkspace } from '../../shared'; +import { RemWorkspaceFlavour } from '../../shared'; import { apis } from '../../shared/apis'; import { createEmptyBlockSuiteWorkspace } from '../../utils'; diff --git a/apps/web/src/plugins/affine/index.tsx b/apps/web/src/plugins/affine/index.tsx index 023975b2a3..1bec4ca9b8 100644 --- a/apps/web/src/plugins/affine/index.tsx +++ b/apps/web/src/plugins/affine/index.tsx @@ -8,8 +8,8 @@ import { PageNotFoundError } from '../../components/affine/affine-error-eoundary import { WorkspaceSettingDetail } from '../../components/affine/workspace-setting-detail'; import { BlockSuitePageList } from '../../components/blocksuite/block-suite-page-list'; import { PageDetailEditor } from '../../components/page-detail-editor'; +import type { AffineWorkspace } from '../../shared'; import { - AffineWorkspace, BlockSuiteWorkspace, LoadPriority, RemWorkspaceFlavour, @@ -17,7 +17,7 @@ import { import { apis, clientAuth } from '../../shared/apis'; import { createEmptyBlockSuiteWorkspace } from '../../utils'; import { initPage } from '../../utils/blocksuite'; -import { WorkspacePlugin } from '..'; +import type { WorkspacePlugin } from '..'; import { QueryKey } from './fetcher'; const storage = createJSONStorage(() => localStorage); diff --git a/apps/web/src/plugins/index.tsx b/apps/web/src/plugins/index.tsx index 58aca21bd8..22d391febe 100644 --- a/apps/web/src/plugins/index.tsx +++ b/apps/web/src/plugins/index.tsx @@ -1,12 +1,12 @@ -import React from 'react'; +import type React from 'react'; -import { +import type { BlockSuiteWorkspace, FlavourToWorkspace, LoadPriority, - RemWorkspaceFlavour, SettingPanel, } from '../shared'; +import { RemWorkspaceFlavour } from '../shared'; import { AffinePlugin } from './affine'; import { LocalPlugin } from './local'; diff --git a/apps/web/src/plugins/local/index.tsx b/apps/web/src/plugins/local/index.tsx index e37fe6eebc..31978b06f8 100644 --- a/apps/web/src/plugins/local/index.tsx +++ b/apps/web/src/plugins/local/index.tsx @@ -10,15 +10,15 @@ import { PageNotFoundError } from '../../components/affine/affine-error-eoundary import { WorkspaceSettingDetail } from '../../components/affine/workspace-setting-detail'; import { BlockSuitePageList } from '../../components/blocksuite/block-suite-page-list'; import { PageDetailEditor } from '../../components/page-detail-editor'; +import type { LocalWorkspace } from '../../shared'; import { BlockSuiteWorkspace, LoadPriority, - LocalWorkspace, RemWorkspaceFlavour, } from '../../shared'; import { createEmptyBlockSuiteWorkspace } from '../../utils'; import { initPage } from '../../utils/blocksuite'; -import { WorkspacePlugin } from '..'; +import type { WorkspacePlugin } from '..'; const getStorage = () => createJSONStorage(() => localStorage); diff --git a/apps/web/src/providers/AffineSWRConfigProvider.tsx b/apps/web/src/providers/AffineSWRConfigProvider.tsx index 8009986754..1612171005 100644 --- a/apps/web/src/providers/AffineSWRConfigProvider.tsx +++ b/apps/web/src/providers/AffineSWRConfigProvider.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import { SWRConfig, SWRConfiguration } from 'swr'; +import type { SWRConfiguration } from 'swr'; +import { SWRConfig } from 'swr'; import { fetcher } from '../plugins/affine/fetcher'; diff --git a/apps/web/src/providers/ModalProvider.tsx b/apps/web/src/providers/ModalProvider.tsx index ff0a8af510..0443d1be77 100644 --- a/apps/web/src/providers/ModalProvider.tsx +++ b/apps/web/src/providers/ModalProvider.tsx @@ -1,7 +1,8 @@ import { useAtom, useAtomValue, useSetAtom } from 'jotai'; import dynamic from 'next/dynamic'; import { useRouter } from 'next/router'; -import React, { useCallback } from 'react'; +import type React from 'react'; +import { useCallback } from 'react'; import { currentWorkspaceIdAtom, diff --git a/apps/web/src/providers/ThemeProvider.tsx b/apps/web/src/providers/ThemeProvider.tsx index e273c070a3..4a0b539c87 100644 --- a/apps/web/src/providers/ThemeProvider.tsx +++ b/apps/web/src/providers/ThemeProvider.tsx @@ -1,4 +1,4 @@ -import { AffineTheme, ThemeProviderProps } from '@affine/component'; +import type { AffineTheme, ThemeProviderProps } from '@affine/component'; import { getDarkTheme, getLightTheme, diff --git a/apps/web/src/shared/index.ts b/apps/web/src/shared/index.ts index e82541bc2d..e0de6c12e7 100644 --- a/apps/web/src/shared/index.ts +++ b/apps/web/src/shared/index.ts @@ -1,7 +1,7 @@ -import { Workspace as RemoteWorkspace } from '@affine/datacenter'; +import type { Workspace as RemoteWorkspace } from '@affine/datacenter'; import { Workspace as BlockSuiteWorkspace } from '@blocksuite/store'; -import { NextPage } from 'next'; -import { ReactElement, ReactNode } from 'react'; +import type { NextPage } from 'next'; +import type { ReactElement, ReactNode } from 'react'; export { BlockSuiteWorkspace }; diff --git a/apps/web/src/utils/blocksuite.ts b/apps/web/src/utils/blocksuite.ts index d7662c899d..f7356c3700 100644 --- a/apps/web/src/utils/blocksuite.ts +++ b/apps/web/src/utils/blocksuite.ts @@ -1,7 +1,7 @@ import { DebugLogger } from '@affine/debug'; import markdown from '@affine/templates/Welcome-to-AFFiNE.md'; -import { EditorContainer } from '@blocksuite/editor'; -import { Page } from '@blocksuite/store'; +import type { EditorContainer } from '@blocksuite/editor'; +import type { Page } from '@blocksuite/store'; const demoTitle = markdown .split('\n') diff --git a/packages/component/src/components/block-suite-editor/index.stories.tsx b/packages/component/src/components/block-suite-editor/index.stories.tsx index 0bd1554faa..883d7f88be 100644 --- a/packages/component/src/components/block-suite-editor/index.stories.tsx +++ b/packages/component/src/components/block-suite-editor/index.stories.tsx @@ -1,12 +1,14 @@ /* deepscan-disable USELESS_ARROW_FUNC_BIND */ import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models'; -import { EditorContainer } from '@blocksuite/editor'; -import { Page, Workspace } from '@blocksuite/store'; +import type { EditorContainer } from '@blocksuite/editor'; +import type { Page } from '@blocksuite/store'; +import { Workspace } from '@blocksuite/store'; import { expect } from '@storybook/jest'; -import { Meta, StoryFn } from '@storybook/react'; +import type { Meta, StoryFn } from '@storybook/react'; import { useEffect, useState } from 'react'; -import { BlockSuiteEditor, EditorProps } from '.'; +import type { EditorProps } from '.'; +import { BlockSuiteEditor } from '.'; function initPage(page: Page, editor: Readonly): void { // Add page block and surface block at root level diff --git a/packages/component/src/components/block-suite-editor/index.tsx b/packages/component/src/components/block-suite-editor/index.tsx index af963bde93..30d8dbcf68 100644 --- a/packages/component/src/components/block-suite-editor/index.tsx +++ b/packages/component/src/components/block-suite-editor/index.tsx @@ -1,7 +1,8 @@ -import { BlockHub } from '@blocksuite/blocks'; +import type { BlockHub } from '@blocksuite/blocks'; import { EditorContainer } from '@blocksuite/editor'; import type { Page, Workspace } from '@blocksuite/store'; -import { CSSProperties, useEffect, useRef } from 'react'; +import type { CSSProperties } from 'react'; +import { useEffect, useRef } from 'react'; export type EditorProps = { blockSuiteWorkspace: Workspace; diff --git a/packages/component/src/stories/Breadcrumbs.stories.tsx b/packages/component/src/stories/Breadcrumbs.stories.tsx index 2eee4c2d35..3989951660 100644 --- a/packages/component/src/stories/Breadcrumbs.stories.tsx +++ b/packages/component/src/stories/Breadcrumbs.stories.tsx @@ -1,7 +1,7 @@ /* deepscan-disable USELESS_ARROW_FUNC_BIND */ import { Link, Typography } from '@mui/material'; import { expect } from '@storybook/jest'; -import { Meta, StoryFn } from '@storybook/react'; +import type { Meta, StoryFn } from '@storybook/react'; import { within } from '@storybook/testing-library'; import { Breadcrumbs } from '..'; diff --git a/packages/component/src/stories/Button.stories.tsx b/packages/component/src/stories/Button.stories.tsx index e385477d5c..7c406ba36f 100644 --- a/packages/component/src/stories/Button.stories.tsx +++ b/packages/component/src/stories/Button.stories.tsx @@ -1,8 +1,8 @@ /* deepscan-disable USELESS_ARROW_FUNC_BIND */ -import { Meta, StoryFn } from '@storybook/react'; +import type { Meta, StoryFn } from '@storybook/react'; import { Button } from '..'; -import { ButtonProps } from '../ui/button/interface'; +import type { ButtonProps } from '../ui/button/interface'; export default { title: 'AFFiNE/Button', diff --git a/packages/component/src/styles/styled.tsx b/packages/component/src/styles/styled.tsx index f6973175b2..9cdcf0371b 100644 --- a/packages/component/src/styles/styled.tsx +++ b/packages/component/src/styles/styled.tsx @@ -9,7 +9,7 @@ import { import type { PropsWithChildren } from 'react'; import { useMemo } from 'react'; -import { AffineTheme } from './types'; +import type { AffineTheme } from './types'; export { css, keyframes, styled }; diff --git a/packages/component/src/styles/theme.ts b/packages/component/src/styles/theme.ts index 2ab5e1d7ba..fc2b8c8400 100644 --- a/packages/component/src/styles/theme.ts +++ b/packages/component/src/styles/theme.ts @@ -2,7 +2,7 @@ import '@emotion/react'; import type { EditorContainer } from '@blocksuite/editor'; -import { AffineTheme, AffineThemeCSSVariables } from './types'; +import type { AffineTheme, AffineThemeCSSVariables } from './types'; const basicFontFamily = 'apple-system, BlinkMacSystemFont,Helvetica Neue, Tahoma, PingFang SC, Microsoft Yahei, Arial,Hiragino Sans GB, sans-serif, Apple Color Emoji, Segoe UI Emoji,Segoe UI Symbol, Noto Color Emoji'; diff --git a/packages/component/src/styles/types.ts b/packages/component/src/styles/types.ts index a3f3039431..dac264f802 100644 --- a/packages/component/src/styles/types.ts +++ b/packages/component/src/styles/types.ts @@ -1,5 +1,5 @@ -import { EditorContainer } from '@blocksuite/editor'; -import { CSSProperties } from 'react'; +import type { EditorContainer } from '@blocksuite/editor'; +import type { CSSProperties } from 'react'; export type Theme = 'light' | 'dark'; export type ThemeMode = Theme | 'auto'; diff --git a/packages/component/src/styles/utils/localStorageThemeHelper.ts b/packages/component/src/styles/utils/localStorageThemeHelper.ts index 4aee8eca0f..be9961e6ab 100644 --- a/packages/component/src/styles/utils/localStorageThemeHelper.ts +++ b/packages/component/src/styles/utils/localStorageThemeHelper.ts @@ -1,4 +1,4 @@ -import { ThemeMode } from '../types'; +import type { ThemeMode } from '../types'; export class LocalStorageThemeHelper { name = 'Affine-theme-mode'; diff --git a/packages/component/src/styles/utils/systemThemeHelper.ts b/packages/component/src/styles/utils/systemThemeHelper.ts index 1c26cf8d4f..9b817c140f 100644 --- a/packages/component/src/styles/utils/systemThemeHelper.ts +++ b/packages/component/src/styles/utils/systemThemeHelper.ts @@ -1,4 +1,4 @@ -import { Theme } from '../types'; +import type { Theme } from '../types'; export class SystemThemeHelper { media: MediaQueryList = window.matchMedia('(prefers-color-scheme: light)'); diff --git a/packages/component/src/ui/button/Button.tsx b/packages/component/src/ui/button/Button.tsx index e20bbdd7dd..0378651cb5 100644 --- a/packages/component/src/ui/button/Button.tsx +++ b/packages/component/src/ui/button/Button.tsx @@ -1,6 +1,6 @@ import { Children, cloneElement, forwardRef } from 'react'; -import { ButtonProps } from './interface'; +import type { ButtonProps } from './interface'; import { Loading } from './Loading'; import { StyledButton } from './styles'; import { getSize } from './utils'; diff --git a/packages/component/src/ui/button/IconButton.tsx b/packages/component/src/ui/button/IconButton.tsx index 56ffa30f23..9717851707 100644 --- a/packages/component/src/ui/button/IconButton.tsx +++ b/packages/component/src/ui/button/IconButton.tsx @@ -1,11 +1,5 @@ -import { - Children, - cloneElement, - CSSProperties, - forwardRef, - HTMLAttributes, - ReactElement, -} from 'react'; +import type { CSSProperties, HTMLAttributes, ReactElement } from 'react'; +import { Children, cloneElement, forwardRef } from 'react'; import { StyledIconButton } from './styles'; const SIZE_SMALL = 'small' as const; diff --git a/packages/component/src/ui/button/Loading.tsx b/packages/component/src/ui/button/Loading.tsx index 11cb776628..81b93dea0b 100644 --- a/packages/component/src/ui/button/Loading.tsx +++ b/packages/component/src/ui/button/Loading.tsx @@ -1,5 +1,5 @@ import { styled } from '../../styles'; -import { ButtonProps } from './interface'; +import type { ButtonProps } from './interface'; import { getButtonColors } from './utils'; export const LoadingContainer = styled('div')>( ({ theme, type = 'default' }) => { diff --git a/packages/component/src/ui/button/TextButton.tsx b/packages/component/src/ui/button/TextButton.tsx index 69c2859368..87817150b2 100644 --- a/packages/component/src/ui/button/TextButton.tsx +++ b/packages/component/src/ui/button/TextButton.tsx @@ -1,6 +1,6 @@ import { Children, cloneElement, forwardRef } from 'react'; -import { ButtonProps } from './interface'; +import type { ButtonProps } from './interface'; import { StyledTextButton } from './styles'; import { getSize } from './utils'; export const TextButton = forwardRef( diff --git a/packages/component/src/ui/button/interface.ts b/packages/component/src/ui/button/interface.ts index d198db55dd..380f7872c1 100644 --- a/packages/component/src/ui/button/interface.ts +++ b/packages/component/src/ui/button/interface.ts @@ -1,4 +1,4 @@ -import { +import type { CSSProperties, HTMLAttributes, PropsWithChildren, diff --git a/packages/component/src/ui/button/styles.ts b/packages/component/src/ui/button/styles.ts index 07753e8044..7357fce208 100644 --- a/packages/component/src/ui/button/styles.ts +++ b/packages/component/src/ui/button/styles.ts @@ -1,7 +1,7 @@ -import { CSSProperties } from 'react'; +import type { CSSProperties } from 'react'; import { absoluteCenter, displayInlineFlex, styled } from '../../styles'; -import { ButtonProps } from './interface'; +import type { ButtonProps } from './interface'; import { getButtonColors, getSize } from './utils'; export const StyledIconButton = styled('button', { diff --git a/packages/component/src/ui/button/utils.ts b/packages/component/src/ui/button/utils.ts index 666dd72b24..8d0c22a443 100644 --- a/packages/component/src/ui/button/utils.ts +++ b/packages/component/src/ui/button/utils.ts @@ -1,11 +1,7 @@ -import { Theme } from '@mui/material'; +import type { Theme } from '@mui/material'; -import { - ButtonProps, - SIZE_DEFAULT, - SIZE_MIDDLE, - SIZE_SMALL, -} from './interface'; +import type { ButtonProps } from './interface'; +import { SIZE_DEFAULT, SIZE_MIDDLE, SIZE_SMALL } from './interface'; // TODO: Designer is not sure about the size, Now, is just use default size export const SIZE_CONFIG = { diff --git a/packages/component/src/ui/confirm/Confirm.tsx b/packages/component/src/ui/confirm/Confirm.tsx index 142bdbce52..986ada55c0 100644 --- a/packages/component/src/ui/confirm/Confirm.tsx +++ b/packages/component/src/ui/confirm/Confirm.tsx @@ -1,7 +1,8 @@ import { useTranslation } from '@affine/i18n'; import { Button } from '../button'; -import { Modal, ModalCloseButton, ModalProps } from '../modal'; +import type { ModalProps } from '../modal'; +import { Modal, ModalCloseButton } from '../modal'; import { StyledColumnButtonWrapper, StyledConfirmContent, diff --git a/packages/component/src/ui/empty/Empty.tsx b/packages/component/src/ui/empty/Empty.tsx index ade1e07e6a..3d0acd64f8 100644 --- a/packages/component/src/ui/empty/Empty.tsx +++ b/packages/component/src/ui/empty/Empty.tsx @@ -1,4 +1,4 @@ -import { CSSProperties } from 'react'; +import type { CSSProperties } from 'react'; import { EmptySVG } from './EmptySVG'; import { StyledEmptyContainer } from './style'; diff --git a/packages/component/src/ui/empty/EmptySVG.tsx b/packages/component/src/ui/empty/EmptySVG.tsx index a6a0fce58e..0a64d8215a 100644 --- a/packages/component/src/ui/empty/EmptySVG.tsx +++ b/packages/component/src/ui/empty/EmptySVG.tsx @@ -1,4 +1,5 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; +import type { SvgIconProps } from '@mui/material/SvgIcon'; +import SvgIcon from '@mui/material/SvgIcon'; export const EmptySVG = (props: SvgIconProps) => { return ( diff --git a/packages/component/src/ui/input/Input.tsx b/packages/component/src/ui/input/Input.tsx index 916f0db264..6f06e4c6a0 100644 --- a/packages/component/src/ui/input/Input.tsx +++ b/packages/component/src/ui/input/Input.tsx @@ -1,11 +1,10 @@ -import { +import type { FocusEventHandler, HTMLAttributes, InputHTMLAttributes, KeyboardEventHandler, - useEffect, - useState, } from 'react'; +import { useEffect, useState } from 'react'; import { StyledInput } from './style'; type inputProps = { diff --git a/packages/component/src/ui/layout/Content.tsx b/packages/component/src/ui/layout/Content.tsx index 887cd7cadc..ea8cfeef79 100644 --- a/packages/component/src/ui/layout/Content.tsx +++ b/packages/component/src/ui/layout/Content.tsx @@ -1,4 +1,4 @@ -import { CSSProperties } from 'react'; +import type { CSSProperties } from 'react'; import { styled, textEllipsis } from '../../styles'; diff --git a/packages/component/src/ui/menu/Menu.tsx b/packages/component/src/ui/menu/Menu.tsx index dbf1d25750..ff0ebc111c 100644 --- a/packages/component/src/ui/menu/Menu.tsx +++ b/packages/component/src/ui/menu/Menu.tsx @@ -1,5 +1,5 @@ -import { TooltipProps } from '@mui/material'; -import { CSSProperties } from 'react'; +import type { TooltipProps } from '@mui/material'; +import type { CSSProperties } from 'react'; import { Popper, type PopperProps } from '../popper'; import { StyledMenuWrapper } from './styles'; diff --git a/packages/component/src/ui/menu/MenuItem.tsx b/packages/component/src/ui/menu/MenuItem.tsx index 97f53f30ad..db4b835a99 100644 --- a/packages/component/src/ui/menu/MenuItem.tsx +++ b/packages/component/src/ui/menu/MenuItem.tsx @@ -1,10 +1,5 @@ -import { - cloneElement, - forwardRef, - HTMLAttributes, - PropsWithChildren, - ReactElement, -} from 'react'; +import type { HTMLAttributes, PropsWithChildren, ReactElement } from 'react'; +import { cloneElement, forwardRef } from 'react'; import { StyledArrow, StyledMenuItem } from './styles'; export type IconMenuProps = PropsWithChildren<{ diff --git a/packages/component/src/ui/menu/styles.ts b/packages/component/src/ui/menu/styles.ts index 5b89cdbbf3..7041264c02 100644 --- a/packages/component/src/ui/menu/styles.ts +++ b/packages/component/src/ui/menu/styles.ts @@ -1,5 +1,5 @@ import { ArrowRightSmallIcon } from '@blocksuite/icons'; -import { CSSProperties } from 'react'; +import type { CSSProperties } from 'react'; import { displayFlex, styled } from '../../styles'; import StyledPopperContainer from '../shared/Container'; diff --git a/packages/component/src/ui/modal/Modal.tsx b/packages/component/src/ui/modal/Modal.tsx index fe40d54971..d51e3246e4 100644 --- a/packages/component/src/ui/modal/Modal.tsx +++ b/packages/component/src/ui/modal/Modal.tsx @@ -1,4 +1,4 @@ -import { ModalUnstyledOwnProps } from '@mui/base/ModalUnstyled'; +import type { ModalUnstyledOwnProps } from '@mui/base/ModalUnstyled'; import Fade from '@mui/material/Fade'; import { StyledBackdrop, StyledModal } from './styles'; diff --git a/packages/component/src/ui/modal/ModalCloseButton.tsx b/packages/component/src/ui/modal/ModalCloseButton.tsx index 9890c8ad7d..58ed64a1a5 100644 --- a/packages/component/src/ui/modal/ModalCloseButton.tsx +++ b/packages/component/src/ui/modal/ModalCloseButton.tsx @@ -1,8 +1,9 @@ import { CloseIcon } from '@blocksuite/icons'; -import { HTMLAttributes } from 'react'; +import type { HTMLAttributes } from 'react'; import { styled } from '../../styles'; -import { IconButton, IconButtonProps } from '../button/IconButton'; +import type { IconButtonProps } from '../button/IconButton'; +import { IconButton } from '../button/IconButton'; export type ModalCloseButtonProps = { top?: number; right?: number; diff --git a/packages/component/src/ui/modal/ModalWrapper.tsx b/packages/component/src/ui/modal/ModalWrapper.tsx index 85f2b1205d..b363ca4b6e 100644 --- a/packages/component/src/ui/modal/ModalWrapper.tsx +++ b/packages/component/src/ui/modal/ModalWrapper.tsx @@ -1,4 +1,4 @@ -import { CSSProperties } from 'react'; +import type { CSSProperties } from 'react'; import { styled } from '../../styles'; diff --git a/packages/component/src/ui/modal/styles.ts b/packages/component/src/ui/modal/styles.ts index f789d82186..d8685fdb04 100644 --- a/packages/component/src/ui/modal/styles.ts +++ b/packages/component/src/ui/modal/styles.ts @@ -1,5 +1,5 @@ import ModalUnstyled from '@mui/base/ModalUnstyled'; -import { CSSProperties } from 'react'; +import type { CSSProperties } from 'react'; import { styled } from '../../styles'; import { Wrapper } from '../layout'; diff --git a/packages/component/src/ui/popper/PopoverArrow.tsx b/packages/component/src/ui/popper/PopoverArrow.tsx index e112a0f9ac..847af75ae9 100644 --- a/packages/component/src/ui/popper/PopoverArrow.tsx +++ b/packages/component/src/ui/popper/PopoverArrow.tsx @@ -1,7 +1,8 @@ -import { CSSProperties, forwardRef } from 'react'; +import type { CSSProperties } from 'react'; +import { forwardRef } from 'react'; import { styled } from '../../styles'; -import { PopperArrowProps } from './interface'; +import type { PopperArrowProps } from './interface'; export const PopperArrow = forwardRef( function PopperArrow({ placement }, ref) { diff --git a/packages/component/src/ui/popper/Popper.tsx b/packages/component/src/ui/popper/Popper.tsx index eaeaf1e2af..e934778d49 100644 --- a/packages/component/src/ui/popper/Popper.tsx +++ b/packages/component/src/ui/popper/Popper.tsx @@ -11,7 +11,7 @@ import { } from 'react'; import { styled } from '../../styles'; -import { PopperProps, VirtualElement } from './interface'; +import type { PopperProps, VirtualElement } from './interface'; import { PopperArrow } from './PopoverArrow'; export const Popper = ({ children, diff --git a/packages/component/src/ui/shared/Container.tsx b/packages/component/src/ui/shared/Container.tsx index 3ec35f4e62..f8e2894b82 100644 --- a/packages/component/src/ui/shared/Container.tsx +++ b/packages/component/src/ui/shared/Container.tsx @@ -1,4 +1,4 @@ -import { PopperPlacementType } from '@mui/material'; +import type { PopperPlacementType } from '@mui/material'; import { styled } from '../../styles'; diff --git a/packages/component/src/ui/table/Table.tsx b/packages/component/src/ui/table/Table.tsx index b14ad9ed4c..6552692857 100644 --- a/packages/component/src/ui/table/Table.tsx +++ b/packages/component/src/ui/table/Table.tsx @@ -1,4 +1,5 @@ -import { Children, HTMLAttributes, PropsWithChildren, ReactNode } from 'react'; +import type { HTMLAttributes, PropsWithChildren, ReactNode } from 'react'; +import { Children } from 'react'; import { StyledTable } from './styles'; const childrenHasEllipsis = (children: ReactNode | ReactNode[]): boolean => { diff --git a/packages/component/src/ui/table/TableBody.tsx b/packages/component/src/ui/table/TableBody.tsx index 8b64d6e957..3ab84c5682 100644 --- a/packages/component/src/ui/table/TableBody.tsx +++ b/packages/component/src/ui/table/TableBody.tsx @@ -1,4 +1,4 @@ -import { HTMLAttributes, PropsWithChildren } from 'react'; +import type { HTMLAttributes, PropsWithChildren } from 'react'; import { StyledTableBody } from './styles'; export const TableBody = ({ diff --git a/packages/component/src/ui/table/TableCell.tsx b/packages/component/src/ui/table/TableCell.tsx index 1a06f93b6d..02d1b4ae95 100644 --- a/packages/component/src/ui/table/TableCell.tsx +++ b/packages/component/src/ui/table/TableCell.tsx @@ -1,4 +1,4 @@ -import { TableCellProps } from './interface'; +import type { TableCellProps } from './interface'; import { StyledTableCell } from './styles'; export const TableCell = ({ children, ...props }: TableCellProps) => { return {children}; diff --git a/packages/component/src/ui/table/TableHead.tsx b/packages/component/src/ui/table/TableHead.tsx index c2cf83d01a..552460d504 100644 --- a/packages/component/src/ui/table/TableHead.tsx +++ b/packages/component/src/ui/table/TableHead.tsx @@ -1,4 +1,4 @@ -import { HTMLAttributes, PropsWithChildren } from 'react'; +import type { HTMLAttributes, PropsWithChildren } from 'react'; import { StyledTableHead } from './styles'; diff --git a/packages/component/src/ui/table/TableRow.tsx b/packages/component/src/ui/table/TableRow.tsx index e8ca202546..d047e484da 100644 --- a/packages/component/src/ui/table/TableRow.tsx +++ b/packages/component/src/ui/table/TableRow.tsx @@ -1,4 +1,4 @@ -import { HTMLAttributes, PropsWithChildren } from 'react'; +import type { HTMLAttributes, PropsWithChildren } from 'react'; import { StyledTableRow } from './styles'; export const TableRow = ({ diff --git a/packages/component/src/ui/table/interface.ts b/packages/component/src/ui/table/interface.ts index f9fa382255..ebd6b3515a 100644 --- a/packages/component/src/ui/table/interface.ts +++ b/packages/component/src/ui/table/interface.ts @@ -1,4 +1,4 @@ -import { CSSProperties, HTMLAttributes, PropsWithChildren } from 'react'; +import type { CSSProperties, HTMLAttributes, PropsWithChildren } from 'react'; export type TableCellProps = { align?: 'left' | 'right' | 'center'; diff --git a/packages/component/src/ui/table/styles.ts b/packages/component/src/ui/table/styles.ts index fa72bb3f88..1b0858b37a 100644 --- a/packages/component/src/ui/table/styles.ts +++ b/packages/component/src/ui/table/styles.ts @@ -1,5 +1,5 @@ import { styled, textEllipsis } from '../../styles'; -import { TableCellProps } from './interface'; +import type { TableCellProps } from './interface'; export const StyledTable = styled('table')<{ tableLayout: 'auto' | 'fixed' }>( ({ theme, tableLayout }) => { diff --git a/packages/component/src/ui/toast/toast.ts b/packages/component/src/ui/toast/toast.ts index 327dd9b000..69f76263e8 100644 --- a/packages/component/src/ui/toast/toast.ts +++ b/packages/component/src/ui/toast/toast.ts @@ -1,5 +1,6 @@ // Copyright: https://github.com/toeverything/blocksuite/commit/8032ef3ab97aefce01664b36502fc392c5db8b78#diff-bf5b41be21936f9165a8400c7f20e24d3dbc49644ba57b9258e0943f0dc1c464 -import { css, html, TemplateResult } from 'lit'; +import type { TemplateResult } from 'lit'; +import { css, html } from 'lit'; export const sleep = (ms = 0) => new Promise(resolve => setTimeout(resolve, ms)); diff --git a/packages/data-center/src/datacenter.ts b/packages/data-center/src/datacenter.ts index 1aab1ad4b0..b04a55955b 100644 --- a/packages/data-center/src/datacenter.ts +++ b/packages/data-center/src/datacenter.ts @@ -1,5 +1,5 @@ import { DebugLogger } from '@affine/debug'; -import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store'; +import type { Workspace as BlocksuiteWorkspace } from '@blocksuite/store'; import assert from 'assert'; import { MessageCenter } from './message'; diff --git a/packages/data-center/src/message/message.ts b/packages/data-center/src/message/message.ts index 0b54a2f077..5e771a6058 100644 --- a/packages/data-center/src/message/message.ts +++ b/packages/data-center/src/message/message.ts @@ -1,6 +1,6 @@ import { Observable } from 'lib0/observable'; -import { Message } from '../types'; +import type { Message } from '../types'; import { MessageCode, messages } from './code'; export class MessageCenter extends Observable { diff --git a/packages/data-center/src/provider/affine/affine.ts b/packages/data-center/src/provider/affine/affine.ts index 3fa5a641b2..8d37259d36 100644 --- a/packages/data-center/src/provider/affine/affine.ts +++ b/packages/data-center/src/provider/affine/affine.ts @@ -1,6 +1,6 @@ import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store'; import assert from 'assert'; -import { KyInstance } from 'ky/distribution/types/ky'; +import type { KyInstance } from 'ky/distribution/types/ky'; import { MessageCenter } from '../../message'; import type { User } from '../../types'; @@ -12,8 +12,8 @@ import type { ProviderConstructorParams, } from '../base'; import { BaseProvider } from '../base'; -import type { Apis, WorkspaceDetail } from './apis'; -import { getApis, Workspace } from './apis'; +import type { Apis, Workspace, WorkspaceDetail } from './apis'; +import { getApis } from './apis'; import { createGoogleAuth } from './apis/google'; import { createAuthClient, createBareClient } from './apis/request'; import { WebsocketClient } from './channel'; diff --git a/packages/data-center/src/provider/affine/apis/google.ts b/packages/data-center/src/provider/affine/apis/google.ts index 3b4e4e6083..d9469bbaca 100644 --- a/packages/data-center/src/provider/affine/apis/google.ts +++ b/packages/data-center/src/provider/affine/apis/google.ts @@ -1,6 +1,7 @@ import { DebugLogger } from '@affine/debug'; import { initializeApp } from 'firebase/app'; -import { connectAuthEmulator, User } from 'firebase/auth'; +import type { User } from 'firebase/auth'; +import { connectAuthEmulator } from 'firebase/auth'; import { type Auth as FirebaseAuth, getAuth as getFirebaseAuth, @@ -9,7 +10,7 @@ import { signOut, } from 'firebase/auth'; import { decode } from 'js-base64'; -import { KyInstance } from 'ky/distribution/types/ky'; +import type { KyInstance } from 'ky/distribution/types/ky'; import { MessageCenter } from '../../../message'; import { storage } from '../storage'; diff --git a/packages/data-center/src/provider/affine/apis/index.ts b/packages/data-center/src/provider/affine/apis/index.ts index 4b4aa04206..53d69acb11 100644 --- a/packages/data-center/src/provider/affine/apis/index.ts +++ b/packages/data-center/src/provider/affine/apis/index.ts @@ -1,8 +1,9 @@ export type { Callback } from './google'; -import { KyInstance } from 'ky/distribution/types/ky'; +import type { KyInstance } from 'ky/distribution/types/ky'; -import { createGoogleAuth, getAuthorizer, GoogleAuth } from './google'; +import type { createGoogleAuth, GoogleAuth } from './google'; +import { getAuthorizer } from './google'; import { createUserApis } from './user'; import { createWorkspaceApis } from './workspace'; diff --git a/packages/data-center/src/provider/affine/apis/request.ts b/packages/data-center/src/provider/affine/apis/request.ts index 521bb3a072..7034baaed9 100644 --- a/packages/data-center/src/provider/affine/apis/request.ts +++ b/packages/data-center/src/provider/affine/apis/request.ts @@ -1,7 +1,7 @@ import ky from 'ky-universal'; import { MessageCenter } from '../../../message'; -import { GoogleAuth } from './google'; +import type { GoogleAuth } from './google'; type KyInstance = typeof ky; diff --git a/packages/data-center/src/provider/affine/apis/user.ts b/packages/data-center/src/provider/affine/apis/user.ts index 15d3045a77..720de5700e 100644 --- a/packages/data-center/src/provider/affine/apis/user.ts +++ b/packages/data-center/src/provider/affine/apis/user.ts @@ -1,4 +1,4 @@ -import { KyInstance } from 'ky/distribution/types/ky'; +import type { KyInstance } from 'ky/distribution/types/ky'; export interface GetUserByEmailParams { email: string; diff --git a/packages/data-center/src/provider/affine/apis/workspace.ts b/packages/data-center/src/provider/affine/apis/workspace.ts index f5e982d74a..9e1dd89580 100644 --- a/packages/data-center/src/provider/affine/apis/workspace.ts +++ b/packages/data-center/src/provider/affine/apis/workspace.ts @@ -1,8 +1,8 @@ -import { KyInstance } from 'ky/distribution/types/ky'; +import type { KyInstance } from 'ky/distribution/types/ky'; import { MessageCenter } from '../../../message'; import { createBlocksuiteWorkspace as _createBlocksuiteWorkspace } from '../../../utils'; -import { GoogleAuth } from './google'; +import type { GoogleAuth } from './google'; import RequestError from './request-error'; import type { User } from './user'; const messageCenter = MessageCenter.getInstance(); diff --git a/packages/data-center/src/provider/affine/channel.ts b/packages/data-center/src/provider/affine/channel.ts index 4a8237c7b7..e37dc5c314 100644 --- a/packages/data-center/src/provider/affine/channel.ts +++ b/packages/data-center/src/provider/affine/channel.ts @@ -2,7 +2,7 @@ import { DebugLogger } from '@affine/debug'; import * as url from 'lib0/url'; import * as websocket from 'lib0/websocket'; -import { GoogleAuth } from './apis/google'; +import type { GoogleAuth } from './apis/google'; const RECONNECT_INTERVAL_TIME = 500; const MAX_RECONNECT_TIMES = 50; diff --git a/packages/data-center/src/provider/base.ts b/packages/data-center/src/provider/base.ts index 569e35b314..58f89273e9 100644 --- a/packages/data-center/src/provider/base.ts +++ b/packages/data-center/src/provider/base.ts @@ -1,12 +1,12 @@ import { DebugLogger } from '@affine/debug'; -import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store'; +import type { Workspace as BlocksuiteWorkspace } from '@blocksuite/store'; -import { MessageCenter } from '../message'; -import { User } from '../types'; +import type { MessageCenter } from '../message'; +import type { User } from '../types'; import type { WorkspaceUnit, WorkspaceUnitCtorParams } from '../workspace-unit'; import type { WorkspaceUnitCollectionScope } from '../workspace-unit-collection'; -import { Member } from './affine/apis'; -import { Permission } from './affine/apis/workspace'; +import type { Member } from './affine/apis'; +import type { Permission } from './affine/apis/workspace'; export interface ProviderConstructorParams { workspaces: WorkspaceUnitCollectionScope; diff --git a/packages/data-center/src/provider/local/local.ts b/packages/data-center/src/provider/local/local.ts index 0c94230632..d88171e856 100644 --- a/packages/data-center/src/provider/local/local.ts +++ b/packages/data-center/src/provider/local/local.ts @@ -1,4 +1,5 @@ -import { uuidv4, Workspace as BlocksuiteWorkspace } from '@blocksuite/store'; +import type { Workspace as BlocksuiteWorkspace } from '@blocksuite/store'; +import { uuidv4 } from '@blocksuite/store'; import assert from 'assert'; import { varStorage as storage } from 'lib0/storage'; diff --git a/packages/data-center/src/provider/tauri-ipc/__tests__/mock-apis.ts b/packages/data-center/src/provider/tauri-ipc/__tests__/mock-apis.ts index e8aa822f5d..4838adfd6f 100644 --- a/packages/data-center/src/provider/tauri-ipc/__tests__/mock-apis.ts +++ b/packages/data-center/src/provider/tauri-ipc/__tests__/mock-apis.ts @@ -1,11 +1,11 @@ -import { GetBlob, PutBlob } from '../ipc/types/blob'; -import { +import type { GetBlob, PutBlob } from '../ipc/types/blob'; +import type { GetDocumentParameter, GetDocumentResponse, YDocumentUpdate, } from '../ipc/types/document'; -import { CreateUser, GetUserParameters, User } from '../ipc/types/user'; -import { +import type { CreateUser, GetUserParameters, User } from '../ipc/types/user'; +import type { CreateWorkspace, CreateWorkspaceResult, GetWorkspace, diff --git a/packages/data-center/src/provider/tauri-ipc/index.ts b/packages/data-center/src/provider/tauri-ipc/index.ts index 8a9b8d7187..392870572e 100644 --- a/packages/data-center/src/provider/tauri-ipc/index.ts +++ b/packages/data-center/src/provider/tauri-ipc/index.ts @@ -1,16 +1,19 @@ -import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store'; +import type { Workspace as BlocksuiteWorkspace } from '@blocksuite/store'; import assert from 'assert'; import * as Y from 'yjs'; -import { User } from '../../types'; +import type { User } from '../../types'; import { applyUpdate } from '../../utils'; import type { WorkspaceUnit } from '../../workspace-unit'; -import { CreateWorkspaceInfoParams, ProviderConstructorParams } from '../base'; +import type { + CreateWorkspaceInfoParams, + ProviderConstructorParams, +} from '../base'; import { LocalProvider } from '../local'; import { loadWorkspaceUnit } from '../local/utils'; import { IPCBlobProvider } from './blocksuite-provider/blob'; import type { IPCMethodsType } from './ipc/methods'; -import { WorkspaceWithPermission } from './ipc/types/workspace'; +import type { WorkspaceWithPermission } from './ipc/types/workspace'; import { createWorkspaceUnit } from './utils'; /** diff --git a/packages/data-center/src/provider/tauri-ipc/ipc/methods.ts b/packages/data-center/src/provider/tauri-ipc/ipc/methods.ts index ca5a03bed8..e062ae583b 100644 --- a/packages/data-center/src/provider/tauri-ipc/ipc/methods.ts +++ b/packages/data-center/src/provider/tauri-ipc/ipc/methods.ts @@ -1,13 +1,13 @@ import { invoke } from '@tauri-apps/api'; -import { GetBlob, PutBlob } from './types/blob'; -import { +import type { GetBlob, PutBlob } from './types/blob'; +import type { GetDocumentParameter, GetDocumentResponse, YDocumentUpdate, } from './types/document'; -import { CreateUser, GetUserParameters } from './types/user'; -import { +import type { CreateUser, GetUserParameters } from './types/user'; +import type { CreateWorkspace, CreateWorkspaceResult, GetWorkspace, diff --git a/packages/data-center/src/provider/utils.ts b/packages/data-center/src/provider/utils.ts index 1501702bb6..638ea55af1 100644 --- a/packages/data-center/src/provider/utils.ts +++ b/packages/data-center/src/provider/utils.ts @@ -1,4 +1,4 @@ -import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store'; +import type { Workspace as BlocksuiteWorkspace } from '@blocksuite/store'; import assert from 'assert'; import { getDefaultHeadImgBlob } from '../utils'; diff --git a/packages/data-center/src/types/index.ts b/packages/data-center/src/types/index.ts index a7c5be3abd..d0c2cfec5d 100644 --- a/packages/data-center/src/types/index.ts +++ b/packages/data-center/src/types/index.ts @@ -8,6 +8,7 @@ // memberCount: number; // provider: string; // }; +import type { DebugLogger } from '@affine/debug'; declare global { interface Window { @@ -24,8 +25,7 @@ export type User = { }; // export type WorkspaceMeta = Pick; - -export type Logger = typeof import('@affine/debug').DebugLogger; +export type Logger = DebugLogger; export type Message = { code: number; diff --git a/packages/data-center/src/utils/index.ts b/packages/data-center/src/utils/index.ts index c574d142a2..80ed17f256 100644 --- a/packages/data-center/src/utils/index.ts +++ b/packages/data-center/src/utils/index.ts @@ -1,8 +1,6 @@ import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models'; -import { - StoreOptions, - Workspace as BlocksuiteWorkspace, -} from '@blocksuite/store'; +import type { StoreOptions } from '@blocksuite/store'; +import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store'; export const createBlocksuiteWorkspace = (options: StoreOptions) => { return new BlocksuiteWorkspace({ diff --git a/packages/data-center/src/workspace-unit.ts b/packages/data-center/src/workspace-unit.ts index 8c414b7bf5..bd6ffefe15 100644 --- a/packages/data-center/src/workspace-unit.ts +++ b/packages/data-center/src/workspace-unit.ts @@ -1,4 +1,4 @@ -import { +import type { BlobOptionsGetter, Workspace as BlocksuiteWorkspace, } from '@blocksuite/store'; diff --git a/packages/i18n/src/index.ts b/packages/i18n/src/index.ts index 330869035c..4d8c30f3c7 100644 --- a/packages/i18n/src/index.ts +++ b/packages/i18n/src/index.ts @@ -1,4 +1,5 @@ -import i18next, { i18n, Resource } from 'i18next'; +import type { i18n, Resource } from 'i18next'; +import i18next from 'i18next'; import { I18nextProvider, initReactI18next, diff --git a/tests/libs/sidebar.ts b/tests/libs/sidebar.ts index 68922a832d..bd12e89bc5 100644 --- a/tests/libs/sidebar.ts +++ b/tests/libs/sidebar.ts @@ -1,4 +1,4 @@ -import { Page } from '@playwright/test'; +import type { Page } from '@playwright/test'; export async function clickSideBarSettingButton(page: Page) { await page.getByTestId('slider-bar-workspace-setting-button').click();