880f82e658
Right now this examples app looks exactly the same as our old examples app, but there are a couple of tiny differences: - We use `vite` instead of our own esbuild setup for development and bundling - We use `@tldraw/assets` for smart asset hashing instead of copying the assets to a public folder You can use `@tldraw/assets` with vite with a bunch of extra config, but it (plus a bunch of other bundlers) also support a special syntax for specifying asset urls: `new URL('./my/asset.svg', import.meta.url).href`. This approach is more standards-complient, but doesn't work with every bundler just yet. This diff also adds a url-based version of `@tldraw/assets`, although I'd like to tweak the entry point - right now you need to import from `@tldraw/assets/lib/urls`, but i'd like to find a way to get this to `@tldraw/assets/urls` or something at some point. There are a couple other extra fixes in here: - vscode builds were broken, they're fixed now! - there's also a little tweak to the `getBundlerAssetUrls` API to allow passing in a function instead of an object for URL formatting - there are new internal-only functions for injecting asset urls globally instead of passing them in via react props. this means we can get the benefits of cacheable URLs without having to clutter our examples by passing them in |
||
---|---|---|
.. | ||
scripts | ||
src | ||
api-extractor.json | ||
api-report.md | ||
CHANGELOG.md | ||
LICENSE | ||
package.json | ||
README.md | ||
setupTests.js | ||
tsconfig.json |
@tldraw/tldraw
This is the alpha version of tldraw. It is very much a work in progress.
Installation
Install the @tldraw/tldraw
package using @alpha
for the latest alpha release.
yarn add @tldraw/tldraw@alpha
# or
npm install @tldraw/tldraw@alpha
# or
pnpm i @tldraw/tldraw@alpha
Then start the local development server.
yarn dev
# or
npm run dev
# or
pnpm dev
Usage
An extremely minimal usage (without our UI) might look like this:
import { Tldraw } from '@tldraw/tldraw'
import '@tldraw/tldraw/styles-editor.css'
import '@tldraw/tldraw/styles-ui.css'
export default function () {
return <Tldraw />
}
See the examples repo for more examples.
License
The source code in this repository (as well as our 2.0+ distributions and releases) are currently licensed under Apache-2.0. These licenses are subject to change in our upcoming 2.0 release. If you are planning to use tldraw in a commercial product, please reach out at hello@tldraw.com.