Compare commits

...
Author SHA1 Message Date
renovate[bot] 91938420f6 chore(deps): update codemirror 2026-11-20 23:27:17 +00:00
ShareVB d07563cf5e fix: update nginx for CVE
Fix #600
2026-11-19 09:59:15 +01:00
ShareVB cf6df4e9f3 ci: fix e2e 2026-11-15 23:06:50 +01:00
JoAdo07 91ee2ab7a8 fix(percentage-calculator): clear the result when an input is cleared
n-input-number emits null when its text is cleared, while the computeds only
treated undefined as a missing value. The arithmetic then coerced null to 0,
so emptying To showed -100 and emptying X showed 0.

The three formulas moved into a service that treats null and undefined alike,
with unit tests for the cleared cases and an e2e case that clears a filled
field.

Fixes #1906
2026-11-15 23:03:42 +01:00
8 changed files with 265 additions and 159 deletions

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ RUN pnpm build \
-exec gzip -9 -n -k {} +
# production stage
FROM nginxinc/nginx-unprivileged:stable-alpine@sha256:f5116ed4606f3eb015dd4a8e28cb9b351476dc0ad4bc6e9f93b19cec130cdf03 AS production-stage
FROM nginx/nginx-unprivileged:alpine AS production-stage
LABEL maintainer="ShareVB <sharevb@gmail.com>" \
org.opencontainers.image.authors="ShareVB <sharevb@gmail.com>"
+142 -136
View File
@@ -223,7 +223,7 @@ importers:
version: 6.0.1
'@codemirror/lang-html':
specifier: ^6.4.11
version: 6.4.11
version: 6.4.12
'@codemirror/lang-javascript':
specifier: ^6.2.5
version: 6.2.5
@@ -232,7 +232,7 @@ importers:
version: 6.0.2
'@codemirror/lang-markdown':
specifier: ^6.5.0
version: 6.5.0
version: 6.5.2
'@codemirror/lang-php':
specifier: ^6.0.2
version: 6.0.2
@@ -250,16 +250,16 @@ importers:
version: 6.1.3
'@codemirror/language':
specifier: ^6.12.4
version: 6.12.4
version: 6.13.1
'@codemirror/state':
specifier: ^6.7.0
version: 6.7.0
version: 6.7.6
'@codemirror/theme-one-dark':
specifier: ^6.1.3
version: 6.1.3
'@codemirror/view':
specifier: ^6.43.5
version: 6.43.5
version: 6.43.15
'@colordx/core':
specifier: ^5.5.0
version: 5.5.0
@@ -1466,7 +1466,7 @@ importers:
version: 4.6.7
node:
specifier: runtime:24.x
version: runtime:24.21.0
version: runtime:24.22.3
oxfmt:
specifier: ^0.57.0
version: 0.57.0(svelte@5.56.4(@typescript-eslint/types@8.62.1))
@@ -2159,8 +2159,8 @@ packages:
'@codemirror/lang-go@6.0.1':
resolution: {integrity: sha512-7fNvbyNylvqCphW9HD6WFnRpcDjr+KXX/FgqXy5H5ZS0eC5edDljukm/yNgYkwTsgp2busdod50AOTIy6Jikfg==}
'@codemirror/lang-html@6.4.11':
resolution: {integrity: sha512-9NsXp7Nwp891pQchI7gPdTwBuSuT3K65NGTHWHNJ55HjYcHLllr0rbIZNdOzas9ztc1EUVBlHou85FFZS4BNnw==}
'@codemirror/lang-html@6.4.12':
resolution: {integrity: sha512-pw2ReWKUqSkbvh76RAT4NYxiogRu+PWkR2ukAwO9uOgrm8uipkzjtKKtNpyeAQwHOqxEeSvAXZ6vr3AfyB9y/w==}
'@codemirror/lang-java@6.0.2':
resolution: {integrity: sha512-m5Nt1mQ/cznJY7tMfQTJchmrjdjQ71IDs+55d1GAa8DGaB8JXWsVCkVT284C3RTASaY43YknrK2X3hPO/J3MOQ==}
@@ -2180,8 +2180,8 @@ packages:
'@codemirror/lang-liquid@6.3.2':
resolution: {integrity: sha512-6PDVU3ZnfeYyz1at1E/ttorErZvZFXXt1OPhtfe1EZJ2V2iDFa0CwPqPgG5F7NXN0yONGoBogKmFAafKTqlwIw==}
'@codemirror/lang-markdown@6.5.0':
resolution: {integrity: sha512-0K40bZ35jpHya6FriukbgaleaqzBLZfOh7HuzqbMxBXkbYMJDxfF39c23xOgxFezR+3G+tR2/Mup+Xk865OMvw==}
'@codemirror/lang-markdown@6.5.2':
resolution: {integrity: sha512-AwBOdkWYuA//WcM0xO5PfHPUcmz/O2i5o0Nsg1U69SII/loCJlFI1Romd9xp2HYb1kYJRGZotyqRghuHH5n8Kw==}
'@codemirror/lang-php@6.0.2':
resolution: {integrity: sha512-ZKy2v1n8Fc8oEXj0Th0PUMXzQJ0AIR6TaZU+PbDHExFwdu+guzOA4jmCHS1Nz4vbFezwD7LyBdDnddSJeScMCA==}
@@ -2213,8 +2213,8 @@ packages:
'@codemirror/language-data@6.5.2':
resolution: {integrity: sha512-CPkWBKrNS8stYbEU5kwBwTf3JB1kghlbh4FSAwzGW2TEscdeHHH4FGysREW86Mqnj3Qn09s0/6Ea/TutmoTobg==}
'@codemirror/language@6.12.4':
resolution: {integrity: sha512-1q4PaT+o6PbgpkJt4Q8Fv5XJxTy4FUZ4MWETtyiDw3J0Pyr9E2vqcKL+k9wcvjNTIsauxvE7OfmWj3FRPHQ76A==}
'@codemirror/language@6.13.1':
resolution: {integrity: sha512-zfvU2r3TyylQLMj/te+5CnQ0rSqZi8B1oTCBbQkagcLW4Xc6imab6qN+pEJhsuNOLaJqiRyBXp9UhWA1DhVvDw==}
'@codemirror/legacy-modes@6.5.3':
resolution: {integrity: sha512-xCsmIzH78MyWkib9jlPaaun57XNkfbMIhagfaZVd0iLTqlpw3jXaIcbZm72MTmmn64eTZpBVNjbyYh+QXnxRsg==}
@@ -2225,14 +2225,17 @@ packages:
'@codemirror/search@6.7.1':
resolution: {integrity: sha512-uMe5UO6PamJtSHrXhhHOzSX3ReWtiJrva6GnPMwSOrZtiExb5X5eExhr2OUZQVvdxPsKpY3Ro2mFbQadpPWmHA==}
'@codemirror/state@6.7.0':
resolution: {integrity: sha512-Zbl9NyscLMZkfXPQnNAIIAFftidrA1UbcJEIMp24C0Bukc2I5T8wJS0wsXYsnDOqCFJUeJ1BITGNs5CqPDSmSg==}
'@codemirror/state@6.7.6':
resolution: {integrity: sha512-kAz+AncRtKuIknedxT1bq4XwXv4UowhbkHU1myPrtVb/jZtImWuV5BXzv5vK6i3kYACsdiZiQKFQQ5Mq7elW8w==}
'@codemirror/streamparser@6.0.0':
resolution: {integrity: sha512-JTFPF6xrfjt0mnfGPgzcLiMwYmvIyNaoizp8BYzv8FE8KrT6GBGDZ190rtt+O7Wke3gG/MFHyiY9YGNeimof4w==}
'@codemirror/theme-one-dark@6.1.3':
resolution: {integrity: sha512-NzBdIvEJmx6fjeremiGp3t/okrLPYT0d9orIc7AFun8oZcRk58aejkqhv6spnz4MLAevrKNPMQYXEWMg4s+sKA==}
'@codemirror/view@6.43.5':
resolution: {integrity: sha512-7uT/vUgH6dfXWn3WqOe23KneILMvGy5wQjNMEcRXLKzziJ9NOktpW6tGoyQpwVkBgE5Gj6hKkCcsddbnkaWrOQ==}
'@codemirror/view@6.43.15':
resolution: {integrity: sha512-HHsfpqFeHyXLs983pSRe38Xajs0vFWZQ2BuX0m7Ki8w3jZ5iD8cuR3lBz2/5/X53Dhf32SBHKh6rtSTB6tKeGw==}
'@codemod/matchers@1.7.1':
resolution: {integrity: sha512-umwQ17+Nb9iI1C1+dPIChlZLZ1grk3NYpXRvhhWGuE2VgiSSVUhAyIXfwLpHBkDsWRRgLvjcotg63HRvtmHAuQ==}
@@ -9216,7 +9219,7 @@ packages:
resolution: {integrity: sha512-X75ZN8DCLftGM5iKwoYLA3rjnrAEs97MkzvSd4q2746Tgpg8b8XWiBGiBG4ZpgcAqBgtgPHTiAc8ZMCvZuikDw==}
engines: {node: '>=10'}
node@runtime:24.21.0:
node@runtime:24.22.3:
resolution:
type: variations
variants:
@@ -9224,9 +9227,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-rseyRkr7mfB4wZywbSAdVDvTsxHLoHEoK84bF8l+WLs=
integrity: sha256-aT/ojEqF5+Fy7BMvdg5ns5JbLWRCyxyzp0tz/Pgx9wo=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-aix-ppc64.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-aix-ppc64.tar.gz
targets:
- cpu: ppc64
os: aix
@@ -9234,9 +9237,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-vtfupTJeEQjzLOUijd1qXw8IpJnuQqp0Qq6lg3AvYFc=
integrity: sha256-/24X1IdLdtJyISuQjMAg1ugV+6Wmx+qqBq3XJYQDB/0=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-darwin-arm64.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-darwin-arm64.tar.gz
targets:
- cpu: arm64
os: darwin
@@ -9244,9 +9247,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-FGLLOzBGuBXPjqQ209pFDsGp8R2sflpGsK2lMF1+gJc=
integrity: sha256-l3YUrwUEyBBF5/2FWW28oOX5UblmgVFtra/tzKjER/c=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-darwin-x64.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-darwin-x64.tar.gz
targets:
- cpu: x64
os: darwin
@@ -9254,9 +9257,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-ckKCw7Q67JmKqVJzgEZbRdIp4CG1gDX19PYwleq/5dU=
integrity: sha256-JhryryUN/X6fJc8VHRsnE6Ct+PEKmtEWxJR/aGJ6/+g=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-arm64.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-arm64.tar.gz
targets:
- cpu: arm64
os: linux
@@ -9264,9 +9267,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-UcXVMGbukpILYXg7A7Buy5nzZhFg97Fcp36EdBFaZ7w=
integrity: sha256-uksmreH3s/W6Z1aFaBXeWONTdGAE5+RsyDgkOmy/Mpk=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-ppc64le.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-ppc64le.tar.gz
targets:
- cpu: ppc64le
os: linux
@@ -9274,9 +9277,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-Xy+jdCLgx13jXBaG/lHXgyTywqj+LMI5pB2cAAop2Tg=
integrity: sha256-2PhDl8FHjA7QwbKTQ2Ju0PXxoJhd8MWXXDDwwDg2Yx8=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-s390x.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-s390x.tar.gz
targets:
- cpu: s390x
os: linux
@@ -9284,9 +9287,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-PWNAX8ZaDS0pdsHwvC/Se7C9ByEkaecFqsPwOuWrTJw=
integrity: sha256-VJm2Y/Yscgk3FdqY9K6m+DQnrYurnPnHXwkk4ORWzhQ=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-x64-musl.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-x64-musl.tar.gz
targets:
- cpu: x64
os: linux
@@ -9295,9 +9298,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-bh24fvWLiBnl1UAu/xU2SRsY7djre+5e94l4duiNxf8=
integrity: sha256-Bh7D4wYhFXBbVrUfqcwzCrUNNLaWk4fU5LGlDGgJrMI=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-x64.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-x64.tar.gz
targets:
- cpu: x64
os: linux
@@ -9305,10 +9308,10 @@ packages:
archive: zip
bin:
node: node.exe
integrity: sha256-h3mxveHTn41CDjtXqmV7OYka9DTT3kSpGQRM7AZ4WSE=
prefix: node-v24.21.0-win-arm64
integrity: sha256-s8x0opWznU8nMnHpb1jAbdKzV1fKEqvsZMfQWYtDTxQ=
prefix: node-v24.22.3-win-arm64
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-win-arm64.zip
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-win-arm64.zip
targets:
- cpu: arm64
os: win32
@@ -9316,10 +9319,10 @@ packages:
archive: zip
bin:
node: node.exe
integrity: sha256-FY92hbRN5R9sDfHRU1JsvNPhvHOajfxgdyHO913p5UE=
prefix: node-v24.21.0-win-x64
integrity: sha256-5hKvmfYmq0FeoiWva85clx/rRIy1yuJQuxw/pQxffZ8=
prefix: node-v24.22.3-win-x64
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-win-x64.zip
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-win-x64.zip
targets:
- cpu: x64
os: win32
@@ -9327,9 +9330,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-MEiwgR4VjKDYZytZyDmGF2PhREkpgNjSmzad/uRXR+Q=
integrity: sha256-JIyWqE9sgzhka5/XO/ElEkZ4+PsI218jAj9GIFXg7tw=
type: binary
url: https://unofficial-builds.nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-arm64-musl.tar.gz
url: https://unofficial-builds.nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-arm64-musl.tar.gz
targets:
- cpu: arm64
os: linux
@@ -9338,14 +9341,14 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-AacT402pjntNKjGR7nyj+T3QOE0aLvI8N5shYe5uEzo=
integrity: sha256-LbT4pAq+X1tdEZlkIj/tycTHxefGMpAa6GCvUix4RLI=
type: binary
url: https://unofficial-builds.nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-x64-musl.tar.gz
url: https://unofficial-builds.nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-x64-musl.tar.gz
targets:
- cpu: x64
os: linux
libc: musl
version: 24.21.0
version: 24.22.3
hasBin: true
nodemailer@9.0.1:
@@ -12819,95 +12822,95 @@ snapshots:
'@codemirror/autocomplete@6.20.3':
dependencies:
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
'@lezer/common': 1.5.2
'@codemirror/commands@6.10.4':
dependencies:
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
'@lezer/common': 1.5.2
'@codemirror/lang-angular@0.1.4':
dependencies:
'@codemirror/lang-html': 6.4.11
'@codemirror/lang-html': 6.4.12
'@codemirror/lang-javascript': 6.2.5
'@codemirror/language': 6.12.4
'@codemirror/language': 6.13.1
'@lezer/common': 1.5.2
'@lezer/highlight': 1.2.3
'@lezer/lr': 1.4.10
'@codemirror/lang-cpp@6.0.3':
dependencies:
'@codemirror/language': 6.12.4
'@codemirror/language': 6.13.1
'@lezer/cpp': 1.1.6
'@codemirror/lang-css@6.3.1':
dependencies:
'@codemirror/autocomplete': 6.20.3
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@lezer/common': 1.5.2
'@lezer/css': 1.3.4
'@codemirror/lang-go@6.0.1':
dependencies:
'@codemirror/autocomplete': 6.20.3
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@lezer/common': 1.5.2
'@lezer/go': 1.0.1
'@codemirror/lang-html@6.4.11':
'@codemirror/lang-html@6.4.12':
dependencies:
'@codemirror/autocomplete': 6.20.3
'@codemirror/lang-css': 6.3.1
'@codemirror/lang-javascript': 6.2.5
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
'@lezer/common': 1.5.2
'@lezer/css': 1.3.4
'@lezer/html': 1.3.13
'@codemirror/lang-java@6.0.2':
dependencies:
'@codemirror/language': 6.12.4
'@codemirror/language': 6.13.1
'@lezer/java': 1.1.3
'@codemirror/lang-javascript@6.2.5':
dependencies:
'@codemirror/autocomplete': 6.20.3
'@codemirror/language': 6.12.4
'@codemirror/language': 6.13.1
'@codemirror/lint': 6.9.7
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
'@lezer/common': 1.5.2
'@lezer/javascript': 1.5.4
'@codemirror/lang-jinja@6.0.1':
dependencies:
'@codemirror/autocomplete': 6.20.3
'@codemirror/lang-html': 6.4.11
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/lang-html': 6.4.12
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
'@lezer/common': 1.5.2
'@lezer/highlight': 1.2.3
'@lezer/lr': 1.4.10
'@codemirror/lang-json@6.0.2':
dependencies:
'@codemirror/language': 6.12.4
'@codemirror/language': 6.13.1
'@lezer/json': 1.0.3
'@codemirror/lang-less@6.0.2':
dependencies:
'@codemirror/lang-css': 6.3.1
'@codemirror/language': 6.12.4
'@codemirror/language': 6.13.1
'@lezer/common': 1.5.2
'@lezer/highlight': 1.2.3
'@lezer/lr': 1.4.10
@@ -12915,74 +12918,74 @@ snapshots:
'@codemirror/lang-liquid@6.3.2':
dependencies:
'@codemirror/autocomplete': 6.20.3
'@codemirror/lang-html': 6.4.11
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/lang-html': 6.4.12
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
'@lezer/common': 1.5.2
'@lezer/highlight': 1.2.3
'@lezer/lr': 1.4.10
'@codemirror/lang-markdown@6.5.0':
'@codemirror/lang-markdown@6.5.2':
dependencies:
'@codemirror/autocomplete': 6.20.3
'@codemirror/lang-html': 6.4.11
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/lang-html': 6.4.12
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
'@lezer/common': 1.5.2
'@lezer/markdown': 1.6.4
'@codemirror/lang-php@6.0.2':
dependencies:
'@codemirror/lang-html': 6.4.11
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/lang-html': 6.4.12
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@lezer/common': 1.5.2
'@lezer/php': 1.0.5
'@codemirror/lang-python@6.2.1':
dependencies:
'@codemirror/autocomplete': 6.20.3
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@lezer/common': 1.5.2
'@lezer/python': 1.1.19
'@codemirror/lang-rust@6.0.2':
dependencies:
'@codemirror/language': 6.12.4
'@codemirror/language': 6.13.1
'@lezer/rust': 1.0.2
'@codemirror/lang-sass@6.0.2':
dependencies:
'@codemirror/lang-css': 6.3.1
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@lezer/common': 1.5.2
'@lezer/sass': 1.1.0
'@codemirror/lang-sql@6.10.0':
dependencies:
'@codemirror/autocomplete': 6.20.3
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@lezer/common': 1.5.2
'@lezer/highlight': 1.2.3
'@lezer/lr': 1.4.10
'@codemirror/lang-vue@0.1.3':
dependencies:
'@codemirror/lang-html': 6.4.11
'@codemirror/lang-html': 6.4.12
'@codemirror/lang-javascript': 6.2.5
'@codemirror/language': 6.12.4
'@codemirror/language': 6.13.1
'@lezer/common': 1.5.2
'@lezer/highlight': 1.2.3
'@lezer/lr': 1.4.10
'@codemirror/lang-wast@6.0.2':
dependencies:
'@codemirror/language': 6.12.4
'@codemirror/language': 6.13.1
'@lezer/common': 1.5.2
'@lezer/highlight': 1.2.3
'@lezer/lr': 1.4.10
@@ -12990,17 +12993,17 @@ snapshots:
'@codemirror/lang-xml@6.1.0':
dependencies:
'@codemirror/autocomplete': 6.20.3
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
'@lezer/common': 1.5.2
'@lezer/xml': 1.0.6
'@codemirror/lang-yaml@6.1.3':
dependencies:
'@codemirror/autocomplete': 6.20.3
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@lezer/common': 1.5.2
'@lezer/highlight': 1.2.3
'@lezer/lr': 1.4.10
@@ -13012,14 +13015,14 @@ snapshots:
'@codemirror/lang-cpp': 6.0.3
'@codemirror/lang-css': 6.3.1
'@codemirror/lang-go': 6.0.1
'@codemirror/lang-html': 6.4.11
'@codemirror/lang-html': 6.4.12
'@codemirror/lang-java': 6.0.2
'@codemirror/lang-javascript': 6.2.5
'@codemirror/lang-jinja': 6.0.1
'@codemirror/lang-json': 6.0.2
'@codemirror/lang-less': 6.0.2
'@codemirror/lang-liquid': 6.3.2
'@codemirror/lang-markdown': 6.5.0
'@codemirror/lang-markdown': 6.5.2
'@codemirror/lang-php': 6.0.2
'@codemirror/lang-python': 6.2.1
'@codemirror/lang-rust': 6.0.2
@@ -13029,13 +13032,14 @@ snapshots:
'@codemirror/lang-wast': 6.0.2
'@codemirror/lang-xml': 6.1.0
'@codemirror/lang-yaml': 6.1.3
'@codemirror/language': 6.12.4
'@codemirror/language': 6.13.1
'@codemirror/legacy-modes': 6.5.3
'@codemirror/language@6.12.4':
'@codemirror/language@6.13.1':
dependencies:
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/state': 6.7.6
'@codemirror/streamparser': 6.0.0
'@codemirror/view': 6.43.15
'@lezer/common': 1.5.2
'@lezer/highlight': 1.2.3
'@lezer/lr': 1.4.10
@@ -13043,34 +13047,36 @@ snapshots:
'@codemirror/legacy-modes@6.5.3':
dependencies:
'@codemirror/language': 6.12.4
'@codemirror/language': 6.13.1
'@codemirror/lint@6.9.7':
dependencies:
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
crelt: 1.0.7
'@codemirror/search@6.7.1':
dependencies:
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
crelt: 1.0.7
'@codemirror/state@6.7.0':
'@codemirror/state@6.7.6':
dependencies:
'@marijn/find-cluster-break': 1.0.3
'@codemirror/streamparser@6.0.0': {}
'@codemirror/theme-one-dark@6.1.3':
dependencies:
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
'@lezer/highlight': 1.2.3
'@codemirror/view@6.43.5':
'@codemirror/view@6.43.15':
dependencies:
'@codemirror/state': 6.7.0
'@codemirror/state': 6.7.6
crelt: 1.0.7
style-mod: 4.1.3
w3c-keyname: 2.2.8
@@ -14697,11 +14703,11 @@ snapshots:
'@regexper/parser': 1.0.0
'@svgdotjs/svg.js': 3.2.5
'@replit/codemirror-indentation-markers@6.5.3(@codemirror/language@6.12.4)(@codemirror/state@6.7.0)(@codemirror/view@6.43.5)':
'@replit/codemirror-indentation-markers@6.5.3(@codemirror/language@6.13.1)(@codemirror/state@6.7.6)(@codemirror/view@6.43.15)':
dependencies:
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
'@resvg/resvg-wasm@2.6.2': {}
@@ -16843,21 +16849,21 @@ snapshots:
clsx@2.1.1: {}
codemirror-wrapped-line-indent@1.0.9(@codemirror/language@6.12.4)(@codemirror/state@6.7.0)(@codemirror/view@6.43.5):
codemirror-wrapped-line-indent@1.0.9(@codemirror/language@6.13.1)(@codemirror/state@6.7.6)(@codemirror/view@6.43.15):
dependencies:
'@codemirror/language': 6.12.4
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/language': 6.13.1
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
codemirror@6.0.2:
dependencies:
'@codemirror/autocomplete': 6.20.3
'@codemirror/commands': 6.10.4
'@codemirror/language': 6.12.4
'@codemirror/language': 6.13.1
'@codemirror/lint': 6.9.7
'@codemirror/search': 6.7.1
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
collection-utils@1.0.1: {}
@@ -19872,12 +19878,12 @@ snapshots:
dependencies:
'@codemirror/autocomplete': 6.20.3
'@codemirror/commands': 6.10.4
'@codemirror/lang-markdown': 6.5.0
'@codemirror/language': 6.12.4
'@codemirror/lang-markdown': 6.5.2
'@codemirror/language': 6.13.1
'@codemirror/language-data': 6.5.2
'@codemirror/search': 6.7.1
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
'@lezer/highlight': 1.2.3
'@lucide/vue': 1.48.0(vue@3.5.39(typescript@6.0.3))
'@types/markdown-it': 14.1.2
@@ -20290,7 +20296,7 @@ snapshots:
util: 0.12.5
vm-browserify: 1.1.2
node@runtime:24.21.0: {}
node@runtime:24.22.3: {}
nodemailer@9.0.1: {}
@@ -22617,18 +22623,18 @@ snapshots:
'@codemirror/autocomplete': 6.20.3
'@codemirror/commands': 6.10.4
'@codemirror/lang-json': 6.0.2
'@codemirror/language': 6.12.4
'@codemirror/language': 6.13.1
'@codemirror/lint': 6.9.7
'@codemirror/search': 6.7.1
'@codemirror/state': 6.7.0
'@codemirror/view': 6.43.5
'@codemirror/state': 6.7.6
'@codemirror/view': 6.43.15
'@fortawesome/free-regular-svg-icons': 7.3.0
'@fortawesome/free-solid-svg-icons': 7.3.0
'@jsonquerylang/jsonquery': 5.1.1
'@lezer/highlight': 1.2.3
'@replit/codemirror-indentation-markers': 6.5.3(@codemirror/language@6.12.4)(@codemirror/state@6.7.0)(@codemirror/view@6.43.5)
'@replit/codemirror-indentation-markers': 6.5.3(@codemirror/language@6.13.1)(@codemirror/state@6.7.6)(@codemirror/view@6.43.15)
ajv: 8.20.0
codemirror-wrapped-line-indent: 1.0.9(@codemirror/language@6.12.4)(@codemirror/state@6.7.0)(@codemirror/view@6.43.5)
codemirror-wrapped-line-indent: 1.0.9(@codemirror/language@6.13.1)(@codemirror/state@6.7.6)(@codemirror/view@6.43.15)
diff-sequences: 29.6.3
immutable-json-patch: 6.0.3
jmespath: 0.16.0
@@ -58,7 +58,7 @@ test.describe('Tool - Paste image', () => {
});
test('Has title', async ({ page }) => {
await expect(page).toHaveTitle('Paste image - Toolbox');
await expect(page).toHaveTitle('Paste Image - IT Tools');
});
test('A pasted image is added to the history and can be downloaded', async ({ page }) => {
@@ -33,4 +33,22 @@ test.describe('Tool - Percentage calculator', () => {
await page.getByTestId('numberFrom').locator('input').pressSequentially('123\n');
await expect(page.getByTestId('percentageIncreaseDecrease').locator('input')).toHaveValue('');
});
test('Displays empty results after an input is cleared', async ({ page }) => {
await page.getByTestId('percentageX').locator('input').pressSequentially('40\n');
await page.getByTestId('percentageY').locator('input').pressSequentially('50\n');
await expect(page.getByTestId('percentageResult').locator('input')).toHaveValue('20');
await page.getByTestId('numberFrom').locator('input').pressSequentially('40\n');
await page.getByTestId('numberTo').locator('input').pressSequentially('46\n');
await expect(page.getByTestId('percentageIncreaseDecrease').locator('input')).toHaveValue('15');
await page.getByTestId('percentageY').locator('input').clear();
await page.getByTestId('numberTo').locator('input').clear();
await page.getByTestId('percentageX').locator('input').clear();
await page.getByTestId('numberFrom').locator('input').clear();
await expect(page.getByTestId('percentageResult').locator('input')).toHaveValue('');
await expect(page.getByTestId('percentageIncreaseDecrease').locator('input')).toHaveValue('');
});
});
@@ -0,0 +1,58 @@
import { describe, expect, it } from 'vitest';
import {
computeIsWhatPercentOf,
computePercentageIncreaseDecrease,
computePercentageOf,
} from './percentage-calculator.service';
describe('percentage-calculator', () => {
describe('computePercentageOf', () => {
it('computes a percentage of a value', () => {
expect(computePercentageOf(123, 456)).toBe('560.88');
expect(computePercentageOf(0, 200)).toBe('0');
});
it('returns an empty result when an input is missing', () => {
expect(computePercentageOf(undefined, 200)).toBe('');
expect(computePercentageOf(200, undefined)).toBe('');
expect(computePercentageOf(null, 200)).toBe('');
expect(computePercentageOf(200, null)).toBe('');
});
});
describe('computeIsWhatPercentOf', () => {
it('computes what percent x is of y', () => {
expect(computeIsWhatPercentOf(123, 456)).toBe('26.973684210526315');
});
it('returns an empty result when an input is missing', () => {
expect(computeIsWhatPercentOf(undefined, 12)).toBe('');
expect(computeIsWhatPercentOf(12, undefined)).toBe('');
expect(computeIsWhatPercentOf(null, 12)).toBe('');
expect(computeIsWhatPercentOf(12, null)).toBe('');
});
it('returns an empty result when the divisor is zero', () => {
expect(computeIsWhatPercentOf(12, 0)).toBe('');
});
});
describe('computePercentageIncreaseDecrease', () => {
it('computes the increase and the decrease', () => {
expect(computePercentageIncreaseDecrease(123, 456)).toBe('270.7317073170732');
expect(computePercentageIncreaseDecrease(40, 46)).toBe('15');
expect(computePercentageIncreaseDecrease(46, 40)).toBe('-13.043478260869565');
});
it('returns an empty result when an input is missing', () => {
expect(computePercentageIncreaseDecrease(undefined, 46)).toBe('');
expect(computePercentageIncreaseDecrease(40, undefined)).toBe('');
expect(computePercentageIncreaseDecrease(null, 46)).toBe('');
expect(computePercentageIncreaseDecrease(40, null)).toBe('');
});
it('returns an empty result when the reference value is zero', () => {
expect(computePercentageIncreaseDecrease(0, 46)).toBe('');
});
});
});
@@ -0,0 +1,35 @@
export type PercentageInput = number | null | undefined;
export { computePercentageOf, computeIsWhatPercentOf, computePercentageIncreaseDecrease };
function isMissing(value: PercentageInput): value is null | undefined {
return value === null || value === undefined;
}
function formatFinite(value: number): string {
return Number.isFinite(value) ? value.toString() : '';
}
function computePercentageOf(x: PercentageInput, y: PercentageInput): string {
if (isMissing(x) || isMissing(y)) {
return '';
}
return formatFinite((x / 100) * y);
}
function computeIsWhatPercentOf(x: PercentageInput, y: PercentageInput): string {
if (isMissing(x) || isMissing(y)) {
return '';
}
return formatFinite((100 * x) / y);
}
function computePercentageIncreaseDecrease(from: PercentageInput, to: PercentageInput): string {
if (isMissing(from) || isMissing(to)) {
return '';
}
return formatFinite(((to - from) / from) * 100);
}
@@ -1,35 +1,24 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import {
computeIsWhatPercentOf,
computePercentageIncreaseDecrease,
computePercentageOf,
} from './percentage-calculator.service';
const { t } = useI18n();
const percentageX = ref();
const percentageY = ref();
const percentageResult = computed(() => {
if (percentageX.value === undefined || percentageY.value === undefined) {
return '';
}
return ((percentageX.value / 100) * percentageY.value).toString();
});
const percentageResult = computed(() => computePercentageOf(percentageX.value, percentageY.value));
const numberX = ref();
const numberY = ref();
const numberResult = computed(() => {
if (numberX.value === undefined || numberY.value === undefined) {
return '';
}
const result = (100 * numberX.value) / numberY.value;
return !Number.isFinite(result) || Number.isNaN(result) ? '' : result.toString();
});
const numberResult = computed(() => computeIsWhatPercentOf(numberX.value, numberY.value));
const numberFrom = ref();
const numberTo = ref();
const percentageIncreaseDecrease = computed(() => {
if (numberFrom.value === undefined || numberTo.value === undefined) {
return '';
}
const result = ((numberTo.value - numberFrom.value) / numberFrom.value) * 100;
return !Number.isFinite(result) || Number.isNaN(result) ? '' : result.toString();
});
const percentageIncreaseDecrease = computed(() => computePercentageIncreaseDecrease(numberFrom.value, numberTo.value));
</script>
<template>
@@ -32,7 +32,7 @@ test.describe('Tool - Whitespace cleaner', () => {
});
test('Has correct title', async ({ page }) => {
await expect(page).toHaveTitle('Whitespace cleaner - Toolbox');
await expect(page).toHaveTitle('Whitespace Cleaner - IT Tools');
});
test('U1 updates the output on input with no button press', async ({ page }) => {