@tldraw/state-react 3.16.0-next.f9f54ec051f3 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-cjs/index.js CHANGED
@@ -37,7 +37,7 @@ var import_useStateTracking = require("./lib/useStateTracking");
37
37
  var import_useValue = require("./lib/useValue");
38
38
  (0, import_utils.registerTldrawLibraryVersion)(
39
39
  "@tldraw/state-react",
40
- "3.16.0-next.f9f54ec051f3",
40
+ "4.0.0",
41
41
  "cjs"
42
42
  );
43
43
  //# sourceMappingURL=index.js.map
@@ -8,7 +8,7 @@ import { useStateTracking } from "./lib/useStateTracking.mjs";
8
8
  import { useValue } from "./lib/useValue.mjs";
9
9
  registerTldrawLibraryVersion(
10
10
  "@tldraw/state-react",
11
- "3.16.0-next.f9f54ec051f3",
11
+ "4.0.0",
12
12
  "esm"
13
13
  );
14
14
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tldraw/state-react",
3
3
  "description": "tldraw infinite canvas SDK (react bindings for state).",
4
- "version": "3.16.0-next.f9f54ec051f3",
4
+ "version": "4.0.0",
5
5
  "author": {
6
6
  "name": "tldraw Inc.",
7
7
  "email": "hello@tldraw.com"
@@ -32,38 +32,29 @@
32
32
  "src"
33
33
  ],
34
34
  "scripts": {
35
- "test-ci": "lazy inherit",
36
- "test": "yarn run -T jest",
37
- "test-coverage": "lazy inherit",
35
+ "test-ci": "yarn run -T vitest run --passWithNoTests",
36
+ "test": "yarn run -T vitest --passWithNoTests",
37
+ "test-coverage": "yarn run -T vitest run --coverage --passWithNoTests",
38
38
  "build": "yarn run -T tsx ../../internal/scripts/build-package.ts",
39
39
  "build-api": "yarn run -T tsx ../../internal/scripts/build-api.ts",
40
40
  "prepack": "yarn run -T tsx ../../internal/scripts/prepack.ts",
41
41
  "postpack": "../../internal/scripts/postpack.sh",
42
42
  "pack-tarball": "yarn pack",
43
- "lint": "yarn run -T tsx ../../internal/scripts/lint.ts"
44
- },
45
- "jest": {
46
- "preset": "../../internal/config/jest/node/jest-preset.js",
47
- "setupFiles": [
48
- "raf/polyfill"
49
- ],
50
- "moduleNameMapper": {
51
- "^~(.*)": "<rootDir>/src/$1"
52
- },
53
- "testEnvironment": "jsdom"
43
+ "lint": "yarn run -T tsx ../../internal/scripts/lint.ts",
44
+ "context": "yarn run -T tsx ../../internal/scripts/context.ts"
54
45
  },
55
46
  "dependencies": {
56
- "@tldraw/state": "3.16.0-next.f9f54ec051f3",
57
- "@tldraw/utils": "3.16.0-next.f9f54ec051f3"
47
+ "@tldraw/state": "4.0.0",
48
+ "@tldraw/utils": "4.0.0"
58
49
  },
59
50
  "devDependencies": {
60
- "@testing-library/jest-dom": "^5.17.0",
61
51
  "@testing-library/react": "^15.0.7",
62
52
  "@types/lodash": "^4.17.14",
63
53
  "@types/react": "^18.3.18",
64
54
  "lodash": "^4.17.21",
65
55
  "react": "^18.3.1",
66
- "react-dom": "^18.3.1"
56
+ "react-dom": "^18.3.1",
57
+ "vitest": "^3.2.4"
67
58
  },
68
59
  "peerDependencies": {
69
60
  "react": "^18.2.0 || ^19.0.0",
@@ -1,6 +1,7 @@
1
1
  import { act, render, RenderResult } from '@testing-library/react'
2
2
  import { Atom, Computed } from '@tldraw/state'
3
3
  import { useState } from 'react'
4
+ import { vi } from 'vitest'
4
5
  import { useAtom } from './useAtom'
5
6
  import { useComputed } from './useComputed'
6
7
  import { useValue } from './useValue'
@@ -76,7 +77,7 @@ test('useComputed allows optionally passing options', async () => {
76
77
  let theComputed = null as null | Computed<number>
77
78
  let theAtom = null as null | Atom<number>
78
79
  let setCount = null as null | ((count: number) => void)
79
- const isEqual = jest.fn((a, b) => a === b)
80
+ const isEqual = vi.fn((a, b) => a === b)
80
81
  function Component() {
81
82
  const [count, _setCount] = useState(0)
82
83
  setCount = _setCount
@@ -1,6 +1,7 @@
1
1
  import { RenderResult, act, render } from '@testing-library/react'
2
2
  import { Atom, Computed, atom } from '@tldraw/state'
3
3
  import { Component, ReactNode, useState } from 'react'
4
+ import { vi } from 'vitest'
4
5
  import { useAtom } from './useAtom'
5
6
  import { useComputed } from './useComputed'
6
7
  import { useValue } from './useValue'
@@ -192,7 +193,7 @@ test('useValue throws synchronously during render when the computed throws', asy
192
193
  // ignore console.error here because react will log the error to console.error
193
194
  // even though it's caught by the error boundary
194
195
  const originalError = console.error
195
- console.error = jest.fn()
196
+ console.error = vi.fn()
196
197
  try {
197
198
  act(() => {
198
199
  theAtom.set(new Error('test'))