mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-24 05:07:06 +08:00
chore: sort imports
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { Utils, TLShapeUtil } from '@tldraw/core';
|
||||
import type { TLPointerInfo, TLBounds } from '@tldraw/core';
|
||||
import type { TLBounds, TLPointerInfo } from '@tldraw/core';
|
||||
import { TLShapeUtil, Utils } from '@tldraw/core';
|
||||
import {
|
||||
intersectLineSegmentBounds,
|
||||
intersectLineSegmentPolyline,
|
||||
@@ -15,9 +15,9 @@ import type {
|
||||
} from '@toeverything/components/board-types';
|
||||
import { BINDING_DISTANCE } from '@toeverything/components/board-types';
|
||||
import { createRef } from 'react';
|
||||
import { getTextSvgElement } from './shared/get-text-svg-element';
|
||||
import { getTextLabelSize } from './shared/get-text-size';
|
||||
import { getFontStyle, getShapeStyle } from './shared';
|
||||
import { getTextLabelSize } from './shared/get-text-size';
|
||||
import { getTextSvgElement } from './shared/get-text-svg-element';
|
||||
|
||||
export abstract class TDShapeUtil<
|
||||
T extends TDShape,
|
||||
|
||||
@@ -4,14 +4,14 @@ import {
|
||||
intersectCircleLineSegment,
|
||||
} from '@tldraw/intersect';
|
||||
import Vec from '@tldraw/vec';
|
||||
import getStroke from 'perfect-freehand';
|
||||
import { EASINGS } from '@toeverything/components/board-types';
|
||||
import { getShapeStyle } from '../shared/shape-styles';
|
||||
import type {
|
||||
ArrowShape,
|
||||
Decoration,
|
||||
ShapeStyles,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { EASINGS } from '@toeverything/components/board-types';
|
||||
import getStroke from 'perfect-freehand';
|
||||
import { getShapeStyle } from '../shared/shape-styles';
|
||||
|
||||
export function getArrowArcPath(
|
||||
start: number[],
|
||||
|
||||
@@ -1,22 +1,30 @@
|
||||
import * as React from 'react';
|
||||
import { Utils, TLBounds, SVGContainer } from '@tldraw/core';
|
||||
import { Vec } from '@tldraw/vec';
|
||||
import { defaultStyle } from '../shared/shape-styles';
|
||||
import {
|
||||
ArrowShape,
|
||||
TransformInfo,
|
||||
Decoration,
|
||||
TDShapeType,
|
||||
DashStyle,
|
||||
TDMeta,
|
||||
GHOSTED_OPACITY,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { SVGContainer, TLBounds, Utils } from '@tldraw/core';
|
||||
import {
|
||||
intersectArcBounds,
|
||||
intersectLineSegmentBounds,
|
||||
intersectLineSegmentLineSegment,
|
||||
} from '@tldraw/intersect';
|
||||
import { Vec } from '@tldraw/vec';
|
||||
import {
|
||||
ArrowShape,
|
||||
DashStyle,
|
||||
Decoration,
|
||||
GHOSTED_OPACITY,
|
||||
TDMeta,
|
||||
TDShapeType,
|
||||
TransformInfo,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
getFontStyle,
|
||||
getShapeStyle,
|
||||
getTextLabelSize,
|
||||
LabelMask,
|
||||
TextLabel,
|
||||
} from '../shared';
|
||||
import { defaultStyle } from '../shared/shape-styles';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import {
|
||||
getArcLength,
|
||||
getArcPoints,
|
||||
@@ -25,16 +33,8 @@ import {
|
||||
getCtp,
|
||||
isAngleBetween,
|
||||
} from './arrow-helpers';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import {
|
||||
TextLabel,
|
||||
getFontStyle,
|
||||
getShapeStyle,
|
||||
getTextLabelSize,
|
||||
LabelMask,
|
||||
} from '../shared';
|
||||
import { StraightArrow } from './components/straight-arrow';
|
||||
import { CurvedArrow } from './components/curved-arrow';
|
||||
import { StraightArrow } from './components/straight-arrow';
|
||||
|
||||
type T = ArrowShape;
|
||||
type E = HTMLDivElement;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import * as React from 'react';
|
||||
|
||||
export interface ArrowheadProps {
|
||||
left: number[];
|
||||
middle: number[];
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Utils } from '@tldraw/core';
|
||||
import Vec from '@tldraw/vec';
|
||||
import * as React from 'react';
|
||||
import { EASINGS } from '@toeverything/components/board-types';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import type {
|
||||
Decoration,
|
||||
ShapeStyles,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { EASINGS } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import {
|
||||
getArcLength,
|
||||
getArrowArcPath,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Utils } from '@tldraw/core';
|
||||
import Vec from '@tldraw/vec';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import type {
|
||||
Decoration,
|
||||
ShapeStyles,
|
||||
} from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import {
|
||||
getStraightArrowHeadPoints,
|
||||
renderFreehandArrowShaft,
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import * as React from 'react';
|
||||
import { Utils, SVGContainer, TLBounds } from '@tldraw/core';
|
||||
import { Vec } from '@tldraw/vec';
|
||||
import { defaultStyle, getShapeStyle } from '../shared/shape-styles';
|
||||
import {
|
||||
DrawShape,
|
||||
DashStyle,
|
||||
TDShapeType,
|
||||
TransformInfo,
|
||||
TDMeta,
|
||||
GHOSTED_OPACITY,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { SVGContainer, TLBounds, Utils } from '@tldraw/core';
|
||||
import {
|
||||
intersectBoundsBounds,
|
||||
intersectBoundsPolyline,
|
||||
intersectLineSegmentBounds,
|
||||
intersectLineSegmentLineSegment,
|
||||
} from '@tldraw/intersect';
|
||||
import { Vec } from '@tldraw/vec';
|
||||
import {
|
||||
DashStyle,
|
||||
DrawShape,
|
||||
GHOSTED_OPACITY,
|
||||
TDMeta,
|
||||
TDShapeType,
|
||||
TransformInfo,
|
||||
} from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { defaultStyle, getShapeStyle } from '../shared/shape-styles';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import {
|
||||
getDrawStrokePathTDSnapshot,
|
||||
getFillPath,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Utils } from '@tldraw/core';
|
||||
import Vec from '@tldraw/vec';
|
||||
import type { DrawShape } from '@toeverything/components/board-types';
|
||||
import {
|
||||
getStrokeOutlinePoints,
|
||||
getStrokePoints,
|
||||
StrokeOptions,
|
||||
} from 'perfect-freehand';
|
||||
import type { DrawShape } from '@toeverything/components/board-types';
|
||||
import { getShapeStyle } from '../shared/shape-styles';
|
||||
|
||||
const simulatePressureSettings: StrokeOptions = {
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
import { useRef, useCallback, useEffect, memo } from 'react';
|
||||
import type { SyntheticEvent } from 'react';
|
||||
import { Utils, HTMLContainer, TLBounds } from '@tldraw/core';
|
||||
import { HTMLContainer, TLBounds, Utils } from '@tldraw/core';
|
||||
import { Vec } from '@tldraw/vec';
|
||||
import { AffineEditor } from '@toeverything/components/affine-editor';
|
||||
import {
|
||||
EditorShape,
|
||||
TDMeta,
|
||||
TDShapeType,
|
||||
TransformInfo,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { MIN_PAGE_WIDTH } from '@toeverything/components/editor-core';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import type { SyntheticEvent } from 'react';
|
||||
import { memo, useCallback, useEffect, useRef } from 'react';
|
||||
import {
|
||||
defaultTextStyle,
|
||||
getBoundsRectangle,
|
||||
getTextSvgElement,
|
||||
} from '../shared';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { getShapeStyle } from '../shared/shape-styles';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import { Vec } from '@tldraw/vec';
|
||||
import { AffineEditor } from '@toeverything/components/affine-editor';
|
||||
import { MIN_PAGE_WIDTH } from '@toeverything/components/editor-core';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
const MemoAffineEditor = memo(AffineEditor, (prev, next) => {
|
||||
return (
|
||||
prev.workspace === next.workspace &&
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
import * as React from 'react';
|
||||
import { Utils, SVGContainer, TLBounds } from '@tldraw/core';
|
||||
import { Vec } from '@tldraw/vec';
|
||||
import {
|
||||
defaultStyle,
|
||||
getShapeStyle,
|
||||
getFontStyle,
|
||||
TextLabel,
|
||||
} from '../shared';
|
||||
import {
|
||||
EllipseShape,
|
||||
DashStyle,
|
||||
TDShapeType,
|
||||
TDShape,
|
||||
TransformInfo,
|
||||
TDMeta,
|
||||
GHOSTED_OPACITY,
|
||||
LABEL_POINT,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { SVGContainer, TLBounds, Utils } from '@tldraw/core';
|
||||
import {
|
||||
intersectEllipseBounds,
|
||||
intersectLineSegmentEllipse,
|
||||
intersectRayEllipse,
|
||||
} from '@tldraw/intersect';
|
||||
import { getEllipseIndicatorPath } from './ellipse-helpers';
|
||||
import { DrawEllipse } from './components/DrawEllipse';
|
||||
import { DashedEllipse } from './components/DashedEllipse';
|
||||
import { Vec } from '@tldraw/vec';
|
||||
import {
|
||||
DashStyle,
|
||||
EllipseShape,
|
||||
GHOSTED_OPACITY,
|
||||
LABEL_POINT,
|
||||
TDMeta,
|
||||
TDShape,
|
||||
TDShapeType,
|
||||
TransformInfo,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
defaultStyle,
|
||||
getFontStyle,
|
||||
getShapeStyle,
|
||||
TextLabel,
|
||||
} from '../shared';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { DashedEllipse } from './components/DashedEllipse';
|
||||
import { DrawEllipse } from './components/DrawEllipse';
|
||||
import { getEllipseIndicatorPath } from './ellipse-helpers';
|
||||
|
||||
type T = EllipseShape;
|
||||
type E = HTMLDivElement;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { Utils } from '@tldraw/core';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
|
||||
interface EllipseSvgProps {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import { getEllipseIndicatorPath, getEllipsePath } from '../ellipse-helpers';
|
||||
|
||||
interface EllipseSvgProps {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Utils } from '@tldraw/core';
|
||||
import { getStrokeOutlinePoints, getStrokePoints } from 'perfect-freehand';
|
||||
import { EASINGS } from '@toeverything/components/board-types';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import { EASINGS } from '@toeverything/components/board-types';
|
||||
import { getStrokeOutlinePoints, getStrokePoints } from 'perfect-freehand';
|
||||
import { getShapeStyle } from '../shared/shape-styles';
|
||||
|
||||
export function getEllipseStrokePoints(
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
import { Utils, SVGContainer } from '@tldraw/core';
|
||||
import { SVGContainer, Utils } from '@tldraw/core';
|
||||
import {
|
||||
FrameShape,
|
||||
TDShapeType,
|
||||
TDMeta,
|
||||
TDShapeType,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import {
|
||||
defaultStyle,
|
||||
getShapeStyle,
|
||||
getBoundsRectangle,
|
||||
getShapeStyle,
|
||||
transformRectangle,
|
||||
transformSingleRectangle,
|
||||
} from '../shared';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { Frame } from './components/Frame';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
|
||||
type T = FrameShape;
|
||||
type E = SVGSVGElement;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { BINDING_DISTANCE } from '@toeverything/components/board-types';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import { BINDING_DISTANCE } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
|
||||
interface RectangleSvgProps {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { BINDING_DISTANCE } from '@toeverything/components/board-types';
|
||||
|
||||
interface BindingIndicatorProps {
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import { Utils, SVGContainer } from '@tldraw/core';
|
||||
import { defaultStyle } from '../shared/shape-styles';
|
||||
import { SVGContainer, Utils } from '@tldraw/core';
|
||||
import {
|
||||
TDShapeType,
|
||||
GHOSTED_OPACITY,
|
||||
GroupShape,
|
||||
TDMeta,
|
||||
GHOSTED_OPACITY,
|
||||
TDShapeType,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import { commonColors, getBoundsRectangle } from '../shared';
|
||||
import { defaultStyle } from '../shared/shape-styles';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { getBoundsRectangle, commonColors } from '../shared';
|
||||
|
||||
type T = GroupShape;
|
||||
type E = SVGSVGElement;
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
import * as React from 'react';
|
||||
import { Utils, SVGContainer, TLBounds } from '@tldraw/core';
|
||||
import {
|
||||
HexagonShape,
|
||||
TDShapeType,
|
||||
TDMeta,
|
||||
TDShape,
|
||||
DashStyle,
|
||||
BINDING_DISTANCE,
|
||||
GHOSTED_OPACITY,
|
||||
LABEL_POINT,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import {
|
||||
defaultStyle,
|
||||
getBoundsRectangle,
|
||||
transformRectangle,
|
||||
transformSingleRectangle,
|
||||
getFontStyle,
|
||||
TextLabel,
|
||||
getShapeStyle,
|
||||
} from '../shared';
|
||||
import { SVGContainer, TLBounds, Utils } from '@tldraw/core';
|
||||
import {
|
||||
intersectBoundsPolygon,
|
||||
intersectLineSegmentPolyline,
|
||||
intersectRayLineSegment,
|
||||
} from '@tldraw/intersect';
|
||||
import Vec from '@tldraw/vec';
|
||||
import { getHexagonCentroid, getHexagonPoints } from './hexagon-helpers';
|
||||
import {
|
||||
BINDING_DISTANCE,
|
||||
DashStyle,
|
||||
GHOSTED_OPACITY,
|
||||
HexagonShape,
|
||||
LABEL_POINT,
|
||||
TDMeta,
|
||||
TDShape,
|
||||
TDShapeType,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import { DrawHexagon } from './components/DrawHexagon';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
defaultStyle,
|
||||
getBoundsRectangle,
|
||||
getFontStyle,
|
||||
getShapeStyle,
|
||||
TextLabel,
|
||||
transformRectangle,
|
||||
transformSingleRectangle,
|
||||
} from '../shared';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { DashedHexagon } from './components/DashedHexagon';
|
||||
import { DrawHexagon } from './components/DrawHexagon';
|
||||
import { HexagonBindingIndicator } from './components/HexagonBindingIndicator';
|
||||
import { getHexagonCentroid, getHexagonPoints } from './hexagon-helpers';
|
||||
|
||||
type T = HexagonShape;
|
||||
type E = HTMLDivElement;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as React from 'react';
|
||||
import { Utils } from '@tldraw/core';
|
||||
import Vec from '@tldraw/vec';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import { getHexagonPoints } from '../hexagon-helpers';
|
||||
import Vec from '@tldraw/vec';
|
||||
|
||||
interface HexagonSvgProps {
|
||||
id: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import {
|
||||
getHexagonIndicatorPathTDSnapshot,
|
||||
getHexagonPath,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { BINDING_DISTANCE } from '@toeverything/components/board-types';
|
||||
import { getHexagonPoints } from '../hexagon-helpers';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Utils } from '@tldraw/core';
|
||||
import Vec from '@tldraw/vec';
|
||||
import getStroke, { getStrokePoints } from 'perfect-freehand';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import { getShapeStyle, getOffsetPolygon } from '../shared';
|
||||
import getStroke, { getStrokePoints } from 'perfect-freehand';
|
||||
import { getOffsetPolygon, getShapeStyle } from '../shared';
|
||||
function getPonits(w: number, h: number) {
|
||||
return [
|
||||
[w / 5, 0],
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import * as React from 'react';
|
||||
import { Utils, HTMLContainer } from '@tldraw/core';
|
||||
import { HTMLContainer, Utils } from '@tldraw/core';
|
||||
import {
|
||||
TDShapeType,
|
||||
TDMeta,
|
||||
GHOSTED_OPACITY,
|
||||
ImageShape,
|
||||
TDImageAsset,
|
||||
GHOSTED_OPACITY,
|
||||
TDMeta,
|
||||
TDShapeType,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
defaultStyle,
|
||||
getBoundsRectangle,
|
||||
transformRectangle,
|
||||
transformSingleRectangle,
|
||||
} from '../shared';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
|
||||
type T = ImageShape;
|
||||
type E = HTMLDivElement;
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
import { TDShape, TDShapeType } from '@toeverything/components/board-types';
|
||||
import type { TDShapeUtil } from './TDShapeUtil';
|
||||
import { RectangleUtil } from './rectangle-util';
|
||||
import { TriangleUtil } from './triangle-util';
|
||||
import { HexagonUtil } from './hexagon-util';
|
||||
import { ArrowUtil } from './arrow-util';
|
||||
import { DrawUtil } from './draw-util';
|
||||
import { EllipseUtil } from './ellipse-util';
|
||||
import { GroupUtil } from './group-util';
|
||||
import { ImageUtil } from './image-util';
|
||||
import { VideoUtil } from './video-util';
|
||||
import { EditorUtil } from './editor-util';
|
||||
import { PentagramUtil } from './pentagram-util';
|
||||
import { WhiteArrowUtil } from './white-arrow-util';
|
||||
import { EllipseUtil } from './ellipse-util';
|
||||
import { FrameUtil } from './frame-util';
|
||||
import { GroupUtil } from './group-util';
|
||||
import { HexagonUtil } from './hexagon-util';
|
||||
import { ImageUtil } from './image-util';
|
||||
import { PentagramUtil } from './pentagram-util';
|
||||
import { RectangleUtil } from './rectangle-util';
|
||||
import type { TDShapeUtil } from './TDShapeUtil';
|
||||
import { TriangleUtil } from './triangle-util';
|
||||
import { VideoUtil } from './video-util';
|
||||
import { WhiteArrowUtil } from './white-arrow-util';
|
||||
|
||||
export { clearPrevSize } from './shared/get-text-size';
|
||||
export { defaultStyle } from './shared/shape-styles';
|
||||
export { TDShapeUtil } from './TDShapeUtil';
|
||||
export { getTrianglePoints } from './triangle-util/triangle-helpers';
|
||||
|
||||
export const Rectangle = new RectangleUtil();
|
||||
export const Triangle = new TriangleUtil();
|
||||
@@ -54,7 +57,3 @@ export const getShapeUtil = <T extends TDShape>(
|
||||
return shapeUtils[shape] as unknown as TDShapeUtil<T>;
|
||||
return shapeUtils[shape.type] as unknown as TDShapeUtil<T>;
|
||||
};
|
||||
|
||||
export { getTrianglePoints } from './triangle-util/triangle-helpers';
|
||||
export { defaultStyle } from './shared/shape-styles';
|
||||
export { clearPrevSize } from './shared/get-text-size';
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
import * as React from 'react';
|
||||
import { Utils, SVGContainer, TLBounds } from '@tldraw/core';
|
||||
import {
|
||||
PentagramShape,
|
||||
TDShapeType,
|
||||
TDMeta,
|
||||
TDShape,
|
||||
DashStyle,
|
||||
BINDING_DISTANCE,
|
||||
GHOSTED_OPACITY,
|
||||
LABEL_POINT,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import {
|
||||
defaultStyle,
|
||||
getBoundsRectangle,
|
||||
transformRectangle,
|
||||
transformSingleRectangle,
|
||||
getFontStyle,
|
||||
TextLabel,
|
||||
getShapeStyle,
|
||||
} from '../shared';
|
||||
import { SVGContainer, TLBounds, Utils } from '@tldraw/core';
|
||||
import {
|
||||
intersectBoundsPolygon,
|
||||
intersectLineSegmentPolyline,
|
||||
intersectRayLineSegment,
|
||||
} from '@tldraw/intersect';
|
||||
import Vec from '@tldraw/vec';
|
||||
import { getPentagramCentroid, getPentagramPoints } from './pentagram-helpers';
|
||||
import {
|
||||
BINDING_DISTANCE,
|
||||
DashStyle,
|
||||
GHOSTED_OPACITY,
|
||||
LABEL_POINT,
|
||||
PentagramShape,
|
||||
TDMeta,
|
||||
TDShape,
|
||||
TDShapeType,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import { DrawPentagram } from './components/DrawPentagram';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
defaultStyle,
|
||||
getBoundsRectangle,
|
||||
getFontStyle,
|
||||
getShapeStyle,
|
||||
TextLabel,
|
||||
transformRectangle,
|
||||
transformSingleRectangle,
|
||||
} from '../shared';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { DashedPentagram } from './components/DashedPentagram';
|
||||
import { DrawPentagram } from './components/DrawPentagram';
|
||||
import { PentagramBindingIndicator } from './components/PentagramBindingIndicator';
|
||||
import { getPentagramCentroid, getPentagramPoints } from './pentagram-helpers';
|
||||
|
||||
type T = PentagramShape;
|
||||
type E = HTMLDivElement;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as React from 'react';
|
||||
import { Utils } from '@tldraw/core';
|
||||
import Vec from '@tldraw/vec';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import { getPentagramPoints } from '../pentagram-helpers';
|
||||
import Vec from '@tldraw/vec';
|
||||
|
||||
interface PentagramSvgProps {
|
||||
id: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import {
|
||||
getPentagramIndicatorPathTDSnapshot,
|
||||
getPentagramPath,
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { BINDING_DISTANCE } from '@toeverything/components/board-types';
|
||||
import { getPentagramPoints } from '../pentagram-helpers';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Utils } from '@tldraw/core';
|
||||
import Vec from '@tldraw/vec';
|
||||
import getStroke, { getStrokePoints } from 'perfect-freehand';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import { getShapeStyle, getOffsetPolygon } from '../shared';
|
||||
import getStroke, { getStrokePoints } from 'perfect-freehand';
|
||||
import { getOffsetPolygon, getShapeStyle } from '../shared';
|
||||
function getPonits(w: number, h: number) {
|
||||
return [
|
||||
[0, (76 / 200) * h],
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import * as React from 'react';
|
||||
import { Utils, SVGContainer } from '@tldraw/core';
|
||||
import { SVGContainer, Utils } from '@tldraw/core';
|
||||
import {
|
||||
RectangleShape,
|
||||
DashStyle,
|
||||
TDShapeType,
|
||||
TDMeta,
|
||||
GHOSTED_OPACITY,
|
||||
LABEL_POINT,
|
||||
RectangleShape,
|
||||
TDMeta,
|
||||
TDShapeType,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
defaultStyle,
|
||||
getShapeStyle,
|
||||
getBoundsRectangle,
|
||||
transformRectangle,
|
||||
getFontStyle,
|
||||
getShapeStyle,
|
||||
transformRectangle,
|
||||
transformSingleRectangle,
|
||||
} from '../shared';
|
||||
import { TextLabel } from '../shared/text-label';
|
||||
import { getRectangleIndicatorPathTDSnapshot } from './rectangle-helpers';
|
||||
import { DrawRectangle } from './components/DrawRectangle';
|
||||
import { DashedRectangle } from './components/DashedRectangle';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { BindingIndicator } from './components/BindingIndicator';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import { DashedRectangle } from './components/DashedRectangle';
|
||||
import { DrawRectangle } from './components/DrawRectangle';
|
||||
import { getRectangleIndicatorPathTDSnapshot } from './rectangle-helpers';
|
||||
|
||||
type T = RectangleShape;
|
||||
type E = HTMLDivElement;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { BINDING_DISTANCE } from '@toeverything/components/board-types';
|
||||
|
||||
interface BindingIndicatorProps {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { Utils } from '@tldraw/core';
|
||||
import { BINDING_DISTANCE } from '@toeverything/components/board-types';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import { BINDING_DISTANCE } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
|
||||
interface RectangleSvgProps {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import {
|
||||
getRectangleIndicatorPathTDSnapshot,
|
||||
getRectanglePath,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Utils } from '@tldraw/core';
|
||||
import Vec from '@tldraw/vec';
|
||||
import getStroke, { getStrokePoints } from 'perfect-freehand';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import getStroke, { getStrokePoints } from 'perfect-freehand';
|
||||
import { getShapeStyle } from '../shared';
|
||||
|
||||
function getRectangleDrawPoints(
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { TLBounds } from '@tldraw/core';
|
||||
import { getFontFace, getFontSize } from './shape-styles';
|
||||
import { getTextAlign } from './get-text-align';
|
||||
import {
|
||||
LINE_HEIGHT,
|
||||
AlignStyle,
|
||||
LINE_HEIGHT,
|
||||
ShapeStyles,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { getTextAlign } from './get-text-align';
|
||||
import { getFontFace, getFontSize } from './shape-styles';
|
||||
|
||||
export function getTextSvgElement(
|
||||
text: string,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
export * from './get-bounds-rectangle';
|
||||
export * from './get-text-align';
|
||||
export * from './get-text-size';
|
||||
export * from './get-text-svg-element';
|
||||
export * from './shape-styles';
|
||||
export * from './get-bounds-rectangle';
|
||||
export * from './transform-rectangle';
|
||||
export * from './transform-single-rectangle';
|
||||
export * from './text-label';
|
||||
export * from './polygon-utils';
|
||||
export * from './label-mask';
|
||||
export * from './normalize-text';
|
||||
export * from './polygon-utils';
|
||||
export * from './shape-styles';
|
||||
export * from './stop-propagation';
|
||||
export * from './text-label';
|
||||
export * from './transform-rectangle';
|
||||
export * from './transform-single-rectangle';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { TLBounds } from '@tldraw/core';
|
||||
import * as React from 'react';
|
||||
|
||||
interface WithLabelMaskProps {
|
||||
id: string;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Utils } from '@tldraw/core';
|
||||
import {
|
||||
Theme,
|
||||
AlignStyle,
|
||||
ColorStyle,
|
||||
DashStyle,
|
||||
ShapeStyles,
|
||||
FontSizeStyle,
|
||||
FontStyle,
|
||||
AlignStyle,
|
||||
ShapeStyles,
|
||||
StrokeWidth,
|
||||
Theme,
|
||||
} from '@toeverything/components/board-types';
|
||||
|
||||
const canvasLight = '#fafafa';
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import { stopPropagation } from './stop-propagation';
|
||||
import {
|
||||
GHOSTED_OPACITY,
|
||||
LETTER_SPACING,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { normalizeText } from './normalize-text';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import * as React from 'react';
|
||||
import { getTextLabelSize } from './get-text-size';
|
||||
import { normalizeText } from './normalize-text';
|
||||
import { stopPropagation } from './stop-propagation';
|
||||
import { TextAreaUtils } from './text-area-utils';
|
||||
|
||||
export interface TextLabelProps {
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
import * as React from 'react';
|
||||
import { Utils, SVGContainer, TLBounds } from '@tldraw/core';
|
||||
import {
|
||||
TriangleShape,
|
||||
TDShapeType,
|
||||
TDMeta,
|
||||
TDShape,
|
||||
DashStyle,
|
||||
BINDING_DISTANCE,
|
||||
GHOSTED_OPACITY,
|
||||
LABEL_POINT,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import {
|
||||
defaultStyle,
|
||||
getBoundsRectangle,
|
||||
transformRectangle,
|
||||
transformSingleRectangle,
|
||||
getFontStyle,
|
||||
TextLabel,
|
||||
getShapeStyle,
|
||||
} from '../shared';
|
||||
import { SVGContainer, TLBounds, Utils } from '@tldraw/core';
|
||||
import {
|
||||
intersectBoundsPolygon,
|
||||
intersectLineSegmentPolyline,
|
||||
intersectRayLineSegment,
|
||||
} from '@tldraw/intersect';
|
||||
import Vec from '@tldraw/vec';
|
||||
import { getTriangleCentroid, getTrianglePoints } from './triangle-helpers';
|
||||
import {
|
||||
BINDING_DISTANCE,
|
||||
DashStyle,
|
||||
GHOSTED_OPACITY,
|
||||
LABEL_POINT,
|
||||
TDMeta,
|
||||
TDShape,
|
||||
TDShapeType,
|
||||
TriangleShape,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import { DrawTriangle } from './components/DrawTriangle';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
defaultStyle,
|
||||
getBoundsRectangle,
|
||||
getFontStyle,
|
||||
getShapeStyle,
|
||||
TextLabel,
|
||||
transformRectangle,
|
||||
transformSingleRectangle,
|
||||
} from '../shared';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { DashedTriangle } from './components/DashedTriangle';
|
||||
import { DrawTriangle } from './components/DrawTriangle';
|
||||
import { TriangleBindingIndicator } from './components/TriangleBindingIndicator';
|
||||
import { getTriangleCentroid, getTrianglePoints } from './triangle-helpers';
|
||||
|
||||
type T = TriangleShape;
|
||||
type E = HTMLDivElement;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as React from 'react';
|
||||
import { Utils } from '@tldraw/core';
|
||||
import Vec from '@tldraw/vec';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import { getTrianglePoints } from '../triangle-helpers';
|
||||
import Vec from '@tldraw/vec';
|
||||
|
||||
interface TriangleSvgProps {
|
||||
id: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import {
|
||||
getTriangleIndicatorPathTDSnapshot,
|
||||
getTrianglePath,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { BINDING_DISTANCE } from '@toeverything/components/board-types';
|
||||
import { getTrianglePoints } from '../triangle-helpers';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Utils } from '@tldraw/core';
|
||||
import Vec from '@tldraw/vec';
|
||||
import getStroke, { getStrokePoints } from 'perfect-freehand';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import { getShapeStyle, getOffsetPolygon } from '../shared';
|
||||
import getStroke, { getStrokePoints } from 'perfect-freehand';
|
||||
import { getOffsetPolygon, getShapeStyle } from '../shared';
|
||||
|
||||
export function getTrianglePoints(size: number[], offset = 0, rotation = 0) {
|
||||
const [w, h] = size;
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import * as React from 'react';
|
||||
import { Utils, HTMLContainer } from '@tldraw/core';
|
||||
import { HTMLContainer, Utils } from '@tldraw/core';
|
||||
import {
|
||||
TDShapeType,
|
||||
TDMeta,
|
||||
VideoShape,
|
||||
TDVideoAsset,
|
||||
GHOSTED_OPACITY,
|
||||
TDMeta,
|
||||
TDShapeType,
|
||||
TDVideoAsset,
|
||||
VideoShape,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
defaultStyle,
|
||||
getBoundsRectangle,
|
||||
transformRectangle,
|
||||
transformSingleRectangle,
|
||||
} from '../shared';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
|
||||
type T = VideoShape;
|
||||
type E = HTMLDivElement;
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
import * as React from 'react';
|
||||
import { Utils, SVGContainer, TLBounds } from '@tldraw/core';
|
||||
import {
|
||||
WhiteArrowShape,
|
||||
TDShapeType,
|
||||
TDMeta,
|
||||
TDShape,
|
||||
DashStyle,
|
||||
BINDING_DISTANCE,
|
||||
GHOSTED_OPACITY,
|
||||
LABEL_POINT,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import {
|
||||
defaultStyle,
|
||||
getBoundsRectangle,
|
||||
transformRectangle,
|
||||
transformSingleRectangle,
|
||||
getFontStyle,
|
||||
TextLabel,
|
||||
getShapeStyle,
|
||||
} from '../shared';
|
||||
import { SVGContainer, TLBounds, Utils } from '@tldraw/core';
|
||||
import {
|
||||
intersectBoundsPolygon,
|
||||
intersectLineSegmentPolyline,
|
||||
intersectRayLineSegment,
|
||||
} from '@tldraw/intersect';
|
||||
import Vec from '@tldraw/vec';
|
||||
import {
|
||||
BINDING_DISTANCE,
|
||||
DashStyle,
|
||||
GHOSTED_OPACITY,
|
||||
LABEL_POINT,
|
||||
TDMeta,
|
||||
TDShape,
|
||||
TDShapeType,
|
||||
WhiteArrowShape,
|
||||
} from '@toeverything/components/board-types';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
defaultStyle,
|
||||
getBoundsRectangle,
|
||||
getFontStyle,
|
||||
getShapeStyle,
|
||||
TextLabel,
|
||||
transformRectangle,
|
||||
transformSingleRectangle,
|
||||
} from '../shared';
|
||||
import { TDShapeUtil } from '../TDShapeUtil';
|
||||
import { DashedWhiteArrow } from './components/DashedWhiteArrow';
|
||||
import { DrawWhiteArrow } from './components/DrawWhiteArrow';
|
||||
import { WhiteArrowBindingIndicator } from './components/WhiteArrowBindingIndicator';
|
||||
import {
|
||||
getWhiteArrowCentroid,
|
||||
getWhiteArrowPoints,
|
||||
} from './white-arrow-helpers';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
import { DrawWhiteArrow } from './components/DrawWhiteArrow';
|
||||
import { DashedWhiteArrow } from './components/DashedWhiteArrow';
|
||||
import { WhiteArrowBindingIndicator } from './components/WhiteArrowBindingIndicator';
|
||||
|
||||
type T = WhiteArrowShape;
|
||||
type E = HTMLDivElement;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as React from 'react';
|
||||
import { Utils } from '@tldraw/core';
|
||||
import Vec from '@tldraw/vec';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import { getWhiteArrowPoints } from '../white-arrow-helpers';
|
||||
import Vec from '@tldraw/vec';
|
||||
|
||||
interface WhiteArrowSvgProps {
|
||||
id: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import * as React from 'react';
|
||||
import { getShapeStyle } from '../../shared';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import {
|
||||
getWhiteArrowIndicatorPathTDSnapshot,
|
||||
getWhiteArrowPath,
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { BINDING_DISTANCE } from '@toeverything/components/board-types';
|
||||
import { getWhiteArrowPoints } from '../white-arrow-helpers';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Utils } from '@tldraw/core';
|
||||
import Vec from '@tldraw/vec';
|
||||
import getStroke, { getStrokePoints } from 'perfect-freehand';
|
||||
import type { ShapeStyles } from '@toeverything/components/board-types';
|
||||
import { getShapeStyle, getOffsetPolygon } from '../shared';
|
||||
import getStroke, { getStrokePoints } from 'perfect-freehand';
|
||||
import { getOffsetPolygon, getShapeStyle } from '../shared';
|
||||
function getPonits(w: number, h: number) {
|
||||
return [
|
||||
[w / 2, 0],
|
||||
|
||||
Reference in New Issue
Block a user