From 265c1d231120d8989b79740d256a62e5ddbb6db2 Mon Sep 17 00:00:00 2001 From: "SME\\avagy" Date: Mon, 4 Mar 2024 00:01:27 +0400 Subject: [PATCH] added typescript --- index.html | 29 ++-- package-lock.json | 141 +++++++++++++++++- package.json | 12 +- .../Comments/{index.js => index.tsx} | 0 src/components/Editor/{index.js => index.tsx} | 0 src/components/Footer/{index.js => index.tsx} | 0 .../Reactions/{index.js => index.tsx} | 0 src/{index.js => index.tsx} | 0 .../Comments/{index.js => index.tsx} | 0 .../Language/{index.js => index.tsx} | 0 .../Reactions/{index.js => index.tsx} | 0 .../Requests/{index.js => index.tsx} | 0 src/providers/Theme/{index.js => index.tsx} | 0 src/utils/{emotions.js => emotions.ts} | 0 tsconfig.json | 26 ++++ 15 files changed, 187 insertions(+), 21 deletions(-) rename src/components/Comments/{index.js => index.tsx} (100%) rename src/components/Editor/{index.js => index.tsx} (100%) rename src/components/Footer/{index.js => index.tsx} (100%) rename src/components/Reactions/{index.js => index.tsx} (100%) rename src/{index.js => index.tsx} (100%) rename src/providers/Comments/{index.js => index.tsx} (100%) rename src/providers/Language/{index.js => index.tsx} (100%) rename src/providers/Reactions/{index.js => index.tsx} (100%) rename src/providers/Requests/{index.js => index.tsx} (100%) rename src/providers/Theme/{index.js => index.tsx} (100%) rename src/utils/{emotions.js => emotions.ts} (100%) create mode 100644 tsconfig.json diff --git a/index.html b/index.html index 89f09d0..40dfdcd 100644 --- a/index.html +++ b/index.html @@ -1,16 +1,19 @@ + + + + Zoomment.com Widget + - - - - Zoomment.com Widget - - - -
- - - - \ No newline at end of file + +
+ + + diff --git a/package-lock.json b/package-lock.json index 08659d0..7d952f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,11 +25,16 @@ "devDependencies": { "@babel/core": "^7.22.9", "@babel/preset-env": "^7.22.9", + "@types/lscache": "^1.3.4", + "@types/react": "^18.2.61", + "@types/react-dom": "^18.2.19", + "@types/styled-components": "^5.1.34", "babel-core": "^6.26.3", "babel-plugin-module-resolver": "^4.1.0", "buffer": "^6.0.3", "parcel": "^2.12.0", - "process": "^0.11.10" + "process": "^0.11.10", + "typescript": "^5.3.3" } }, "node_modules/@ampproject/remapping": { @@ -4227,6 +4232,65 @@ "node": ">=10.13.0" } }, + "node_modules/@types/hoist-non-react-statics": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz", + "integrity": "sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==", + "dev": true, + "dependencies": { + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0" + } + }, + "node_modules/@types/lscache": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@types/lscache/-/lscache-1.3.4.tgz", + "integrity": "sha512-boZGIpx9t9lISW2EllC4APDwMQAouwViERSZU2T1p5gYs/SVM1ohq29+eBDb8g6D3FDPgeUsOALZIH0IGwLNvw==", + "dev": true + }, + "node_modules/@types/prop-types": { + "version": "15.7.11", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz", + "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==", + "dev": true + }, + "node_modules/@types/react": { + "version": "18.2.61", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.61.tgz", + "integrity": "sha512-NURTN0qNnJa7O/k4XUkEW2yfygA+NxS0V5h1+kp9jPwhzZy95q3ADoGMP0+JypMhrZBTTgjKAUlTctde1zzeQA==", + "dev": true, + "dependencies": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, + "node_modules/@types/react-dom": { + "version": "18.2.19", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.19.tgz", + "integrity": "sha512-aZvQL6uUbIJpjZk4U8JZGbau9KDeAwMfmhyWorxgBkqDIEf6ROjRozcmPIicqsUwPUjbkDfHKgGee1Lq65APcA==", + "dev": true, + "dependencies": { + "@types/react": "*" + } + }, + "node_modules/@types/scheduler": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz", + "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==", + "dev": true + }, + "node_modules/@types/styled-components": { + "version": "5.1.34", + "resolved": "https://registry.npmjs.org/@types/styled-components/-/styled-components-5.1.34.tgz", + "integrity": "sha512-mmiVvwpYklFIv9E8qfxuPyIt/OuyIrn6gMOAMOFUO3WJfSrSE+sGUoa4PiZj77Ut7bKZpaa6o1fBKS/4TOEvnA==", + "dev": true, + "dependencies": { + "@types/hoist-non-react-statics": "*", + "@types/react": "*", + "csstype": "^3.0.2" + } + }, "node_modules/abortcontroller-polyfill": { "version": "1.7.5", "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz", @@ -5031,6 +5095,12 @@ "optional": true, "peer": true }, + "node_modules/csstype": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "dev": true + }, "node_modules/dayjs": { "version": "1.11.9", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.9.tgz", @@ -6867,7 +6937,6 @@ "version": "5.3.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -9676,6 +9745,65 @@ "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==" }, + "@types/hoist-non-react-statics": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz", + "integrity": "sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==", + "dev": true, + "requires": { + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0" + } + }, + "@types/lscache": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@types/lscache/-/lscache-1.3.4.tgz", + "integrity": "sha512-boZGIpx9t9lISW2EllC4APDwMQAouwViERSZU2T1p5gYs/SVM1ohq29+eBDb8g6D3FDPgeUsOALZIH0IGwLNvw==", + "dev": true + }, + "@types/prop-types": { + "version": "15.7.11", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz", + "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==", + "dev": true + }, + "@types/react": { + "version": "18.2.61", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.61.tgz", + "integrity": "sha512-NURTN0qNnJa7O/k4XUkEW2yfygA+NxS0V5h1+kp9jPwhzZy95q3ADoGMP0+JypMhrZBTTgjKAUlTctde1zzeQA==", + "dev": true, + "requires": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, + "@types/react-dom": { + "version": "18.2.19", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.19.tgz", + "integrity": "sha512-aZvQL6uUbIJpjZk4U8JZGbau9KDeAwMfmhyWorxgBkqDIEf6ROjRozcmPIicqsUwPUjbkDfHKgGee1Lq65APcA==", + "dev": true, + "requires": { + "@types/react": "*" + } + }, + "@types/scheduler": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz", + "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==", + "dev": true + }, + "@types/styled-components": { + "version": "5.1.34", + "resolved": "https://registry.npmjs.org/@types/styled-components/-/styled-components-5.1.34.tgz", + "integrity": "sha512-mmiVvwpYklFIv9E8qfxuPyIt/OuyIrn6gMOAMOFUO3WJfSrSE+sGUoa4PiZj77Ut7bKZpaa6o1fBKS/4TOEvnA==", + "dev": true, + "requires": { + "@types/hoist-non-react-statics": "*", + "@types/react": "*", + "csstype": "^3.0.2" + } + }, "abortcontroller-polyfill": { "version": "1.7.5", "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz", @@ -10304,6 +10432,12 @@ } } }, + "csstype": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "dev": true + }, "dayjs": { "version": "1.11.9", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.9.tgz", @@ -11528,8 +11662,7 @@ "typescript": { "version": "5.3.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", - "peer": true + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==" }, "unicode-canonical-property-names-ecmascript": { "version": "2.0.0", diff --git a/package.json b/package.json index 4f2e539..5e1067a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,6 @@ "name": "zoomment-widget", "version": "1.0.0", "description": "", - "dependencies": { "@ant-design/icons": "^4.2.2", "@fingerprintjs/fingerprintjs": "^3.4.2", @@ -20,15 +19,20 @@ "devDependencies": { "@babel/core": "^7.22.9", "@babel/preset-env": "^7.22.9", + "@types/lscache": "^1.3.4", + "@types/react": "^18.2.61", + "@types/react-dom": "^18.2.19", + "@types/styled-components": "^5.1.34", "babel-core": "^6.26.3", "babel-plugin-module-resolver": "^4.1.0", "buffer": "^6.0.3", "parcel": "^2.12.0", - "process": "^0.11.10" + "process": "^0.11.10", + "typescript": "^5.3.3" }, "scripts": { - "start": "parcel index.html", - "build": "parcel build --no-source-maps --no-content-hash --target modern --dist-dir docs src/index.js", + "start": "parcel index.html --no-cache", + "build": "parcel build --no-source-maps --no-content-hash --target modern --dist-dir docs src/index.tsx", "help": "parcel build --help" }, "modern": "docs/zoomment.min.js", diff --git a/src/components/Comments/index.js b/src/components/Comments/index.tsx similarity index 100% rename from src/components/Comments/index.js rename to src/components/Comments/index.tsx diff --git a/src/components/Editor/index.js b/src/components/Editor/index.tsx similarity index 100% rename from src/components/Editor/index.js rename to src/components/Editor/index.tsx diff --git a/src/components/Footer/index.js b/src/components/Footer/index.tsx similarity index 100% rename from src/components/Footer/index.js rename to src/components/Footer/index.tsx diff --git a/src/components/Reactions/index.js b/src/components/Reactions/index.tsx similarity index 100% rename from src/components/Reactions/index.js rename to src/components/Reactions/index.tsx diff --git a/src/index.js b/src/index.tsx similarity index 100% rename from src/index.js rename to src/index.tsx diff --git a/src/providers/Comments/index.js b/src/providers/Comments/index.tsx similarity index 100% rename from src/providers/Comments/index.js rename to src/providers/Comments/index.tsx diff --git a/src/providers/Language/index.js b/src/providers/Language/index.tsx similarity index 100% rename from src/providers/Language/index.js rename to src/providers/Language/index.tsx diff --git a/src/providers/Reactions/index.js b/src/providers/Reactions/index.tsx similarity index 100% rename from src/providers/Reactions/index.js rename to src/providers/Reactions/index.tsx diff --git a/src/providers/Requests/index.js b/src/providers/Requests/index.tsx similarity index 100% rename from src/providers/Requests/index.js rename to src/providers/Requests/index.tsx diff --git a/src/providers/Theme/index.js b/src/providers/Theme/index.tsx similarity index 100% rename from src/providers/Theme/index.js rename to src/providers/Theme/index.tsx diff --git a/src/utils/emotions.js b/src/utils/emotions.ts similarity index 100% rename from src/utils/emotions.js rename to src/utils/emotions.ts diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..dda815d --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react", + "baseUrl": ".", + "paths": { + "components/*": ["src/components/*"], + "providers/*": ["src/providers/*"], + "utils/*": ["src/utils/*"], + "locales/*": ["src/locales/*"] + } + }, + "include": ["src"] +}