add toasts and update deps

This commit is contained in:
cupcakearmy 2022-07-20 10:31:01 +02:00
parent 0ff559e70b
commit d4321474b9
No known key found for this signature in database
GPG Key ID: 3235314B4D31232F
9 changed files with 157 additions and 132 deletions

View File

@ -11,10 +11,11 @@
"type": "module",
"devDependencies": {
"@lokalise/node-api": "^7.3.1",
"@sveltejs/adapter-static": "^1.0.0-next.37",
"@sveltejs/kit": "^1.0.0-next.377",
"@sveltejs/adapter-static": "^1.0.0-next.38",
"@sveltejs/kit": "^1.0.0-next.384",
"@types/dompurify": "^2.3.3",
"@types/file-saver": "^2.0.5",
"@zerodevx/svelte-toast": "^0.7.2",
"adm-zip": "^0.5.9",
"dotenv": "^16.0.1",
"svelte": "^3.49.0",
@ -23,12 +24,12 @@
"svelte-preprocess": "^4.10.7",
"tslib": "^2.4.0",
"typescript": "^4.7.4",
"vite": "^3.0.1"
"vite": "^3.0.2"
},
"dependencies": {
"@fontsource/fira-mono": "^4.5.8",
"copy-to-clipboard": "^3.3.1",
"dompurify": "^2.3.9",
"dompurify": "^2.3.10",
"file-saver": "^2.0.5",
"pretty-bytes": "^5.6.0"
}

View File

@ -3,13 +3,14 @@ lockfileVersion: 5.4
specifiers:
'@fontsource/fira-mono': ^4.5.8
'@lokalise/node-api': ^7.3.1
'@sveltejs/adapter-static': ^1.0.0-next.37
'@sveltejs/kit': ^1.0.0-next.377
'@sveltejs/adapter-static': ^1.0.0-next.38
'@sveltejs/kit': ^1.0.0-next.384
'@types/dompurify': ^2.3.3
'@types/file-saver': ^2.0.5
'@zerodevx/svelte-toast': ^0.7.2
adm-zip: ^0.5.9
copy-to-clipboard: ^3.3.1
dompurify: ^2.3.9
dompurify: ^2.3.10
dotenv: ^16.0.1
file-saver: ^2.0.5
pretty-bytes: ^5.6.0
@ -19,21 +20,22 @@ specifiers:
svelte-preprocess: ^4.10.7
tslib: ^2.4.0
typescript: ^4.7.4
vite: ^3.0.1
vite: ^3.0.2
dependencies:
'@fontsource/fira-mono': 4.5.8
copy-to-clipboard: 3.3.1
dompurify: 2.3.9
dompurify: 2.3.10
file-saver: 2.0.5
pretty-bytes: 5.6.0
devDependencies:
'@lokalise/node-api': 7.3.1
'@sveltejs/adapter-static': 1.0.0-next.37
'@sveltejs/kit': 1.0.0-next.377_svelte@3.49.0+vite@3.0.1
'@sveltejs/adapter-static': 1.0.0-next.38
'@sveltejs/kit': 1.0.0-next.384_svelte@3.49.0+vite@3.0.2
'@types/dompurify': 2.3.3
'@types/file-saver': 2.0.5
'@zerodevx/svelte-toast': 0.7.2
adm-zip: 0.5.9
dotenv: 16.0.1
svelte: 3.49.0
@ -42,7 +44,7 @@ devDependencies:
svelte-preprocess: 4.10.7_uslzfc62di2n2otc2tvfklnwji
tslib: 2.4.0
typescript: 4.7.4
vite: 3.0.1
vite: 3.0.2
packages:
@ -66,20 +68,20 @@ packages:
engines: {node: '>=6.9.0'}
dev: true
/@babel/core/7.18.6:
resolution: {integrity: sha512-cQbWBpxcbbs/IUredIPkHiAGULLV8iwgNRMFzvbhEXISp4f3rUUXE5+TIw6KwUWUR3DwyI6gmBRnmAtYaWehwQ==}
/@babel/core/7.18.9:
resolution: {integrity: sha512-1LIb1eL8APMy91/IMW+31ckrfBM4yCoLaVzoDhZUKSM4cu1L1nIidyxkCgzPAgrC5WEz36IPEr/eSeSF9pIn+g==}
engines: {node: '>=6.9.0'}
dependencies:
'@ampproject/remapping': 2.2.0
'@babel/code-frame': 7.18.6
'@babel/generator': 7.18.7
'@babel/helper-compilation-targets': 7.18.6_@babel+core@7.18.6
'@babel/helper-module-transforms': 7.18.8
'@babel/helpers': 7.18.6
'@babel/parser': 7.18.8
'@babel/generator': 7.18.9
'@babel/helper-compilation-targets': 7.18.9_@babel+core@7.18.9
'@babel/helper-module-transforms': 7.18.9
'@babel/helpers': 7.18.9
'@babel/parser': 7.18.9
'@babel/template': 7.18.6
'@babel/traverse': 7.18.8
'@babel/types': 7.18.8
'@babel/traverse': 7.18.9
'@babel/types': 7.18.9
convert-source-map: 1.8.0
debug: 4.3.4
gensync: 1.0.0-beta.2
@ -89,73 +91,73 @@ packages:
- supports-color
dev: true
/@babel/generator/7.18.7:
resolution: {integrity: sha512-shck+7VLlY72a2w9c3zYWuE1pwOKEiQHV7GTUbSnhyl5eu3i04t30tBY82ZRWrDfo3gkakCFtevExnxbkf2a3A==}
/@babel/generator/7.18.9:
resolution: {integrity: sha512-wt5Naw6lJrL1/SGkipMiFxJjtyczUWTP38deiP1PO60HsBjDeKk08CGC3S8iVuvf0FmTdgKwU1KIXzSKL1G0Ug==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
'@babel/types': 7.18.9
'@jridgewell/gen-mapping': 0.3.2
jsesc: 2.5.2
dev: true
/@babel/helper-compilation-targets/7.18.6_@babel+core@7.18.6:
resolution: {integrity: sha512-vFjbfhNCzqdeAtZflUFrG5YIFqGTqsctrtkZ1D/NB0mDW9TwW3GmmUepYY4G9wCET5rY5ugz4OGTcLd614IzQg==}
/@babel/helper-compilation-targets/7.18.9_@babel+core@7.18.9:
resolution: {integrity: sha512-tzLCyVmqUiFlcFoAPLA/gL9TeYrF61VLNtb+hvkuVaB5SUjW7jcfrglBIX1vUIoT7CLP3bBlIMeyEsIl2eFQNg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/compat-data': 7.18.8
'@babel/core': 7.18.6
'@babel/core': 7.18.9
'@babel/helper-validator-option': 7.18.6
browserslist: 4.21.2
semver: 6.3.0
dev: true
/@babel/helper-environment-visitor/7.18.6:
resolution: {integrity: sha512-8n6gSfn2baOY+qlp+VSzsosjCVGFqWKmDF0cCWOybh52Dw3SEyoWR1KrhMJASjLwIEkkAufZ0xvr+SxLHSpy2Q==}
/@babel/helper-environment-visitor/7.18.9:
resolution: {integrity: sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/helper-function-name/7.18.6:
resolution: {integrity: sha512-0mWMxV1aC97dhjCah5U5Ua7668r5ZmSC2DLfH2EZnf9c3/dHZKiFa5pRLMH5tjSl471tY6496ZWk/kjNONBxhw==}
/@babel/helper-function-name/7.18.9:
resolution: {integrity: sha512-fJgWlZt7nxGksJS9a0XdSaI4XvpExnNIgRP+rVefWh5U7BL8pPuir6SJUmFKRfjWQ51OtWSzwOxhaH/EBWWc0A==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/template': 7.18.6
'@babel/types': 7.18.8
'@babel/types': 7.18.9
dev: true
/@babel/helper-hoist-variables/7.18.6:
resolution: {integrity: sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
'@babel/types': 7.18.9
dev: true
/@babel/helper-module-imports/7.18.6:
resolution: {integrity: sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
'@babel/types': 7.18.9
dev: true
/@babel/helper-module-transforms/7.18.8:
resolution: {integrity: sha512-che3jvZwIcZxrwh63VfnFTUzcAM9v/lznYkkRxIBGMPt1SudOKHAEec0SIRCfiuIzTcF7VGj/CaTT6gY4eWxvA==}
/@babel/helper-module-transforms/7.18.9:
resolution: {integrity: sha512-KYNqY0ICwfv19b31XzvmI/mfcylOzbLtowkw+mfvGPAQ3kfCnMLYbED3YecL5tPd8nAYFQFAd6JHp2LxZk/J1g==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-environment-visitor': 7.18.6
'@babel/helper-environment-visitor': 7.18.9
'@babel/helper-module-imports': 7.18.6
'@babel/helper-simple-access': 7.18.6
'@babel/helper-split-export-declaration': 7.18.6
'@babel/helper-validator-identifier': 7.18.6
'@babel/template': 7.18.6
'@babel/traverse': 7.18.8
'@babel/types': 7.18.8
'@babel/traverse': 7.18.9
'@babel/types': 7.18.9
transitivePeerDependencies:
- supports-color
dev: true
/@babel/helper-plugin-utils/7.18.6:
resolution: {integrity: sha512-gvZnm1YAAxh13eJdkb9EWHBnF3eAub3XTLCZEehHT2kWxiKVRL64+ae5Y6Ivne0mVHmMYKT+xWgZO+gQhuLUBg==}
/@babel/helper-plugin-utils/7.18.9:
resolution: {integrity: sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w==}
engines: {node: '>=6.9.0'}
dev: true
@ -163,14 +165,14 @@ packages:
resolution: {integrity: sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
'@babel/types': 7.18.9
dev: true
/@babel/helper-split-export-declaration/7.18.6:
resolution: {integrity: sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
'@babel/types': 7.18.9
dev: true
/@babel/helper-validator-identifier/7.18.6:
@ -183,13 +185,13 @@ packages:
engines: {node: '>=6.9.0'}
dev: true
/@babel/helpers/7.18.6:
resolution: {integrity: sha512-vzSiiqbQOghPngUYt/zWGvK3LAsPhz55vc9XNN0xAl2gV4ieShI2OQli5duxWHD+72PZPTKAcfcZDE1Cwc5zsQ==}
/@babel/helpers/7.18.9:
resolution: {integrity: sha512-Jf5a+rbrLoR4eNdUmnFu8cN5eNJT6qdTdOg5IHIzq87WwyRw9PwguLFOWYgktN/60IP4fgDUawJvs7PjQIzELQ==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/template': 7.18.6
'@babel/traverse': 7.18.8
'@babel/types': 7.18.8
'@babel/traverse': 7.18.9
'@babel/types': 7.18.9
transitivePeerDependencies:
- supports-color
dev: true
@ -203,12 +205,12 @@ packages:
js-tokens: 4.0.0
dev: true
/@babel/parser/7.18.8:
resolution: {integrity: sha512-RSKRfYX20dyH+elbJK2uqAkVyucL+xXzhqlMD5/ZXx+dAAwpyB7HsvnHe/ZUGOF+xLr5Wx9/JoXVTj6BQE2/oA==}
/@babel/parser/7.18.9:
resolution: {integrity: sha512-9uJveS9eY9DJ0t64YbIBZICtJy8a5QrDEVdiLCG97fVLpDTpGX7t8mMSb6OWw6Lrnjqj4O8zwjELX3dhoMgiBg==}
engines: {node: '>=6.0.0'}
hasBin: true
dependencies:
'@babel/types': 7.18.8
'@babel/types': 7.18.9
dev: true
/@babel/template/7.18.6:
@ -216,30 +218,30 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/code-frame': 7.18.6
'@babel/parser': 7.18.8
'@babel/types': 7.18.8
'@babel/parser': 7.18.9
'@babel/types': 7.18.9
dev: true
/@babel/traverse/7.18.8:
resolution: {integrity: sha512-UNg/AcSySJYR/+mIcJQDCv00T+AqRO7j/ZEJLzpaYtgM48rMg5MnkJgyNqkzo88+p4tfRvZJCEiwwfG6h4jkRg==}
/@babel/traverse/7.18.9:
resolution: {integrity: sha512-LcPAnujXGwBgv3/WHv01pHtb2tihcyW1XuL9wd7jqh1Z8AQkTd+QVjMrMijrln0T7ED3UXLIy36P9Ao7W75rYg==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/code-frame': 7.18.6
'@babel/generator': 7.18.7
'@babel/helper-environment-visitor': 7.18.6
'@babel/helper-function-name': 7.18.6
'@babel/generator': 7.18.9
'@babel/helper-environment-visitor': 7.18.9
'@babel/helper-function-name': 7.18.9
'@babel/helper-hoist-variables': 7.18.6
'@babel/helper-split-export-declaration': 7.18.6
'@babel/parser': 7.18.8
'@babel/types': 7.18.8
'@babel/parser': 7.18.9
'@babel/types': 7.18.9
debug: 4.3.4
globals: 11.12.0
transitivePeerDependencies:
- supports-color
dev: true
/@babel/types/7.18.8:
resolution: {integrity: sha512-qwpdsmraq0aJ3osLJRApsc2ouSJCdnMeZwB0DhbtHAtRpZNZCdlbRnHIgcRKzdE1g0iOGg644fzjOBcdOz9cPw==}
/@babel/types/7.18.9:
resolution: {integrity: sha512-WwMLAg2MvJmt/rKEVQBBhIVffMmnilX4oe0sRe7iPOHIGsqpruFHHdrfj4O1CMMtgMtCU4oPafZjDPCRgO57Wg==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-validator-identifier': 7.18.6
@ -357,31 +359,31 @@ packages:
engines: {node: '>=10'}
dev: true
/@sveltejs/adapter-static/1.0.0-next.37:
resolution: {integrity: sha512-BDFkx4CGAd6pG4e3+zYjy/eM9UDbhkRgXqavUzCO5oT8xXao5TeprY1AIbdzjMTmFjsWdeSXE9TbIsT0iikpyQ==}
/@sveltejs/adapter-static/1.0.0-next.38:
resolution: {integrity: sha512-O1b264K62E3OrUnsFxMjKn3CUJF50fxGcW0rWk8fa5kjzskPsSyTxS3jnWNryFaVJ3oSUtx57m4qFW43S1910Q==}
dependencies:
tiny-glob: 0.2.9
dev: true
/@sveltejs/kit/1.0.0-next.377_svelte@3.49.0+vite@3.0.1:
resolution: {integrity: sha512-DH2v2yUBUuDZ7vzjPXUd/yt1AMR3BIkZN0ubLAvS2C+q5Wbvk7ZvAJhfPZ3OYc3ZpQXe4ZGEcptOjvEYvd1lLA==}
/@sveltejs/kit/1.0.0-next.384_svelte@3.49.0+vite@3.0.2:
resolution: {integrity: sha512-m1i9dhma1JAuDYp8nrPyqsN6VWv/ye90h6mWQvAC3lCNmKlb4F8cxhMYIhGYgzaZYSqToNiTaK2QRVPuB4i2/g==}
engines: {node: '>=16.9'}
hasBin: true
peerDependencies:
svelte: ^3.44.0
vite: ^3.0.0
dependencies:
'@sveltejs/vite-plugin-svelte': 1.0.1_svelte@3.49.0+vite@3.0.1
'@sveltejs/vite-plugin-svelte': 1.0.1_svelte@3.49.0+vite@3.0.2
chokidar: 3.5.3
sade: 1.8.1
svelte: 3.49.0
vite: 3.0.1
vite: 3.0.2
transitivePeerDependencies:
- diff-match-patch
- supports-color
dev: true
/@sveltejs/vite-plugin-svelte/1.0.1_svelte@3.49.0+vite@3.0.1:
/@sveltejs/vite-plugin-svelte/1.0.1_svelte@3.49.0+vite@3.0.2:
resolution: {integrity: sha512-PorCgUounn0VXcpeJu+hOweZODKmGuLHsLomwqSj+p26IwjjGffmYQfVHtiTWq+NqaUuuHWWG7vPge6UFw4Aeg==}
engines: {node: ^14.18.0 || >= 16}
peerDependencies:
@ -399,7 +401,7 @@ packages:
magic-string: 0.26.2
svelte: 3.49.0
svelte-hmr: 0.14.12_svelte@3.49.0
vite: 3.0.1
vite: 3.0.2
transitivePeerDependencies:
- supports-color
dev: true
@ -468,6 +470,10 @@ packages:
resolution: {integrity: sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==}
dev: true
/@zerodevx/svelte-toast/0.7.2:
resolution: {integrity: sha512-vWiY6IqsstcOoQ8PFBuFuxgPkj1JFAGhUF9gC7wLx7c5A9SSfdtxWs/39ekGSIeyJK0yqWhTcmzGrCEWSELzDw==}
dev: true
/adm-zip/0.5.9:
resolution: {integrity: sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==}
engines: {node: '>=6.0'}
@ -495,8 +501,8 @@ packages:
/babel-plugin-precompile-intl/0.4.0:
resolution: {integrity: sha512-kfZPPgjutWg7nPxvwHscgxdhiOUEgWI+MZwh7NZ8lIAqf/tVKzuaoVNC4Bnl4pgzCMpuRktQz2bwFypF2ehJWg==}
dependencies:
'@babel/core': 7.18.6
'@babel/helper-plugin-utils': 7.18.6
'@babel/core': 7.18.9
'@babel/helper-plugin-utils': 7.18.9
'@formatjs/icu-messageformat-parser': 2.1.4
transitivePeerDependencies:
- supports-color
@ -531,9 +537,9 @@ packages:
hasBin: true
dependencies:
caniuse-lite: 1.0.30001367
electron-to-chromium: 1.4.192
electron-to-chromium: 1.4.195
node-releases: 2.0.6
update-browserslist-db: 1.0.4_browserslist@4.21.2
update-browserslist-db: 1.0.5_browserslist@4.21.2
dev: true
/buffer-crc32/0.2.13:
@ -555,7 +561,7 @@ packages:
keyv: 4.3.3
lowercase-keys: 2.0.0
normalize-url: 6.1.0
responselike: 2.0.0
responselike: 2.0.1
dev: true
/callsites/3.1.0:
@ -665,8 +671,8 @@ packages:
engines: {node: '>=8'}
dev: true
/dompurify/2.3.9:
resolution: {integrity: sha512-3zOnuTwup4lPV/GfGS6UzG4ub9nhSYagR/5tB3AvDEwqyy5dtyCM2dVjwGDCnrPerXifBKTYh/UWCGKK7ydhhw==}
/dompurify/2.3.10:
resolution: {integrity: sha512-o7Fg/AgC7p/XpKjf/+RC3Ok6k4St5F7Q6q6+Nnm3p2zGWioAY6dh0CbbuwOhH2UcSzKsdniE/YnE2/92JcsA+g==}
dev: false
/dotenv/16.0.1:
@ -674,8 +680,8 @@ packages:
engines: {node: '>=12'}
dev: true
/electron-to-chromium/1.4.192:
resolution: {integrity: sha512-8nCXyIQY9An88NXAp+PuPy5h3/w5ZY7Iu2lag65Q0XREprcat5F8gKhoHsBUnQcFuCRnmevpR8yEBYRU3d2HDw==}
/electron-to-chromium/1.4.195:
resolution: {integrity: sha512-vefjEh0sk871xNmR5whJf9TEngX+KTKS3hOHpjoMpauKkwlGwtMz1H8IaIjAT/GNnX0TbGwAdmVoXCAzXf+PPg==}
dev: true
/end-of-stream/1.4.4:
@ -1011,7 +1017,7 @@ packages:
http2-wrapper: 1.0.3
lowercase-keys: 2.0.0
p-cancelable: 2.1.1
responselike: 2.0.0
responselike: 2.0.1
dev: true
/graceful-fs/4.2.10:
@ -1326,8 +1332,8 @@ packages:
supports-preserve-symlinks-flag: 1.0.0
dev: true
/responselike/2.0.0:
resolution: {integrity: sha512-xH48u3FTB9VsZw7R+vvgaKeLKzT6jOogbQhEe/jewwnZgzPcnyWui2Av6JpoYZF/91uueC+lqhWqeURw5/qhCw==}
/responselike/2.0.1:
resolution: {integrity: sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==}
dependencies:
lowercase-keys: 2.0.0
dev: true
@ -1566,8 +1572,8 @@ packages:
hasBin: true
dev: true
/update-browserslist-db/1.0.4_browserslist@4.21.2:
resolution: {integrity: sha512-jnmO2BEGUjsMOe/Fg9u0oczOe/ppIDZPebzccl1yDWGLFP16Pa1/RM5wEoKYPG2zstNcDuAStejyxsOuKINdGA==}
/update-browserslist-db/1.0.5_browserslist@4.21.2:
resolution: {integrity: sha512-dteFFpCyvuDdr9S/ff1ISkKt/9YZxKjI9WlRR99c180GaztJtRa/fn18FdxGVKVsnPY7/a/FDN68mcvUmP4U7Q==}
hasBin: true
peerDependencies:
browserslist: '>= 4.21.0'
@ -1577,8 +1583,8 @@ packages:
picocolors: 1.0.0
dev: true
/vite/3.0.1:
resolution: {integrity: sha512-nefKSglkoEsDpYUkBuT2++L04ktcP8fz8dxLtmZdDdMyhubFSOLFw6BTh/46Fc6tIX/cibs/NVYWNrsqn0k6pQ==}
/vite/3.0.2:
resolution: {integrity: sha512-TAqydxW/w0U5AoL5AsD9DApTvGb2iNbGs3sN4u2VdT1GFkQVUfgUldt+t08TZgi23uIauh1TUOQJALduo9GXqw==}
engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true
peerDependencies:

View File

@ -14,7 +14,9 @@
--ui-text-0: #fefefe;
--ui-text-1: #eee;
--ui-clr-primary: hsl(186, 65%, 55%);
--ui-clr-primary-alt: hsl(186, 85%, 35%);
--ui-clr-error: hsl(357, 77%, 51%);
--ui-clr-error-alt: hsl(357, 87%, 41%);
--ui-anim: all 150ms ease;
}

37
frontend/src/lib/toast.ts Normal file
View File

@ -0,0 +1,37 @@
import { toast, type SvelteToastOptions } from '@zerodevx/svelte-toast'
export enum NotifyType {
Success = 'success',
Error = 'error',
}
const themeMapping: Record<NotifyType, SvelteToastOptions['theme']> = {
[NotifyType.Success]: {
'--toastBackground': 'var(--ui-clr-primary)',
'--toastBarBackground': 'var(--ui-clr-primary-alt)',
},
[NotifyType.Error]: {
'--toastBackground': 'var(--ui-clr-error)',
'--toastBarBackground': 'var(--ui-clr-error-alt)',
},
}
function notifyFN(message: string, type: NotifyType = NotifyType.Success) {
const options: SvelteToastOptions = {
duration: 5_000,
theme: {
...themeMapping[type],
'--toastBarHeight': '0.25rem',
'--toastMinHeight': 'auto',
'--toastMsgPadding': '0.5rem',
'--toastBorderRadius': '0',
},
}
toast.push(message, options)
}
export const notify = {
success: (message: string) => notifyFN(message, NotifyType.Success),
error: (message: string) => notifyFN(message, NotifyType.Error),
}

View File

@ -3,7 +3,6 @@
</script>
<script lang="ts">
import copy from 'copy-to-clipboard'
import DOMPurify from 'dompurify'
import { saveAs } from 'file-saver'
import prettyBytes from 'pretty-bytes'
@ -11,6 +10,7 @@
import type { FileDTO, NotePublic } from '$lib/api'
import Button from '$lib/ui/Button.svelte'
import { copy } from '$lib/utils'
export let note: DecryptedNote

View File

@ -1,10 +1,7 @@
<script lang="ts">
import copyToClipboard from 'copy-to-clipboard'
import { t } from 'svelte-intl-precompile'
import { fade } from 'svelte/transition'
import { Crypto, Hex } from '$lib/crypto'
import Icon from '$lib/ui/Icon.svelte'
import { copy as copyFN } from '$lib/utils'
export let label: string = ''
export let value: any
@ -15,8 +12,6 @@
const initialType = $$restProps.type
const isPassword = initialType === 'password'
let hidden = true
let notification: string | null = null
let notificationTimeout: NodeJS.Timeout | null = null
$: valid = validate(value)
@ -28,23 +23,9 @@
function toggle() {
hidden = !hidden
}
function copyFN() {
copyToClipboard(value.toString())
notify($t('home.copied_to_clipboard'))
}
function randomFN() {
value = Hex.encode(Crypto.getRandomBytes(20))
}
function notify(msg: string, delay: number = 2000) {
if (notificationTimeout) {
clearTimeout(notificationTimeout)
}
notificationTimeout = setTimeout(() => {
notification = null
}, delay)
notification = msg
}
</script>
<label>
@ -63,12 +44,9 @@
<Icon class="icon" icon="dice" on:click={randomFN} />
{/if}
{#if copy}
<Icon class="icon" icon="copy" on:click={copyFN} />
<Icon class="icon" icon="copy" on:click={() => copyFN(value.toString())} />
{/if}
</div>
{#if notification}
<div class="notification" transition:fade><small>{notification}</small></div>
{/if}
</label>
<style>
@ -118,11 +96,4 @@
.icons > :global(.icon:hover) {
border-color: var(--ui-clr-primary);
}
.notification {
text-align: right;
position: absolute;
right: 0;
bottom: -1.5em;
}
</style>

11
frontend/src/lib/utils.ts Normal file
View File

@ -0,0 +1,11 @@
import copyToClipboard from 'copy-to-clipboard'
import { t } from 'svelte-intl-precompile'
import { get } from 'svelte/store'
import { notify } from './toast'
export function copy(value: string) {
copyToClipboard(value)
const msg = get(t)('common.copied_to_clipboard')
notify.success(msg)
}

View File

@ -7,6 +7,7 @@
import { create, PayloadToLargeError } from '$lib/api'
import { Crypto, Hex } from '$lib/crypto'
import { status } from '$lib/stores/status'
import { notify } from '$lib/toast'
import AdvancedParameters from '$lib/ui/AdvancedParameters.svelte'
import Button from '$lib/ui/Button.svelte'
import FileUpload from '$lib/ui/FileUpload.svelte'
@ -29,7 +30,6 @@
let timeExpiration = false
let description = ''
let loading: string | null = null
let error: string | null = null
$: if (!advanced) {
note.views = 1
@ -56,7 +56,6 @@
async function submit() {
try {
error = null
loading = $t('common.encrypting')
const password = Hex.encode(Crypto.getRandomBytes(32))
@ -82,14 +81,15 @@
password: password,
id: response.id,
}
notify.success($t('home.messages.note_created'))
} catch (e) {
if (e instanceof PayloadToLargeError) {
error = $t('home.errors.note_to_big')
notify.error($t('home.errors.note_to_big'))
} else if (e instanceof EmptyContentError) {
error = $t('home.errors.empty_content')
notify.error($t('home.errors.empty_content'))
} else {
console.error(e)
error = $t('home.errors.note_error')
notify.error($t('home.errors.note_error'))
}
} finally {
loading = null
@ -138,10 +138,6 @@
</div>
</div>
{#if error}
<div class="error-text">{error}</div>
{/if}
<p>
<br />
{#if loading}
@ -175,8 +171,4 @@
.grow {
flex: 1;
}
.error-text {
margin-top: 0.5rem;
}
</style>

View File

@ -7,11 +7,14 @@
</script>
<script lang="ts">
import { SvelteToast } from '@zerodevx/svelte-toast'
import { onMount } from 'svelte'
import '../app.css'
import { init as initStores } from '$lib/stores/status'
import Footer from '$lib/views/Footer.svelte'
import Header from '$lib/views/Header.svelte'
import { onMount } from 'svelte'
import '../app.css'
onMount(() => {
initStores()
@ -28,6 +31,8 @@
<slot />
</main>
<SvelteToast />
<Footer />
{/await}