This commit is contained in:
parent
a22ea56b50
commit
05ff8493e4
6
.prettierrc
Normal file
6
.prettierrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false
|
||||||
|
}
|
@ -3,6 +3,8 @@ import globals from 'globals'
|
|||||||
import reactHooks from 'eslint-plugin-react-hooks'
|
import reactHooks from 'eslint-plugin-react-hooks'
|
||||||
import reactRefresh from 'eslint-plugin-react-refresh'
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||||
import tseslint from 'typescript-eslint'
|
import tseslint from 'typescript-eslint'
|
||||||
|
import eslintConfigPrettier from 'eslint-config-prettier'
|
||||||
|
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
|
||||||
|
|
||||||
export default tseslint.config(
|
export default tseslint.config(
|
||||||
{ ignores: ['dist'] },
|
{ ignores: ['dist'] },
|
||||||
@ -25,4 +27,6 @@ export default tseslint.config(
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
eslintConfigPrettier,
|
||||||
|
eslintPluginPrettierRecommended,
|
||||||
)
|
)
|
||||||
|
@ -32,9 +32,12 @@
|
|||||||
"@types/react-dom": "^18.3.1",
|
"@types/react-dom": "^18.3.1",
|
||||||
"@vitejs/plugin-react-swc": "^3.5.0",
|
"@vitejs/plugin-react-swc": "^3.5.0",
|
||||||
"eslint": "^9.13.0",
|
"eslint": "^9.13.0",
|
||||||
|
"eslint-config-prettier": "^10.0.1",
|
||||||
|
"eslint-plugin-prettier": "^5.2.2",
|
||||||
"eslint-plugin-react-hooks": "^5.0.0",
|
"eslint-plugin-react-hooks": "^5.0.0",
|
||||||
"eslint-plugin-react-refresh": "^0.4.13",
|
"eslint-plugin-react-refresh": "^0.4.13",
|
||||||
"globals": "^15.11.0",
|
"globals": "^15.11.0",
|
||||||
|
"monaco-editor": "^0.52.2",
|
||||||
"sass-embedded": "^1.80.4",
|
"sass-embedded": "^1.80.4",
|
||||||
"sharp": "^0.33.5",
|
"sharp": "^0.33.5",
|
||||||
"typescript": "~5.6.2",
|
"typescript": "~5.6.2",
|
||||||
|
95
pnpm-lock.yaml
generated
95
pnpm-lock.yaml
generated
@ -13,7 +13,7 @@ importers:
|
|||||||
version: 5.1.1
|
version: 5.1.1
|
||||||
'@monaco-editor/react':
|
'@monaco-editor/react':
|
||||||
specifier: ^4.6.0
|
specifier: ^4.6.0
|
||||||
version: 4.6.0(monaco-editor@0.52.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
version: 4.6.0(monaco-editor@0.52.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
'@uidotdev/usehooks':
|
'@uidotdev/usehooks':
|
||||||
specifier: ^2.4.1
|
specifier: ^2.4.1
|
||||||
version: 2.4.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
version: 2.4.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
@ -69,6 +69,12 @@ importers:
|
|||||||
eslint:
|
eslint:
|
||||||
specifier: ^9.13.0
|
specifier: ^9.13.0
|
||||||
version: 9.13.0
|
version: 9.13.0
|
||||||
|
eslint-config-prettier:
|
||||||
|
specifier: ^10.0.1
|
||||||
|
version: 10.0.1(eslint@9.13.0)
|
||||||
|
eslint-plugin-prettier:
|
||||||
|
specifier: ^5.2.2
|
||||||
|
version: 5.2.2(eslint-config-prettier@10.0.1(eslint@9.13.0))(eslint@9.13.0)(prettier@3.4.2)
|
||||||
eslint-plugin-react-hooks:
|
eslint-plugin-react-hooks:
|
||||||
specifier: ^5.0.0
|
specifier: ^5.0.0
|
||||||
version: 5.0.0(eslint@9.13.0)
|
version: 5.0.0(eslint@9.13.0)
|
||||||
@ -78,6 +84,9 @@ importers:
|
|||||||
globals:
|
globals:
|
||||||
specifier: ^15.11.0
|
specifier: ^15.11.0
|
||||||
version: 15.11.0
|
version: 15.11.0
|
||||||
|
monaco-editor:
|
||||||
|
specifier: ^0.52.2
|
||||||
|
version: 0.52.2
|
||||||
sass-embedded:
|
sass-embedded:
|
||||||
specifier: ^1.80.4
|
specifier: ^1.80.4
|
||||||
version: 1.80.4
|
version: 1.80.4
|
||||||
@ -443,6 +452,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
|
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
|
||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
|
|
||||||
|
'@pkgr/core@0.1.1':
|
||||||
|
resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==}
|
||||||
|
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
|
||||||
|
|
||||||
'@rollup/rollup-android-arm-eabi@4.24.0':
|
'@rollup/rollup-android-arm-eabi@4.24.0':
|
||||||
resolution: {integrity: sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==}
|
resolution: {integrity: sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
@ -805,6 +818,26 @@ packages:
|
|||||||
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
|
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
|
eslint-config-prettier@10.0.1:
|
||||||
|
resolution: {integrity: sha512-lZBts941cyJyeaooiKxAtzoPHTN+GbQTJFAIdQbRhA4/8whaAraEh47Whw/ZFfrjNSnlAxqfm9i0XVAEkULjCw==}
|
||||||
|
hasBin: true
|
||||||
|
peerDependencies:
|
||||||
|
eslint: '>=7.0.0'
|
||||||
|
|
||||||
|
eslint-plugin-prettier@5.2.2:
|
||||||
|
resolution: {integrity: sha512-1yI3/hf35wmlq66C8yOyrujQnel+v5l1Vop5Cl2I6ylyNTT1JbuUUnV3/41PzwTzcyDp/oF0jWE3HXvcH5AQOQ==}
|
||||||
|
engines: {node: ^14.18.0 || >=16.0.0}
|
||||||
|
peerDependencies:
|
||||||
|
'@types/eslint': '>=8.0.0'
|
||||||
|
eslint: '>=8.0.0'
|
||||||
|
eslint-config-prettier: '*'
|
||||||
|
prettier: '>=3.0.0'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@types/eslint':
|
||||||
|
optional: true
|
||||||
|
eslint-config-prettier:
|
||||||
|
optional: true
|
||||||
|
|
||||||
eslint-plugin-react-hooks@5.0.0:
|
eslint-plugin-react-hooks@5.0.0:
|
||||||
resolution: {integrity: sha512-hIOwI+5hYGpJEc4uPRmz2ulCjAGD/N13Lukkh8cLV0i2IRk/bdZDYjgLVHj+U9Z704kLIdIO6iueGvxNur0sgw==}
|
resolution: {integrity: sha512-hIOwI+5hYGpJEc4uPRmz2ulCjAGD/N13Lukkh8cLV0i2IRk/bdZDYjgLVHj+U9Z704kLIdIO6iueGvxNur0sgw==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
@ -861,6 +894,9 @@ packages:
|
|||||||
fast-deep-equal@3.1.3:
|
fast-deep-equal@3.1.3:
|
||||||
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
||||||
|
|
||||||
|
fast-diff@1.3.0:
|
||||||
|
resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==}
|
||||||
|
|
||||||
fast-glob@3.3.2:
|
fast-glob@3.3.2:
|
||||||
resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==}
|
resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==}
|
||||||
engines: {node: '>=8.6.0'}
|
engines: {node: '>=8.6.0'}
|
||||||
@ -1028,8 +1064,8 @@ packages:
|
|||||||
moment@2.30.1:
|
moment@2.30.1:
|
||||||
resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==}
|
resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==}
|
||||||
|
|
||||||
monaco-editor@0.52.0:
|
monaco-editor@0.52.2:
|
||||||
resolution: {integrity: sha512-OeWhNpABLCeTqubfqLMXGsqf6OmPU6pHM85kF3dhy6kq5hnhuVS1p3VrEW/XhWHc71P2tHyS5JFySD8mgs1crw==}
|
resolution: {integrity: sha512-GEQWEZmfkOGLdd3XK8ryrfWz3AIP8YymVXiPHEdewrUq7mh0qrKrfHLNCXcbB6sTnMLnOZ3ztSiKcciFUkIJwQ==}
|
||||||
|
|
||||||
ms@2.1.3:
|
ms@2.1.3:
|
||||||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||||
@ -1094,6 +1130,15 @@ packages:
|
|||||||
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
||||||
engines: {node: '>= 0.8.0'}
|
engines: {node: '>= 0.8.0'}
|
||||||
|
|
||||||
|
prettier-linter-helpers@1.0.0:
|
||||||
|
resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==}
|
||||||
|
engines: {node: '>=6.0.0'}
|
||||||
|
|
||||||
|
prettier@3.4.2:
|
||||||
|
resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==}
|
||||||
|
engines: {node: '>=14'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
punycode@2.3.1:
|
punycode@2.3.1:
|
||||||
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
|
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
@ -1330,6 +1375,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==}
|
resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
|
synckit@0.9.2:
|
||||||
|
resolution: {integrity: sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==}
|
||||||
|
engines: {node: ^14.18.0 || >=16.0.0}
|
||||||
|
|
||||||
text-table@0.2.0:
|
text-table@0.2.0:
|
||||||
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
|
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
|
||||||
|
|
||||||
@ -1655,15 +1704,15 @@ snapshots:
|
|||||||
'@img/sharp-win32-x64@0.33.5':
|
'@img/sharp-win32-x64@0.33.5':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@monaco-editor/loader@1.4.0(monaco-editor@0.52.0)':
|
'@monaco-editor/loader@1.4.0(monaco-editor@0.52.2)':
|
||||||
dependencies:
|
dependencies:
|
||||||
monaco-editor: 0.52.0
|
monaco-editor: 0.52.2
|
||||||
state-local: 1.0.7
|
state-local: 1.0.7
|
||||||
|
|
||||||
'@monaco-editor/react@4.6.0(monaco-editor@0.52.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
|
'@monaco-editor/react@4.6.0(monaco-editor@0.52.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@monaco-editor/loader': 1.4.0(monaco-editor@0.52.0)
|
'@monaco-editor/loader': 1.4.0(monaco-editor@0.52.2)
|
||||||
monaco-editor: 0.52.0
|
monaco-editor: 0.52.2
|
||||||
react: 18.3.1
|
react: 18.3.1
|
||||||
react-dom: 18.3.1(react@18.3.1)
|
react-dom: 18.3.1(react@18.3.1)
|
||||||
|
|
||||||
@ -1679,6 +1728,8 @@ snapshots:
|
|||||||
'@nodelib/fs.scandir': 2.1.5
|
'@nodelib/fs.scandir': 2.1.5
|
||||||
fastq: 1.17.1
|
fastq: 1.17.1
|
||||||
|
|
||||||
|
'@pkgr/core@0.1.1': {}
|
||||||
|
|
||||||
'@rollup/rollup-android-arm-eabi@4.24.0':
|
'@rollup/rollup-android-arm-eabi@4.24.0':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
@ -2017,6 +2068,19 @@ snapshots:
|
|||||||
|
|
||||||
escape-string-regexp@4.0.0: {}
|
escape-string-regexp@4.0.0: {}
|
||||||
|
|
||||||
|
eslint-config-prettier@10.0.1(eslint@9.13.0):
|
||||||
|
dependencies:
|
||||||
|
eslint: 9.13.0
|
||||||
|
|
||||||
|
eslint-plugin-prettier@5.2.2(eslint-config-prettier@10.0.1(eslint@9.13.0))(eslint@9.13.0)(prettier@3.4.2):
|
||||||
|
dependencies:
|
||||||
|
eslint: 9.13.0
|
||||||
|
prettier: 3.4.2
|
||||||
|
prettier-linter-helpers: 1.0.0
|
||||||
|
synckit: 0.9.2
|
||||||
|
optionalDependencies:
|
||||||
|
eslint-config-prettier: 10.0.1(eslint@9.13.0)
|
||||||
|
|
||||||
eslint-plugin-react-hooks@5.0.0(eslint@9.13.0):
|
eslint-plugin-react-hooks@5.0.0(eslint@9.13.0):
|
||||||
dependencies:
|
dependencies:
|
||||||
eslint: 9.13.0
|
eslint: 9.13.0
|
||||||
@ -2094,6 +2158,8 @@ snapshots:
|
|||||||
|
|
||||||
fast-deep-equal@3.1.3: {}
|
fast-deep-equal@3.1.3: {}
|
||||||
|
|
||||||
|
fast-diff@1.3.0: {}
|
||||||
|
|
||||||
fast-glob@3.3.2:
|
fast-glob@3.3.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@nodelib/fs.stat': 2.0.5
|
'@nodelib/fs.stat': 2.0.5
|
||||||
@ -2232,7 +2298,7 @@ snapshots:
|
|||||||
|
|
||||||
moment@2.30.1: {}
|
moment@2.30.1: {}
|
||||||
|
|
||||||
monaco-editor@0.52.0: {}
|
monaco-editor@0.52.2: {}
|
||||||
|
|
||||||
ms@2.1.3: {}
|
ms@2.1.3: {}
|
||||||
|
|
||||||
@ -2289,6 +2355,12 @@ snapshots:
|
|||||||
|
|
||||||
prelude-ls@1.2.1: {}
|
prelude-ls@1.2.1: {}
|
||||||
|
|
||||||
|
prettier-linter-helpers@1.0.0:
|
||||||
|
dependencies:
|
||||||
|
fast-diff: 1.3.0
|
||||||
|
|
||||||
|
prettier@3.4.2: {}
|
||||||
|
|
||||||
punycode@2.3.1: {}
|
punycode@2.3.1: {}
|
||||||
|
|
||||||
queue-microtask@1.2.3: {}
|
queue-microtask@1.2.3: {}
|
||||||
@ -2518,6 +2590,11 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
has-flag: 4.0.0
|
has-flag: 4.0.0
|
||||||
|
|
||||||
|
synckit@0.9.2:
|
||||||
|
dependencies:
|
||||||
|
'@pkgr/core': 0.1.1
|
||||||
|
tslib: 2.8.0
|
||||||
|
|
||||||
text-table@0.2.0: {}
|
text-table@0.2.0: {}
|
||||||
|
|
||||||
to-regex-range@5.0.1:
|
to-regex-range@5.0.1:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { FC, ReactNode } from "react";
|
import { FC, ReactNode } from 'react'
|
||||||
|
|
||||||
import style from './style.module.scss'
|
import style from './style.module.scss'
|
||||||
|
|
||||||
@ -6,7 +6,6 @@ interface AppLayoutProp {
|
|||||||
children?: ReactNode
|
children?: ReactNode
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AppLayout: FC<AppLayoutProp> = ({ children }) =>
|
export const AppLayout: FC<AppLayoutProp> = ({ children }) => (
|
||||||
<div className={style.container}>
|
<div className={style.container}>{children}</div>
|
||||||
{children}
|
)
|
||||||
</div>
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { FC } from "react";
|
import { FC } from 'react'
|
||||||
import { AppLayout } from "./AppLayout";
|
import { AppLayout } from './AppLayout'
|
||||||
import { Editor } from "../Editor";
|
import { Editor } from '../Editor'
|
||||||
import { TransformGrid } from "../TransformGrid";
|
import { TransformGrid } from '../TransformGrid'
|
||||||
|
|
||||||
export const App: FC = () =>
|
export const App: FC = () => (
|
||||||
<AppLayout>
|
<AppLayout>
|
||||||
<Editor />
|
<Editor />
|
||||||
<TransformGrid />
|
<TransformGrid />
|
||||||
</AppLayout>
|
</AppLayout>
|
||||||
|
)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import styled from "styled-components";
|
import styled from 'styled-components'
|
||||||
|
|
||||||
export const Button = styled.button`
|
export const Button = styled.button`
|
||||||
border: none;
|
border: none;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import styled from "styled-components";
|
import styled from 'styled-components'
|
||||||
|
|
||||||
export const Input = styled.input`
|
export const Input = styled.input`
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
@ -12,7 +12,7 @@ export const Input = styled.input`
|
|||||||
|
|
||||||
width: 24px;
|
width: 24px;
|
||||||
|
|
||||||
&[type=checkbox] {
|
&[type='checkbox'] {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import styled from "styled-components";
|
import styled from 'styled-components'
|
||||||
|
|
||||||
export const TextArea = styled.textarea`
|
export const TextArea = styled.textarea`
|
||||||
border: none;
|
border: none;
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import { createRef, FC, useEffect, useRef } from "react";
|
import { createRef, FC, useEffect, useRef } from 'react'
|
||||||
import { Editor as MonacoEditor } from "@monaco-editor/react";
|
import { Editor as MonacoEditor } from '@monaco-editor/react'
|
||||||
import { useRecoilState } from "recoil";
|
import { useRecoilState } from 'recoil'
|
||||||
import { EditorValueState } from "../GlobalStates/EditorValueState";
|
import { EditorValueState } from '../GlobalStates/EditorValueState'
|
||||||
import { motion } from "framer-motion";
|
import { motion } from 'framer-motion'
|
||||||
import { VERSION } from "../version";
|
import { VERSION } from '../version'
|
||||||
|
import { editor } from 'monaco-editor'
|
||||||
|
|
||||||
import style from "./style.module.scss";
|
import style from './style.module.scss'
|
||||||
|
|
||||||
export const Editor: FC = () => {
|
export const Editor: FC = () => {
|
||||||
const [value, setValue] = useRecoilState(EditorValueState)
|
const [value, setValue] = useRecoilState(EditorValueState)
|
||||||
const ref = useRef<any>()
|
const ref = useRef<editor.IStandaloneCodeEditor>()
|
||||||
const containerRef = createRef<HTMLDivElement>()
|
const containerRef = createRef<HTMLDivElement>()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -20,11 +21,11 @@ export const Editor: FC = () => {
|
|||||||
const rect = containerRef.current?.getBoundingClientRect()
|
const rect = containerRef.current?.getBoundingClientRect()
|
||||||
ref.current?.layout({
|
ref.current?.layout({
|
||||||
width: rect?.width ?? 0,
|
width: rect?.width ?? 0,
|
||||||
height: rect?.height ?? 0
|
height: rect?.height ?? 0,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}, [])
|
}, [containerRef])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
@ -32,33 +33,37 @@ export const Editor: FC = () => {
|
|||||||
ref={containerRef}
|
ref={containerRef}
|
||||||
transition={{ delay: 1.5 }}
|
transition={{ delay: 1.5 }}
|
||||||
initial={{ opacity: 0 }}
|
initial={{ opacity: 0 }}
|
||||||
animate={{ opacity: 1 }}>
|
animate={{ opacity: 1 }}
|
||||||
|
>
|
||||||
<MonacoEditor
|
<MonacoEditor
|
||||||
loading={<></>}
|
loading={<></>}
|
||||||
value={value}
|
value={value}
|
||||||
language="yaml"
|
language="yaml"
|
||||||
onMount={(v) => ref.current = v}
|
onMount={(v) => (ref.current = v)}
|
||||||
onChange={(v) => setValue(v ?? '')}
|
onChange={(v) => setValue(v ?? '')}
|
||||||
options={{
|
options={{
|
||||||
automaticLayout: true,
|
automaticLayout: true,
|
||||||
lineNumbersMinChars: 3,
|
lineNumbersMinChars: 3,
|
||||||
minimap: { enabled: false },
|
minimap: { enabled: false },
|
||||||
theme: "vs-dark",
|
theme: 'vs-dark',
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
fontFamily: 'JetBrains Mono Variable',
|
fontFamily: 'JetBrains Mono Variable',
|
||||||
fontLigatures: true,
|
fontLigatures: true,
|
||||||
wordWrap: "on",
|
wordWrap: 'on',
|
||||||
mouseWheelZoom: true,
|
mouseWheelZoom: true,
|
||||||
smoothScrolling: true,
|
smoothScrolling: true,
|
||||||
cursorSmoothCaretAnimation: 'on',
|
cursorSmoothCaretAnimation: 'on',
|
||||||
cursorBlinking: 'smooth',
|
cursorBlinking: 'smooth',
|
||||||
cursorStyle: 'line'
|
cursorStyle: 'line',
|
||||||
}}
|
}}
|
||||||
theme="vs-dark" />
|
theme="vs-dark"
|
||||||
|
/>
|
||||||
|
|
||||||
<div className={style.credit}>
|
<div className={style.credit}>
|
||||||
<div className={style.creditstr}>
|
<div className={style.creditstr}>
|
||||||
<p><b>The PTOOLS</b></p>
|
<p>
|
||||||
|
<b>The PTOOLS</b>
|
||||||
|
</p>
|
||||||
<p>v2-{VERSION}</p>
|
<p>v2-{VERSION}</p>
|
||||||
<p>© Minhyeok Park</p>
|
<p>© Minhyeok Park</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
import { atom } from "recoil";
|
import { atom } from 'recoil'
|
||||||
|
|
||||||
export const EditorValueState = atom({
|
export const EditorValueState = atom({
|
||||||
key: 'editor_value',
|
key: 'editor_value',
|
||||||
default: JSON.stringify({
|
default: JSON.stringify(
|
||||||
Hello: 'world!'
|
{
|
||||||
}, null, 2)
|
Hello: 'world!',
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
2,
|
||||||
|
),
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { FC, useEffect, useState } from "react";
|
import { FC, useEffect, useState } from 'react'
|
||||||
import { AnimatePresence, motion, TargetAndTransition } from 'framer-motion'
|
import { AnimatePresence, motion, TargetAndTransition } from 'framer-motion'
|
||||||
|
|
||||||
import style from './style.module.scss'
|
import style from './style.module.scss'
|
||||||
@ -7,7 +7,7 @@ import Suika from '../Assets/favicon.webp'
|
|||||||
export const LandingAnimation: FC = () => {
|
export const LandingAnimation: FC = () => {
|
||||||
const [isVisible, setVisible] = useState(true)
|
const [isVisible, setVisible] = useState(true)
|
||||||
const exitAnimation: TargetAndTransition = {
|
const exitAnimation: TargetAndTransition = {
|
||||||
opacity: 0
|
opacity: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
import { FC } from "react";
|
import { FC } from 'react'
|
||||||
import { motion } from "framer-motion";
|
import { motion } from 'framer-motion'
|
||||||
|
|
||||||
import style from './style.module.scss'
|
import style from './style.module.scss'
|
||||||
import { TransformGridItem } from "../TransformGridItem";
|
import { TransformGridItem } from '../TransformGridItem'
|
||||||
import { transforms, wrapTransform } from "../Transforms/Transform";
|
import { transforms, wrapTransform } from '../Transforms/Transform'
|
||||||
|
|
||||||
export const TransformGrid: FC = () =>
|
export const TransformGrid: FC = () => (
|
||||||
<ul className={style.grid}>
|
<ul className={style.grid}>
|
||||||
{transforms.map((transform, i) =>
|
{transforms.map((transform, i) => (
|
||||||
<motion.li
|
<motion.li
|
||||||
key={i}
|
key={i}
|
||||||
initial={{ opacity: 0 }}
|
initial={{ opacity: 0 }}
|
||||||
animate={{ opacity: 1 }}
|
animate={{ opacity: 1 }}
|
||||||
transition={{ delay: i * 0.1 + 1.5 }} >
|
transition={{ delay: i * 0.1 + 1.5 }}
|
||||||
|
>
|
||||||
<TransformGridItem
|
<TransformGridItem transform={wrapTransform(transform)} />
|
||||||
transform={wrapTransform(transform)}/>
|
|
||||||
|
|
||||||
</motion.li>
|
</motion.li>
|
||||||
)}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
)
|
||||||
|
@ -1,22 +1,25 @@
|
|||||||
import { ChangeEvent, FC, useEffect, useState } from "react";
|
// src/components/TransformGridItem.tsx
|
||||||
|
|
||||||
|
import { ChangeEvent, FC, useEffect, useState } from 'react'
|
||||||
import style from './style.module.scss'
|
import style from './style.module.scss'
|
||||||
import { Button } from "../Components/Button";
|
import { Button } from '../Components/Button'
|
||||||
import { Input } from "../Components/Input";
|
import { Input } from '../Components/Input'
|
||||||
import { TextArea } from "../Components/TextArea";
|
// Remove TextArea import as it's no longer used
|
||||||
import clsx from "clsx";
|
import clsx from 'clsx'
|
||||||
import { useRecoilState } from "recoil";
|
import { useRecoilState } from 'recoil'
|
||||||
import { EditorValueState } from "../GlobalStates/EditorValueState";
|
import { EditorValueState } from '../GlobalStates/EditorValueState'
|
||||||
import {
|
import {
|
||||||
TransformCheckboxOption,
|
TransformCheckboxOption,
|
||||||
TransformIntboxOption,
|
TransformIntboxOption,
|
||||||
TransformRadioOption,
|
TransformRadioOption,
|
||||||
TransformTextboxOption,
|
TransformTextboxOption,
|
||||||
WrappedTransform,
|
WrappedTransform,
|
||||||
WrappedTransformResult
|
WrappedTransformResult,
|
||||||
} from "../Transforms/Transform";
|
} from '../Transforms/Transform'
|
||||||
import { useLocalStorage } from "@uidotdev/usehooks";
|
import { useLocalStorage } from '@uidotdev/usehooks'
|
||||||
import { AnimatePresence, motion } from "framer-motion";
|
import { AnimatePresence, motion } from 'framer-motion'
|
||||||
import { Tooltip } from 'react-tooltip'
|
import { Tooltip } from 'react-tooltip'
|
||||||
|
import { TextArea } from '../Components/TextArea'
|
||||||
|
|
||||||
interface TransformGridItemProp {
|
interface TransformGridItemProp {
|
||||||
transform: WrappedTransform
|
transform: WrappedTransform
|
||||||
@ -25,10 +28,13 @@ interface TransformGridItemProp {
|
|||||||
export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
||||||
const [value, setValue] = useRecoilState(EditorValueState)
|
const [value, setValue] = useRecoilState(EditorValueState)
|
||||||
const [options, setOptions] = useState(transform.options)
|
const [options, setOptions] = useState(transform.options)
|
||||||
const [closedToggle, setClosedToggle] = useLocalStorage(`transform_closed__${transform.name}`, false)
|
const [closedToggle, setClosedToggle] = useLocalStorage(
|
||||||
|
`transform_closed__${transform.name}`,
|
||||||
|
false,
|
||||||
|
)
|
||||||
const [result, setResult] = useState<WrappedTransformResult>({
|
const [result, setResult] = useState<WrappedTransformResult>({
|
||||||
error: false,
|
error: false,
|
||||||
value: ''
|
value: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
const previewDisabled = value.length > 30000
|
const previewDisabled = value.length > 30000
|
||||||
@ -41,59 +47,64 @@ export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
|||||||
setResult(result)
|
setResult(result)
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
setResult({ error: true, value: error.toString() })
|
||||||
|
return { error: true, value: error.toString() }
|
||||||
|
})
|
||||||
|
|
||||||
// trigger transform when value, option or closed state changed
|
// Trigger transform when value, option or closed state changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (previewDisabled)
|
if (previewDisabled) return
|
||||||
return
|
|
||||||
|
|
||||||
triggerTransform()
|
transform
|
||||||
}, [value, options, closed])
|
.fn(value, options)
|
||||||
|
.then(setResult.bind(this))
|
||||||
|
.catch((error) => setResult({ error: true, value: error.toString() }))
|
||||||
|
}, [value, options, closed, previewDisabled, transform])
|
||||||
|
|
||||||
// reset error state when option changed
|
// Reset error state when options change
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!previewDisabled)
|
if (!previewDisabled) return
|
||||||
return
|
|
||||||
|
|
||||||
setResult({
|
setResult({
|
||||||
error: false,
|
error: false,
|
||||||
value: ''
|
value: '',
|
||||||
})
|
})
|
||||||
}, [options])
|
}, [options, previewDisabled])
|
||||||
|
|
||||||
// forcely disable preview when value is longer than 30,000 chars
|
// Force disable preview when value is longer than 30,000 chars
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (previewDisabled) {
|
if (previewDisabled) {
|
||||||
setResult({
|
setResult({
|
||||||
error: false,
|
error: false,
|
||||||
value: ''
|
value: '',
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerTransform()
|
transform
|
||||||
}, [value])
|
.fn(value, options)
|
||||||
|
.then(setResult.bind(this))
|
||||||
|
.catch((error) => setResult({ error: true, value: error.toString() }))
|
||||||
|
}, [value, previewDisabled, transform, options])
|
||||||
|
|
||||||
const onCheckboxOptionChanged =
|
const onCheckboxOptionChanged =
|
||||||
(option: TransformCheckboxOption) =>
|
(option: TransformCheckboxOption) =>
|
||||||
(event: ChangeEvent<HTMLInputElement>) => {
|
(event: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
|
||||||
options.set(option.key, {
|
options.set(option.key, {
|
||||||
...option,
|
...option,
|
||||||
value: event.target.checked
|
value: event.target.checked,
|
||||||
})
|
})
|
||||||
|
|
||||||
setOptions(new Map(options))
|
setOptions(new Map(options))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const onTextboxOptionChanged =
|
const onTextboxOptionChanged =
|
||||||
(option: TransformTextboxOption) =>
|
(option: TransformTextboxOption) =>
|
||||||
(event: ChangeEvent<HTMLInputElement>) => {
|
(event: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
|
||||||
options.set(option.key, {
|
options.set(option.key, {
|
||||||
...option,
|
...option,
|
||||||
value: event.target.value
|
value: event.target.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
setOptions(new Map(options))
|
setOptions(new Map(options))
|
||||||
@ -102,10 +113,9 @@ export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
|||||||
const onIntboxOptionChanged =
|
const onIntboxOptionChanged =
|
||||||
(option: TransformIntboxOption) =>
|
(option: TransformIntboxOption) =>
|
||||||
(event: ChangeEvent<HTMLInputElement>) => {
|
(event: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
|
||||||
options.set(option.key, {
|
options.set(option.key, {
|
||||||
...option,
|
...option,
|
||||||
value: parseInt(event.target.value)
|
value: parseInt(event.target.value),
|
||||||
})
|
})
|
||||||
|
|
||||||
setOptions(new Map(options))
|
setOptions(new Map(options))
|
||||||
@ -114,28 +124,24 @@ export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
|||||||
const onRadioOptionChanged =
|
const onRadioOptionChanged =
|
||||||
(option: TransformRadioOption) =>
|
(option: TransformRadioOption) =>
|
||||||
(event: ChangeEvent<HTMLInputElement>) => {
|
(event: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
|
||||||
options.set(option.key, {
|
options.set(option.key, {
|
||||||
...option,
|
...option,
|
||||||
value: event.target.value
|
value: event.target.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
setOptions(new Map(options))
|
setOptions(new Map(options))
|
||||||
}
|
}
|
||||||
|
|
||||||
const onForwardButtonPressed = async () => {
|
const onForwardButtonPressed = async () => {
|
||||||
const result =
|
const result = await triggerTransform()
|
||||||
await triggerTransform()
|
|
||||||
|
|
||||||
if (result.error)
|
if (result.error) return
|
||||||
return
|
|
||||||
|
|
||||||
setValue(result.value)
|
setValue(result.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onLabelClicked = async () => {
|
const onLabelClicked = async () => {
|
||||||
if (previewDisabled)
|
if (previewDisabled) return
|
||||||
return
|
|
||||||
|
|
||||||
setClosedToggle(!closed)
|
setClosedToggle(!closed)
|
||||||
}
|
}
|
||||||
@ -144,22 +150,23 @@ export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
|||||||
<div className={clsx(style.item, closed && style.closed)}>
|
<div className={clsx(style.item, closed && style.closed)}>
|
||||||
<div className={style.toolbar}>
|
<div className={style.toolbar}>
|
||||||
<div data-tooltip-id={`${transform.name}-tooltip`}>
|
<div data-tooltip-id={`${transform.name}-tooltip`}>
|
||||||
<Button
|
<Button disabled={result.error} onClick={onForwardButtonPressed}>
|
||||||
disabled={result.error}
|
|
||||||
onClick={onForwardButtonPressed}>
|
|
||||||
|
|
||||||
<<<
|
<<<
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Tooltip className={style.error} id={`${transform.name}-tooltip`} place="bottom">
|
<Tooltip
|
||||||
|
className={style.error}
|
||||||
|
id={`${transform.name}-tooltip`}
|
||||||
|
place="bottom"
|
||||||
|
>
|
||||||
{previewDisabled && result.error && result.value}
|
{previewDisabled && result.error && result.value}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
<h2
|
<h2
|
||||||
onClick={onLabelClicked}
|
onClick={onLabelClicked}
|
||||||
className={clsx(style.name, previewDisabled && style.previewDisabled)}>
|
className={clsx(style.name, previewDisabled && style.previewDisabled)}
|
||||||
|
>
|
||||||
{transform.name}
|
{transform.name}
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
@ -173,8 +180,10 @@ export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
|||||||
<Input
|
<Input
|
||||||
checked={option.value}
|
checked={option.value}
|
||||||
onChange={onCheckboxOptionChanged(option)}
|
onChange={onCheckboxOptionChanged(option)}
|
||||||
type="checkbox" />
|
type="checkbox"
|
||||||
</label>))}
|
/>
|
||||||
|
</label>
|
||||||
|
))}
|
||||||
|
|
||||||
{[...options.values()]
|
{[...options.values()]
|
||||||
?.filter((v) => v.type === 'TEXTBOX')
|
?.filter((v) => v.type === 'TEXTBOX')
|
||||||
@ -185,9 +194,10 @@ export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
|||||||
<Input
|
<Input
|
||||||
value={option.value}
|
value={option.value}
|
||||||
onChange={onTextboxOptionChanged(option)}
|
onChange={onTextboxOptionChanged(option)}
|
||||||
type="text" />
|
type="text"
|
||||||
</label>))}
|
/>
|
||||||
|
</label>
|
||||||
|
))}
|
||||||
|
|
||||||
{[...options.values()]
|
{[...options.values()]
|
||||||
?.filter((v) => v.type === 'INTBOX')
|
?.filter((v) => v.type === 'INTBOX')
|
||||||
@ -199,9 +209,10 @@ export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
|||||||
min={1}
|
min={1}
|
||||||
value={option.value}
|
value={option.value}
|
||||||
onChange={onIntboxOptionChanged(option)}
|
onChange={onIntboxOptionChanged(option)}
|
||||||
type="number" />
|
type="number"
|
||||||
</label>))}
|
/>
|
||||||
|
</label>
|
||||||
|
))}
|
||||||
|
|
||||||
{[...options.values()]
|
{[...options.values()]
|
||||||
?.filter((v) => v.type === 'RADIO')
|
?.filter((v) => v.type === 'RADIO')
|
||||||
@ -209,7 +220,8 @@ export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
|||||||
<div
|
<div
|
||||||
key={i}
|
key={i}
|
||||||
onChange={onRadioOptionChanged(option)}
|
onChange={onRadioOptionChanged(option)}
|
||||||
className={style.optionItem}>
|
className={style.optionItem}
|
||||||
|
>
|
||||||
{option.radios.map((radio, i2) => (
|
{option.radios.map((radio, i2) => (
|
||||||
<label key={i2}>
|
<label key={i2}>
|
||||||
<p>{radio.label ?? radio.value}:</p>
|
<p>{radio.label ?? radio.value}:</p>
|
||||||
@ -219,28 +231,31 @@ export const TransformGridItem: FC<TransformGridItemProp> = ({ transform }) => {
|
|||||||
name={option.key}
|
name={option.key}
|
||||||
defaultChecked={radio.value === option.value}
|
defaultChecked={radio.value === option.value}
|
||||||
value={radio.value}
|
value={radio.value}
|
||||||
type="radio" />
|
type="radio"
|
||||||
|
/>
|
||||||
</label>
|
</label>
|
||||||
))}
|
))}
|
||||||
|
</div>
|
||||||
</div>))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
{!closed &&
|
{!closed && (
|
||||||
<motion.div
|
<motion.div
|
||||||
initial={{ height: 0 }}
|
initial={{ height: 0 }}
|
||||||
animate={{ height: 200 }}
|
animate={{ height: 200 }}
|
||||||
exit={{ height: 0 }}
|
exit={{ height: 0 }}
|
||||||
className={style.output}>
|
className={style.output}
|
||||||
|
>
|
||||||
<TextArea
|
<TextArea
|
||||||
readOnly
|
readOnly
|
||||||
value={result.value}
|
value={result.value}
|
||||||
placeholder="(empty)"
|
placeholder="(empty)"
|
||||||
className={clsx(result.error && style.error)} />
|
className={clsx(result.error && style.error)}
|
||||||
|
/>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
}
|
)}
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { Transform } from "./Transform";
|
import { Transform } from './Transform'
|
||||||
|
|
||||||
export const Base64DecodeTransform: Transform = {
|
export const Base64DecodeTransform: Transform = {
|
||||||
name: 'base64d',
|
name: 'base64d',
|
||||||
fn: async (v) => atob(v)
|
fn: async (v) => atob(v),
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Base64EncodeTransform: Transform = {
|
export const Base64EncodeTransform: Transform = {
|
||||||
name: 'base64e',
|
name: 'base64e',
|
||||||
fn: async (v) => btoa(v)
|
fn: async (v) => btoa(v),
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Transform } from "./Transform";
|
import { Transform } from './Transform'
|
||||||
import { strptime } from 'strtime'
|
import { strptime } from 'strtime'
|
||||||
import moment from "moment";
|
import moment from 'moment'
|
||||||
|
|
||||||
export const DatetimeTransform: Transform = {
|
export const DatetimeTransform: Transform = {
|
||||||
name: 'datetime',
|
name: 'datetime',
|
||||||
@ -20,31 +20,28 @@ export const DatetimeTransform: Transform = {
|
|||||||
|
|
||||||
throw new Error('Unknown Format')
|
throw new Error('Unknown Format')
|
||||||
})
|
})
|
||||||
.map((date) => JSON.stringify({
|
.map((date) =>
|
||||||
|
JSON.stringify({
|
||||||
year: date.getFullYear(),
|
year: date.getFullYear(),
|
||||||
month: date.getMonth() + 1,
|
month: date.getMonth() + 1,
|
||||||
date: date.getDate(),
|
date: date.getDate(),
|
||||||
hour: date.getHours(),
|
hour: date.getHours(),
|
||||||
minute: date.getMinutes(),
|
minute: date.getMinutes(),
|
||||||
second: date.getSeconds(),
|
second: date.getSeconds(),
|
||||||
milli: date.getMilliseconds()
|
milli: date.getMilliseconds(),
|
||||||
}))
|
}),
|
||||||
|
)
|
||||||
.join('\n')
|
.join('\n')
|
||||||
|
|
||||||
return [
|
return [expression, samples, parsedSamples].join('\n\n')
|
||||||
expression,
|
|
||||||
samples,
|
|
||||||
parsedSamples
|
|
||||||
].join('\n\n')
|
|
||||||
},
|
},
|
||||||
|
|
||||||
options: [{
|
options: [
|
||||||
|
{
|
||||||
type: 'RADIO',
|
type: 'RADIO',
|
||||||
key: 'f',
|
key: 'f',
|
||||||
value: 'c',
|
value: 'c',
|
||||||
radios: [
|
radios: [{ value: 'c' }, { value: 'java' }],
|
||||||
{ value: 'c' },
|
},
|
||||||
{ value: 'java' }
|
],
|
||||||
]
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// GzipCompressTransform.ts
|
// GzipCompressTransform.ts
|
||||||
import { Transform } from "./Transform"
|
import { Transform } from './Transform'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compresses a string using Gzip and encodes the result in Base64.
|
* Compresses a string using Gzip and encodes the result in Base64.
|
||||||
@ -8,8 +8,10 @@ import { Transform } from "./Transform"
|
|||||||
*/
|
*/
|
||||||
const compressGzip = async (input: string): Promise<string> => {
|
const compressGzip = async (input: string): Promise<string> => {
|
||||||
// Check if CompressionStream is supported
|
// Check if CompressionStream is supported
|
||||||
if (typeof CompressionStream === "undefined") {
|
if (typeof CompressionStream === 'undefined') {
|
||||||
throw new Error("CompressionStream API is not supported in this environment.")
|
throw new Error(
|
||||||
|
'CompressionStream API is not supported in this environment.',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode the input string to a Uint8Array
|
// Encode the input string to a Uint8Array
|
||||||
@ -21,11 +23,11 @@ const compressGzip = async (input: string): Promise<string> => {
|
|||||||
start(controller) {
|
start(controller) {
|
||||||
controller.enqueue(encoded)
|
controller.enqueue(encoded)
|
||||||
controller.close()
|
controller.close()
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// Create a CompressionStream for Gzip
|
// Create a CompressionStream for Gzip
|
||||||
const compressionStream = new CompressionStream("gzip")
|
const compressionStream = new CompressionStream('gzip')
|
||||||
|
|
||||||
// Pipe the readable stream through the compression stream
|
// Pipe the readable stream through the compression stream
|
||||||
const compressedStream = readable.pipeThrough(compressionStream)
|
const compressedStream = readable.pipeThrough(compressionStream)
|
||||||
@ -64,7 +66,7 @@ const compressGzip = async (input: string): Promise<string> => {
|
|||||||
* @returns The Base64-encoded string.
|
* @returns The Base64-encoded string.
|
||||||
*/
|
*/
|
||||||
const arrayBufferToBase64 = (buffer: Uint8Array): string => {
|
const arrayBufferToBase64 = (buffer: Uint8Array): string => {
|
||||||
let binary = ""
|
let binary = ''
|
||||||
for (let i = 0; i < buffer.length; i++) {
|
for (let i = 0; i < buffer.length; i++) {
|
||||||
binary += String.fromCharCode(buffer[i])
|
binary += String.fromCharCode(buffer[i])
|
||||||
}
|
}
|
||||||
@ -76,5 +78,5 @@ export const GzipCompressTransform: Transform = {
|
|||||||
|
|
||||||
fn: (v: string) => compressGzip(v),
|
fn: (v: string) => compressGzip(v),
|
||||||
|
|
||||||
options: [] // Add any options if needed
|
options: [], // Add any options if needed
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Transform } from "./Transform"
|
import { Transform } from './Transform'
|
||||||
|
|
||||||
const decompressGzip = async (base64: string) => {
|
const decompressGzip = async (base64: string) => {
|
||||||
const byteCharacters = atob(base64)
|
const byteCharacters = atob(base64)
|
||||||
@ -7,10 +7,9 @@ const decompressGzip = async (base64: string) => {
|
|||||||
for (let i = 0; i < byteCharacters.length; i++)
|
for (let i = 0; i < byteCharacters.length; i++)
|
||||||
byteNumbers[i] = byteCharacters.charCodeAt(i)
|
byteNumbers[i] = byteCharacters.charCodeAt(i)
|
||||||
|
|
||||||
const decompressedStream =
|
const decompressedStream = new Blob([new Uint8Array(byteNumbers)])
|
||||||
new Blob([new Uint8Array(byteNumbers)])
|
|
||||||
.stream()
|
.stream()
|
||||||
.pipeThrough(new DecompressionStream("gzip"))
|
.pipeThrough(new DecompressionStream('gzip'))
|
||||||
|
|
||||||
return await new Response(decompressedStream).text()
|
return await new Response(decompressedStream).text()
|
||||||
}
|
}
|
||||||
@ -18,6 +17,5 @@ const decompressGzip = async (base64: string) => {
|
|||||||
export const GzipDecompressTransform: Transform = {
|
export const GzipDecompressTransform: Transform = {
|
||||||
name: 'gzipd',
|
name: 'gzipd',
|
||||||
|
|
||||||
fn: (v) => decompressGzip(v)
|
fn: (v) => decompressGzip(v),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,39 +1,50 @@
|
|||||||
import JSON5 from 'json5'
|
import JSON5 from 'json5'
|
||||||
import { Transform } from "./Transform";
|
import { Transform } from './Transform'
|
||||||
|
|
||||||
export const JSONBeautifyTransform: Transform = {
|
export const JSONBeautifyTransform: Transform = {
|
||||||
name: 'jsonbtf',
|
name: 'jsonbtf',
|
||||||
|
|
||||||
fn: async (v, o) =>
|
fn: async (v, o) =>
|
||||||
o.get('multiline')?.value === true
|
o.get('multiline')?.value === true
|
||||||
? JSON.stringify(JSON5.parse(v), null, o.get('tab')?.value as number ?? 2)
|
? JSON.stringify(
|
||||||
: v.split('\n').map((v2) => JSON.stringify(JSON5.parse(v2), null, o.get('tab')?.value as number ?? 2)).join('\n'),
|
JSON5.parse(v),
|
||||||
|
null,
|
||||||
|
(o.get('tab')?.value as number) ?? 2,
|
||||||
|
)
|
||||||
|
: v
|
||||||
|
.split('\n')
|
||||||
|
.map((v2) =>
|
||||||
|
JSON.stringify(
|
||||||
|
JSON5.parse(v2),
|
||||||
|
null,
|
||||||
|
(o.get('tab')?.value as number) ?? 2,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.join('\n'),
|
||||||
|
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
type: 'CHECKBOX',
|
type: 'CHECKBOX',
|
||||||
key: 'multiline'
|
key: 'multiline',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'INTBOX',
|
type: 'INTBOX',
|
||||||
key: 'tab',
|
key: 'tab',
|
||||||
value: 2
|
value: 2,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
export const JSONSimplifyTransform: Transform = {
|
export const JSONSimplifyTransform: Transform = {
|
||||||
name: 'jsonsmp',
|
name: 'jsonsmp',
|
||||||
|
|
||||||
fn: async (v) =>
|
fn: async (v) => JSON.stringify(JSON5.parse(v)),
|
||||||
JSON.stringify(JSON5.parse(v))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const JSONEscapeTransform: Transform = {
|
export const JSONEscapeTransform: Transform = {
|
||||||
name: 'jsonesc',
|
name: 'jsonesc',
|
||||||
|
|
||||||
fn: async (v) =>
|
fn: async (v) => JSON.stringify(v),
|
||||||
JSON.stringify(v)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const JSONUnescapeTransform: Transform = {
|
export const JSONUnescapeTransform: Transform = {
|
||||||
@ -42,9 +53,8 @@ export const JSONUnescapeTransform: Transform = {
|
|||||||
fn: async (v) => {
|
fn: async (v) => {
|
||||||
const result = JSON5.parse(v)
|
const result = JSON5.parse(v)
|
||||||
|
|
||||||
if (typeof result !== 'string')
|
if (typeof result !== 'string') throw new Error('Not JSON escaped')
|
||||||
throw new Error('Not JSON escaped')
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Transform } from "./Transform";
|
import { Transform } from './Transform'
|
||||||
|
|
||||||
export const RegexpTransform: Transform = {
|
export const RegexpTransform: Transform = {
|
||||||
name: 'regexp',
|
name: 'regexp',
|
||||||
@ -8,14 +8,9 @@ export const RegexpTransform: Transform = {
|
|||||||
|
|
||||||
const parsedSamples = samples
|
const parsedSamples = samples
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.map((sample) =>
|
.map((sample) => JSON.stringify(regexp.exec(sample)?.groups))
|
||||||
JSON.stringify(regexp.exec(sample)?.groups))
|
|
||||||
.join('\n')
|
.join('\n')
|
||||||
|
|
||||||
return [
|
return [expression, samples, parsedSamples].join('\n\n')
|
||||||
expression,
|
},
|
||||||
samples,
|
|
||||||
parsedSamples
|
|
||||||
].join('\n\n')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,39 +1,46 @@
|
|||||||
import { Base64DecodeTransform, Base64EncodeTransform } from "./Base64Transforms"
|
import {
|
||||||
import { DatetimeTransform } from "./DatetimeTransforms"
|
Base64DecodeTransform,
|
||||||
import { GzipCompressTransform } from "./GzipCompressTransform"
|
Base64EncodeTransform,
|
||||||
import { GzipDecompressTransform } from "./GzipTransform"
|
} from './Base64Transforms'
|
||||||
import { JSONBeautifyTransform, JSONEscapeTransform, JSONSimplifyTransform, JSONUnescapeTransform } from "./JSONTransforms"
|
import { DatetimeTransform } from './DatetimeTransforms'
|
||||||
import { RegexpTransform } from "./RegexpTransform"
|
import { GzipCompressTransform } from './GzipCompressTransform'
|
||||||
import { URIDecodeTransform, URIEncodeTransform } from "./URITransforms"
|
import { GzipDecompressTransform } from './GzipTransform'
|
||||||
import { JSON2YAMLTransform, YAML2JSONTransform } from "./YAMLTransforms"
|
import {
|
||||||
|
JSONBeautifyTransform,
|
||||||
|
JSONEscapeTransform,
|
||||||
|
JSONSimplifyTransform,
|
||||||
|
JSONUnescapeTransform,
|
||||||
|
} from './JSONTransforms'
|
||||||
|
import { RegexpTransform } from './RegexpTransform'
|
||||||
|
import { URIDecodeTransform, URIEncodeTransform } from './URITransforms'
|
||||||
|
import { JSON2YAMLTransform, YAML2JSONTransform } from './YAMLTransforms'
|
||||||
|
|
||||||
export interface TransformCheckboxOption {
|
export interface TransformCheckboxOption {
|
||||||
type: 'CHECKBOX',
|
type: 'CHECKBOX'
|
||||||
key: string,
|
key: string
|
||||||
label?: string,
|
label?: string
|
||||||
value?: boolean
|
value?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface TransformTextboxOption {
|
export interface TransformTextboxOption {
|
||||||
type: 'TEXTBOX',
|
type: 'TEXTBOX'
|
||||||
key: string,
|
key: string
|
||||||
label?: string,
|
label?: string
|
||||||
value?: string
|
value?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TransformIntboxOption {
|
export interface TransformIntboxOption {
|
||||||
type: 'INTBOX',
|
type: 'INTBOX'
|
||||||
key: string,
|
key: string
|
||||||
label?: string,
|
label?: string
|
||||||
value?: number
|
value?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TransformRadioOption {
|
export interface TransformRadioOption {
|
||||||
type: 'RADIO',
|
type: 'RADIO'
|
||||||
key: string,
|
key: string
|
||||||
label?: string,
|
label?: string
|
||||||
value?: string,
|
value?: string
|
||||||
radios: {
|
radios: {
|
||||||
label?: string
|
label?: string
|
||||||
value: string
|
value: string
|
||||||
@ -41,8 +48,10 @@ export interface TransformRadioOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type TransformOption =
|
export type TransformOption =
|
||||||
TransformCheckboxOption | TransformTextboxOption |
|
| TransformCheckboxOption
|
||||||
TransformIntboxOption | TransformRadioOption
|
| TransformTextboxOption
|
||||||
|
| TransformIntboxOption
|
||||||
|
| TransformRadioOption
|
||||||
|
|
||||||
export interface Transform {
|
export interface Transform {
|
||||||
name: string
|
name: string
|
||||||
@ -56,10 +65,12 @@ export interface WrappedTransformResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface WrappedTransform extends Omit<Transform, 'fn' | 'options'> {
|
export interface WrappedTransform extends Omit<Transform, 'fn' | 'options'> {
|
||||||
wrapped: true,
|
wrapped: true
|
||||||
|
|
||||||
fn: (value: string, options: Map<string, TransformOption>) =>
|
fn: (
|
||||||
Promise<WrappedTransformResult>,
|
value: string,
|
||||||
|
options: Map<string, TransformOption>,
|
||||||
|
) => Promise<WrappedTransformResult>
|
||||||
|
|
||||||
options: Map<string, TransformOption>
|
options: Map<string, TransformOption>
|
||||||
}
|
}
|
||||||
@ -68,16 +79,15 @@ export const wrapTransform = (transform: Transform): WrappedTransform => ({
|
|||||||
...transform,
|
...transform,
|
||||||
|
|
||||||
fn: async (...args) =>
|
fn: async (...args) =>
|
||||||
await transform.fn(...args)
|
await transform
|
||||||
.then((value) =>
|
.fn(...args)
|
||||||
({ error: false, value: value.toString() }))
|
.then((value) => ({ error: false, value: value.toString() }))
|
||||||
.catch((error) =>
|
.catch((error) => ({ error: true, value: error.toString() })),
|
||||||
({ error: true, value: error.toString() })),
|
|
||||||
|
|
||||||
options: new Map<string, TransformOption>(
|
options: new Map<string, TransformOption>(
|
||||||
(transform.options ?? []).map((v) => [v.key, v])
|
(transform.options ?? []).map((v) => [v.key, v]),
|
||||||
),
|
),
|
||||||
wrapped: true
|
wrapped: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const transforms: Transform[] = [
|
export const transforms: Transform[] = [
|
||||||
@ -94,5 +104,5 @@ export const transforms: Transform[] = [
|
|||||||
JSON2YAMLTransform,
|
JSON2YAMLTransform,
|
||||||
YAML2JSONTransform,
|
YAML2JSONTransform,
|
||||||
GzipCompressTransform,
|
GzipCompressTransform,
|
||||||
GzipDecompressTransform
|
GzipDecompressTransform,
|
||||||
]
|
]
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
import { Transform } from "./Transform";
|
import { Transform } from './Transform'
|
||||||
|
|
||||||
export const URIDecodeTransform: Transform = {
|
export const URIDecodeTransform: Transform = {
|
||||||
name: 'urid',
|
name: 'urid',
|
||||||
|
|
||||||
fn: async (v, o) =>
|
fn: async (v, o) =>
|
||||||
o.get('cmp')?.value === true
|
o.get('cmp')?.value === true ? decodeURIComponent(v) : decodeURI(v),
|
||||||
? decodeURIComponent(v)
|
|
||||||
: decodeURI(v),
|
|
||||||
|
|
||||||
options: [{
|
options: [
|
||||||
|
{
|
||||||
type: 'CHECKBOX',
|
type: 'CHECKBOX',
|
||||||
key: 'cmp'
|
key: 'cmp',
|
||||||
}]
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
export const URIEncodeTransform: Transform = {
|
export const URIEncodeTransform: Transform = {
|
||||||
name: 'urie',
|
name: 'urie',
|
||||||
|
|
||||||
fn: async (v, o) =>
|
fn: async (v, o) =>
|
||||||
o.get('cmp')?.value === true
|
o.get('cmp')?.value === true ? encodeURIComponent(v) : encodeURI(v),
|
||||||
? encodeURIComponent(v)
|
|
||||||
: encodeURI(v),
|
|
||||||
|
|
||||||
options: [{
|
options: [
|
||||||
|
{
|
||||||
type: 'CHECKBOX',
|
type: 'CHECKBOX',
|
||||||
key: 'cmp'
|
key: 'cmp',
|
||||||
}]
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
import { Transform } from "./Transform";
|
import { Transform } from './Transform'
|
||||||
import YAML from 'yaml'
|
import YAML from 'yaml'
|
||||||
import JSON5 from 'json5'
|
import JSON5 from 'json5'
|
||||||
|
|
||||||
export const YAML2JSONTransform: Transform = {
|
export const YAML2JSONTransform: Transform = {
|
||||||
name: 'yaml2json',
|
name: 'yaml2json',
|
||||||
|
|
||||||
fn: async (v) =>
|
fn: async (v) => JSON.stringify(YAML.parse(v)),
|
||||||
JSON.stringify(YAML.parse(v))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const JSON2YAMLTransform: Transform = {
|
export const JSON2YAMLTransform: Transform = {
|
||||||
name: 'json2yaml',
|
name: 'json2yaml',
|
||||||
|
|
||||||
fn: async (v) =>
|
fn: async (v) => YAML.stringify(JSON5.parse(v)),
|
||||||
YAML.stringify(JSON5.parse(v))
|
|
||||||
}
|
}
|
||||||
|
@ -21,3 +21,8 @@ input[type=number] {
|
|||||||
appearance: textfield;
|
appearance: textfield;
|
||||||
-moz-appearance: textfield;
|
-moz-appearance: textfield;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*::selection {
|
||||||
|
color: #212121;
|
||||||
|
background-color: #ff1696;
|
||||||
|
}
|
||||||
|
3
src/vite-env.d.ts
vendored
3
src/vite-env.d.ts
vendored
@ -1,5 +1,6 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
module 'strtime' {
|
module 'strtime' {
|
||||||
function strptime (string, string): Date
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
function strptime(string, string): Date
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ export default defineConfig({
|
|||||||
css: {
|
css: {
|
||||||
preprocessorOptions: {
|
preprocessorOptions: {
|
||||||
scss: {
|
scss: {
|
||||||
api: 'modern-compiler' // or "modern"
|
api: 'modern-compiler', // or "modern"
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user