From a0bdf46866176fa42bda12d829b602656e2cb24c Mon Sep 17 00:00:00 2001 From: Emmanuel Raviart <emmanuel@raviart.com> Date: Fri, 23 Jul 2021 23:00:25 +0200 Subject: [PATCH] Upgrade packages & Svelte Kit. --- .eslintrc.cjs | 2 +- .gitignore | 3 +- .prettierignore | 2 +- package-lock.json | 130 ++++++++---------- package.json | 10 +- src/app.html | 2 +- src/global.d.ts | 2 - .../components/tutorial/StartTutorial.svelte | 3 - src/lib/decompositions.ts | 23 +++- src/lib/server/decompositions.ts | 16 ++- src/lib/situations.ts | 37 +++-- src/lib/variables.ts | 11 +- src/routes/simulation.svelte | 2 +- static/favicon.ico | Bin 1150 -> 0 bytes static/favicon.png | Bin 0 -> 1571 bytes svelte.config.js | 7 +- tsconfig.json | 21 ++- 17 files changed, 145 insertions(+), 126 deletions(-) delete mode 100644 static/favicon.ico create mode 100644 static/favicon.png diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 605f2438a..c4721b59f 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -19,6 +19,6 @@ module.exports = { }, root: true, settings: { - "svelte3/typescript": require("typescript"), + "svelte3/typescript": () => require("typescript"), }, } diff --git a/.gitignore b/.gitignore index 594419fe3..b4e1c1bc4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,4 @@ node_modules /*.env !/example.env /.svelte-kit -/build -/functions +/package diff --git a/.prettierignore b/.prettierignore index d292d2186..7dde8a0ae 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,4 @@ -.svelte/** +.svelte-kit/** build/** node_modules/** static/** diff --git a/package-lock.json b/package-lock.json index 9e74a4144..1244d1f3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "prettier-plugin-svelte": "^2.2.0", "sanitize-filename": "^1.6.3", "sockette": "^2.0.6", - "svelte": "^3.37.0", + "svelte": "^3.39.0", "svelte-check": "^2.0.0", "svelte-dnd-action": "^0.9.8", "svelte-json-tree": "github:eraviart/svelte-json-tree", @@ -306,15 +306,15 @@ } }, "node_modules/@sveltejs/kit": { - "version": "1.0.0-next.132", - "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.0.0-next.132.tgz", - "integrity": "sha512-mX3ihuyTQr3302ZpihG3gXfTBcDPODlJ6ZoYu6f7TGo8+1OdpuDdozgi1CKLkrUBHYGnPO4E75XOVKlgJLjBQw==", + "version": "1.0.0-next.137", + "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.0.0-next.137.tgz", + "integrity": "sha512-YdcwaN9zWcbz4jLZS4j9/7fNZIVO8WkXDuwGTiKARhOLIuuJAjCvSuOZ3btJdV/ySpizTWX22u632weVPLECdw==", "dev": true, "dependencies": { - "@sveltejs/vite-plugin-svelte": "^1.0.0-next.12", + "@sveltejs/vite-plugin-svelte": "^1.0.0-next.14", "cheap-watch": "^1.0.3", "sade": "^1.7.4", - "vite": "^2.4.1" + "vite": "^2.4.3" }, "bin": { "svelte-kit": "svelte-kit.js" @@ -327,25 +327,30 @@ } }, "node_modules/@sveltejs/vite-plugin-svelte": { - "version": "1.0.0-next.13", - "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-1.0.0-next.13.tgz", - "integrity": "sha512-hzacNmIOR55aE+yQj750R90+BbQERRVGjlu6TQLgy+Aw2bPmRJMLKvS/NmwO+I66DEiWQdFFHR+lxtwH4bbbXw==", + "version": "1.0.0-next.14", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-1.0.0-next.14.tgz", + "integrity": "sha512-46IKPtoGcdo6YLyUhvsXyC1Dg3m2HlbgreZqxM/h5DzavgUa75c/WHT5cIxxLppG+gxtct7V08/WNEdpFdmM3Q==", "dev": true, "dependencies": { "@rollup/pluginutils": "^4.1.1", "debug": "^4.3.2", - "diff-match-patch": "^1.0.5", "kleur": "^4.1.4", "magic-string": "^0.25.7", "require-relative": "^0.8.7", - "svelte-hmr": "^0.14.6" + "svelte-hmr": "^0.14.7" }, "engines": { "node": "^12.20 || ^14.13.1 || >= 16" }, "peerDependencies": { + "diff-match-patch": "^1.0.5", "svelte": "^3.34.0", "vite": "^2.3.7" + }, + "peerDependenciesMeta": { + "diff-match-patch": { + "optional": true + } } }, "node_modules/@tailwindcss/forms": { @@ -391,9 +396,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.4.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.4.0.tgz", - "integrity": "sha512-HrJuE7Mlqcjj+00JqMWpZ3tY8w7EUd+S0U3L1+PQSWiXZbOgyQDvi+ogoUxaHApPJq5diKxYBQwA3iIlNcPqOg==", + "version": "16.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.4.1.tgz", + "integrity": "sha512-UW7cbLqf/Wu5XH2RKKY1cHwUNLicIDRLMraYKz+HHAerJ0ZffUEk+fMnd8qU2JaS6cAy0r8tsaf7yqHASf/Y0Q==", "dev": true }, "node_modules/@types/parse-json": { @@ -954,9 +959,9 @@ "dev": true }, "node_modules/colord": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/colord/-/colord-2.3.0.tgz", - "integrity": "sha512-0NaS8lq6xZ9Zb+cWRwQf6ql1Z/7HMIAMzPrM2pgfAqskGAhUksBcaau6W8sL+6OK0xIujcSo1TJfdctG7K85Qg==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.4.0.tgz", + "integrity": "sha512-2306/NeTDOykDwvFQK0ctnP+9I5KQdqVm+IJAM6MsAr4vvy1llAdJyax4YmZoqTxdJ/lvRBwR8MqyJi/tupBAw==", "dev": true }, "node_modules/colorette": { @@ -1324,12 +1329,6 @@ "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", "dev": true }, - "node_modules/diff-match-patch": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.5.tgz", - "integrity": "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==", - "dev": true - }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -1425,9 +1424,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.3.782", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.782.tgz", - "integrity": "sha512-6AI2se1NqWA1SBf/tlD6tQD/6ZOt+yAhqmrTlh4XZw4/g0Mt3p6JhTQPZxRPxPZiOg0o7ss1EBP/CpYejfnoIA==", + "version": "1.3.785", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.785.tgz", + "integrity": "sha512-WmCgAeURsMFiyoJ646eUaJQ7GNfvMRLXo+GamUyKVNEM4MqTAsXyC0f38JEB4N3BtbD0tlAKozGP5E2T9K3YGg==", "dev": true }, "node_modules/emoji-regex": { @@ -3359,9 +3358,9 @@ "dev": true }, "node_modules/regenerator-runtime": { - "version": "0.13.7", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", - "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==", "dev": true }, "node_modules/regexpp": { @@ -3745,9 +3744,9 @@ "dev": true }, "node_modules/svelte-hmr": { - "version": "0.14.6", - "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.14.6.tgz", - "integrity": "sha512-0oXQmRiEh3uNjyVQiGmIE7imbKO4dYc1WL6XRXTC0X9XbSacJgj9MOLguqqbZygPsNnlglhlk4eB0pCmM6nQAA==", + "version": "0.14.7", + "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.14.7.tgz", + "integrity": "sha512-pDrzgcWSoMaK6AJkBWkmgIsecW0GChxYZSZieIYfCP0v2oPyx2CYU/zm7TBIcjLVUPP714WxmViE9Thht4etog==", "dev": true, "peerDependencies": { "svelte": ">=3.19.0" @@ -3884,9 +3883,9 @@ "dev": true }, "node_modules/tailwindcss": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-2.2.5.tgz", - "integrity": "sha512-/85aI7qltFUXCF/zRKCm2Z1TYKy74DK3V4DP1gxz++YK0CgV3TlXB9h7ylKAukrc+ILcRPe6+dSQ1lbCj8XSJQ==", + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-2.2.7.tgz", + "integrity": "sha512-jv35rugP5j8PpzbXnsria7ZAry7Evh0KtQ4MZqNd+PhF+oIKPwJTVwe/rmfRx9cZw3W7iPZyzBmeoAoNwfJ1yg==", "dev": true, "dependencies": { "arg": "^5.0.0", @@ -4418,30 +4417,29 @@ } }, "@sveltejs/kit": { - "version": "1.0.0-next.132", - "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.0.0-next.132.tgz", - "integrity": "sha512-mX3ihuyTQr3302ZpihG3gXfTBcDPODlJ6ZoYu6f7TGo8+1OdpuDdozgi1CKLkrUBHYGnPO4E75XOVKlgJLjBQw==", + "version": "1.0.0-next.137", + "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.0.0-next.137.tgz", + "integrity": "sha512-YdcwaN9zWcbz4jLZS4j9/7fNZIVO8WkXDuwGTiKARhOLIuuJAjCvSuOZ3btJdV/ySpizTWX22u632weVPLECdw==", "dev": true, "requires": { - "@sveltejs/vite-plugin-svelte": "^1.0.0-next.12", + "@sveltejs/vite-plugin-svelte": "^1.0.0-next.14", "cheap-watch": "^1.0.3", "sade": "^1.7.4", - "vite": "^2.4.1" + "vite": "^2.4.3" } }, "@sveltejs/vite-plugin-svelte": { - "version": "1.0.0-next.13", - "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-1.0.0-next.13.tgz", - "integrity": "sha512-hzacNmIOR55aE+yQj750R90+BbQERRVGjlu6TQLgy+Aw2bPmRJMLKvS/NmwO+I66DEiWQdFFHR+lxtwH4bbbXw==", + "version": "1.0.0-next.14", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-1.0.0-next.14.tgz", + "integrity": "sha512-46IKPtoGcdo6YLyUhvsXyC1Dg3m2HlbgreZqxM/h5DzavgUa75c/WHT5cIxxLppG+gxtct7V08/WNEdpFdmM3Q==", "dev": true, "requires": { "@rollup/pluginutils": "^4.1.1", "debug": "^4.3.2", - "diff-match-patch": "^1.0.5", "kleur": "^4.1.4", "magic-string": "^0.25.7", "require-relative": "^0.8.7", - "svelte-hmr": "^0.14.6" + "svelte-hmr": "^0.14.7" } }, "@tailwindcss/forms": { @@ -4481,9 +4479,9 @@ "dev": true }, "@types/node": { - "version": "16.4.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.4.0.tgz", - "integrity": "sha512-HrJuE7Mlqcjj+00JqMWpZ3tY8w7EUd+S0U3L1+PQSWiXZbOgyQDvi+ogoUxaHApPJq5diKxYBQwA3iIlNcPqOg==", + "version": "16.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.4.1.tgz", + "integrity": "sha512-UW7cbLqf/Wu5XH2RKKY1cHwUNLicIDRLMraYKz+HHAerJ0ZffUEk+fMnd8qU2JaS6cAy0r8tsaf7yqHASf/Y0Q==", "dev": true }, "@types/parse-json": { @@ -4877,9 +4875,9 @@ } }, "colord": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/colord/-/colord-2.3.0.tgz", - "integrity": "sha512-0NaS8lq6xZ9Zb+cWRwQf6ql1Z/7HMIAMzPrM2pgfAqskGAhUksBcaau6W8sL+6OK0xIujcSo1TJfdctG7K85Qg==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.4.0.tgz", + "integrity": "sha512-2306/NeTDOykDwvFQK0ctnP+9I5KQdqVm+IJAM6MsAr4vvy1llAdJyax4YmZoqTxdJ/lvRBwR8MqyJi/tupBAw==", "dev": true }, "colorette": { @@ -5164,12 +5162,6 @@ "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", "dev": true }, - "diff-match-patch": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.5.tgz", - "integrity": "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==", - "dev": true - }, "dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -5238,9 +5230,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.782", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.782.tgz", - "integrity": "sha512-6AI2se1NqWA1SBf/tlD6tQD/6ZOt+yAhqmrTlh4XZw4/g0Mt3p6JhTQPZxRPxPZiOg0o7ss1EBP/CpYejfnoIA==", + "version": "1.3.785", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.785.tgz", + "integrity": "sha512-WmCgAeURsMFiyoJ646eUaJQ7GNfvMRLXo+GamUyKVNEM4MqTAsXyC0f38JEB4N3BtbD0tlAKozGP5E2T9K3YGg==", "dev": true }, "emoji-regex": { @@ -6647,9 +6639,9 @@ } }, "regenerator-runtime": { - "version": "0.13.7", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", - "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==", "dev": true }, "regexpp": { @@ -6927,9 +6919,9 @@ "dev": true }, "svelte-hmr": { - "version": "0.14.6", - "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.14.6.tgz", - "integrity": "sha512-0oXQmRiEh3uNjyVQiGmIE7imbKO4dYc1WL6XRXTC0X9XbSacJgj9MOLguqqbZygPsNnlglhlk4eB0pCmM6nQAA==", + "version": "0.14.7", + "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.14.7.tgz", + "integrity": "sha512-pDrzgcWSoMaK6AJkBWkmgIsecW0GChxYZSZieIYfCP0v2oPyx2CYU/zm7TBIcjLVUPP714WxmViE9Thht4etog==", "dev": true, "requires": {} }, @@ -7000,9 +6992,9 @@ } }, "tailwindcss": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-2.2.5.tgz", - "integrity": "sha512-/85aI7qltFUXCF/zRKCm2Z1TYKy74DK3V4DP1gxz++YK0CgV3TlXB9h7ylKAukrc+ILcRPe6+dSQ1lbCj8XSJQ==", + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-2.2.7.tgz", + "integrity": "sha512-jv35rugP5j8PpzbXnsria7ZAry7Evh0KtQ4MZqNd+PhF+oIKPwJTVwe/rmfRx9cZw3W7iPZyzBmeoAoNwfJ1yg==", "dev": true, "requires": { "arg": "^5.0.0", diff --git a/package.json b/package.json index a7e06eaf8..a83428169 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,9 @@ "check": "svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch", "dev": "svelte-kit dev", - "format": "prettier --write .", - "lint": "prettier --check . && eslint--ignore-path .gitignore .", - "prettier": "prettier --plugin-search-dir=. --write \"*.cjs\" --write \"src/*.ts\" \"src/**/*.ts\" \"src/**/*.svelte\"", - "preview": "svelte-kit preview", - "start": "svelte-kit start" + "format": "prettier --write --plugin-search-dir=. .", + "lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .", + "preview": "svelte-kit preview" }, "devDependencies": { "@auditors/core": "^0.1.7", @@ -41,7 +39,7 @@ "prettier-plugin-svelte": "^2.2.0", "sanitize-filename": "^1.6.3", "sockette": "^2.0.6", - "svelte": "^3.37.0", + "svelte": "^3.39.0", "svelte-check": "^2.0.0", "svelte-dnd-action": "^0.9.8", "svelte-json-tree": "github:eraviart/svelte-json-tree", diff --git a/src/app.html b/src/app.html index c4d7cde65..7921122ef 100644 --- a/src/app.html +++ b/src/app.html @@ -2,7 +2,7 @@ <html lang="fr"> <head> <meta charset="utf-8" /> - <link rel="icon" href="/favicon.ico" /> + <link rel="icon" href="/favicon.png" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> %svelte.head% </head> diff --git a/src/global.d.ts b/src/global.d.ts index c57bce8c6..357a61643 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -1,6 +1,4 @@ /// <reference types="@sveltejs/kit" /> -/// <reference types="svelte" /> -/// <reference types="vite/client" /> // See: https://github.com/isaacHagoel/svelte-dnd-action#typescript // Needed until following bug is solved: diff --git a/src/lib/components/tutorial/StartTutorial.svelte b/src/lib/components/tutorial/StartTutorial.svelte index a49ca302b..871ce2d0b 100644 --- a/src/lib/components/tutorial/StartTutorial.svelte +++ b/src/lib/components/tutorial/StartTutorial.svelte @@ -1,6 +1,3 @@ -<script lang="ts"> -</script> - <div class="bg-white border-le-bleu-light border-4 shadow-lg rounded-md my-12 mx-2 xl:mx-10" > diff --git a/src/lib/decompositions.ts b/src/lib/decompositions.ts index f41442764..fdd9e6a89 100644 --- a/src/lib/decompositions.ts +++ b/src/lib/decompositions.ts @@ -68,9 +68,15 @@ export function decompositionByNameFromCore( decomposition.childrenName = decompositionCore.children let ancestor: Decomposition | undefined = undefined let depth = 0 - for (const ancestorName of iterDecompositionAncestorsName(decompositionByName, name)) { + for (const ancestorName of iterDecompositionAncestorsName( + decompositionByName, + name, + )) { if (depth === 0) { - const ancestorIndex = ancestor === undefined ? 0 : ancestor.childrenName.indexOf(ancestorName) + const ancestorIndex = + ancestor === undefined + ? 0 + : ancestor.childrenName.indexOf(ancestorName) if (ancestorIndex > 0) { depth++ } @@ -197,20 +203,22 @@ export function updateDecompositionEvaluations( return newDecompositionByName } -export function updateVectorIndex(decompositionByName: DecompositionByName, vectorIndex: number +export function updateVectorIndex( + decompositionByName: DecompositionByName, + vectorIndex: number, ): DecompositionByName { let changed = false const newDecompositionByName: DecompositionByName = {} for (const [name, decomposition] of Object.entries(decompositionByName)) { let decompositionChanged = false const newDecomposition = { ...decomposition } - const { delta, deltaAtVectorIndex, values, valuesAtVectorIndex } = decomposition + const { delta, deltaAtVectorIndex, values, valuesAtVectorIndex } = + decomposition if (vectorIndex < delta.length) { const newDeltaAtVectorIndex = delta[vectorIndex] if (newDeltaAtVectorIndex != deltaAtVectorIndex) { newDecomposition.deltaAtVectorIndex = newDeltaAtVectorIndex decompositionChanged = true - } } if (vectorIndex < values.length) { @@ -218,10 +226,11 @@ export function updateVectorIndex(decompositionByName: DecompositionByName, vect if (newValuesAtVectorIndex != valuesAtVectorIndex) { newDecomposition.valuesAtVectorIndex = newValuesAtVectorIndex decompositionChanged = true - } } - newDecompositionByName[name] = decompositionChanged ? newDecomposition : decomposition + newDecompositionByName[name] = decompositionChanged + ? newDecomposition + : decomposition if (decompositionChanged) { changed = true } diff --git a/src/lib/server/decompositions.ts b/src/lib/server/decompositions.ts index 8f1e26563..1255d075e 100644 --- a/src/lib/server/decompositions.ts +++ b/src/lib/server/decompositions.ts @@ -2,11 +2,11 @@ import assert from "assert" import fs from "fs-extra" import type { DecompositionCore } from "$lib/decompositions" -import { decompositionByNameFromCore, walkDecompositionsCore } from "$lib/decompositions" -import type { - Variable, - VariableByName, -} from "@openfisca/ast" +import { + decompositionByNameFromCore, + walkDecompositionsCore, +} from "$lib/decompositions" +import type { Variable, VariableByName } from "@openfisca/ast" import config from "$lib/server/config" import { variableSummaryByName } from "$lib/server/variables" import { guessVariableLastReview } from "$lib/variables" @@ -22,7 +22,11 @@ assert.notStrictEqual( undefined, ) -for (const [variableName, decompositionCore] of walkDecompositionsCore(decompositionCoreByName, rootDecompositionName, false)) { +for (const [variableName, decompositionCore] of walkDecompositionsCore( + decompositionCoreByName, + rootDecompositionName, + false, +)) { const variable = variableSummaryByName[variableName] decompositionCore.label = variable.ux_name ?? variable.label const lastReview = guessVariableLastReview(variable) diff --git a/src/lib/situations.ts b/src/lib/situations.ts index 10536879b..a1b943880 100644 --- a/src/lib/situations.ts +++ b/src/lib/situations.ts @@ -25,9 +25,9 @@ export interface Population extends PopulationWithoutId { export interface PopulationWithoutId { name?: string [key: string]: - | { [instant: string]: boolean | number | string | null } // variable value by instant - | string // id & name - | string[] // ids of persons (when key is a role and entity is not a person) + | { [instant: string]: boolean | number | string | null } // variable value by instant + | string // id & name + | string[] // ids of persons (when key is a role and entity is not a person) } export interface Situation { @@ -43,11 +43,11 @@ export function getPopulationReservedKeys(entity: Entity): Set<string> { entity.is_person ? ["name"] : [ - "name", - ...(entity as GroupEntity).roles.map((role) => - getRolePersonsIdKey(role), - ), - ], + "name", + ...(entity as GroupEntity).roles.map((role) => + getRolePersonsIdKey(role), + ), + ], ) } @@ -60,16 +60,23 @@ export function getSituationVariableValue( ): number | string { const entity = entityByKey[variable.entity] const entitySituation = situation[entity.key_plural] - return entitySituation?.[populationId]?.[variable.name]?.[ - year - ] ?? variable.default_value + return ( + entitySituation?.[populationId]?.[variable.name]?.[year] ?? + variable.default_value + ) } -export function indexOfSituationPopulationId(entity: Entity, situation: Situation, - populationId: string): number { +export function indexOfSituationPopulationId( + entity: Entity, + situation: Situation, + populationId: string, +): number { const entitySituation = situation[entity.key_plural] - return Object.keys(entitySituation).sort(([populationId1], [populationId2]) => populationId1.localeCompare(populationId2)).indexOf(populationId) - + return Object.keys(entitySituation) + .sort(([populationId1], [populationId2]) => + populationId1.localeCompare(populationId2), + ) + .indexOf(populationId) } export function* iterSituationVariablesName( diff --git a/src/lib/variables.ts b/src/lib/variables.ts index e3be8f9b7..b87344001 100644 --- a/src/lib/variables.ts +++ b/src/lib/variables.ts @@ -2,14 +2,18 @@ import type { Variable } from "@openfisca/ast" export type VariableValues = boolean[] | number[] | string[] -export function guessVariableLastReview(variable: Variable): string | undefined { +export function guessVariableLastReview( + variable: Variable, +): string | undefined { if (variable.last_review !== undefined) { return variable.last_review } if (variable.formulas === undefined) { return undefined } - const last_date = Object.keys(variable.formulas).sort((date1, date2) => date2.localeCompare(date1),)[0] + const last_date = Object.keys(variable.formulas).sort((date1, date2) => + date2.localeCompare(date1), + )[0] return last_date === "0001-01-01" ? undefined : last_date } @@ -26,7 +30,8 @@ export async function retrieveVariableSummaryByName( const res = await fetch(new URL(url, baseUrl).toString()) if (!res.ok) { console.error( - `Error ${res.status + `Error ${ + res.status } while retrieving variables at ${url}\n\n${await res.text()}`, ) return undefined diff --git a/src/routes/simulation.svelte b/src/routes/simulation.svelte index 5db0409bf..c1f075e9a 100644 --- a/src/routes/simulation.svelte +++ b/src/routes/simulation.svelte @@ -15,6 +15,7 @@ import TestCaseEdit from "$lib/components/test_cases/TestCaseEdit.svelte" import TestCasesPane from "$lib/components/test_cases/TestCasesPane.svelte" import VariableReferredInputsPane from "$lib/components/variables/VariableReferredInputsPane.svelte" + import StartTutorial from "$lib/components/tutorial/StartTutorial.svelte" import VariableReferredParametersPane from "$lib/components/variables/VariableReferredParametersPane.svelte" import type { DecompositionByName } from "$lib/decompositions" import { @@ -30,7 +31,6 @@ } from "$lib/situations" import { getPopulationReservedKeys } from "$lib/situations" import type { SelfTargetAProps } from "$lib/urls" - import StartTutorial from "$lib/components/tutorial/StartTutorial.svelte" type EditionMode = | { diff --git a/static/favicon.ico b/static/favicon.ico deleted file mode 100644 index d75d248ef0b15096a95054643a4d97f5d9b60846..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmZQzU}Ruq5D);-3Je)63=Con3=A3!3=9Gc3=9ek5OD?&U}0bo;)Y-l7X{n>XJCL} zE(W{*It+II?HKI-t1;O9X9bI+C`RKz^nvu7FxdQG$zc8eF@yF0cMR75?=jf^p8_=p zB#)*M%7y4RV6gpvP0a8A|CFx({~PE3|L;-q|38QG|Njg&|F1LH{ZD4F`_BV*3rIaw zE0oX7VEccLfY<;3tM>o@|M%a2F!=KQ|NpsL|NqyB0h{ri!S?@ZsNWE70hwj@U!1}E z|5dl*|Nnpf`u~5=ng9ROy8r(_eFJRF|67kCd>*&|{~2umpMm=a<OYa-DF*BRx19_A z|DU<(|9|b+|Nj}x|NoZ?`2W9S>Hq(4KmGsz>-Ycvy(|9zXLACZ(F}Dr#2t43IT-Bz zZ(w!&{~zRsklO$M>*xLdA6)zYKfmYy|E@*<|37;9|NpZ$|NpB;|NqZm{eK&S-G4R| zGi?8Nfb@4Q`~UyvZ-~1=^!mg9|Hrld2m9ga>;L~%qrmz%z~dF-es%`y|6A2#Aa>k* z^#6Zy=l}mZPyPS@`wzq{ko!Sqvp9m?--Kef-G5F7>;HST<Np7D_5T0=yHEfBx5@th zU(oyi|Cr|g|2voc{~yr^@f%pb-T&oi_A@Zp{_o{*`Tu|VhX4Qn{Qdv`#k>Fi>*oId zFXH?EKZ6A%OsA~-|KBzT?EcFPcK=1eZa~C=E`#m=E1>WynEe0$!x#Vm|NHm<|KUsj z|Hrre|G)R_|Nq~A{{Qb(0M>t=!S25>nto7Rm@wG>-@<77|CfH!|NqPOK=gn@0A$w6 zeUSKIu>C)i!R|j3TtC7MAT#(G?EdF6SpUDv?fU<JK-K^MolF1!&+PsGU)&!Yc2^nf z{_COW1?h)jNPI9d*!>6jXC62&+5G>+VEz9&gU$an40iub!FoaJV0y68AbCi-(q*vw z@5*5J--yBPKR3GG5A_TT59}Ej4)8NDG_W%;G%!OkBLl+$MpQP4|A3K!;R7=R!w+@_ JhJXAF3;<;C{Fnd$ diff --git a/static/favicon.png b/static/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..825b9e65af7c104cfb07089bb28659393b4f2097 GIT binary patch literal 1571 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 literal 0 HcmV?d00001 diff --git a/svelte.config.js b/svelte.config.js index 85eeb2bba..5593b2f7b 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,5 +1,5 @@ import node from "@sveltejs/adapter-node" -import sveltePreprocess from "svelte-preprocess" +import preprocess from "svelte-preprocess" /** @type {import('@sveltejs/kit').Config} */ const config = { @@ -16,10 +16,7 @@ const config = { // Consult https://github.com/sveltejs/svelte-preprocess // for more information about preprocessors preprocess: [ - sveltePreprocess({ - defaults: { - style: "postcss", - }, + preprocess({ postcss: true, }), ], diff --git a/tsconfig.json b/tsconfig.json index 1d2637b85..1d26442f0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,10 @@ "compilerOptions": { "moduleResolution": "node", "module": "es2020", - "lib": ["es2020"], + "lib": [ + "es2020", + "DOM" + ], "target": "es2019", /** svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript @@ -23,8 +26,18 @@ "allowJs": true, "checkJs": true, "paths": { - "$lib/*": ["src/lib/*"] + "$lib": [ + "src/lib" + ], + "$lib/*": [ + "src/lib/*" + ] } }, - "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"] -} + "include": [ + "src/**/*.d.ts", + "src/**/*.js", + "src/**/*.ts", + "src/**/*.svelte" + ] +} \ No newline at end of file -- GitLab