From 58f25d7cb0be7d87287b9d09fb440ad28e77830e Mon Sep 17 00:00:00 2001 From: CyberCookie Date: Sun, 19 Jan 2025 14:04:54 +0200 Subject: [PATCH] downgrade react to 18 --- .../DataTable/helpers/apply_virtualization.ts | 2 +- client_core/ui/Input/index.tsx | 6 +- client_core/ui/Input/utils.ts | 2 +- client_core/ui/Select/index.tsx | 4 +- client_core/ui/_internals/ref_apply.ts | 2 +- .../postcss_svg2icon_plugin/icons_to_font.ts | 3 +- global.d.ts | 4 -- package-lock.json | 70 +++++++++++-------- package.json | 10 +-- 9 files changed, 56 insertions(+), 47 deletions(-) diff --git a/client_core/ui/DataTable/helpers/apply_virtualization.ts b/client_core/ui/DataTable/helpers/apply_virtualization.ts index 27c7f18..9832c91 100644 --- a/client_core/ui/DataTable/helpers/apply_virtualization.ts +++ b/client_core/ui/DataTable/helpers/apply_virtualization.ts @@ -172,7 +172,7 @@ function applyVirtualization(params: UseVirtualizationParams) { maxItemsCount: newMaxItemsCount }) - const rootElement = (rootAttributes.ref as Ref).current + const rootElement = (rootAttributes.ref as Ref).current! const tableElement = rootElement.firstChild as HTMLTableElement tableElement.style.padding = `${from * itemHeight}px 0 ${(newMaxItemsCount - to) * itemHeight}px` diff --git a/client_core/ui/Input/index.tsx b/client_core/ui/Input/index.tsx index 6c85c51..5bf6a2d 100644 --- a/client_core/ui/Input/index.tsx +++ b/client_core/ui/Input/index.tsx @@ -93,7 +93,7 @@ const Input = component( inputProps.ref = useRef(null) autofocus && useEffect(() => { - disabled || (inputProps.ref as InputRef).current.focus() + disabled || (inputProps.ref as InputRef).current!.focus() }, [ disabled ]) } @@ -173,11 +173,11 @@ const Input = component( : value if (prefix && (selectionStart! < prefix.length)) { - setCaretPos(inputProps.ref! as InputRef, prefix.length) + setCaretPos(inputProps.ref as InputRef, prefix.length) } if (suffix && (selectionStart! >= value.length)) { - setCaretPos(inputProps.ref! as InputRef, value.length) + setCaretPos(inputProps.ref as InputRef, value.length) } } diff --git a/client_core/ui/Input/utils.ts b/client_core/ui/Input/utils.ts index 8f72e8c..b35fb43 100644 --- a/client_core/ui/Input/utils.ts +++ b/client_core/ui/Input/utils.ts @@ -3,7 +3,7 @@ import type { InputRef } from './types' const setCaretPos = (ref: InputRef, caretPosFrom: number, caretPosTo?: number) => ( setTimeout(() => { - ref.current.setSelectionRange(caretPosFrom, caretPosTo || caretPosFrom) + ref.current!.setSelectionRange(caretPosFrom, caretPosTo || caretPosFrom) }) ) diff --git a/client_core/ui/Select/index.tsx b/client_core/ui/Select/index.tsx index aa13fd4..c827c6e 100644 --- a/client_core/ui/Select/index.tsx +++ b/client_core/ui/Select/index.tsx @@ -74,7 +74,7 @@ const Select = component( onChange(value, e, payload) - closeOnSelect && (selectRootProps.ref as RootRef).current.blur() + closeOnSelect && (selectRootProps.ref as RootRef).current!.blur() } @@ -162,7 +162,7 @@ const Select = component( onMouseDown={ e => { if (isActive) { e.preventDefault() - ;(selectRootProps.ref as RootRef).current.blur() + ;(selectRootProps.ref as RootRef).current!.blur() } } }> diff --git a/client_core/ui/_internals/ref_apply.ts b/client_core/ui/_internals/ref_apply.ts index 567745d..b663ef7 100644 --- a/client_core/ui/_internals/ref_apply.ts +++ b/client_core/ui/_internals/ref_apply.ts @@ -19,7 +19,7 @@ function applyRefApi< : undefined useEffect(() => { - getRef((rootProps.ref as React.RefObject).current, mergedProps) + getRef((rootProps.ref as React.RefObject).current!, mergedProps) }, trackDependencies) } } diff --git a/core/client_build/module_rules/postcss_svg2icon_plugin/icons_to_font.ts b/core/client_build/module_rules/postcss_svg2icon_plugin/icons_to_font.ts index 0814fad..a92b6f8 100644 --- a/core/client_build/module_rules/postcss_svg2icon_plugin/icons_to_font.ts +++ b/core/client_build/module_rules/postcss_svg2icon_plugin/icons_to_font.ts @@ -44,8 +44,7 @@ const convertSvgToFont: ConvertSvgToFontFn = ({ fontName, svgs, isWoff2 }) => ( }) fontStream.end() - }) -) + })) .then(svgFont => svg2ttf(svgFont, { ts: 0 }).buffer) .then(ttfFont => isWoff2 ? ttf2woff2(ttfFont as Buffer) : ttf2woff(ttfFont).buffer) diff --git a/global.d.ts b/global.d.ts index ff11725..143a9ec 100644 --- a/global.d.ts +++ b/global.d.ts @@ -1,8 +1,4 @@ declare module '*.sass' -// { -// const classes: Record -// export default classes -// } diff --git a/package-lock.json b/package-lock.json index d7a6558..f4e73cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "siegel", - "version": "0.15.5", + "version": "0.15.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "siegel", - "version": "0.15.5", + "version": "0.15.8", "license": "MIT", "dependencies": { "@eslint/js": "9.18.0", @@ -22,8 +22,8 @@ "mime": "4.0.6", "mini-css-extract-plugin": "2.9.2", "postcss-loader": "8.1.1", - "react": "19.0.0", - "react-dom": "19.0.0", + "react": "18.3.1", + "react-dom": "18.3.1", "react-refresh": "0.16.0", "sass": "1.83.4", "sass-loader": "16.0.4", @@ -57,8 +57,8 @@ "peerDependencies": { "@types/express": "4.17.21", "@types/node": "20.16.9", - "@types/react": "19.0.7", - "@types/react-dom": "19.0.3", + "@types/react": "18.3.12", + "@types/react-dom": "18.3.1", "@types/svg2ttf": "5.0.3", "@types/svgicons2svgfont": "14.0.0", "@types/ttf2woff": "2.0.4", @@ -2404,6 +2404,12 @@ "postcss": "^8.0.0" } }, + "node_modules/@types/prop-types": { + "version": "15.7.14", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.14.tgz", + "integrity": "sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ==", + "peer": true + }, "node_modules/@types/qs": { "version": "6.9.18", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.18.tgz", @@ -2417,21 +2423,22 @@ "peer": true }, "node_modules/@types/react": { - "version": "19.0.7", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.0.7.tgz", - "integrity": "sha512-MoFsEJKkAtZCrC1r6CM8U22GzhG7u2Wir8ons/aCKH6MBdD1ibV24zOSSkdZVUKqN5i396zG5VKLYZ3yaUZdLA==", + "version": "18.3.12", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.12.tgz", + "integrity": "sha512-D2wOSq/d6Agt28q7rSI3jhU7G6aiuzljDGZ2hTZHIkrTLUI+AF3WMeKkEZ9nN2fkBAlcktT6vcZjDFiIhMYEQw==", "peer": true, "dependencies": { + "@types/prop-types": "*", "csstype": "^3.0.2" } }, "node_modules/@types/react-dom": { - "version": "19.0.3", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.0.3.tgz", - "integrity": "sha512-0Knk+HJiMP/qOZgMyNFamlIjw9OFCsyC2ZbigmEEyXXixgre6IQpm/4V+r3qH4GC1JPvRJKInw+on2rV6YZLeA==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-qW1Mfv8taImTthu4KoXgDfLuk4bydU6Q/TkADnDWWHwi4NX4BR+LWfTp2sVmTqRrsHvyDDTelgelxJ+SsejKKQ==", "peer": true, - "peerDependencies": { - "@types/react": "^19.0.0" + "dependencies": { + "@types/react": "*" } }, "node_modules/@types/sax": { @@ -3702,9 +3709,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001692", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001692.tgz", - "integrity": "sha512-A95VKan0kdtrsnMubMKxEKUKImOPSuCpYgxSQBo036P5YYgVIcOYJEgt/txJWqObiRQeISNCfef9nvlQ0vbV7A==", + "version": "1.0.30001695", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001695.tgz", + "integrity": "sha512-vHyLade6wTgI2u1ec3WQBxv+2BrTERV28UXQu9LO6lZ9pYeMk34vjXFLOxo1A4UBA8XTL4njRQZdno/yYaSmWw==", "funding": [ { "type": "opencollective", @@ -8890,22 +8897,26 @@ } }, "node_modules/react": { - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/react/-/react-19.0.0.tgz", - "integrity": "sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "dependencies": { + "loose-envify": "^1.1.0" + }, "engines": { "node": ">=0.10.0" } }, "node_modules/react-dom": { - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.0.0.tgz", - "integrity": "sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "dependencies": { - "scheduler": "^0.25.0" + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" }, "peerDependencies": { - "react": "^19.0.0" + "react": "^18.3.1" } }, "node_modules/react-is": { @@ -9279,9 +9290,12 @@ "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==" }, "node_modules/scheduler": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0.tgz", - "integrity": "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==" + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "dependencies": { + "loose-envify": "^1.1.0" + } }, "node_modules/schema-utils": { "version": "4.3.0", diff --git a/package.json b/package.json index 253a526..58a1013 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "siegel", - "version": "0.15.6", + "version": "0.15.8", "homepage": "https://siegel-qe3q.onrender.com", "url": "https://github.com/CyberCookie/siegel", "bugs": "https://github.com/CyberCookie/siegel/issues", @@ -76,8 +76,8 @@ "mime": "4.0.6", "mini-css-extract-plugin": "2.9.2", "postcss-loader": "8.1.1", - "react": "19.0.0", - "react-dom": "19.0.0", + "react": "18.3.1", + "react-dom": "18.3.1", "react-refresh": "0.16.0", "sass": "1.83.4", "sass-loader": "16.0.4", @@ -104,8 +104,8 @@ "peerDependencies": { "@types/express": "4.17.21", "@types/node": "20.16.9", - "@types/react": "19.0.7", - "@types/react-dom": "19.0.3", + "@types/react": "18.3.12", + "@types/react-dom": "18.3.1", "@types/svg2ttf": "5.0.3", "@types/svgicons2svgfont": "14.0.0", "@types/ttf2woff": "2.0.4",