Commit graph

1962 commits

Author SHA1 Message Date
Lu Wilson
004787d5bd
[docs] Add feedback when you search (#1633)
This PR adds some immediate feedback when you search on the docs site —
so that you know that your query has been submitted. This is most
noticeable on slower internet connections. But even on fast connections,
search feels a bit untrustworthy because you don't get that immediate
feedback.

We could make a little loading spinner or something. But for now, I just
disabled the search input when you submit it, because it didn't require
any design work!

## Before

No way of telling that the search results are loading. No immediate
feedback:

![2023-06-22 at 12 17 34 - Fuchsia
Fowl](https://github.com/tldraw/tldraw/assets/15892272/da3b3d7f-fc6a-49f9-9352-58949ca917d5)

## After
![2023-06-22 at 13 09 26 - Turquoise
Cat](https://github.com/tldraw/tldraw/assets/15892272/9e44061a-c4b9-43d2-8b8f-e1c4dce60c48)


## Admin

### 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. Throttle your network tab!
2. Search for something on the docs site (eg: Editor)
3. The search input should get disabled when you press the Enter key.

### Release Notes

- Documentation: Added some immediate feedback when you search.
2023-06-23 09:57:57 +00:00
Lu Wilson
c5fe399842
[docs] Separate some pages out of the Docs section (#1626)
This PR changes the structure of the docs site's sidebar.


![image](https://github.com/tldraw/tldraw/assets/15892272/ffe1e152-c921-43f0-9ba2-d084bda5e1e3)

I think this signposts more clearly what the different pages are for.
And it also paves the way for some work I want to do on
expanding+refining the Editor docs.

This PR also simplifies URL for all sidebar links.
It's a bit scrappy, but I think it feels simple enough to work with, and
easy-enough to change in the future.
> But hey! I've been doing this a couple times recently. Maybe we should
refactor? Or maybe we should keep going with what we've got and focus on
getting these docs *done*.

### 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. Check that all the sidebar links go to where you expect.
2. Check that old URLs redirect to the right pages, eg: `/docs/usage`
should go to the usage page.


### Release Notes

- Documentation: Restructured the sidebar for clarity.
2023-06-23 09:53:22 +00:00
Lu Wilson
d2c51ae3ba
[docs] Fix wrong cursor when hovering buttons (#1630)
This PR fixes your cursor when you hover some buttons in the docs site.

This makes them consistent with all other buttons.


![image](https://github.com/tldraw/tldraw/assets/15892272/d918e12e-2831-49fe-acf7-34c67a9cd976)

### 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. On the docs site, hover your cursor over the light/dark button.
2. Make sure that your cursor is a pointing finger.


### Release Notes

- Documentation: Fixed the wrong cursor showing when hovering some
buttons.
2023-06-23 09:51:42 +00:00
Lu Wilson
db68473db9
[docs] Tighten up wording & structure of Usage page (#1624)
This PR tightens up the wording of the Usage docs page, and it
restructures it slightly.

See my comments in the code for more info.

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

### Release Notes

- Documentation: Impoved clarity of wording and structure of the Usage
page.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-20 15:42:51 +00:00
Steve Ruiz
83184aaf43
[fix] react component runaways, error boundaries (#1625)
This PR fixes a few components that were updating too often. It changes
the format of our error boundaries in order to avoid re-rendering them
as changed props.

### Change Type

- [x] `major` — Breaking change
2023-06-20 14:06:28 +00:00
Steve Ruiz
5cb08711c1
Incorporate signia as @tldraw/state (#1620)
It tried to get out but we're dragging it back in. 

This PR brings [signia](https://github.com/tldraw/signia) back into
tldraw as @tldraw/state.

### Change Type

- [x] major

---------

Co-authored-by: David Sheldrick <d.j.sheldrick@gmail.com>
2023-06-20 13:31:26 +00:00
Steve Ruiz
a4b5bcb8f7
3/2 Cursor chat (#1623)
This PR tweaks the cursor chat support.

### Change Type

- [x] `patch` — Bug fix
2023-06-20 12:08:49 +00:00
Lu Wilson
655d3b39ee
[docs] Tighten up Editor page introduction (#1622)
This PR improves the wording in the Editor docs page.
It only touches the intro section.

See the comments for more details!



I'm also looking at the page in entirety - will cover that in another
PR.

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

### Release Notes

- Documentation: Simplified the Editor page.
2023-06-20 10:53:26 +00:00
Lu Wilson
8d28d16943
[docs] Tighten up Introduction page (#1621)
This PR contains some feedback for the Introduction page of the docs.
I've written comments explaining my feedback, and the changes are some
potential changes (but they're just examples).

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

### Release Notes

- Documentation: Simplified the Introduction page.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-20 09:12:20 +00:00
Lu Wilson
9db28f2fdb
Lokalise: Translations update (#1618)
### Release Notes

- Added more translations for Simplified Chinese.
2023-06-19 19:01:41 +00:00
Lu Wilson
8329b1da89
[docs] Simplify paths for uncategorised pages (#1619)
This PR changes the paths that we use for uncategorised pages on the
docs site.
It also redirects the old paths to the new ones.

```
// BEFORE
tldraw.dev/docs/ucg/shapes

// AFTER
tldraw.dev/docs/shapes
```

I think that this is more intuitive, and will make the links that we
share a bit clearer.
eg: As a by-product, it fixes some broken links from the introduction
page.

As a trade-off, this PR makes our pathing system a bit more complicated.
But I don't think it's tooooo bad? WDYT?

### 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. Navigate to `/docs/shapes` on the docs site.
2. Make sure that it goes to the Shapes page.
3. Do the same for `/docs/ucg/shapes`


### Release Notes

- Documentation: Cleaned up some paths.
2023-06-19 18:48:55 +00:00
Steve Ruiz
57bb341593
ShapeUtil refactor, Editor cleanup (#1611)
This PR improves the ergonomics of `ShapeUtil` classes.

### Cached methods

First, I've remove the cached methods (such as `bounds`) from the
`ShapeUtil` class and lifted this to the `Editor` class.

Previously, calling `ShapeUtil.getBounds` would return the un-cached
bounds of a shape, while calling `ShapeUtil.bounds` would return the
cached bounds of a shape. We also had `Editor.getBounds`, which would
call `ShapeUtil.bounds`. It was confusing. The cached methods like
`outline` were also marked with "please don't override", which suggested
the architecture was just wrong.

The only weirdness from this is that utils sometimes reach out to the
editor for cached versions of data rather than calling their own cached
methods. It's still an easier story to tell than what we had before.

### More defaults

We now have three and only three `abstract` methods for a `ShapeUtil`:
- `getDefaultProps` (renamed from `defaultProps`)
- `getBounds`,
- `component`
-  `indicator`

Previously, we also had `getCenter` as an abstract method, though this
was usually just the middle of the bounds anyway.

### Editing bounds

This PR removes the concept of editingBounds. The viewport will no
longer animate to editing shapes.

### Active area manager

This PR also removes the active area manager, which was not being used
in the way we expected it to be.

### Dpr manager

This PR removes the dpr manager and uses a hook instead to update it
from React. This is one less runtime browser dependency in the app, one
less thing to document.

### Moving things around

This PR also continues to try to organize related methods and properties
in the editor.

### Change Type

- [x] `major` — Breaking change

### Release Notes

- [editor] renames `defaultProps` to `getDefaultProps`
- [editor] removes `outline`, `outlineSegments`, `handles`, `bounds`
- [editor] renames `renderBackground` to `backgroundComponent`
2023-06-19 14:01:18 +00:00
alex
38d74a9ff0
Revert "Update dependencies (#1613)" (#1617)
This reverts commit b6716a3750.

Not sure why, but this introduced a `/// <references />` comment in the
tldraw/tldraw api-report.md file that doesn't show up when you build
from brivate. Reverting for now.

### Change Type

- [x] `dependencies` — Changes to package dependencies[^1]


### Test Plan

-

### Release Notes

-
2023-06-19 09:49:44 +00:00
Steve Ruiz
4b8491d388
[fix] tldraw file drop (#1616)
This PR removes a line of code that was filtering out .tldraw files when
dropping files onto the canvas.

### Change Type

- [x] `patch` — Bug fix
2023-06-18 22:38:50 +00:00
Steve Ruiz
55acf046aa
[fix] tldraw api report (#1615)
This PR adds a dumb reference that is presence on the bublic branch but
not on tldraw repo. Ridiculous.

### Change Type

- [x] `patch` — Bug fix
2023-06-18 20:26:06 +00:00
Steve Ruiz
b6716a3750
Update dependencies (#1613)
This PR updates a few key dependencies.

### Change Type

- [x] `dependencies` — Changes to package dependencies
2023-06-18 18:26:33 +00:00
Steve Ruiz
99a46af4c8
Remove on drop override (#1612)
This PR removes the `onDropOverride` prop from the canvas, which was a
bit of a hack.

### Change Type

- [x] `major` — Breaking change

### Release Notes

- [editor] Remove `onDropOverride`
2023-06-18 12:51:19 +00:00
Steve Ruiz
336cbc7158
Make resizeBox a regular function (#1610)
This PR changes `resizeBox` to be a regular function rather than an
arrow function.

### Change Type

- [x] `minor` — New feature

### Release Notes

- [editor] Change `resizeBox` to be a regular function.
2023-06-18 09:47:00 +00:00
Steve Ruiz
3129bae6e2
Rename ShapeUtil.render -> ShapeUtil.component (#1609)
This PR renames `ShapeUtil.render` to `ShapeUtil.component`.

### Change Type

- [x] `major` — Breaking change

### Release Notes

- [editor] rename `ShapeUtil.render` to `ShapeUtil.component`
2023-06-18 09:46:53 +00:00
Steve Ruiz
4dfc59e5cb
tldraw.css (#1607)
This PR introduces `@tldraw/tldraw/tldraw.css`, an exported CSS file
that replaces the `editor.css` and `ui.css` that were previously copied
from the editor and ui packages. Instead, these files are combined into
the `tldraw.css` file, simplifying the import story when using
`@tldraw/tldraw`.

### Change Type

- [x] `major` — Breaking change

### Release Notes

- [tldraw] Removes `editor.css` and `ui.css` exports, replaces with
`tldraw.css`
2023-06-17 22:33:21 +00:00
Steve Ruiz
b9c6bf2fe8
Auto content refresh for docs site (#1606)
This PR improves the author experience when working on the docs site. 

When running `docs-dev`, the site's content will now update whenever a
content file is changed.

### Context

In the docs project, we generate content from two sources: from API
documentation generated by api-extractor and from markdown files in the
docs/content folder. Generating API docs is a relatively slow process
because it involves building and parsing TypeScript declaration files
for each package in the monorepo; however, generating docs from the
markdown files is basically instantaneous. The same script used to
address both tasks, which meant it was too slow to run on each save.
Instead, the script needed to be run manually or the dev server would
need to be restarted.

We now split the generation into two separate scripts. First, the script
runs to generate the API content; and then a second script runs to
generate the markdown content. The second script also imports and
combines the two sources of content. When we build the docs, both
scripts are run. When a markdown file changes, the new watcher only runs
the second script. This allows the site's content to be updated quickly
without having to generate the API docs each time.

Note that this does not incorporate live changes to package APIs, though
I can't think of a time where we be developing the docs and the APIs at
the same time.

### Change Type

- [x] `documentation` — Changes to the documentation only
2023-06-17 09:46:46 +00:00
Steve Ruiz
3f52c24fec
[fix] yjs presence (#1603)
This PR:
- updates the yjs example to include user presence
- tweaks the `createPresenceStateDerivation` API
- fix a "double update" bug caused by re-syncing local changes
- fix connection bugs

### Change Type

- [x] `minor` — New feature
2023-06-16 15:59:13 +00:00
Steve Ruiz
bdd8913af3
[fix] camera culling (#1602)
This PR restores camera culling behavior and includes a 500ms forced
render while the camera is moving to prevent weird long pan behavior.

It:
- removes `CameraManager`
- adds `cameraState` to editor

### Change Type

- [x] `major` — Breaking change

### Release Notes

- [editor] Adds `Editor.cameraState`
- Adds smart culling to make panning and zooming more smooth
2023-06-16 13:02:38 +00:00
Steve Ruiz
271d0088e9
Tidy up (#1600)
This PR is intended to do some housecleaning ahead of our developer
release.

It:
- co-locates code in the `Editor` class, i.e. moving shape-related
methods next to other shape-related methods
- renames `cullingBounds` and other culling-related names to
`renderingBounds`
- renames `Editor.getParentPageId` to `Editor.getAncestorPageId`
- renames `Editor.shapeIds` to `Editor.currentPageShapeIds`

### Change Type

- [x] `major` — api changes
2023-06-16 11:27:47 +00:00
alex
b88a2370b3
Styles API (#1580)
Removes `propsForNextShape` and replaces it with the new styles API. 

Changes in here:
- New custom style example
- `setProp` is now `setStyle` and takes a `StyleProp` instead of a
string
- `Editor.props` and `Editor.opacity` are now `Editor.sharedStyles` and
`Editor.sharedOpacity`
- They return an object that flags mixed vs shared types instead of
using null to signal mixed types
- `Editor.styles` returns a `SharedStyleMap` - keyed on `StyleProp`
instead of `string`
- `StateNode.shapeType` is now the shape util rather than just a string.
This lets us pull the styles from the shape type directly.
- `color` is no longer a core part of the editor set on the shape
parent. Individual child shapes have to use color directly.
- `propsForNextShape` is now `stylesForNextShape`
- `InstanceRecordType` is created at runtime in the same way
`ShapeRecordType` is. This is so it can pull style validators out of
shape defs for `stylesForNextShape`
- Shape type are now defined by their props rather than having separate
validators & type defs

### Change Type

- [x] `major` — Breaking change

### Test Plan

1. Big time regression testing around styles!
2. Check UI works as intended for all shape/style/tool combos

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

### Release Notes

-

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-16 10:33:47 +00:00
Lu Wilson
f864d0cfbd
(1/2) Timeout collaborator cursors (#1525)
This PR adds a timeout to collaborator cursors.

It's part 1 of two PRs. The second one is smaller:
https://github.com/tldraw/brivate/pull/2053

# What is this?

After three seconds of inactivity, collaborator cursors disappear.

![2023-06-08 at 10 42 43 - Moccasin
Flamingo](https://github.com/tldraw/tldraw/assets/15892272/93e463aa-0329-4ecb-ada1-4c38b36a655b)

If you're following someone, you can always see their cursor.

![2023-06-08 at 10 45 42 - Olive
Crayfish](https://github.com/tldraw/tldraw/assets/15892272/11e8d85a-18a8-4976-85c5-d14f3841c296)

# Is there anything else?
The PR also adds support for the brivate PR:
https://github.com/tldraw/brivate/pull/2053

# Admin

### Change Type

- [x] `minor` — New Feature

### Test Plan

You probably need to test this locally, as we don't do multiplayer
previews on this repo yet.
1. Open the same shared project in two browser sessions.
2. Move around the cursor in one session, while able to see it from the
other.
3. Stop moving the cursor.
4. Make sure that the cursor disappears on the other session after 3
seconds.
5. Move the cursor again, and make sure it reappears it.
6. Make sure that viewport-following the user makes the cursor show
permanently.

### Release Notes

- Brought back cursor timeouts. Collaborator cursors now disappear after
3 seconds of inactivity.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-15 15:48:47 +00:00
Lu Wilson
6d4d9424df
Remove @tldraw/utils from the docs site (#1596)
This PR removes the `@tldraw/utils` package from the docs site's API
reference. It does this by removing it from the docs site's
`devDependencies`.

The reason for this is this:

<img width="899" alt="Screenshot 2023-06-15 at 15 52 24"
src="https://github.com/tldraw/tldraw/assets/15892272/3b00e9da-663d-45e5-8b77-ab0a4fc466ad">


### 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. Check the API Reference page of the docs.
2. Make that `@tldraw/utils` isn't there.

### Release Notes

- [docs] Removed an internal utilities package.
2023-06-15 15:35:23 +00:00
Lu Wilson
3bbb34eba8
(1/2) Cursor Chat - Presence (#1487)
This PR adds support for seeing **another user**'s chat messages.

It's part 1 of two PRs relating to Cursor Chat.
And it's needed for the much bigger part 2:
https://github.com/tldraw/brivate/pull/1981

# Presence

You can see another person's chat messages!

![2023-06-02 at 17 42 33 - Blush
Capybara](https://github.com/tldraw/tldraw/assets/15892272/8f3efb5f-9c05-459c-aa7e-24842be75e58)

If they have a name, it gets popped on top.

![2023-06-02 at 17 45 34 - Sapphire
Meerkat](https://github.com/tldraw/tldraw/assets/15892272/749bd924-c1f5-419b-a028-1fafe1b61292)

That's it!
With this PR, there's no way of actually *typing* your chat messages.
That comes with the [next
one](https://github.com/tldraw/brivate/pull/1981)!

# Admin

### To-do

- [x] Store chat message
- [x] Allow overflowing chat
- [x] Presence for chat message
- [x] Display chat message to others

### Change Type

- [x] `minor` — New Feature

### Test Plan

To test this, I recommend checking out both `lu/cursor-chat` branches,
and opening two browser sessions in the same shared project.

1. In one session, type some cursor chat by pressing the Enter key while
on the canvas (and typing).
2. On the other session, check that you can see the chat message appear.
3. Repeat this while being both named, and unnamed.

I recommend just focusing on the visible presense in this PR.
The [other PR](https://github.com/tldraw/brivate/pull/1981) is where we
can focus about how we _input_ the cursor chat.

### Release Notes

- [dev] Added support for cursor chat presence.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-15 15:10:08 +00:00
Steve Ruiz
21377c0f22
Explicit shape type checks (#1594)
This PR adds shape type checks that use the shape util, e.g.
`this.editor.isShapeOfType(shape, FrameShapeUtil)`. In part this is
designed to help us track down where dependencies exist between the
editor and our default shapes.

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package
2023-06-15 15:09:41 +00:00
Lu Wilson
0bbdcdd91b
[docs] Add barebones note about translations (#1593)
This PR adds a bare-minimum note to the Translations page on the docs
site.

### 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. Take a look at the Translations docs page.

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

### Release Notes

- [docs] Added brief info on how to join as a translations contributor.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-15 14:53:30 +00:00
Steve Ruiz
b22bb13bb0
[refactor] snapping (#1589)
This PR is a refactor / tidy up of some snapping logic.

- Fix a bug where the recursive call to `findAdjacentGaps` could lead to
a maximum call stack error
- Fixed an issue that caused handle snapping to expensively recompute
- Fixed a dependency from the snap manager to the line shape

### Change Type

- [x] `patch`

### Test Plan

Our snap tests are pretty thorough, they should work here.

### Release Notes

- [editor] fix bug in snapping
2023-06-15 14:36:46 +00:00
Steve Ruiz
4650869988
remove ShapeUtil.transform (#1590)
Removes the cached (but not really needed) local transform for shapes.
We almost never get the local transform except when getting the page
transform.

### Change Type

- [x] `major` — Breaking change


### Release Notes

- [editor] Remove `ShapeUtil.transform`
2023-06-15 12:42:18 +00:00
Lu Wilson
519d0dd348
Change app to editor in docs (#1592)
This PR changes App to Editor in the docs.
It goes alongside some changes that I accidentally commited to main...
so feel free to review those here as well!
([this
one](be1ec9699c))
and ([this
one](5a9f3a1726))

### 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. Check that there's an Editor page in the docs sidebar.

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

### Release Notes

- [docs] Updated 'App' to 'Editor'.
2023-06-15 12:37:42 +00:00
Mitja Bezenšek
86e0010523
Make sure loading screens use dark mode user preference. (#1552)
We load the user preferences a bit earlier, so that we can make sure
that the `LoadingScreen` and `ErrorScreen` also use the correct color
and background color based on the dark mode setting.

There's still a brief flash of white screen, but that's before any of
our components load, not sure if we can avoid that one.

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

### Change Type

- [x] `patch` — Bug Fix

### Test Plan

1. Probably best if you throttle your network speed.
2. Reload the page.
3. The asset loading screen should use take your dark mode setting into
account.
4. Change the dark mode and try again.

### Release Notes

- Make sure our loading and error screens take dark mode setting into
account.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-15 11:57:19 +00:00
Steve Ruiz
c937b01915
remove ShapeUtil.point (#1591)
Removes the unused `ShapeUtil.point`.

### Change Type

- [x] `major` — Breaking change

### Release Notes

- [editor] Remove `ShapeUtil.point`
2023-06-15 11:53:09 +00:00
Brian Hung
33465b9c49
move some kbds into actions and tools (#1585)
This PR tries to move some remaining kbds into actions and tools, which
allows them to be overwritten in actions or tools if developer wishes
so. It also modifies `getHotkeysStringFromKbd` to support multiple
`kbds` per action and parses them into proper hotkeys.

Right now, these kbds cannot be removed without reimplementing
`useKeyboardShortcuts` entirely.

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

Should not affect existing kbds behavior as it just moves them into
actions or tools.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-15 11:49:20 +00:00
Lu[ke] Wilson
5a9f3a1726 change App to Editor in docs 2023-06-15 11:36:54 +01:00
Lu[ke] Wilson
be1ec9699c rename api.mdx to editor.mdx 2023-06-15 11:35:39 +01:00
Steve Ruiz
6a8eb283ba
update exports for user presence (#1583)
This PR updates exports related to user presence, in order to enable
external sync solutions that use user presence.

### Change Type

- [x] `patch` — Bug fix

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version
2023-06-14 22:08:07 +00:00
Steve Ruiz
36e8813bf2
[fix] Remove group shape export backgrounds (#1587)
This PR removes the default SVG export for groups.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Create a group
2. Export it to SVG

### Release Notes

- Fix image exports for groups
2023-06-14 22:04:42 +00:00
Lu Wilson
3e2f2e0884
Add tsdocs to Editor methods (#1581)
This PR does a first-pass of adding tsdocs to the methods of the Editor
class.
It's a minimal start — just descriptions of them, and their parameters.
It makes the Editor docs page a lot more fleshed out though, and easier
to quickly scan.
There's still a lot more to do!

### Change Type

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

### Release Notes

- [dev] Added initial documentation for the Editor class.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-14 06:40:10 +00:00
Steve Ruiz
014576ba87
add presence to yjs example (#1582)
This PR adds presence to the yjs example.

![Kapture 2023-06-13 at 19 47
16](https://github.com/tldraw/tldraw/assets/23072548/759e0bf9-a934-47c7-979f-512c16b03e48)


### Change Type

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

### Release Notes

- [editor] Add presence to yjs example.
2023-06-13 21:00:53 +01:00
Steve Ruiz
ce1cf82029
Add optional generic to updateShapes / createShapes (#1579)
This PR adds a generic that we can use with `updateShapes` and
`createShapes` in order to type the partials being passed into those
methods. By default, the partials are typed as `TLUnknownShape`, which
accepts any props.

### Change Type

- [x] `minor` — New feature

### Test Plan

- [x] Unit Tests

### Release Notes

- [editor] adds an optional shape generic to `updateShapes` and
`createShapes`
2023-06-13 18:02:17 +00:00
Shahriar Shojib
69e5b248ca
fix: properly remove awareness from store (#1565)
Describe what your pull request does. If appropriate, add GIFs or images
showing the before and after.

### Change Type
This pr updates yjs example to remove awareness when a peer disconnects

<!-- 💡 Indicate the type of change your pull request is. -->
<!-- 🤷‍♀️ If you're not sure, don't select anything -->
<!-- ✂️ Feel free to delete unselected options -->

<!-- To select one, put an x in the box: [x] -->

- [ ] `patch` — Bug Fix
- [ ] `minor` — New Feature
- [ ] `major` — Breaking Change
- [ ] `dependencies` — Dependency Update (publishes a `patch` release,
for devDependencies use `internal`)
- [x] `documentation` — Changes to the documentation only (will not
publish a new version)
- [ ] `tests` — Changes to any testing-related code only (will not
publish a new version)
- [ ] `internal` — Any other changes that don't affect the published
package (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
- [ ] Webdriver tests

### Release Notes

- Add a brief release note for your PR here.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-13 17:05:28 +00:00
Mohammad Kazemi
7a78d14346
Fa translation (#1500)
Update Farsi (Persian) translations.

Note: I used my personal Weblate to manage translations. But the output
file json order of strings is different with the main.json file. I don't
know if it matters.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-13 15:29:48 +00:00
Steve Ruiz
e3b00e7c11
[fix] embeds (#1578)
This PR fixes embeds to remove the `doesResize` prop when creating
embeds / converting between bookmarks and embeds.

### 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. Create an embed
2. Convert between bookmark and embed
2023-06-13 12:45:43 +00:00
Steve Ruiz
b65aef5cf2
[improvement] Embed shape cleanup (#1569)
This PR does some cleanup around our Embed Shape.

It:
- removes used `doesResize` and `overridePermissions` props
- removes the no-longer-needed `tmpOldUrl` prop
- adds a `canUnmount` property to embed definitions, so that some embeds
can unmount when desired

### Change Type

- [x] `patch` — Bug Fix

### Test Plan

1. Create embed shapes
2. Migrate old data that includes embed shapes?

- [x] Unit Tests

### Release Notes

- [editor] Remove unused props for `TLEditorShape`
- [editor] Adds `canUnmount` property to embed definitions
2023-06-13 08:27:54 +00:00
Mitja Bezenšek
439a2ed3bc
Move the loading of assets to the TldrawEditorWithReadyStore so that all code paths load the assets. (#1561)
Move the preloading of assets to `TldrawEditorWithReadyStore` which
makes it sure that all codepaths preload assets. Before that didn't
happen for cases where we passed in an existing store - snapshots.


### Change Type

- [x] `patch` — Bug Fix

### Release notes
- Fix a problem where assets were not loading in some cases (snapshots).
2023-06-13 08:22:38 +00:00
Steve Ruiz
34a880dcbd
[improvement] bookmark shape logic (#1568)
This PR extracts some logic from the EditUrlDialog into the bookmark
shape util, removing the dependency between the two.

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package (will not publish a new version)

### Test Plan

1. Create a bookmark shape
2. Set its URL to an empty string

- [x] Unit Tests
2023-06-12 19:15:58 +00:00
Mitja Bezenšek
edd393353e
Add anchor targets to our headings. (#1571)
Add anchor target for our headings. Makes it much easier to share a link
to a specific part of the page.

### Change Type

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

### Test Plan

1. Open the docs page.
2. The headings should now be anchors to this part of the page.

### Release Notes

- Improve documentation to include anchor targets.
2023-06-12 17:09:17 +00:00