diff --git a/README.md b/README.md index 46fcbed65..e44d26593 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,9 @@ To support this project (and gain access to the project while it is in developme ## Documentation -In progress! Check the README files in packages/core and packages/tldraw. +In progress! Check the README files in [packages/core](packages/core/README.md) and [packages/tldraw](packages/tldraw/README.md). + +## Examples - [@tldraw/core example](https://codesandbox.io/s/tldraw-core-example-88c74) - [@tldraw/tldraw example](https://codesandbox.io/s/tldraw-example-n539u) @@ -24,7 +26,7 @@ In progress! Check the README files in packages/core and packages/tldraw. ### The tldraw packages -To work on the packages (@tldraw/core or @tldraw/tldraw), you'll want to run the (extremely fast) package dev server. +To work on the packages (@tldraw/core or @tldraw/tldraw), you'll want to run the (extremely fast) dev server. 1. Download or clone the repository. @@ -46,15 +48,14 @@ To work on the packages (@tldraw/core or @tldraw/tldraw), you'll want to run the 4. Open the local site at `https://localhost:5000`. - ### The tldraw app To work on the app itself (that embeds @tldraw/tldraw), run the Next.js app. This won't directly respond to changes to packages, so for concurrent package dev work be sure to use the package dev server instead. (This is being worked on.) - + 1. Start the development server. ```bash yarn start:www ``` - + 2. Open the local site at `https://localhost:3000`. diff --git a/package.json b/package.json index 46f4482fd..9e140df8a 100644 --- a/package.json +++ b/package.json @@ -113,4 +113,4 @@ "\\+(.*)": "/packages/core/src/$1" } } -} \ No newline at end of file +} diff --git a/packages/core/src/components/renderer/renderer.test.tsx b/packages/core/src/components/renderer/renderer.test.tsx index 037c21a25..4e3eec61f 100644 --- a/packages/core/src/components/renderer/renderer.test.tsx +++ b/packages/core/src/components/renderer/renderer.test.tsx @@ -3,7 +3,7 @@ import { mockDocument, mockUtils } from '+test' import { render } from '@testing-library/react' import { Renderer } from './renderer' -describe('context menu', () => { +describe('renderer', () => { test('mounts component without crashing', () => { render( { +describe('shape', () => { test('mounts component without crashing', () => { renderWithSvg( { +describe('menu', () => { test('mounts component without crashing', () => { renderWithContext() }) diff --git a/packages/tldraw/src/state/command/align/align.command.spec.ts b/packages/tldraw/src/state/command/align/align.command.spec.ts index 408b5f787..2a07d6fd6 100644 --- a/packages/tldraw/src/state/command/align/align.command.spec.ts +++ b/packages/tldraw/src/state/command/align/align.command.spec.ts @@ -21,7 +21,7 @@ describe('Align command', () => { expect(tlstate.getShape('rect2').point).toEqual([100, 0]) }) - it('aligns left', () => { + it('aligns top', () => { tlstate.loadDocument(mockDocument) tlstate.selectAll() tlstate.align(AlignType.Top) diff --git a/packages/tldraw/src/state/command/duplicate-page/duplicate-page.command.spec.ts b/packages/tldraw/src/state/command/duplicate-page/duplicate-page.command.spec.ts index 79c76ca7d..8b215dbd2 100644 --- a/packages/tldraw/src/state/command/duplicate-page/duplicate-page.command.spec.ts +++ b/packages/tldraw/src/state/command/duplicate-page/duplicate-page.command.spec.ts @@ -1,7 +1,7 @@ import { TLDrawState } from '~state' import { mockDocument } from '~test' -describe('Duplicate page', () => { +describe('Duplicate page command', () => { const tlstate = new TLDrawState() it('does, undoes and redoes command', () => { diff --git a/packages/tldraw/src/state/command/flip/flip.command.spec.ts b/packages/tldraw/src/state/command/flip/flip.command.spec.ts index d6cbe55ba..0ceba4b9c 100644 --- a/packages/tldraw/src/state/command/flip/flip.command.spec.ts +++ b/packages/tldraw/src/state/command/flip/flip.command.spec.ts @@ -2,7 +2,7 @@ import { TLDrawState } from '~state' import { mockDocument } from '~test' import type { RectangleShape } from '~types' -describe('Stretch command', () => { +describe('Flip command', () => { const tlstate = new TLDrawState() it('does, undoes and redoes command', () => { @@ -29,7 +29,7 @@ describe('Stretch command', () => { expect(tlstate.getShape('rect1').point).toStrictEqual([100, 0]) }) - it('distributes vertically', () => { + it('flips vertically', () => { tlstate.loadDocument(mockDocument) tlstate.select('rect1', 'rect2') tlstate.flipVertical() diff --git a/packages/tldraw/src/state/command/rename-page/rename-page.command.spec.ts b/packages/tldraw/src/state/command/rename-page/rename-page.command.spec.ts index 98c740152..ffa84024d 100644 --- a/packages/tldraw/src/state/command/rename-page/rename-page.command.spec.ts +++ b/packages/tldraw/src/state/command/rename-page/rename-page.command.spec.ts @@ -1,7 +1,7 @@ import { TLDrawState } from '~state' import { mockDocument } from '~test' -describe('Edit page', () => { +describe('Rename page command', () => { const tlstate = new TLDrawState() it('does, undoes and redoes command', () => { diff --git a/packages/tldraw/src/state/command/stretch/stretch.command.spec.ts b/packages/tldraw/src/state/command/stretch/stretch.command.spec.ts index 28d0e2721..899b58a19 100644 --- a/packages/tldraw/src/state/command/stretch/stretch.command.spec.ts +++ b/packages/tldraw/src/state/command/stretch/stretch.command.spec.ts @@ -30,7 +30,7 @@ describe('Stretch command', () => { expect(tlstate.getShape('rect2').size).toStrictEqual([200, 100]) }) - it('distributes horizontally', () => { + it('stretches horizontally', () => { tlstate.loadDocument(mockDocument) tlstate.select('rect1', 'rect2') tlstate.stretch(StretchType.Horizontal) @@ -41,7 +41,7 @@ describe('Stretch command', () => { expect(tlstate.getShape('rect2').size).toStrictEqual([200, 100]) }) - it('distributes vertically', () => { + it('stretches vertically', () => { tlstate.loadDocument(mockDocument) tlstate.select('rect1', 'rect2') tlstate.stretch(StretchType.Vertical) diff --git a/packages/tldraw/src/state/command/toggle-decoration/toggle-decoration.command.spec.ts b/packages/tldraw/src/state/command/toggle-decoration/toggle-decoration.command.spec.ts index a1e7febeb..0f2301595 100644 --- a/packages/tldraw/src/state/command/toggle-decoration/toggle-decoration.command.spec.ts +++ b/packages/tldraw/src/state/command/toggle-decoration/toggle-decoration.command.spec.ts @@ -3,7 +3,7 @@ import { TLDrawState } from '~state' import { mockDocument } from '~test' import { ArrowShape, Decoration, TLDrawShape } from '~types' -describe('Handle command', () => { +describe('Toggle decoration command', () => { const tlstate = new TLDrawState() it('does, undoes and redoes command', () => { diff --git a/packages/tldraw/src/state/command/update/update.command.spec.ts b/packages/tldraw/src/state/command/update/update.command.spec.ts index 568971e88..3a8efb687 100644 --- a/packages/tldraw/src/state/command/update/update.command.spec.ts +++ b/packages/tldraw/src/state/command/update/update.command.spec.ts @@ -4,7 +4,7 @@ import { Utils } from '@tldraw/core' const doc = Utils.deepClone(mockDocument) -describe('Move command', () => { +describe('Update command', () => { const tlstate = new TLDrawState() it('does, undoes and redoes command', () => { diff --git a/packages/tldraw/src/state/session/sessions/arrow/arrow.session.spec.ts b/packages/tldraw/src/state/session/sessions/arrow/arrow.session.spec.ts index d8ce73242..606198591 100644 --- a/packages/tldraw/src/state/session/sessions/arrow/arrow.session.spec.ts +++ b/packages/tldraw/src/state/session/sessions/arrow/arrow.session.spec.ts @@ -159,12 +159,8 @@ describe('Arrow session', () => { expect(tlstate.getShape('arrow1').handles.end.point).toStrictEqual([85, 85]) }) - it('updates the arrow when bound on both sides', () => { - // TODO - }) + it.todo('updates the arrow when bound on both sides') - it('snaps the bend to zero when dragging the bend handle toward the center', () => { - // TODO - }) + it.todo('snaps the bend to zero when dragging the bend handle toward the center') }) }) diff --git a/packages/tldraw/src/state/session/sessions/draw/draw.session.spec.ts b/packages/tldraw/src/state/session/sessions/draw/draw.session.spec.ts index 4373a5079..8c9bcc786 100644 --- a/packages/tldraw/src/state/session/sessions/draw/draw.session.spec.ts +++ b/packages/tldraw/src/state/session/sessions/draw/draw.session.spec.ts @@ -2,7 +2,7 @@ import { TLDrawState } from '~state' import { mockDocument } from '~test' import { ColorStyle, DashStyle, SizeStyle, TLDrawShapeType, TLDrawStatus } from '~types' -describe('Transform session', () => { +describe('Draw session', () => { const tlstate = new TLDrawState() it('begins, updates and completes session', () => { diff --git a/packages/tldraw/src/state/session/sessions/rotate/rotate.session.spec.ts b/packages/tldraw/src/state/session/sessions/rotate/rotate.session.spec.ts index ba477d090..fdc2c3219 100644 --- a/packages/tldraw/src/state/session/sessions/rotate/rotate.session.spec.ts +++ b/packages/tldraw/src/state/session/sessions/rotate/rotate.session.spec.ts @@ -2,7 +2,7 @@ import { TLDrawState } from '~state' import { mockDocument } from '~test' import { TLDrawStatus } from '~types' -describe('Brush session', () => { +describe('Rotate session', () => { const tlstate = new TLDrawState() it('begins, updates and completes session', () => { diff --git a/packages/tldraw/src/state/session/sessions/translate/translate.session.spec.ts b/packages/tldraw/src/state/session/sessions/translate/translate.session.spec.ts index 2706ba5e1..c81d5bd68 100644 --- a/packages/tldraw/src/state/session/sessions/translate/translate.session.spec.ts +++ b/packages/tldraw/src/state/session/sessions/translate/translate.session.spec.ts @@ -2,7 +2,7 @@ import { TLDrawState } from '~state' import { mockDocument } from '~test' import { ArrowShape, TLDrawShapeType, TLDrawStatus } from '~types' -describe('Brush session', () => { +describe('Translate session', () => { const tlstate = new TLDrawState() it('begins, updates and completes session', () => { @@ -173,13 +173,7 @@ describe('Brush session', () => { // expect(tlstate.getShape('arrow1').handles.start.bindingId).toBe(undefined) }) - // it('clones a shape with a parent shape', () => { - // tlstate.loadDocument(mockDocument) - // // TODO - // }) + // it.todo('clones a shape with a parent shape') - // it('clones a shape with children', () => { - // tlstate.loadDocument(mockDocument) - // // TODO - // }) + // it.todo('clones a shape with children') }) diff --git a/packages/tldraw/src/state/tlstate.spec.ts b/packages/tldraw/src/state/tlstate.spec.ts index 12ee2aa4a..c3d1ecfcc 100644 --- a/packages/tldraw/src/state/tlstate.spec.ts +++ b/packages/tldraw/src/state/tlstate.spec.ts @@ -115,21 +115,13 @@ describe('TLDrawState', () => { expect(tlstate.appState.status.current).toBe('idle') }) - it('deletes shapes if cancelled during creating', () => { - // TODO - }) + it.todo('deletes shapes if cancelled during creating') - it('deletes shapes on undo after creating', () => { - // TODO - }) + it.todo('deletes shapes on undo after creating') - it('re-creates shapes on undo after creating', () => { - // TODO - }) + it.todo('re-creates shapes on redo after creating') - it('selects all', () => { - // TODO - }) + it.todo('selects all') // Single click on a selected shape to select just that shape diff --git a/yarn.lock b/yarn.lock index 108c1c66e..3de3deb68 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2726,6 +2726,15 @@ "@babel/runtime" "^7.12.5" "@testing-library/dom" "^8.0.0" +"@tldraw/core@^0.0.53": + version "0.0.53" + resolved "https://registry.yarnpkg.com/@tldraw/core/-/core-0.0.53.tgz#2db2b27df441169e452e0aa07570adca8b06b582" + integrity sha512-hxZIUR3Sm320tvGW5lWEKfw1QJhe6mJu7IrG5ka5G3slusqaY3cQY9EafFqH07yEXul2MU2RENIQus7fh+Gwcg== + dependencies: + deepmerge "^4.2.2" + ismobilejs "^1.1.1" + react-use-gesture "^9.1.3" + "@tootallnate/once@1": version "1.1.2" resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"