From 3bccd0160dcd2a198f11a900b135493247dd893f Mon Sep 17 00:00:00 2001 From: Laxman Pache Date: Sun, 20 Jul 2025 20:08:27 +0530 Subject: [PATCH] upgrade: react version upgraded to react 19 --- .gitignore | 4 +- example/package.json | 3 +- example/tsconfig.json | 2 +- example/yarn.lock | 5 +++ package.json | 11 +++--- src/components/Item.tsx | 4 +- src/components/Menu.tsx | 8 ++-- yarn.lock | 86 +++++++++++++---------------------------- 8 files changed, 49 insertions(+), 74 deletions(-) diff --git a/.gitignore b/.gitignore index 997356b5..b7321b13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ + .idea/ node_modules/ .sass-cache/ @@ -10,4 +11,5 @@ yarn-error.log* .vscode .cache dist -*.log \ No newline at end of file +*.log +.history \ No newline at end of file diff --git a/example/package.json b/example/package.json index 663c8d5c..6d1c4808 100644 --- a/example/package.json +++ b/example/package.json @@ -19,6 +19,7 @@ "@types/react": "^18.0.24", "@types/react-dom": "^18.0.8", "parcel": "^2.7.0", + "process": "^0.11.10", "typescript": "^4.8.4" } -} \ No newline at end of file +} diff --git a/example/tsconfig.json b/example/tsconfig.json index c799f038..25bdbf87 100644 --- a/example/tsconfig.json +++ b/example/tsconfig.json @@ -3,7 +3,7 @@ "allowSyntheticDefaultImports": false, "target": "ESNext", "module": "commonjs", - "jsx": "react", + "jsx": "react-jsx", "moduleResolution": "node", "noImplicitAny": false, "noUnusedLocals": false, diff --git a/example/yarn.lock b/example/yarn.lock index a445b4c2..0973449f 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -1436,6 +1436,11 @@ posthtml@^0.16.4, posthtml@^0.16.5: posthtml-parser "^0.11.0" posthtml-render "^3.0.0" +process@^0.11.10: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== + promise@^8.1.0: version "8.3.0" resolved "https://registry.yarnpkg.com/promise/-/promise-8.3.0.tgz#8cb333d1edeb61ef23869fbb8a4ea0279ab60e0a" diff --git a/package.json b/package.json index 0f287d24..a9e002f9 100644 --- a/package.json +++ b/package.json @@ -66,21 +66,22 @@ "popup" ], "devDependencies": { - "@types/react": "^18.0.25", - "@types/react-dom": "^18.0.8", + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", "cssnano": "^5.1.14", "cssnano-cli": "^1.0.5", "cypress": "^11.0.1", "postcss": "^8.4.18", "postcss-cli": "^10.0.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", "sass": "^1.56.1", "style2js": "^1.0.1", "tsup": "^6.4.0", "typescript": "^4.8.4" }, "dependencies": { - "clsx": "^1.2.1" + "clsx": "^1.2.1", + "process": "^0.11.10" } } diff --git a/src/components/Item.tsx b/src/components/Item.tsx index 7c3c0c61..80c9ae76 100644 --- a/src/components/Item.tsx +++ b/src/components/Item.tsx @@ -15,7 +15,7 @@ import { contextMenu } from '../core'; export interface ItemProps extends InternalProps, - Omit, 'hidden' | 'disabled' | 'onClick'> { + Omit, 'hidden' | 'disabled' | 'onClick'> { /** * Any valid node that can be rendered */ @@ -135,7 +135,7 @@ export const Item: React.FC = ({ handlerEvent = 'onClick', ...rest }) => { - const itemNode = useRef(); + const itemNode = useRef(null); const itemTracker = useItemTrackerContext(); const handlerParams = { id, diff --git a/src/components/Menu.tsx b/src/components/Menu.tsx index d85670e8..982f194c 100644 --- a/src/components/Menu.tsx +++ b/src/components/Menu.tsx @@ -105,8 +105,8 @@ export const Menu: React.FC = ({ const nodeRef = useRef(null); const itemTracker = useItemTracker(); const [menuController] = useState(() => createKeyboardController()); - const wasVisible = useRef(); - const visibilityId = useRef(); + const wasVisible = useRef(false); + const visibilityId = useRef(0); // subscribe event manager useEffect(() => { @@ -232,8 +232,8 @@ export const Menu: React.FC = ({ animation && (isStr(animation) || ('exit' in animation && animation.exit)) ? setState((state) => ({ willLeave: state.visible })) : setState((state) => ({ - visible: state.visible ? false : state.visible, - })); + visible: state.visible ? false : state.visible, + })); visibilityId.current = setTimeout(() => { isFn(onVisibilityChange) && onVisibilityChange(false); diff --git a/yarn.lock b/yarn.lock index e5c9f107..baa5da97 100644 --- a/yarn.lock +++ b/yarn.lock @@ -115,40 +115,18 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.33.tgz#8c29a0036771569662e4635790ffa9e057db379b" integrity sha512-qelS/Ra6sacc4loe/3MSjXNL1dNQ/GjxNHVzuChwMfmk7HuycRLVQN2qNY3XahK+fZc5E2szqQSKUyAF0E+2bg== -"@types/prop-types@*": - version "15.7.3" - resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7" - integrity sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw== +"@types/react-dom@^19.0.0": + version "19.1.6" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-19.1.6.tgz#4af629da0e9f9c0f506fc4d1caa610399c595d64" + integrity sha512-4hOiT/dwO8Ko0gV1m/TJZYk3y0KBnY9vzDh7W+DH17b2HFSOGgdj33dhihPeuy3l0q23+4e+hoXHV6hCC4dCXw== -"@types/react-dom@^18.0.8": - version "18.0.8" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.8.tgz#d2606d855186cd42cc1b11e63a71c39525441685" - integrity sha512-C3GYO0HLaOkk9dDAz3Dl4sbe4AKUGTCfFIZsz3n/82dPNN8Du533HzKatDxeUYWu24wJgMP1xICqkWk1YOLOIw== +"@types/react@^19.0.0": + version "19.1.8" + resolved "https://registry.yarnpkg.com/@types/react/-/react-19.1.8.tgz#ff8395f2afb764597265ced15f8dddb0720ae1c3" + integrity sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g== dependencies: - "@types/react" "*" - -"@types/react@*": - version "16.9.56" - resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.56.tgz#ea25847b53c5bec064933095fc366b1462e2adf0" - integrity sha512-gIkl4J44G/qxbuC6r2Xh+D3CGZpJ+NdWTItAPmZbR5mUS+JQ8Zvzpl0ea5qT/ZT3ZNTUcDKUVqV3xBE8wv/DyQ== - dependencies: - "@types/prop-types" "*" csstype "^3.0.2" -"@types/react@^18.0.25": - version "18.0.25" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.25.tgz#8b1dcd7e56fe7315535a4af25435e0bb55c8ae44" - integrity sha512-xD6c0KDT4m7n9uD4ZHi02lzskaiqcBxf4zi+tXZY98a04wvc0hi/TcCPC2FOESZi51Nd7tlUeOJY8RofL799/g== - dependencies: - "@types/prop-types" "*" - "@types/scheduler" "*" - csstype "^3.0.2" - -"@types/scheduler@*": - version "0.16.2" - resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39" - integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew== - "@types/sinonjs__fake-timers@8.1.1": version "8.1.1" resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.1.tgz#b49c2c70150141a15e0fa7e79cf1f92a72934ce3" @@ -1702,11 +1680,6 @@ js-base64@^2.1.9: resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.6.4.tgz#f4e686c5de1ea1f867dbcad3d46d969428df98c4" integrity sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ== -"js-tokens@^3.0.0 || ^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - js-yaml@~3.7.0: version "3.7.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.7.0.tgz#5c967ddd837a9bfdca5f2de84253abe8a1c03b80" @@ -1850,13 +1823,6 @@ log-update@^4.0.0: slice-ansi "^4.0.0" wrap-ansi "^6.2.0" -loose-envify@^1.1.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" - integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== - dependencies: - js-tokens "^3.0.0 || ^4.0.0" - lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -2624,6 +2590,11 @@ pretty-hrtime@^1.0.3: resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" integrity sha1-t+PqQkNaTJsnWdmeDyAesZWALuE= +process@^0.11.10: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== + proxy-from-env@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" @@ -2665,20 +2636,17 @@ query-string@^4.1.0: object-assign "^4.1.0" strict-uri-encode "^1.0.0" -react-dom@^18.2.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d" - integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== +react-dom@^19.0.0: + version "19.1.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-19.1.0.tgz#133558deca37fa1d682708df8904b25186793623" + integrity sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g== dependencies: - loose-envify "^1.1.0" - scheduler "^0.23.0" + scheduler "^0.26.0" -react@^18.2.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" - integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== - dependencies: - loose-envify "^1.1.0" +react@^19.0.0: + version "19.1.0" + resolved "https://registry.yarnpkg.com/react/-/react-19.1.0.tgz#926864b6c48da7627f004795d6cce50e90793b75" + integrity sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg== read-cache@^1.0.0: version "1.0.0" @@ -2809,12 +2777,10 @@ sax@~1.2.1: resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== -scheduler@^0.23.0: - version "0.23.0" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe" - integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw== - dependencies: - loose-envify "^1.1.0" +scheduler@^0.26.0: + version "0.26.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.26.0.tgz#4ce8a8c2a2095f13ea11bf9a445be50c555d6337" + integrity sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA== semver@7.x: version "7.3.8"