chore: strict eslint check (#1084)

This commit is contained in:
Himself65
2023-02-17 01:33:32 -06:00
committed by GitHub
parent 191c36c6fb
commit 5e6366ba44
213 changed files with 1080 additions and 1886 deletions

View File

@@ -1,5 +1,5 @@
import React, { Component, ErrorInfo } from 'react';
import { MigrationError } from '@blocksuite/global/error';
import React, { Component, ErrorInfo } from 'react';
export type BlockSuiteErrorBoundaryProps = React.PropsWithChildren;
@@ -43,6 +43,7 @@ export class BlockSuiteErrorBoundary extends Component<
<a
target="_blank"
href="https://github.com/toeverything/blocksuite/issues"
rel="noreferrer"
>
BlockSuite Github Issue
</a>

View File

@@ -1,4 +1,5 @@
// export * from './components/BlockSuiteEditor';
export * from './styles';
export * from './ui/breadcrumbs';
export * from './ui/button';
export * from './ui/confirm';
@@ -8,10 +9,9 @@ export * from './ui/input';
export * from './ui/layout';
export * from './ui/menu';
export * from './ui/modal';
export * from './ui/mui';
export * from './ui/popper';
export * from './ui/shared/Container';
export * from './ui/table';
export * from './ui/toast';
export * from './ui/tooltip';
export * from './ui/mui';
export * from './styles';

View File

@@ -1,12 +1,13 @@
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
import React, { Suspense } from 'react';
import { Meta, Story } from '@storybook/react';
import { builtInSchemas } from '@blocksuite/blocks/models';
import { Page, Workspace } from '@blocksuite/store';
import { Meta, Story } from '@storybook/react';
import React, { Suspense } from 'react';
import {
BlockSuiteEditor,
BlockSuiteEditorProps,
} from '../components/BlockSuiteEditor';
import { Page, Workspace } from '@blocksuite/store';
const worksapce = new Workspace({
room: 'test',

View File

@@ -1,11 +1,12 @@
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
import { MigrationError } from '@blocksuite/global/error';
import { Meta, StoryFn } from '@storybook/react';
import React from 'react';
import {
BlockSuiteErrorBoundary,
BlockSuiteErrorBoundaryProps,
} from '../components/BlockSuiteErrorBoundary';
import { MigrationError } from '@blocksuite/global/error';
export default {
title: 'BlockSuite/ErrorBoundary',
@@ -22,5 +23,8 @@ export const ErrorComponent = () => {
export const Primary = Template.bind(undefined);
Primary.args = {
children: [<span>There is no error</span>, <ErrorComponent />],
children: [
<span key="1">There is no error</span>,
<ErrorComponent key="2" />,
],
};

View File

@@ -1,8 +1,9 @@
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
import React from 'react';
import { Meta, Story } from '@storybook/react';
import { Breadcrumbs } from '..';
import { Link, Typography } from '@mui/material';
import { Meta, Story } from '@storybook/react';
import React from 'react';
import { Breadcrumbs } from '..';
export default {
title: 'AFFiNE/Breadcrumbs',
@@ -14,12 +15,14 @@ const Template: Story = args => <Breadcrumbs {...args} />;
export const Primary = Template.bind(undefined);
Primary.args = {
children: [
<Link underline="hover" color="inherit" href="/">
<Link key="1" underline="hover" color="inherit" href="/">
AFFiNE
</Link>,
<Link underline="hover" color="inherit" href="/Docs/">
<Link key="2" underline="hover" color="inherit" href="/Docs/">
Docs
</Link>,
<Typography color="text.primary">Introduction</Typography>,
<Typography key="3" color="text.primary">
Introduction
</Typography>,
],
};

View File

@@ -1,6 +1,7 @@
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
import React from 'react';
import { Meta, Story } from '@storybook/react';
import React from 'react';
import { Button } from '..';
import { ButtonProps } from '../ui/button/interface';

View File

@@ -1,5 +1,5 @@
export * from './helper';
export * from './styled';
export * from './theme';
export * from './helper';
export * from './types';
export * from './utils';

View File

@@ -1,6 +1,7 @@
import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
import emotionStyled from '@emotion/styled';
import type { PropsWithChildren } from 'react';
import { AffineTheme } from './types';
export { css, keyframes } from '@emotion/react';
export const styled = emotionStyled;

View File

@@ -1,7 +1,9 @@
import '@emotion/react';
import { AffineTheme, AffineThemeCSSVariables, ThemeMode } from './types';
import type { EditorContainer } from '@blocksuite/editor';
import { AffineTheme, AffineThemeCSSVariables, ThemeMode } 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';

View File

@@ -1,2 +1,2 @@
export * from './systemThemeHelper';
export * from './localStorageThemeHelper';
export * from './systemThemeHelper';

View File

@@ -1,4 +1,5 @@
import MuiBreadcrumbs from '@mui/material/Breadcrumbs';
import { styled } from '../../styles';
export const Breadcrumbs = styled(MuiBreadcrumbs)(({ theme }) => {

View File

@@ -1,9 +1,9 @@
import { cloneElement, Children, forwardRef } from 'react';
import { StyledButton } from './styles';
import { Children, cloneElement, forwardRef } from 'react';
import { ButtonProps } from './interface';
import { getSize } from './utils';
import { Loading } from './Loading';
import { StyledButton } from './styles';
import { getSize } from './utils';
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
(

View File

@@ -1,11 +1,12 @@
import {
HTMLAttributes,
cloneElement,
ReactElement,
Children,
cloneElement,
CSSProperties,
forwardRef,
HTMLAttributes,
ReactElement,
} from 'react';
import { StyledIconButton } from './styles';
const SIZE_SMALL = 'small' as const;

View File

@@ -1,7 +1,7 @@
import { cloneElement, Children, forwardRef } from 'react';
import { StyledTextButton } from './styles';
import { Children, cloneElement, forwardRef } from 'react';
import { ButtonProps } from './interface';
import { StyledTextButton } from './styles';
import { getSize } from './utils';
export const TextButton = forwardRef<HTMLButtonElement, ButtonProps>(

View File

@@ -1,3 +1,3 @@
export * from './IconButton';
export * from './Button';
export * from './IconButton';
export * from './TextButton';

View File

@@ -1,7 +1,8 @@
import { absoluteCenter, displayInlineFlex, styled } from '../../styles';
import { CSSProperties } from 'react';
import { absoluteCenter, displayInlineFlex, styled } from '../../styles';
import { ButtonProps } from './interface';
import { getSize, getButtonColors } from './utils';
import { getButtonColors, getSize } from './utils';
export const StyledIconButton = styled('button', {
shouldForwardProp: prop => {

View File

@@ -1,9 +1,9 @@
import { AffineTheme } from '../../styles';
import {
SIZE_SMALL,
SIZE_MIDDLE,
SIZE_DEFAULT,
ButtonProps,
SIZE_DEFAULT,
SIZE_MIDDLE,
SIZE_SMALL,
} from './interface';
// TODO: Designer is not sure about the size, Now, is just use default size

View File

@@ -1,14 +1,15 @@
import { useTranslation } from '@affine/i18n';
import { useState } from 'react';
import { Button } from '../button';
import { Modal, ModalCloseButton, ModalProps } from '../modal';
import {
StyledRowButtonWrapper,
StyledColumnButtonWrapper,
StyledConfirmContent,
StyledConfirmTitle,
StyledModalWrapper,
StyledRowButtonWrapper,
} from './styles';
import { Button } from '../button';
import { useTranslation } from '@affine/i18n';
export type ConfirmProps = {
title?: string;
content?: string;

View File

@@ -1,4 +1,5 @@
import MuiDivider from '@mui/material/Divider';
import { styled } from '../../styles';
export const Divider = styled(MuiDivider)(({ theme }) => {

View File

@@ -1,6 +1,7 @@
import { CSSProperties } from 'react';
import { EmptySVG } from './EmptySVG';
import { styled } from '../../styles';
import { EmptySVG } from './EmptySVG';
export type EmptyContentProps = {
width?: CSSProperties['width'];

View File

@@ -1,11 +1,12 @@
import {
FocusEventHandler,
HTMLAttributes,
InputHTMLAttributes,
KeyboardEventHandler,
useEffect,
useState,
FocusEventHandler,
KeyboardEventHandler,
HTMLAttributes,
} from 'react';
import { StyledInput } from './style';
type inputProps = {

View File

@@ -1,4 +1,5 @@
import { CSSProperties } from 'react';
import { styled, textEllipsis } from '../../styles';
// This component should be just used to be contained the text content

View File

@@ -1,4 +1,5 @@
import type { CSSProperties } from 'react';
import { styled } from '../../styles';
export type WrapperProps = {

View File

@@ -1,2 +1,2 @@
export * from './Wrapper';
export * from './Content';
export * from './Wrapper';

View File

@@ -1,5 +1,6 @@
import { Popper, type PopperProps } from '../popper';
import { TooltipProps } from '@mui/material';
import { Popper, type PopperProps } from '../popper';
import { StyledMenuWrapper } from './styles';
export const Menu = (props: PopperProps & Omit<TooltipProps, 'title'>) => {

View File

@@ -5,7 +5,8 @@ import {
PropsWithChildren,
ReactElement,
} from 'react';
import { StyledMenuItem, StyledArrow } from './styles';
import { StyledArrow, StyledMenuItem } from './styles';
export type IconMenuProps = PropsWithChildren<{
isDir?: boolean;

View File

@@ -1,6 +1,7 @@
import { ArrowRightIcon } from '@blocksuite/icons';
import { displayFlex, styled } from '../../styles';
import StyledPopperContainer from '../shared/Container';
import { ArrowRightIcon } from '@blocksuite/icons';
export const StyledMenuWrapper = styled(StyledPopperContainer)(({ theme }) => {
return {

View File

@@ -1,6 +1,7 @@
import Fade from '@mui/material/Fade';
import { StyledModal, StyledBackdrop } from './styles';
import { ModalUnstyledOwnProps } from '@mui/base/ModalUnstyled';
import Fade from '@mui/material/Fade';
import { StyledBackdrop, StyledModal } from './styles';
const Backdrop = ({
open,

View File

@@ -1,7 +1,8 @@
import { HTMLAttributes } from 'react';
import { CloseIcon } from '@blocksuite/icons';
import { IconButton, IconButtonProps } from '../button/IconButton';
import { HTMLAttributes } from 'react';
import { styled } from '../../styles';
import { IconButton, IconButtonProps } from '../button/IconButton';
export type ModalCloseButtonProps = {
top?: number;
right?: number;

View File

@@ -1,4 +1,5 @@
import { CSSProperties } from 'react';
import { styled } from '../../styles';
export const ModalWrapper = styled.div<{

View File

@@ -1,7 +1,7 @@
import Modal from './Modal';
export * from './Modal';
export * from './ModalCloseButton';
export * from './ModalWrapper';
export * from './Modal';
export default Modal;

View File

@@ -1,8 +1,9 @@
import { styled } from '../../styles';
import ModalUnstyled from '@mui/base/ModalUnstyled';
import { Wrapper } from '../layout';
import { CSSProperties } from 'react';
import { styled } from '../../styles';
import { Wrapper } from '../layout';
export const StyledBackdrop = styled.div(({ theme }) => {
return {
zIndex: '-1',

View File

@@ -1,17 +1,17 @@
import MuiClickAwayListener from '@mui/base/ClickAwayListener';
import MuiAvatar from '@mui/material/Avatar';
import MuiBreadcrumbs from '@mui/material/Breadcrumbs';
import MuiCollapse from '@mui/material/Collapse';
import MuiSlide from '@mui/material/Slide';
import MuiAvatar from '@mui/material/Avatar';
import MuiGrow from '@mui/material/Grow';
import MuiClickAwayListener from '@mui/base/ClickAwayListener';
import MuiFade from '@mui/material/Fade';
import MuiGrow from '@mui/material/Grow';
import MuiSlide from '@mui/material/Slide';
export {
MuiBreadcrumbs,
MuiCollapse,
MuiSlide,
MuiAvatar,
MuiGrow,
MuiFade,
MuiBreadcrumbs,
MuiClickAwayListener,
MuiCollapse,
MuiFade,
MuiGrow,
MuiSlide,
};

View File

@@ -1,9 +1,10 @@
import { forwardRef } from 'react';
import { styled } from '../../styles';
import { PopperArrowProps } from './interface';
export const PopperArrow = forwardRef<HTMLElement, PopperArrowProps>(
({ placement }, ref) => {
function PopperArrow({ placement }, ref) {
return <StyledArrow placement={placement} ref={ref} />;
}
);

View File

@@ -1,17 +1,16 @@
import ClickAwayListener from '@mui/base/ClickAwayListener';
import PopperUnstyled from '@mui/base/PopperUnstyled';
import Grow from '@mui/material/Grow';
import {
cloneElement,
useEffect,
useImperativeHandle,
useMemo,
useRef,
useState,
cloneElement,
} from 'react';
import PopperUnstyled from '@mui/base/PopperUnstyled';
import ClickAwayListener from '@mui/base/ClickAwayListener';
import Grow from '@mui/material/Grow';
import { styled } from '../../styles';
import { PopperProps, VirtualElement } from './interface';
import { PopperArrow } from './PopoverArrow';
export const Popper = ({

View File

@@ -1,8 +1,8 @@
import type { CSSProperties, ReactNode, Ref, ReactElement } from 'react';
import {
type PopperPlacementType,
type PopperUnstyledProps,
} from '@mui/base/PopperUnstyled';
import type { CSSProperties, ReactElement, ReactNode, Ref } from 'react';
export type VirtualElement = {
getBoundingClientRect: () => ClientRect | DOMRect;
contextElement?: Element;

View File

@@ -1,6 +1,7 @@
import { styled } from '../../styles';
import { PopperPlacementType } from '@mui/material';
import { styled } from '../../styles';
export type PopperDirection =
| 'none'
| 'left-top'

View File

@@ -1,4 +1,5 @@
import { PropsWithChildren, Children, ReactNode, HTMLAttributes } from 'react';
import { Children, HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
import { StyledTable } from './styles';
const childrenHasEllipsis = (children: ReactNode | ReactNode[]): boolean => {

View File

@@ -1,4 +1,5 @@
import { HTMLAttributes, PropsWithChildren } from 'react';
import { StyledTableBody } from './styles';
export const TableBody = ({

View File

@@ -1,4 +1,5 @@
import { HTMLAttributes, PropsWithChildren } from 'react';
import { TableCellProps } from './interface';
import { StyledTableCell } from './styles';

View File

@@ -1,4 +1,5 @@
import { HTMLAttributes, PropsWithChildren } from 'react';
import { StyledTableHead } from './styles';
export const TableHead = ({

View File

@@ -1,4 +1,5 @@
import { HTMLAttributes, PropsWithChildren } from 'react';
import { StyledTableRow } from './styles';
export const TableRow = ({

View File

@@ -6,7 +6,7 @@
//
export * from './Table';
export * from './TableRow';
export * from './TableHead';
export * from './TableCell';
export * from './TableBody';
export * from './TableCell';
export * from './TableHead';
export * from './TableRow';

View File

@@ -1,8 +1,9 @@
import StyledPopperContainer from '../shared/Container';
import { Popper, type PopperProps } from '../popper';
import { styled } from '../../styles';
import type { TooltipProps } from '@mui/material';
import { styled } from '../../styles';
import { Popper, type PopperProps } from '../popper';
import StyledPopperContainer from '../shared/Container';
const StyledTooltip = styled(StyledPopperContainer)(({ theme }) => {
return {
maxWidth: '320px',

View File

@@ -1,19 +1,20 @@
import { WorkspaceUnitCollection } from './workspace-unit-collection';
import type { WorkspaceUnitCollectionChangeEvent } from './workspace-unit-collection';
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import assert from 'assert';
import { getLogger } from './logger';
import { MessageCenter } from './message';
import { AffineProvider } from './provider';
import type {
BaseProvider,
CreateWorkspaceInfoParams,
UpdateWorkspaceMetaParams,
} from './provider/base';
import { LocalProvider } from './provider/local';
import { AffineProvider } from './provider';
import type { Message } from './types';
import assert from 'assert';
import { getLogger } from './logger';
import { createBlocksuiteWorkspace } from './utils';
import { MessageCenter } from './message';
import { WorkspaceUnit } from './workspace-unit';
import type { WorkspaceUnitCollectionChangeEvent } from './workspace-unit-collection';
import { WorkspaceUnitCollection } from './workspace-unit-collection';
/**
* @class DataCenter
* @classdesc Data center is made for managing different providers for business

View File

@@ -26,8 +26,8 @@ const _initializeDataCenter = () => {
export const getDataCenter = _initializeDataCenter();
export type { DataCenter };
export * from './provider/affine/apis';
export { WorkspaceUnit } from './workspace-unit';
export { getLogger } from './logger';
export * from './message';
export * from './provider/affine/apis';
export * from './types';
export { WorkspaceUnit } from './workspace-unit';

View File

@@ -1,2 +1,2 @@
export { MessageCenter } from './message';
export { MessageCode } from './code';
export { MessageCenter } from './message';

View File

@@ -1,4 +1,5 @@
import { Observable } from 'lib0/observable';
import { Message } from '../types';
import { MessageCode, messages } from './code';

View File

@@ -1,4 +1,4 @@
import type { Apis, AccessTokenMessage } from '../apis';
import type { AccessTokenMessage, Apis } from '../apis';
const user: AccessTokenMessage = {
created_at: Date.now(),

View File

@@ -1,26 +1,27 @@
import { BaseProvider } from '../base';
import type {
ProviderConstructorParams,
CreateWorkspaceInfoParams,
} from '../base';
import type { User } from '../../types';
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import assert from 'assert';
import { WebsocketProvider } from './sync';
// import { IndexedDBProvider } from '../local/indexeddb';
import { getApis, Workspace } from './apis';
import type { Apis, WorkspaceDetail } from './apis';
import { WebsocketClient } from './channel';
import {
loadWorkspaceUnit,
createWorkspaceUnit,
migrateBlobDB,
createBlocksuiteWorkspaceWithAuth,
} from './utils';
import { WorkspaceUnit } from '../../workspace-unit';
import { MessageCenter } from '../../message';
import type { User } from '../../types';
import { applyUpdate } from '../../utils';
import type { SyncMode } from '../../workspace-unit';
import { MessageCenter } from '../../message';
import { WorkspaceUnit } from '../../workspace-unit';
import type {
CreateWorkspaceInfoParams,
ProviderConstructorParams,
} from '../base';
import { BaseProvider } from '../base';
import type { Apis, WorkspaceDetail } from './apis';
// import { IndexedDBProvider } from '../local/indexeddb';
import { getApis, Workspace } from './apis';
import { WebsocketClient } from './channel';
import { WebsocketProvider } from './sync';
import {
createBlocksuiteWorkspaceWithAuth,
createWorkspaceUnit,
loadWorkspaceUnit,
migrateBlobDB,
} from './utils';
type ChannelMessage = {
ws_list: Workspace[];

View File

@@ -1,4 +1,5 @@
import { describe, test, expect } from 'vitest';
import { describe, expect, test } from 'vitest';
import { Auth } from '../auth';
describe('class Auth', () => {

View File

@@ -1,4 +1,5 @@
import { initializeApp } from 'firebase/app';
import type { User } from 'firebase/auth';
import {
type Auth as FirebaseAuth,
getAuth as getFirebaseAuth,
@@ -6,12 +7,11 @@ import {
signInWithPopup,
signOut,
} from 'firebase/auth';
import type { User } from 'firebase/auth';
import { decode } from 'js-base64';
import { getLogger } from '../../../logger';
import { bareClient } from './request';
import { storage } from '../storage';
import { bareClient } from './request';
export interface AccessTokenMessage {
created_at: number;

View File

@@ -2,9 +2,9 @@
export type { Callback } from './auth';
import { getAuthorizer } from './auth';
import { auth } from './auth';
import * as user from './user';
import * as workspace from './workspace';
import { auth } from './auth';
// See https://twitter.com/mattpocockuk/status/1622730173446557697
// TODO: move to ts utils?

View File

@@ -1,4 +1,5 @@
import ky from 'ky-universal';
import { MessageCenter } from '../../../message';
import { auth } from './auth';

View File

@@ -1,7 +1,8 @@
import * as websocket from 'lib0/websocket';
import { auth } from './apis/auth';
import * as url from 'lib0/url';
import * as websocket from 'lib0/websocket';
import { Logger } from '../../types';
import { auth } from './apis/auth';
const RECONNECT_INTERVAL_TIME = 500;
const MAX_RECONNECT_TIMES = 50;

View File

@@ -1,4 +1,4 @@
import { createStore, keys, setMany, getMany, clear } from 'idb-keyval';
import { clear, createStore, getMany, keys, setMany } from 'idb-keyval';
import * as idb from 'lib0/indexeddb';
type IDBInstance<T = ArrayBufferLike> = {

View File

@@ -7,15 +7,15 @@
// import * as Y from 'yjs'; // eslint-disable-line
import * as bc from 'lib0/broadcastchannel';
import * as time from 'lib0/time';
import * as encoding from 'lib0/encoding';
import * as decoding from 'lib0/decoding';
import * as syncProtocol from 'y-protocols/sync';
import * as encoding from 'lib0/encoding';
import * as math from 'lib0/math';
import { Observable } from 'lib0/observable';
import * as time from 'lib0/time';
import * as url from 'lib0/url';
import * as authProtocol from 'y-protocols/auth';
import * as awarenessProtocol from 'y-protocols/awareness';
import { Observable } from 'lib0/observable';
import * as math from 'lib0/math';
import * as url from 'lib0/url';
import * as syncProtocol from 'y-protocols/sync';
export const messageSync = 0;
export const messageQueryAwareness = 3;

View File

@@ -1,11 +1,11 @@
import { WorkspaceUnit } from '../../workspace-unit';
import type { WorkspaceUnitCtorParams } from '../../workspace-unit';
import { createBlocksuiteWorkspace as _createBlocksuiteWorkspace } from '../../utils';
import type { Apis } from './apis';
import { setDefaultAvatar } from '../utils';
import { applyUpdate } from '../../utils';
import { getDatabase } from './idb-kv';
import type { WorkspaceUnitCtorParams } from '../../workspace-unit';
import { WorkspaceUnit } from '../../workspace-unit';
import { setDefaultAvatar } from '../utils';
import type { Apis } from './apis';
import { auth } from './apis/auth';
import { getDatabase } from './idb-kv';
export const createBlocksuiteWorkspaceWithAuth = async (id: string) => {
if (auth.isExpired && auth.isLogin) {

View File

@@ -1,8 +1,9 @@
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import { MessageCenter } from '../message';
import { Logger, User } from '../types';
import type { WorkspaceUnit, WorkspaceUnitCtorParams } from '../workspace-unit';
import type { WorkspaceUnitCollectionScope } from '../workspace-unit-collection';
import type { WorkspaceUnitCtorParams, WorkspaceUnit } from '../workspace-unit';
import { Member } from './affine/apis';
import { Permission } from './affine/apis/workspace';

View File

@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import * as idb from 'lib0/indexeddb';
import { Observable } from 'lib0/observable';
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
const customStoreName = 'custom';
const updatesStoreName = 'updates';

View File

@@ -1,6 +1,7 @@
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import assert from 'assert';
import * as idb from 'lib0/indexeddb';
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import { applyUpdate } from '../../../utils';
const { encodeStateAsUpdate, mergeUpdates } = BlocksuiteWorkspace.Y;

View File

@@ -1,8 +1,10 @@
import { test, describe, expect } from 'vitest';
import 'fake-indexeddb/auto';
import { describe, expect, test } from 'vitest';
import { MessageCenter } from '../../message';
import { WorkspaceUnitCollection } from '../../workspace-unit-collection';
import { LocalProvider } from './local';
import { MessageCenter } from '../../message';
import 'fake-indexeddb/auto';
describe('local provider', () => {
const workspaceMetaCollection = new WorkspaceUnitCollection();

View File

@@ -1,17 +1,18 @@
import { BaseProvider } from '../base';
import type {
ProviderConstructorParams,
WorkspaceMeta0,
UpdateWorkspaceMetaParams,
CreateWorkspaceInfoParams,
} from '../base';
import { uuidv4, Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import assert from 'assert';
import { varStorage as storage } from 'lib0/storage';
import { Workspace as BlocksuiteWorkspace, uuidv4 } from '@blocksuite/store';
import type { WorkspaceUnit } from '../../workspace-unit';
import type {
CreateWorkspaceInfoParams,
ProviderConstructorParams,
UpdateWorkspaceMetaParams,
WorkspaceMeta0,
} from '../base';
import { BaseProvider } from '../base';
import { IndexedDBProvider } from './indexeddb/indexeddb';
import { applyLocalUpdates } from './indexeddb/utils';
import assert from 'assert';
import { loadWorkspaceUnit, createWorkspaceUnit } from './utils';
import type { WorkspaceUnit } from '../../workspace-unit';
import { createWorkspaceUnit, loadWorkspaceUnit } from './utils';
const WORKSPACE_KEY = 'workspaces';

View File

@@ -1,8 +1,8 @@
import { WorkspaceUnit } from '../../workspace-unit';
import type { WorkspaceUnitCtorParams } from '../../workspace-unit';
import { createBlocksuiteWorkspace } from '../../utils';
import { applyLocalUpdates, writeUpdatesToLocal } from './indexeddb/utils';
import type { WorkspaceUnitCtorParams } from '../../workspace-unit';
import { WorkspaceUnit } from '../../workspace-unit';
import { setDefaultAvatar } from '../utils';
import { applyLocalUpdates, writeUpdatesToLocal } from './indexeddb/utils';
export const loadWorkspaceUnit = async (params: WorkspaceUnitCtorParams) => {
const workspaceUnit = new WorkspaceUnit(params);

View File

@@ -7,15 +7,15 @@
// import * as Y from 'yjs'; // eslint-disable-line
import * as bc from 'lib0/broadcastchannel';
import * as time from 'lib0/time';
import * as encoding from 'lib0/encoding';
import * as decoding from 'lib0/decoding';
import * as syncProtocol from 'y-protocols/sync';
import * as encoding from 'lib0/encoding';
import * as math from 'lib0/math';
import { Observable } from 'lib0/observable';
import * as time from 'lib0/time';
import * as url from 'lib0/url';
import * as authProtocol from 'y-protocols/auth';
import * as awarenessProtocol from 'y-protocols/awareness';
import { Observable } from 'lib0/observable';
import * as math from 'lib0/math';
import * as url from 'lib0/url';
import * as syncProtocol from 'y-protocols/sync';
export const messageSync = 0;
export const messageQueryAwareness = 3;

View File

@@ -1,17 +1,17 @@
import { PutBlob, GetBlob } from '../ipc/types/blob';
import { GetBlob, PutBlob } from '../ipc/types/blob';
import {
YDocumentUpdate,
GetDocumentParameter,
GetDocumentResponse,
YDocumentUpdate,
} from '../ipc/types/document';
import { CreateUser, GetUserParameters, User } from '../ipc/types/user';
import {
CreateWorkspace,
CreateWorkspaceResult,
GetWorkspaces,
GetWorkspacesResult,
GetWorkspace,
GetWorkspaceResult,
GetWorkspaces,
GetWorkspacesResult,
} from '../ipc/types/workspace';
export const updateYDocument = async (parameters: YDocumentUpdate) =>

View File

@@ -1,11 +1,12 @@
import { describe, test, expect } from 'vitest';
import 'fake-indexeddb/auto';
import { describe, expect, test } from 'vitest';
import { MessageCenter } from '../../../message';
import { WorkspaceUnitCollection } from '../../../workspace-unit-collection';
import { TauriIPCProvider } from '..';
import { MessageCenter } from '../../../message';
import * as ipcMethods from './mock-apis';
import 'fake-indexeddb/auto';
describe('tauri-ipc provider', async () => {
const workspaceMetaCollection = new WorkspaceUnitCollection();
const provider = new TauriIPCProvider({

View File

@@ -1,13 +1,15 @@
import { BlobSyncState } from '@blocksuite/store';
import * as ipcMethods from '../ipc/methods';
import { Signal } from '@blocksuite/store';
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import type {
BlobId,
BlobProvider,
BlobSyncStateChangeEvent,
BlobId,
BlobURL,
} from '@blocksuite/store/dist/persistence/blob/types';
import * as ipcMethods from '../ipc/methods';
export class IPCBlobProvider implements BlobProvider {
#ipc = ipcMethods;

View File

@@ -1,16 +1,16 @@
import * as Y from 'yjs';
import assert from 'assert';
import { LocalProvider } from '../local';
import type { IPCMethodsType } from './ipc/methods';
import { CreateWorkspaceInfoParams, ProviderConstructorParams } from '../base';
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import { IPCBlobProvider } from './blocksuite-provider/blob';
import type { WorkspaceUnit } from '../../workspace-unit';
import { loadWorkspaceUnit } from '../local/utils';
import { WorkspaceWithPermission } from './ipc/types/workspace';
import { applyUpdate } from '../../utils';
import assert from 'assert';
import * as Y from 'yjs';
import { User } from '../../types';
import { applyUpdate } from '../../utils';
import type { WorkspaceUnit } from '../../workspace-unit';
import { 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 { createWorkspaceUnit } from './utils';
/**

View File

@@ -1,9 +1,12 @@
import { invoke } from '@tauri-apps/api';
import { GetBlob, PutBlob } from './types/blob';
import {
GetDocumentParameter,
GetDocumentResponse,
YDocumentUpdate,
} from './types/document';
import { CreateUser, GetUserParameters } from './types/user';
import {
CreateWorkspace,
CreateWorkspaceResult,
@@ -13,8 +16,6 @@ import {
GetWorkspacesResult,
User,
} from './types/workspace';
import { GetBlob, PutBlob } from './types/blob';
import { CreateUser, GetUserParameters } from './types/user';
export interface IPCMethodsType {
updateYDocument: typeof updateYDocument;

View File

@@ -1,6 +1,6 @@
import { WorkspaceUnit } from '../../workspace-unit';
import type { WorkspaceUnitCtorParams } from '../../workspace-unit';
import { createBlocksuiteWorkspace } from '../../utils';
import type { WorkspaceUnitCtorParams } from '../../workspace-unit';
import { WorkspaceUnit } from '../../workspace-unit';
import { setDefaultAvatar } from '../utils';
import { IPCBlobProvider } from './blocksuite-provider/blob';

View File

@@ -1,5 +1,6 @@
import assert from 'assert';
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
import assert from 'assert';
import { getDefaultHeadImgBlob } from '../utils';
export const setDefaultAvatar = async (

View File

@@ -1,12 +1,12 @@
import {
clear,
createStore,
del,
entries,
get,
keys,
set,
setMany,
clear,
entries,
} from 'idb-keyval';
export type ConfigStore<T = any> = {

View File

@@ -1,8 +1,8 @@
import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models';
import {
StoreOptions,
Workspace as BlocksuiteWorkspace,
} from '@blocksuite/store';
import { builtInSchemas, __unstableSchemas } from '@blocksuite/blocks/models';
export const createBlocksuiteWorkspace = (
workspaceId: string,

View File

@@ -1,7 +1,8 @@
import { describe, test, expect } from 'vitest';
import { WorkspaceUnitCollection } from './workspace-unit-collection';
import type { WorkspaceUnitCollectionChangeEvent } from './workspace-unit-collection';
import { describe, expect, test } from 'vitest';
import { WorkspaceUnit } from './workspace-unit';
import type { WorkspaceUnitCollectionChangeEvent } from './workspace-unit-collection';
import { WorkspaceUnitCollection } from './workspace-unit-collection';
describe('workspace meta collection observable', () => {
const workspaceUnitCollection = new WorkspaceUnitCollection();

View File

@@ -1,7 +1,8 @@
import { Observable } from 'lib0/observable';
import type {
WorkspaceUnit,
UpdateWorkspaceUnitParams,
WorkspaceUnit,
} from './workspace-unit';
export interface WorkspaceUnitCollectionScope {

View File

@@ -2,6 +2,7 @@ import {
BlobOptionsGetter,
Workspace as BlocksuiteWorkspace,
} from '@blocksuite/store';
import type { User } from './types';
export type SyncMode = 'all' | 'core';

View File

@@ -1,5 +1,6 @@
import i18next, { Resource } from 'i18next';
import { Trans, initReactI18next, useTranslation } from 'react-i18next';
import { initReactI18next, Trans, useTranslation } from 'react-i18next';
import { LOCALES } from './resources';
import type en_US from './resources/en.json';
@@ -24,7 +25,7 @@ declare module 'react-i18next' {
const STORAGE_KEY = 'i18n_lng';
export { Trans, i18n, useTranslation, LOCALES };
export { i18n, LOCALES, Trans, useTranslation };
const resources = LOCALES.reduce<Resource>(
(acc, { tag, res }) => ({ ...acc, [tag]: { translation: res } }),

View File

@@ -1,11 +1,11 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
// Run `pnpm run download-resources` to regenerate.
// To overwrite this, please overwrite download.ts script.
import en from './en.json';
import zh_Hans from './zh-Hans.json';
import fr from './fr.json';
import de from './de.json';
import en from './en.json';
import fr from './fr.json';
import ru from './ru.json';
import zh_Hans from './zh-Hans.json';
export const LOCALES = [
{

View File

@@ -1,7 +1,9 @@
// cSpell:ignore Tolgee
import fs from 'node:fs/promises';
import path from 'node:path';
import { format } from 'prettier';
import { getAllProjectLanguages, getRemoteTranslations } from './api.js';
import type { TranslationRes } from './utils.js';

View File

@@ -1,6 +1,7 @@
// cSpell:ignore Tolgee
import { readFile } from 'fs/promises';
import path from 'path';
import { createsNewKey, getRemoteTranslations } from './api.js';
import type { TranslationRes } from './utils.js';

View File

@@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { Logger } from '../src';
const Page = () => {