Commit graph

2016 commits

Author SHA1 Message Date
alex
eba7b8c6a6
cleanup (#1711)
I accidentally checked in a bunch of stuff i shouldn't. oops.

### 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
2023-07-05 08:55:56 +00:00
Lu Wilson
d965c9f6c9
Firefox: Fix coarse pointer issue (#1701)
This PR fixes the editor sometimes incorrectly assuming that you're
using a coarse pointer in firefox. It's not a complete fix — it just
avoids some of the bigger issues with it. ie: It disables cursor chat.

To avoid the issue, we just assume that you have a fine pointer if
you're using firefox on desktop.

Eventually, we should do a more complete fix for this.

I QA'd this change on:
* Mac Firefox (no touch screen)
* Windows Firefox (touch screen)
* Android Firefox

### 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. Use firefox on desktop with a touch screen.
2. Check that you can still use cursor chat (when in a shared project).

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

### Release Notes

- Fixed firefox not being able to use cursor chat when using a touch
screen on desktop.
2023-07-04 15:24:20 +00:00
Lu Wilson
d314c1ab01
Fix tsdocs for TldrawUi component (#1707)
This PR fixes the tsdocs formatting on the TldrawUi component so that
they appear on the docs site. Very similar to
https://github.com/tldraw/tldraw/pull/1706

### 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. Go to `/gen/ui/TldrawUiProps`
2. Make sure that there are descriptions for all parameters.

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

### Release Notes

- Docs: Show some docs missing from TldrawUi component.
2023-07-04 15:24:11 +00:00
huppy-bot[bot]
43442070c2 Update CHANGELOG.md [skip ci] 2023-07-04 14:21:37 +00:00
Mitja Bezenšek
f44551104b
Disable styles panel button on mobile when using the laser tool. (#1704)
Disable the style panel button on mobile layouts when using the laser
tool.

Fixes #1702 
### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Use a mobile layout.
2. Select laser tool
3. Make sure you cannot click the style panel button - it should be
disabled.

### Release Notes

- Disable the styles panel button for laser tool on mobile.
2023-07-04 10:45:01 +00:00
alex
c893a02878
remove lock option from highlighter (#1703)
Highlighter is autolocked, so we shouldn't show the lock icon 

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

- We no longer show the tool lock option for highlighter - it didn't do
anything anyway
2023-07-04 10:41:14 +00:00
Steve Ruiz
603966486d
[fix] penmode (#1698)
This PR fixes pen mode.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. On iPad, use the pencil to enter pen mode
2. Select the draw tool
3. touch the screen

- [x] Unit Tests (sort of)

### Release Notes

- [fix] pen mode
2023-07-04 10:11:57 +00:00
Lu Wilson
2aa6c4cbe3
Lokalise: Translations update (#1694)
This pull request was initiated by Lokalise (user Lu) at 2023-07-04
11:04:05
2023-07-04 10:10:57 +00:00
Lu Wilson
8ebeb72ef0
Update readme (#1686)
This PR updates the repo's readme. Some things were out-of-date. For
example, the 'hello world' example didn't work.

See code comments for more detail!

### 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: Updated readme to reflect recent library changes.
2023-07-04 10:07:05 +00:00
Steve Ruiz
5174d3f466
[fix] indicator not updating (#1696)
This PR fixes the indicator bug
(https://github.com/orgs/tldraw/projects/16/views/1?pane=issue&itemId=32402403).

### Change Type

- [x] `patch` — Bug fix
2023-07-04 10:06:45 +00:00
David Sheldrick
b5edaeb950
[infra] use huppy token for publish-new (#1687)
This PR sets up our publish-new script to use Huppy's GH token. At the
same time I added huppy to a list of actors who are allowed to override
the branch protection rules for `main` so hopefully next time we run the
release script the push will succeed and the release will therefore also
succeed. I will create a test repo to see if that works and if it does
I'll merge this.

### 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
2023-06-30 16:00:04 +00:00
Steve Ruiz
b96d207f5f
[docs] Update multiple test (#1685)
This PR adds a bit of content to the multiple editor test so that we can
also test scrolling.

### Change Type

- [x] `documentation`
2023-06-30 13:30:06 +00:00
Lu Wilson
f07b915716
[docs] Fix the types in the Shapes example (#1681)
This PR fixes some incorrect types in the example on the Shapes page of
the docs.

### 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: Fix some incorrect types on the Shapes page.
2023-06-30 12:46:32 +00:00
Steve Ruiz
eb6aa9bbe4
[improvement] More nuanced cursor state (#1682)
This PR adds some more nuance to collaborator cursors.

Rather than being timed out or not timed out, a collaborator can now be
`active`, `idle` or `inactive`.

We calculate this based on the difference between the time that has
elapsed since the user's last activity timestamp.

After 3 seconds of inactivity, they go `idle`.
After sixty seconds of inactivity, they are `inactive`.
After any activity, they become `active` again.

When a user is `active`, we always show their cursor.
When a user is `idle`, we hide their cursor if they're following us,
unless they're highlighted
When a user is `inactive`, we hide their cursor unless they're
highlighted.

### Change Type

- [x] `minor`

### Test Plan

1. Find a friend and experiment with inactive times
2. Join a room that includes an inactive cursors; they should be hidden
on load
3. Have people follow you; do their timeouts feel natural?

### Release Notes

- Improve cursor timeouts and hiding logic.
2023-06-30 12:46:07 +00:00
Lu Wilson
0e7af29085
Fix VS Code commits failing on bublic? (#1680)
This PR should fix commits failing with the VS Code / Github Desktop ui
~~and help steve to stop using "ok" as a commit message~~

### Change Type

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

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

### Release Notes

- [internal] fixed commits failing from bublic when using UI
2023-06-30 12:25:16 +00:00
Steve Ruiz
91dfdecc93
[fix] Lock shortcut (#1677)
This PR fixes the shortcut for lock shapes, which may be blocked by
browser defaults. We now use Shift+L instead of Cmd+Shift+L. Closes
https://github.com/tldraw/tldraw/issues/1676.

### Change Type

- [x] `patch` 

### Test Plan

1. Try the lock tool shortcuts.

- [x] End to end tests

### Release Notes

- [@tldraw/editor] Fix lock tool shortcut
2023-06-29 21:43:28 +00:00
Steve Ruiz
c524cac3f7
[fix] comma keyboard shortcuts (#1675)
This PR fixes some issues in our `useDocumentEvents`. It closes
https://github.com/tldraw/tldraw/issues/1667 (I think).

### Change Type

- [x] `patch`

### Release Notes

- [@tldraw/editor] Bug fixes on document events.
2023-06-29 20:30:33 +00:00
Steve Ruiz
cf2cc8c970
[improvement] add box sizing border box (#1674)
This PR adds `box-sizing: border-box` to the editor and its children.

### Change Type

- [x] `patch`

### Release Notes

- [@tldraw/editor] Add `box-sizing: border-box` to `tl-container`
2023-06-29 14:23:18 +00:00
Steve Ruiz
f1f584df94
[improvemnet] drop crc, Buffer dependency (#1673)
This PR incorporates a crc method from
https://github.com/alexgorbatchev/crc into the library, removing a peer
dependency on `buffer`. This was causing build errors in apps that did
not include the buffer library. (Our codebase included buffer because of
vsce.)

### Change Type

- [x] `patch`

### Release Notes

- [@tldraw/editor] Remove peer dependency on buffer.
2023-06-29 14:14:43 +00:00
Steve Ruiz
6faef733b6
[improvement] export scribble manager (#1671)
This PR adds the `ScribbleManager` to the exports from `@tldraw/editor`.

### Change Type

- [x] `minor` — New feature


### Release Notes

- [@tldraw/tldraw] Export `ScribbleManager`
2023-06-29 14:10:54 +00:00
Steve Ruiz
352c19fcac
[fix] rename global in @tldraw/state to avoid collissions (#1672)
We saw an issue on stackblitz where the `global` constant was causing a
conflict (possibly because that environment was injecting its own
`global`). Either way, perhaps `global` is a bit of a risky name—this PR
renames `global` to `tldrawStateGlobal`.

### Change Type

- [x] `patch`
2023-06-29 12:57:55 +00:00
Steve Ruiz
81ee3381bf
[fix] Shape rendering (#1670)
This PR fixes shape rendering logic. Remember! memo's 2nd argument
returns "when should we NOT render" not "when should we render"

### Change Type

- [x] `patch`

### Test Plan

1. Use the draw tool
2023-06-29 10:13:50 +00:00
Steve Ruiz
fd29006538
[feature] add meta property to records (#1627)
This PR adds a `meta` property to shapes and other records.

It adds it to:
- asset
- camera
- document
- instance
- instancePageState
- instancePresence
- page
- pointer
- rootShape

## Setting meta

This data can generally be added wherever you would normally update the
corresponding record.

An exception exists for shapes, which can be updated using a partial of
the `meta` in the same way that we update shapes with a partial of
`props`.

```ts
this.updateShapes([{
    id: myShape.id,
    type: "geo",
    meta: { 
      nemesis: "steve",
      special: true
    }
])
```

## `Editor.getInitialMetaForShape`

The `Editor.getInitialMetaForShape` method is kind of a hack to set the
initial meta property for newly created shapes. You can set it
externally. Escape hatch!

### Change Type

- [x] `minor` — New feature

### Test Plan

todo

- [ ] Unit Tests (todo)

### Release Notes

- todo
2023-06-28 14:24:05 +00:00
Steve Ruiz
3e07f70440
[fix] mutating snapshot in migrateStoreSnapshot (#1663)
This PR fixes an issue that I introduced where the `snapshot` argument
would be mutated by the `Store.migrateStoreSnapshot` method.

### Change Type

- [x] `patch`

### Release Notes

- [@tldraw/store] Fixed a bug that would cause
`Store.migrateStoreSnapshot` to mutate its `snapshot` argument.
2023-06-28 14:23:56 +00:00
David Sheldrick
a63b536782 Update CHANGELOG.md [skip ci] 2023-06-28 11:53:57 +01:00
Steve Ruiz
1dede56131
[chore] bump vscode extension to 2.0.9 (#1662)
Bump vscode to 2.0.9

### Change Type

- [x] `internal`
2023-06-28 10:35:55 +00:00
Steve Ruiz
2239f16aa2 Update publish-new.yml 2023-06-28 11:33:42 +01:00
Steve Ruiz
9532854b37 Update publish-new.yml 2023-06-28 11:27:04 +01:00
Steve Ruiz
c22eb9d869 Update publish-new.yml 2023-06-28 11:16:53 +01:00
Steve Ruiz
78f93be1d7 Update lerna.json 2023-06-28 10:48:51 +01:00
Steve Ruiz
bb3d8e0de8 Update lerna.json 2023-06-28 10:45:29 +01:00
Steve Ruiz
887a5f9841 Update lerna.json 2023-06-28 10:40:52 +01:00
Lu Wilson
9c12c91f5f
Fix crash when rotating a deleted shape (#1658)
This PR fixes a crash when rotating a deleted shapes, and adds a unit
test for it.

It also updates the docs of an editor method to communicate a current
limitation that we left a 'todo' for. See code comments for more info.

### 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. Get two devices out for this! (or write a little console script to do
it for you)
2. Rotate a shape on one device.
3. While rotating it, delete it on the other device.
4. Make sure the page doesn't crash!

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

### Release Notes

- Fixed a crash when trying to rotate a deleted shape.
2023-06-27 15:08:23 +00:00
Steve Ruiz
7fd0ab75ed
[improvement] custom shapes example (#1660)
This PR fixes an import in the custom shapes example. It also tweaks the
example to show how buttons and other interactive content should work.

### Change Type

- [x] `documentation`
2023-06-27 14:51:35 +00:00
Steve Ruiz
2d5b2bdc94
[tweak] migrate store snapshot arguments (#1659)
This PR updates the `migrateStoreSnapshot` method in @tldraw/store

### Change Type

- [x] `major` — Breaking change

### Test Plan

- [x] Unit Tests
2023-06-27 13:59:07 +00:00
Steve Ruiz
ed8d4d9e05
[improvement] store snapshot types (#1657)
This PR improves the types for the Store.

- renames `StoreSnapshot` to `SerializedStore`, which is the return type
of `Store.serialize`
- creates `StoreSnapshot` as a type for the return type of
`Store.getSnapshot` / the argument type for `Store.loadSnapshot`
- creates `TLStoreSnapshot` as the type used for the `TLStore`.

This came out of a session I had with a user. This should prevent
needing to import types from `@tldraw/store` directly.

### Change Type

- [x] `major` — Breaking change

### Test Plan

- [x] Unit Tests

### Release Notes

- [dev] Rename `StoreSnapshot` to `SerializedStore`
- [dev] Create new `StoreSnapshot` as type related to
`getSnapshot`/`loadSnapshot`
2023-06-27 12:25:55 +00:00
Steve Ruiz
faecd88220
[fix] pen mode touches (#1655)
This PR fixes an issue (cough feature cough) where three touches would
exit pen mode.

### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Removes three touches to cancel pen mode feature.
2023-06-27 10:25:49 +00:00
Steve Ruiz
d3ce35c916
[fix] remove docs scripts (#1651)
This PR removes the docs generation scripts.

### Change Type

- [x] `documentation`
2023-06-27 08:34:26 +00:00
Lu Wilson
2403577da0
(2/2) [docs] Fix links to API. (#1654)
This PR fixes some links to the API in the docs.
It's part 2 of two PRs related to simplifying the paths of our API
reference.
This first one is https://github.com/tldraw/brivate/pull/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. On the docs site...
2. Go to the Editor page...
3. Click on the links to the Editor API reference.
4. Make sure they take you to the right place.

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

### Release Notes

- Documentation: Simplified links to the API reference.
2023-06-27 08:34:12 +00:00
Lu Wilson
df5fce2a39
(1/2) [docs] Restore some missing changes (#1652)
This PR restores some changes that were lost during the docs move from
bublic to brivate.

This is part 1 of two PRs. The second one is
https://github.com/tldraw/brivate/pull/2124

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

- None (Docs internals)
2023-06-26 16:22:48 +00:00
Lu Wilson
02c4ed48ef
[docs] Remove embeds page (#1653)
This PR removes the skeleton Embeds page.

While we're here, do we also want to remove the skeleton Persistence
page (would it fit somewhere else? or nah?)

### 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...
2. Make sure that there's no 'Embeds' page in the menu.

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

### Release Notes

- Documentation: Removed unused Embeds page.
2023-06-26 16:22:29 +00:00
Steve Ruiz
23f4aca90d Update lerna.json 2023-06-26 16:55:58 +01:00
Steve Ruiz
79539f9ac3 Update publish-new.ts 2023-06-26 16:46:59 +01:00
Lu Wilson
caaedc559f
Fix text shapes not having colour (#1649)
This PR fixes text shapes always being black.
It also fixes Note shapes not having the correct text colour.

<img width="759" alt="Screenshot 2023-06-26 at 11 26 45"
src="https://github.com/tldraw/tldraw/assets/15892272/a68ae0d1-69ba-43de-9e21-87c483ffd2dc">


### 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. Make a text shape.
2. Make sure you can change its colour.
3. Make a note shape.
4. Make sure its text label stays black when you change the note's
colour.

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

### Release Notes

- None: Fixes an unreleased bug.
2023-06-26 12:57:15 +00:00
alex
aad5815a06
Styles API docs (#1641)
Adds some basic API docs for the new styles API.

### Change Type

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

### Test Plan

--

### Release Notes
 --

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-24 14:01:02 +00:00
alex
e8bc114bf3
Styles API follow-ups (#1636)
tldraw-zero themed follow-ups to the styles API added in #1580.

- Removed style related helpers from `ShapeUtil`
- `editor.css` no longer includes the tldraw default color palette.
Instead, a global `DefaultColorPalette` is defined as part of the color
style. If developers wish to cusomise the colors, they can mutate that
global.
- `ShapeUtil.toSvg` no longer takes font/color. Instead, it takes an
"svg export context" that can be used to add `<defs>` to the exported
SVG element. Converting e.g. fonts to inlined data urls is now the
responsibility of the shapes that use them rather than the Editor.
- `usePattern` is not longer a core part of the editor. Instead,
`ShapeUtil` has a `getCanvasSvgDefs` method for returning react
components representing anything a shape needs included in `<defs>` for
the canvas.
- The shape-specific cleanup logic in `setStyle` has been deleted. It
turned out that none of that logic has been running anyway, and instead
the relevant logic lives in shape `onBeforeChange` callbacks already.

### Change Type
- [x] `minor` — New feature

### Test Plan


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

### Release Notes
 --

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-24 13:46:04 +00:00
Gabriel Lee
15ce98b277
docs: remove not accepting contributions notice (#1647)
Remove the "not accepting contributions" notice from the root readme

Raising this PR cuz i don't see another PR being raised by the team
<img width="684" alt="Screenshot 2023-06-24 at 13 40 46"
src="https://github.com/tldraw/tldraw/assets/5616556/9684456f-9f6a-489b-b380-41484cd4fe18">

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

- Remove not accepting contributions notice from README
2023-06-24 13:45:20 +00:00
Lu Wilson
39a4615fe5
Fix SVG cursors not being used (#1639)
This PR fixes a bug where our custom SVG cursors were not being used,
causing cursor chat to look worse on Windows.

It was the result of a dodgy merge!

### Change Type

- [x] `patch` — Bug fix

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

### Test Plan

To test this, you might need to change your OS cursor to something
different to usual. I set mine to off-black so that I can test this sort
of thing.

1. Make sure that your cursor is our custom black cursor when using the
app.

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

### Release Notes

- None: Fixing an unreleased bug.
2023-06-24 08:24:10 +00:00
Lu Wilson
b3029e3fd3
[docs] Add table of contents to Editor page (#1642)
This PR adds a table of contents to the Editor docs page.

The Editor page is quite long, with different sections. I think that
some contents at the top will make it slightly more approachable &
usable for now.

### 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: Added a table of contents to the Editor page.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-24 08:23:02 +00:00
Steve Ruiz
44387eb363
untrack generated files (#1646)
This PR untracks generated docs files. It does some minor repo cleanup.

### Change Type

- [x] `internal`
2023-06-24 08:22:42 +00:00