Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from tldraw:main #1

Open
wants to merge 2,404 commits into
base: main
Choose a base branch
from
Open

[pull] main from tldraw:main #1

wants to merge 2,404 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented Jul 3, 2022

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@netlify
Copy link

netlify bot commented Jul 3, 2022

Deploy Preview for rafids-tldraw failed.

Name Link
🔨 Latest commit 2e22167
🔍 Latest deploy log https://app.netlify.com/sites/rafids-tldraw/deploys/679cbe0f20cfbf000856b36a

mimecuvalo and others added 27 commits November 18, 2024 10:43
I noticed while looking into
https://linear.app/tldraw/issue/INT-468/issues-with-react-intl-wrapping-translations-into-spans-when-using
that we should just be using a richer Select menu option that allows for
content other than just strings.

This brings the radix-select library into use for our selects instead of
just the raw/native browser one.

<img width="263" alt="Screenshot 2024-11-14 at 12 24 00"
src="https://github.com/user-attachments/assets/391c477a-2af9-4cd7-8417-3b7b8d49834c">


### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
Describe what your pull request does. If you can, add GIFs or images
showing the before and after of your change.

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [x] `api`
- [ ] `other`

### Test plan

No test needed IMO

### Release notes

- Expose `ARROW_LABEL_FONT_SIZES`, `STROKE_SIZES`, `FONT_SIZES`
* Makes e2e test more stable.
* Brings the e2e (dotcom) workflow.
* Allows parallelization of tests by using multiple users and isolating
the tests in the db. It seems to work fine till around 4 workers, then
you might run into some postgres deadlocks.
* Improves [clerk usage in
tests](https://clerk.com/docs/testing/playwright/overview).
* Adds missing tests.
* Pulls in @Taha-Hassan-Git tests from
#4827
* Adds `@step('step name')` helper decorator that can be use in fixtures
to make the test output a bit less noisy.
* Adds `repeatTest` helper which allows you to run a single test
multiple times. It's a 1:1 replacement of `test` (so you can also use it
with `.only`) to make it easier to switch between the two.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Release notes

- Bring back dotcom e2e tests, make them more stable, and add a few more
of them.
Connect our request form with Hubspot.

Related to INT-402

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`

### Test plan

1. Create a shape...
2.

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

### Release notes

- Integrate with Hubspot.
Small clean up of the request form.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Release notes

- Small cleanup for the request form.
…are zoomed out (#4935)

When zoomed out we switched from using a shadow to using a border with
opacity. This caused significant perf drop of rendering the note shapes.

Fixes #4923

###  Before

![image](https://github.com/user-attachments/assets/e9084b9c-70ad-4206-931b-9d053c7e4a21)

### After 
![CleanShot 2024-11-18 at 10 50
46](https://github.com/user-attachments/assets/e4a34693-98c6-42ca-aa54-752b88a34ab3)

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Test plan

1. Create many note shapes
2. Zoom out past 35%
3. Pan around.
4. It should be much smoother than on main.

### Release notes

- Improve performance of rendering note shapes when zoomed out past 35%.

---------

Co-authored-by: Steve Ruiz <[email protected]>
Describe what your pull request does. If you can, add GIFs or images
showing the before and after of your change.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [x] `feature`
- [ ] `api`
- [ ] `other`

### Test plan

1. `yarn run dev`
2. Develop...
3. Check by importing the component somewhere in the example.(dev page.)

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

### Release notes
close #4927 


![image](https://github.com/user-attachments/assets/01b1a73f-d26b-456f-8617-e7236f028fe4)

```
<a href={url.toString()} style={{ color: 'blue', textDecoration: 'underline' }}>
	create a GitHub issue
</a>
```
Added blue underline style to links in error messages.
Currently, tldraw seems to be styling with CSS. If it's good, I'll add a
style for that function in css.
If so, more styles can be applied.
For ex...(There are concerns that writing this as style props may reduce
readability.)
```
a {
  color: #0000ee; 
  text-decoration: underline; 
  cursor: pointer; 
}

a:visited {
  color: #551a8b; 
}

a:hover {
  color: #0000cc; 
  text-decoration: underline; 
}

a:active {
  color: #ff0000; 
}
```

---------

Co-authored-by: Steve Ruiz <[email protected]>
### Change type

- [x] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`
PR updates the license references of different templates.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Test plan

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

### Release notes

- Update license references

Signed-off-by: Emmanuel Ferdman <[email protected]>
This pull request was initiated by Lokalise (user Mime) at 2024-11-19
13:21:00

---------

Co-authored-by: Mime Čuvalo <[email protected]>
Various improvements to ordering and labelling of examples in the docs
site, based on a conversation I had in the discord. Now, useful and
important examples are being surfaced more optimally in the docs site.

This PR makes a few changes:

- Changes the title of the code x-ray example
- Adds tags for the code x-ray example
- References the code x-ray example from the custom ui example
- Adds priority fields to some of the examples
- Adds a default priority of 5 when sorting examples

For the future we might consider a lint rule to ensure all examples have
tags and priority set.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Test plan

### Release notes

- Improved examples naming, tags and priority

---------

Co-authored-by: Steve Ruiz <[email protected]>
Improve the e2e test outputs.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Release notes

- Improve the e2e tests outputs.
This PR adds our jobs board to tldraw.dev.

### Change type

- [x] `other`
- the pg replicator only stores data for the users who are currently
active
- even then it only stores the users' ids, along with any guest file ids
they have access to.
- each user DO fetches their replica directly from postgres, and syncs
via messages from the pg replicator
- user DOs keep their replica in memory rather than sqlite, since they
are so small.

still need to debug and stress test this, but it should be a lot more
scalable than the current thing.

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`

### Test plan

1. Create a shape...
2.

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

### Release notes

- Fixed a bug with…
Apparently the [first call
](https://developers.cloudflare.com/durable-objects/reference/data-location/#provide-a-location-hint)
to `get` provides a location hint to where the DO should be located.
Pulled out a helper function for getting the replicator and made all
current uses go through that.

Looks like we created supabase databases in eu central, so west europe
for the DO seemed best. We could [use a
jurisdiction](https://developers.cloudflare.com/durable-objects/reference/data-location/#restrict-durable-objects-to-a-jurisdiction)
and make sure it's located in EU? (location hints are not a guarantee of
the location).

We have many users in US, it might be better to move the supabase
instances? OTOH having them in EU brings us closer to GDPR.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Release notes

- Pin 🙏  the postgres replicator close to the DB.
Looks like we used the same form for both buttons, now added the sign up
for the sign up button.

Fixes INT-489

### Change type

- [x] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Release notes

- Sign up button now opens the sign up form.
Not sure why I didn't think of this before 🤦‍♂️

Simplify how we run e2e tests. Instead of having to run zero cache on
our own, we now completely rely on playwright. The way it works is:
- playwright checks port 3000 to see if the server is already running.
if it is not it will run `yarn dev-app` from the root folder
- this starts the dev scripts inside `apps/dotcom`
- this will start zero cache and will wake up docker and postgress
- `yarn dev` for `apps/dotcom/client` now waits for docker to be healthy
before proceeding. this means that playwright will only get a valid
response on port 3000 when docker is up. it also means it will clean all
the background processes after it finishes and correctly report the
status.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Release notes

- Simplify botcom e2e logic.
The 'shared by default' and 'edit mode by default' settings got
clobbered during the backend refactor.

### Change type


- [x] `other`

---------

Co-authored-by: Mitja Bezenšek <[email protected]>
Improve the duplication of files by incrementing the file name. 

If the current file has no name (we are showing the time of creation) we
also don't set any name for the duplicate, which will make the duplicate
show the time of duplication as its name.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Release notes

- Improve the file duplication names.
Not sure why this started happening today, but clerk's useAuth started
emitting updates sometimes on certain window interactions like tab
switching and opening the share menu (??) even though the user session
hadn't changed, which caused our useUser hook to emit updates, which
caused our useSync to restart from scratch, which caused the editor to
disappear momentarily.

### Change type


- [x] `other`
Add published slug unique constraint.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Release notes

- Don't allow creating files with non unique published slugs.
Fixes an error when sigining out and renables the log out test.

### Change type

- [x] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Test plan

1. Sign in
2. Sing out
3. There should be no errors int he console.

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

### Release notes

- Fix an error with signing out.
- made brand name slightly heavier, added a tiny amount of letter
spacing, to make it look brand-y instead of label-y
- align buttons with each other
- align buttons with neighboring text
- fix spacing and alignment between mark and brand name

Before
<img width="624" alt="image"
src="https://github.com/user-attachments/assets/28e7b3ce-710b-455a-9f27-43628002b71e">

After
<img width="515" alt="image"
src="https://github.com/user-attachments/assets/246a8402-24b6-4c37-b030-6cb5d8519093">




### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
Show different time formats for files from different periods.

![CleanShot 2024-11-20 at 17 49
26](https://github.com/user-attachments/assets/708951c2-f2f0-4425-b994-0d7d3b13eeb4)

Feels like we have too many sections in the sidebar, should we pair them
down?

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Release notes

- Fixed a bug with…
30s might not be enough for all cases (CI booting up from scratch).

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Release notes

- Increase how long we can wait for postgress to boot up.
cc @MitjaBezensek not ideal (i don't like the `!important`s but i'll fix
up some more later)

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
mimecuvalo and others added 30 commits January 28, 2025 10:28
This reverts commit 4e8dbf1.

@steveruizok you mighta missed my comment on your PR:
> I was gonna approve but actually, before you land, I'd like to leave
this PR open so that I can better test this Sentry improvements:
#5221
> I was looking at the events, and I think it's when people are
"fighting" over a shape but it's a guess that I'd like to confirm with
more context.

So, before we suppress this error, I want to see if I can find out more
with the extra context/tooling that was recently added.


### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
This is called when cropping and allows you to override the crop
calculations. This is useful for instance to set a min width and/or
height for the cropping.

It can also be used to provide a completely different cropping
mechanism, e.g. to keep the size of the shape fixed and instead resize
the image when cropping. This would require overriding the
SelectionForeground component, but it's better to only have to override
that than the whole selection tool. And maybe that component can be made
more dynamic in the future.

This also defines specific crop interfaces instead of using the ones
from the image shape and uses the correct util instead of the image util
when cropping. Any shape can define that it supports cropping, so I
don't think it should be tied to the image shape.

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [x] `api`
- [ ] `other`

### Test plan

1. Add an onCrop handler to a util for a shape that can be cropped.
1. Create a shape with a crop prop.
2. Try to crop the shape and see that the behavior in onCrop is applied.

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

### Release notes

- Add support for an onCrop handler on shape utils that allows you to
prevent or modify the crop.
- The `TLImageShapeCrop` type has been replaced by `TLShapeCrop`.

---------

Co-authored-by: Mime Čuvalo <[email protected]>
Looks like we didn't gracefully handle the cases where the embed util is
not present.

### Change type

- [x] `bugfix`

### Release notes

- Fix an issue with embeds logic not gracefully handling cases when we
don't have an embed util.

### API changes
Adds `editor.hasShapeUtil` that returns whether a shape util for a
specific shape type is registered with the editor.

Co-authored-by: Mime Čuvalo <[email protected]>
This PR adds an option to resize sticky notes. There are a few ways that
sticky notes _could_ resize however these are all a bit more complicated
and would take time to unpick This PR only adds "scale" resizing while
leaving some doors open for other options in the future.

This PR also:
- fixes a bug with `getNoteForPit`
- changes the zIndex of handles to be in front of selection foreground

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [x] `api`
- [ ] `other`

### Test plan

1. Visit the "resize note shape" example
2. Resize a note shape

- [x] Unit tests

### Release notes

- Added `options.noteShapeResizeMode` editor option to control how note
shapes resize.
This fixes an issue where the more you cropped an image, the lower scale
the image would be resolved to. However, when cropping the image is
still rendered at the same size, it just shows only a part of the image.
Therefore use the uncropped size when resolving the asset instead, so it
keeps the correct scale.

Fixes #5299

### Change type

- [x] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Test plan

1. Have an asset store that scales assets
2. Create an image shape
3. Crop the image
4. Observe that the more you crop the image, the lower scale it gets

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

### Release notes

- Fixed a bug where a cropped image would use lower scaled assets the
more it was cropped.
Radix complains if we mount a dialog without a title, which we were
doing by returning `null` while the data for this dialog loaded. Now we
load the async part of the data before creating the dialog and pass it
in.

### Change type

- [x] `other`
Seems like this was broken a couple of weeks ago.

### Change type

- [x] `bugfix`

### Release notes

- Fixed a bug with handling native paste events for plain text
seems like we didn't add our image worker to the content security policy
so exporting PNGs is breaking? not 100% sure this will fix until it
lands in staging

### Change type

- [x] `other`
we were getting a lot of these errors in sentry
https://tldraw.sentry.io/issues/6152025342/?environment=production&environment=production-tldraw-multiplayer&project=4503966963662848&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&statsPeriod=14d&stream_index=1
which seemed to mostly the registerUser failing ?

But I couldn't figure out why, so I fixed the error reporting for that
method, and added a bunch of debugs to add breadcrumb context on sentry.
 
At the same time, I added a bunch of extra fail-safes to restart things
if the user durable objects are failing to connect to the replicator.
hopefully that will mitigate whatever is going on. this was causing the
durable object's in-memory cache to get stale and make it look like the
db writes were failing when in fact they were not.

### Change type

- [x] `other`
Fix an issue with file uploads not working on preview builds (when
logged in).

### Change type

- [x] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Release notes

- Fix an issue with file uploads not working on preview builds.
accidentally introduced a couple of minor bugs by nullifying the cache,
so in this PR i make it so that the interval just starts and stops
rather than completely getting rid of the cache.

### Change type

- [x] `bugfix`
We were blocking this with a preventDefault

### Change type

- [x] `other`
This fixes an issue where line shapes would wobble if you dragged points
in a way that changes the shape's overall size after moving the first
point away from the shape's origin point.

![2025-01-24 09 51
21](https://github.com/user-attachments/assets/1509bc85-3e8e-41ad-98c5-2d8e4391b865)

This re-introduces part of this fix from #1915
Add `/new` route for quickly creating files.

### Change type
- [x] `improvement`

### Release notes

- Add `/new` route for quickly creating a new file.
Fixed bug where texts that used non default font style where getting
wrong svg conversion. The SVG text calculated didn't take into account
the real text dimensions, resulting in weird line breaks and wrong
positioning in certain cases

Describe what your pull request does. If you can, add GIFs or images
showing the before and after of your change.

### Change type

- [x] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Release notes

- Fixed a bug with…
Describe what your pull request does. If you can, add GIFs or images
showing the before and after of your change.

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`

### Test plan

1. Create a shape...
2.

- [ ] Unit tests
- [ ] End to end tests
This will emit an event from Editor when dispatch is called that can be
used to handle events before they are handled by tldraw.

The specific thing we need this for is to update camera options on wheel
and pointer events before tldraw handles them in order to have a
different wheelBehavior based on if you are using a mouse or a touchpad
(which is determined from a heuristic based on the wheel and pointer
events).

Describe what your pull request does. If you can, add GIFs or images
showing the before and after of your change.

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [x] `api`
- [ ] `other`

### Release notes

- Emit a `before-event` from Editor for events before they are handled
by tldraw.
Currently, if you want to e.g. augment but not override one of our
default content handlers (e.g. to add audio file support to pasting),
you have to copy-paste the entirety of that handler into your app. This
kind of sucks. Now, you can call our default handlers yourself, so you
can augment how they work without having to completely re-implement
them.

For reviewers: it's easiest to read this diff with [whitespace changed
hidden](https://github.com/tldraw/tldraw/pull/5298/files?diff=split&w=1#diff-51f3e244dba5247299a2153f96348efdca84e0e8fb8fe27cff4443dd9d8d4161)

### Change type

- [x] `api`

### Release notes

- You can now import each of our external asset/content handlers, so you
can augment them without having to copy-paste them into your app

#### BREAKING
- `TLExternalAssetContent` has been renamed to `TLExternalAsset`
This diff adds support for react 19. React 19 is backwards compatible
with react 18, excluding the removal of some deprecated APIs. React 18.3
(which we already use) warns when these APIs are used.

"adding support" here involves two things:
1. upgrading our depenencies to ones that specify react 19 in their peer
deps array. I just upgraded everything that had a non-breaking upgrade
to go to.
2. adding react 19 to our own list of peer dependencies

We want to make sure that we can still be used with react 18, so we're
not upgrading to react 19 internally because we don't want to make use
of any of the new APIs that aren't 18-compatible.

I've made the decision here not to do anything like running tests
against both react versions. I think that this would be more effort to
set up (and have more on-going cost on CI times etc) than it would be
worth, and I trust react's guarantees about react 19's backwards
compatibility and the warnings in 18.3.

### Change type

- [x] `improvement`

### Release notes

- tldraw now supports react 19

---------

Co-authored-by: Mime Čuvalo <[email protected]>
Co-authored-by: huppy-bot[bot] <128400622+huppy-bot[bot]@users.noreply.github.com>
The logged out menu was missing editor preferences (grid mode,...) so
now we show the same options as for the logged in experience.

### Change type

- [x] `improvement`

### Release notes

- Show the same page menu for logged in and for logged out users.
🤷‍♂️ 

### Change type

- [x] `bugfix`

### Release notes

- Removes the border around the guest badge for Safari.
Instead of a full-blown banner, I just added an item in the menu, and a
little dot to entice people to click. this is a common pattern when apps
add new stuff and I think it works pretty well here, especially since
the goal is just to make sure the backend can handle the scale before we
go full switchover.

![Kapture 2025-01-30 at 11 23
56](https://github.com/user-attachments/assets/507ee977-8e8d-4231-8df8-bfc34fee8017)

### Change type

- [x] `other`
This was feeling super rough. On android it was downright abysmal.
Better to just immediately open the new file and let them rename it as
and when.

### Change type

- [x] `other`
Clerk's API for this is that combined sign in/up mode is enabled when a
`signInUrl` is provided but a `signUpUrl` isn't. They sort of seem to
have an assumption that there's a page somewhere that does sign in,
which we sort of don't have (its not in the app because we use modals)
but sort of do (clerk creates one automatically at
https://accounts.tldraw.com/sign-in).

This diff specifies the `signInUrl` (enabling combined sign in/up mode)
and creates a placeholder sign in page at that path (just in case
someone somehow gets sent to it, although I'm not sure how/why this
would happen).

Clerk likes react-router to be searching for a wildcard under
`/sign-in`. We don't have wildcard support in our routing stuff at the
moment, but I don't think we'd need to construct those URLs ourself
anyway, so I've just dynamically configured the route for now.

### Change type
- [x] `other`
### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
I guess we had to upgrade the `@types/vscode` to`^1.96.0` to get it
working with react 19?

Updated the engine as well. This means that users will only get the
update if they are using vs code with that engine or higher. I guess
people update their editors so they should be using close to the latest
one.

### Change type

- [x] `bugfix`

### Release notes

- Fix packaging of the vs code extension.
We had a bug where if the room snapshots were bigger than 1mb,
duplicating and publishing would fail.

### Change type

- [x] `bugfix`
Pinned files always took precedence in the recent user's files. This
meant that after returning to the app you'd always land on a pinned
file.

### Change type

- [x] `bugfix`

### Test plan

1. Pin a file
2. Switch to a different file and make some edits to it (seems like our
recent files takes last edit time as the preferred way of determining
the order).
3. Go to the root route.
4. You should land on the correct file.

### Release notes

- Fix an issue with pinned files always taking precedence when returning
to the app.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.