Wykres commitów

17 Commity (main)

Autor SHA1 Wiadomość Data
Dan Groshev d7b80baa31
use native structuredClone on node, cloudflare workers, and in tests (#3166)
Currently, we only use native `structuredClone` in the browser, falling
back to `JSON.parse(JSON.stringify(...))` elsewhere, despite Node
supporting `structuredClone` [since
v17](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone)
and Cloudflare Workers supporting it [since
2022](https://blog.cloudflare.com/standards-compliant-workers-api/).
This PR adjusts our shim to use the native `structuredClone` on all
platforms, if available.

Additionally, `jsdom` doesn't implement `structuredClone`, a bug [open
since 2022](https://github.com/jsdom/jsdom/issues/3363). This PR patches
`jsdom` environment in all packages/apps that use it for tests.

Also includes a driveby removal of `deepCopy`, a function that is
strictly inferior to `structuredClone`.

### Change Type

<!--  Please select a 'Scope' label ️ -->

- [x] `sdk` — Changes the tldraw SDK
- [x] `dotcom` — Changes the tldraw.com web app
- [ ] `docs` — Changes to the documentation, examples, or templates.
- [ ] `vs code` — Changes to the vscode plugin
- [ ] `internal` — Does not affect user-facing stuff

<!--  Please select a 'Type' label ️ -->

- [ ] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [x] `improvement` — Improving existing features
- [x] `chore` — Updating dependencies, other boring stuff
- [ ] `galaxy brain` — Architectural changes
- [ ] `tests` — Changes to any test code
- [ ] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know


### Test Plan

1. A smoke test would be enough

- [ ] Unit Tests
- [x] End to end tests
2024-03-18 17:16:09 +00:00
David Sheldrick 47a85896e0
[dx] Allow vscode to search inside md files by default (#3105)
Before this PR all .md files were targeted by the `.ignore` file, which
has bitten me on a number of occasions since .md files often contain
valuable information (e.g. the vscode extensions docs). This PR
unignores .md files while still ignoring _generated_ .md files like our
changelogs, the api-report files, and the generated docs sections.

Additionally, the `yarn format` and `yarn lint` commands were configured
slightly differently, which was confusing, so I've unified those and
simplified the lint.ts script at the same time.

### 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
2024-03-11 14:08:04 +00:00
David Sheldrick ade38247d8
[dotcom] Delete service worker, cache tldraw assets (#2552)
A few things happening here

- Delete our service worker. Turns out that a couple of years back
browsers decided that a service worker is no longer required for a PWA
so you can just have the manifest and still install on the user's
device.
- Cache tldraw's assets as part of the dotcom vite asset pipeline. This
allows them to participate in the asset coalescing (preserving old
versions of asset files so old clients don't stop working when you
deploy new versions of things, see
https://github.com/tldraw/brivate/pull/3132 for more context).
- Add a new 'imports.vite.js' file to the assets package, because we
import a bunch of json translation files, and vite imports .json files
as parsed json objects instead of string urls, and there's no good way
to tell it not to. Even if there was we wouldn't want to impose that
config on our users. So another way to tell vite to load any asset as a
url string is to append `?url` to the end of the import path. That's
what this file does.

closes [#2486](https://github.com/tldraw/tldraw/issues/2486)

### Change Type

- [x] `minor` — New feature


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

### Release Notes

- Fix 'could not load assets' error that we often see on tldraw.com
after a deploy
2024-01-19 15:31:01 +00:00
Steve Ruiz d7002057d7
unbrivate, dot com in (#2475)
This PR moves the tldraw.com app into the public repo.

### Change Type

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

---------

Co-authored-by: Dan Groshev <git@dgroshev.com>
Co-authored-by: alex <alex@dytry.ch>
2024-01-16 14:38:05 +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 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
alex 529574f83a
enable eslint for test files (#1363)
We've had a few issues where .only in tests wasn't getting caught by our
lint rules. Turns out it's because we were excluding tests from eslint
completely

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

### Release Notes

internal-only change
2023-05-12 13:19:39 +00:00
Steve Ruiz a722e3e6f0
[fix] various text (#1350)
This PR updates tests for the text shape, as well as updating the logic
of `getTextLines`. We now:

- allow leading whitespace
- allow white space to cause line breaks, trim the whitespace off of the
end of the line. Crazy times!
- fix a bug with geo shapes changes width when growY changes

Note that this is not a "full solution" to line breaks that are caused
by whitespace + wrapping. AFAIK this is impossible to fix in SVG-land
without measuring the SVG element in order to collapse whitespace in the
same way that it collapses in HTML layout.

### Change Type

- [x] `patch` — Bug Fix
- [ ] `minor` — New Feature
- [ ] `major` — Breaking Change

- [ ] `dependencies` — Dependency Update (publishes a `patch` release,
for devDependencies use `internal`)

- [ ] `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

- [x] Webdriver tests

### Release Notes

- Allow leading whitespace
2023-05-11 22:15:24 +00:00
Orange Mug 2dbfda1285
Added initial webdriver tests (#1337)
Adds webdriver tests for testing from a users perspective via browser
actions. We currently support local test runners for a bunch of actions
on desktop `chrome`/`firefox`/`edge`/`safari` on macos.

We also have a browserstack runner which we'll enable in another PR.

### Release Note

- Adds initial webdriver tests
2023-05-09 20:21:45 +00:00
alex 71aef1764d
Rework the assets package for strategy-specific imports (#1341)
The assets package now only exports esm-formatted .js files. There's one
for each strategy - import-based, and meta.url-based. These are directly
generated as .js and .d.ts files rather than generated as .ts and
converted to js/dts through other means.

As this package depends on esm-specific stuff to function, we don't
publish a cjs version any more.

### Change Type

<!-- 💡 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
- [x] `major` — Breaking Change

- [ ] `dependencies` — Dependency Update (publishes a `patch` release,
for devDependencies use `internal`)

- [ ] `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)

### Release Notes

- [dev] If you're using the `@tldraw/assets` package, you need to update
your code to `import { getAssetUrlsByImport } from
'@tldraw/assets/imports'` instead of `import { getBundlerAssetUrls }
from '@tldraw/assets`
2023-05-09 16:08:38 +00:00
David Sheldrick f5c5b05dc7
[chore] update lazyrepo (#1211) 2023-05-02 12:25:26 +00:00
alex 29ed921c67 transfer-out: transfer out 2023-04-25 12:01:25 +01:00
alex ec84f64e63 lite: delete all 2023-04-21 16:53:31 +01:00
Francois Laberge a95b581e07
Prepare for Publishing VS Code Extension (#227)
* Changed Wardlt use back to Tldraw. Added some VS Code marketplace categories

* Missed removing one Wardlt mention

* Initial support for esbuild based vscode extension workflow.

* Hacky start of vs code extension build script

* Fixed categories of extension

* Added script for generating VS Code extension installer

* Temp fix for file format change affecting VS Code extension

* Temp fix for file format change issue

* Cleanup, prevent changes from saving pagestates

* Remove logic around saving pageState

* standardize capitalization

* v0.1.8

* Edit readme, scripts

* Update .eslintignore

* v0.1.9

* v0.1.10

* cleans up build scripts, adds publishing notes

* Added VS Code extension implementation references links. start:vscode now auto opens the extension folder in VS Code

* Removed step from VS Code README to manually open the extensions folder

* Removed file

* v0.1.11

* v0.1.12

* Fix empty file

* v0.1.13

* README cleanup

* v0.1.14

* Update TLDrawEditorProvider.ts

* v0.1.15

* Fix types for file extension (sort of) build script for extension

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2021-11-10 15:35:51 +00:00
Francois Laberge 0b15992464
Create VS Code Extension (#4)
* Start of vscode extension. Current code is copy/paste from custom editor samples from Microsoft. We need to evaluate if using their text based customer editor or full on new custom editor is the way to go

* Not sure how I missed these files. Adding them

* Have a custom editor triggering off of .tldr files. Added gitignores for generated folder. Have iframed tldraw loading and security policies set to do so

* Can now load a .tldr file. No saving support yet. Load times are slow, mostly from editor loading up I think

* Have temporary solution for saving working now too.

* Missed af ile

* Backing up progress in syncing tldraw editor history changes

* Removed console

* ...

* ...

* Cleanup

* Have save working well now.

* Moved extension into 'integrations' folder

* Trying out WebviewPanelOptions.retainContextWhenHidden=true and it's looking promising

* Some cleanup

* Trying out new  @tldraw/editor module

* Have prototype loading using new embedded editor

* ...

* Shaved off 1 second from editor loadtime

* Got save working again. Had to manually fixuppreviously created .tldr files as the format changed a bit

* More tuning

* Starting work to get new tldraw/tldraw working.

* Added example tldr files to vscode package

* Removed old editor package

* Have onChange working with latest fix. Back to iframed for a few mom

* Fixed up .tldr files

* Have iframe free extension working, but requiring hand crafted building

* ...

* Better handling of empty .tldr files. Still an issue with freshly created files trying to save as .js or .json

* Thoroughly added comments for the extension code. Need to add diagrams though and now will document/comment/diagram the editor src code

* Added comments to all of the editor side of the VS Code Extension. Also cleaned up the code

* More cleanup of VS Code Extension code and have script automating generating the initial webview's html content from the cra editor static build

* Tweaks to watch logic

* Improved scripts for publishing to VS Code Marketplace

* Improved name

* Made the smiley angry

* Reverted

* Turned smiley mad

* Turned smiley mad

* Made smiley sad

* Have a lot of plumbing working for Github codespaces and github.dev support

* Imported new tldraw vs code extension code. Added instructions for workflows

* Quick fix

* Fix for corrupted arrows files

* Updated editor build step to new location

* Merge branch 'main' into vscode-extension-v1, add local file updating

* Update App.tsx

* Cleanup, bumped to 0.0.124 @tldraw/tdlraw and published a 0.10.0 version of hte extension

* Added Trello/Kanban style file

* Finished video

* brings up to date

* Fix scripts

* Update README.md

* Update .babelrc

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2021-11-06 16:49:53 +00:00
Steve Ruiz 5998879e24 Replace 2021-08-10 17:12:55 +01:00
Steve Ruiz 864ded959a big cleanup 2021-06-21 22:35:28 +01:00