Chore: clean up sort imports with prettier (#870)
* Update prettier to latest * Add format command * Create .prettierignore * Add prettier plugin sort imports * Update prettier config * Update prettier config * Update .prettierignore * Fix @babel/parser conflict https://github.com/trivago/prettier-plugin-sort-imports/issues/156 * Revert "Update .prettierignore" This reverts commit 282e5b838376f16b3df7f4c1f99f1106baaffea4. * Revert change for apps/www/pages/v/[id].tsx * Sort imports Moves the third party imports to the top, "~" imports in middle, and "./" at last * Sorting of the specifiers in an import declarations * [www] use path vs "../" * [core] use path "~" vs "../" * [tldraw] use path "~" vs "../.../" * [tldraw] use path "~" vs "../" * [tldraw] Cleanup * Update prettier config * Last use path "~" vs "../.../" * [www] Fix order of the third party imports * Clean prettier config
This commit is contained in:
parent
ecb4bfcc3b
commit
e0e1373468
309 changed files with 1082 additions and 910 deletions
17
.prettierignore
Normal file
17
.prettierignore
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
assets
|
||||||
|
**/assets
|
||||||
|
**/dist
|
||||||
|
**/extension/editor
|
||||||
|
**/out
|
||||||
|
**/public
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
.next
|
||||||
|
.tldr
|
||||||
|
.turbo
|
||||||
|
.vercel
|
||||||
|
.vsix
|
||||||
|
|
||||||
|
*.lock
|
||||||
|
*.log
|
||||||
|
*.yaml
|
|
@ -2,5 +2,8 @@
|
||||||
"trailingComma": "es5",
|
"trailingComma": "es5",
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"semi": false,
|
"semi": false,
|
||||||
"printWidth": 100
|
"printWidth": 100,
|
||||||
|
"importOrder": ["^[~]", "^[./]"],
|
||||||
|
"importOrderSortSpecifiers": true,
|
||||||
|
"importOrderParserPlugins": ["typescript", "jsx", "decorators-legacy"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { shell, Menu, MenuItemConstructorOptions } from 'electron'
|
import { Menu, MenuItemConstructorOptions, shell } from 'electron'
|
||||||
import type { Message } from 'src/types'
|
import type { Message } from 'src/types'
|
||||||
|
|
||||||
export async function createMenu(send: (message: Message) => Promise<void>) {
|
export async function createMenu(send: (message: Message) => Promise<void>) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import path from 'path'
|
|
||||||
import { BrowserWindow } from 'electron'
|
import { BrowserWindow } from 'electron'
|
||||||
import { is } from 'electron-util'
|
import { is } from 'electron-util'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
export async function createWindow() {
|
export async function createWindow() {
|
||||||
let win: BrowserWindow | null = null
|
let win: BrowserWindow | null = null
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { app, BrowserWindow } from 'electron'
|
import { BrowserWindow, app } from 'electron'
|
||||||
import { is } from 'electron-util'
|
import { is } from 'electron-util'
|
||||||
import type { Message } from 'src/types'
|
import type { Message } from 'src/types'
|
||||||
import { createMenu } from './createMenu'
|
import { createMenu } from './createMenu'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from 'react'
|
|
||||||
import { Tldraw, TldrawApp } from '@tldraw/tldraw'
|
import { Tldraw, TldrawApp } from '@tldraw/tldraw'
|
||||||
|
import * as React from 'react'
|
||||||
import type { Message, TldrawBridgeApi } from 'src/types'
|
import type { Message, TldrawBridgeApi } from 'src/types'
|
||||||
|
|
||||||
declare const window: Window & { TldrawBridgeApi: TldrawBridgeApi }
|
declare const window: Window & { TldrawBridgeApi: TldrawBridgeApi }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Tldraw, TldrawApp, TldrawProps, useFileSystem } from '@tldraw/tldraw'
|
import { Tldraw, TldrawApp, TldrawProps, useFileSystem } from '@tldraw/tldraw'
|
||||||
import { useUploadAssets } from './hooks/useUploadAssets'
|
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
|
import { useUploadAssets } from './hooks/useUploadAssets'
|
||||||
|
|
||||||
declare const window: Window & { app: TldrawApp }
|
declare const window: Window & { app: TldrawApp }
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { defineConfig } from 'vite'
|
|
||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react'
|
||||||
|
import { defineConfig } from 'vite'
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import fs from 'fs'
|
|
||||||
import esbuild from 'esbuild'
|
import esbuild from 'esbuild'
|
||||||
|
import fs from 'fs'
|
||||||
import { createRequire } from 'module'
|
import { createRequire } from 'module'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
import fs from 'fs'
|
|
||||||
import esbuildServe from 'esbuild-serve'
|
|
||||||
import dotenv from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
|
import esbuildServe from 'esbuild-serve'
|
||||||
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
dotenv.config()
|
dotenv.config()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as vscode from 'vscode'
|
|
||||||
import { TDFile } from '@tldraw/tldraw'
|
import { TDFile } from '@tldraw/tldraw'
|
||||||
import { MessageFromWebview, MessageFromExtension } from './types'
|
import * as vscode from 'vscode'
|
||||||
|
import { MessageFromExtension, MessageFromWebview } from './types'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When a new editor is opened, an instance of this class will
|
* When a new editor is opened, an instance of this class will
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Tldraw, TldrawApp, TldrawProps, useFileSystem } from '@tldraw/tldraw'
|
import { Tldraw, TldrawApp, TldrawProps, useFileSystem } from '@tldraw/tldraw'
|
||||||
import { useUploadAssets } from 'hooks/useUploadAssets'
|
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import * as gtag from 'utils/gtag'
|
import { useUploadAssets } from '~hooks/useUploadAssets'
|
||||||
|
import * as gtag from '~utils/gtag'
|
||||||
|
|
||||||
declare const window: Window & { app: TldrawApp }
|
declare const window: Window & { app: TldrawApp }
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { styled } from 'styles'
|
import { styled } from '~styles'
|
||||||
|
|
||||||
export default function IFrameWarning({ url = 'https://tldraw.com' }: { url?: string }) {
|
export default function IFrameWarning({ url = 'https://tldraw.com' }: { url?: string }) {
|
||||||
const [copied, setCopied] = React.useState(false)
|
const [copied, setCopied] = React.useState(false)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import * as React from 'react'
|
|
||||||
import { RoomProvider } from '../utils/liveblocks'
|
|
||||||
import { Tldraw, useFileSystem } from '@tldraw/tldraw'
|
import { Tldraw, useFileSystem } from '@tldraw/tldraw'
|
||||||
import { useMultiplayerAssets } from 'hooks/useMultiplayerAssets'
|
import * as React from 'react'
|
||||||
import { useMultiplayerState } from 'hooks/useMultiplayerState'
|
import { useMultiplayerAssets } from '~hooks/useMultiplayerAssets'
|
||||||
import { useUploadAssets } from 'hooks/useUploadAssets'
|
import { useMultiplayerState } from '~hooks/useMultiplayerState'
|
||||||
import { styled } from 'styles'
|
import { useUploadAssets } from '~hooks/useUploadAssets'
|
||||||
|
import { styled } from '~styles'
|
||||||
|
import { RoomProvider } from '~utils/liveblocks'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
roomId: string
|
roomId: string
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import * as React from 'react'
|
|
||||||
import { RoomProvider } from '../utils/liveblocks'
|
|
||||||
import { Tldraw, useFileSystem } from '@tldraw/tldraw'
|
import { Tldraw, useFileSystem } from '@tldraw/tldraw'
|
||||||
import { styled } from 'styles'
|
import * as React from 'react'
|
||||||
import { useReadOnlyMultiplayerState } from 'hooks/useReadOnlyMultiplayerState'
|
import { useReadOnlyMultiplayerState } from '~hooks/useReadOnlyMultiplayerState'
|
||||||
|
import { styled } from '~styles'
|
||||||
|
import { RoomProvider } from '~utils/liveblocks'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
roomId: string
|
roomId: string
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
||||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
||||||
import React, { useState, useRef, useCallback } from 'react'
|
|
||||||
import type { TldrawApp, TDUser, TDShape, TDBinding, TDAsset } from '@tldraw/tldraw'
|
|
||||||
import { Storage, useRedo, useUndo, useRoom, useUpdateMyPresence } from '../utils/liveblocks'
|
|
||||||
import { useHotkeys } from 'react-hotkeys-hook'
|
|
||||||
import { LiveMap } from '@liveblocks/client'
|
import { LiveMap } from '@liveblocks/client'
|
||||||
|
import type { TDAsset, TDBinding, TDShape, TDUser, TldrawApp } from '@tldraw/tldraw'
|
||||||
|
import React, { useCallback, useRef, useState } from 'react'
|
||||||
|
import { useHotkeys } from 'react-hotkeys-hook'
|
||||||
|
import { Storage, useRedo, useRoom, useUndo, useUpdateMyPresence } from '~utils/liveblocks'
|
||||||
|
|
||||||
declare const window: Window & { app: TldrawApp }
|
declare const window: Window & { app: TldrawApp }
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
||||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
||||||
import React, { useState, useRef, useCallback } from 'react'
|
|
||||||
import type { TldrawApp, TDUser, TDShape, TDBinding, TDAsset } from '@tldraw/tldraw'
|
|
||||||
import { Storage, useRedo, useUndo, useRoom, useUpdateMyPresence } from '../utils/liveblocks'
|
|
||||||
import { useHotkeys } from 'react-hotkeys-hook'
|
|
||||||
import { LiveMap } from '@liveblocks/client'
|
import { LiveMap } from '@liveblocks/client'
|
||||||
|
import type { TDAsset, TDBinding, TDShape, TDUser, TldrawApp } from '@tldraw/tldraw'
|
||||||
|
import React, { useCallback, useRef, useState } from 'react'
|
||||||
|
import { useHotkeys } from 'react-hotkeys-hook'
|
||||||
|
import { Storage, useRedo, useRoom, useUndo, useUpdateMyPresence } from '~utils/liveblocks'
|
||||||
|
|
||||||
declare const window: Window & { app: TldrawApp }
|
declare const window: Window & { app: TldrawApp }
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import '../styles/globals.css'
|
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
import useGtag from 'utils/useGtag'
|
|
||||||
import { init } from 'utils/sentry'
|
|
||||||
import type React from 'react'
|
import type React from 'react'
|
||||||
|
import '~styles/globals.css'
|
||||||
|
import { init } from '~utils/sentry'
|
||||||
|
import useGtag from '~utils/useGtag'
|
||||||
|
|
||||||
init()
|
init()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import NextDocument, { Html, Head, Main, NextScript, DocumentContext } from 'next/document'
|
import NextDocument, { DocumentContext, Head, Html, Main, NextScript } from 'next/document'
|
||||||
import { getCssText } from 'styles'
|
import { getCssText } from '~styles'
|
||||||
import { GA_TRACKING_ID } from 'utils/gtag'
|
import { GA_TRACKING_ID } from '~utils/gtag'
|
||||||
|
|
||||||
class MyDocument extends NextDocument {
|
class MyDocument extends NextDocument {
|
||||||
static async getInitialProps(ctx: DocumentContext): Promise<any> {
|
static async getInitialProps(ctx: DocumentContext): Promise<any> {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
|
||||||
import { TDDocument } from '@tldraw/tldraw'
|
|
||||||
import { Utils } from '@tldraw/core'
|
import { Utils } from '@tldraw/core'
|
||||||
|
import { TDDocument } from '@tldraw/tldraw'
|
||||||
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
|
|
||||||
type RequestBody = {
|
type RequestBody = {
|
||||||
pageId: string
|
pageId: string
|
||||||
|
|
|
@ -3,7 +3,7 @@ import Head from 'next/head'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { useMemo } from 'react'
|
import { useMemo } from 'react'
|
||||||
|
|
||||||
const Editor = dynamic(() => import('components/Editor'), { ssr: false }) as any
|
const Editor = dynamic(() => import('~components/Editor'), { ssr: false }) as any
|
||||||
|
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
const { query } = useRouter()
|
const { query } = useRouter()
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import * as React from 'react'
|
|
||||||
import type { GetServerSideProps } from 'next'
|
import type { GetServerSideProps } from 'next'
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
|
import * as React from 'react'
|
||||||
|
|
||||||
const IFrameWarning = dynamic(() => import('components/IFrameWarning'), {
|
const IFrameWarning = dynamic(() => import('~components/IFrameWarning'), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
}) as any
|
}) as any
|
||||||
|
|
||||||
const MultiplayerEditor = dynamic(() => import('components/MultiplayerEditor'), {
|
const MultiplayerEditor = dynamic(() => import('~components/MultiplayerEditor'), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
}) as any
|
}) as any
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as React from 'react'
|
|
||||||
import type { GetServerSideProps } from 'next'
|
import type { GetServerSideProps } from 'next'
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
|
import * as React from 'react'
|
||||||
|
|
||||||
export default function RandomRoomPage() {
|
export default function RandomRoomPage() {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import * as React from 'react'
|
import { Utils } from '@tldraw/core'
|
||||||
import type { GetServerSideProps } from 'next'
|
import type { GetServerSideProps } from 'next'
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
import { Utils } from '@tldraw/core'
|
import * as React from 'react'
|
||||||
|
|
||||||
const IFrameWarning = dynamic(() => import('components/IFrameWarning'), {
|
const IFrameWarning = dynamic(() => import('~components/IFrameWarning'), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
}) as any
|
}) as any
|
||||||
|
|
||||||
const ReadOnlyMultiplayerEditor = dynamic(() => import('components/ReadOnlyMultiplayerEditor'), {
|
const ReadOnlyMultiplayerEditor = dynamic(() => import('~components/ReadOnlyMultiplayerEditor'), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
}) as any
|
}) as any
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"*": ["./*"],
|
"~*": ["./*"],
|
||||||
"@tldraw/core": ["../../packages/core"],
|
"@tldraw/core": ["../../packages/core"],
|
||||||
"@tldraw/tldraw": ["../../packages/tldraw"]
|
"@tldraw/tldraw": ["../../packages/tldraw"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { createClient } from '@liveblocks/client'
|
import { createClient } from '@liveblocks/client'
|
||||||
import type { EnsureJson, LiveMap, LiveObject } from '@liveblocks/client'
|
import type { EnsureJson, LiveMap, LiveObject } from '@liveblocks/client'
|
||||||
import { createRoomContext } from '@liveblocks/react'
|
import { createRoomContext } from '@liveblocks/react'
|
||||||
import type { TDUser, TDShape, TDBinding, TDDocument, TDAsset } from '@tldraw/tldraw'
|
import type { TDAsset, TDBinding, TDDocument, TDShape, TDUser } from '@tldraw/tldraw'
|
||||||
|
|
||||||
const client = createClient({
|
const client = createClient({
|
||||||
publicApiKey: process.env.NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_API_KEY || '',
|
publicApiKey: process.env.NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_API_KEY || '',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as Sentry from '@sentry/node'
|
|
||||||
import { RewriteFrames } from '@sentry/integrations'
|
import { RewriteFrames } from '@sentry/integrations'
|
||||||
|
import * as Sentry from '@sentry/node'
|
||||||
|
|
||||||
export function init(): void {
|
export function init(): void {
|
||||||
if (!process.env.NEXT_PUBLIC_SENTRY_DSN) return
|
if (!process.env.NEXT_PUBLIC_SENTRY_DSN) return
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
||||||
import router from 'next/router'
|
import router from 'next/router'
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
import * as gtag from 'utils/gtag'
|
import * as gtag from './gtag'
|
||||||
|
|
||||||
function handleRouteChange(url: URL) {
|
function handleRouteChange(url: URL) {
|
||||||
gtag.pageview(url)
|
gtag.pageview(url)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import fs from 'fs'
|
|
||||||
import esbuild from 'esbuild'
|
import esbuild from 'esbuild'
|
||||||
|
import fs from 'fs'
|
||||||
import { createRequire } from 'module'
|
import { createRequire } from 'module'
|
||||||
|
|
||||||
const pkg = createRequire(import.meta.url)('../package.json')
|
const pkg = createRequire(import.meta.url)('../package.json')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
import fs from 'fs'
|
|
||||||
import esbuildServe from 'esbuild-serve'
|
import esbuildServe from 'esbuild-serve'
|
||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
const { log: jslog } = console
|
const { log: jslog } = console
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as React from 'react'
|
import { useStateDesigner } from '@state-designer/react'
|
||||||
import {
|
import {
|
||||||
Renderer,
|
Renderer,
|
||||||
TLBounds,
|
TLBounds,
|
||||||
|
@ -7,14 +7,14 @@ import {
|
||||||
TLPointerEventHandler,
|
TLPointerEventHandler,
|
||||||
TLWheelEventHandler,
|
TLWheelEventHandler,
|
||||||
} from '@tldraw/core'
|
} from '@tldraw/core'
|
||||||
import { useStateDesigner } from '@state-designer/react'
|
import * as React from 'react'
|
||||||
|
import { Api } from 'state/api'
|
||||||
|
import styled from 'stitches.config'
|
||||||
|
import { TitleLinks } from './components/TitleLinks'
|
||||||
|
import { Toolbar } from './components/Toolbar'
|
||||||
import { shapeUtils } from './shapes'
|
import { shapeUtils } from './shapes'
|
||||||
import { machine } from './state/machine'
|
import { machine } from './state/machine'
|
||||||
import { Toolbar } from './components/Toolbar'
|
|
||||||
import { TitleLinks } from './components/TitleLinks'
|
|
||||||
import './styles.css'
|
import './styles.css'
|
||||||
import styled from 'stitches.config'
|
|
||||||
import { Api } from 'state/api'
|
|
||||||
|
|
||||||
declare const window: Window & { api: Api }
|
declare const window: Window & { api: Api }
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as React from 'react'
|
import { SVGContainer, TLShapeUtil } from '@tldraw/core'
|
||||||
import { TLShapeUtil, SVGContainer } from '@tldraw/core'
|
|
||||||
import type { ArrowShape } from './ArrowShape'
|
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
|
import * as React from 'react'
|
||||||
|
import type { ArrowShape } from './ArrowShape'
|
||||||
|
|
||||||
export const ArrowComponent = TLShapeUtil.Component<ArrowShape, SVGSVGElement>(
|
export const ArrowComponent = TLShapeUtil.Component<ArrowShape, SVGSVGElement>(
|
||||||
({ shape, events, isGhost, meta }, ref) => {
|
({ shape, events, isGhost, meta }, ref) => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as React from 'react'
|
|
||||||
import { TLShapeUtil } from '@tldraw/core'
|
import { TLShapeUtil } from '@tldraw/core'
|
||||||
import type { ArrowShape } from './ArrowShape'
|
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
|
import * as React from 'react'
|
||||||
|
import type { ArrowShape } from './ArrowShape'
|
||||||
|
|
||||||
export const ArrowIndicator = TLShapeUtil.Indicator<ArrowShape>(({ shape }) => {
|
export const ArrowIndicator = TLShapeUtil.Indicator<ArrowShape>(({ shape }) => {
|
||||||
const { start, end } = shape.handles
|
const { start, end } = shape.handles
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Utils, TLBounds } from '@tldraw/core'
|
import { TLBounds, Utils } from '@tldraw/core'
|
||||||
import { intersectBoundsLineSegment, intersectLineSegmentLineSegment } from '@tldraw/intersect'
|
import { intersectBoundsLineSegment, intersectLineSegmentLineSegment } from '@tldraw/intersect'
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
import { nanoid } from 'nanoid'
|
import { nanoid } from 'nanoid'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { SVGContainer, TLShapeUtil } from '@tldraw/core'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { TLShapeUtil, SVGContainer } from '@tldraw/core'
|
|
||||||
import type { BoxShape } from './BoxShape'
|
import type { BoxShape } from './BoxShape'
|
||||||
|
|
||||||
export const BoxComponent = TLShapeUtil.Component<BoxShape, SVGSVGElement>(
|
export const BoxComponent = TLShapeUtil.Component<BoxShape, SVGSVGElement>(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from 'react'
|
|
||||||
import { TLShapeUtil } from '@tldraw/core'
|
import { TLShapeUtil } from '@tldraw/core'
|
||||||
|
import * as React from 'react'
|
||||||
import type { BoxShape } from './BoxShape'
|
import type { BoxShape } from './BoxShape'
|
||||||
|
|
||||||
export const BoxIndicator = TLShapeUtil.Indicator<BoxShape>(({ shape }) => {
|
export const BoxIndicator = TLShapeUtil.Indicator<BoxShape>(({ shape }) => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Utils, TLBounds } from '@tldraw/core'
|
import { TLBounds, Utils } from '@tldraw/core'
|
||||||
import { intersectLineSegmentBounds } from '@tldraw/intersect'
|
import { intersectLineSegmentBounds } from '@tldraw/intersect'
|
||||||
import { nanoid } from 'nanoid'
|
import { nanoid } from 'nanoid'
|
||||||
import { CustomShapeUtil } from 'shapes/CustomShapeUtil'
|
import { CustomShapeUtil } from 'shapes/CustomShapeUtil'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { SVGContainer, TLShapeUtil } from '@tldraw/core'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { TLShapeUtil, SVGContainer } from '@tldraw/core'
|
|
||||||
import type { PencilShape } from './PencilShape'
|
import type { PencilShape } from './PencilShape'
|
||||||
import { getComponentSvgPath } from './pencil-helpers'
|
import { getComponentSvgPath } from './pencil-helpers'
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import { Utils, TLBounds } from '@tldraw/core'
|
import { TLBounds, Utils } from '@tldraw/core'
|
||||||
import {
|
import {
|
||||||
intersectBoundsBounds,
|
intersectBoundsBounds,
|
||||||
intersectBoundsPolyline,
|
intersectBoundsPolyline,
|
||||||
intersectLineSegmentPolyline,
|
intersectLineSegmentPolyline,
|
||||||
} from '@tldraw/intersect'
|
} from '@tldraw/intersect'
|
||||||
|
import Vec from '@tldraw/vec'
|
||||||
import { nanoid } from 'nanoid'
|
import { nanoid } from 'nanoid'
|
||||||
import { CustomShapeUtil } from 'shapes/CustomShapeUtil'
|
import { CustomShapeUtil } from 'shapes/CustomShapeUtil'
|
||||||
import { PencilComponent } from './PencilComponent'
|
import { PencilComponent } from './PencilComponent'
|
||||||
import { PencilIndicator } from './PenclIndicator'
|
|
||||||
import type { PencilShape } from './PencilShape'
|
import type { PencilShape } from './PencilShape'
|
||||||
import Vec from '@tldraw/vec'
|
import { PencilIndicator } from './PenclIndicator'
|
||||||
|
|
||||||
type T = PencilShape
|
type T = PencilShape
|
||||||
type E = SVGSVGElement
|
type E = SVGSVGElement
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from 'react'
|
|
||||||
import { TLShapeUtil } from '@tldraw/core'
|
import { TLShapeUtil } from '@tldraw/core'
|
||||||
|
import * as React from 'react'
|
||||||
import type { PencilShape } from './PencilShape'
|
import type { PencilShape } from './PencilShape'
|
||||||
import { getIndicatorSvgPath } from './pencil-helpers'
|
import { getIndicatorSvgPath } from './pencil-helpers'
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Utils } from '@tldraw/core'
|
import { Utils } from '@tldraw/core'
|
||||||
import { intersectLineSegmentBounds } from '@tldraw/intersect'
|
import { intersectLineSegmentBounds } from '@tldraw/intersect'
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
import { getShapeUtils, Shape } from 'shapes'
|
import { Shape, getShapeUtils } from 'shapes'
|
||||||
import type { ArrowShape } from 'shapes/arrow'
|
import type { ArrowShape } from 'shapes/arrow'
|
||||||
import { AppData, BINDING_PADDING } from 'state/constants'
|
import { AppData, BINDING_PADDING } from 'state/constants'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { Action } from 'state/constants'
|
|
||||||
import type { TLPointerInfo } from '@tldraw/core'
|
import type { TLPointerInfo } from '@tldraw/core'
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
|
import type { Action } from 'state/constants'
|
||||||
|
|
||||||
export const panCamera: Action = (data, payload: TLPointerInfo) => {
|
export const panCamera: Action = (data, payload: TLPointerInfo) => {
|
||||||
const { point, zoom } = data.pageState.camera
|
const { point, zoom } = data.pageState.camera
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { Action } from 'state/constants'
|
|
||||||
import type { TLPointerInfo } from '@tldraw/core'
|
import type { TLPointerInfo } from '@tldraw/core'
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
|
import type { Action } from 'state/constants'
|
||||||
|
|
||||||
export const pinchCamera: Action = (data, payload: TLPointerInfo) => {
|
export const pinchCamera: Action = (data, payload: TLPointerInfo) => {
|
||||||
const { camera } = data.pageState
|
const { camera } = data.pageState
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Action } from 'state/constants'
|
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
|
import type { Action } from 'state/constants'
|
||||||
import { mutables } from 'state/mutables'
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const zoomIn: Action = (data) => {
|
export const zoomIn: Action = (data) => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Action } from 'state/constants'
|
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
|
import type { Action } from 'state/constants'
|
||||||
import { mutables } from 'state/mutables'
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const zoomOut: Action = (data) => {
|
export const zoomOut: Action = (data) => {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Action, FIT_TO_SCREEN_PADDING } from 'state/constants'
|
|
||||||
import { Utils } from '@tldraw/core'
|
import { Utils } from '@tldraw/core'
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
import { mutables } from 'state/mutables'
|
|
||||||
import { getShapeUtils } from 'shapes'
|
import { getShapeUtils } from 'shapes'
|
||||||
|
import { Action, FIT_TO_SCREEN_PADDING } from 'state/constants'
|
||||||
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const zoomToFit: Action = (data) => {
|
export const zoomToFit: Action = (data) => {
|
||||||
const { camera } = data.pageState
|
const { camera } = data.pageState
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Action, FIT_TO_SCREEN_PADDING } from 'state/constants'
|
|
||||||
import { Utils } from '@tldraw/core'
|
import { Utils } from '@tldraw/core'
|
||||||
import { mutables } from 'state/mutables'
|
|
||||||
import { getShapeUtils } from 'shapes'
|
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
|
import { getShapeUtils } from 'shapes'
|
||||||
|
import { Action, FIT_TO_SCREEN_PADDING } from 'state/constants'
|
||||||
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const zoomToSelection: Action = (data) => {
|
export const zoomToSelection: Action = (data) => {
|
||||||
const { camera, selectedIds } = data.pageState
|
const { camera, selectedIds } = data.pageState
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Action } from 'state/constants'
|
import type { Action } from 'state/constants'
|
||||||
import { mutables } from '../../mutables'
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const restoreSavedDocument: Action = (data) => {
|
export const restoreSavedDocument: Action = (data) => {
|
||||||
const snapshot = mutables.history.restore()
|
const snapshot = mutables.history.restore()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { TLPointerInfo } from '@tldraw/core'
|
import type { TLPointerInfo } from '@tldraw/core'
|
||||||
import type { Action } from 'state/constants'
|
|
||||||
import { getShapeUtils } from 'shapes'
|
import { getShapeUtils } from 'shapes'
|
||||||
|
import type { Action } from 'state/constants'
|
||||||
import { mutables } from 'state/mutables'
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const eraseShapes: Action = (data, payload: TLPointerInfo) => {
|
export const eraseShapes: Action = (data, payload: TLPointerInfo) => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Action } from 'state/constants'
|
|
||||||
import { getShapeUtils } from 'shapes'
|
import { getShapeUtils } from 'shapes'
|
||||||
|
import type { Action } from 'state/constants'
|
||||||
import { mutables } from 'state/mutables'
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const eraseShapesAtPoint: Action = (data) => {
|
export const eraseShapesAtPoint: Action = (data) => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Utils } from '@tldraw/core'
|
import { Utils } from '@tldraw/core'
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
import { getShapeUtils, Shape } from 'shapes'
|
import { Shape, getShapeUtils } from 'shapes'
|
||||||
import type { ArrowShape } from 'shapes/arrow'
|
import type { ArrowShape } from 'shapes/arrow'
|
||||||
import type { AppData } from 'state/constants'
|
import type { AppData } from 'state/constants'
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import type { Action, CustomBinding } from 'state/constants'
|
|
||||||
import { getShapeUtils, Shape } from 'shapes'
|
|
||||||
import { mutables } from 'state/mutables'
|
|
||||||
import { nanoid } from 'nanoid'
|
|
||||||
import { TLPointerInfo, Utils } from '@tldraw/core'
|
import { TLPointerInfo, Utils } from '@tldraw/core'
|
||||||
import type { ArrowShape } from 'shapes/arrow'
|
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
|
import { nanoid } from 'nanoid'
|
||||||
|
import { Shape, getShapeUtils } from 'shapes'
|
||||||
|
import type { ArrowShape } from 'shapes/arrow'
|
||||||
|
import type { Action, CustomBinding } from 'state/constants'
|
||||||
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const translateHandle: Action = (data, payload: TLPointerInfo) => {
|
export const translateHandle: Action = (data, payload: TLPointerInfo) => {
|
||||||
const { initialPoint, snapshot, pointedHandleId } = mutables
|
const { initialPoint, snapshot, pointedHandleId } = mutables
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Action } from 'state/constants'
|
import type { Action } from 'state/constants'
|
||||||
import { mutables } from '../../mutables'
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const addToHistory: Action = (data) => {
|
export const addToHistory: Action = (data) => {
|
||||||
mutables.history.push(data)
|
mutables.history.push(data)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Action } from 'state/constants'
|
import type { Action } from 'state/constants'
|
||||||
import { mutables } from '../../mutables'
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const redo: Action = (data) => {
|
export const redo: Action = (data) => {
|
||||||
const snapshot = mutables.history.redo()
|
const snapshot = mutables.history.redo()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Action } from 'state/constants'
|
import type { Action } from 'state/constants'
|
||||||
import { mutables } from '../../mutables'
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const undo: Action = (data) => {
|
export const undo: Action = (data) => {
|
||||||
const snapshot = mutables.history.undo()
|
const snapshot = mutables.history.undo()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { Action } from 'state/constants'
|
|
||||||
import { TLPointerInfo, Utils } from '@tldraw/core'
|
import { TLPointerInfo, Utils } from '@tldraw/core'
|
||||||
import { mutables } from '../../mutables'
|
|
||||||
import { getShapeUtils } from 'shapes'
|
import { getShapeUtils } from 'shapes'
|
||||||
|
import type { Action } from 'state/constants'
|
||||||
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const updateBrush: Action = (data, payload: TLPointerInfo) => {
|
export const updateBrush: Action = (data, payload: TLPointerInfo) => {
|
||||||
const { initialPoint, snapshot } = mutables
|
const { initialPoint, snapshot } = mutables
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { nanoid } from 'nanoid'
|
|
||||||
import Vec from '@tldraw/vec'
|
|
||||||
import { TLPointerInfo, Utils } from '@tldraw/core'
|
import { TLPointerInfo, Utils } from '@tldraw/core'
|
||||||
import { getShapeUtils, Shape, shapeUtils } from 'shapes'
|
import Vec from '@tldraw/vec'
|
||||||
import { mutables } from 'state/mutables'
|
import { nanoid } from 'nanoid'
|
||||||
|
import { Shape, getShapeUtils, shapeUtils } from 'shapes'
|
||||||
import type { Action, CustomBinding } from 'state/constants'
|
import type { Action, CustomBinding } from 'state/constants'
|
||||||
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const createArrowShape: Action = (data, payload: TLPointerInfo) => {
|
export const createArrowShape: Action = (data, payload: TLPointerInfo) => {
|
||||||
const shape = shapeUtils.arrow.getShape({
|
const shape = shapeUtils.arrow.getShape({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { TLPointerInfo } from '@tldraw/core'
|
import type { TLPointerInfo } from '@tldraw/core'
|
||||||
import type { Action } from 'state/constants'
|
|
||||||
import { shapeUtils } from 'shapes'
|
import { shapeUtils } from 'shapes'
|
||||||
|
import type { Action } from 'state/constants'
|
||||||
import { mutables } from 'state/mutables'
|
import { mutables } from 'state/mutables'
|
||||||
|
|
||||||
export const createPencilShape: Action = (data, payload: TLPointerInfo) => {
|
export const createPencilShape: Action = (data, payload: TLPointerInfo) => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { nanoid } from 'nanoid'
|
import { nanoid } from 'nanoid'
|
||||||
import { getShapeUtils, Shape } from 'shapes'
|
import { Shape, getShapeUtils } from 'shapes'
|
||||||
import type { Action } from 'state/constants'
|
import type { Action } from 'state/constants'
|
||||||
|
|
||||||
export const createShapes: Action = (
|
export const createShapes: Action = (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { TLBinding, TLPage, TLPageState, TLPerformanceMode, TLSnapLine } from '@tldraw/core'
|
|
||||||
import type { Shape } from '../shapes'
|
|
||||||
import type { S } from '@state-designer/react'
|
import type { S } from '@state-designer/react'
|
||||||
|
import type { TLBinding, TLPage, TLPageState, TLPerformanceMode, TLSnapLine } from '@tldraw/core'
|
||||||
|
import type { Shape } from 'shapes'
|
||||||
|
|
||||||
export const VERSION = 1
|
export const VERSION = 1
|
||||||
export const PERSIST_DATA = true
|
export const PERSIST_DATA = true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { AppData, INITIAL_DATA, PERSIST_DATA } from './constants'
|
|
||||||
import { current } from 'immer'
|
import { current } from 'immer'
|
||||||
|
import { AppData, INITIAL_DATA, PERSIST_DATA } from './constants'
|
||||||
|
|
||||||
export function makeHistory(ID = '@tldraw/core_advanced_example') {
|
export function makeHistory(ID = '@tldraw/core_advanced_example') {
|
||||||
let initialData = INITIAL_DATA
|
let initialData = INITIAL_DATA
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { createState } from '@state-designer/react'
|
import { createState } from '@state-designer/react'
|
||||||
import type { TLPointerInfo } from '@tldraw/core'
|
import type { TLPointerInfo } from '@tldraw/core'
|
||||||
import { INITIAL_DATA } from './constants'
|
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
import * as actions from './actions'
|
import * as actions from './actions'
|
||||||
|
import { INITIAL_DATA } from './constants'
|
||||||
import { mutables } from './mutables'
|
import { mutables } from './mutables'
|
||||||
|
|
||||||
export const machine = createState({
|
export const machine = createState({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import fs from 'fs'
|
|
||||||
import esbuild from 'esbuild'
|
import esbuild from 'esbuild'
|
||||||
|
import fs from 'fs'
|
||||||
import { createRequire } from 'module'
|
import { createRequire } from 'module'
|
||||||
|
|
||||||
const pkg = createRequire(import.meta.url)('../package.json')
|
const pkg = createRequire(import.meta.url)('../package.json')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
import fs from 'fs'
|
|
||||||
import esbuildServe from 'esbuild-serve'
|
import esbuildServe from 'esbuild-serve'
|
||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
const { log: jslog } = console
|
const { log: jslog } = console
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import * as React from 'react'
|
|
||||||
import { Renderer, TLPointerEventHandler, TLShapeUtilsMap } from '@tldraw/core'
|
import { Renderer, TLPointerEventHandler, TLShapeUtilsMap } from '@tldraw/core'
|
||||||
|
import { observer } from 'mobx-react-lite'
|
||||||
|
import * as React from 'react'
|
||||||
import { RectUtil, Shape } from './shapes'
|
import { RectUtil, Shape } from './shapes'
|
||||||
import { Page, PageState } from './stores'
|
import { Page, PageState } from './stores'
|
||||||
import { observer } from 'mobx-react-lite'
|
|
||||||
|
|
||||||
const page = new Page({
|
const page = new Page({
|
||||||
id: 'page1',
|
id: 'page1',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { SVGContainer, TLShapeUtil } from '@tldraw/core'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { TLShapeUtil, SVGContainer } from '@tldraw/core'
|
|
||||||
import type { RectShape } from './RectShape'
|
import type { RectShape } from './RectShape'
|
||||||
|
|
||||||
export const RectComponent = TLShapeUtil.Component<RectShape, SVGSVGElement>(
|
export const RectComponent = TLShapeUtil.Component<RectShape, SVGSVGElement>(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from 'react'
|
|
||||||
import { TLShapeUtil } from '@tldraw/core'
|
import { TLShapeUtil } from '@tldraw/core'
|
||||||
|
import * as React from 'react'
|
||||||
import type { RectShape } from './RectShape'
|
import type { RectShape } from './RectShape'
|
||||||
|
|
||||||
export const RectIndicator = TLShapeUtil.Indicator<RectShape>(({ shape }) => {
|
export const RectIndicator = TLShapeUtil.Indicator<RectShape>(({ shape }) => {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import fs from 'fs'
|
|
||||||
import path from 'path'
|
|
||||||
import esbuild from 'esbuild'
|
import esbuild from 'esbuild'
|
||||||
|
import fs from 'fs'
|
||||||
import { createRequire } from 'module'
|
import { createRequire } from 'module'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
const pkg = createRequire(import.meta.url)('../package.json')
|
const pkg = createRequire(import.meta.url)('../package.json')
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
|
import dotenv from 'dotenv'
|
||||||
|
import esbuildServe from 'esbuild-serve'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import esbuildServe from 'esbuild-serve'
|
|
||||||
import dotenv from 'dotenv'
|
|
||||||
|
|
||||||
dotenv.config()
|
dotenv.config()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
import { ColorStyle, TDShapeType, Tldraw, TldrawApp } from '@tldraw/tldraw'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { ColorStyle, Tldraw, TDShapeType, TldrawApp } from '@tldraw/tldraw'
|
|
||||||
|
|
||||||
export default function Imperative() {
|
export default function Imperative() {
|
||||||
const rTldrawApp = React.useRef<TldrawApp>()
|
const rTldrawApp = React.useRef<TldrawApp>()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { ColorStyle, TDShapeType, Tldraw, TldrawApp } from '@tldraw/tldraw'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { Tldraw, TldrawApp, TDShapeType, ColorStyle } from '@tldraw/tldraw'
|
|
||||||
|
|
||||||
declare const window: Window & { app: TldrawApp }
|
declare const window: Window & { app: TldrawApp }
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { Routes, Route, Link } from 'react-router-dom'
|
import { Link, Route, Routes } from 'react-router-dom'
|
||||||
import Basic from './basic'
|
|
||||||
import DarkMode from './dark-mode'
|
|
||||||
import ReadOnly from './readonly'
|
|
||||||
import PropsControl from './props-control'
|
|
||||||
import ApiControl from './api-control'
|
|
||||||
import LoadingFiles from './loading-files'
|
|
||||||
import Embedded from './embedded'
|
|
||||||
import NoSizeEmbedded from './no-size-embedded'
|
|
||||||
import ChangingId from './changing-id'
|
|
||||||
import Persisted from './persisted'
|
|
||||||
import Develop from './develop'
|
|
||||||
import Api from './api'
|
|
||||||
import Scroll from './scroll'
|
|
||||||
import FileSystem from './file-system'
|
|
||||||
import UIOptions from './ui-options'
|
|
||||||
import { Multiplayer } from './multiplayer'
|
|
||||||
import './styles.css'
|
|
||||||
import Export from '~export'
|
import Export from '~export'
|
||||||
import IFrame from '~iframe'
|
import IFrame from '~iframe'
|
||||||
|
import Api from './api'
|
||||||
|
import ApiControl from './api-control'
|
||||||
|
import Basic from './basic'
|
||||||
|
import ChangingId from './changing-id'
|
||||||
|
import DarkMode from './dark-mode'
|
||||||
|
import Develop from './develop'
|
||||||
|
import Embedded from './embedded'
|
||||||
|
import FileSystem from './file-system'
|
||||||
|
import LoadingFiles from './loading-files'
|
||||||
|
import { Multiplayer } from './multiplayer'
|
||||||
|
import NoSizeEmbedded from './no-size-embedded'
|
||||||
|
import Persisted from './persisted'
|
||||||
|
import PropsControl from './props-control'
|
||||||
|
import ReadOnly from './readonly'
|
||||||
|
import Scroll from './scroll'
|
||||||
|
import './styles.css'
|
||||||
|
import UIOptions from './ui-options'
|
||||||
|
|
||||||
const pages: ({ path: string; component: any; title: string } | '---')[] = [
|
const pages: ({ path: string; component: any; title: string } | '---')[] = [
|
||||||
{ path: '/develop', component: Develop, title: 'Develop' },
|
{ path: '/develop', component: Develop, title: 'Develop' },
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from 'react'
|
|
||||||
import { Tldraw } from '@tldraw/tldraw'
|
import { Tldraw } from '@tldraw/tldraw'
|
||||||
|
import * as React from 'react'
|
||||||
|
|
||||||
export default function Basic() {
|
export default function Basic() {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from 'react'
|
|
||||||
import { Tldraw } from '@tldraw/tldraw'
|
import { Tldraw } from '@tldraw/tldraw'
|
||||||
|
import * as React from 'react'
|
||||||
|
|
||||||
export default function ChangingId() {
|
export default function ChangingId() {
|
||||||
const [id, setId] = React.useState('example')
|
const [id, setId] = React.useState('example')
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from 'react'
|
|
||||||
import { Tldraw } from '@tldraw/tldraw'
|
import { Tldraw } from '@tldraw/tldraw'
|
||||||
|
import * as React from 'react'
|
||||||
|
|
||||||
export default function DarkMode() {
|
export default function DarkMode() {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
import * as React from 'react'
|
|
||||||
import { Tldraw, TldrawApp, useFileSystem } from '@tldraw/tldraw'
|
import { Tldraw, TldrawApp, useFileSystem } from '@tldraw/tldraw'
|
||||||
|
import * as React from 'react'
|
||||||
|
|
||||||
declare const window: Window & { app: TldrawApp }
|
declare const window: Window & { app: TldrawApp }
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
import * as React from 'react'
|
import { Utils } from '@tldraw/core'
|
||||||
import {
|
import {
|
||||||
TldrawApp,
|
|
||||||
ImageShape,
|
ImageShape,
|
||||||
TDExportType,
|
|
||||||
TDAssets,
|
|
||||||
TDAssetType,
|
TDAssetType,
|
||||||
TDShapeType,
|
TDAssets,
|
||||||
|
TDExportType,
|
||||||
TDShape,
|
TDShape,
|
||||||
Tldraw,
|
TDShapeType,
|
||||||
TLDR,
|
TLDR,
|
||||||
|
Tldraw,
|
||||||
|
TldrawApp,
|
||||||
} from '@tldraw/tldraw'
|
} from '@tldraw/tldraw'
|
||||||
import Vec from '@tldraw/vec'
|
import Vec from '@tldraw/vec'
|
||||||
import { Utils } from '@tldraw/core'
|
import * as React from 'react'
|
||||||
|
|
||||||
export default function Export() {
|
export default function Export() {
|
||||||
const handleExport = React.useCallback(async (app: TldrawApp) => {
|
const handleExport = React.useCallback(async (app: TldrawApp) => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { TDExport, TDExportType, Tldraw, TldrawApp } from '@tldraw/tldraw'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { TldrawApp, TDExport, TDExportType, Tldraw } from '@tldraw/tldraw'
|
|
||||||
|
|
||||||
const ACTION = 'download' as 'download' | 'open'
|
const ACTION = 'download' as 'download' | 'open'
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from 'react'
|
|
||||||
import { Tldraw, useFileSystem } from '@tldraw/tldraw'
|
import { Tldraw, useFileSystem } from '@tldraw/tldraw'
|
||||||
|
import * as React from 'react'
|
||||||
|
|
||||||
export default function FileSystem() {
|
export default function FileSystem() {
|
||||||
const fileSystemEvents = useFileSystem()
|
const fileSystemEvents = useFileSystem()
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||||
|
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { createRoot } from 'react-dom/client'
|
import { createRoot } from 'react-dom/client'
|
||||||
import App from './app'
|
|
||||||
import { HashRouter } from 'react-router-dom'
|
import { HashRouter } from 'react-router-dom'
|
||||||
|
import App from './app'
|
||||||
|
|
||||||
const container = document.getElementById('root')!
|
const container = document.getElementById('root')!
|
||||||
const root = createRoot(container)
|
const root = createRoot(container)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Tldraw, TDFile } from '@tldraw/tldraw'
|
import { TDFile, Tldraw } from '@tldraw/tldraw'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
|
|
||||||
export default function LoadingFiles() {
|
export default function LoadingFiles() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { createClient } from '@liveblocks/client'
|
import { createClient } from '@liveblocks/client'
|
||||||
import type { EnsureJson, LiveMap, LiveObject } from '@liveblocks/client'
|
import type { EnsureJson, LiveMap, LiveObject } from '@liveblocks/client'
|
||||||
import { createRoomContext } from '@liveblocks/react'
|
import { createRoomContext } from '@liveblocks/react'
|
||||||
import type { TDUser, TDShape, TDBinding, TDDocument, TDAsset } from '@tldraw/tldraw'
|
import type { TDAsset, TDBinding, TDDocument, TDShape, TDUser } from '@tldraw/tldraw'
|
||||||
|
|
||||||
const client = createClient({
|
const client = createClient({
|
||||||
publicApiKey: 'YOUR_PUBLIC_KEY' || '',
|
publicApiKey: 'YOUR_PUBLIC_KEY' || '',
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||||
import * as React from 'react'
|
|
||||||
import { Tldraw } from '@tldraw/tldraw'
|
import { Tldraw } from '@tldraw/tldraw'
|
||||||
|
import * as React from 'react'
|
||||||
import { RoomProvider } from './liveblocks.config'
|
import { RoomProvider } from './liveblocks.config'
|
||||||
import { useMultiplayerState } from './useMultiplayerState'
|
import { useMultiplayerState } from './useMultiplayerState'
|
||||||
|
|
||||||
const roomId = 'mp-test-8'
|
const roomId = 'mp-test-8'
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
||||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
||||||
import React, { useState, useRef, useCallback } from 'react'
|
|
||||||
import type { TldrawApp, TDUser, TDShape, TDBinding, TDAsset } from '@tldraw/tldraw'
|
|
||||||
import { useHotkeys } from 'react-hotkeys-hook'
|
|
||||||
import { LiveMap } from '@liveblocks/client'
|
import { LiveMap } from '@liveblocks/client'
|
||||||
|
import type { TDAsset, TDBinding, TDShape, TDUser, TldrawApp } from '@tldraw/tldraw'
|
||||||
import { useRedo, useUndo, useRoom, useUpdateMyPresence } from './liveblocks.config'
|
import React, { useCallback, useRef, useState } from 'react'
|
||||||
|
import { useHotkeys } from 'react-hotkeys-hook'
|
||||||
|
import { useRedo, useRoom, useUndo, useUpdateMyPresence } from './liveblocks.config'
|
||||||
import type { Storage } from './liveblocks.config'
|
import type { Storage } from './liveblocks.config'
|
||||||
|
|
||||||
declare const window: Window & { app: TldrawApp }
|
declare const window: Window & { app: TldrawApp }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from 'react'
|
|
||||||
import { Tldraw } from '@tldraw/tldraw'
|
import { Tldraw } from '@tldraw/tldraw'
|
||||||
|
import * as React from 'react'
|
||||||
|
|
||||||
export default function Persisted() {
|
export default function Persisted() {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import * as React from 'react'
|
|
||||||
import {
|
import {
|
||||||
Tldraw,
|
|
||||||
ColorStyle,
|
ColorStyle,
|
||||||
DashStyle,
|
DashStyle,
|
||||||
SizeStyle,
|
SizeStyle,
|
||||||
TDDocument,
|
TDDocument,
|
||||||
TDShapeType,
|
TDShapeType,
|
||||||
|
Tldraw,
|
||||||
TldrawApp,
|
TldrawApp,
|
||||||
} from '@tldraw/tldraw'
|
} from '@tldraw/tldraw'
|
||||||
|
import * as React from 'react'
|
||||||
|
|
||||||
export default function Controlled() {
|
export default function Controlled() {
|
||||||
const rDocument = React.useRef<TDDocument>({
|
const rDocument = React.useRef<TDDocument>({
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Tldraw, TDFile } from '@tldraw/tldraw'
|
import { TDFile, Tldraw } from '@tldraw/tldraw'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
|
|
||||||
export default function ReadOnly() {
|
export default function ReadOnly() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
import * as React from 'react'
|
|
||||||
import { Tldraw, TldrawApp } from '@tldraw/tldraw'
|
import { Tldraw, TldrawApp } from '@tldraw/tldraw'
|
||||||
|
import * as React from 'react'
|
||||||
|
|
||||||
declare const window: Window & { app: TldrawApp }
|
declare const window: Window & { app: TldrawApp }
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,10 @@ Rename the new file to the [language code](https://gist.github.com/wpsmith/76048
|
||||||
In the `packages/tldraw/src/translations/translations.ts` file, import your file and create a new entry in to the `TRANSLATIONS` array like this:
|
In the `packages/tldraw/src/translations/translations.ts` file, import your file and create a new entry in to the `TRANSLATIONS` array like this:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import en from './en.json'
|
|
||||||
import ar from './ar.json'
|
import ar from './ar.json'
|
||||||
import eo from './eo.json' // <-- import here
|
import en from './en.json'
|
||||||
|
// import here ↲
|
||||||
|
import eo from './eo.json'
|
||||||
|
|
||||||
export const TRANSLATIONS: TDTranslations = [
|
export const TRANSLATIONS: TDTranslations = [
|
||||||
// Default language:
|
// Default language:
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
"test": "turbo run test --stream",
|
"test": "turbo run test --stream",
|
||||||
"test:ci": "turbo run test:ci --stream",
|
"test:ci": "turbo run test:ci --stream",
|
||||||
"test:watch": "turbo run test:watch --stream",
|
"test:watch": "turbo run test:watch --stream",
|
||||||
|
"format": "prettier --write .",
|
||||||
"lint": "turbo run lint",
|
"lint": "turbo run lint",
|
||||||
"clean": "turbo run clean",
|
"clean": "turbo run clean",
|
||||||
"postinstall": "husky install",
|
"postinstall": "husky install",
|
||||||
|
@ -44,6 +45,7 @@
|
||||||
"@testing-library/jest-dom": "^5.16.2",
|
"@testing-library/jest-dom": "^5.16.2",
|
||||||
"@testing-library/react": "^12.1.2",
|
"@testing-library/react": "^12.1.2",
|
||||||
"@tldraw/lfg": "latest",
|
"@tldraw/lfg": "latest",
|
||||||
|
"@trivago/prettier-plugin-sort-imports": "^3.3.0",
|
||||||
"@types/jest": "^27.4.0",
|
"@types/jest": "^27.4.0",
|
||||||
"@types/node": "^17.0.14",
|
"@types/node": "^17.0.14",
|
||||||
"@types/vscode": "^1.63.2",
|
"@types/vscode": "^1.63.2",
|
||||||
|
@ -57,7 +59,7 @@
|
||||||
"jest": "^27.4.7",
|
"jest": "^27.4.7",
|
||||||
"lint-staged": "^12.3.3",
|
"lint-staged": "^12.3.3",
|
||||||
"mobx": "^6.3.8",
|
"mobx": "^6.3.8",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.7.1",
|
||||||
"resize-observer-polyfill": "^1.5.1",
|
"resize-observer-polyfill": "^1.5.1",
|
||||||
"source-map-loader": "^3.0.1",
|
"source-map-loader": "^3.0.1",
|
||||||
"tslib": "^2.4.0",
|
"tslib": "^2.4.0",
|
||||||
|
@ -65,6 +67,9 @@
|
||||||
"typescript": "^4.7.3",
|
"typescript": "^4.7.3",
|
||||||
"webpack": "^5.68.0"
|
"webpack": "^5.68.0"
|
||||||
},
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"@trivago/prettier-plugin-sort-imports/**/@babel/parser": "^7.17.0"
|
||||||
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*": "prettier --ignore-unknown --write",
|
"*": "prettier --ignore-unknown --write",
|
||||||
"*.{ts,tsx}": "eslint --fix"
|
"*.{ts,tsx}": "eslint --fix"
|
||||||
|
|
|
@ -312,9 +312,8 @@ Next, use `TLShapeUtil.Component` to create a second component for your shape's
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
// BoxComponent.ts
|
// BoxComponent.ts
|
||||||
|
import { SVGContainer, shapeComponent } from '@tldraw/core'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { shapeComponent, SVGContainer } from '@tldraw/core'
|
|
||||||
import type { BoxShape } from './BoxShape'
|
import type { BoxShape } from './BoxShape'
|
||||||
|
|
||||||
export const BoxComponent = TLShapeUtil.Component<BoxShape, SVGSVGElement>(
|
export const BoxComponent = TLShapeUtil.Component<BoxShape, SVGSVGElement>(
|
||||||
|
@ -391,8 +390,7 @@ Next, create a "shape util" for your shape. This is a class that extends `TLShap
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
// BoxUtil.ts
|
// BoxUtil.ts
|
||||||
|
import { TLBounds, TLShapeUtil, Utils } from '@tldraw/core'
|
||||||
import { Utils, TLBounds, TLShapeUtil } from '@tldraw/core'
|
|
||||||
import { BoxComponent } from './BoxComponent'
|
import { BoxComponent } from './BoxComponent'
|
||||||
import { BoxIndicator } from './BoxIndicator'
|
import { BoxIndicator } from './BoxIndicator'
|
||||||
import type { BoxShape } from './BoxShape'
|
import type { BoxShape } from './BoxShape'
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import * as React from 'react'
|
|
||||||
import type { TLShape, TLBounds, TLComponentProps } from '../types'
|
|
||||||
import { TLShapeUtil } from './TLShapeUtil'
|
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
|
import * as React from 'react'
|
||||||
import { SVGContainer } from '~components'
|
import { SVGContainer } from '~components'
|
||||||
import Utils from '../utils'
|
import type { TLBounds, TLComponentProps, TLShape } from '~types'
|
||||||
|
import Utils from '~utils'
|
||||||
|
import { TLShapeUtil } from './TLShapeUtil'
|
||||||
|
|
||||||
export interface BoxShape extends TLShape {
|
export interface BoxShape extends TLShape {
|
||||||
type: 'box'
|
type: 'box'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as React from 'react'
|
|
||||||
import Utils from '../utils'
|
|
||||||
import type { TLBounds, TLComponentProps, TLForwardedRef, TLShape, TLUser } from '../types'
|
|
||||||
import { intersectPolygonBounds } from '@tldraw/intersect'
|
import { intersectPolygonBounds } from '@tldraw/intersect'
|
||||||
|
import * as React from 'react'
|
||||||
|
import type { TLBounds, TLComponentProps, TLForwardedRef, TLShape, TLUser } from '~types'
|
||||||
|
import Utils from '~utils'
|
||||||
|
|
||||||
export abstract class TLShapeUtil<T extends TLShape, E extends Element = any, M = any> {
|
export abstract class TLShapeUtil<T extends TLShape, E extends Element = any, M = any> {
|
||||||
refMap = new Map<string, React.RefObject<E>>()
|
refMap = new Map<string, React.RefObject<E>>()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { TLShape } from '../types'
|
import type { TLShape } from '~types'
|
||||||
import type { TLShapeUtil } from './TLShapeUtil'
|
import type { TLShapeUtil } from './TLShapeUtil'
|
||||||
|
|
||||||
export type TLShapeUtilsMap<T extends TLShape> = {
|
export type TLShapeUtilsMap<T extends TLShape> = {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
|
import { observer } from 'mobx-react-lite'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { TLBoundsEdge, TLBoundsCorner, TLBounds } from '~types'
|
|
||||||
import { CenterHandle } from './CenterHandle'
|
|
||||||
import { RotateHandle } from './RotateHandle'
|
|
||||||
import { CornerHandle } from './CornerHandle'
|
|
||||||
import { LinkHandle } from './LinkHandle'
|
|
||||||
import { EdgeHandle } from './EdgeHandle'
|
|
||||||
import { CloneButtons } from './CloneButtons'
|
|
||||||
import { Container } from '~components/Container'
|
import { Container } from '~components/Container'
|
||||||
import { SVGContainer } from '~components/SVGContainer'
|
import { SVGContainer } from '~components/SVGContainer'
|
||||||
import { observer } from 'mobx-react-lite'
|
import { TLBounds, TLBoundsCorner, TLBoundsEdge } from '~types'
|
||||||
|
import { CenterHandle } from './CenterHandle'
|
||||||
|
import { CloneButtons } from './CloneButtons'
|
||||||
|
import { CornerHandle } from './CornerHandle'
|
||||||
|
import { EdgeHandle } from './EdgeHandle'
|
||||||
|
import { LinkHandle } from './LinkHandle'
|
||||||
|
import { RotateHandle } from './RotateHandle'
|
||||||
|
|
||||||
interface BoundsProps {
|
interface BoundsProps {
|
||||||
zoom: number
|
zoom: number
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { observer } from 'mobx-react-lite'
|
import { observer } from 'mobx-react-lite'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import type { TLBounds } from '~types'
|
|
||||||
import { useBoundsEvents } from '~hooks'
|
|
||||||
import { Container } from '~components/Container'
|
import { Container } from '~components/Container'
|
||||||
import { SVGContainer } from '~components/SVGContainer'
|
import { SVGContainer } from '~components/SVGContainer'
|
||||||
|
import { useBoundsEvents } from '~hooks'
|
||||||
|
import type { TLBounds } from '~types'
|
||||||
|
|
||||||
interface BoundsBgProps {
|
interface BoundsBgProps {
|
||||||
bounds: TLBounds
|
bounds: TLBounds
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { observer } from 'mobx-react-lite'
|
import { observer } from 'mobx-react-lite'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { useBoundsHandleEvents } from '~hooks'
|
import { useBoundsHandleEvents } from '~hooks'
|
||||||
import { TLBoundsCorner, TLBounds } from '~types'
|
import { TLBounds, TLBoundsCorner } from '~types'
|
||||||
|
|
||||||
const cornerBgClassnames = {
|
const cornerBgClassnames = {
|
||||||
[TLBoundsCorner.TopLeft]: 'tl-cursor-nwse',
|
[TLBoundsCorner.TopLeft]: 'tl-cursor-nwse',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { observer } from 'mobx-react-lite'
|
import { observer } from 'mobx-react-lite'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { useBoundsHandleEvents } from '~hooks'
|
import { useBoundsHandleEvents } from '~hooks'
|
||||||
import { TLBoundsEdge, TLBounds } from '~types'
|
import { TLBounds, TLBoundsEdge } from '~types'
|
||||||
|
|
||||||
const edgeClassnames = {
|
const edgeClassnames = {
|
||||||
[TLBoundsEdge.Top]: 'tl-cursor-ns',
|
[TLBoundsEdge.Top]: 'tl-cursor-ns',
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { renderWithContext } from '~test'
|
|
||||||
import { screen } from '@testing-library/react'
|
import { screen } from '@testing-library/react'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
|
import { renderWithContext } from '~test'
|
||||||
import { Bounds } from '../Bounds'
|
import { Bounds } from '../Bounds'
|
||||||
|
|
||||||
describe('bounds', () => {
|
describe('bounds', () => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { renderWithContext } from '~test'
|
|
||||||
import { screen } from '@testing-library/react'
|
import { screen } from '@testing-library/react'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
|
import { renderWithContext } from '~test'
|
||||||
import { CloneButton } from '../CloneButton'
|
import { CloneButton } from '../CloneButton'
|
||||||
|
|
||||||
jest.spyOn(console, 'error').mockImplementation(() => void null)
|
jest.spyOn(console, 'error').mockImplementation(() => void null)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue