Wykres commitów

2530 Commity (c4ffa05b1229214f6178e0680d4c613fa963112d)

Autor SHA1 Wiadomość Data
Steve Ruiz 219e2f63dd
[improvement] account for coarse pointers / insets in edge scrolling (#2401)
This PR:
- shrinks the distance for edge scrolling and insets the distance for
coarse pointers
- adds edge inset tracking

## Scroll distances

Rather than increasing the distance, we move the "zero" in from the
edges, so that the middle of a honkin' fat finger would be at "zero"
when the edge of the finger is touching the edge of the screen. This is
a bit more reliable than looking at just the component size.

## Inset tracking

We now track whether a shape's edges are identical to the edges of the
document body. When an edge is inset, we extend the edge scrolling
distance outside of the component, so that dragging PAST the edge of the
component will scroll. When an edge is NOT inset, we bring that distance
into the component's bounds, so that dragging NEAR TO the edge will
begin to scroll.


![image](https://github.com/tldraw/tldraw/assets/23072548/bb216c98-3dd0-4e2e-a635-4c4f339d5117)


![image](https://github.com/tldraw/tldraw/assets/23072548/75e83c81-1ca9-40a9-8edc-72851d3b1411)


![image](https://github.com/tldraw/tldraw/assets/23072548/6cda7bda-2935-4ded-821c-e7bf78833a1c)

### Change Type

- [x] `minor` — New feature

### Test Plan

1. Use edge scrolling on mobile
2. Use edge scrolling on desktop
3. Use edge scrolling in the "scrolling example"

- [x] Unit Tests

### Release Notes

- Add `instanceState.insets` to track which edges of the component are
inset from the edges of the document body.
- Improve behavior around edge scrolling
2024-01-10 14:29:32 +00:00
Taha e291dda27f
Custom components annotation (#2403)
Annotate the custom components example with further explanation, fix a
typo

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [x] `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

- Annotate the custom components example.
2024-01-10 14:29:17 +00:00
Taha f7b612fa3d
annotate meta onchange (#2430)
annotate meta onchange

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [x] `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

- annotate meta onchange
2024-01-10 14:14:51 +00:00
Mitja Bezenšek 6f67449cd5
VS Code 2.0.21 (#2438)
VS code version bump.

### 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
2024-01-10 13:56:11 +00:00
Mitja Bezenšek 3eaa5810fe
Fix main. (#2439)
Looks like tests fail on `main` ([example of a
PR](https://github.com/tldraw/tldraw/actions/runs/7475025477/job/20342349739?pr=2438)
that should not be failing). This fixes them.

For some reason this [line didn't update
it](https://github.com/tldraw/tldraw/blob/main/scripts/lib/publishing.ts#L61).
Will look into it, but I guess we can merge this to unblock stuff.

### 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
2024-01-10 13:31:33 +00:00
huppy-bot[bot] 35e74fdb12 Update CHANGELOG.md [skip ci] 2024-01-10 12:03:59 +00:00
Mitja Bezenšek ca9ae8e3a3
Fix validation when pasting images. (#2436)
Before introducing url / src validation [we allowed
nulls](https://github.com/tldraw/tldraw/pull/2428/files#diff-28a9f0a3d4797d7addd1d61d336fc00acdec878273ac09f048e2e2dfaf77a037L30)
for src so I updated validations to reflect that.

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

### 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. Copy an image in tldraw in one browser (`cmd + c`)
2. Paste it to a different browser (or at least private mode of the same
browser)
3. Paste should work and you should not see any errors in the console.

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

### Release Notes

- Fixes url validations.

---------

Co-authored-by: alex <alex@dytry.ch>
2024-01-10 10:45:19 +00:00
Stan Flint 59465be84b
Fix decrement button label in OnTheCanvas example component (#2432)
| **Before** | **After** |
| - | - |
| <img width="325" alt="Screenshot 2024-01-09 at 15 34 29"
src="https://github.com/tldraw/tldraw/assets/38284426/2e97723a-787f-4eba-9000-c72eb94974f1">
| <img width="325" alt="Screenshot 2024-01-09 at 15 34 11"
src="https://github.com/tldraw/tldraw/assets/38284426/5f1171b4-2d02-4d90-95de-cb4e58d9de09">
|

### Change Type

- [x] `documentation` — Changes to the documentation only[^2]

### Release Notes

- tiny bug fix, simply changing a label to match behaviour
2024-01-09 17:08:25 +00:00
alex 25328f98d0
refactor copy/export, fix safari copy-as-image being broken (#2411)
In #2198, we introduced a regression on ios around image exports. ios
will block copys if they're not called syncronously in a UI event. It's
important to make ios copys like this:
```ts
navigator.clipboard.write(new ClipboardItem(getStuffToCopyAsAPromise())
```

instead of
```ts
getStuffToCopyAsAPromise().then(stuff => {
    navigator.clipboard.write(new ClipboardItem(stuff))
})
```

We've written and fixed this bug a few times, which i think is because
of how our export/copy code is written: the formatting is interspersed
with interacting with the browser APIs, which makes it hard to change
one without accidentally affecting the other.

This diff fixes the bug, but also restructures our export/copy code: all
the formatting is handled by `exportToBlob` and related which just
return `Blob`s. This leaves `copyAs`, `exportAs` etc. to just handle
interacting with the browser APIs.

Fixes #2312

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Test copy/export as on all browsers

### Release Notes

- Fix a bug preventing copying as an image on iOS

---------

Co-authored-by: huppy-bot[bot] <128400622+huppy-bot[bot]@users.noreply.github.com>
2024-01-09 14:50:10 +00:00
Mitja Bezenšek 6e9fe0c8be
Add url validation (#2428)
Adds validation for urls we use for our shapes and assets. This PR
includes a migration so we should check that existing rooms still load
correctly. There might be some that won't, but that means that they had
invalid url set.

### 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. Existing rooms should still load correctly (there should be no
validation errors).
2. Adding new images and videos should also work (test both local and
multiplayer rooms as they handle assets differently).

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

### Release Notes

- Add validation to urls.

---------

Co-authored-by: alex <alex@dytry.ch>
2024-01-09 10:49:57 +00:00
Taha 4821ba0ba3
[fix] next selected shapes comment (#2427)
setStyleForNextShapes had a comment describing how
setStyleForSelectedShapes worked. This PR fixes that.

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [x] `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

- Fix error in setStyleForNextSelectedShapes comment
2024-01-09 10:16:16 +00:00
Taha 0d755de41e
annotate error boundary example (#2410)
Annotates error boundary example

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [x] `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

- Add annotation to error boundary example

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-01-08 12:12:29 +00:00
alex 01ab3604d0
fix example scrolling on ios (#2412)
We were blocking scrolling on touch devices with `touch-action: none`.
This diff moves that from the `<body>` onto just the editor itself.

### Change Type

- [x] `documentation` — Changes to the documentation only[^2]
2024-01-05 14:21:58 +00:00
alex ddf8a2623c
Add descriptions to active examples (#2407)
Adds example descriptions to active examples. Some examples only have
descriptions and no details, so we should show both on the example
details

### Change Type

- [x] `documentation` — Changes to the documentation only[^2]
2024-01-05 11:08:36 +00:00
Mitja Bezenšek 466a9a2088
Fix issues with clip paths for frames (#2406)
Fixes an issue with frame clipping paths. In fact, this should also
solve other issues we might have with intersect. Seems like our
`pointInPolygon` did not correctly detect that points in the corners or
on the edges of the polygon are in fact part of the polygon.

When calculating the intersection of two regular, intersecting
rectangles the`intersectPolygonPolygon` was returning a polygon with 2,
3, or sometimes even 0 points, which also could result in an error when
dragging one frame out of another frame.

It seems that for all intents and purposes the `pointInPolygon` function
should also consider corners and edges, but maybe we might want to
rename it?

Before:


https://github.com/tldraw/tldraw/assets/2523721/155d351d-8ceb-47c3-a263-024cab487d03

After:


https://github.com/tldraw/tldraw/assets/2523721/338b923a-f902-4dc4-a1b7-e954f906fb8d




Fixes https://github.com/tldraw/tldraw/issues/2387

### 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

- Add a brief release note for your PR here.
2024-01-05 07:55:38 +00:00
Taha d66b4af69d
Annotate custom styles example (#2405)
Adds annotation to the custom styles example

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [x] `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

- Add annotation to the custom styles example

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-01-04 17:32:34 +00:00
Taha c198283c78
annotate custom config example (#2404)
Annotates the custom config example with more detail

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [x] `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

- Adds annotation to the custom config example with a bit more detail
2024-01-04 17:27:22 +00:00
Steve Ruiz 85c5210cd1
[example] Changing the default tldraw colors (#2402)
This PR adds an example that shows how a user could customize tldraw's
default color theme.

### Change Type

- [x] `documentation` — Changes to the documentation only[^2]
2024-01-04 10:06:01 +00:00
Taha 85389551e6
annotate asset props, correct image/video confusion (#2399)
Annotates the asset props example

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [x] `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

- Annotates the asset props example and fixes a mistake in the existing
comments
2024-01-03 13:54:57 +00:00
Taha 918e735510
Annotate/refactor store events example (#2400)
This example refactors the store events example to use the store.listen
method and adds annotations to explain the code.

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [x] `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

- Update store events example to use store.listen method
- Annotate with explanations of the code
2024-01-03 13:54:36 +00:00
Taha 9f336c0128
annotate canvas events (#2397)
Adds annotation to the canvas events example

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [x] `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

- Adds annotation to the canvas events example
2024-01-03 13:54:24 +00:00
Steve Ruiz 2944c46618
[fix] edge scrolling when component is inside of screen (#2398)
This PR updates edge scrolling to take into account situations where the
component's top left corner is not 0,0.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Open up the scrolling container example
2. Edge scroll on the left near the sidebar
 
- [x] Unit Tests

### Release Notes

- Add a brief release note for your PR here.
2024-01-03 12:33:10 +00:00
Taha 05a2751eb6
Annotate api example (#2395)
Annotates the API example, updates from calling it app to calling it
editor.

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [x] `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

- Annotate API example
2024-01-03 12:25:09 +00:00
Steve Ruiz 6b1005ef71
[tech debt] Primitives renaming party / cleanup (#2396)
This PR:
- renames Vec2d to Vec
- renames Vec2dModel to VecModel
- renames Box2d to Box
- renames Box2dModel to BoxModel
- renames Matrix2d to Mat
- renames Matrix2dModel to MatModel
- removes unused primitive helpers
- removes unused exports
- removes a few redundant tests in dgreensp

### Change Type

- [x] `major` — Breaking change

### Release Notes

- renames Vec2d to Vec
- renames Vec2dModel to VecModel
- renames Box2d to Box
- renames Box2dModel to BoxModel
- renames Matrix2d to Mat
- renames Matrix2dModel to MatModel
- removes unused primitive helpers
2024-01-03 12:13:15 +00:00
Taha afd5af1cb6
Refactor and document speech bubble example (#2392)
Adds comments to speech bubble example in a similar vein to the
screenshot tool example. it also refactors the code to make it easier to
parse.

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [x] `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

- Add annotations to the speech bubble example
- Refactor code for clarity

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-01-03 10:29:59 +00:00
Steve Ruiz 16316ac2a0
Fix meta examples (#2379)
This PR fixes a bug in our meta examples.

### Change Type

- [x] `patch` — Bug fix
2024-01-03 08:26:22 +00:00
Steve Ruiz 530596ac5d
[fix] Asset versions (#2389)
This PR fixes a bug where the `version` was not updated during our last
release. This causes the assets not to load.

### Change Type

- [x] `patch` — Bug fix
2023-12-31 11:07:38 +00:00
alex b373abf605
add descriptions to examples (#2375)
Adds descriptions to examples.

![Kapture 2023-12-22 at 17 08
32](https://github.com/tldraw/tldraw/assets/1489520/d78657cf-b3c3-4160-b58b-7c08ed27823d)

They show as a list on the index page, and on individual examples they
show in a three-js style sidebar. For now, this is disabled completely
on mobile. Examples can still be opened in 'standalone' mode to get rid
of the sidebar.

Note: the 'view code' link won't work until after these changes are
merged.

There's a small impact on authoring examples: each one needs to live in
a folder with a README.md. At a minimum, the readme needs to look like
this:
```md
---
title: My Example
component: ./MyExample.tsx
---

Here is a 1-liner about my example
```

Optionally, you can:
- Add `hide: true` to the frontmatter to remove the example from the
list (you can skip the description this way)
- Add `order: 3` to control the order in which the example appears.
They're alphabetical otherwise
- Add some more description or links to docs below a `---`. This won't
show in the listing, but will be visible on GitHub and on the example
page itself.

As a follow-up, I'd like to add an 'Open in CodeSandbox' link to each
example. These won't work until we've made a release with these examples
(as our special examples codesandbox is tied to our release process) but
the code is there & ready to go!

Have a play, let me know what you think!

### Change Type

- [x] `documentation` — Changes to the documentation only[^2]

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-12-27 17:17:18 +00:00
David @ HASH ed37bcf541
Fix trademark links (#2380)
Changes `TRANDEMARK` -> `TRADEMARK` in docs links so they work.

### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [x] `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

- Confirm the links now work.

### Release Notes

- Fixes broken links in a number of docs files.
2023-12-26 09:22:04 +00:00
Steve Ruiz 3f90fbf5b0
[fix] polygon bounds (#2378)
This PR fixes the bounds calculation for polygons. It solves the bug
reported here: https://github.com/tldraw/tldraw/issues/2309 . Note that
this may produce visual changes for hexagons and other shapes.

![Kapture 2023-12-24 at 10 35
13](https://github.com/tldraw/tldraw/assets/23072548/773e89ee-f8c3-4875-b942-30860b1cdf22)

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Create a hexagon shape with a label.
2. The label should be correctly centered.

### Release Notes

- Fixed a bug with the bounds calculation for polygons.
2023-12-24 11:53:15 +00:00
chunderbolt e5232e3513
Fix README link typo (#2372)
Trademark link was mistyped. 

### Change Type

- [x] `documentation` — Changes to the documentation only
2023-12-22 13:28:53 +00:00
Mitja Bezenšek 79196e9f2b
Avoid importing `editor.css` twice (#2373)
This PR prevents importing `editor.css` twice. Looks like we currently
import all the css files for all the routes in the examples app. This
means that we were importing both `tldraw.css` (which includes
`editor.css`) as well as `editor.css` directly (this last one we
imported from `OnlyEditor.tsx`).

This caused all the classes to be defined twice and it made it harder to
debug things - you might have disabled the styles in one of the
definitions but you didn't see any changes because the other definitions
still applied.


![image](https://github.com/tldraw/tldraw/assets/2523721/8d84a145-bfc6-49c1-af44-7f456510b884)

I don't think importing `editor.css` is needed as we do import the full
`tldraw.css` anyway.


![image](https://github.com/tldraw/tldraw/assets/2523721/ccc22af5-1c3a-4ac4-b24e-ee3959c99d3c)


### 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

### Release Notes

- Prevent importing `editor.css` twice which should help when debugging
the styles via developer console.
2023-12-22 13:26:30 +00:00
Mitja Bezenšek fb0c16b448
Adding an image shape from a file the public folder (#2370)
Adds an example of adding an image shape from the public folder.

### Change Type

- [ ] `patch` — Bug fix
- [x] `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

### Release Notes

- Adds a simple image example.
2023-12-22 13:26:07 +00:00
Mitja Bezenšek fbf15e8846
VS Code bump 2.0.20 (#2371)
VS Code version bump.

### 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-12-21 09:46:32 +00:00
Steve Ruiz d16d1af3c8
Another typo fix. (#2366)
This PR fixes a typo in the readme.

### Change Type

- [x] `documentation` — Changes to the documentation only[^2]
2023-12-20 16:46:51 +00:00
Steve Ruiz a5105f24b3
Fix license language. (#2365)
Bleh

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package[^2]
2023-12-20 16:08:50 +00:00
huppy-bot[bot] b95089c5ea Update CHANGELOG.md [skip ci] 2023-12-20 15:27:34 +00:00
Steve Ruiz 70a2eeb576
bump to beta (#2364)
This PR bumps versions to beta-0

### Change Type

- [x] `major` — Breaking change
2023-12-20 15:14:17 +00:00
Taha 1c954db90e
add speech bubble example (#2362)
Adds an example for making a custom shape with handles

### Change Type

- [x] `documentation` — Changes to the documentation only[^2]

### Release Notes

- Add an example for making a custom shape with handles, this one is a
speech bubble with a movable tail.
2023-12-20 14:40:23 +00:00
Lu Wilson 6549ab70e2
Fix clicking off the context menu (#2355)
Fixes https://github.com/tldraw/tldraw/issues/2357

This PR fixes not being able to close the context menu by clicking
- your selected shape
- the ui

It seems like the Radix's `modal` setting causes trouble for us. I think
we're better off turning it off.
We now show an indicator on hovered shapes when the context menu. This
is consistent with how our other menus currently work.

![2023-12-19 at 14 19 14 - Cyan
Bovid](https://github.com/tldraw/tldraw/assets/15892272/88b492c2-8f3b-40bc-9dec-744fe72cda3b)

![2023-12-19 at 14 21 36 - Amaranth
Vulture](https://github.com/tldraw/tldraw/assets/15892272/1f19751d-499b-40c3-9b28-9f41a2f27ab2)

### 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

- Fix not being able to close the context menu by clicking on the UI or
your selected shape.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-12-20 14:39:34 +00:00
Taha 95e54e46d3
fix read only page menu (#2356)
This PR fixes pages in the pages menu being squished in read only rooms

### 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

- Add a brief release note for your PR here.

---------

Co-authored-by: Lu[ke] Wilson <l2wilson94@gmail.com>
2023-12-20 09:09:29 +00:00
MinhoPark 3ffcd1601d
refactor: Keep hook function convention the same (#2358)
I standardized the definition of the `useEditor hook` by changing it
from an `arrow function` to a `regular function`, in line with other
editor-related hooks.


### 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

[^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.

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

### Release Notes

- Add a brief release note for your PR here.
2023-12-20 09:06:20 +00:00
David Sheldrick f6e7793f49
focus on container before deleting to avoid losing focus (#2354)
Fixes #2353 

so it turns out

- when you click a button that becomes the active element
- when you disable a button which is the active element, the button
blurs and the active element becomes document.body

### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Prevents losing focus when clicking the trash button
2023-12-19 15:39:44 +00:00
Lu Wilson 4b4c258219
Stop shape text labels being hoverable when context menu is open (#2352)
Fixes https://github.com/tldraw/tldraw/issues/2351

This css change shouldn't affect any other interactions.

Tested on:
- Mac Chrome
- Mac Chrome with touch
- Mac Safari
- Mac Firefox

### 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. Right click to open context menu.
2. Click on a filled shape's text label.
3. Make sure the context menu has closed.

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

### Release Notes

- Add a brief release note for your PR here.
2023-12-19 14:26:10 +00:00
David Sheldrick 55f95bb666
Use custom font (#2343)
This PR adds our custom version of Shantell Sans. Not sure if we need to
keep the old file around for backwards compat?

### Change Type

- [x] `major` 

### Release Notes

- Add a brief release note for your PR here.

---------

Co-authored-by: huppy-bot[bot] <128400622+huppy-bot[bot]@users.noreply.github.com>
2023-12-19 14:17:45 +00:00
Mitja Bezenšek 2a026504fe
Only allow side resizing when we have some shapes that are not aspect ratio locked (#2347)
Only allow edges resizing on mobile when a single text shape is
selected. Disabled it for all other cases.

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

### 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


### Release Notes

- Don't allow edges resizing on mobile. The only exception is a single
text shape.
2023-12-19 13:45:19 +00:00
alex 39cb6bf49b
fix png images with pixel ratios <0.5 crashing the app (#2350)
When we handle pixel ratios in .png files, we were rounding the pixel
ratio to the nearest integer. This mean that if an image had a pixel
ration less than 0.5, it would get rounded to zero. This would cause a
divide-by-zero on the width & height of the image which would crash the
app.

This has a couple fixes:
- we ignore pixel ratios less that 1
- we perform rounding _after_ we apply the pixel ratio to the
width/height

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Upload this funky image:
![shapes_5](https://github.com/tldraw/tldraw/assets/1489520/80fb41fa-3be1-4dbd-8e2f-d81013b09780)
2. Check the app doesn't crash
2023-12-19 12:35:42 +00:00
Steve Ruiz b58274ced2
Drop edge scrolling adjustment for mobile (#2346)
This PR makes all edge scrolling distances 32px.

### Change Type

- [x] `patch` — Bug fix
2023-12-19 11:47:40 +00:00
Steve Ruiz 5f9ab64838
Fix iconleft padding (#2345)
This PR fixes the icon padding (or margin) for helper buttons like Back
to Content.

Before:
<img width="393" alt="image"
src="https://github.com/tldraw/tldraw/assets/23072548/c584901c-e826-433a-b76c-08f67a13807c">

After:
<img width="446" alt="image"
src="https://github.com/tldraw/tldraw/assets/23072548/ed9aeb3b-70df-43a0-9241-c329093c5cf5">


### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Fixes the icon padding in back to content / pen mode buttons.
2023-12-19 11:24:52 +00:00
zfedoran 80f8c98754
[bug] Fix for issue #2329 (#2330)
This PR fixes the issue outlined in issue #2329

### Change Type

- [x] `patch` — Bug fix


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

### Release Notes

- Fix for `Matrix2d.Scale` function
2023-12-19 10:41:23 +00:00