3d30f77ac1
This PR makes it so that user preferences can be in a 'null' state, where we use the default values and/or infer from the system preferences. Before this PR it was impossible to allow a user to change their locale via their system config rather than selecting an explicit value in the tldraw editor menu. Similarly, it was impossible to adapt to changes in the user's system preferences for dark/light mode. That's because we saved the full user preference values the first time the user loaded tldraw, and the only way for them to change after that is by saving new values. After this PR, if a value is `null` we will use the 'default' version of it, which can be inferred based on the user's system preferences in the case of dark mode, locale, and animation speed. Then if the user changes their system config and refreshes the page their changes should be picked up by tldraw where they previously wouldn't have been. Dark mode inference is opt-in by setting a prop `inferDarkMode: true` on the `Editor` instance (and the `<Tldraw />` components), because we don't want it to be a surprise for existing library users. ### Change Type - [ ] `patch` — Bug fix - [ ] `minor` — New feature - [x] `major` — Breaking change [^1]: publishes a `patch` release, for devDependencies use `internal` [^2]: will not publish a new version |
||
---|---|---|
.. | ||
src | ||
api-extractor.json | ||
api-report.md | ||
CHANGELOG.md | ||
editor.css | ||
LICENSE | ||
package.json | ||
README.md | ||
setupTests.js | ||
tsconfig.json |
tldraw/tldraw
Benchmark
To run the benchmarks
yarn workspace @tldraw/tldraw benchmark
Or
yarn workspace @tldraw/tldraw benchmark "file_search_string"