{"_id":"@cooperkai/tldraw-tlschema","name":"@cooperkai/tldraw-tlschema","dist-tags":{"cooper":"5.1.1-cooper.5","latest":"5.1.1-cooper.5"},"versions":{"5.1.1-cooper.5":{"name":"@cooperkai/tldraw-tlschema","description":"tldraw infinite canvas SDK (schema).","version":"5.1.1-cooper.5","author":{"name":"tldraw Inc.","email":"hello@tldraw.com"},"homepage":"https://github.com/CooperHash/tldraw","license":"MIT","repository":{"type":"git","url":"git+https://github.com/CooperHash/tldraw.git"},"bugs":{"url":"https://github.com/CooperHash/tldraw/issues"},"keywords":["tldraw","sdk","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":"dist-cjs/index.js","types":"./.tsbuild/index.d.ts","/* GOTCHA */":"files will include ./dist and index.d.ts by default, add any others you want to include in here","scripts":{"test-ci":"yarn run -T vitest run --passWithNoTests","test":"yarn run -T vitest --passWithNoTests","test-coverage":"yarn run -T vitest run --coverage --passWithNoTests","format":"yarn run -T oxfmt \"src/**/*.{ts,tsx,js,jsx,json,md}\"","build":"yarn run -T tsx ../../internal/scripts/build-package.ts","build-api":"yarn run -T tsx ../../internal/scripts/build-api.ts","prepack":"yarn run -T tsx ../../internal/scripts/prepack.ts","postpack":"../../internal/scripts/postpack.sh","pack-tarball":"yarn pack","lint":"yarn run -T tsx ../../internal/scripts/lint.ts"},"devDependencies":{"kleur":"^4.1.5","lazyrepo":"0.0.0-alpha.27","react":"^19.2.1","vitest":"^4.1.7"},"dependencies":{"@tldraw/state":"npm:@cooperkai/tldraw-state@5.1.1-cooper.5","@tldraw/store":"npm:@cooperkai/tldraw-store@5.1.1-cooper.5","@tldraw/utils":"npm:@cooperkai/tldraw-utils@5.1.1-cooper.5","@tldraw/validate":"npm:@cooperkai/tldraw-validate@5.1.1-cooper.5"},"peerDependencies":{"react":"^18.2.0 || ^19.2.1","react-dom":"^18.2.0 || ^19.2.1"},"engines":{"node":">=22.12.0"},"module":"dist-esm/index.mjs","source":"src/index.ts","exports":{".":{"types":"./.tsbuild/index.d.ts","import":"./dist-esm/index.mjs","require":"./dist-cjs/index.js"}},"_id":"@cooperkai/tldraw-tlschema@5.1.1-cooper.5","gitHead":"3e49e6a4fd30f6a052af05aba7c3a5824a893b58","_nodeVersion":"22.21.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-5EEnHqrehD2hbFVHLC3I5tBputSIlVDkjcHxGk2BhICyGq+JghEsSJAMF+APp2+hFHIIpKmCWvKjeefG2dWn4g==","shasum":"7ceaacf104954c772cf3cae0818a33d16c7e6a9b","tarball":"https://registry.npmjs.org/@cooperkai/tldraw-tlschema/-/tldraw-tlschema-5.1.1-cooper.5.tgz","fileCount":403,"unpackedSize":2091412,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCTN9AwVDLXBh7lThosvgtIYyVrLwCcpkayisVJCXWEFwIgVB49JTMCAumwLdZDE4dWq5y4udKOaaUoG2ZOcPaofoI="}]},"_npmUser":{"name":"cooperkai","email":"2597905281@qq.com"},"directories":{},"maintainers":[{"name":"cooperkai","email":"2597905281@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tldraw-tlschema_5.1.1-cooper.5_1782226587958_0.4380921586387523"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-23T14:56:27.814Z","5.1.1-cooper.5":"2026-06-23T14:56:28.188Z","modified":"2026-06-23T14:56:28.406Z"},"maintainers":[{"name":"cooperkai","email":"2597905281@qq.com"}],"description":"tldraw infinite canvas SDK (schema).","homepage":"https://github.com/CooperHash/tldraw","keywords":["tldraw","sdk","drawing","app","development","whiteboard","canvas","infinite"],"repository":{"type":"git","url":"git+https://github.com/CooperHash/tldraw.git"},"author":{"name":"tldraw Inc.","email":"hello@tldraw.com"},"bugs":{"url":"https://github.com/CooperHash/tldraw/issues"},"license":"MIT","readme":"# @tldraw/tlschema\n\nType definitions, schema migrations, and other type metadata for the tldraw editor's default persisted data.\n\n## Documentation\n\nDocumentation for the most recent release can be found on [tldraw.dev/docs](https://tldraw.dev/docs), including [reference docs](https://tldraw.dev/reference/editor/Editor). Our release notes can be found [here](https://tldraw.dev/releases).\n\nFor more agent-friendly docs, see our [LLMs.txt](https://tldraw.dev/llms.txt).\n\nA `DOCS.md` file is included alongside this README in the published package, with detailed API documentation and usage examples.\n\n## Records\n\nThere are three main kinds of types:\n\n- Record types\n\n  These are root record types added to the `Store` class. They are defined in the `./src/records` directory.\n\n- Shape types\n\n  These are subtypes of the root TLShape record type. They allow specifying a unique name and custom props for a particular kind of shape.\n\n- Asset types\n\n  These are subtypes of the root TLAsset record type. They allow specifying a unique name and custom props for a particular kind of asset.\n\n# Adding migrations\n\nIf you make any kind of change to any persisted data shape in this package, you must add migrations that are able to convert old versions to new versions, and vice-versa.\n\nIf you are making a change that affects the structure of a record, shape, or asset, update the migrations in the same file as the record, shape, or asset is defined.\n\nIf you are making a change that affects the structure of the store (e.g. renaming or deleting a type, consolidating two shape types into one, etc), add your changes in the migrations in `schema.ts`.\n\nAfter making your changes, add a new version number, using a meaningful name. For example, if you add a new property\nto the `TLShape` type called `ownerId` that points to a user, you might do this:\n\nIn `TLShape.ts`\n\n```diff\n const Versions = {\n   RemoveSomeProp: 1,\n+  AddOwnerId: 2,\n } as const\n```\n\nand then in the `TLShape` type\n\n```diff\n   x: number\n   y: number\n+  ownerId: ID<TLUser> | null\n   props: Props\n   parentId: ID<TLShape> | ID<TLPage>\n```\n\nand then adding a migration:\n\n```diff\n export const shapeTypeMigrations = defineMigrations({\n   currentVersion: Versions.Initial,\n   firstVersion: Versions.Initial,\n   migrators: {\n+    [Versions.AddOwnerId]: {\n+      // add ownerId property\n+      up: (shape) => ({...shape, ownerId: null}),\n+      // remove ownerId property\n+      down: ({ownerId, ...shape}) => shape,\n+    }\n   },\n```\n\nAfter you've added your migration, make sure to add a test for it in `src/migrations.test.ts`. It will complain if you do not!\n\n## License\n\nThis project is licensed under the MIT License found [here](https://github.com/tldraw/tldraw/blob/main/packages/tlschema/LICENSE.md). The tldraw SDK is provided under the [tldraw license](https://github.com/tldraw/tldraw/blob/main/LICENSE.md).\n\n## Trademarks\n\nCopyright (c) 2024-present tldraw Inc. The tldraw name and logo are trademarks of tldraw. Please see our [trademark guidelines](https://github.com/tldraw/tldraw/blob/main/TRADEMARKS.md) for info on acceptable usage.\n\n## Distributions\n\nYou can find tldraw on npm [here](https://www.npmjs.com/package/@tldraw/tldraw?activeTab=versions).\n\n## Contribution\n\nFound a bug? Please [submit an issue](https://github.com/tldraw/tldraw/issues/new).\n\n## Community\n\nHave questions, comments or feedback? [Join our discord](https://discord.tldraw.com/?utm_source=github&utm_medium=readme&utm_campaign=sociallink). For the latest news and release notes, visit [tldraw.dev](https://tldraw.dev).\n\n## Contact\n\nFind us on Twitter/X at [@tldraw](https://twitter.com/tldraw).\n","readmeFilename":"README.md","_rev":"1-7a0715b4378095694b531107307ab35e"}