Commit graph

12 commits

Author SHA1 Message Date
Lu Wilson
5c095e0b7e
add shapes docs content (#1705)
This PR adds a bunch of brain-dump content onto the Shapes docs page.
There's more to add, but I'm submitting what I've done so far.

The main addition is explaining the concept of 'shapes' outside of the
context of creating a custom shape. I think it's good to do the basics
before getting into the world of custom stuff.

Note: I've also moved the Meta section from the Editor page to the
Shapes page.
 
### 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 more info about shapes.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-07-17 22:06:20 +00:00
Steve Ruiz
b7d9c8684c
tldraw zero - package shuffle (#1710)
This PR moves code between our packages so that:
- @tldraw/editor is a “core” library with the engine and canvas but no
shapes, tools, or other things
- @tldraw/tldraw contains everything particular to the experience we’ve
built for tldraw

At first look, this might seem like a step away from customization and
configuration, however I believe it greatly increases the configuration
potential of the @tldraw/editor while also providing a more accurate
reflection of what configuration options actually exist for
@tldraw/tldraw.

## Library changes

@tldraw/editor re-exports its dependencies and @tldraw/tldraw re-exports
@tldraw/editor.

- users of @tldraw/editor WITHOUT @tldraw/tldraw should almost always
only import things from @tldraw/editor.
- users of @tldraw/tldraw should almost always only import things from
@tldraw/tldraw.

- @tldraw/polyfills is merged into @tldraw/editor
- @tldraw/indices is merged into @tldraw/editor
- @tldraw/primitives is merged mostly into @tldraw/editor, partially
into @tldraw/tldraw
- @tldraw/file-format is merged into @tldraw/tldraw
- @tldraw/ui is merged into @tldraw/tldraw

Many (many) utils and other code is moved from the editor to tldraw. For
example, embeds now are entirely an feature of @tldraw/tldraw. The only
big chunk of code left in core is related to arrow handling.

## API Changes

The editor can now be used without tldraw's assets. We load them in
@tldraw/tldraw instead, so feel free to use whatever fonts or images or
whatever that you like with the editor.

All tools and shapes (except for the `Group` shape) are moved to
@tldraw/tldraw. This includes the `select` tool.

You should use the editor with at least one tool, however, so you now
also need to send in an `initialState` prop to the Editor /
<TldrawEditor> component indicating which state the editor should begin
in.

The `components` prop now also accepts `SelectionForeground`.

The complex selection component that we use for tldraw is moved to
@tldraw/tldraw. The default component is quite basic but can easily be
replaced via the `components` prop. We pass down our tldraw-flavored
SelectionFg via `components`.

Likewise with the `Scribble` component: the `DefaultScribble` no longer
uses our freehand tech and is a simple path instead. We pass down the
tldraw-flavored scribble via `components`.

The `ExternalContentManager` (`Editor.externalContentManager`) is
removed and replaced with a mapping of types to handlers.

- Register new content handlers with
`Editor.registerExternalContentHandler`.
- Register new asset creation handlers (for files and URLs) with
`Editor.registerExternalAssetHandler`

### Change Type

- [x] `major` — Breaking change

### Test Plan

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

### Release Notes

- [@tldraw/editor] lots, wip
- [@tldraw/ui] gone, merged to tldraw/tldraw
- [@tldraw/polyfills] gone, merged to tldraw/editor
- [@tldraw/primitives] gone, merged to tldraw/editor / tldraw/tldraw
- [@tldraw/indices] gone, merged to tldraw/editor
- [@tldraw/file-format] gone, merged to tldraw/tldraw

---------

Co-authored-by: alex <alex@dytry.ch>
2023-07-17 21:22:34 +00:00
Lu Wilson
30b0a4d736
(2/2) Add content to Tools docs page. (#1721)
This PR adds some tools docs. There's more to come (eventually), but
this is what's finished so far.

This PR relies on this brivate one landing first:
https://github.com/tldraw/brivate/pull/2223

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

- Tools docs.
2023-07-10 08:43:58 +00:00
Lu Wilson
a316fd2ab4
Add API links to all docs pages (#1661)
This PR adds links to the API reference from within the docs pages.
I think we should continue with this as we move forwards with more
content.

We could tweak the threshold of what we link or don't link. I tried to
strike a good balance (maybe linked too much though). We'd want lots of
stuff to be clickable, so that users can dive into the API. But we don't
want the screen to be a splattering of blue, distracting away from more
important stuff.

### 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 some of the newly added links on the docs site.

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

### Release Notes

- Documentation: Added links to API reference in guides.
2023-07-06 14:01:11 +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
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
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
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
Steve Ruiz
096df3209b
[1/2] Move docs to brivate (#1640)
This PR moves the docs site to the private repo while keeping the docs
content on the public repo.

### Change Type

- [x] `documentation`
2023-06-23 14:23:14 +00:00