Commit graph

2428 commits

Author SHA1 Message Date
huppy-bot[bot]
9c3b3ddbe0 Update CHANGELOG.md [skip ci] 2023-10-17 14:39:34 +00:00
Lu Wilson
5feccecb56
Firefox, Touch: Fix not being able to open style dropdowns (#2092)
This PR places a bandaid over a radix issue.

On firefox, when using a touch screen, certain dropdowns in the style
menu would immediately close after opening. This is because the
'touchup' event was closing them.

We can do a dodgy fix by preventing the touch up event.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. On firefox, use a touch device (this can be firefox devtools on a
mac)
2. Draw an arrow and a geo shape.
3. Select both of them.
4. Open the style menu.
5. Make sure you can open the arrowhead dropdown.
6. Make sure you can open the geo shape type dropdown.

### Release Notes

- Firefox Mobile: Fixed a bug where you couldn't open some style
dropdown options.
2023-10-17 13:19:05 +00:00
Taha
ad956865ec
Add timestamp to file names (#2096)
closes #2091
Added a little timestamp to filenames so that you don't get asked if you
want to download them again on android devices.

### Change Type

- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version

### Test Plan

1. export as png
2. export again
3. the two files now have different names, wow!

### Release Notes

- Add timestamp to exported image file names
2023-10-17 13:15:00 +00:00
alex
4ab0a9d351
move imports (#2099)
These got moved in another diff and it broke our build for the dotcom
app.

### Change Type

- [x] `patch` — Bug fix
2023-10-17 13:09:39 +00:00
Steve Ruiz
3b7acb8997
[fix] Context menu + menus not closing correctly (#2086)
This PR fixes a bug that causes menus not to close correctly when open.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. On mobile, open the menu.
2. Tap the canvas—it should close the panel.
3. Open the mobile style panel.
4. Tap the canvas—it should close the panel.
5. Open the mobile style panel.
6. Tap the mobile style panel button—it should close the panel.
7. On mobile, long press to open the context menu

### Release Notes

- [fix] bug with menus
2023-10-17 13:06:53 +00:00
Lu Wilson
ca609a0fa5
Fix not being able to upload massive images (#2095)
This PR fixes a case where you couldn't upload images that are bigger
than the browser's max canvas size.
It does this by resizing them down if they're too big.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

Easiest to test on one of our iPads.

1. Take a photo with the iPad camera. (they're big photos)
2. Insert the photo to the canvas with the 'insert media' tool.
3. It should appear on the canvas!

(You might want to double check that your photo *doesn't* successfully
upload on staging, to make sure it's big enough)

- [ ] Unit Tests
- [ ] End to end tests

### Release Notes

- Fixed big images being too big to get added to the canvas.
2023-10-17 12:54:40 +00:00
David Sheldrick
21ac5749d0
fix cropped image size (#2097)
closes #2080 

### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Fixes a rendering issue where cropped images were sometimes bleeding
outside their bounds.
2023-10-17 12:17:12 +00:00
Steve Ruiz
aaf810b015
Add offline indicator (also to top zone example) (#2083)
This PR adds an offline indicator to the UI package. It's not used in
the default app but we'll use it on tldraw.com, and it makes sense to
include it here as it's generally useful.

### Change Type

- [x] `minor` — New feature

### Test Plan

1. See the zones example.

### Release Notes

- [@tldraw/tldraw] add offline indicator to ui components
2023-10-17 08:32:41 +00:00
Kewell
47e6e4c25a
Fixed a bug checking translated string keys (#2082)
Fixed a bug checking translated string keys

Suppress the following warning message in your browser.
```
Language zh-cn: missing messages for keys:
locale
label
messages
```

### Change Type

- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
2023-10-17 08:29:43 +00:00
Steve Ruiz
59129e269d
[fix] remove findLast calls (#2081)
This PR removes some calls to `findLast`, as this is not in all browsers
yet.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Drag and drop.
2. Create a shape inside of a frame

- [x] Unit Tests
2023-10-17 08:23:59 +00:00
David Sheldrick
c377c98902
bump nanoid (#2078)
Bumps nanoid to bring in line with brivate to make sure our nanoid mock
in our fuzz test works. Supersedes
https://github.com/tldraw/brivate/pull/3027#pullrequestreview-1676280991

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [x] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
2023-10-16 08:44:12 +00:00
Steve Ruiz
a7c421ce9e
Add data breakpoint to layout css (#2076)
This PR adds `data-breakpoint` to the `tlui-layout`.

### Change Type

- [x] `minor` — New feature
2023-10-14 09:04:23 +00:00
Steve Ruiz
ff9c1655f9
[fix] missing border on group shape when unlocked (#2075)
This PR fixes a bug where the indicator on a locked group (or any
shape!) would not appear when the shape was unlocked. This happens
because the `memo` equality checker filtered out changes to the shape's
locked property if they did not effect any other properties.

![Kapture 2023-10-13 at 14 44
31](https://github.com/tldraw/tldraw/assets/23072548/c40442e0-8d18-4ed0-863c-c2b73da81f28)

### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Fix case where indicator was not shown when unlocking groups
2023-10-13 15:13:47 +00:00
alex
22955bb0ec
Only upload playwright to S3 if we have the right credentials (#2074)
These credentials aren't available to non-tldraw contributors which was
breaking uploads.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-10-13 13:42:41 +00:00
Steve Ruiz
1f4df14d4f
Compact children when updating parents to children. (#2072)
This PR fixes (or rather buries) a bug that could occur when the parents
to children array includes shapes that no longer exist.

### Change Type

- [x] `patch` — Bug fix
2023-10-13 12:12:05 +00:00
Steve Ruiz
bfb61b12ad
[fix] reparenting locked shapes (#2070)
This PR allows locked shapes to be reparented. This fixes a bug where
grouped and locked shapes would disappear when their parent group would
be ungrouped.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Create two shapes.
2. Group the shapes.
3. Lock one shape.
4. Ungroup the group

- [x] Unit Tests

### Release Notes

- Fix a bug where grouped locked shapes would be deleted when ungrouped.
2023-10-13 11:18:26 +00:00
Steve Ruiz
01d46bbe22
[fix] Don't select locked shapes on pointer up (#2069)
This PR fixes a bug where a locked shape could be selected when clicking
the shape's label.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Place a no-fill geo shape
2. Lock the shape
3. Click on the middle of the shape (its label)
4. It should not be selected (previously it would be)

1. Place a no-fill shape in a frame
2. Lock the shape
3. Click on the middle of the shape or the edge of the shape
4. It should not be selected (previously it would be)

- [x] Unit Tests

### Release Notes

- Fix bug where locked shape could be selected by clicking on its label
2023-10-13 11:18:15 +00:00
Steve Ruiz
3a2598748c
Same first page id for all editors (#2071)
This PR changes the default state of the editor to use `page:page` as
its first page's id. This removes some randomness that makes certain
seed-based tests impossible. It should have no effect on the way that
the app works.

### Change Type

- [x] `minor` — New feature
2023-10-13 11:18:07 +00:00
Hana
eb041d516f
[fix] locked shape of opacity problem with eraser.pointing (#2073)
locked shape of opacity problem with the pointing state of the eraser
tool
this is only in the pointing (clicking) state.
I don't know if this is intended or a bug, but it's true that it's a
little uncomfortable.


![blinks](https://github.com/tldraw/tldraw/assets/59823089/6292aa54-120d-4cbc-b712-a78f408d248b)
blinks when the user starts to remove the handwriting on locked content.

Defs https://github.com/tldraw/tldraw/pull/2061

### Change Type

- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version

### Test Plan

1. Make a locked shape
2. Click erase over the shape
3. The shape shouldn't change opacity

### Release Notes

- locked shape of opacity problem with eraser.pointing
Before/after:

![A](https://github.com/tldraw/tldraw/assets/59823089/7483506c-72ac-45cc-93aa-f2a794ea8ff0)
![B](https://github.com/tldraw/tldraw/assets/59823089/ef0f988c-83f5-46a2-b891-0a391bca2f87)
2023-10-13 11:17:42 +00:00
antonio moura
981ef61810
Fix ExplodedExample.tsx (#2068)
Previous implementation was incorrect, causing the following bug:


![image](https://github.com/tldraw/tldraw/assets/26308297/03f2a996-dd58-4864-8f89-8e7af2ecca69)


### Change Type

- [] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [x] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-10-13 08:28:59 +00:00
Mitja Bezenšek
8f1850785e
Cache playwright browsers. (#2067)
Adds caching for playwright browsers, should make the e2e tests run much
faster.

![CleanShot 2023-10-11 at 13 06
48](https://github.com/tldraw/tldraw/assets/2523721/6eb7fb00-d70e-4019-9e81-736b2a19e1bb)

Here's how it looks like when there's a cache hit (added an empty commit
to this PR to test it out)
![CleanShot 2023-10-11 at 13 19
30](https://github.com/tldraw/tldraw/assets/2523721/b6a2cfcf-8322-413f-822b-8ed211f5c9a3)


### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [x] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
2023-10-12 09:28:55 +00:00
Mitja Bezenšek
ec97b740b4
Update VS Code extension 2.0.13 (#2066)
Update VS code extension version and changelog.
### Change Type

- [x] `internal` — Any other changes that don't affect the published
package[^2]
[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
2023-10-11 10:52:27 +00:00
huppy-bot[bot]
ed5df33244 Update CHANGELOG.md [skip ci] 2023-10-11 10:42:50 +00:00
Steve Ruiz
8a8b718e53
Move example into examples folder (#2064)
This PR moves an example into the examples folder.

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package[^2]
2023-10-11 09:54:26 +00:00
David Sheldrick
f118430afe
Fix shape opacity when erasing (#2055)
Closes #2051 

This was another bug related to the usage of parent-scope `let`
assignments to avoid stack allocations in a hot code path, so I switched
to `const`s and local `let`s which we really should have done last week.
I think the compiler should be able to optimize this well enough.

### Change Type

- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version

### Test Plan

1. Add a step-by-step description of how to test your PR here.
2.

- [ ] Unit Tests
- [ ] End to end tests

### Release Notes

- Fixes opacity of shapes while erasing in a group or frame.
2023-10-10 15:58:18 +00:00
Steve Ruiz
e77005e507
[fix] Hit testing against zero width / height lines (#2060)
This PR fixes a bug where certain hit tests would always miss straight
lines.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Create a straight line.
2. Try to bind an arrow to it.

- [x] Unit Tests

### Release Notes

- [fix] Bug where arrows would not bind to straight lines
2023-10-10 15:58:02 +00:00
Taha
8015a7e3d8
Fix opacity lowering on shapes that cannot be deleted (#2061)
Opacity used to lower on locked shapes, now it doesn't

### Change Type

- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version

### Test Plan

1. Make a locked shape
2. Scribble erase over the shape
3. The shape shouldn't change opacity

### Release Notes

- Locked shapes don't change opacity when scribble erasing.

Before/after:

<image width="250"
src="https://github.com/tldraw/tldraw/assets/98838967/763a93eb-ffaa-405c-9255-e68ba88ed9a2"
/>

<image width="250"
src="https://github.com/tldraw/tldraw/assets/98838967/dc9d3f77-c1c5-40f2-a9fe-10c723b6a21c"
/>
2023-10-10 13:27:42 +00:00
Steve Ruiz
544c61568c
[fix] broken docs link (#2062)
This PR fixes a broken link in the StyleProp docs.

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package[^2]
2023-10-10 13:23:49 +00:00
Prince Mendiratta
135af4533a
fix: proper label for opacity tooltip on hover (#2044)
Describe what your pull request does. If appropriate, add GIFs or images
showing the before and after.
There was a bug where hovering over the slider for opacity didn't
resolve the tooltip properly, due to accessing object property
incorrectly. This PR fixes this bug. The bug's reproduction video has
been attached below.

Thank you for this project, grateful!

<details>
<summary>Bug Reproduction Video</summary>


https://github.com/tldraw/tldraw/assets/54077356/f313fe1e-6d83-43f7-b101-2818719649bd

</details>

### Change Type

- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version

### Test Plan

1. Open the app.
2. Hover above the opacity slider.
3. Ensure that the opacity value is shown properly.

- [ ] Unit Tests
- [ ] End to end tests

### Release Notes

- Add a brief release note for your PR here.

Signed-off-by: Prince Mendiratta <prince.mendi@gmail.com>
2023-10-10 13:03:12 +00:00
alex
421102282d
Fix newlines in text geo shapes (#2059)
Previously, entering a geo shape and adding a bunch of newlines wouldn't
correctly update the shape's height. This fixes that.

### Change Type

- [x] `patch` — Bug fix


### Test Plan

1. Create a geo shape
2. Enter text editing mode
3. Spam the enter key
4. See that the shape grows appropriately
5. Exit editing and check that the trailing newlines have been deleted.

- [ ] Unit Tests
- [x] End to end tests

---------

Co-authored-by: huppy-bot[bot] <128400622+huppy-bot[bot]@users.noreply.github.com>
Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-10-10 12:58:28 +00:00
alex
4ccb6d8a50
re-enable visual regression tests (#2056)
Re-enable visual regression tests

### Change Type
- [x] `tests` — Changes to any test code only[^2]

---------

Co-authored-by: huppy-bot[bot] <128400622+huppy-bot[bot]@users.noreply.github.com>
2023-10-10 12:33:16 +00:00
Mitja Bezenšek
f16bad666a
Fix alt + shift keyboard shortcuts (#2053)
Fixes keyboard shortcuts that use `alt + shift` modifier (distribute
horizontally and vertically fall into this category).

Fixes [#2054](https://github.com/tldraw/tldraw/issues/2054)

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Create multiple shapes
2. Use `alt + shift + v / h` to distribute vertically or horizontally.

### Release Notes

- Fixes keyboard shortcuts that use `alt` and `shift` modifiers.
2023-10-10 11:22:36 +00:00
Steve Ruiz
8892176b1a
[improvement] Scope getShapeAtPoint to rendering shapes only (#2043)
This PR:

1. Adds a `renderingOnly` option to the `Editor.getShapeAtPoint` method.
When true, the method will only hit test against rendering shapes
(shapes that are inside of the current `renderingBounds`) rather than
all shapes on the canvas.
2. Includes some low level improvements to the way that edges find their
nearest point.
3. Includes a fix to circle geometry that could produce NaN values
 
### Change Type

- [x] `minor` — New feature

### Test Plan

1. Check whether hovering shapes still works as you would expect.

- [x] Unit Tests

### Release Notes

- Improve perf for hovering shapes / shape hit tests
2023-10-09 14:18:42 +00:00
alex
2a8987d8b9
fix standalone examples (#2042)
The trigger for the generating the standalone examples was accidentally
pointing at the wrong domain
2023-10-09 10:55:16 +00:00
Steve Ruiz
863edc9b56
Remove fixup script (#2041)
This PR removes an unused "fixup" script.

### Change Type

- [x] `internal`
2023-10-09 10:23:01 +00:00
Steve Ruiz
550b88be8f
[fix] Page state migration (#2040)
This PR is a follower fix for the page state migration.

### Change Type

- [x] `patch` — Bug fix
2023-10-09 08:20:55 +00:00
Steve Ruiz
a5d9012934
Remove dot com ui styles [1/2] (#2039)
This PR removes some ui styles that were only being used on tldraw.com

### Change Type

- [x] `minor` — New feature
2023-10-09 07:11:34 +00:00
Steve Ruiz
31b3ae2100
[fix] migrations for page state (#2038)
This PR adds an additional migration that fixes a bad (a->a) migration
that I added in the previous version.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. On the tldraw app, open a file.

- [x] Unit Tests
2023-10-09 06:36:38 +00:00
alex
a007c66b78
prevent hover indicator from showing when pointer isn't over the canvas (#2023)
Before the geometry change, we'd rely on the browser to tell us which
element was hovered, which meant that when the pointer left the canvas
we'd automatically clear the hovered shape.

Currently, we don't know whether the pointer is over the canvas or not -
so we keep showing the hover indicator for the last shape you had your
pointer over.

This diff adds an `isHoveringCanvas` prop to the instance state (true,
false, or null if the current pointer doesn't support hovering) that we
can use to track this and disable the hover indicator appropriately.

![Kapture 2023-10-05 at 12 00
00](https://github.com/tldraw/tldraw/assets/1489520/236b9459-878b-47e2-bcaa-10d245581347)


### Change Type

- [x] `minor` — New feature

### Test Plan

1. Create some shapes that go below the UI
2. Move the mouse from the shape to the UI
3. Hover indicator should disappear
2023-10-09 06:34:48 +00:00
Steve Ruiz
e2a6f3ed40
Restore background (#2037)
This PR restores the missing background component (which includes the
background color).

### Change Type

- [x] `patch` — Bug fix
2023-10-09 06:19:41 +00:00
Steve Ruiz
cfb007599a
[fix] Stylepanel default spacing (#2036)
This PR fixes the uneven spacing around the style panel.

### Change Type

- [x] `patch` — Bug fix
2023-10-09 06:11:01 +00:00
alex
37f8a7a491
Remove topBar prop from <TldrawUi /> (#2018)
This diff removes the UI top center bar from the public API and tweaks
some of the styling around the top bar as a whole. Now, the left and
right bars shrink to fit their content, and the center bar is unstyled
by us. It's also marked `@internal`.

This also exposes `<Spinner />` for internal use.

### Change Type

- [x] `minor` — New feature

### Test Plan

-

### Release Notes

- [BREAKING] removed topBar prop
2023-10-09 06:02:43 +00:00
Steve Ruiz
edf79e56c0
Export tools (#2035)
This PR adds the tldraw tools to its exports.

### Change Type

- [x] `patch` — Bug fix
2023-10-08 22:31:16 +00:00
Steve Ruiz
b0851737ed
Publish api.json (#2034)
This PR publishes the api.json files created by the build-api scripts.

### Change Type

- [x] `internal`
2023-10-08 15:00:58 +00:00
huppy-bot[bot]
d38587d215 Update CHANGELOG.md [skip ci] 2023-10-06 15:18:15 +00:00
Steve Ruiz
68c52f0bfa
Remove docs source. (#2030)
The docs source is going back to the brivate secret sauce repo!

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package[^2]
2023-10-06 13:44:15 +00:00
Steve Ruiz
53a8fd6c69
Update readme (#2027)
This PR updates the tldraw readme.

### Change Type

- [x] `patch` — Bug fix
2023-10-06 12:10:33 +00:00
Steve Ruiz
fa32173409
[fix] Multiple example (#2026)
This PR fixes the multiple example.

### Change Type

- [x] `patch` — Bug fix
2023-10-06 09:02:39 +00:00
Steve Ruiz
9c1dc00740
Debugging cleanup / misc cleanup (#2025)
This PR:
- removes feature flags for people menu, highlighter shape
- removes debugging for cursors
- adds a debug flag for hiding shapes
- changes Canvas to use `useValue` rather than `track`
- removes the default background color on `tl-background`
- in the editor components, makes `Background` null by default

### Change Type

- [x] `minor` — New feature
2023-10-06 08:57:46 +00:00
alex
a9236bcbb0
fix screen bounds not updating (#2022)
There are a lot of cases (eg when interacting with the ui) where the
editor loses focus. This check was preventing us from updating the
viewport screen bounds when appropriate. This function is throttled and
pretty cheap anyway (if the viewport is equal its a no-op) so let's just
remove the condition

### Change Type

- [x] `patch` — Bug fix
2023-10-05 12:31:36 +00:00