Commit graph

2843 commits

Author SHA1 Message Date
Dan Groshev
86519d60cd
unbork "unbork publish-new" (#3003)
Bring back the template publishing stuff, now with a problem fixed
https://github.com/tldraw/tldraw/pull/2999

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package
2024-02-29 14:42:17 +00:00
David Sheldrick
5220f5c49d better name for publish-new 2024-02-29 14:10:28 +00:00
David Sheldrick
12935a5922 remove dry run early return 2024-02-29 14:09:42 +00:00
David Sheldrick
bd03f5b7dd better error message in publish-new.yml 2024-02-29 13:55:54 +00:00
David Sheldrick
e796119098 fix error logging in publish-now.yml 2024-02-29 13:49:30 +00:00
David Sheldrick
08c96b0df7 fix bash thing 2024-02-29 13:32:28 +00:00
Taha
5db4e9a491
Adding a single E2E test per menu (#2954)
A basic test for each of the menu areas

fixes TLD-2251

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

### Release Notes

- Add a brief release note for your PR here.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-02-29 13:21:10 +00:00
David Sheldrick
c0d849e8b5
unbork publish-new (#2999)
@si14 this template publish thing was failing, i think you referenced
the workflow incorrectly, I'm just gonna comment out for now, take a
look when you have time

https://github.com/tldraw/tldraw/actions/runs/8096363547

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

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

### Release Notes

- Add a brief release note for your PR here.
2024-02-29 13:05:02 +00:00
Dan Groshev
849d8aca9b
remove yarn stuff from the templates and ignore it (#2997)
We accidentally checked in yarn cache in the template folders. We shall
not do that.

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package[^2]
2024-02-29 12:32:16 +00:00
David Sheldrick
6d4b46e6d6
Implement new package publish process (#2996)
Gonna merge in a sneaky dry run mode to test the args parsing etc
### 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.

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

### Release Notes

- Add a brief release note for your PR here.
2024-02-29 12:21:11 +00:00
Mime Čuvalo
83423cd6d7
textfields: make them consistent (#2984)
as i look into textfields the places where we are using them are
out-of-sync at the moment. this brings them in line with each other for
further refactoring later.

### Change Type

- [x] `patch` — Bug fix
2024-02-29 12:15:57 +00:00
Steve Ruiz
4f07e696e8
[feature] wrap mode (#2938)
By default, tldraw's brushing mode will select when the box intersects
an shape's geometry. A user can hold Command / Ctrl to require that the
selection box fully contain a shape's bounds instead.

Some people really prefer the opposite. Three years! Three years I've
been saying "no no no".

This PR adds a user preference to flip the logic. When `isWrapMode` is
true, selection requires that the box completely contain a shape before
it's added to the list of selecting shapes; and ctrl flips back to
intersection instead.

### Change Type

- [x] `minor` — New feature

### Test Plan

1. Turn on wrap mode in the user preferences menu.
2. Select stuff.
3. Use the ctrl key to except the behavior back to intersection.

- [x] Unit Tests

### Release Notes

- Added `isWrapMode` to user preferences.
- Added Wrap Mode toggle to user preferences menu.
2024-02-29 11:45:02 +00:00
Mitja Bezenšek
adc53afbe3
Don't allow edge scrolling when camera is frozen. (#2992)
Don't allow edge scrolling when camera is frozen.

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

### Testing
It's a bit hard to test this, you actually need to change the code a
bit.
1. Add an `onMount` handler to the `Tldraw` component in `develop.tsx`
2. In the `onMount` handler add:
`editor.updateInstanceState({canMoveCamera: false})` to freeze the
camera.
3. Make sure edge scrolling is turned on in the preferences.
4. Use brush selections / resizing / translating close to the edges.
5. The camera should not move.

### Release Notes

- Don't allow edge scrolling when camera is frozen.
2024-02-29 11:27:16 +00:00
Dan Groshev
cc1e5196dd
Use github actions to mirror templates from monorepo to appropriate repos (#2781)
The idea here is to mirror project templates from our monorepo to the
corresponding "top level" repos in our organisation. The main benefits
are:

- being able to easily synchronise template versions to the last release
on release
- being able to test those templates together with the rest of the
project
- being able to deploy the unreleased version of the templates 

However, this PR will only do the synchronisation part. The main
roadblock for the latter at the moment is running `yarn install` on
packages in the current `main` that are still unreleased. There are ways
around that, but this PR is deliberately minimalistic to land it sooner.

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package

---------

Co-authored-by: Taha <98838967+Taha-Hassan-Git@users.noreply.github.com>
2024-02-29 10:48:31 +00:00
David Sheldrick
a4033f7a61
Setup papercuts (#2987)
I'm bringing the sockets example up to date and ran into some issues
that were tricky to resolve in userland but trivial to resolve in
packageland.

Gonna collect them here.  

### 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-02-29 10:40:28 +00:00
Lu Wilson
8df5a22ad9
Add external dialog example (#2887)
This PR adds an example that shows you how to make your dialogs pop
outside of the Tldraw component and go fullscreen.

Closes TLD-2191

### Change Type

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

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

### Test Plan

1. Try out the "External dialog" example.
2. Open the keyboard shortcuts dialog (or any dialog).
3. The dialog should be centered in the browser window, not just the
tldraw component.

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

### Release Notes

- Dev: Added an example for dialogs that go outside the component.
2024-02-29 09:44:19 +00:00
Mime Čuvalo
42865a5b70
husky: add +x chmod flag (#2986)
### Change Type

- [x] `patch` — Bug fix
2024-02-28 16:33:04 +00:00
Taha
a62932d4ed
fix document name overlapping people menu (#2970)
When the people menu grew too large it would [overlap the document
name](https://github.com/orgs/tldraw/projects/38/views/1?pane=issue&itemId=54609134)

This PR checks if the right layout panel has grown beyond the style
panel width (plus the width of the button) and includes the button width
in the calculation if so.



- [x] `patch` — Bug fix

### Release Notes

- Fix people menu overlapping with document name when it grew too large.
2024-02-28 16:27:56 +00:00
alex
9f82e27214
speech bubble handle -> tail (#2975)
Handle's days are numbered, and in the line shape we've moved away from
storing `TLHandle` directly. This diff updates the speech bubble shape
to rename the 'handle' prop to 'tail' and make it just be the
coordinates. The handle props are derived at runtime.

### Change Type

- [x] `documentation` — Changes to the documentation only[^2]
2024-02-28 11:32:42 +00:00
David Sheldrick
22af179983
Make exportToBlob public (#2983)
Solves #2939

Also converts to named arguments to make it easier to add arguments in
the future. We should be doing this everywhere from now on.

### Change Type


- [x] `minor` — New feature


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

### Release Notes

- Exposes the exportToBlob function for library users
2024-02-28 11:26:30 +00:00
Mime Čuvalo
b1e168b207
tooling: notify team members if package.json/yarn has been updated (#2972)
This is a team tooling thing to let each other know if `yarn` needs to
be run upon checkout of a branch.

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package[^2]
2024-02-28 10:50:48 +00:00
Mime Čuvalo
98be39d6f8
license: make them not be scrubbed out in code munging (#2976)
Add the `/*!` to prevent stripping in compilation, also make the MIT
part explicit.

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package[^2]
2024-02-28 10:45:49 +00:00
alex
82f2c97816
Open iframe production links in new tab (#2966)
cuz otherwise they don't work

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package[^2]
2024-02-27 19:08:28 +00:00
Steve Ruiz
1a68857174
migrate shapes / assets as a store on putContent (#2971)
This PR updates the `putContentOntoCurrentPage` so that it migrates
shapes / records as a complete store.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Copy and paste, ideally between versions.
2024-02-27 16:35:01 +00:00
Taha
e6513215b5
export default ui items (#2973)
This PR exports all the components within each of the default menu
content components. Should make it easier to customise the default UI.


- [x] `minor` — New feature


### Release Notes

- Components within default menu content components are now exported.
2024-02-27 15:36:35 +00:00
David Sheldrick
4639436aad
Show toast on upload error (#2959)
A little toast for when image uploads fail. Solves #2944

![Kapture 2024-02-27 at 09 27
12](https://github.com/tldraw/tldraw/assets/1242537/9e285622-8015-41fa-bc3d-92dccfaa7ba9)

### Change Type

- [x] `patch` — Bug fix


### Release Notes

- Adds a quick toast to show when image uploads fail.
2024-02-27 14:14:42 +00:00
Mime Čuvalo
2a8ae6188e
menu: export followup with different semantics for file menu (#2968)
Renamed Object → Shape
Different semantics for Export under file menu. Thanks @TodePond !

### Change Type

- [x] `patch` — Bug fix
2024-02-27 12:48:20 +00:00
David Sheldrick
98850eb043
Fix transparency toggle (#2964)
We recently changed the export checkbox ` Export Background` to `
Transparent` which are logically opposite, but we didn't flip the
`checked` state of the checkbox so it was exporting the background when
`Transparent` was checked!

Fixes #2941 

### Change Type

- [x] `patch` — Bug fix

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

### Release Notes

- Fixes the Transparent toggle. The condition was accidentally flipped.
2024-02-27 10:02:07 +00:00
Steve Ruiz
d88ce929eb
[fix] double spinner (#2963)
Fixes a double spinner in the loading component.

### Change Type

- [x] `patch` — Bug fix
2024-02-27 09:30:02 +00:00
Steve Ruiz
2a6576a2dc
[docs] Fix mailtos (#2961)
This PR fixes some mailtos.

### Change Type

- [x] `documentation` — Changes to the documentation only[^2]
2024-02-27 08:27:22 +00:00
Steve Ruiz
6d417577be
Prevent iframe embedding for dotcom (except on tldraw.com) (#2947)
This PR fixes a check on whether the dot com multiplayer editor has been
loaded in an iframe.

It tries to keep it working on tldraw.com itself.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Load me in an iframe
2024-02-26 18:30:55 +00:00
Steve Ruiz
4c1425076e
[docs] content (#2958)
This PR refreshes the docs content (the API json files will change after
the API extractor bump).

### Change Type

- [x] `documentation` — Changes to the documentation only[^2]
2024-02-26 16:50:38 +00:00
David Sheldrick
cf1c71fcd1
[examples] Log out the 'after' values of changes in StoreEventsExample (#2956)
The log statements in this were confusing me when I was inspecting style
changes the other day because when you changed some value from A
(before) to B (after) it only logged out the A value. I tried
experimenting with logging both A and B but it didn't feel necessary,
switching to only B feels fine.

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package[^2]
2024-02-26 15:42:50 +00:00
Mime Čuvalo
fb852459db
menu: rework File menu / ensure Export menu is present (#2783)
<img width="428" alt="Screenshot 2024-02-16 at 16 46 28"
src="https://github.com/tldraw/tldraw/assets/469604/334cd0db-d9d5-4993-8012-c6985173edfb">


- re-orders to be the normative New / Open / Save order — we shouldn't
be messing with this conventional ordering
- removes the "Don't ask again" from New/Open dialogs because they're
non-undoable and not what _anybody_ should ever select. we shouldn't
offer users a loaded footgun! :P
- makes File menu be part of the default menu — it's presence is
glaringly missing for regular development
- along with that, make the pieces of that menu available as lego pieces
to use - it can't just be `DefaultMainMenuContent`, all or nothing,
forcing downstream users to import everything from scratch
- finally, adds the Export menu as initially intended by this PR!

@steveruizok let's discuss if you have some notes on this and we can
talk about the shape of things here.

### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Composable UI: makes File items be more granularly accessible / usable
- Menu: show Export under the File menu.
2024-02-26 15:01:56 +00:00
David Sheldrick
f19b12c42e
[dx] Derive vercel routes from react-router config (#2937)
I had some free time at the end of the week so I investigated the idea
of deriving the vercel routing config from the react-router config, then
storing the derived vercel route info in a jest snapshot, and then
loading the jest snapshot during the build script.

Seems to work well!



### Change Type

- [x] `internal` — Any other changes that don't affect the published
package[^2]
2024-02-26 12:30:35 +00:00
Mime Čuvalo
8499af6945
ui events: prevent sending 2nd event unnecessarily (#2921)
Noticed that we were sending two events (one for pointerDown, and one
for pointerUp). The click event handler adds this same check to prevent
this, so this adds it in the pointerUp event as well.

### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Some cleanup on duplicate UI events being sent.
2024-02-26 10:08:27 +00:00
David Sheldrick
f3eae3c398
Update auto (#2952)
Auto merged this PR https://github.com/intuit/auto/pull/2420/files

So we can get rid of our patch file

### Change Type

- [x] `internal`
2024-02-26 10:06:23 +00:00
Steve Ruiz
1f3f5f7c4f
[fix] fit to content shown on groups (#2946)
This PR fixes a bug where "fit to content" would be shown on groups.

### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Fix bug where "fit frame to content" would be shown when a group is
selected.
2024-02-25 13:32:59 +00:00
Steve Ruiz
2211ca0063
bump typescript / api-extractor (#2949)
This PR bumps TypeScript to 5.3.3 and API extractor. We started getting
some weird behavior in CI due to different versions of the two
libraries, ie where the CI api.jsons would differ from those built
locally.

### Change Type

- [x] `dependencies` — Changes to package dependencies[^1]
2024-02-25 11:43:17 +00:00
Steve Ruiz
ad902be5e6
Expand props (#2948)
This PR expands the tldraw / tldraweditor component props.

### Change Type

- [x] `patch` — Bug fix
2024-02-25 11:16:10 +00:00
Steve Ruiz
b2cb0d27b0
fix structured clone reference in drawing (#2945)
This PR fixes a rogue structuredClone reference in the drawing state.

### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Fixes a reference to structuredClone that caused a crash on older
browsers.
2024-02-24 20:02:17 +00:00
Steve Ruiz
0f1599d5b3
[fix] Corejs imports (#2940)
This PR fixes a bug with corejs imports. See
https://github.com/tldraw/tldraw/issues/1947

### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Fixes a bug effecting some users related to corejs imports.
2024-02-23 17:36:27 +00:00
Lu Wilson
7a09581081
Add example for external UI (#2846)
This PR adds an example for how to add external UI components.

It's something that I've been asked for help with in the past, and it's
something I wish more consumers would do when using tldraw inline - it
would help the editor feel less cramped. Therefore, I'd like to have it
is as an example we can point people to.

![2024-02-19 at 11 53 18 - Maroon
Boar](https://github.com/tldraw/tldraw/assets/15892272/f043bb77-3181-4a7d-b736-2b6a5012e208)

> Some other context:
> We've talked about giving this sorta thing more first-class support in
the future, eg: with a `useEditorInstance` hook or something.

Closes TLD-2128

### Change Type

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

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

### Test Plan

1. Try out the External UI example.
2. Make sure you can change tool by pressing the toolbar buttons.
3. Make sure you can change tool by pressing keys (eg: d, e)

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

### Release Notes

- Docs: Added external UI example.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-02-23 16:07:08 +00:00
Taha
d731951fcf
Remove template references (#2919)
Removes references to the vite template

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

- changes the doc site so it no longer references the site template
2024-02-23 15:37:59 +00:00
Steve Ruiz
37bd92ef60
Fix keyboard shortcuts bugs (#2936)
This PR moves the focus 

### Change Type

- [x] `minor` 

### Test Plan

1. Select an element.
2. Press the delete quick action menu button.
3. Undo the delete with a keyboard shortcut.

1. Create a geo shape
2. Use the style panel to change the geo type
3. Undo so that it deletes
4. Try to redo

### Release Notes

- [Fix] Keyboard shortcut focus bug

---------

Co-authored-by: David Sheldrick <d.j.sheldrick@gmail.com>
2024-02-23 15:35:13 +00:00
Taha
fcf97958e8
E2E Style Panel Tests (#2878)
This PR adds E2E tests for the style panel.

It checks that: 
- the style panel opens and closes as expected on mobile
- the style panel button is disabled for the eraser tool on mobile
- selecting a style hints the button
- changing a style changes the appearance of the shape
- It also moves a test from the toolbar tests that checks the correct
styles are exposed for the right tools


fixes tld-2222

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


### Release Notes

- Add style panel E2E tests

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-02-23 14:37:15 +00:00
David Sheldrick
046ebc4ac0
Fix undo/redo for Opacity Slider + Style dropdowns. (#2933)
Closes #2664 and #2929 

### Change Type

- [x] `patch` — Bug fix

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

- Fixed issues where undo/redo entries were not being set up correctly
for the opacity slider or the style dropdown menus.
2024-02-23 14:25:36 +00:00
Steve Ruiz
521d84a611
Add custom static assets example, extract preloadFont (#2932)
This PR adds a custom static assets example.

It also:
- extracts preloadFont into a async function to make custom preloading
easier
- accounts for file-based formats

### Change Type

- [x] `minor` — New feature

### Test Plan

1. Test the example.

### Release Notes

- Docs, added custom static assets example.
2024-02-23 13:58:06 +00:00
Mitja Bezenšek
303c8782e3
Fix an issue with publishing canary (#2931)
Our canary builds are broken right now, see
https://github.com/tldraw/tldraw/actions/runs/8018554530/job/21904677162#step:4:13

Looks like `auto@11.0.5` solves this
https://github.com/intuit/auto/issues/2425

### 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
2024-02-23 12:27:37 +00:00
Mitja Bezenšek
217a1d073f
Fix frames not preserving shape order (#2928)
It looks like enclosing shapes with a new frame did not preserve the
order of the shapes. Also makes framing inside of frames work.

Solves https://github.com/tldraw/tldraw/issues/2892

Before:


https://github.com/tldraw/tldraw/assets/2523721/90da4fc0-92a1-49fe-b658-73842c4ef4c2


After:


https://github.com/tldraw/tldraw/assets/2523721/0558d22e-8216-4d84-8a89-7dd049c37974

### 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 few shapes.
2. Make sure to change some of their order (example in the gif puts the
last created shape to the back)
3. Create a new frame that encloses these shapes.
4. The order of the shapes should be preseved.

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

### Release Notes

- Fix an issue when framing shapes did not preserve the original order
of the shapes.
2024-02-23 11:25:13 +00:00