Skip to content

Commit 287f12e

Browse files
committed
chore: update for React 19 compatibility
1 parent 769e636 commit 287f12e

File tree

30 files changed

+753
-289
lines changed

30 files changed

+753
-289
lines changed

common/shared/vite/data.ts

-10
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@
1515
*/
1616

1717
export const peerDepsMap = {
18-
react: {
19-
global: 'React',
20-
name: 'react',
21-
version: '^16.9.0 || ^17.0.0 || ^18.0.0',
22-
},
23-
'react-dom': {
24-
global: 'ReactDOM',
25-
name: 'react-dom',
26-
version: '^16.9.0 || ^17.0.0 || ^18.0.0',
27-
},
2818
rxjs: {
2919
global: 'rxjs',
3020
name: 'rxjs',

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"url": "https://github.com/dream-num/univer/issues"
2020
},
2121
"engines": {
22-
"node": ">=18.0.0",
23-
"pnpm": ">=8.5.0 || >=9.0.0"
22+
"node": ">=18 || <=22",
23+
"pnpm": ">=9"
2424
},
2525
"scripts": {
2626
"prepare": "husky install",

packages/design/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@
9999
"@univerjs/core": "workspace:*",
100100
"less": "^4.2.1",
101101
"postcss": "^8.4.49",
102-
"react": "18.3.1",
103-
"react-dom": "18.3.1",
102+
"react": "workspace:./tools/src/react",
103+
"react-dom": "workspace:./tools/src/react-dom",
104104
"tailwindcss": "^3.4.16",
105105
"typescript": "^5.7.2",
106106
"vite": "^6.0.3",

packages/docs-drawing-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"@univerjs-infra/shared": "workspace:*",
8383
"less": "^4.2.1",
8484
"postcss": "^8.4.49",
85-
"react": "18.3.1",
85+
"react": "workspace:./tools/src/react",
8686
"rxjs": "^7.8.1",
8787
"tailwindcss": "^3.4.16",
8888
"typescript": "^5.7.2",

packages/docs-hyper-link-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"devDependencies": {
8080
"@univerjs-infra/shared": "workspace:*",
8181
"postcss": "^8.4.49",
82-
"react": "18.3.1",
82+
"react": "workspace:./tools/src/react",
8383
"rxjs": "^7.8.1",
8484
"tailwindcss": "^3.4.16",
8585
"typescript": "^5.7.2",

packages/docs-mention-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"@univerjs-infra/shared": "workspace:*",
7373
"less": "^4.2.1",
7474
"postcss": "^8.4.49",
75-
"react": "18.3.1",
75+
"react": "workspace:./tools/src/react",
7676
"rxjs": "^7.8.1",
7777
"tailwindcss": "^3.4.16",
7878
"typescript": "^5.7.2",

packages/docs-thread-comment-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"devDependencies": {
7474
"@univerjs-infra/shared": "workspace:*",
7575
"postcss": "^8.4.49",
76-
"react": "18.3.1",
76+
"react": "workspace:./tools/src/react",
7777
"rxjs": "^7.8.1",
7878
"tailwindcss": "^3.4.16",
7979
"typescript": "^5.7.2",

packages/docs-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"@univerjs/docs-drawing": "workspace:*",
9090
"less": "^4.2.1",
9191
"postcss": "^8.4.49",
92-
"react": "18.3.1",
92+
"react": "workspace:./tools/src/react",
9393
"rxjs": "^7.8.1",
9494
"tailwindcss": "^3.4.16",
9595
"typescript": "^5.7.2",

packages/drawing-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"@univerjs-infra/shared": "workspace:*",
7979
"less": "^4.2.1",
8080
"postcss": "^8.4.49",
81-
"react": "18.3.1",
81+
"react": "workspace:./tools/src/react",
8282
"rxjs": "^7.8.1",
8383
"tailwindcss": "^3.4.16",
8484
"typescript": "^5.7.2",

packages/find-replace/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"@univerjs-infra/shared": "workspace:*",
7979
"less": "^4.2.1",
8080
"postcss": "^8.4.49",
81-
"react": "18.3.1",
81+
"react": "workspace:./tools/src/react",
8282
"rxjs": "^7.8.1",
8383
"tailwindcss": "^3.4.16",
8484
"typescript": "^5.7.2",

packages/sheets-conditional-formatting-ui/package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@
6464
"build": "univer-cli build"
6565
},
6666
"peerDependencies": {
67-
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
68-
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0",
6967
"rxjs": ">=7.0.0"
7068
},
7169
"dependencies": {
@@ -88,7 +86,7 @@
8886
"@univerjs-infra/shared": "workspace:*",
8987
"less": "^4.2.1",
9088
"postcss": "^8.4.49",
91-
"react": "18.3.1",
89+
"react": "workspace:./tools/src/react",
9290
"rxjs": "^7.8.1",
9391
"tailwindcss": "^3.4.16",
9492
"typescript": "^5.7.2",

packages/sheets-crosshair-highlight/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"@univerjs-infra/shared": "workspace:*",
8585
"less": "^4.2.1",
8686
"postcss": "^8.4.49",
87-
"react": "18.3.1",
87+
"react": "workspace:./tools/src/react",
8888
"rxjs": "^7.8.1",
8989
"tailwindcss": "^3.4.16",
9090
"typescript": "^5.7.2",

packages/sheets-data-validation-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"@univerjs-infra/shared": "workspace:*",
9090
"less": "^4.2.1",
9191
"postcss": "^8.4.49",
92-
"react": "18.3.1",
92+
"react": "workspace:./tools/src/react",
9393
"rxjs": "^7.8.1",
9494
"tailwindcss": "^3.4.16",
9595
"typescript": "^5.7.2",

packages/sheets-drawing-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"@univerjs-infra/shared": "workspace:*",
9191
"less": "^4.2.1",
9292
"postcss": "^8.4.49",
93-
"react": "18.3.1",
93+
"react": "workspace:./tools/src/react",
9494
"rxjs": "^7.8.1",
9595
"tailwindcss": "^3.4.16",
9696
"typescript": "^5.7.2",

packages/sheets-filter-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"@univerjs-infra/shared": "workspace:*",
8383
"less": "^4.2.1",
8484
"postcss": "^8.4.49",
85-
"react": "18.3.1",
85+
"react": "workspace:./tools/src/react",
8686
"rxjs": "^7.8.1",
8787
"tailwindcss": "^3.4.16",
8888
"typescript": "^5.7.2",

packages/sheets-formula-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"@univerjs-infra/shared": "workspace:*",
8989
"less": "^4.2.1",
9090
"postcss": "^8.4.49",
91-
"react": "18.3.1",
91+
"react": "workspace:./tools/src/react",
9292
"rxjs": "^7.8.1",
9393
"tailwindcss": "^3.4.16",
9494
"typescript": "^5.7.2",

packages/sheets-hyper-link-ui/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
"build": "univer-cli build"
7171
},
7272
"peerDependencies": {
73-
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
7473
"rxjs": ">=7.0.0"
7574
},
7675
"dependencies": {
@@ -91,8 +90,9 @@
9190
},
9291
"devDependencies": {
9392
"@univerjs-infra/shared": "workspace:*",
93+
"less": "^4.2.1",
9494
"postcss": "^8.4.49",
95-
"react": "18.3.1",
95+
"react": "workspace:./tools/src/react",
9696
"rxjs": "^7.8.1",
9797
"tailwindcss": "^3.4.16",
9898
"typescript": "^5.7.2",

packages/sheets-numfmt-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"@univerjs/engine-formula": "workspace:*",
8484
"less": "^4.2.1",
8585
"postcss": "^8.4.49",
86-
"react": "18.3.1",
86+
"react": "workspace:./tools/src/react",
8787
"rxjs": "^7.8.1",
8888
"tailwindcss": "^3.4.16",
8989
"typescript": "^5.7.2",

packages/sheets-sort-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"@univerjs-infra/shared": "workspace:*",
8282
"less": "^4.2.1",
8383
"postcss": "^8.4.49",
84-
"react": "18.3.1",
84+
"react": "workspace:./tools/src/react",
8585
"rxjs": "^7.8.1",
8686
"tailwindcss": "^3.4.16",
8787
"typescript": "^5.7.2",

packages/sheets-thread-comment-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"devDependencies": {
8282
"@univerjs-infra/shared": "workspace:*",
8383
"postcss": "^8.4.49",
84-
"react": "18.3.1",
84+
"react": "workspace:./tools/src/react",
8585
"rxjs": "^7.8.1",
8686
"tailwindcss": "^3.4.16",
8787
"typescript": "^5.7.2",

packages/sheets-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"@univerjs-infra/shared": "workspace:*",
9393
"less": "^4.2.1",
9494
"postcss": "^8.4.49",
95-
"react": "18.3.1",
95+
"react": "workspace:./tools/src/react",
9696
"rxjs": "^7.8.1",
9797
"tailwindcss": "^3.4.16",
9898
"typescript": "^5.7.2",

packages/sheets-zen-editor/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"@univerjs-infra/shared": "workspace:*",
8282
"less": "^4.2.1",
8383
"postcss": "^8.4.49",
84-
"react": "18.3.1",
84+
"react": "workspace:./tools/src/react",
8585
"rxjs": "^7.8.1",
8686
"tailwindcss": "^3.4.16",
8787
"typescript": "^5.7.2",

packages/slides-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"@univerjs-infra/shared": "workspace:*",
8484
"less": "^4.2.1",
8585
"postcss": "^8.4.49",
86-
"react": "18.3.1",
86+
"react": "workspace:./tools/src/react",
8787
"rxjs": "^7.8.1",
8888
"tailwindcss": "^3.4.16",
8989
"typescript": "^5.7.2",

packages/thread-comment-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"@univerjs-infra/shared": "workspace:*",
8181
"less": "^4.2.1",
8282
"postcss": "^8.4.49",
83-
"react": "18.3.1",
83+
"react": "workspace:./tools/src/react",
8484
"rxjs": "^7.8.1",
8585
"tailwindcss": "^3.4.16",
8686
"typescript": "^5.7.2",

packages/tools/package.json

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"name": "@univerjs/tools",
3+
"version": "0.5.1",
4+
"private": false,
5+
"description": "UI component library for building exceptional Univer.",
6+
"author": "DreamNum <[email protected]>",
7+
"license": "Apache-2.0",
8+
"funding": {
9+
"type": "opencollective",
10+
"url": "https://opencollective.com/univer"
11+
},
12+
"homepage": "https://univer.ai",
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/dream-num/univer"
16+
},
17+
"bugs": {
18+
"url": "https://github.com/dream-num/univer/issues"
19+
},
20+
"keywords": [
21+
"univer"
22+
],
23+
"exports": {
24+
"./*": "./src/*",
25+
"./react": "./src/react/index.ts",
26+
"./react-dom": "./src/react-dom/index.ts",
27+
"./react-dom/client": "./src/react-dom/client.ts"
28+
},
29+
"main": "./src/index.ts",
30+
"types": "./lib/types/index.d.ts",
31+
"publishConfig": {
32+
"access": "public",
33+
"main": "./lib/es/index.js",
34+
"module": "./lib/es/index.js",
35+
"exports": {
36+
".": {
37+
"import": "./lib/es/index.js",
38+
"require": "./lib/cjs/index.js",
39+
"types": "./lib/types/index.d.ts"
40+
},
41+
"./*": {
42+
"import": "./lib/es/*",
43+
"require": "./lib/cjs/*",
44+
"types": "./lib/types/index.d.ts"
45+
},
46+
"./locale/*": {
47+
"import": "./lib/es/locale/*.js",
48+
"require": "./lib/cjs/locale/*.js",
49+
"types": "./lib/types/locale/*.d.ts"
50+
},
51+
"./lib/*": "./lib/*"
52+
}
53+
},
54+
"directories": {
55+
"lib": "lib"
56+
},
57+
"files": [
58+
"lib"
59+
],
60+
"scripts": {
61+
"lint:types": "tsc --noEmit",
62+
"build": "univer-cli build"
63+
},
64+
"dependencies": {
65+
"react": "18.3.1",
66+
"react-dom": "18.3.1"
67+
},
68+
"devDependencies": {
69+
"@univerjs-infra/shared": "workspace:*",
70+
"typescript": "^5.7.2",
71+
"vite": "^6.0.3"
72+
},
73+
"space": {
74+
".": {
75+
"import": "./lib/es/index.js",
76+
"require": "./lib/cjs/index.js",
77+
"types": "./lib/types/index.d.ts"
78+
},
79+
"./*": {
80+
"import": "./lib/es/*",
81+
"require": "./lib/cjs/*",
82+
"types": "./lib/types/index.d.ts"
83+
},
84+
"./locale/*": {
85+
"import": "./lib/es/locale/*.js",
86+
"require": "./lib/cjs/locale/*.js",
87+
"types": "./lib/types/locale/*.d.ts"
88+
},
89+
"./lib/*": "./lib/*"
90+
}
91+
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Copyright 2023-present DreamNum Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
export * from 'react-dom/client';

packages/tools/src/react-dom/index.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Copyright 2023-present DreamNum Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
export * from 'react-dom';

packages/tools/src/react/index.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Copyright 2023-present DreamNum Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// @ts-expect-error
18+
export * from 'react';

0 commit comments

Comments
 (0)