chore: sort imports

This commit is contained in:
DarkSky committed 2022-08-13 02:45:04 +08:00
1 parent 617f9b9bfc
commit 5462b1707f
83 files changed
+343 -1481

No files matched your search

@@ -1,4 +1,4 @@
import { getTitle, getBoard } from '../support/app.po'; import { getBoard, getTitle } from '../support/app.po';
describe('ligo-virgo', () => { describe('ligo-virgo', () => {
beforeEach(() => cy.visit('/')); beforeEach(() => cy.visit('/'));
+1 -4
View File
@@ -3,10 +3,7 @@
"version": "0.0.1", "version": "0.0.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@authing/react-ui-components": "^3.1.39",
"@emotion/styled": "^11.9.3" "@emotion/styled": "^11.9.3"
}, },
"devDependencies": { "devDependencies": {}
"authing-js-sdk": "^4.23.35"
}
} }
+1 -4
View File
@@ -1,10 +1,7 @@
import { Link } from 'react-router-dom';
import style9 from 'style9'; import style9 from 'style9';
import { getAuth, signOut } from 'firebase/auth';
import { MuiBox as Box } from '@toeverything/components/ui';
import { keyframes } from '@emotion/react'; import { keyframes } from '@emotion/react';
import { LOGOUT_LOCAL_STORAGE, LOGOUT_COOKIES } from '@toeverything/utils'; import { MuiBox as Box } from '@toeverything/components/ui';
const styles = style9.create({ const styles = style9.create({
container: { container: {
+1 -1
View File
@@ -1,3 +1,3 @@
export { Login } from './login';
export { Error } from './error'; export { Error } from './error';
export { PageLoading } from './loading'; export { PageLoading } from './loading';
export { Login } from './login';
+1 -1
View File
@@ -1,5 +1,5 @@
import style9 from 'style9';
import { MuiCircularProgress as CircularProgress } from '@toeverything/components/ui'; import { MuiCircularProgress as CircularProgress } from '@toeverything/components/ui';
import style9 from 'style9';
const styles = style9.create({ const styles = style9.create({
container: { container: {
@@ -1,74 +0,0 @@
import { Guard as AuthingGuard } from '@authing/react-ui-components';
import { MuiBox as Box } from '@toeverything/components/ui';
import type { User as AuthingUser } from 'authing-js-sdk';
import { useCallback, useEffect, useMemo } from 'react';
import { useNavigate } from 'react-router-dom';
import style9 from 'style9';
import { useUserAndSpaces } from '@toeverything/datasource/state';
import { AUTHING_APP_HOST_US, AUTHING_APP_ID_US } from '@toeverything/utils';
import '@authing/react-ui-components/lib/index.min.css';
export function Authing() {
const navigate = useNavigate();
const { handleUserLoginSuccess, currentSpaceId } = useUserAndSpaces();
/**
* Refer to Authing documentation https://docs.authing.cn/v2/reference/guard/react.html
*/
const handle_login_success = useCallback(
async (authingUser: AuthingUser) => {
handleUserLoginSuccess(authingUser);
},
[handleUserLoginSuccess]
);
const authing_config = useMemo(() => {
return {
host: AUTHING_APP_HOST_US,
};
}, []);
useEffect(() => {
if (currentSpaceId) {
const targetRoute = `/${currentSpaceId}`;
navigate(targetRoute);
}
}, [currentSpaceId, navigate]);
return (
<div className={styles('loginContainer')}>
<Box
sx={{
'.g2-view-header': {
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
},
'.authing-g2-render-module': {
boxShadow: '0 2px 10px 0 rgb(57 106 255 / 20%)',
},
}}
>
<AuthingGuard
onLogin={handle_login_success}
appId={AUTHING_APP_ID_US}
config={authing_config}
/>
<Box sx={{ height: '56px' }} />
</Box>
</div>
);
}
const styles = style9.create({
loginContainer: {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
width: '100%',
height: 'calc( 100vh - 64px )',
},
});
+10 -10
View File
@@ -1,15 +1,15 @@
import { useEffect, useState } from 'react';
import { Tldraw } from '@toeverything/components/board-draw';
import { tools } from '@toeverything/components/board-tools';
import { getSession } from '@toeverything/components/board-sessions';
import * as commands from '@toeverything/components/board-commands';
import { TldrawApp, deepCopy } from '@toeverything/components/board-state';
import { TDShapeType } from '@toeverything/components/board-types';
import { services } from '@toeverything/datasource/db-service';
import { useShapes } from './hooks';
import { RecastBlockProvider } from '@toeverything/components/editor-core';
import { createEditor } from '@toeverything/components/affine-editor'; import { createEditor } from '@toeverything/components/affine-editor';
import * as commands from '@toeverything/components/board-commands';
import { Tldraw } from '@toeverything/components/board-draw';
import { getSession } from '@toeverything/components/board-sessions';
import { deepCopy, TldrawApp } from '@toeverything/components/board-state';
import { tools } from '@toeverything/components/board-tools';
import { TDShapeType } from '@toeverything/components/board-types';
import { RecastBlockProvider } from '@toeverything/components/editor-core';
import { services } from '@toeverything/datasource/db-service';
import { AsyncBlock, BlockEditor } from '@toeverything/framework/virgo'; import { AsyncBlock, BlockEditor } from '@toeverything/framework/virgo';
import { useEffect, useState } from 'react';
import { useShapes } from './hooks';
interface AffineBoardProps { interface AffineBoardProps {
workspace: string; workspace: string;
@@ -1,9 +1,9 @@
import { useEffect, useState } from 'react';
import { services } from '@toeverything/datasource/db-service';
import type { ReturnEditorBlock } from '@toeverything/datasource/db-service';
import type { TDShape } from '@toeverything/components/board-types';
import { Editor } from '@toeverything/components/board-shapes'; import { Editor } from '@toeverything/components/board-shapes';
import type { TDShape } from '@toeverything/components/board-types';
import type { ReturnEditorBlock } from '@toeverything/datasource/db-service';
import { services } from '@toeverything/datasource/db-service';
import { usePageClientWidth } from '@toeverything/datasource/state'; import { usePageClientWidth } from '@toeverything/datasource/state';
import { useEffect, useState } from 'react';
export const useShapes = (workspace: string, rootBlockId: string) => { export const useShapes = (workspace: string, rootBlockId: string) => {
const { pageClientWidth } = usePageClientWidth(); const { pageClientWidth } = usePageClientWidth();
+1 -1
View File
@@ -1,8 +1,8 @@
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react'; import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
import { import {
RenderRoot,
RenderBlock, RenderBlock,
RenderRoot,
type BlockEditor, type BlockEditor,
} from '@toeverything/components/editor-core'; } from '@toeverything/components/editor-core';
import { useCurrentEditors } from '@toeverything/datasource/state'; import { useCurrentEditors } from '@toeverything/datasource/state';
@@ -1,31 +1,31 @@
import { BlockEditor } from '@toeverything/framework/virgo';
import { import {
PageBlock, BulletBlock,
RefLinkBlock, CalloutBlock,
TextBlock, CodeBlock,
DividerBlock,
EmbedLinkBlock,
FigmaBlock,
// TocBlock,
FileBlock,
GridBlock,
GridItemBlock,
GroupBlock,
GroupDividerBlock,
Heading1Block, Heading1Block,
Heading2Block, Heading2Block,
Heading3Block, Heading3Block,
QuoteBlock,
TodoBlock,
CodeBlock,
// TocBlock,
FileBlock,
ImageBlock, ImageBlock,
DividerBlock,
CalloutBlock,
YoutubeBlock,
FigmaBlock,
GroupBlock,
EmbedLinkBlock,
BulletBlock,
NumberedBlock, NumberedBlock,
GridBlock, PageBlock,
GridItemBlock, QuoteBlock,
GroupDividerBlock, RefLinkBlock,
TextBlock,
TodoBlock,
YoutubeBlock,
} from '@toeverything/components/editor-blocks'; } from '@toeverything/components/editor-blocks';
import { Protocol } from '@toeverything/datasource/db-service';
import { plugins } from '@toeverything/components/editor-plugins'; import { plugins } from '@toeverything/components/editor-plugins';
import { Protocol } from '@toeverything/datasource/db-service';
import { BlockEditor } from '@toeverything/framework/virgo';
export const createEditor = ( export const createEditor = (
workspace: string, workspace: string,
+1 -1
View File
@@ -1,2 +1,2 @@
export { AffineEditor } from './Editor';
export { createEditor } from './create-editor'; export { createEditor } from './create-editor';
export { AffineEditor } from './Editor';
@@ -1,13 +1,13 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Vec } from '@tldraw/vec';
import { Utils } from '@tldraw/core'; import { Utils } from '@tldraw/core';
import { Vec } from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import { import {
AlignType, AlignType,
TldrawCommand,
TDShapeType, TDShapeType,
TldrawCommand,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import type { TldrawApp } from '@toeverything/components/board-state';
export function alignShapes( export function alignShapes(
app: TldrawApp, app: TldrawApp,
@@ -1,5 +1,5 @@
import type { TldrawCommand } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import type { TldrawCommand } from '@toeverything/components/board-types';
export function changePage(app: TldrawApp, pageId: string): TldrawCommand { export function changePage(app: TldrawApp, pageId: string): TldrawCommand {
return { return {
@@ -1,9 +1,9 @@
import type { import { TLPageState, Utils } from '@tldraw/core';
TldrawCommand,
TDPage,
} from '@toeverything/components/board-types';
import { Utils, TLPageState } from '@tldraw/core';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import type {
TDPage,
TldrawCommand,
} from '@toeverything/components/board-types';
export function createPage( export function createPage(
app: TldrawApp, app: TldrawApp,
@@ -1,10 +1,10 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import type { import type {
Patch, Patch,
TDBinding,
TDShape, TDShape,
TldrawCommand, TldrawCommand,
TDBinding,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state';
export function createShapes( export function createShapes(
app: TldrawApp, app: TldrawApp,
@@ -1,5 +1,5 @@
import type { TldrawCommand } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import type { TldrawCommand } from '@toeverything/components/board-types';
export function deletePage(app: TldrawApp, pageId: string): TldrawCommand { export function deletePage(app: TldrawApp, pageId: string): TldrawCommand {
const { const {
@@ -1,9 +1,9 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import type { import type {
TDAsset, TDAsset,
TDAssets, TDAssets,
TldrawCommand, TldrawCommand,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state';
import { removeShapesFromPage } from './shared/remove-shapes-from-page'; import { removeShapesFromPage } from './shared/remove-shapes-from-page';
const removeAssetsFromDocument = (assets: TDAssets, idsToRemove: string[]) => { const removeAssetsFromDocument = (assets: TDAssets, idsToRemove: string[]) => {
@@ -1,14 +1,14 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Utils } from '@tldraw/core'; import { Utils } from '@tldraw/core';
import Vec from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import { import {
DistributeType, DistributeType,
TDShape, TDShape,
TldrawCommand,
TDShapeType, TDShapeType,
TldrawCommand,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import Vec from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
export function distributeShapes( export function distributeShapes(
app: TldrawApp, app: TldrawApp,
@@ -1,6 +1,6 @@
import type { TldrawCommand } from '@toeverything/components/board-types';
import { Utils } from '@tldraw/core'; import { Utils } from '@tldraw/core';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import type { TldrawCommand } from '@toeverything/components/board-types';
export function duplicatePage(app: TldrawApp, pageId: string): TldrawCommand { export function duplicatePage(app: TldrawApp, pageId: string): TldrawCommand {
const newId = Utils.uniqueId(); const newId = Utils.uniqueId();
@@ -1,13 +1,13 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Utils } from '@tldraw/core'; import { Utils } from '@tldraw/core';
import { Vec } from '@tldraw/vec'; import { Vec } from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state'; import { TLDR } from '@toeverything/components/board-state';
import type { import type {
PagePartial, PagePartial,
TldrawCommand,
TDShape, TDShape,
TldrawCommand,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state';
export function duplicateShapes( export function duplicateShapes(
app: TldrawApp, app: TldrawApp,
@@ -1,8 +1,8 @@
import { FlipType } from '@toeverything/components/board-types';
import { TLBoundsCorner, Utils } from '@tldraw/core'; import { TLBoundsCorner, Utils } from '@tldraw/core';
import type { TldrawCommand } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state'; import { TLDR } from '@toeverything/components/board-state';
import type { TldrawCommand } from '@toeverything/components/board-types';
import { FlipType } from '@toeverything/components/board-types';
export function flipShapes( export function flipShapes(
app: TldrawApp, app: TldrawApp,
@@ -1,12 +1,12 @@
import { TDShape, TDShapeType } from '@toeverything/components/board-types';
import { Utils } from '@tldraw/core'; import { Utils } from '@tldraw/core';
import type {
Patch,
TldrawCommand,
TDBinding,
} from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state'; import { TLDR } from '@toeverything/components/board-state';
import type {
Patch,
TDBinding,
TldrawCommand,
} from '@toeverything/components/board-types';
import { TDShape, TDShapeType } from '@toeverything/components/board-types';
export function groupShapes( export function groupShapes(
app: TldrawApp, app: TldrawApp,
+3 -3
View File
@@ -10,10 +10,12 @@ export * from './duplicate-shapes';
export * from './flip-shapes'; export * from './flip-shapes';
export * from './group-shapes'; export * from './group-shapes';
export * from './move-shapes-to-page'; export * from './move-shapes-to-page';
export * from './reorder-shapes';
export * from './rename-page'; export * from './rename-page';
export * from './reorder-shapes';
export * from './reset-bounds'; export * from './reset-bounds';
export * from './rotate-shapes'; export * from './rotate-shapes';
export * from './set-shapes-lock-status';
export * from './set-shapes-props';
export * from './stretch-shapes'; export * from './stretch-shapes';
export * from './style-shapes'; export * from './style-shapes';
export * from './toggle-shapes-decoration'; export * from './toggle-shapes-decoration';
@@ -21,5 +23,3 @@ export * from './toggle-shapes-prop';
export * from './translate-shapes'; export * from './translate-shapes';
export * from './ungroup-shapes'; export * from './ungroup-shapes';
export * from './update-shapes'; export * from './update-shapes';
export * from './set-shapes-props';
export * from './set-shapes-lock-status';
@@ -1,14 +1,14 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
import { TLBounds, Utils } from '@tldraw/core';
import { Vec } from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import type { import type {
ArrowShape, ArrowShape,
PagePartial, PagePartial,
TldrawCommand,
TDShape, TDShape,
TldrawCommand,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import { Utils, TLBounds } from '@tldraw/core';
import { Vec } from '@tldraw/vec';
export function moveShapesToPage( export function moveShapesToPage(
app: TldrawApp, app: TldrawApp,
@@ -1,5 +1,5 @@
import type { TldrawCommand } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import type { TldrawCommand } from '@toeverything/components/board-types';
export function renamePage( export function renamePage(
app: TldrawApp, app: TldrawApp,
@@ -1,10 +1,10 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import { import {
MoveType, MoveType,
TDShape, TDShape,
TldrawCommand, TldrawCommand,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import type { TldrawApp } from '@toeverything/components/board-state';
export function reorderShapes( export function reorderShapes(
app: TldrawApp, app: TldrawApp,
@@ -1,6 +1,6 @@
import type { TldrawCommand } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import type { TldrawCommand } from '@toeverything/components/board-types';
export function resetBounds( export function resetBounds(
app: TldrawApp, app: TldrawApp,
@@ -1,10 +1,10 @@
import { Utils } from '@tldraw/core'; import { Utils } from '@tldraw/core';
import type {
TldrawCommand,
TDShape,
} from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import type {
TDShape,
TldrawCommand,
} from '@toeverything/components/board-types';
const PI2 = Math.PI * 2; const PI2 = Math.PI * 2;
@@ -1,8 +1,8 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import type { import type {
TDShape, TDShape,
TldrawCommand, TldrawCommand,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state';
export function setShapesLockStatus<T extends TDShape>( export function setShapesLockStatus<T extends TDShape>(
app: TldrawApp, app: TldrawApp,
@@ -1,8 +1,8 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import type { import type {
TDShape, TDShape,
TldrawCommand, TldrawCommand,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state';
export function setShapesProps<T extends TDShape>( export function setShapesProps<T extends TDShape>(
app: TldrawApp, app: TldrawApp,
@@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
import { TLBoundsCorner, Utils } from '@tldraw/core'; import { TLBoundsCorner, Utils } from '@tldraw/core';
import { StretchType, TDShapeType } from '@toeverything/components/board-types';
import type { TldrawCommand } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import type { TldrawCommand } from '@toeverything/components/board-types';
import { StretchType, TDShapeType } from '@toeverything/components/board-types';
export function stretchShapes( export function stretchShapes(
app: TldrawApp, app: TldrawApp,
@@ -1,14 +1,11 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import { import {
Patch, Patch,
ShapeStyles, ShapeStyles,
TldrawCommand,
TDShape, TDShape,
// TDShapeType, TldrawCommand,
// TextShape
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import { Vec } from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
export function styleShapes( export function styleShapes(
app: TldrawApp, app: TldrawApp,
@@ -1,10 +1,10 @@
import { Decoration } from '@toeverything/components/board-types'; import type { TldrawApp } from '@toeverything/components/board-state';
import type { import type {
Patch,
ArrowShape, ArrowShape,
Patch,
TldrawCommand, TldrawCommand,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state'; import { Decoration } from '@toeverything/components/board-types';
export function toggleShapesDecoration( export function toggleShapesDecoration(
app: TldrawApp, app: TldrawApp,
@@ -1,8 +1,8 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import type { import type {
TDShape, TDShape,
TldrawCommand, TldrawCommand,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state';
export function toggleShapesProp( export function toggleShapesProp(
app: TldrawApp, app: TldrawApp,
@@ -1,10 +1,10 @@
import { Vec } from '@tldraw/vec'; import { Vec } from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state'; import { TLDR } from '@toeverything/components/board-state';
import type { import type {
TldrawCommand,
PagePartial, PagePartial,
TldrawCommand,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state';
export function translateShapes( export function translateShapes(
app: TldrawApp, app: TldrawApp,
@@ -1,12 +1,12 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state'; import { TLDR } from '@toeverything/components/board-state';
import type { import type {
Patch,
GroupShape, GroupShape,
Patch,
TDBinding, TDBinding,
TDShape, TDShape,
TldrawCommand, TldrawCommand,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state';
export function ungroupShapes( export function ungroupShapes(
app: TldrawApp, app: TldrawApp,
@@ -1,9 +1,9 @@
import type {
TldrawCommand,
TDShape,
} from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import type {
TDShape,
TldrawCommand,
} from '@toeverything/components/board-types';
export function updateShapes( export function updateShapes(
app: TldrawApp, app: TldrawApp,
+22 -22
View File
@@ -1,43 +1,43 @@
/* eslint-disable max-lines */ /* eslint-disable max-lines */
import { Renderer } from '@tldraw/core';
import { shapeUtils } from '@toeverything/components/board-shapes';
import {
TLDR,
TldrawApp,
TldrawAppCtorProps,
} from '@toeverything/components/board-state';
import {
GRID_SIZE,
TDDocument,
TDMeta,
TDStatus,
} from '@toeverything/components/board-types';
import { styled } from '@toeverything/components/ui';
import { import {
memo, memo,
useEffect, useEffect,
useLayoutEffect, useLayoutEffect,
useRef,
useMemo, useMemo,
useRef,
useState, useState,
type RefObject, type RefObject,
} from 'react'; } from 'react';
import { Renderer } from '@tldraw/core'; import { ToolsPanel } from './components/tools-panel';
import { styled } from '@toeverything/components/ui';
import {
TDDocument,
TDStatus,
GRID_SIZE,
TDMeta,
} from '@toeverything/components/board-types';
import {
TldrawApp,
TldrawAppCtorProps,
TLDR,
} from '@toeverything/components/board-state';
import { import {
TldrawContext, TldrawContext,
useStylesheet,
useKeyboardShortcuts, useKeyboardShortcuts,
useStylesheet,
useTldrawApp, useTldrawApp,
} from './hooks'; } from './hooks';
import { shapeUtils } from '@toeverything/components/board-shapes';
import { ToolsPanel } from './components/tools-panel';
// import { TopPanel } from '~components/TopPanel'; // import { TopPanel } from '~components/TopPanel';
import { ContextMenu } from './components/context-menu'; import { ContextMenu } from './components/context-menu';
// import { FocusButton } from '~components/FocusButton'; // import { FocusButton } from '~components/FocusButton';
import { Loading } from './components/loading';
import { ErrorBoundary } from 'react-error-boundary';
import { ErrorFallback } from './components/error-fallback';
import { ZoomBar } from './components/zoom-bar';
import { CommandPanel } from './components/command-panel';
import { usePageClientWidth } from '@toeverything/datasource/state'; import { usePageClientWidth } from '@toeverything/datasource/state';
import { ErrorBoundary } from 'react-error-boundary';
import { CommandPanel } from './components/command-panel';
import { ErrorFallback } from './components/error-fallback';
import { Loading } from './components/loading';
import { ZoomBar } from './components/zoom-bar';
export interface TldrawProps extends TldrawAppCtorProps { export interface TldrawProps extends TldrawAppCtorProps {
/** /**
@@ -1,13 +1,13 @@
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 { import {
BorderColorNoneIcon,
BorderColorDuotoneIcon, BorderColorDuotoneIcon,
BorderColorNoneIcon,
} from '@toeverything/components/icons'; } from '@toeverything/components/icons';
import { IconButton, Popover, Tooltip } from '@toeverything/components/ui';
import { countBy, maxBy } from '@toeverything/utils'; import { countBy, maxBy } from '@toeverything/utils';
import { getShapeIds } from './utils';
import { Palette } from '../palette'; import { Palette } from '../palette';
import { getShapeIds } from './utils';
interface BorderColorConfigProps { interface BorderColorConfigProps {
app: TldrawApp; app: TldrawApp;
@@ -1,16 +1,15 @@
import { TLDR, TldrawApp } from '@toeverything/components/board-state';
import { Divider, Popover, styled } from '@toeverything/components/ui';
import { Fragment } from 'react'; import { Fragment } from 'react';
import { Vec } from '@tldraw/vec';
import { TldrawApp, TLDR } from '@toeverything/components/board-state';
import { Popover, styled, Divider } from '@toeverything/components/ui';
import { getAnchor, useConfig } from './utils';
import { BorderColorConfig } from './BorderColorConfig'; import { BorderColorConfig } from './BorderColorConfig';
import { DeleteShapes } from './DeleteOperation';
import { FillColorConfig } from './FillColorConfig'; import { FillColorConfig } from './FillColorConfig';
import { FontSizeConfig } from './FontSizeConfig'; import { FontSizeConfig } from './FontSizeConfig';
import { StrokeLineStyleConfig } from './stroke-line-style-config';
import { Group, UnGroup } from './GroupOperation';
import { DeleteShapes } from './DeleteOperation';
import { Lock, Unlock } from './LockOperation';
import { FrameFillColorConfig } from './FrameFillColorConfig'; import { FrameFillColorConfig } from './FrameFillColorConfig';
import { Group, UnGroup } from './GroupOperation';
import { Lock, Unlock } from './LockOperation';
import { StrokeLineStyleConfig } from './stroke-line-style-config';
import { getAnchor, useConfig } from './utils';
export const CommandPanel = ({ app }: { app: TldrawApp }) => { export const CommandPanel = ({ app }: { app: TldrawApp }) => {
const state = app.useStore(); const state = app.useStore();
@@ -1,7 +1,7 @@
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 { DeleteCashBinIcon } from '@toeverything/components/icons'; import { DeleteCashBinIcon } from '@toeverything/components/icons';
import { IconButton, Tooltip } from '@toeverything/components/ui';
import { getShapeIds } from './utils'; import { getShapeIds } from './utils';
interface DeleteShapesProps { interface DeleteShapesProps {
@@ -1,18 +1,18 @@
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 {
ShapeColorDuotoneIcon,
ShapeColorNoneIcon,
} from '@toeverything/components/icons';
import {
IconButton,
Popover, Popover,
Tooltip, Tooltip,
IconButton,
useTheme, useTheme,
} from '@toeverything/components/ui'; } from '@toeverything/components/ui';
import {
ShapeColorNoneIcon,
ShapeColorDuotoneIcon,
} from '@toeverything/components/icons';
import { countBy, maxBy } from '@toeverything/utils'; import { countBy, maxBy } from '@toeverything/utils';
import { getShapeIds } from './utils';
import { Palette } from '../palette'; import { Palette } from '../palette';
import { getShapeIds } from './utils';
interface BorderColorConfigProps { interface BorderColorConfigProps {
app: TldrawApp; app: TldrawApp;
@@ -2,17 +2,17 @@ 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';
import { import {
Popover,
Tooltip,
IconButton,
styled,
} from '@toeverything/components/ui';
import {
TextFontIcon,
HeadingOneIcon, HeadingOneIcon,
HeadingTwoIcon,
HeadingThreeIcon, HeadingThreeIcon,
HeadingTwoIcon,
TextFontIcon,
} from '@toeverything/components/icons'; } from '@toeverything/components/icons';
import {
IconButton,
Popover,
styled,
Tooltip,
} from '@toeverything/components/ui';
import { countBy, maxBy } from '@toeverything/utils'; import { countBy, maxBy } from '@toeverything/utils';
import { getShapeIds } from './utils'; import { getShapeIds } from './utils';
@@ -1,18 +1,18 @@
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 {
ShapeColorDuotoneIcon,
ShapeColorNoneIcon,
} from '@toeverything/components/icons';
import {
IconButton,
Popover, Popover,
Tooltip, Tooltip,
IconButton,
useTheme, useTheme,
} from '@toeverything/components/ui'; } from '@toeverything/components/ui';
import {
ShapeColorNoneIcon,
ShapeColorDuotoneIcon,
} from '@toeverything/components/icons';
import { countBy, maxBy } from '@toeverything/utils'; import { countBy, maxBy } from '@toeverything/utils';
import { getShapeIds } from './utils';
import { Palette } from '../palette'; import { Palette } from '../palette';
import { getShapeIds } from './utils';
interface BorderColorConfigProps { interface BorderColorConfigProps {
app: TldrawApp; app: TldrawApp;
@@ -1,7 +1,7 @@
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 { GroupIcon, UngroupIcon } from '@toeverything/components/icons'; import { GroupIcon, UngroupIcon } from '@toeverything/components/icons';
import { IconButton, Tooltip } from '@toeverything/components/ui';
import { getShapeIds } from './utils'; import { getShapeIds } from './utils';
interface GroupAndUnGroupProps { interface GroupAndUnGroupProps {
@@ -1,7 +1,7 @@
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 { LockIcon, UnlockIcon } from '@toeverything/components/icons'; import { LockIcon, UnlockIcon } from '@toeverything/components/icons';
import { IconButton, Tooltip } from '@toeverything/components/ui';
import { getShapeIds } from './utils'; import { getShapeIds } from './utils';
interface GroupAndUnGroupProps { interface GroupAndUnGroupProps {
@@ -1,15 +1,15 @@
import { DashStyle, StrokeWidth } from '@toeverything/components/board-types'; import { DashStyle, StrokeWidth } from '@toeverything/components/board-types';
import { import {
LineNoneIcon,
DashLineIcon,
SolidLineIcon,
BrushIcon, BrushIcon,
DashLineIcon,
LineNoneIcon,
SolidLineIcon,
} from '@toeverything/components/icons'; } from '@toeverything/components/icons';
import { import {
IconButton, IconButton,
Slider,
styled, styled,
Tooltip, Tooltip,
Slider,
} from '@toeverything/components/ui'; } from '@toeverything/components/ui';
export const lineStyles = [ export const lineStyles = [
@@ -1,8 +1,8 @@
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 type { TDShape } from '@toeverything/components/board-types'; import type { TDShape } from '@toeverything/components/board-types';
import { Popover, IconButton, Tooltip } from '@toeverything/components/ui'; import { DashStyle, StrokeWidth } from '@toeverything/components/board-types';
import { BrushIcon } from '@toeverything/components/icons'; import { BrushIcon } from '@toeverything/components/icons';
import { IconButton, Popover, Tooltip } from '@toeverything/components/ui';
import { countBy, maxBy } from '@toeverything/utils'; import { countBy, maxBy } from '@toeverything/utils';
import { getShapeIds } from '../utils'; import { getShapeIds } from '../utils';
import { LineStyle, lineStyles } from './LineStyle'; import { LineStyle, lineStyles } from './LineStyle';
@@ -1,2 +1,2 @@
export { getAnchor } from './get-anchor'; export { getAnchor } from './get-anchor';
export { useConfig, getShapeIds } from './use-config'; export { getShapeIds, useConfig } from './use-config';
@@ -1,7 +1,7 @@
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types'; import type { TDShape } from '@toeverything/components/board-types';
import { TDShapeType } from '@toeverything/components/board-types'; import { TDShapeType } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
interface Config { interface Config {
type: type:
@@ -1,7 +1,6 @@
import * as React from 'react'; import { styled } from '@toeverything/components/ui';
import { FallbackProps } from 'react-error-boundary'; import { FallbackProps } from 'react-error-boundary';
import { useTldrawApp } from '../../hooks'; import { useTldrawApp } from '../../hooks';
import { styled } from '@toeverything/components/ui';
export function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) { export function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {
const app = useTldrawApp(); const app = useTldrawApp();
@@ -1,7 +1,6 @@
import * as React from 'react';
import { useTldrawApp } from '../../hooks';
import { styled } from '@toeverything/components/ui';
import type { TDSnapshot } from '@toeverything/components/board-types'; import type { TDSnapshot } from '@toeverything/components/board-types';
import { styled } from '@toeverything/components/ui';
import { useTldrawApp } from '../../hooks';
const loadingSelector = (s: TDSnapshot) => s.appState.isLoading; const loadingSelector = (s: TDSnapshot) => s.appState.isLoading;
@@ -1,7 +1,6 @@
import type { PropsWithChildren } from 'react';
import { useMemo } from 'react';
import { styled, Tooltip } from '@toeverything/components/ui';
import { ShapeColorNoneIcon } from '@toeverything/components/icons'; import { ShapeColorNoneIcon } from '@toeverything/components/icons';
import { styled, Tooltip } from '@toeverything/components/ui';
import { useMemo } from 'react';
interface ColorObject { interface ColorObject {
name?: string; name?: string;
@@ -1,18 +1,18 @@
import { useState, useEffect } from 'react';
import { import {
ConnectorIcon,
ConectorLineIcon,
ConectorArrowIcon, ConectorArrowIcon,
ConectorLineIcon,
ConnectorIcon,
} from '@toeverything/components/icons'; } from '@toeverything/components/icons';
import { import {
Tooltip,
Popover,
IconButton, IconButton,
Popover,
styled, styled,
Tooltip,
} from '@toeverything/components/ui'; } from '@toeverything/components/ui';
import { useEffect, useState } from 'react';
import { TDSnapshot, TDShapeType } from '@toeverything/components/board-types';
import { TldrawApp } from '@toeverything/components/board-state'; import { TldrawApp } from '@toeverything/components/board-state';
import { TDShapeType, TDSnapshot } from '@toeverything/components/board-types';
export type ShapeTypes = TDShapeType.Line | TDShapeType.Arrow; export type ShapeTypes = TDShapeType.Line | TDShapeType.Arrow;
@@ -1,22 +1,22 @@
import { useState, useEffect } from 'react';
import { import {
ShapeIcon,
RectangleIcon,
EllipseIcon,
TriangleIcon,
PolygonIcon,
StarIcon,
ArrowIcon, ArrowIcon,
EllipseIcon,
PolygonIcon,
RectangleIcon,
ShapeIcon,
StarIcon,
TriangleIcon,
} from '@toeverything/components/icons'; } from '@toeverything/components/icons';
import { import {
Tooltip,
Popover,
IconButton, IconButton,
Popover,
styled, styled,
Tooltip,
} from '@toeverything/components/ui'; } from '@toeverything/components/ui';
import { useEffect, useState } from 'react';
import { TDSnapshot, TDShapeType } from '@toeverything/components/board-types';
import { TldrawApp } from '@toeverything/components/board-state'; import { TldrawApp } from '@toeverything/components/board-state';
import { TDShapeType, TDSnapshot } from '@toeverything/components/board-types';
export type ShapeTypes = export type ShapeTypes =
| TDShapeType.Rectangle | TDShapeType.Rectangle
@@ -1,35 +1,35 @@
import style9 from 'style9';
import { import {
EraserIcon,
EraserIconProps,
FrameIcon,
HandToolIcon,
HandToolIconProps,
SelectIcon,
SelectIconProps,
TextIcon,
TextIconProps,
} from '@toeverything/components/icons';
import {
IconButton,
PopoverContainer,
// MuiIconButton as IconButton, // MuiIconButton as IconButton,
// MuiTooltip as Tooltip, // MuiTooltip as Tooltip,
Tooltip, Tooltip,
PopoverContainer,
IconButton,
useTheme, useTheme,
} from '@toeverything/components/ui'; } from '@toeverything/components/ui';
import { import style9 from 'style9';
FrameIcon,
HandToolIcon,
SelectIcon,
TextIcon,
EraserIcon,
SelectIconProps,
EraserIconProps,
HandToolIconProps,
TextIconProps,
} from '@toeverything/components/icons';
import { TldrawApp } from '@toeverything/components/board-state';
import { import {
TDSnapshot,
TDShapeType, TDShapeType,
TDSnapshot,
TDToolType, TDToolType,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import { TldrawApp } from '@toeverything/components/board-state';
import { ShapeTools } from './ShapeTools'; import { ComponentType } from 'react';
import { PenTools } from './pen-tools';
import { LineTools } from './LineTools'; import { LineTools } from './LineTools';
import { ComponentType, Component } from 'react'; import { PenTools } from './pen-tools';
import { ShapeTools } from './ShapeTools';
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;
@@ -1,5 +1,5 @@
import { IconButton, styled, Tooltip } from '@toeverything/components/ui';
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
import { Tooltip, styled, IconButton } from '@toeverything/components/ui';
interface PenProps { interface PenProps {
name: string; name: string;
@@ -1,19 +1,18 @@
import { ReactElement, type CSSProperties } from 'react';
import style9 from 'style9';
import {
MuiDivider as Divider,
Popover,
Tooltip,
IconButton,
styled,
} from '@toeverything/components/ui';
import { TDShapeType, TDToolType } from '@toeverything/components/board-types';
import { TldrawApp } from '@toeverything/components/board-state'; import { TldrawApp } from '@toeverything/components/board-state';
import { TDShapeType, TDToolType } from '@toeverything/components/board-types';
import { import {
PencilDuotoneIcon,
HighlighterDuotoneIcon, HighlighterDuotoneIcon,
LaserPenDuotoneIcon, LaserPenDuotoneIcon,
PencilDuotoneIcon,
} from '@toeverything/components/icons'; } from '@toeverything/components/icons';
import {
IconButton,
MuiDivider as Divider,
Popover,
styled,
Tooltip,
} from '@toeverything/components/ui';
import { ReactElement, type CSSProperties } from 'react';
import { Palette } from '../../palette'; import { Palette } from '../../palette';
import { Pen } from './Pen'; import { Pen } from './Pen';
@@ -1,14 +1,14 @@
import AddIcon from '@mui/icons-material/Add';
import RemoveIcon from '@mui/icons-material/Remove';
import UnfoldMoreIcon from '@mui/icons-material/UnfoldMore';
import { import {
MuiIconButton as IconButton,
MuiButton as Button, MuiButton as Button,
MuiIconButton as IconButton,
styled, styled,
} from '@toeverything/components/ui'; } from '@toeverything/components/ui';
import RemoveIcon from '@mui/icons-material/Remove';
import AddIcon from '@mui/icons-material/Add';
import UnfoldMoreIcon from '@mui/icons-material/UnfoldMore';
import { useTldrawApp } from '../../hooks';
import { TDSnapshot } from '@toeverything/components/board-types'; import { TDSnapshot } from '@toeverything/components/board-types';
import { useTldrawApp } from '../../hooks';
import { MiniMap } from './mini-map'; import { MiniMap } from './mini-map';
@@ -4,9 +4,9 @@ import { TLDR } from '@toeverything/components/board-state';
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import { useTldrawApp } from '../../../hooks'; import { useTldrawApp } from '../../../hooks';
import { getViewportBound, processBound } from './bounds';
import { SimplifiedShape } from './SimplifiedShape'; import { SimplifiedShape } from './SimplifiedShape';
import { Viewport } from './Viewport'; import { Viewport } from './Viewport';
import { processBound, getViewportBound } from './bounds';
const MINI_MAP_WIDTH = 150; const MINI_MAP_WIDTH = 150;
const MINI_MAP_HEIGHT = 100; const MINI_MAP_HEIGHT = 100;
@@ -1,6 +1,6 @@
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';
import type { CSSProperties } from 'react';
interface SimplifiedShapeProps extends TLBounds { interface SimplifiedShapeProps extends TLBounds {
onClick?: () => void; onClick?: () => void;
@@ -1,8 +1,8 @@
import type { CSSProperties, PointerEventHandler } 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';
import { styled, alpha } from '@toeverything/components/ui'; import { alpha, styled } from '@toeverything/components/ui';
import type { CSSProperties, PointerEventHandler } from 'react';
import { useRef, useState } from 'react';
interface ViewportProps extends TLBounds { interface ViewportProps extends TLBounds {
onPan?: (delta: [number, number]) => void; onPan?: (delta: [number, number]) => void;
@@ -1,6 +1,6 @@
export * from './use-file-system-handlers';
export * from './use-keyboard-shortcuts'; export * from './use-keyboard-shortcuts';
export * from './use-tldraw-app';
// export * from './useTheme'; // export * from './useTheme';
export * from './use-stylesheet'; export * from './use-stylesheet';
export * from './use-file-system-handlers'; export * from './use-tldraw-app';
// export * from './useFileSystem'; // export * from './useFileSystem';
@@ -1,8 +1,8 @@
import { AlignStyle, TDShapeType } from '@toeverything/components/board-types';
import * as React from 'react'; import * as React from 'react';
import { useHotkeys } from 'react-hotkeys-hook'; import { useHotkeys } from 'react-hotkeys-hook';
import { AlignStyle, TDShapeType } from '@toeverything/components/board-types';
import { useTldrawApp } from './use-tldraw-app';
import { useFileSystemHandlers } from './use-file-system-handlers'; import { useFileSystemHandlers } from './use-file-system-handlers';
import { useTldrawApp } from './use-tldraw-app';
export function useKeyboardShortcuts(ref: React.RefObject<HTMLDivElement>) { export function useKeyboardShortcuts(ref: React.RefObject<HTMLDivElement>) {
const app = useTldrawApp(); const app = useTldrawApp();
@@ -1,5 +1,5 @@
import * as React from 'react';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import * as React from 'react';
export const TldrawContext = React.createContext<TldrawApp>({} as TldrawApp); export const TldrawContext = React.createContext<TldrawApp>({} as TldrawApp);
+1 -1
View File
@@ -1,2 +1,2 @@
export { Tldraw } from './TlDraw';
export { useTldrawApp } from './hooks'; export { useTldrawApp } from './hooks';
export { Tldraw } from './TlDraw';
@@ -1,21 +1,21 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Utils } from '@tldraw/core';
import { Vec } from '@tldraw/vec';
import { shapeUtils } from '@toeverything/components/board-shapes';
import type { TldrawApp } from '@toeverything/components/board-state';
import { deepCopy, TLDR } from '@toeverything/components/board-state';
import { import {
ArrowBinding, ArrowBinding,
ArrowShape, ArrowShape,
TDShape,
TDBinding,
TDStatus,
SessionType, SessionType,
TDBinding,
TDShape,
TDShapeType, TDShapeType,
TldrawPatch, TDStatus,
TldrawCommand, TldrawCommand,
TldrawPatch,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import { Vec } from '@tldraw/vec';
import { TLDR, deepCopy } from '@toeverything/components/board-state';
import { shapeUtils } from '@toeverything/components/board-shapes';
import { BaseSession } from './base-session'; import { BaseSession } from './base-session';
import type { TldrawApp } from '@toeverything/components/board-state';
import { Utils } from '@tldraw/core';
export class ArrowSession extends BaseSession { export class ArrowSession extends BaseSession {
type = SessionType.Arrow; type = SessionType.Arrow;
@@ -1,5 +1,5 @@
import { BaseSessionType } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import { BaseSessionType } from '@toeverything/components/board-types';
export abstract class BaseSession extends BaseSessionType { export abstract class BaseSession extends BaseSessionType {
app: TldrawApp; app: TldrawApp;
@@ -1,11 +1,11 @@
import { TLBounds, Utils } from '@tldraw/core'; import { TLBounds, Utils } from '@tldraw/core';
import type { TldrawApp } from '@toeverything/components/board-state';
import { import {
SessionType, SessionType,
TldrawPatch,
TDStatus, TDStatus,
TldrawCommand, TldrawCommand,
TldrawPatch,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state';
import { BaseSession } from './base-session'; import { BaseSession } from './base-session';
export class BrushSession extends BaseSession { export class BrushSession extends BaseSession {
@@ -1,13 +1,13 @@
import { Utils } from '@tldraw/core'; import { Utils } from '@tldraw/core';
import { Vec } from '@tldraw/vec'; import { Vec } from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
import { import {
DrawShape,
SessionType, SessionType,
TDStatus, TDStatus,
TldrawPatch,
TldrawCommand, TldrawCommand,
DrawShape, TldrawPatch,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state';
import { BaseSession } from './base-session'; import { BaseSession } from './base-session';
export class DrawSession extends BaseSession { export class DrawSession extends BaseSession {
@@ -1,14 +1,14 @@
import { Vec } from '@tldraw/vec'; import { Vec } from '@tldraw/vec';
import {
SessionType,
TDStatus,
TDShape,
PagePartial,
TDBinding,
TldrawPatch,
TldrawCommand,
} from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state'; import type { TldrawApp } from '@toeverything/components/board-state';
import {
PagePartial,
SessionType,
TDBinding,
TDShape,
TDStatus,
TldrawCommand,
TldrawPatch,
} from '@toeverything/components/board-types';
import { BaseSession } from './base-session'; import { BaseSession } from './base-session';
export class EraseSession extends BaseSession { export class EraseSession extends BaseSession {
@@ -1,17 +1,16 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
import { TLPageState, TLBounds, Utils } from '@tldraw/core'; import { TLBounds, TLPageState, Utils } from '@tldraw/core';
import { Vec } from '@tldraw/vec'; import { Vec } from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
import { import {
Patch, Patch,
SessionType,
TDShape, TDShape,
TDStatus, TDStatus,
SessionType,
TDShapeType,
TldrawPatch,
TldrawCommand, TldrawCommand,
TldrawPatch,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import { BaseSession } from './base-session'; import { BaseSession } from './base-session';
import type { TldrawApp } from '@toeverything/components/board-state';
export class GridSession extends BaseSession { export class GridSession extends BaseSession {
type = SessionType.Grid; type = SessionType.Grid;
@@ -1,14 +1,14 @@
import { Vec } from '@tldraw/vec'; import { Vec } from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import { import {
SessionType, SessionType,
ShapesWithProp, ShapesWithProp,
TDStatus,
TldrawCommand, TldrawCommand,
TldrawPatch, TldrawPatch,
TDStatus,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import { BaseSession } from './base-session'; import { BaseSession } from './base-session';
import type { TldrawApp } from '@toeverything/components/board-state';
export class HandleSession extends BaseSession { export class HandleSession extends BaseSession {
type = SessionType.Handle; type = SessionType.Handle;
+3 -3
View File
@@ -2,14 +2,14 @@ import { ExceptFirst, SessionType } from '@toeverything/components/board-types';
import { ArrowSession } from './arrow-session'; import { ArrowSession } from './arrow-session';
import { BrushSession } from './brush-session'; import { BrushSession } from './brush-session';
import { DrawSession } from './draw-session'; import { DrawSession } from './draw-session';
import { EraseSession } from './erase-session';
import { GridSession } from './grid-session';
import { HandleSession } from './handle-session'; import { HandleSession } from './handle-session';
import { LaserSession } from './laser-session';
import { RotateSession } from './rotate-session'; import { RotateSession } from './rotate-session';
import { TransformSession } from './transform-session'; import { TransformSession } from './transform-session';
import { TransformSingleSession } from './transform-single-session'; import { TransformSingleSession } from './transform-single-session';
import { TranslateSession } from './translate-session'; import { TranslateSession } from './translate-session';
import { EraseSession } from './erase-session';
import { GridSession } from './grid-session';
import { LaserSession } from './laser-session';
export type TldrawSession = export type TldrawSession =
| ArrowSession | ArrowSession
@@ -1,11 +1,11 @@
import { Vec } from '@tldraw/vec'; import { Vec } from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
import { import {
SessionType, SessionType,
TDStatus, TDStatus,
TldrawPatch,
TldrawCommand, TldrawCommand,
TldrawPatch,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import type { TldrawApp } from '@toeverything/components/board-state';
import { BaseSession } from './base-session'; import { BaseSession } from './base-session';
export class LaserSession extends BaseSession { export class LaserSession extends BaseSession {
type = SessionType.Draw; type = SessionType.Draw;
@@ -1,16 +1,16 @@
import { Utils } from '@tldraw/core'; import { Utils } from '@tldraw/core';
import { Vec } from '@tldraw/vec'; import { Vec } from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import { import {
SessionType, SessionType,
TDShape,
TDShapeType,
TDStatus,
TldrawCommand, TldrawCommand,
TldrawPatch, TldrawPatch,
TDShape,
TDStatus,
TDShapeType,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import { BaseSession } from './base-session'; import { BaseSession } from './base-session';
import type { TldrawApp } from '@toeverything/components/board-state';
export class RotateSession extends BaseSession { export class RotateSession extends BaseSession {
type = SessionType.Rotate; type = SessionType.Rotate;
@@ -1,18 +1,18 @@
import type { TLBoundsWithCenter, TLSnapLine } from '@tldraw/core';
import { TLBounds, TLBoundsCorner, TLBoundsEdge, Utils } from '@tldraw/core'; import { TLBounds, TLBoundsCorner, TLBoundsEdge, Utils } from '@tldraw/core';
import { Vec } from '@tldraw/vec'; import { Vec } from '@tldraw/vec';
import type { TLSnapLine, TLBoundsWithCenter } from '@tldraw/core'; import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import { import {
SessionType, SessionType,
TldrawCommand,
TldrawPatch,
TDShape,
TDStatus,
SLOW_SPEED, SLOW_SPEED,
SNAP_DISTANCE, SNAP_DISTANCE,
TDShape,
TDStatus,
TldrawCommand,
TldrawPatch,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import { BaseSession } from './base-session'; import { BaseSession } from './base-session';
import type { TldrawApp } from '@toeverything/components/board-state';
type SnapInfo = type SnapInfo =
| { | {
@@ -1,24 +1,24 @@
import { import {
TLBoundsCorner,
TLSnapLine,
TLBoundsEdge,
Utils,
TLBoundsWithCenter,
TLBounds, TLBounds,
TLBoundsCorner,
TLBoundsEdge,
TLBoundsWithCenter,
TLSnapLine,
Utils,
} from '@tldraw/core'; } from '@tldraw/core';
import { Vec } from '@tldraw/vec'; import { Vec } from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import { import {
SessionType, SessionType,
TldrawCommand,
TldrawPatch,
TDShape,
TDStatus,
SLOW_SPEED, SLOW_SPEED,
SNAP_DISTANCE, SNAP_DISTANCE,
TDShape,
TDStatus,
TldrawCommand,
TldrawPatch,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import { BaseSession } from './base-session'; import { BaseSession } from './base-session';
import type { TldrawApp } from '@toeverything/components/board-state';
type SnapInfo = type SnapInfo =
| { | {
@@ -1,17 +1,17 @@
import type { TLBounds } from '@tldraw/core';
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import { import {
ArrowShape,
EllipseShape,
RectangleShape,
SessionType, SessionType,
TDStatus,
TldrawCommand, TldrawCommand,
TldrawPatch, TldrawPatch,
TDStatus,
RectangleShape,
TriangleShape, TriangleShape,
EllipseShape,
ArrowShape,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import { BaseSession } from './base-session'; import { BaseSession } from './base-session';
import type { TldrawApp } from '@toeverything/components/board-state';
import type { TLBounds } from '@tldraw/core';
export class TranslateLabelSession extends BaseSession { export class TranslateLabelSession extends BaseSession {
type = SessionType.Handle; type = SessionType.Handle;
@@ -1,30 +1,30 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
import { import {
TLPageState,
Utils,
TLBoundsWithCenter,
TLSnapLine,
TLBounds, TLBounds,
TLBoundsWithCenter,
TLPageState,
TLSnapLine,
Utils,
} from '@tldraw/core'; } from '@tldraw/core';
import { Vec } from '@tldraw/vec'; import { Vec } from '@tldraw/vec';
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import { import {
TDShape,
TDBinding,
TldrawCommand,
TDStatus,
ArrowShape,
Patch,
GroupShape,
SessionType,
ArrowBinding, ArrowBinding,
TldrawPatch, ArrowShape,
TDShapeType, GroupShape,
Patch,
SessionType,
SLOW_SPEED, SLOW_SPEED,
SNAP_DISTANCE, SNAP_DISTANCE,
TDBinding,
TDShape,
TDShapeType,
TDStatus,
TldrawCommand,
TldrawPatch,
} from '@toeverything/components/board-types'; } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
import { BaseSession } from './base-session'; import { BaseSession } from './base-session';
import type { TldrawApp } from '@toeverything/components/board-state';
type CloneInfo = type CloneInfo =
| { | {
@@ -8,21 +8,17 @@
* 5. All Plugins should inherit from BasePlugin, in the form of objects * 5. All Plugins should inherit from BasePlugin, in the form of objects
* 6. Dependencies between plugins are not supported for the time being * 6. Dependencies between plugins are not supported for the time being
*/ */
// import { CompleteInfoSelectOption } from '@authing/react-ui-components/components/CompleteInfo/interface';
import type {
BlockFlavors,
BlockFlavorKeys,
} from '@toeverything/datasource/db-service';
import type { PatchNode } from '@toeverything/components/ui'; import type { PatchNode } from '@toeverything/components/ui';
import type { BlockFlavors } from '@toeverything/datasource/db-service';
import type { IdList, SelectionInfo, SelectionManager } from './selection'; import type { IdList, SelectionInfo, SelectionManager } from './selection';
import { Point } from '@toeverything/utils';
import { Observable } from 'rxjs';
import type { AsyncBlock } from './block'; import type { AsyncBlock } from './block';
import type { BlockHelper } from './block/block-helper'; import type { BlockHelper } from './block/block-helper';
import type { BlockCommands } from './commands/block-commands'; import type { BlockCommands } from './commands/block-commands';
import type { DragDropManager } from './drag-drop'; import type { DragDropManager } from './drag-drop';
import { MouseManager } from './mouse'; import { MouseManager } from './mouse';
import { Observable } from 'rxjs';
import { Point } from '@toeverything/utils';
import { ScrollManager } from './scroll'; import { ScrollManager } from './scroll';
// import { BrowserClipboard } from './clipboard/browser-clipboard'; // import { BrowserClipboard } from './clipboard/browser-clipboard';
-1
View File
@@ -6,7 +6,6 @@
"jotai": "^1.7.4" "jotai": "^1.7.4"
}, },
"devDependencies": { "devDependencies": {
"authing-js-sdk": "^4.23.35",
"firebase": "^9.9.2" "firebase": "^9.9.2"
} }
} }
+19 -1063
View File
File diff suppressed because it is too large. Load diff