45dffd1af6
Adds RBush to handle spatial querying. We use it for: - Culling. Helps a lot with panning as we don't have to compute the culled shapes from scratch. Instead we just query rbush again. It makes culling quite granular: spatial index updates when shapes change (additions, removals, changes to bounds), visible shapes depends on that, but also updates when the viewport page bound change, culled shapes then depend on that but also change with selections changes. The api stayed the same, which is great since the fuzz tests can stay as they are. - Brushing - Erasing - Scribble brushing - Getting shapes at point (for example, when updating the hover id) This improves performance of all of those operations. I might have missed some places where this might also be useful. ### Erasing before (Test on my old ipad) https://github.com/tldraw/tldraw/assets/2523721/edb9c004-a44a-4779-b2d0-98617b057314 ### Erasing after https://github.com/tldraw/tldraw/assets/2523721/8f8367fd-fa8e-4963-ba13-720c5f0c2da5 ### Creating an arrow before https://github.com/tldraw/tldraw/assets/2523721/4068f8b7-f7b8-4826-83f2-083b1f3783bc ### After (much better, but still bad) https://github.com/tldraw/tldraw/assets/2523721/11af6be6-01d8-4740-bf15-896e2dd31dd6 ### Change Type <!-- ❗ Please select a 'Scope' label ❗️ --> - [ ] `sdk` — Changes the tldraw SDK - [ ] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [x] `internal` — Does not affect user-facing stuff <!-- ❗ Please select a 'Type' label ❗️ --> - [ ] `bugfix` — Bug fix - [ ] `feature` — New feature - [x] `improvement` — Improving existing features - [ ] `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 --------- Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
112 lines
3 KiB
JSON
112 lines
3 KiB
JSON
{
|
|
"name": "@tldraw/editor",
|
|
"description": "A tiny little drawing app (editor).",
|
|
"version": "2.0.0",
|
|
"author": {
|
|
"name": "tldraw Inc.",
|
|
"email": "hello@tldraw.com"
|
|
},
|
|
"homepage": "https://tldraw.dev",
|
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/tldraw/tldraw"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/tldraw/tldraw/issues"
|
|
},
|
|
"keywords": [
|
|
"tldraw",
|
|
"drawing",
|
|
"app",
|
|
"development",
|
|
"whiteboard",
|
|
"canvas",
|
|
"infinite"
|
|
],
|
|
"/* NOTE */": "These `main` and `types` fields are rewritten by the build script. They are not the actual values we publish",
|
|
"main": "./src/index.ts",
|
|
"types": "./.tsbuild/index.d.ts",
|
|
"style": "./editor.css",
|
|
"/* GOTCHA */": "files will include ./dist and index.d.ts by default, add any others you want to include in here",
|
|
"files": [
|
|
"editor.css"
|
|
],
|
|
"scripts": {
|
|
"test-ci": "lazy inherit",
|
|
"test": "yarn run -T jest",
|
|
"benchmark": "yarn run -T tsx ./scripts/benchmark.ts",
|
|
"test-coverage": "lazy inherit",
|
|
"build": "yarn run -T tsx ../../scripts/build-package.ts",
|
|
"build-api": "yarn run -T tsx ../../scripts/build-api.ts",
|
|
"prepack": "yarn run -T tsx ../../scripts/prepack.ts",
|
|
"postpack": "../../scripts/postpack.sh",
|
|
"pack-tarball": "yarn pack",
|
|
"lint": "yarn run -T tsx ../../scripts/lint.ts"
|
|
},
|
|
"dependencies": {
|
|
"@tldraw/state": "workspace:*",
|
|
"@tldraw/store": "workspace:*",
|
|
"@tldraw/tlschema": "workspace:*",
|
|
"@tldraw/utils": "workspace:*",
|
|
"@tldraw/validate": "workspace:*",
|
|
"@types/core-js": "^2.5.5",
|
|
"@use-gesture/react": "^10.2.27",
|
|
"classnames": "^2.3.2",
|
|
"core-js": "^3.31.1",
|
|
"eventemitter3": "^4.0.7",
|
|
"idb": "^7.1.1",
|
|
"is-plain-object": "^5.0.0",
|
|
"lodash.throttle": "^4.1.1",
|
|
"lodash.uniq": "^4.5.0",
|
|
"nanoid": "4.0.2",
|
|
"rbush": "^3.0.1"
|
|
},
|
|
"peerDependencies": {
|
|
"react": "^18",
|
|
"react-dom": "^18"
|
|
},
|
|
"devDependencies": {
|
|
"@peculiar/webcrypto": "^1.4.0",
|
|
"@testing-library/jest-dom": "^5.16.5",
|
|
"@testing-library/react": "^14.0.0",
|
|
"@types/benchmark": "^2.1.2",
|
|
"@types/lodash.throttle": "^4.1.7",
|
|
"@types/lodash.uniq": "^4.5.7",
|
|
"@types/rbush": "^3.0.3",
|
|
"@types/react-test-renderer": "^18.0.0",
|
|
"@types/wicg-file-system-access": "^2020.9.5",
|
|
"benchmark": "^2.1.4",
|
|
"fake-indexeddb": "^4.0.0",
|
|
"jest-canvas-mock": "^2.5.2",
|
|
"jest-environment-jsdom": "^29.4.3",
|
|
"lazyrepo": "0.0.0-alpha.27",
|
|
"react-test-renderer": "^18.2.0",
|
|
"resize-observer-polyfill": "^1.5.1"
|
|
},
|
|
"jest": {
|
|
"preset": "config/jest/node",
|
|
"testEnvironment": "../../../packages/utils/patchedJestJsDom.js",
|
|
"fakeTimers": {
|
|
"enableGlobally": true
|
|
},
|
|
"testPathIgnorePatterns": [
|
|
"^.+\\.*.css$"
|
|
],
|
|
"transformIgnorePatterns": [
|
|
"node_modules/(?!(nanoid)/)"
|
|
],
|
|
"moduleNameMapper": {
|
|
"^~(.*)": "<rootDir>/src/$1",
|
|
"\\.(css|less|scss|sass)$": "identity-obj-proxy"
|
|
},
|
|
"setupFiles": [
|
|
"raf/polyfill",
|
|
"jest-canvas-mock",
|
|
"<rootDir>/setupTests.js"
|
|
],
|
|
"setupFilesAfterEnv": [
|
|
"../../config/setupJest.ts"
|
|
]
|
|
}
|
|
}
|