Remove static HTML pages in favor of dynamic routing

Deleted static HTML files (404.html and simplify-truths.html) and implemented dynamic routing with '@solidjs/router'; website pages are now rendered dynamically via routing in app.tsx, which reduces unnecessary file redundancy. Moved the truth-table.tsx component to a new pages directory, adjusting the import statements accordingly. Updated vite.config.ts to point to the new app.html instead of the removed files. Finally, the esbuild packages were updated to their latest versions in package-lock.json.
This commit is contained in:
martin 2023-07-24 20:44:32 +02:00
parent 58fb93fef0
commit bfcb860cfc
14 changed files with 269 additions and 287 deletions

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html lang="nb">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#181a1b" />
<title>Siden ble ikke funnet | Martials.no</title>
<meta name="description" content="Hjemmeside for API og diverse">
<link rel="icon" type="image/x-icon" href="resources/code.svg">
<link rel="stylesheet" href="src/index.css">
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script src="/src/404.tsx" type="module"></script>
</body>
</html>

View File

@ -12,6 +12,6 @@
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script src="/src/index.tsx" type="module"></script>
<script src="/src/app.tsx" type="module"></script>
</body>
</html>

261
package-lock.json generated
View File

@ -9,19 +9,20 @@
"version": "1.0",
"license": "MIT",
"dependencies": {
"@solidjs/router": "^0.8.2",
"@types/diff": "^5.0.3",
"diff": "^5.1.0",
"solid-headless": "^0.13.1",
"solid-heroicons": "^3.2.3",
"solid-js": "^1.7.6",
"solid-heroicons": "^3.2.4",
"solid-js": "^1.7.8",
"xlsx": "^0.18.5"
},
"devDependencies": {
"autoprefixer": "^10.4.14",
"postcss": "^8.4.24",
"tailwindcss": "^3.3.2",
"typescript": "^5.1.3",
"vite": "^4.3.9",
"postcss": "^8.4.27",
"tailwindcss": "^3.3.3",
"typescript": "^5.1.6",
"vite": "^4.4.7",
"vite-plugin-solid": "^2.7.0"
}
},
@ -522,9 +523,9 @@
}
},
"node_modules/@esbuild/android-arm": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz",
"integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.16.tgz",
"integrity": "sha512-gCHjjQmA8L0soklKbLKA6pgsLk1byULuHe94lkZDzcO3/Ta+bbeewJioEn1Fr7kgy9NWNFy/C+MrBwC6I/WCug==",
"cpu": [
"arm"
],
@ -538,9 +539,9 @@
}
},
"node_modules/@esbuild/android-arm64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz",
"integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.16.tgz",
"integrity": "sha512-wsCqSPqLz+6Ov+OM4EthU43DyYVVyfn15S4j1bJzylDpc1r1jZFFfJQNfDuT8SlgwuqpmpJXK4uPlHGw6ve7eA==",
"cpu": [
"arm64"
],
@ -554,9 +555,9 @@
}
},
"node_modules/@esbuild/android-x64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz",
"integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.16.tgz",
"integrity": "sha512-ldsTXolyA3eTQ1//4DS+E15xl0H/3DTRJaRL0/0PgkqDsI0fV/FlOtD+h0u/AUJr+eOTlZv4aC9gvfppo3C4sw==",
"cpu": [
"x64"
],
@ -570,9 +571,9 @@
}
},
"node_modules/@esbuild/darwin-arm64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz",
"integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.16.tgz",
"integrity": "sha512-aBxruWCII+OtluORR/KvisEw0ALuw/qDQWvkoosA+c/ngC/Kwk0lLaZ+B++LLS481/VdydB2u6tYpWxUfnLAIw==",
"cpu": [
"arm64"
],
@ -586,9 +587,9 @@
}
},
"node_modules/@esbuild/darwin-x64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz",
"integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.16.tgz",
"integrity": "sha512-6w4Dbue280+rp3LnkgmriS1icOUZDyPuZo/9VsuMUTns7SYEiOaJ7Ca1cbhu9KVObAWfmdjUl4gwy9TIgiO5eA==",
"cpu": [
"x64"
],
@ -602,9 +603,9 @@
}
},
"node_modules/@esbuild/freebsd-arm64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz",
"integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.16.tgz",
"integrity": "sha512-x35fCebhe9s979DGKbVAwXUOcTmCIE32AIqB9CB1GralMIvxdnMLAw5CnID17ipEw9/3MvDsusj/cspYt2ZLNQ==",
"cpu": [
"arm64"
],
@ -618,9 +619,9 @@
}
},
"node_modules/@esbuild/freebsd-x64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz",
"integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.16.tgz",
"integrity": "sha512-YM98f+PeNXF3GbxIJlUsj+McUWG1irguBHkszCIwfr3BXtXZsXo0vqybjUDFfu9a8Wr7uUD/YSmHib+EeGAFlg==",
"cpu": [
"x64"
],
@ -634,9 +635,9 @@
}
},
"node_modules/@esbuild/linux-arm": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz",
"integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.16.tgz",
"integrity": "sha512-b5ABb+5Ha2C9JkeZXV+b+OruR1tJ33ePmv9ZwMeETSEKlmu/WJ45XTTG+l6a2KDsQtJJ66qo/hbSGBtk0XVLHw==",
"cpu": [
"arm"
],
@ -650,9 +651,9 @@
}
},
"node_modules/@esbuild/linux-arm64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz",
"integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.16.tgz",
"integrity": "sha512-XIqhNUxJiuy+zsR77+H5Z2f7s4YRlriSJKtvx99nJuG5ATuJPjmZ9n0ANgnGlPCpXGSReFpgcJ7O3SMtzIFeiQ==",
"cpu": [
"arm64"
],
@ -666,9 +667,9 @@
}
},
"node_modules/@esbuild/linux-ia32": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz",
"integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.16.tgz",
"integrity": "sha512-no+pfEpwnRvIyH+txbBAWtjxPU9grslmTBfsmDndj7bnBmr55rOo/PfQmRfz7Qg9isswt1FP5hBbWb23fRWnow==",
"cpu": [
"ia32"
],
@ -682,9 +683,9 @@
}
},
"node_modules/@esbuild/linux-loong64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz",
"integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.16.tgz",
"integrity": "sha512-Zbnczs9ZXjmo0oZSS0zbNlJbcwKXa/fcNhYQjahDs4Xg18UumpXG/lwM2lcSvHS3mTrRyCYZvJbmzYc4laRI1g==",
"cpu": [
"loong64"
],
@ -698,9 +699,9 @@
}
},
"node_modules/@esbuild/linux-mips64el": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz",
"integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.16.tgz",
"integrity": "sha512-YMF7hih1HVR/hQVa/ot4UVffc5ZlrzEb3k2ip0nZr1w6fnYypll9td2qcoMLvd3o8j3y6EbJM3MyIcXIVzXvQQ==",
"cpu": [
"mips64el"
],
@ -714,9 +715,9 @@
}
},
"node_modules/@esbuild/linux-ppc64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz",
"integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.16.tgz",
"integrity": "sha512-Wkz++LZ29lDwUyTSEnzDaaP5OveOgTU69q9IyIw9WqLRxM4BjTBjz9un4G6TOvehWpf/J3gYVFN96TjGHrbcNQ==",
"cpu": [
"ppc64"
],
@ -730,9 +731,9 @@
}
},
"node_modules/@esbuild/linux-riscv64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz",
"integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.16.tgz",
"integrity": "sha512-LFMKZ30tk78/mUv1ygvIP+568bwf4oN6reG/uczXnz6SvFn4e2QUFpUpZY9iSJT6Qpgstrhef/nMykIXZtZWGQ==",
"cpu": [
"riscv64"
],
@ -746,9 +747,9 @@
}
},
"node_modules/@esbuild/linux-s390x": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz",
"integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.16.tgz",
"integrity": "sha512-3ZC0BgyYHYKfZo3AV2/66TD/I9tlSBaW7eWTEIkrQQKfJIifKMMttXl9FrAg+UT0SGYsCRLI35Gwdmm96vlOjg==",
"cpu": [
"s390x"
],
@ -762,9 +763,9 @@
}
},
"node_modules/@esbuild/linux-x64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz",
"integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.16.tgz",
"integrity": "sha512-xu86B3647DihHJHv/wx3NCz2Dg1gjQ8bbf9cVYZzWKY+gsvxYmn/lnVlqDRazObc3UMwoHpUhNYaZset4X8IPA==",
"cpu": [
"x64"
],
@ -778,9 +779,9 @@
}
},
"node_modules/@esbuild/netbsd-x64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz",
"integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.16.tgz",
"integrity": "sha512-uVAgpimx9Ffw3xowtg/7qQPwHFx94yCje+DoBx+LNm2ePDpQXHrzE+Sb0Si2VBObYz+LcRps15cq+95YM7gkUw==",
"cpu": [
"x64"
],
@ -794,9 +795,9 @@
}
},
"node_modules/@esbuild/openbsd-x64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz",
"integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.16.tgz",
"integrity": "sha512-6OjCQM9wf7z8/MBi6BOWaTL2AS/SZudsZtBziXMtNI8r/U41AxS9x7jn0ATOwVy08OotwkPqGRMkpPR2wcTJXA==",
"cpu": [
"x64"
],
@ -810,9 +811,9 @@
}
},
"node_modules/@esbuild/sunos-x64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz",
"integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.16.tgz",
"integrity": "sha512-ZoNkruFYJp9d1LbUYCh8awgQDvB9uOMZqlQ+gGEZR7v6C+N6u7vPr86c+Chih8niBR81Q/bHOSKGBK3brJyvkQ==",
"cpu": [
"x64"
],
@ -826,9 +827,9 @@
}
},
"node_modules/@esbuild/win32-arm64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz",
"integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.16.tgz",
"integrity": "sha512-+j4anzQ9hrs+iqO+/wa8UE6TVkKua1pXUb0XWFOx0FiAj6R9INJ+WE//1/Xo6FG1vB5EpH3ko+XcgwiDXTxcdw==",
"cpu": [
"arm64"
],
@ -842,9 +843,9 @@
}
},
"node_modules/@esbuild/win32-ia32": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz",
"integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.16.tgz",
"integrity": "sha512-5PFPmq3sSKTp9cT9dzvI67WNfRZGvEVctcZa1KGjDDu4n3H8k59Inbk0du1fz0KrAbKKNpJbdFXQMDUz7BG4rQ==",
"cpu": [
"ia32"
],
@ -858,9 +859,9 @@
}
},
"node_modules/@esbuild/win32-x64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz",
"integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.16.tgz",
"integrity": "sha512-sCIVrrtcWN5Ua7jYXNG1xD199IalrbfV2+0k/2Zf2OyV2FtnQnMgdzgpRAbi4AWlKJj1jkX+M+fEGPQj6BQB4w==",
"cpu": [
"x64"
],
@ -962,6 +963,14 @@
"node": ">= 8"
}
},
"node_modules/@solidjs/router": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/@solidjs/router/-/router-0.8.2.tgz",
"integrity": "sha512-gUKW+LZqxtX6y/Aw6JKyy4gQ9E7dLqp513oB9pSYJR1HM5c56Pf7eijzyXX+b3WuXig18Cxqah4tMtF0YGu80w==",
"peerDependencies": {
"solid-js": "^1.5.3"
}
},
"node_modules/@types/babel__core": {
"version": "7.20.1",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz",
@ -1405,9 +1414,9 @@
"dev": true
},
"node_modules/esbuild": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz",
"integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==",
"version": "0.18.16",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.16.tgz",
"integrity": "sha512-1xLsOXrDqwdHxyXb/x/SOyg59jpf/SH7YMvU5RNSU7z3TInaASNJWNFJ6iRvLvLETZMasF3d1DdZLg7sgRimRQ==",
"dev": true,
"hasInstallScript": true,
"bin": {
@ -1417,28 +1426,28 @@
"node": ">=12"
},
"optionalDependencies": {
"@esbuild/android-arm": "0.17.19",
"@esbuild/android-arm64": "0.17.19",
"@esbuild/android-x64": "0.17.19",
"@esbuild/darwin-arm64": "0.17.19",
"@esbuild/darwin-x64": "0.17.19",
"@esbuild/freebsd-arm64": "0.17.19",
"@esbuild/freebsd-x64": "0.17.19",
"@esbuild/linux-arm": "0.17.19",
"@esbuild/linux-arm64": "0.17.19",
"@esbuild/linux-ia32": "0.17.19",
"@esbuild/linux-loong64": "0.17.19",
"@esbuild/linux-mips64el": "0.17.19",
"@esbuild/linux-ppc64": "0.17.19",
"@esbuild/linux-riscv64": "0.17.19",
"@esbuild/linux-s390x": "0.17.19",
"@esbuild/linux-x64": "0.17.19",
"@esbuild/netbsd-x64": "0.17.19",
"@esbuild/openbsd-x64": "0.17.19",
"@esbuild/sunos-x64": "0.17.19",
"@esbuild/win32-arm64": "0.17.19",
"@esbuild/win32-ia32": "0.17.19",
"@esbuild/win32-x64": "0.17.19"
"@esbuild/android-arm": "0.18.16",
"@esbuild/android-arm64": "0.18.16",
"@esbuild/android-x64": "0.18.16",
"@esbuild/darwin-arm64": "0.18.16",
"@esbuild/darwin-x64": "0.18.16",
"@esbuild/freebsd-arm64": "0.18.16",
"@esbuild/freebsd-x64": "0.18.16",
"@esbuild/linux-arm": "0.18.16",
"@esbuild/linux-arm64": "0.18.16",
"@esbuild/linux-ia32": "0.18.16",
"@esbuild/linux-loong64": "0.18.16",
"@esbuild/linux-mips64el": "0.18.16",
"@esbuild/linux-ppc64": "0.18.16",
"@esbuild/linux-riscv64": "0.18.16",
"@esbuild/linux-s390x": "0.18.16",
"@esbuild/linux-x64": "0.18.16",
"@esbuild/netbsd-x64": "0.18.16",
"@esbuild/openbsd-x64": "0.18.16",
"@esbuild/sunos-x64": "0.18.16",
"@esbuild/win32-arm64": "0.18.16",
"@esbuild/win32-ia32": "0.18.16",
"@esbuild/win32-x64": "0.18.16"
}
},
"node_modules/escalade": {
@ -1964,9 +1973,9 @@
}
},
"node_modules/postcss": {
"version": "8.4.24",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.24.tgz",
"integrity": "sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg==",
"version": "8.4.27",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.27.tgz",
"integrity": "sha512-gY/ACJtJPSmUFPDCHtX78+01fHa64FaU4zaaWfuh1MhGJISufJAH4cun6k/8fwsHYeK4UQmENQK+tRLCFJE8JQ==",
"dev": true,
"funding": [
{
@ -2163,9 +2172,9 @@
}
},
"node_modules/rollup": {
"version": "3.23.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.23.0.tgz",
"integrity": "sha512-h31UlwEi7FHihLe1zbk+3Q7z1k/84rb9BSwmBSr/XjOCEaBJ2YyedQDuM0t/kfOS0IxM+vk1/zI9XxYj9V+NJQ==",
"version": "3.26.3",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.26.3.tgz",
"integrity": "sha512-7Tin0C8l86TkpcMtXvQu6saWH93nhG3dGQ1/+l5V2TDMceTxO7kDiK6GzbfLWNNxqJXm591PcEZUozZm51ogwQ==",
"dev": true,
"bin": {
"rollup": "dist/bin/rollup"
@ -2233,20 +2242,20 @@
}
},
"node_modules/solid-heroicons": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/solid-heroicons/-/solid-heroicons-3.2.3.tgz",
"integrity": "sha512-CGWuTGil6pM1Md2T9tVg98oKdl/U7TNHoyT2ogrN4PuZAEx7oNXTGuvdLgg8CQXSqe+Ht7EHQl1nwTWG5NPwzA==",
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/solid-heroicons/-/solid-heroicons-3.2.4.tgz",
"integrity": "sha512-u6BMdFLvkJnvUGYzdFcWp1wvJ4hb9Y1zd3AbZ9D3bUmmiy9jBzNZX+RcqBCI2EKRvdQwAb1UB9bkESfqfhayDg==",
"dependencies": {
"solid-js": "^1.7.5"
"solid-js": "^1.7.6"
},
"peerDependencies": {
"solid-js": ">= ^1.2.5"
}
},
"node_modules/solid-js": {
"version": "1.7.6",
"resolved": "https://registry.npmjs.org/solid-js/-/solid-js-1.7.6.tgz",
"integrity": "sha512-DXVOTjUh/bIAhE0fIqu3ezGLyQaez7v8EOw3uPLIi87DmLjg+hsuCAgKyNIZ+o4jUetOk3ZORccvJmE1yZUk8g==",
"version": "1.7.8",
"resolved": "https://registry.npmjs.org/solid-js/-/solid-js-1.7.8.tgz",
"integrity": "sha512-XHBWk1FvFd0JMKljko7FfhefJMTSgYEuVKcQ2a8hzRXfiuSJAGsrPPafqEo+f6l+e8Oe3cROSpIL6kbzjC1fjQ==",
"dependencies": {
"csstype": "^3.1.0",
"seroval": "^0.5.0"
@ -2344,9 +2353,9 @@
}
},
"node_modules/tailwindcss": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.2.tgz",
"integrity": "sha512-9jPkMiIBXvPc2KywkraqsUfbfj+dHDb+JPWtSJa9MLFdrPyazI7q6WX2sUrm7R9eVR7qqv3Pas7EvQFzxKnI6w==",
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz",
"integrity": "sha512-A0KgSkef7eE4Mf+nKJ83i75TMyq8HqY3qmFIJSWy8bNt0v1lG7jUcpGpoTFxAwYcWOphcTBLPPJg+bDfhDf52w==",
"dev": true,
"dependencies": {
"@alloc/quick-lru": "^5.2.0",
@ -2369,7 +2378,6 @@
"postcss-load-config": "^4.0.1",
"postcss-nested": "^6.0.1",
"postcss-selector-parser": "^6.0.11",
"postcss-value-parser": "^4.2.0",
"resolve": "^1.22.2",
"sucrase": "^3.32.0"
},
@ -2430,9 +2438,9 @@
"dev": true
},
"node_modules/typescript": {
"version": "5.1.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.3.tgz",
"integrity": "sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==",
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
"integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@ -2485,14 +2493,14 @@
"dev": true
},
"node_modules/vite": {
"version": "4.3.9",
"resolved": "https://registry.npmjs.org/vite/-/vite-4.3.9.tgz",
"integrity": "sha512-qsTNZjO9NoJNW7KnOrgYwczm0WctJ8m/yqYAMAK9Lxt4SoySUfS5S8ia9K7JHpa3KEeMfyF8LoJ3c5NeBJy6pg==",
"version": "4.4.7",
"resolved": "https://registry.npmjs.org/vite/-/vite-4.4.7.tgz",
"integrity": "sha512-6pYf9QJ1mHylfVh39HpuSfMPojPSKVxZvnclX1K1FyZ1PXDOcLBibdq5t1qxJSnL63ca8Wf4zts6mD8u8oc9Fw==",
"dev": true,
"dependencies": {
"esbuild": "^0.17.5",
"postcss": "^8.4.23",
"rollup": "^3.21.0"
"esbuild": "^0.18.10",
"postcss": "^8.4.26",
"rollup": "^3.25.2"
},
"bin": {
"vite": "bin/vite.js"
@ -2500,12 +2508,16 @@
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
"funding": {
"url": "https://github.com/vitejs/vite?sponsor=1"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
},
"peerDependencies": {
"@types/node": ">= 14",
"less": "*",
"lightningcss": "^1.21.0",
"sass": "*",
"stylus": "*",
"sugarss": "*",
@ -2518,6 +2530,9 @@
"less": {
"optional": true
},
"lightningcss": {
"optional": true
},
"sass": {
"optional": true
},

View File

@ -10,18 +10,19 @@
"license": "MIT",
"devDependencies": {
"autoprefixer": "^10.4.14",
"postcss": "^8.4.24",
"tailwindcss": "^3.3.2",
"typescript": "^5.1.3",
"vite": "^4.3.9",
"postcss": "^8.4.27",
"tailwindcss": "^3.3.3",
"typescript": "^5.1.6",
"vite": "^4.4.7",
"vite-plugin-solid": "^2.7.0"
},
"dependencies": {
"@solidjs/router": "^0.8.2",
"@types/diff": "^5.0.3",
"diff": "^5.1.0",
"solid-headless": "^0.13.1",
"solid-heroicons": "^3.2.3",
"solid-js": "^1.7.6",
"solid-heroicons": "^3.2.4",
"solid-js": "^1.7.8",
"xlsx": "^0.18.5"
}
}

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#181a1b" />
<title>Simplify | Martials.no</title>
<meta name="description" content="Simplify truth values and generate truth tables">
<link rel="icon" type="image/x-icon" href="resources/code.svg">
<link rel="stylesheet" href="src/index.css">
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script src="/src/truth-table.tsx" type="module"></script>
</body>
</html>

View File

@ -1,22 +0,0 @@
/* @refresh reload */
import { type Component } from "solid-js";
import { render } from "solid-js/web";
import Layout from "./components/layout";
import { Link } from "./components/link";
const PageNotFound: Component = () => {
return (
<Layout title={ "Siden ble ikke funnet" }>
<div class={ "text-center" }>
<h4>Error 404 - Siden ble ikke funnet</h4>
<p>
<Link to={ "/" } newTab={ false } className={ "mx-auto relative w-max" }>
tilbake til forsiden
</Link>
</p>
</div>
</Layout>
);
};
render(() => <PageNotFound />, document.getElementById("root") as HTMLElement);

23
src/app.tsx Normal file
View File

@ -0,0 +1,23 @@
import { Route, Router, Routes } from "@solidjs/router";
import HomePage from "./pages/home";
import TruthTablePage from "./pages/truth-table";
import PageNotFound from "./pages/404";
import { render } from "solid-js/web";
import { type Component } from "solid-js";
const App: Component = () => (
<Routes>
<Route path={ "/" } element={ <HomePage /> } />
<Route path={ "/simplify-truths" } element={ <TruthTablePage /> } />
<Route path={ "*" } element={ <PageNotFound /> } />
</Routes>
);
render(
() => (
<Router>
<App />
</Router>
),
document.getElementById("root") as HTMLElement
);

View File

@ -38,7 +38,7 @@ function setSetIsText(id: string | undefined, isText: boolean, setIsText: Setter
}
}
interface Input<T> extends InputProps<T> {
interface Input<T extends HTMLElement> extends InputProps<T> {
leading?: JSX.Element,
trailing?: JSX.Element,
onChange?: () => void,
@ -57,7 +57,8 @@ export const Input: Component<Input<HTMLInputElement>> = ( // TODO remove leadin
onChange,
leading,
trailing,
inputClass
inputClass,
ref
}): JSX.Element => {
/**
@ -87,6 +88,7 @@ export const Input: Component<Input<HTMLInputElement>> = ( // TODO remove leadin
class={ `bg-default-bg focus:border-cyan-500 outline-none border-2 border-gray-500
hover:border-t-cyan-400 ${ inputClass }` }
id={ id }
ref={ ref }
onFocus={ () => setIsFocused(true) }
onBlur={ () => setIsFocused(false) }
name={ name ?? undefined }
@ -127,7 +129,8 @@ export const Search: Component<SearchProps> = (
{
typingDefault = false,
id = "search",
className
className,
ref
}) => {
const [typing, setTyping] = createSignal(typingDefault);
@ -156,6 +159,7 @@ export const Search: Component<SearchProps> = (
return (
<Input inputClass={ `rounded-xl pl-7 h-10 w-full pr-8` } className={ `w-full ${ className }` }
id={ id }
ref={ ref }
placeholder={ "¬A & B -> C" }
type={ "text" }
onChange={ onChange }

View File

@ -10,7 +10,7 @@ export const Link: Component<LinkProps> = (
id,
newTab = true,
title,
}) => (
}) => ( // TODO <A/> throws exception
<a href={ to } id={ id } title={ title }
rel={ `${ rel } ${ newTab ? "noreferrer" : undefined }` }
target={ newTab ? "_blank" : undefined }

20
src/pages/404.tsx Normal file
View File

@ -0,0 +1,20 @@
/* @refresh reload */
import { type Component } from "solid-js";
import { render } from "solid-js/web";
import Layout from "../components/layout";
import { Link } from "../components/link";
const PageNotFound: Component = () => (
<Layout title={ "Siden ble ikke funnet" }>
<div class={ "text-center" }>
<h4>Error 404 - Siden ble ikke funnet</h4>
<p>
<Link to={ "/" } newTab={ false } className={ "mx-auto relative w-max" }>
tilbake til forsiden
</Link>
</p>
</div>
</Layout>
);
export default PageNotFound;

View File

@ -1,11 +1,11 @@
/* @refresh reload */
import { For, render } from "solid-js/web";
import { For } from "solid-js/web";
import "./index.css";
import "../index.css";
import { type Component } from "solid-js";
import Layout from "./components/layout";
import Card from "./components/card";
import { Link } from "./components/link";
import Layout from "../components/layout";
import Card from "../components/card";
import { Link } from "../components/link";
const apiRoot = "https://api.martials.no";
@ -23,31 +23,33 @@ const cards = [
</ul>
</>,
to: apiRoot,
newTab: true,
},
{
title: "Hjemmeside",
children: <p>Sjekk ut mine andre prosjekter</p>,
to: "https://h600878.github.io/",
newTab: true,
},
{
title: "Forenkle sannhetsverdier",
children: <p>Implementering av API</p>,
to: `/simplify-truths.html`,
to: `/simplify-truths`,
}
] satisfies CardProps[];
const HomePage: Component = () => {
return (
<Layout title={ "Velkommen!" }>
<div class={ "flex flex-wrap justify-center mt-10" }>
<For each={ cards }>
{ card =>
<Card title={ card.title } className={ "m-4" } to={ card.to }>{ card.children }</Card>
}
</For>
</div>
</Layout>
);
};
const HomePage: Component = () => (
<Layout title={ "Velkommen!" }>
<div class={ "flex flex-wrap justify-center mt-10" }>
<For each={ cards }>
{ card =>
<Card title={ card.title } className={ "m-4" } to={ card.to } newTab={ card.newTab }>
{ card.children }
</Card>
}
</For>
</div>
</Layout>
);
render(() => <HomePage />, document.getElementById("root") as HTMLElement);
export default HomePage;

View File

@ -1,14 +1,14 @@
/* @refresh reload */
import Layout from "./components/layout";
import { Input, Search } from "./components/input";
import Layout from "../components/layout";
import { Input, Search } from "../components/input";
import { Icon } from "solid-heroicons";
import TruthTable from "./components/truth-table";
import { InfoBox, MyDisclosure, MyDisclosureContainer } from "./components/output";
import TruthTable from "../components/truth-table";
import { InfoBox, MyDisclosure, MyDisclosureContainer } from "../components/output";
import { diffChars } from "diff";
import MyMenu from "./components/menu";
import MyMenu from "../components/menu";
import { type Accessor, type Component, createSignal, JSX, onMount, Show } from "solid-js";
import { For, render } from "solid-js/web";
import Row from "./components/row";
import { For } from "solid-js/web";
import Row from "../components/row";
import {
arrowDownTray, arrowPath,
check,
@ -16,13 +16,14 @@ import {
eyeSlash,
funnel
} from "solid-heroicons/solid";
import { Button, MySwitch } from "./components/button";
import MyDialog from "./components/dialog";
import { exportToExcel } from "./utils/export";
import { Link } from "./components/link";
import { isTouch } from "./utils/touch";
import { replaceOperators } from "./utils/expressionUtils";
import { getElementById } from "./utils/dom";
import { Button, MySwitch } from "../components/button";
import MyDialog from "../components/dialog";
import { exportToExcel } from "../utils/export";
import { Link } from "../components/link";
import { isTouch } from "../utils/touch";
import { replaceOperators } from "../utils/expressionUtils";
import { getElementById } from "../utils/dom";
import { useSearchParams } from "@solidjs/router";
type Option = { name: string, value: "NONE" | "TRUE" | "FALSE" | "DEFAULT" | "TRUE_FIRST" | "FALSE_FIRST" };
@ -34,30 +35,14 @@ const fetchUrls = [
// TODO move some code to new components
const TruthTablePage: Component = () => {
let searchParams: URLSearchParams;
let simplifyDefault = true, inputContent = false, hideIntermediate = false;
const [searchParams, setSearchParams] = useSearchParams();
let inputElement: HTMLInputElement | undefined = undefined;
if (typeof location !== "undefined") {
searchParams = new URLSearchParams(location.search);
let simplifyDefault = searchParams.simplify === undefined || searchParams.simplify === "true",
inputContent = !!searchParams.exp,
hideIntermediate = searchParams.hideIntermediate === "true";
if (searchParams.has("simplify")) {
simplifyDefault = searchParams.get("simplify") === "true";
}
if (searchParams.has("exp")) {
inputContent = true;
}
if (searchParams.has("hideIntermediate")) {
hideIntermediate = searchParams.get("hideIntermediate") === "true";
}
}
/**
* Stores the boolean value of the simplify toggle
*/
const [simplifyEnabled, setSimplifyEnabled] = createSignal(simplifyDefault);
/**
* The state element used to store the simplified string, "empty string" by default
*/
const [fetchResult, setFetchResult] = createSignal<FetchResult | null>(null);
const hideOptions: Option[] = [
@ -75,28 +60,28 @@ const TruthTablePage: Component = () => {
];
const [sortValues, setSortValues] = createSignal(sortOptions[0]);
const [hideIntermediates, setHideIntermediates] = createSignal(hideIntermediate);
const [isLoaded, setIsLoaded] = createSignal<boolean | null>(null);
const [error, setError] = createSignal<{ title: string, message: string } | null>(null);
const [useLocalhost, setUseLocalhost] = createSignal(false);
/**
* Updates the state of the current expression to the new search with all whitespace removed.
* If the element is not found, reset.
*/
function onClick(e: { preventDefault: () => void; }): void {
function onClick(e: Event): void {
e.preventDefault(); // Stops the page from reloading onClick
let exp = getInputElement()?.value;
const exp = inputElement?.value;
if (exp) {
history.pushState(null, "", `?exp=${ encodeURIComponent(exp) }&simplify=${ simplifyEnabled() }&
hide=${ hideValues().value }&sort=${ sortValues().value }&hideIntermediate=${ hideIntermediates() }`);
setSearchParams({
exp,
simplify: simplifyEnabled(),
hide: hideValues().value,
sort: sortValues().value,
hideIntermediate: hideIntermediates()
});
getFetchResult(exp);
}
@ -125,26 +110,18 @@ hideIntermediate=${ hideIntermediates() }`)
}
}
const inputId = "truth-input";
function getInputElement(): HTMLInputElement | null {
return getElementById(inputId);
}
onMount((): void => {
const inputElement = getInputElement();
if (searchParams.has("exp")) {
const exp = searchParams.get("exp");
if (searchParams.exp) {
const exp = searchParams.exp;
if (exp && inputElement) {
inputElement.value = exp;
}
const hide = searchParams.get("hide");
const hide = searchParams.hide;
if (hide) {
setHideValues(hideOptions.find(o => o.value === hide) ?? hideOptions[0]);
}
const sort = searchParams.get("sort");
const sort = searchParams.sort;
if (sort) {
setSortValues(sortOptions.find(o => o.value === sort) ?? sortOptions[0]);
}
@ -184,7 +161,7 @@ hideIntermediate=${ hideIntermediates() }`)
<form class={ "flex-row-center" } onSubmit={ onClick } autocomplete={ "off" }>
<Search id={ inputId } typingDefault={ inputContent } />
<Search ref={ inputElement } typingDefault={ inputContent } />
<Button id={ "truth-input-button" }
title={ "Generate (Enter)" }
@ -269,17 +246,18 @@ hideIntermediate=${ hideIntermediates() }`)
</Row>
<Show when={ isLoaded() === false } keyed>
<Show when={ isLoaded() } fallback={
<Icon path={ arrowPath } aria-label={ "Loading indicator" } class={ "animate-spin mx-auto" } />
</Show>
} keyed>
<Show when={ error() && isLoaded() } keyed>
<ErrorBox title={ error()?.title ?? "Error" }
error={ error()?.message ?? "Something went wrong" } />
</Show>
<Show when={ error() } keyed>
<ErrorBox title={ error()?.title ?? "Error" }
error={ error()?.message ?? "Something went wrong" } />
</Show>
<Show when={ simplifyEnabled() && (fetchResult()?.orderOperations?.length ?? 0) > 0 } keyed>
<ShowMeHow fetchResult={ fetchResult } />
<Show when={ simplifyEnabled() && (fetchResult()?.orderOperations?.length ?? 0) > 0 } keyed>
<ShowMeHow fetchResult={ fetchResult } />
</Show>
</Show>
</div>
@ -322,7 +300,7 @@ const SingleMenuItem: Component<SingleMenuItem> = (
currentValue,
onClick
}) => {
const isSelected = () => currentValue && currentValue().value === option.value;
const isSelected = () => currentValue?.().value === option.value;
return (
<button class={ `hover:underline cursor-pointer last:mb-1 flex-row-center` }
onClick={ onClick }>
@ -441,5 +419,3 @@ const KeywordsDisclosure: Component = () => (
</table>
</MyDisclosure>
);
render(() => <TruthTablePage />, document.getElementById("root") as HTMLElement);

View File

@ -1,12 +1,13 @@
interface SimpleProps {
interface SimpleProps<T extends HTMLElement = HTMLElement> {
name?: string;
className?: string,
style?: import("solid-js").JSX.CSSProperties,
id?: string,
title?: string,
ref?: T,
}
interface ChildProps extends SimpleProps {
interface ChildProps<T extends HTMLElement = HTMLInputElement> extends SimpleProps<T> {
children?: import("solid-js").JSX.Element,
}
@ -16,7 +17,7 @@ interface LinkProps extends ChildProps {
newTab?: boolean,
}
interface TitleProps extends ChildProps {
interface TitleProps<T extends HTMLElement = HTMLElement> extends ChildProps<T> {
title?: string,
}
@ -25,7 +26,7 @@ interface ButtonProps extends TitleProps {
type?: "button" | "submit" | "reset",
}
interface InputProps<T> extends TitleProps {
interface InputProps<T extends HTMLElement = HTMLInputElement> extends TitleProps<T> {
onInput?: import("solid-js").JSX.EventHandlerUnion<T, Event>,
placeholder?: string,
required?: boolean,

View File

@ -10,9 +10,7 @@ export default defineConfig({
target: 'esnext',
rollupOptions: {
input: {
main: "index.html",
"404": "404.html",
simplifyTruths: "simplify-truths.html",
main: "app.html",
}
}
},