rename app folder to editor (#1528)

Turns out there was one last terrible renaming PR to make. This PR
renames the `@tldraw.editor`'s `app` folder to `editor`. It should not
effect exports but it will be a gnarly diff.

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package (will not publish a new version)
This commit is contained in:
Steve Ruiz 2023-06-06 17:01:54 +01:00 committed by GitHub
parent 5d826c926d
commit 355ed1de72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
186 changed files with 173 additions and 169 deletions

View file

@ -12,95 +12,6 @@ export {
TldrawEditor,
type TldrawEditorProps,
} from './lib/TldrawEditor'
export { Editor, type TLAnimationOptions, type TLEditorOptions } from './lib/app/Editor'
export { ArrowShapeUtil } from './lib/app/shapeutils/ArrowShapeUtil/ArrowShapeUtil'
export { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/app/shapeutils/BaseBoxShapeUtil'
export { BookmarkShapeUtil } from './lib/app/shapeutils/BookmarkShapeUtil/BookmarkShapeUtil'
export { DrawShapeUtil } from './lib/app/shapeutils/DrawShapeUtil/DrawShapeUtil'
export { EmbedShapeUtil } from './lib/app/shapeutils/EmbedShapeUtil/EmbedShapeUtil'
export { FrameShapeUtil } from './lib/app/shapeutils/FrameShapeUtil/FrameShapeUtil'
export { GeoShapeUtil } from './lib/app/shapeutils/GeoShapeUtil/GeoShapeUtil'
export { GroupShapeUtil } from './lib/app/shapeutils/GroupShapeUtil/GroupShapeUtil'
export { HighlightShapeUtil } from './lib/app/shapeutils/HighlightShapeUtil/HighlightShapeUtil'
export { ImageShapeUtil } from './lib/app/shapeutils/ImageShapeUtil/ImageShapeUtil'
export {
LineShapeUtil,
getSplineForLineShape,
} from './lib/app/shapeutils/LineShapeUtil/LineShapeUtil'
export { NoteShapeUtil } from './lib/app/shapeutils/NoteShapeUtil/NoteShapeUtil'
export {
ShapeUtil,
type TLOnBeforeCreateHandler,
type TLOnBeforeUpdateHandler,
type TLOnBindingChangeHandler,
type TLOnChildrenChangeHandler,
type TLOnClickHandler,
type TLOnDoubleClickHandleHandler,
type TLOnDoubleClickHandler,
type TLOnDragHandler,
type TLOnEditEndHandler,
type TLOnHandleChangeHandler,
type TLOnResizeEndHandler,
type TLOnResizeHandler,
type TLOnResizeStartHandler,
type TLOnRotateEndHandler,
type TLOnRotateHandler,
type TLOnRotateStartHandler,
type TLOnTranslateEndHandler,
type TLOnTranslateHandler,
type TLOnTranslateStartHandler,
type TLResizeInfo,
type TLResizeMode,
type TLShapeUtilConstructor,
type TLShapeUtilFlag,
} from './lib/app/shapeutils/ShapeUtil'
export { INDENT, TextShapeUtil } from './lib/app/shapeutils/TextShapeUtil/TextShapeUtil'
export { VideoShapeUtil } from './lib/app/shapeutils/VideoShapeUtil/VideoShapeUtil'
export { BaseBoxShapeTool } from './lib/app/tools/BaseBoxShapeTool/BaseBoxShapeTool'
export { StateNode, type TLStateNodeConstructor } from './lib/app/tools/StateNode'
export { type TLContent } from './lib/app/types/clipboard-types'
export { type TLEventMap, type TLEventMapHandler } from './lib/app/types/emit-types'
export {
EVENT_NAME_MAP,
type TLBaseEventInfo,
type TLCLickEventName,
type TLCancelEvent,
type TLCancelEventInfo,
type TLClickEvent,
type TLClickEventInfo,
type TLCompleteEvent,
type TLCompleteEventInfo,
type TLEnterEventHandler,
type TLEventHandlers,
type TLEventInfo,
type TLEventName,
type TLExitEventHandler,
type TLInterruptEvent,
type TLInterruptEventInfo,
type TLKeyboardEvent,
type TLKeyboardEventInfo,
type TLKeyboardEventName,
type TLPinchEvent,
type TLPinchEventInfo,
type TLPinchEventName,
type TLPointerEvent,
type TLPointerEventInfo,
type TLPointerEventName,
type TLPointerEventTarget,
type TLTickEvent,
type TLWheelEvent,
type TLWheelEventInfo,
type UiEvent,
type UiEventType,
} from './lib/app/types/event-types'
export {
type TLCommand,
type TLCommandHandler,
type TLHistoryEntry,
type TLHistoryMark,
} from './lib/app/types/history-types'
export { type RequiredKeys } from './lib/app/types/misc-types'
export { type TLResizeHandle, type TLSelectionHandle } from './lib/app/types/selection-types'
export {
defaultEditorAssetUrls,
setDefaultEditorAssetUrls,
@ -169,6 +80,95 @@ export {
WAY_TOO_BIG_ARROW_BEND_FACTOR,
ZOOMS,
} from './lib/constants'
export { Editor, type TLAnimationOptions, type TLEditorOptions } from './lib/editor/Editor'
export { ArrowShapeUtil } from './lib/editor/shapeutils/ArrowShapeUtil/ArrowShapeUtil'
export { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapeutils/BaseBoxShapeUtil'
export { BookmarkShapeUtil } from './lib/editor/shapeutils/BookmarkShapeUtil/BookmarkShapeUtil'
export { DrawShapeUtil } from './lib/editor/shapeutils/DrawShapeUtil/DrawShapeUtil'
export { EmbedShapeUtil } from './lib/editor/shapeutils/EmbedShapeUtil/EmbedShapeUtil'
export { FrameShapeUtil } from './lib/editor/shapeutils/FrameShapeUtil/FrameShapeUtil'
export { GeoShapeUtil } from './lib/editor/shapeutils/GeoShapeUtil/GeoShapeUtil'
export { GroupShapeUtil } from './lib/editor/shapeutils/GroupShapeUtil/GroupShapeUtil'
export { HighlightShapeUtil } from './lib/editor/shapeutils/HighlightShapeUtil/HighlightShapeUtil'
export { ImageShapeUtil } from './lib/editor/shapeutils/ImageShapeUtil/ImageShapeUtil'
export {
LineShapeUtil,
getSplineForLineShape,
} from './lib/editor/shapeutils/LineShapeUtil/LineShapeUtil'
export { NoteShapeUtil } from './lib/editor/shapeutils/NoteShapeUtil/NoteShapeUtil'
export {
ShapeUtil,
type TLOnBeforeCreateHandler,
type TLOnBeforeUpdateHandler,
type TLOnBindingChangeHandler,
type TLOnChildrenChangeHandler,
type TLOnClickHandler,
type TLOnDoubleClickHandleHandler,
type TLOnDoubleClickHandler,
type TLOnDragHandler,
type TLOnEditEndHandler,
type TLOnHandleChangeHandler,
type TLOnResizeEndHandler,
type TLOnResizeHandler,
type TLOnResizeStartHandler,
type TLOnRotateEndHandler,
type TLOnRotateHandler,
type TLOnRotateStartHandler,
type TLOnTranslateEndHandler,
type TLOnTranslateHandler,
type TLOnTranslateStartHandler,
type TLResizeInfo,
type TLResizeMode,
type TLShapeUtilConstructor,
type TLShapeUtilFlag,
} from './lib/editor/shapeutils/ShapeUtil'
export { INDENT, TextShapeUtil } from './lib/editor/shapeutils/TextShapeUtil/TextShapeUtil'
export { VideoShapeUtil } from './lib/editor/shapeutils/VideoShapeUtil/VideoShapeUtil'
export { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'
export { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'
export { type TLContent } from './lib/editor/types/clipboard-types'
export { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'
export {
EVENT_NAME_MAP,
type TLBaseEventInfo,
type TLCLickEventName,
type TLCancelEvent,
type TLCancelEventInfo,
type TLClickEvent,
type TLClickEventInfo,
type TLCompleteEvent,
type TLCompleteEventInfo,
type TLEnterEventHandler,
type TLEventHandlers,
type TLEventInfo,
type TLEventName,
type TLExitEventHandler,
type TLInterruptEvent,
type TLInterruptEventInfo,
type TLKeyboardEvent,
type TLKeyboardEventInfo,
type TLKeyboardEventName,
type TLPinchEvent,
type TLPinchEventInfo,
type TLPinchEventName,
type TLPointerEvent,
type TLPointerEventInfo,
type TLPointerEventName,
type TLPointerEventTarget,
type TLTickEvent,
type TLWheelEvent,
type TLWheelEventInfo,
type UiEvent,
type UiEventType,
} from './lib/editor/types/event-types'
export {
type TLCommand,
type TLCommandHandler,
type TLHistoryEntry,
type TLHistoryMark,
} from './lib/editor/types/history-types'
export { type RequiredKeys } from './lib/editor/types/misc-types'
export { type TLResizeHandle, type TLSelectionHandle } from './lib/editor/types/selection-types'
export { normalizeWheel } from './lib/hooks/shared'
export { useContainer } from './lib/hooks/useContainer'
export { useEditor } from './lib/hooks/useEditor'

View file

@ -2,12 +2,12 @@ import { Store, StoreSnapshot } from '@tldraw/store'
import { TLAsset, TLRecord, TLStore } from '@tldraw/tlschema'
import { annotateError } from '@tldraw/utils'
import React, { memo, useCallback, useLayoutEffect, useState, useSyncExternalStore } from 'react'
import { Editor } from './app/Editor'
import { TLStateNodeConstructor } from './app/tools/StateNode'
import { TLEditorAssetUrls, defaultEditorAssetUrls } from './assetUrls'
import { DefaultErrorFallback } from './components/DefaultErrorFallback'
import { OptionalErrorBoundary } from './components/ErrorBoundary'
import { TLShapeInfo } from './config/createTLStore'
import { Editor } from './editor/Editor'
import { TLStateNodeConstructor } from './editor/tools/StateNode'
import { ContainerProvider, useContainer } from './hooks/useContainer'
import { useCursor } from './hooks/useCursor'
import { useDarkMode } from './hooks/useDarkMode'

View file

@ -1,7 +1,7 @@
import classNames from 'classnames'
import { useEffect, useLayoutEffect, useRef, useState } from 'react'
import { useValue } from 'signia-react'
import { Editor } from '../app/Editor'
import { Editor } from '../editor/Editor'
import { EditorContext } from '../hooks/useEditor'
import { hardResetEditor } from '../utils/hard-reset'
import { refreshPage } from '../utils/refresh-page'

View file

@ -1,7 +1,11 @@
import { rangeIntersection } from '@tldraw/primitives'
import classNames from 'classnames'
import * as React from 'react'
import { type GapsSnapLine, type PointsSnapLine, type SnapLine } from '../app/managers/SnapManager'
import {
type GapsSnapLine,
type PointsSnapLine,
type SnapLine,
} from '../editor/managers/SnapManager'
function PointsSnapLine({ points, zoom }: { zoom: number } & PointsSnapLine) {
const l = 2.5 / zoom

View file

@ -1,7 +1,7 @@
import { Matrix2d, toDomPrecision } from '@tldraw/primitives'
import * as React from 'react'
import { track } from 'signia-react'
import { TLPointerEventInfo } from '../app/types/event-types'
import { TLPointerEventInfo } from '../editor/types/event-types'
import { useEditor } from '../hooks/useEditor'
import { releasePointerCapture, setPointerCapture } from '../utils/dom'
import { getPointerInfo } from '../utils/svg'

View file

@ -7,7 +7,7 @@ import {
useStateTracking,
} from 'signia-react'
import { useEditor } from '../..'
import { ShapeUtil } from '../app/shapeutils/ShapeUtil'
import { ShapeUtil } from '../editor/shapeutils/ShapeUtil'
import { useEditorComponents } from '../hooks/useEditorComponents'
import { useQuickReactor } from '../hooks/useQuickReactor'
import { useShapeEvents } from '../hooks/useShapeEvents'

View file

@ -7,8 +7,8 @@ import {
useValue,
} from 'signia-react'
import { useEditor } from '../..'
import type { Editor } from '../app/Editor'
import { ShapeUtil } from '../app/shapeutils/ShapeUtil'
import type { Editor } from '../editor/Editor'
import { ShapeUtil } from '../editor/shapeutils/ShapeUtil'
import { useEditorComponents } from '../hooks/useEditorComponents'
import { OptionalErrorBoundary } from './ErrorBoundary'

View file

@ -1,6 +1,6 @@
import { Migrations, Store, StoreSnapshot } from '@tldraw/store'
import { TLRecord, TLStore, createTLSchema } from '@tldraw/tlschema'
import { TLShapeUtilConstructor } from '../app/shapeutils/ShapeUtil'
import { TLShapeUtilConstructor } from '../editor/shapeutils/ShapeUtil'
/** @public */
export type TLShapeInfo = {

View file

@ -1,16 +1,16 @@
import { ArrowShapeUtil } from '../app/shapeutils/ArrowShapeUtil/ArrowShapeUtil'
import { BookmarkShapeUtil } from '../app/shapeutils/BookmarkShapeUtil/BookmarkShapeUtil'
import { DrawShapeUtil } from '../app/shapeutils/DrawShapeUtil/DrawShapeUtil'
import { EmbedShapeUtil } from '../app/shapeutils/EmbedShapeUtil/EmbedShapeUtil'
import { FrameShapeUtil } from '../app/shapeutils/FrameShapeUtil/FrameShapeUtil'
import { GeoShapeUtil } from '../app/shapeutils/GeoShapeUtil/GeoShapeUtil'
import { GroupShapeUtil } from '../app/shapeutils/GroupShapeUtil/GroupShapeUtil'
import { HighlightShapeUtil } from '../app/shapeutils/HighlightShapeUtil/HighlightShapeUtil'
import { ImageShapeUtil } from '../app/shapeutils/ImageShapeUtil/ImageShapeUtil'
import { LineShapeUtil } from '../app/shapeutils/LineShapeUtil/LineShapeUtil'
import { NoteShapeUtil } from '../app/shapeutils/NoteShapeUtil/NoteShapeUtil'
import { TextShapeUtil } from '../app/shapeutils/TextShapeUtil/TextShapeUtil'
import { VideoShapeUtil } from '../app/shapeutils/VideoShapeUtil/VideoShapeUtil'
import { ArrowShapeUtil } from '../editor/shapeutils/ArrowShapeUtil/ArrowShapeUtil'
import { BookmarkShapeUtil } from '../editor/shapeutils/BookmarkShapeUtil/BookmarkShapeUtil'
import { DrawShapeUtil } from '../editor/shapeutils/DrawShapeUtil/DrawShapeUtil'
import { EmbedShapeUtil } from '../editor/shapeutils/EmbedShapeUtil/EmbedShapeUtil'
import { FrameShapeUtil } from '../editor/shapeutils/FrameShapeUtil/FrameShapeUtil'
import { GeoShapeUtil } from '../editor/shapeutils/GeoShapeUtil/GeoShapeUtil'
import { GroupShapeUtil } from '../editor/shapeutils/GroupShapeUtil/GroupShapeUtil'
import { HighlightShapeUtil } from '../editor/shapeutils/HighlightShapeUtil/HighlightShapeUtil'
import { ImageShapeUtil } from '../editor/shapeutils/ImageShapeUtil/ImageShapeUtil'
import { LineShapeUtil } from '../editor/shapeutils/LineShapeUtil/LineShapeUtil'
import { NoteShapeUtil } from '../editor/shapeutils/NoteShapeUtil/NoteShapeUtil'
import { TextShapeUtil } from '../editor/shapeutils/TextShapeUtil/TextShapeUtil'
import { VideoShapeUtil } from '../editor/shapeutils/VideoShapeUtil/VideoShapeUtil'
import { TLShapeInfo } from './createTLStore'
/** @public */

View file

@ -1,15 +1,15 @@
import { ArrowShapeTool } from '../app/tools/ArrowShapeTool/ArrowShapeTool'
import { DrawShapeTool } from '../app/tools/DrawShapeTool/DrawShapeTool'
import { EraserShapeTool } from '../app/tools/EraserShapeTool/EraserShapeTool'
import { FrameShapeTool } from '../app/tools/FrameShapeTool/FrameShapeTool'
import { GeoShapeTool } from '../app/tools/GeoShapeTool/GeoShapeTool'
import { HandTool } from '../app/tools/HandTool/HandTool'
import { HighlightShapeTool } from '../app/tools/HighlightShapeTool/HighlightShapeTool'
import { LaserTool } from '../app/tools/LaserTool/LaserTool'
import { LineShapeTool } from '../app/tools/LineShapeTool/LineShapeTool'
import { NoteShapeTool } from '../app/tools/NoteShapeTool/NoteShapeTool'
import { TLStateNodeConstructor } from '../app/tools/StateNode'
import { TextShapeTool } from '../app/tools/TextShapeTool/TextShapeTool'
import { ArrowShapeTool } from '../editor/tools/ArrowShapeTool/ArrowShapeTool'
import { DrawShapeTool } from '../editor/tools/DrawShapeTool/DrawShapeTool'
import { EraserShapeTool } from '../editor/tools/EraserShapeTool/EraserShapeTool'
import { FrameShapeTool } from '../editor/tools/FrameShapeTool/FrameShapeTool'
import { GeoShapeTool } from '../editor/tools/GeoShapeTool/GeoShapeTool'
import { HandTool } from '../editor/tools/HandTool/HandTool'
import { HighlightShapeTool } from '../editor/tools/HighlightShapeTool/HighlightShapeTool'
import { LaserTool } from '../editor/tools/LaserTool/LaserTool'
import { LineShapeTool } from '../editor/tools/LineShapeTool/LineShapeTool'
import { NoteShapeTool } from '../editor/tools/NoteShapeTool/NoteShapeTool'
import { TLStateNodeConstructor } from '../editor/tools/StateNode'
import { TextShapeTool } from '../editor/tools/TextShapeTool/TextShapeTool'
/** @public */
export const defaultTools: TLStateNodeConstructor[] = [

Some files were not shown because too many files have changed in this diff Show more