Merge branch 'develop'

This commit is contained in:
DarkSky 2022-08-12 20:28:13 +08:00
commit 09dcca1b8d
88 changed files with 102 additions and 126 deletions

View File

@ -22,7 +22,7 @@ See https://github.com/all-?/all-contributors/issues/361#issuecomment-637166066
<!-- ALL-CONTRIBUTORS-BADGE:END --> <!-- ALL-CONTRIBUTORS-BADGE:END -->
[![affine.pro](https://img.shields.io/static/v1?label=affine.pro&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAhpJREFUWEdjZEACtnl3MxgY/0YzMjAaMzAwcCLLUYH9/T/D/7MM/5mXHp6kPANmHiOI4Zx9Xfg3C+tKBob/zlSwiAgjGPey/vkdvneq5luwA+zy7+yhn+Vwv+89NFHFhREU7IyM/6YT4WyqK/n/nymT0Tb/1mFGBkYbqptOhIH/Gf4fYbTLv/2NBgmOCOvBSr6DHPCfWNW0UEe2A2x1uRlakiXBbtpx6jND+7KXZLmPbAdURokzeJjxwi31rrzH8OX7P5IdQbYDtnUoMXBzMMEt7Fj2imH7qU/0cQBy8MNsPHL5K0P13Of0cQB68MNsJScaSI4CHk4mhq3tSnCf3n36k0FZmh3Mn7L+DcPqgx9ICgWSHeBpxsdQESUGtgRk+eqDH+H8O09/MiR3P6atA1qTJRlsdLnhPgYlPOQQCW96wPDi3R+iHUFSCKAHP8wydEeREg0kOQA9+JOgwR1qL8CQEygC9jWp0UCSA+aVysIT3JqDHxgmr38DtlRCiIVhZZ0CPNhB6QDkEGIA0Q4gZAkuxxFyBNEOQA7ml+/+MIQ1PUAxG1kelAhB6YMYQLQDCPmQUAjhcgxRDiDWcEKOxOYIohyQGyjCEGIvANaPLfhhBiNHA6hmBBXNhABRDgCV/aBQAAFQpYMrn4PUgNTCACiXEMoNRDmAkC8okR8UDhjYRumAN8sHvGMCSkAD2jUDOWDAO6ewbDQQ3XMAy/oxKownQR0AAAAASUVORK5CYII=&color=orange&message=→)](https://affine.pro) [![affine.pro](https://img.shields.io/static/v1?label=live%20demo&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAhpJREFUWEdjZEACtnl3MxgY/0YzMjAaMzAwcCLLUYH9/T/D/7MM/5mXHp6kPANmHiOI4Zx9Xfg3C+tKBob/zlSwiAgjGPey/vkdvneq5luwA+zy7+yhn+Vwv+89NFHFhREU7IyM/6YT4WyqK/n/nymT0Tb/1mFGBkYbqptOhIH/Gf4fYbTLv/2NBgmOCOvBSr6DHPCfWNW0UEe2A2x1uRlakiXBbtpx6jND+7KXZLmPbAdURokzeJjxwi31rrzH8OX7P5IdQbYDtnUoMXBzMMEt7Fj2imH7qU/0cQBy8MNsPHL5K0P13Of0cQB68MNsJScaSI4CHk4mhq3tSnCf3n36k0FZmh3Mn7L+DcPqgx9ICgWSHeBpxsdQESUGtgRk+eqDH+H8O09/MiR3P6atA1qTJRlsdLnhPgYlPOQQCW96wPDi3R+iHUFSCKAHP8wydEeREg0kOQA9+JOgwR1qL8CQEygC9jWp0UCSA+aVysIT3JqDHxgmr38DtlRCiIVhZZ0CPNhB6QDkEGIA0Q4gZAkuxxFyBNEOQA7ml+/+MIQ1PUAxG1kelAhB6YMYQLQDCPmQUAjhcgxRDiDWcEKOxOYIohyQGyjCEGIvANaPLfhhBiNHA6hmBBXNhABRDgCV/aBQAAFQpYMrn4PUgNTCACiXEMoNRDmAkC8okR8UDhjYRumAN8sHvGMCSkAD2jUDOWDAO6ewbDQQ3XMAy/oxKownQR0AAAAASUVORK5CYII=&color=orange&message=→)](https://affine.pro)
[![stars](https://img.shields.io/github/stars/toeverything/AFFiNE.svg?style=flat&logo=github&colorB=red&label=stars)](https://github.com/toeverything/AFFiNE) [![stars](https://img.shields.io/github/stars/toeverything/AFFiNE.svg?style=flat&logo=github&colorB=red&label=stars)](https://github.com/toeverything/AFFiNE)
[![All Contributors][all-contributors-badge]](#contributors) [![All Contributors][all-contributors-badge]](#contributors)
[![Node](https://img.shields.io/badge/node->=16.0-success)](https://www.typescriptlang.org/) [![Node](https://img.shields.io/badge/node->=16.0-success)](https://www.typescriptlang.org/)

View File

@ -1,9 +1,15 @@
import { type FC, useRef } from 'react'; import { type ComponentType, useRef } from 'react';
import * as uiIcons from '@toeverything/components/icons'; import * as uiIcons from '@toeverything/components/icons';
import { message, styled } from '@toeverything/components/ui'; import { message, styled } from '@toeverything/components/ui';
import { copy } from './copy'; import { copy } from './copy';
const IconBooth = ({ name, Icon }: { name: string; Icon: FC<any> }) => { const IconBooth = ({
name,
Icon,
}: {
name: string;
Icon: ComponentType<any>;
}) => {
const on_click = () => { const on_click = () => {
copy(`<${name} />`); copy(`<${name} />`);
message.success('Copied ~'); message.success('Copied ~');
@ -36,7 +42,13 @@ export const Icons = () => {
<hr /> <hr />
<IconsContainer> <IconsContainer>
{_icons.map(([key, icon]) => { {_icons.map(([key, icon]) => {
return <IconBooth key={key} name={key} Icon={icon as FC} />; return (
<IconBooth
key={key}
name={key}
Icon={icon as ComponentType<any>}
/>
);
})} })}
</IconsContainer> </IconsContainer>
</Container> </Container>

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types'; import type { TDShape } from '@toeverything/components/board-types';
import { Popover, Tooltip, IconButton } from '@toeverything/components/ui'; import { Popover, Tooltip, IconButton } from '@toeverything/components/ui';

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import { Fragment } from 'react'; import { Fragment } from 'react';
import { Vec } from '@tldraw/vec'; import { Vec } from '@tldraw/vec';
import { TldrawApp, TLDR } from '@toeverything/components/board-state'; import { TldrawApp, TLDR } from '@toeverything/components/board-state';

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types'; import type { TDShape } from '@toeverything/components/board-types';
import { IconButton, Tooltip } from '@toeverything/components/ui'; import { IconButton, Tooltip } from '@toeverything/components/ui';

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types'; import type { TDShape } from '@toeverything/components/board-types';
import { import {

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types'; import type { TDShape } from '@toeverything/components/board-types';
import { FontSizeStyle } from '@toeverything/components/board-types'; import { FontSizeStyle } from '@toeverything/components/board-types';

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types'; import type { TDShape } from '@toeverything/components/board-types';
import { import {

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types'; import type { TDShape } from '@toeverything/components/board-types';
import { IconButton, Tooltip } from '@toeverything/components/ui'; import { IconButton, Tooltip } from '@toeverything/components/ui';

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types'; import type { TDShape } from '@toeverything/components/board-types';
import { IconButton, Tooltip } from '@toeverything/components/ui'; import { IconButton, Tooltip } from '@toeverything/components/ui';

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import { DashStyle, StrokeWidth } from '@toeverything/components/board-types'; import { DashStyle, StrokeWidth } from '@toeverything/components/board-types';
import { import {
LineNoneIcon, LineNoneIcon,

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import { DashStyle, StrokeWidth } from '@toeverything/components/board-types'; import { DashStyle, StrokeWidth } from '@toeverything/components/board-types';
import type { TDShape } from '@toeverything/components/board-types'; import type { TDShape } from '@toeverything/components/board-types';

View File

@ -1,4 +1,4 @@
import type { FC, ReactNode } from 'react'; import type { ReactNode } from 'react';
export const ContextMenu = ({ children }: { children: ReactNode }) => { export const ContextMenu = ({ children }: { children: ReactNode }) => {
return <div>{children}</div>; return <div>{children}</div>;

View File

@ -1,4 +1,4 @@
import type { FC, PropsWithChildren } from 'react'; import type { PropsWithChildren } from 'react';
import { useMemo } from 'react'; import { useMemo } from 'react';
import { styled, Tooltip } from '@toeverything/components/ui'; import { styled, Tooltip } from '@toeverything/components/ui';
import { ShapeColorNoneIcon } from '@toeverything/components/icons'; import { ShapeColorNoneIcon } from '@toeverything/components/icons';

View File

@ -1,4 +1,4 @@
import { FC, useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import { import {
ConnectorIcon, ConnectorIcon,
ConectorLineIcon, ConectorLineIcon,

View File

@ -1,4 +1,4 @@
import { FC, useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import { import {
ShapeIcon, ShapeIcon,
RectangleIcon, RectangleIcon,

View File

@ -1,4 +1,3 @@
import { FC } from 'react';
import style9 from 'style9'; import style9 from 'style9';
import { import {
// MuiIconButton as IconButton, // MuiIconButton as IconButton,
@ -14,6 +13,10 @@ import {
SelectIcon, SelectIcon,
TextIcon, TextIcon,
EraserIcon, EraserIcon,
SelectIconProps,
EraserIconProps,
HandToolIconProps,
TextIconProps,
} from '@toeverything/components/icons'; } from '@toeverything/components/icons';
import { import {
@ -26,6 +29,7 @@ import { TldrawApp } from '@toeverything/components/board-state';
import { ShapeTools } from './ShapeTools'; import { ShapeTools } from './ShapeTools';
import { PenTools } from './pen-tools'; import { PenTools } from './pen-tools';
import { LineTools } from './LineTools'; import { LineTools } from './LineTools';
import { ComponentType, Component } from 'react';
const activeToolSelector = (s: TDSnapshot) => s.appState.activeTool; const activeToolSelector = (s: TDSnapshot) => s.appState.activeTool;
const toolLockedSelector = (s: TDSnapshot) => s.appState.isToolLocked; const toolLockedSelector = (s: TDSnapshot) => s.appState.isToolLocked;
@ -34,8 +38,10 @@ const tools: Array<{
type: string; type: string;
label?: string; label?: string;
tooltip?: string; tooltip?: string;
icon?: FC; icon?: ComponentType<
component?: FC<{ app: TldrawApp }>; SelectIconProps | EraserIconProps | HandToolIconProps | TextIconProps
>;
component?: ComponentType<{ app: TldrawApp }>;
}> = [ }> = [
{ {
type: 'select', type: 'select',

View File

@ -1,4 +1,4 @@
import type { FC, ReactNode } from 'react'; import type { ReactNode } from 'react';
import { Tooltip, styled, IconButton } from '@toeverything/components/ui'; import { Tooltip, styled, IconButton } from '@toeverything/components/ui';
interface PenProps { interface PenProps {

View File

@ -1,4 +1,4 @@
import { FC, ReactElement, type CSSProperties } from 'react'; import { ReactElement, type CSSProperties } from 'react';
import style9 from 'style9'; import style9 from 'style9';
import { import {
MuiDivider as Divider, MuiDivider as Divider,

View File

@ -1,4 +1,3 @@
import { FC } from 'react';
import { import {
MuiIconButton as IconButton, MuiIconButton as IconButton,
MuiButton as Button, MuiButton as Button,

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import { Utils } from '@tldraw/core'; import { Utils } from '@tldraw/core';
import Vec from '@tldraw/vec'; import Vec from '@tldraw/vec';
import { TLDR } from '@toeverything/components/board-state'; import { TLDR } from '@toeverything/components/board-state';

View File

@ -1,4 +1,4 @@
import type { FC, CSSProperties } from 'react'; import type { CSSProperties } from 'react';
import type { TLBounds } from '@tldraw/core'; import type { TLBounds } from '@tldraw/core';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';

View File

@ -1,4 +1,4 @@
import type { FC, CSSProperties, PointerEventHandler } from 'react'; import type { CSSProperties, PointerEventHandler } from 'react';
import { useState, useRef } from 'react'; import { useState, useRef } from 'react';
import type { TLBounds } from '@tldraw/core'; import type { TLBounds } from '@tldraw/core';
import Vec from '@tldraw/vec'; import Vec from '@tldraw/vec';

View File

@ -1,4 +1,4 @@
import { FC, useState } from 'react'; import { useState } from 'react';
import { useNavigate } from 'react-router'; import { useNavigate } from 'react-router';
import clsx from 'clsx'; import clsx from 'clsx';
import style9 from 'style9'; import style9 from 'style9';
@ -21,7 +21,7 @@ export const commonListContainer = 'commonListContainer';
type Content = { type Content = {
id: string; id: string;
content: string; content: string;
icon: FC<SvgIconProps>; icon: (prop: SvgIconProps) => JSX.Element;
}; };
export type CommonListItem = { export type CommonListItem = {

View File

@ -5,7 +5,7 @@ import {
Protocol, Protocol,
} from '@toeverything/datasource/db-service'; } from '@toeverything/datasource/db-service';
import { type CreateView } from '@toeverything/framework/virgo'; import { type CreateView } from '@toeverything/framework/virgo';
import { useEffect, useRef, useState, type FC } from 'react'; import { useEffect, useRef, useState } from 'react';
import { import {
TextManage, TextManage,

View File

@ -1,4 +1,4 @@
import { FC, useState, useRef, useEffect } from 'react'; import { useState, useRef, useEffect } from 'react';
import { StyleWithAtRules } from 'style9'; import { StyleWithAtRules } from 'style9';
import { CreateView } from '@toeverything/framework/virgo'; import { CreateView } from '@toeverything/framework/virgo';

View File

@ -1,4 +1,4 @@
import { FC, useState } from 'react'; import { useState } from 'react';
import { CreateView } from '@toeverything/framework/virgo'; import { CreateView } from '@toeverything/framework/virgo';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import { useOnSelect } from '@toeverything/components/editor-core'; import { useOnSelect } from '@toeverything/components/editor-core';

View File

@ -1,4 +1,4 @@
import { FC, useState } from 'react'; import { useState } from 'react';
import { CreateView } from '@toeverything/framework/virgo'; import { CreateView } from '@toeverything/framework/virgo';
import { import {
BlockPendantProvider, BlockPendantProvider,

View File

@ -1,4 +1,4 @@
import { FC, useState } from 'react'; import { useState } from 'react';
import { CreateView } from '@toeverything/framework/virgo'; import { CreateView } from '@toeverything/framework/virgo';
import { import {
useOnSelect, useOnSelect,

View File

@ -1,4 +1,4 @@
import { FC, useState, useEffect, useRef } from 'react'; import { useState, useEffect, useRef } from 'react';
import { CreateView } from '@toeverything/framework/virgo'; import { CreateView } from '@toeverything/framework/virgo';
import { Upload } from '../../components/upload/upload'; import { Upload } from '../../components/upload/upload';
import { services, FileColumnValue } from '@toeverything/datasource/db-service'; import { services, FileColumnValue } from '@toeverything/datasource/db-service';

View File

@ -1,4 +1,4 @@
import { FC, useEffect, useLayoutEffect, useRef } from 'react'; import { useEffect, useLayoutEffect, useRef } from 'react';
import { ChildrenView } from '@toeverything/framework/virgo'; import { ChildrenView } from '@toeverything/framework/virgo';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import { sleep } from '@toeverything/utils'; import { sleep } from '@toeverything/utils';

View File

@ -1,8 +1,9 @@
import { FC } from 'react';
import { RenderBlock } from '@toeverything/components/editor-core'; import { RenderBlock } from '@toeverything/components/editor-core';
import { ChildrenView, CreateView } from '@toeverything/framework/virgo'; import { ChildrenView, CreateView } from '@toeverything/framework/virgo';
export const GridItemRender = function (creator: FC<ChildrenView>) { export const GridItemRender = function (
creator: (prop: ChildrenView) => JSX.Element
) {
const GridItem = function (props: CreateView) { const GridItem = function (props: CreateView) {
const { block } = props; const { block } = props;
const children = ( const children = (

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import { useState } from 'react'; import { useState } from 'react';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import { BlockEditor } from '@toeverything/framework/virgo'; import { BlockEditor } from '@toeverything/framework/virgo';

View File

@ -1,6 +1,6 @@
import { RenderBlock } from '@toeverything/components/editor-core'; import { RenderBlock } from '@toeverything/components/editor-core';
import { CreateView } from '@toeverything/framework/virgo'; import { CreateView } from '@toeverything/framework/virgo';
import React, { FC, useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import { GridHandle } from './GirdHandle'; import { GridHandle } from './GirdHandle';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';

View File

@ -1,8 +1,7 @@
import { FC } from 'react';
import { CreateView } from '@toeverything/framework/virgo'; import { CreateView } from '@toeverything/framework/virgo';
import { BlockContainer } from '../../components/BlockContainer'; import { BlockContainer } from '../../components/BlockContainer';
export function GridRender(creator: FC<CreateView>) { export function GridRender(creator: (prop: CreateView) => JSX.Element) {
return function GridWithItem(props: CreateView) { return function GridWithItem(props: CreateView) {
const { editor, block } = props; const { editor, block } = props;
return ( return (

View File

@ -8,7 +8,7 @@ import {
} from '@toeverything/components/editor-core'; } from '@toeverything/components/editor-core';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import type { CreateView } from '@toeverything/framework/virgo'; import type { CreateView } from '@toeverything/framework/virgo';
import type { ComponentType, FC } from 'react'; import type { ComponentType } from 'react';
import { useState } from 'react'; import { useState } from 'react';
import { GroupMenuWrapper } from './group-menu'; import { GroupMenuWrapper } from './group-menu';
import { SceneKanban } from './scene-kanban'; import { SceneKanban } from './scene-kanban';

View File

@ -1,6 +1,5 @@
import { RenderBlockChildren } from '@toeverything/components/editor-core'; import { RenderBlockChildren } from '@toeverything/components/editor-core';
import type { CreateView } from '@toeverything/framework/virgo'; import type { CreateView } from '@toeverything/framework/virgo';
import { FC } from 'react';
export const ScenePage = ({ block }: CreateView) => { export const ScenePage = ({ block }: CreateView) => {
return <RenderBlockChildren block={block} />; return <RenderBlockChildren block={block} />;

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import { useState, useMemo, useEffect } from 'react'; import { useState, useMemo, useEffect } from 'react';
import type { DefaultColumnsValue } from '@toeverything/datasource/db-service'; import type { DefaultColumnsValue } from '@toeverything/datasource/db-service';
import type { CreateView } from '@toeverything/framework/virgo'; import type { CreateView } from '@toeverything/framework/virgo';

View File

@ -1,9 +1,9 @@
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import type { FC } from 'react';
import type { SvgIconProps } from '@toeverything/components/ui'; import type { SvgIconProps } from '@toeverything/components/ui';
interface Props { interface Props {
Icon: FC<SvgIconProps>; Icon: (prop: SvgIconProps) => JSX.Element;
text?: string; text?: string;
onClick: () => void; onClick: () => void;
} }

View File

@ -1,4 +1,3 @@
import { FC } from 'react';
import { CreateView } from '@toeverything/framework/virgo'; import { CreateView } from '@toeverything/framework/virgo';
export const GroupDividerView = ({ block, editor }: CreateView) => { export const GroupDividerView = ({ block, editor }: CreateView) => {

View File

@ -6,7 +6,7 @@ import {
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import { services } from '@toeverything/datasource/db-service'; import { services } from '@toeverything/datasource/db-service';
import { CreateView } from '@toeverything/framework/virgo'; import { CreateView } from '@toeverything/framework/virgo';
import { FC, useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import { Image as SourceView } from '../../components/ImageView'; import { Image as SourceView } from '../../components/ImageView';
import { Upload } from '../../components/upload/upload'; import { Upload } from '../../components/upload/upload';
import { SCENE_CONFIG } from '../group/config'; import { SCENE_CONFIG } from '../group/config';

View File

@ -5,7 +5,7 @@ import {
Protocol, Protocol,
} from '@toeverything/datasource/db-service'; } from '@toeverything/datasource/db-service';
import { type CreateView } from '@toeverything/framework/virgo'; import { type CreateView } from '@toeverything/framework/virgo';
import { useEffect, useRef, useState, type FC } from 'react'; import { useEffect, useRef, useState } from 'react';
import { import {
TextManage, TextManage,
type ExtendedTextUtils, type ExtendedTextUtils,

View File

@ -1,4 +1,4 @@
import { FC, useRef, useEffect, useMemo, useState } from 'react'; import { useRef, useEffect, useMemo, useState } from 'react';
import { useParams } from 'react-router'; import { useParams } from 'react-router';
import { BackLink, TextProps } from '@toeverything/components/common'; import { BackLink, TextProps } from '@toeverything/components/common';

View File

@ -13,9 +13,9 @@ import {
} from '@toeverything/framework/virgo'; } from '@toeverything/framework/virgo';
import { PageView } from './PageView'; import { PageView } from './PageView';
import { ComponentType, FC } from 'react';
export const PageChildrenView: FC<ChildrenView> = props => props.children; export const PageChildrenView: (prop: ChildrenView) => JSX.Element = props =>
props.children;
export class PageBlock extends BaseView { export class PageBlock extends BaseView {
type = Protocol.Block.Type.page; type = Protocol.Block.Type.page;

View File

@ -1,4 +1,4 @@
import { FC, useEffect, useMemo, useState } from 'react'; import { useEffect, useMemo, useState } from 'react';
import { InlineRefLink } from '@toeverything/components/common'; import { InlineRefLink } from '@toeverything/components/common';
import { CreateView } from '@toeverything/framework/virgo'; import { CreateView } from '@toeverything/framework/virgo';

View File

@ -10,13 +10,13 @@ import {
getTextProperties, getTextProperties,
SelectBlock, SelectBlock,
} from '@toeverything/framework/virgo'; } from '@toeverything/framework/virgo';
import { FC } from 'react';
import { TextView } from './TextView'; import { TextView } from './TextView';
export class QuoteBlock extends BaseView { export class QuoteBlock extends BaseView {
type = Protocol.Block.Type.quote; type = Protocol.Block.Type.quote;
View: FC<CreateView> = TextView; View: (prop: CreateView) => JSX.Element = TextView;
// override ChildrenView = IndentWrapper; // override ChildrenView = IndentWrapper;
@ -83,7 +83,7 @@ export class QuoteBlock extends BaseView {
export class CalloutBlock extends BaseView { export class CalloutBlock extends BaseView {
type = Protocol.Block.Type.callout; type = Protocol.Block.Type.callout;
View: FC<CreateView> = TextView; View: (prop: CreateView) => JSX.Element = TextView;
// override ChildrenView = IndentWrapper; // override ChildrenView = IndentWrapper;

View File

@ -11,13 +11,13 @@ import {
Protocol, Protocol,
} from '@toeverything/datasource/db-service'; } from '@toeverything/datasource/db-service';
import { TextView } from './TextView'; import { TextView } from './TextView';
import { FC } from 'react';
import { getRandomString } from '@toeverything/components/common'; import { getRandomString } from '@toeverything/components/common';
export class TextBlock extends BaseView { export class TextBlock extends BaseView {
type = Protocol.Block.Type.text; type = Protocol.Block.Type.text;
View: FC<CreateView> = TextView; View: (prop: CreateView) => JSX.Element = TextView;
override async onCreate(block: AsyncBlock): Promise<AsyncBlock> { override async onCreate(block: AsyncBlock): Promise<AsyncBlock> {
if (!block.getProperty('text')) { if (!block.getProperty('text')) {
@ -134,7 +134,7 @@ export class TextBlock extends BaseView {
export class Heading1Block extends BaseView { export class Heading1Block extends BaseView {
type = Protocol.Block.Type.heading1; type = Protocol.Block.Type.heading1;
View: FC<CreateView> = TextView; View: (prop: CreateView) => JSX.Element = TextView;
override async onCreate(block: AsyncBlock): Promise<AsyncBlock> { override async onCreate(block: AsyncBlock): Promise<AsyncBlock> {
if (!block.getProperty('text')) { if (!block.getProperty('text')) {
@ -199,7 +199,7 @@ export class Heading1Block extends BaseView {
export class Heading2Block extends BaseView { export class Heading2Block extends BaseView {
type = Protocol.Block.Type.heading2; type = Protocol.Block.Type.heading2;
View: FC<CreateView> = TextView; View: (prop: CreateView) => JSX.Element = TextView;
override async onCreate(block: AsyncBlock): Promise<AsyncBlock> { override async onCreate(block: AsyncBlock): Promise<AsyncBlock> {
if (!block.getProperty('text')) { if (!block.getProperty('text')) {
@ -264,7 +264,7 @@ export class Heading2Block extends BaseView {
export class Heading3Block extends BaseView { export class Heading3Block extends BaseView {
type = Protocol.Block.Type.heading3; type = Protocol.Block.Type.heading3;
View: FC<CreateView> = TextView; View: (prop: CreateView) => JSX.Element = TextView;
override async onCreate(block: AsyncBlock): Promise<AsyncBlock> { override async onCreate(block: AsyncBlock): Promise<AsyncBlock> {
if (!block.getProperty('text')) { if (!block.getProperty('text')) {

View File

@ -1,4 +1,4 @@
import { FC, useState } from 'react'; import { useState } from 'react';
import { CustomText, TextProps } from '@toeverything/components/common'; import { CustomText, TextProps } from '@toeverything/components/common';
import { import {

View File

@ -1,4 +1,4 @@
import { FC, useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { CreateView } from '@toeverything/framework/virgo'; import { CreateView } from '@toeverything/framework/virgo';
import { import {
is_heading_child_type, is_heading_child_type,

View File

@ -1,5 +1,5 @@
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import { FC, useMemo } from 'react'; import { useMemo } from 'react';
interface CheckBoxProps { interface CheckBoxProps {
size?: number; size?: number;

View File

@ -5,7 +5,7 @@ import {
Protocol, Protocol,
} from '@toeverything/datasource/db-service'; } from '@toeverything/datasource/db-service';
import { AsyncBlock, type CreateView } from '@toeverything/framework/virgo'; import { AsyncBlock, type CreateView } from '@toeverything/framework/virgo';
import { useRef, type FC } from 'react'; import { useRef } from 'react';
import { import {
TextManage, TextManage,
type ExtendedTextUtils, type ExtendedTextUtils,

View File

@ -1,4 +1,4 @@
import { FC, useState } from 'react'; import { useState } from 'react';
import { CreateView } from '@toeverything/framework/virgo'; import { CreateView } from '@toeverything/framework/virgo';
import { Upload } from '../../components/upload/upload'; import { Upload } from '../../components/upload/upload';
import { SourceView } from '../../components/source-view'; import { SourceView } from '../../components/source-view';

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import { AsyncBlock, BlockEditor } from '@toeverything/framework/virgo'; import { AsyncBlock, BlockEditor } from '@toeverything/framework/virgo';

View File

@ -1,5 +1,5 @@
import { AsyncBlock } from '@toeverything/framework/virgo'; import { AsyncBlock } from '@toeverything/framework/virgo';
import { FC } from 'react';
import { ResizableBox } from 'react-resizable'; import { ResizableBox } from 'react-resizable';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';

View File

@ -1,4 +1,4 @@
import { FC, PropsWithChildren } from 'react'; import { PropsWithChildren } from 'react';
import { ChildrenView } from '@toeverything/framework/virgo'; import { ChildrenView } from '@toeverything/framework/virgo';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';

View File

@ -1,4 +1,4 @@
import { FC, useMemo } from 'react'; import { useMemo } from 'react';
import { createEditor } from 'slate'; import { createEditor } from 'slate';
import { Slate, Editable as SlateEditable, withReact } from 'slate-react'; import { Slate, Editable as SlateEditable, withReact } from 'slate-react';
import { ErrorBoundary } from '@toeverything/utils'; import { ErrorBoundary } from '@toeverything/utils';

View File

@ -4,14 +4,7 @@ import {
useLazyIframe, useLazyIframe,
} from '@toeverything/components/editor-core'; } from '@toeverything/components/editor-core';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import { import { ReactElement, ReactNode, useEffect, useRef, useState } from 'react';
FC,
ReactElement,
ReactNode,
useEffect,
useRef,
useState,
} from 'react';
import { SCENE_CONFIG } from '../../blocks/group/config'; import { SCENE_CONFIG } from '../../blocks/group/config';
import { BlockPreview } from './BlockView'; import { BlockPreview } from './BlockView';
import { formatUrl } from './format-url'; import { formatUrl } from './format-url';

View File

@ -6,7 +6,7 @@ import {
useLayoutEffect, useLayoutEffect,
useCallback, useCallback,
} from 'react'; } from 'react';
import type { FC } from 'react';
import { VariableSizeGrid, areEqual } from 'react-window'; import { VariableSizeGrid, areEqual } from 'react-window';
import type { import type {
GridChildComponentProps, GridChildComponentProps,
@ -34,7 +34,7 @@ export interface CustomCellProps<T = unknown> {
value: T; value: T;
valueKey: string; valueKey: string;
} }
export type CustomCell<T = unknown> = FC<CustomCellProps<T>>; export type CustomCell<T = unknown> = (prop: CustomCellProps<T>) => JSX.Element;
interface TableData { interface TableData {
columns: readonly TableColumn[]; columns: readonly TableColumn[];

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import { Checkbox } from '@toeverything/components/ui'; import { Checkbox } from '@toeverything/components/ui';
import type { BooleanColumnValue } from '@toeverything/datasource/db-service'; import type { BooleanColumnValue } from '@toeverything/datasource/db-service';
import type { CellProps } from '../types'; import type { CellProps } from '../types';

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import { ColumnType } from '@toeverything/datasource/db-service'; import { ColumnType } from '@toeverything/datasource/db-service';
import type { CustomCellProps as TableCustomCellProps } from '../basic-table'; import type { CustomCellProps as TableCustomCellProps } from '../basic-table';
import { DEFAULT_RENDER_CELL } from '../basic-table'; import { DEFAULT_RENDER_CELL } from '../basic-table';
@ -16,7 +15,7 @@ const DefaultCell = ({ onChange, ...props }: CellProps) => {
/** /**
* @deprecated * @deprecated
*/ */
const cellMap: Record<ColumnType, FC<CellProps<any>>> = { const cellMap: Record<ColumnType, (prop: CellProps<any>) => JSX.Element> = {
[ColumnType.content]: DefaultCell, [ColumnType.content]: DefaultCell,
[ColumnType.number]: DefaultCell, [ColumnType.number]: DefaultCell,
[ColumnType.enum]: SelectCell, [ColumnType.enum]: SelectCell,

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import { useMemo } from 'react'; import { useMemo } from 'react';
import { OldSelect } from '@toeverything/components/ui'; import { OldSelect } from '@toeverything/components/ui';
import type { EnumColumnValue } from '@toeverything/datasource/db-service'; import type { EnumColumnValue } from '@toeverything/datasource/db-service';

View File

@ -1,4 +1,4 @@
import type { FC, ReactNode } from 'react'; import type { ReactNode } from 'react';
import { BasicTable } from './basic-table'; import { BasicTable } from './basic-table';
import type { BasicTableProps } from './basic-table'; import type { BasicTableProps } from './basic-table';

View File

@ -1,5 +1,4 @@
import { import {
FC,
useRef, useRef,
ChangeEvent, ChangeEvent,
ReactElement, ReactElement,

View File

@ -1,4 +1,4 @@
import type { FC, PropsWithChildren } from 'react'; import type { PropsWithChildren } from 'react';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import type { AsyncBlock } from '../editor'; import type { AsyncBlock } from '../editor';
import { PendantPopover } from './pendant-popover'; import { PendantPopover } from './pendant-popover';

View File

@ -1,4 +1,4 @@
import { FC, useRef } from 'react'; import { useRef } from 'react';
import { AsyncBlock } from '../../editor'; import { AsyncBlock } from '../../editor';
import { PendantHistoryPanel } from '../pendant-history-panel'; import { PendantHistoryPanel } from '../pendant-history-panel';
import { import {

View File

@ -4,7 +4,6 @@ import {
SelectOption, SelectOption,
SelectOptionId, SelectOptionId,
} from '../recast-block'; } from '../recast-block';
import { FunctionComponent } from 'react';
import { TextFontIcon } from '@toeverything/components/icons'; import { TextFontIcon } from '@toeverything/components/icons';
export { PropertyType as PendantTypes } from '../recast-block'; export { PropertyType as PendantTypes } from '../recast-block';

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import type { AsyncBlock } from '../editor'; import type { AsyncBlock } from '../editor';
import { RenderBlock } from './RenderBlock'; import { RenderBlock } from './RenderBlock';

View File

@ -1,4 +1,4 @@
import { useCallback, type FC, type MouseEvent } from 'react'; import { useCallback, type MouseEvent } from 'react';
import { import {
styled, styled,
Tooltip, Tooltip,
@ -83,7 +83,7 @@ export const AddCommentActions = ({
}; };
type IconButtonWithTooltipProps = { type IconButtonWithTooltipProps = {
icon: FC<SvgIconProps>; icon: (prop: SvgIconProps) => JSX.Element;
tooltip?: string; tooltip?: string;
}; };

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import { import {
HeadingOneIcon, HeadingOneIcon,
HeadingTwoIcon, HeadingTwoIcon,
@ -40,7 +39,7 @@ type ClickItemHandler = (
export type CommandMenuDataType = { export type CommandMenuDataType = {
type: BlockFlavorKeys; type: BlockFlavorKeys;
text: string; text: string;
icon: FC<SvgIconProps>; icon: (prop: SvgIconProps) => JSX.Element;
}; };
export const commonCommandMenuHandler: ClickItemHandler = async ( export const commonCommandMenuHandler: ClickItemHandler = async (

View File

@ -135,7 +135,9 @@ export const MenuDropdownItem = ({
); );
}; };
const withStylesForIcon = (FontIconComponent: React.FC<SvgIconProps>) => const withStylesForIcon = (
FontIconComponent: (prop: SvgIconProps) => JSX.Element
) =>
styled(FontIconComponent, { styled(FontIconComponent, {
shouldForwardProp: (prop: string) => shouldForwardProp: (prop: string) =>
!['fontColor', 'fontBgColor'].includes(prop), !['fontColor', 'fontBgColor'].includes(prop),

View File

@ -1,4 +1,3 @@
import React, { type FC } from 'react';
import type { SvgIconProps } from '@toeverything/components/ui'; import type { SvgIconProps } from '@toeverything/components/ui';
import type { Virgo, SelectionInfo } from '@toeverything/framework/virgo'; import type { Virgo, SelectionInfo } from '@toeverything/framework/virgo';
import { inlineMenuNames, INLINE_MENU_UI_TYPES } from './config'; import { inlineMenuNames, INLINE_MENU_UI_TYPES } from './config';
@ -23,7 +22,7 @@ export type ClickItemHandler = ({
export type IconItemType = { export type IconItemType = {
type: typeof INLINE_MENU_UI_TYPES['icon']; type: typeof INLINE_MENU_UI_TYPES['icon'];
icon: FC<SvgIconProps>; icon: (prop: SvgIconProps) => JSX.Element;
nameKey: InlineMenuNamesType; nameKey: InlineMenuNamesType;
name: typeof inlineMenuNames[InlineMenuNamesType]; name: typeof inlineMenuNames[InlineMenuNamesType];
onClick?: ClickItemHandler; onClick?: ClickItemHandler;
@ -32,7 +31,7 @@ export type IconItemType = {
export type DropdownItemType = { export type DropdownItemType = {
type: typeof INLINE_MENU_UI_TYPES['dropdown']; type: typeof INLINE_MENU_UI_TYPES['dropdown'];
icon: FC<SvgIconProps>; icon: (prop: SvgIconProps) => JSX.Element;
nameKey: InlineMenuNamesType; nameKey: InlineMenuNamesType;
name: typeof inlineMenuNames[InlineMenuNamesType]; name: typeof inlineMenuNames[InlineMenuNamesType];
children: IconItemType[]; children: IconItemType[];

View File

@ -1,7 +1,6 @@
import { import {
useState, useState,
useEffect, useEffect,
FC,
type MouseEvent, type MouseEvent,
type DragEvent, type DragEvent,
type ReactNode, type ReactNode,

View File

@ -1,4 +1,4 @@
export const timestamp = 1660239514133; export const timestamp = 1660270988401;
export * from './image/image'; export * from './image/image';
export * from './format-clear/format-clear'; export * from './format-clear/format-clear';
export * from './backward-undo/backward-undo'; export * from './backward-undo/backward-undo';

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import type { DocMode } from './type'; import type { DocMode } from './type';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import { StatusIcon } from './StatusIcon'; import { StatusIcon } from './StatusIcon';

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import { LastModified } from './LastModified'; import { LastModified } from './LastModified';
import { Logout } from './Logout'; import { Logout } from './Logout';

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import format from 'date-fns/format'; import format from 'date-fns/format';
import { Typography, styled } from '@toeverything/components/ui'; import { Typography, styled } from '@toeverything/components/ui';
import { useUserAndSpaces } from '@toeverything/datasource/state'; import { useUserAndSpaces } from '@toeverything/datasource/state';

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import { MoveToIcon } from '@toeverything/components/icons'; import { MoveToIcon } from '@toeverything/components/icons';
import { import {
ListItem, ListItem,

View File

@ -1,5 +1,4 @@
import type { import type {
FC,
MouseEventHandler, MouseEventHandler,
CSSProperties, CSSProperties,
PropsWithChildren, PropsWithChildren,

View File

@ -41,7 +41,7 @@ type ListButtonProps = {
content?: string; content?: string;
children?: () => JSX.Element; children?: () => JSX.Element;
hover?: boolean; hover?: boolean;
icon?: React.FC<SvgIconProps>; icon?: (prop: SvgIconProps) => JSX.Element;
}; };
export const ListButton = (props: ListButtonProps) => { export const ListButton = (props: ListButtonProps) => {

View File

@ -1,4 +1,4 @@
import type { FC, ReactNode, CSSProperties } from 'react'; import type { ReactNode, CSSProperties } from 'react';
import { styled } from '../styled'; import { styled } from '../styled';
import { MuiDivider } from '../mui'; import { MuiDivider } from '../mui';
import type { MuiDividerProps } from '../mui'; import type { MuiDividerProps } from '../mui';

View File

@ -1,4 +1,4 @@
import type { FC, PropsWithChildren, CSSProperties } from 'react'; import type { PropsWithChildren, CSSProperties } from 'react';
import { Clickable } from '../clickable'; import { Clickable } from '../clickable';
import { styled } from '../styled'; import { styled } from '../styled';

View File

@ -1,6 +1,6 @@
import { useCallback } from 'react'; import { useCallback } from 'react';
import { styled } from '../styled'; import { styled } from '../styled';
import type { FC, CSSProperties, ChangeEvent } from 'react'; import type { CSSProperties, ChangeEvent } from 'react';
/** /**
* WARNING: This component is about to be deprecated, use Select replace * WARNING: This component is about to be deprecated, use Select replace

View File

@ -1,4 +1,3 @@
import type { FC } from 'react';
import { SliderUnstyled, sliderUnstyledClasses } from '@mui/base'; import { SliderUnstyled, sliderUnstyledClasses } from '@mui/base';
import type { SliderUnstyledProps } from '@mui/base'; import type { SliderUnstyledProps } from '@mui/base';
import { alpha } from '@mui/system'; import { alpha } from '@mui/system';

View File

@ -1,5 +1,4 @@
import type { import type {
FC,
ChangeEventHandler, ChangeEventHandler,
PropsWithChildren, PropsWithChildren,
CSSProperties, CSSProperties,

View File

@ -1,4 +1,4 @@
import type { FC, PropsWithChildren, ReactNode } from 'react'; import type { PropsWithChildren, ReactNode } from 'react';
// eslint-disable-next-line no-restricted-imports // eslint-disable-next-line no-restricted-imports
import { import {
createTheme, createTheme,
@ -30,8 +30,8 @@ export const ThemeProvider = ({ children }: { children?: ReactNode }) => {
export const useTheme = () => muiUseTheme(); export const useTheme = () => muiUseTheme();
export const withTheme = <T,>( export const withTheme = <T,>(
Component: FC<T & { theme: MuiTheme }> Component: (prop: T & { theme: MuiTheme }) => JSX.Element
): FC<T> => { ): ((prop: T) => JSX.Element) => {
return props => { return props => {
const theme = useTheme(); const theme = useTheme();
return <Component {...props} theme={theme} />; return <Component {...props} theme={theme} />;

View File

@ -11,8 +11,8 @@
{ {
"id": "wusZ8Qht8rsmFD1s", "id": "wusZ8Qht8rsmFD1s",
"name": "No Started", "name": "No Started",
"color": "#05683D", "color": "#AF1212",
"background": "#C5FBE0", "background": "#FFCECE",
"iconName": "status" "iconName": "status"
}, },
{ {
@ -25,8 +25,8 @@
{ {
"id": "u0ZgY0sRCnqMkxzn", "id": "u0ZgY0sRCnqMkxzn",
"name": "Complete", "name": "Complete",
"color": "#AF1212", "color": "#05683D",
"background": "#FFCECE", "background": "#C5FBE0",
"iconName": "status" "iconName": "status"
} }
] ]

View File

@ -24,10 +24,7 @@ interface ErrorBoundaryPropsWithComponent {
declare function FallbackRender( declare function FallbackRender(
props: FallbackProps props: FallbackProps
): React.ReactElement< ): React.ReactElement<unknown, string | typeof React.Component> | null;
unknown,
string | React.FunctionComponent | typeof React.Component
> | null;
interface ErrorBoundaryPropsWithRender { interface ErrorBoundaryPropsWithRender {
onResetKeysChange?: ( onResetKeysChange?: (
@ -52,7 +49,7 @@ interface ErrorBoundaryPropsWithFallback {
resetKeys?: Array<unknown>; resetKeys?: Array<unknown>;
fallback: React.ReactElement< fallback: React.ReactElement<
unknown, unknown,
string | React.FunctionComponent | typeof React.Component string | typeof React.Component
> | null; > | null;
FallbackComponent?: never; FallbackComponent?: never;
fallbackRender?: never; fallbackRender?: never;

View File

@ -84,9 +84,8 @@ async function getJSXContent(name, svgCode) {
} }
let matcher = svgrContent.match(/<svg ([^\>]+)>([\s\S]*?)<\/svg>/); let matcher = svgrContent.match(/<svg ([^\>]+)>([\s\S]*?)<\/svg>/);
return ` return `
import { FC } from 'react';
import { SvgIcon, SvgIconProps } from '@mui/material'; import { SvgIcon, SvgIconProps } from '@mui/material';
export const ${name}Icon: FC<SvgIconProps> = (props) => ( export const ${name}Icon = (props: SvgIconProps) => (
<SvgIcon ${matcher[1]}> <SvgIcon ${matcher[1]}>
${matcher[2]} ${matcher[2]}
</SvgIcon> </SvgIcon>