diff --git a/.eslintrc.js b/.eslintrc.js index 6f6d2b54..9ff9f7b0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,22 +1,21 @@ module.exports = { - // https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy - // This option interrupts the configuration hierarchy at this file - // Remove this if you have an higher level ESLint config file (it usually happens into a monorepos) - root: true, + // https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy + // This option interrupts the configuration hierarchy at this file + // Remove this if you have an higher level ESLint config file (it usually happens into a monorepos) + root: true, - parserOptions: { - parser: '@babel/eslint-parser', - ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features - sourceType: 'module' // Allows for the use of imports - }, + parserOptions: { + parser: '@babel/eslint-parser', + ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features + sourceType: 'module', // Allows for the use of imports + }, - env: { - browser: true, - 'vue/setup-compiler-macros': true - }, + env: { + browser: true, + 'vue/setup-compiler-macros': true, + }, - // Rules order is important, please avoid shuffling them - extends: [ + extends: [ // Base ESLint recommended rules // 'eslint:recommended', @@ -28,52 +27,60 @@ module.exports = { // 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead) 'standard' - + ], - plugins: [ - // https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files - // required to lint *.vue files - 'vue', - - ], - globals: { - ga: 'readonly', // Google Analytics - cordova: 'readonly', - __statics: 'readonly', - __QUASAR_SSR__: 'readonly', - __QUASAR_SSR_SERVER__: 'readonly', - __QUASAR_SSR_CLIENT__: 'readonly', - __QUASAR_SSR_PWA__: 'readonly', - process: 'readonly', - Capacitor: 'readonly', - chrome: 'readonly' - }, - // add your custom rules here - rules: { - - // allow async-await - 'generator-star-spacing': 'off', - // allow paren-less arrow functions - 'arrow-parens': 'off', - 'one-var': 'off', - 'no-void': 'off', - 'multiline-ternary': 'off', + plugins: ['vue', 'prettier'], - 'import/first': 'off', - 'import/named': 'error', - 'import/namespace': 'error', - 'import/default': 'error', - 'import/export': 'error', - 'import/extensions': 'off', - 'import/no-unresolved': 'off', - 'import/no-extraneous-dependencies': 'off', - - 'prefer-promise-reject-errors': 'off', + globals: { + ga: 'readonly', // Google Analytics + cordova: 'readonly', + __statics: 'readonly', + __QUASAR_SSR__: 'readonly', + __QUASAR_SSR_SERVER__: 'readonly', + __QUASAR_SSR_CLIENT__: 'readonly', + __QUASAR_SSR_PWA__: 'readonly', + process: 'readonly', + Capacitor: 'readonly', + chrome: 'readonly', + }, - // allow debugger during development only - 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' - } -} + // add your custom rules here + rules: { + // allow async-await + 'generator-star-spacing': 'off', + // allow paren-less arrow functions + 'arrow-parens': 'off', + 'one-var': 'off', + 'no-void': 'off', + 'multiline-ternary': 'off', + + 'import/first': 'off', + 'import/named': 'error', + 'import/namespace': 'error', + 'import/default': 'error', + 'import/export': 'error', + 'import/extensions': 'off', + 'import/no-unresolved': 'off', + 'import/no-extraneous-dependencies': 'off', + + 'prefer-promise-reject-errors': 'off', + semi: 'off', + // allow debugger during development only + 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', + }, + overrides: [ + { + extends: [ + 'plugin:vue/vue3-essential', + ], + files: ['src/**/*.{js,vue,scss}'], // Aplica ESLint solo a archivos .js y .vue dentro de src + rules: { + semi: 'off', + indent: ['error', 4, { SwitchCase: 1 }], + }, + }, + ], +}; diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 00000000..44b30174 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,9 @@ +module.exports = { + printWidth: 80, + tabWidth: 4, + useTabs: false, + singleQuote: true, + trailingComma: 'all', + bracketSpacing: true, + arrowParens: 'avoid', +}; diff --git a/.vscode/settings.json b/.vscode/settings.json index 303c0014..00be94bb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,4 +14,4 @@ "typescript", "vue" ] -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index 0ed1988c..e203cc99 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,12 +32,14 @@ "assets-webpack-plugin": "^7.1.1", "babel-loader": "^9.1.0", "bundle-loader": "^0.5.6", - "eslint": "^8.10.0", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", "eslint-config-standard": "^17.0.0", "eslint-plugin-import": "^2.19.1", "eslint-plugin-n": "^15.0.0", + "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-promise": "^6.0.0", - "eslint-plugin-vue": "^9.0.0", + "eslint-plugin-vue": "^9.27.0", "eslint-webpack-plugin": "^3.1.1", "file-loader": "^6.2.0", "fs-extra": "^10.1.0", @@ -1976,16 +1978,40 @@ "node": ">=10.0.0" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", + "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, "node_modules/@eslint/eslintrc": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", - "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.4.0", - "globals": "^13.15.0", + "espree": "^9.6.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -2017,6 +2043,15 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/@eslint/js": { + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", @@ -2024,13 +2059,14 @@ "dev": true }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.7", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz", - "integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "deprecated": "Use @eslint/config-array instead", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" }, "engines": { @@ -2051,9 +2087,10 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", "dev": true }, "node_modules/@intlify/bundle-utils": { @@ -2364,6 +2401,18 @@ "node": ">=10" } }, + "node_modules/@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/@polka/url": { "version": "1.0.0-next.21", "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz", @@ -3375,6 +3424,12 @@ "@types/node": "*" } }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, "node_modules/@vue/compiler-core": { "version": "3.2.45", "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.45.tgz", @@ -3696,9 +3751,9 @@ } }, "node_modules/acorn": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", - "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -6304,49 +6359,48 @@ } }, "node_modules/eslint": { - "version": "8.27.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.27.0.tgz", - "integrity": "sha512-0y1bfG2ho7mty+SiILVf9PfuRA49ek4Nc60Wmmu62QlobNR+CeXa4xXIJgcuwSQgZiWaPH+5BDsctpIW0PR/wQ==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.3.3", - "@humanwhocodes/config-array": "^0.11.6", + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", "glob-parent": "^6.0.2", - "globals": "^13.15.0", - "grapheme-splitter": "^1.0.4", + "globals": "^13.19.0", + "graphemer": "^1.4.0", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", - "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", + "optionator": "^0.9.3", "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" }, "bin": { @@ -6359,6 +6413,18 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-config-standard": { "version": "17.0.0", "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", @@ -6552,6 +6618,36 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-plugin-prettier": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz", + "integrity": "sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==", + "dev": true, + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.8.6" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": "*", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, "node_modules/eslint-plugin-promise": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz", @@ -6565,30 +6661,31 @@ } }, "node_modules/eslint-plugin-vue": { - "version": "9.8.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-9.8.0.tgz", - "integrity": "sha512-E/AXwcTzunyzM83C2QqDHxepMzvI2y6x+mmeYHbVDQlKFqmKYvRrhaVixEeeG27uI44p9oKDFiyCRw4XxgtfHA==", + "version": "9.27.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-9.27.0.tgz", + "integrity": "sha512-5Dw3yxEyuBSXTzT5/Ge1X5kIkRTQ3nvBn/VwPwInNiZBSJOO/timWMUaflONnFBzU6NhB68lxnCda7ULV5N7LA==", "dev": true, "dependencies": { - "eslint-utils": "^3.0.0", + "@eslint-community/eslint-utils": "^4.4.0", + "globals": "^13.24.0", "natural-compare": "^1.4.0", - "nth-check": "^2.0.1", - "postcss-selector-parser": "^6.0.9", - "semver": "^7.3.5", - "vue-eslint-parser": "^9.0.1", + "nth-check": "^2.1.1", + "postcss-selector-parser": "^6.0.15", + "semver": "^7.6.0", + "vue-eslint-parser": "^9.4.3", "xml-name-validator": "^4.0.0" }, "engines": { "node": "^14.17.0 || >=16.0.0" }, "peerDependencies": { - "eslint": "^6.2.0 || ^7.0.0 || ^8.0.0" + "eslint": "^6.2.0 || ^7.0.0 || ^8.0.0 || ^9.0.0" } }, "node_modules/eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", @@ -6596,6 +6693,9 @@ }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/eslint-utils": { @@ -6626,12 +6726,15 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/eslint-webpack-plugin": { @@ -6753,14 +6856,14 @@ } }, "node_modules/espree": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", - "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, "dependencies": { - "acorn": "^8.8.0", + "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.1" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -6782,9 +6885,9 @@ } }, "node_modules/esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, "dependencies": { "estraverse": "^5.1.0" @@ -7039,6 +7142,12 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, "node_modules/fast-glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", @@ -7792,9 +7901,9 @@ } }, "node_modules/globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -7878,10 +7987,10 @@ "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, - "node_modules/grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, "node_modules/gzip-size": { @@ -8957,12 +9066,6 @@ "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==", "dev": true }, - "node_modules/js-sdsl": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz", - "integrity": "sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q==", - "dev": true - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -10419,9 +10522,9 @@ } }, "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, "dependencies": { "deep-is": "^0.1.3", @@ -10429,7 +10532,7 @@ "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "word-wrap": "^1.2.5" }, "engines": { "node": ">= 0.8.0" @@ -11385,9 +11488,9 @@ } }, "node_modules/postcss-selector-parser": { - "version": "6.0.10", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz", - "integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.1.tgz", + "integrity": "sha512-b4dlw/9V8A71rLIDsSwVmak9z2DuBUB7CA1/wSdelNEzqsjoSPeADTWNO09lpH49Diy3/JIZ2bSPB1dI3LJCHg==", "dev": true, "dependencies": { "cssesc": "^3.0.0", @@ -11443,6 +11546,34 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "peer": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/pretty-error": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz", @@ -12486,13 +12617,10 @@ } }, "node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, "bin": { "semver": "bin/semver.js" }, @@ -13203,6 +13331,22 @@ "node": ">= 10" } }, + "node_modules/synckit": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.8.tgz", + "integrity": "sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==", + "dev": true, + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/table": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", @@ -13506,9 +13650,9 @@ } }, "node_modules/tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", "dev": true }, "node_modules/tunnel-agent": { @@ -13852,9 +13996,9 @@ } }, "node_modules/vue-eslint-parser": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.1.0.tgz", - "integrity": "sha512-NGn/iQy8/Wb7RrRa4aRkokyCZfOUWk19OP5HP6JEozQFX5AoS/t+Z0ZN7FY4LlmWc4FNI922V7cvX28zctN8dQ==", + "version": "9.4.3", + "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.4.3.tgz", + "integrity": "sha512-2rYRLWlIpaiN8xbPiDyXZXRgLGOtWxERV7ND5fFAv5qo1D2N9Fu9MNajBNc6o13lZ+24DAWCkQCvj4klgmcITg==", "dev": true, "dependencies": { "debug": "^4.3.4", @@ -14475,9 +14619,9 @@ "dev": true }, "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true, "engines": { "node": ">=0.10.0" @@ -16008,16 +16152,31 @@ "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", "dev": true }, + "@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^3.3.0" + } + }, + "@eslint-community/regexpp": { + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", + "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", + "dev": true + }, "@eslint/eslintrc": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", - "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.4.0", - "globals": "^13.15.0", + "espree": "^9.6.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -16042,6 +16201,12 @@ } } }, + "@eslint/js": { + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "dev": true + }, "@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", @@ -16049,13 +16214,13 @@ "dev": true }, "@humanwhocodes/config-array": { - "version": "0.11.7", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz", - "integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", "dev": true, "requires": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" } }, @@ -16066,9 +16231,9 @@ "dev": true }, "@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "dev": true }, "@intlify/bundle-utils": { @@ -16301,6 +16466,12 @@ "rimraf": "^3.0.2" } }, + "@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "dev": true + }, "@polka/url": { "version": "1.0.0-next.21", "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz", @@ -17072,6 +17243,12 @@ "@types/node": "*" } }, + "@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, "@vue/compiler-core": { "version": "3.2.45", "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.45.tgz", @@ -17374,9 +17551,9 @@ } }, "acorn": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", - "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true }, "acorn-import-assertions": { @@ -19312,49 +19489,48 @@ "dev": true }, "eslint": { - "version": "8.27.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.27.0.tgz", - "integrity": "sha512-0y1bfG2ho7mty+SiILVf9PfuRA49ek4Nc60Wmmu62QlobNR+CeXa4xXIJgcuwSQgZiWaPH+5BDsctpIW0PR/wQ==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.3.3", - "@humanwhocodes/config-array": "^0.11.6", + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", "glob-parent": "^6.0.2", - "globals": "^13.15.0", - "grapheme-splitter": "^1.0.4", + "globals": "^13.19.0", + "graphemer": "^1.4.0", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", - "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", + "optionator": "^0.9.3", "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" }, "dependencies": { @@ -19375,6 +19551,13 @@ } } }, + "eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "requires": {} + }, "eslint-config-standard": { "version": "17.0.0", "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", @@ -19513,6 +19696,16 @@ "semver": "^7.3.8" } }, + "eslint-plugin-prettier": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz", + "integrity": "sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==", + "dev": true, + "requires": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.8.6" + } + }, "eslint-plugin-promise": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz", @@ -19521,24 +19714,25 @@ "requires": {} }, "eslint-plugin-vue": { - "version": "9.8.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-9.8.0.tgz", - "integrity": "sha512-E/AXwcTzunyzM83C2QqDHxepMzvI2y6x+mmeYHbVDQlKFqmKYvRrhaVixEeeG27uI44p9oKDFiyCRw4XxgtfHA==", + "version": "9.27.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-9.27.0.tgz", + "integrity": "sha512-5Dw3yxEyuBSXTzT5/Ge1X5kIkRTQ3nvBn/VwPwInNiZBSJOO/timWMUaflONnFBzU6NhB68lxnCda7ULV5N7LA==", "dev": true, "requires": { - "eslint-utils": "^3.0.0", + "@eslint-community/eslint-utils": "^4.4.0", + "globals": "^13.24.0", "natural-compare": "^1.4.0", - "nth-check": "^2.0.1", - "postcss-selector-parser": "^6.0.9", - "semver": "^7.3.5", - "vue-eslint-parser": "^9.0.1", + "nth-check": "^2.1.1", + "postcss-selector-parser": "^6.0.15", + "semver": "^7.6.0", + "vue-eslint-parser": "^9.4.3", "xml-name-validator": "^4.0.0" } }, "eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, "requires": { "esrecurse": "^4.3.0", @@ -19563,9 +19757,9 @@ } }, "eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true }, "eslint-webpack-plugin": { @@ -19637,14 +19831,14 @@ } }, "espree": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", - "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, "requires": { - "acorn": "^8.8.0", + "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.1" } }, "esprima": { @@ -19653,9 +19847,9 @@ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, "requires": { "estraverse": "^5.1.0" @@ -19856,6 +20050,12 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, + "fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, "fast-glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", @@ -20412,9 +20612,9 @@ "dev": true }, "globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -20476,10 +20676,10 @@ "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, - "grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, "gzip-size": { @@ -21251,12 +21451,6 @@ "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==", "dev": true }, - "js-sdsl": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz", - "integrity": "sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q==", - "dev": true - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -22361,9 +22555,9 @@ "dev": true }, "optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, "requires": { "deep-is": "^0.1.3", @@ -22371,7 +22565,7 @@ "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "word-wrap": "^1.2.5" } }, "ora": { @@ -22993,9 +23187,9 @@ } }, "postcss-selector-parser": { - "version": "6.0.10", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz", - "integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.1.tgz", + "integrity": "sha512-b4dlw/9V8A71rLIDsSwVmak9z2DuBUB7CA1/wSdelNEzqsjoSPeADTWNO09lpH49Diy3/JIZ2bSPB1dI3LJCHg==", "dev": true, "requires": { "cssesc": "^3.0.0", @@ -23033,6 +23227,22 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "peer": true + }, + "prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "requires": { + "fast-diff": "^1.1.2" + } + }, "pretty-error": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz", @@ -23812,13 +24022,10 @@ } }, "semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true }, "send": { "version": "0.18.0", @@ -24381,6 +24588,16 @@ } } }, + "synckit": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.8.tgz", + "integrity": "sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==", + "dev": true, + "requires": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + } + }, "table": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", @@ -24612,9 +24829,9 @@ } }, "tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", "dev": true }, "tunnel-agent": { @@ -24858,9 +25075,9 @@ } }, "vue-eslint-parser": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.1.0.tgz", - "integrity": "sha512-NGn/iQy8/Wb7RrRa4aRkokyCZfOUWk19OP5HP6JEozQFX5AoS/t+Z0ZN7FY4LlmWc4FNI922V7cvX28zctN8dQ==", + "version": "9.4.3", + "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.4.3.tgz", + "integrity": "sha512-2rYRLWlIpaiN8xbPiDyXZXRgLGOtWxERV7ND5fFAv5qo1D2N9Fu9MNajBNc6o13lZ+24DAWCkQCvj4klgmcITg==", "dev": true, "requires": { "debug": "^4.3.4", @@ -25298,9 +25515,9 @@ "dev": true }, "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true }, "wrap-ansi": { diff --git a/package.json b/package.json index 2d7bd877..b5ed0542 100644 --- a/package.json +++ b/package.json @@ -17,12 +17,14 @@ "assets-webpack-plugin": "^7.1.1", "babel-loader": "^9.1.0", "bundle-loader": "^0.5.6", - "eslint": "^8.10.0", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", "eslint-config-standard": "^17.0.0", "eslint-plugin-import": "^2.19.1", "eslint-plugin-n": "^15.0.0", + "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-promise": "^6.0.0", - "eslint-plugin-vue": "^9.0.0", + "eslint-plugin-vue": "^9.27.0", "eslint-webpack-plugin": "^3.1.1", "file-loader": "^6.2.0", "fs-extra": "^10.1.0", diff --git a/src/App.vue b/src/App.vue index 38442ee0..7b59c16c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,6 +6,6 @@ import { defineComponent } from 'vue' export default defineComponent({ - name: 'App' + name: 'App' }) diff --git a/src/boot/app.js b/src/boot/app.js index 211e2092..824a26a1 100644 --- a/src/boot/app.js +++ b/src/boot/app.js @@ -3,8 +3,8 @@ import { appStore } from 'stores/app' import { userStore } from 'stores/user' export default boot(({ app }) => { - const props = app.config.globalProperties - props.$app = appStore() - props.$user = userStore() - props.$actions = document.createElement('div') + const props = app.config.globalProperties + props.$app = appStore() + props.$user = userStore() + props.$actions = document.createElement('div') }) diff --git a/src/boot/axios.js b/src/boot/axios.js index 150a8d8d..b09fccc0 100644 --- a/src/boot/axios.js +++ b/src/boot/axios.js @@ -10,33 +10,33 @@ import axios from 'axios' // "export default () => {}" function below (which runs individually // for each client) const api = axios.create({ - baseURL: `//${location.hostname}:${location.port}/api/` + baseURL: `//${location.hostname}:${location.port}/api/` }) const jApi = new Connection() export default boot(({ app }) => { - const user = userStore() - function addToken (config) { - if (user.token) { - config.headers.Authorization = user.token + const user = userStore() + function addToken (config) { + if (user.token) { + config.headers.Authorization = user.token + } + return config } - return config - } - api.interceptors.request.use(addToken) - jApi.use(addToken) + api.interceptors.request.use(addToken) + jApi.use(addToken) - // for use inside Vue files (Options API) through this.$axios and this.$api + // for use inside Vue files (Options API) through this.$axios and this.$api - app.config.globalProperties.$axios = axios - // ^ ^ ^ this will allow you to use this.$axios (for Vue Options API form) - // so you won't necessarily have to import axios in each vue file + app.config.globalProperties.$axios = axios + // ^ ^ ^ this will allow you to use this.$axios (for Vue Options API form) + // so you won't necessarily have to import axios in each vue file - app.config.globalProperties.$api = api - // ^ ^ ^ this will allow you to use this.$api (for Vue Options API form) - // so you can easily perform requests against your app's API + app.config.globalProperties.$api = api + // ^ ^ ^ this will allow you to use this.$api (for Vue Options API form) + // so you can easily perform requests against your app's API - app.config.globalProperties.$jApi = jApi + app.config.globalProperties.$jApi = jApi }) export { api, jApi } diff --git a/src/boot/error-handler.js b/src/boot/error-handler.js index dda7ac3e..1e11c952 100644 --- a/src/boot/error-handler.js +++ b/src/boot/error-handler.js @@ -1,6 +1,5 @@ - export default async ({ app }) => { -/* + /* window.addEventListener('error', e => onWindowError(e)); window.addEventListener('unhandledrejection', @@ -13,55 +12,55 @@ export default async ({ app }) => { errorHandler(event.reason); } */ - app.config.errorHandler = (err, vm, info) => { - errorHandler(err, vm) - } - - function errorHandler (err, vm) { - let message - let tMessage - let res = err.response - - // XXX: Compatibility with old JSON service - if (err.name === 'JsonException') { - res = { - status: err.statusCode, - data: { error: { message: err.message } } - } + app.config.errorHandler = (err, vm, info) => { + errorHandler(err, vm) } - if (res) { - const status = res.status + function errorHandler (err, vm) { + let message + let tMessage + let res = err.response - if (status >= 400 && status < 500) { - switch (status) { - case 401: - tMessage = 'loginFailed' - break - case 403: - tMessage = 'authenticationRequired' - vm.$router.push('/login') - break - case 404: - tMessage = 'notFound' - break - default: - message = res.data.error.message + // XXX: Compatibility with old JSON service + if (err.name === 'JsonException') { + res = { + status: err.statusCode, + data: { error: { message: err.message } } + } } - } else if (status >= 500) { - tMessage = 'internalServerError' - } - } else { - tMessage = 'somethingWentWrong' - console.error(err) - } - if (tMessage) { - message = vm.$t(tMessage) + if (res) { + const status = res.status + + if (status >= 400 && status < 500) { + switch (status) { + case 401: + tMessage = 'loginFailed' + break + case 403: + tMessage = 'authenticationRequired' + vm.$router.push('/login') + break + case 404: + tMessage = 'notFound' + break + default: + message = res.data.error.message + } + } else if (status >= 500) { + tMessage = 'internalServerError' + } + } else { + tMessage = 'somethingWentWrong' + console.error(err) + } + + if (tMessage) { + message = vm.$t(tMessage) + } + vm.$q.notify({ + message, + type: 'negative' + }) } - vm.$q.notify({ - message, - type: 'negative' - }) - } } diff --git a/src/boot/i18n.js b/src/boot/i18n.js index be1fd53e..85d0f9df 100644 --- a/src/boot/i18n.js +++ b/src/boot/i18n.js @@ -3,16 +3,16 @@ import { createI18n } from 'vue-i18n' import messages from 'src/i18n' export default boot(({ app }) => { - const i18n = createI18n({ - locale: 'es-ES', - globalInjection: true, - silentTranslationWarn: true, - silentFallbackWarn: true, - messages - }) + const i18n = createI18n({ + locale: 'es-ES', + globalInjection: true, + silentTranslationWarn: true, + silentFallbackWarn: true, + messages + }) - // Set i18n instance on app - app.use(i18n) + // Set i18n instance on app + app.use(i18n) - window.i18n = i18n.global + window.i18n = i18n.global }) diff --git a/src/css/app.scss b/src/css/app.scss index 6ff5ab78..3a0a70e0 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -5,8 +5,8 @@ src: url(./poppins.ttf) format('truetype'); } @font-face { - font-family: 'Open Sans'; - src: url(./opensans.ttf) format('truetype'); + font-family: 'Open Sans'; + src: url(./opensans.ttf) format('truetype'); } @mixin mobile { @media screen and (max-width: 960px) { @@ -28,7 +28,7 @@ a.link { } .q-card { border-radius: 7px; - box-shadow: 0 0 3px rgba(0, 0, 0, .1); + box-shadow: 0 0 3px rgba(0, 0, 0, 0.1); } .q-page-sticky.fixed-bottom-right { margin: 18px; diff --git a/src/css/quasar.variables.scss b/src/css/quasar.variables.scss index 67ad10cf..3707107b 100644 --- a/src/css/quasar.variables.scss +++ b/src/css/quasar.variables.scss @@ -12,17 +12,17 @@ // to match your app's branding. // Tip: Use the "Theme Builder" on Quasar's documentation website. -$primary : #1A1A1A; -$secondary : #26A69A; -$accent : #8cc63f; +$primary: #1a1a1a; +$secondary: #26a69a; +$accent: #8cc63f; -$dark : #1D1D1D; -$dark-page : #121212; +$dark: #1d1d1d; +$dark-page: #121212; -$positive : #21BA45; -$negative : #C10015; -$info : #31CCEC; -$warning : #F2C037; +$positive: #21ba45; +$negative: #c10015; +$info: #31ccec; +$warning: #f2c037; // Width diff --git a/src/css/width.scss b/src/css/width.scss index 6e01fe61..0772b9c5 100644 --- a/src/css/width.scss +++ b/src/css/width.scss @@ -1,25 +1,24 @@ - %margin-auto { - margin-left: auto; - margin-right: auto; + margin-left: auto; + margin-right: auto; } .vn-w-xs { - @extend %margin-auto; - max-width: $width-xs; + @extend %margin-auto; + max-width: $width-xs; } .vn-w-sm { - @extend %margin-auto; - max-width: $width-sm; + @extend %margin-auto; + max-width: $width-sm; } .vn-w-md { - @extend %margin-auto; - max-width: $width-md; + @extend %margin-auto; + max-width: $width-md; } .vn-w-lg { - @extend %margin-auto; - max-width: $width-lg; + @extend %margin-auto; + max-width: $width-lg; } .vn-w-xl { - @extend %margin-auto; - max-width: $width-xl; + @extend %margin-auto; + max-width: $width-xl; } diff --git a/src/i18n/en-US/index.js b/src/i18n/en-US/index.js index 9e717125..8a0a9207 100644 --- a/src/i18n/en-US/index.js +++ b/src/i18n/en-US/index.js @@ -2,84 +2,76 @@ // so you can safely delete all default props below export default { - failed: 'Action failed', - success: 'Action was successful', - internalServerError: 'Internal server error', - somethingWentWrong: 'Something went wrong', - loginFailed: 'Login failed', - authenticationRequired: 'Authentication required', - notFound: 'Not found', - today: 'Today', - yesterday: 'Yesterday', - tomorrow: 'Tomorrow', - date: { - days: [ - 'Sunday', - 'Monday', - 'Tuesday', - 'Wednesday', - 'Thursday', - 'Friday', - 'Saturday' - ], - daysShort: [ - 'Sun', - 'Mon', - 'Tue', - 'Wed', - 'Thu', - 'Fri', - 'Sat' - ], - months: [ - 'January', - 'February', - 'March', - 'April', - 'May', - 'June', - 'July', - 'August', - 'September', - 'October', - 'November', - 'December' - ], - shortMonths: [ - 'Jan', - 'Feb', - 'Mar', - 'Apr', - 'May', - 'Jun', - 'Jul', - 'Aug', - 'Sep', - 'Oct', - 'Nov', - 'Dec' - ] - }, + failed: 'Action failed', + success: 'Action was successful', + internalServerError: 'Internal server error', + somethingWentWrong: 'Something went wrong', + loginFailed: 'Login failed', + authenticationRequired: 'Authentication required', + notFound: 'Not found', + today: 'Today', + yesterday: 'Yesterday', + tomorrow: 'Tomorrow', + date: { + days: [ + 'Sunday', + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday' + ], + daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + months: [ + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December' + ], + shortMonths: [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec' + ] + }, - // menu - home: 'Home', - catalog: 'Catalog', - orders: 'Orders', - order: 'Pending order', - ticket: 'Order', - conditions: 'Conditions', - about: 'About us', - admin: 'Administration', - panel: 'Control panel', - users: 'Users', - connections: 'Connections', - visits: 'Visits', - news: 'News', - newEdit: 'Edit new', - images: 'Images', - items: 'Items', - config: 'Configuration', - user: 'User', - addresses: 'Addresses', - addressEdit: 'Edit address' + // menu + home: 'Home', + catalog: 'Catalog', + orders: 'Orders', + order: 'Pending order', + ticket: 'Order', + conditions: 'Conditions', + about: 'About us', + admin: 'Administration', + panel: 'Control panel', + users: 'Users', + connections: 'Connections', + visits: 'Visits', + news: 'News', + newEdit: 'Edit new', + images: 'Images', + items: 'Items', + config: 'Configuration', + user: 'User', + addresses: 'Addresses', + addressEdit: 'Edit address' } diff --git a/src/i18n/es-ES/index.js b/src/i18n/es-ES/index.js index f1cbef7b..23f60e10 100644 --- a/src/i18n/es-ES/index.js +++ b/src/i18n/es-ES/index.js @@ -2,84 +2,76 @@ // so you can safely delete all default props below export default { - failed: 'Acción fallida', - success: 'Acción exitosa', - internalServerError: 'Error interno del servidor', - somethingWentWrong: 'Algo salió mal', - loginFailed: 'Usuario o contraseña incorrectos', - authenticationRequired: 'Autenticación requerida', - notFound: 'No encontrado', - today: 'Hoy', - yesterday: 'Ayer', - tomorrow: 'Mañana', - date: { - days: [ - 'Domingo', - 'Lunes', - 'Martes', - 'Miércoles', - 'Jueves', - 'Viernes', - 'Sábado' - ], - daysShort: [ - 'Do', - 'Lu', - 'Mi', - 'Mi', - 'Ju', - 'Vi', - 'Sa' - ], - months: [ - 'Enero', - 'Febrero', - 'Marzo', - 'Abril', - 'Mayo', - 'Junio', - 'Julio', - 'Agosto', - 'Septiembre', - 'Octubre', - 'Noviembre', - 'Diciembre' - ], - shortMonths: [ - 'Ene', - 'Feb', - 'Mar', - 'Abr', - 'May', - 'Jun', - 'Jul', - 'Ago', - 'Sep', - 'Oct', - 'Nov', - 'Dic' - ] - }, + failed: 'Acción fallida', + success: 'Acción exitosa', + internalServerError: 'Error interno del servidor', + somethingWentWrong: 'Algo salió mal', + loginFailed: 'Usuario o contraseña incorrectos', + authenticationRequired: 'Autenticación requerida', + notFound: 'No encontrado', + today: 'Hoy', + yesterday: 'Ayer', + tomorrow: 'Mañana', + date: { + days: [ + 'Domingo', + 'Lunes', + 'Martes', + 'Miércoles', + 'Jueves', + 'Viernes', + 'Sábado' + ], + daysShort: ['Do', 'Lu', 'Mi', 'Mi', 'Ju', 'Vi', 'Sa'], + months: [ + 'Enero', + 'Febrero', + 'Marzo', + 'Abril', + 'Mayo', + 'Junio', + 'Julio', + 'Agosto', + 'Septiembre', + 'Octubre', + 'Noviembre', + 'Diciembre' + ], + shortMonths: [ + 'Ene', + 'Feb', + 'Mar', + 'Abr', + 'May', + 'Jun', + 'Jul', + 'Ago', + 'Sep', + 'Oct', + 'Nov', + 'Dic' + ] + }, - // Menu - home: 'Inicio', - catalog: 'Catálogo', - orders: 'Pedidos', - order: 'Pedido pendiente', - ticket: 'Pedido', - conditions: 'Condiciones', - about: 'Sobre nosotros', - admin: 'Administración', - panel: 'Panel de control', - users: 'Usuarios', - connections: 'Conexiones', - visits: 'Visitas', - news: 'Noticias', - newEdit: 'Editar noticia', - images: 'Imágenes', - items: 'Artículos', - config: 'Configuración', - user: 'Usuario', - addresses: 'Direcciones', - addressEdit: 'Editar dirección' + // Menu + home: 'Inicio', + catalog: 'Catálogo', + orders: 'Pedidos', + order: 'Pedido pendiente', + ticket: 'Pedido', + conditions: 'Condiciones', + about: 'Sobre nosotros', + admin: 'Administración', + panel: 'Panel de control', + users: 'Usuarios', + connections: 'Conexiones', + visits: 'Visitas', + news: 'Noticias', + newEdit: 'Editar noticia', + images: 'Imágenes', + items: 'Artículos', + config: 'Configuración', + user: 'Usuario', + addresses: 'Direcciones', + addressEdit: 'Editar dirección' } diff --git a/src/i18n/index.js b/src/i18n/index.js index 136539a4..6691d176 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -2,6 +2,6 @@ import enUS from './en-US' import esES from './es-ES' export default { - 'en-US': enUS, - 'es-ES': esES + 'en-US': enUS, + 'es-ES': esES } diff --git a/src/js/db/connection.js b/src/js/db/connection.js index d70364a1..c0bde0ff 100644 --- a/src/js/db/connection.js +++ b/src/js/db/connection.js @@ -12,163 +12,173 @@ import { ResultSet } from './result-set' * the user can send any statement to the server. For example: DROP DATABASE */ const Flag = { - NOT_NULL: 1, - PRI_KEY: 2, - AI: 512 | 2 | 1 + NOT_NULL: 1, + PRI_KEY: 2, + AI: 512 | 2 | 1 } const Type = { - BOOLEAN: 1, - INTEGER: 3, - DOUBLE: 4, - STRING: 5, - DATE: 8, - DATE_TIME: 9 + BOOLEAN: 1, + INTEGER: 3, + DOUBLE: 4, + STRING: 5, + DATE: 8, + DATE_TIME: 9 } export class Connection extends JsonConnection { - static Flag = Flag - static Type = Type + static Flag = Flag + static Type = Type - /** + /** * Runs a SQL query on the database. * * @param {String} sql The SQL statement * @return {ResultSet} The result */ - async execSql (sql) { - const json = await this.send('core/query', { sql }) - const results = [] - let err + async execSql (sql) { + const json = await this.send('core/query', { sql }) + const results = [] + let err - if (json) { - try { - if (json && json instanceof Array) { - for (let i = 0; i < json.length; i++) { - if (json[i] !== true) { - const rows = json[i].data - const columns = json[i].columns + if (json) { + try { + if (json && json instanceof Array) { + for (let i = 0; i < json.length; i++) { + if (json[i] !== true) { + const rows = json[i].data + const columns = json[i].columns - const data = new Array(rows.length) - results.push({ - data, - columns, - tables: json[i].tables - }) + const data = new Array(rows.length) + results.push({ + data, + columns, + tables: json[i].tables + }) - for (let j = 0; j < rows.length; j++) { - const row = data[j] = {} - for (let k = 0; k < columns.length; k++) { row[columns[k].name] = rows[j][k] } - } + for (let j = 0; j < rows.length; j++) { + const row = (data[j] = {}) + for (let k = 0; k < columns.length; k++) { + row[columns[k].name] = rows[j][k] + } + } - for (let j = 0; j < columns.length; j++) { - let castFunc = null - const col = columns[j] + for (let j = 0; j < columns.length; j++) { + let castFunc = null + const col = columns[j] - switch (col.type) { - case Type.DATE: - case Type.DATE_TIME: - case Type.TIMESTAMP: - castFunc = this.valueToDate - break + switch (col.type) { + case Type.DATE: + case Type.DATE_TIME: + case Type.TIMESTAMP: + castFunc = this.valueToDate + break + } + + if (castFunc !== null) { + if (col.def != null) { + col.def = castFunc(col.def) + } + + for (let k = 0; k < data.length; k++) { + if (data[k][col.name] != null) { + data[k][col.name] = castFunc(data[k][col.name]) + } + } + } + } + } else { + results.push(json[i]) + } + } } - - if (castFunc !== null) { - if (col.def != null) { col.def = castFunc(col.def) } - - for (let k = 0; k < data.length; k++) { - if (data[k][col.name] != null) { data[k][col.name] = castFunc(data[k][col.name]) } - } - } - } - } else { results.push(json[i]) } - } + } catch (e) { + err = e + } } - } catch (e) { - err = e - } + + return new ResultSet(results, err) } - return new ResultSet(results, err) - } - - /** + /** * Runs a query on the database. * * @param {String} query The SQL statement * @param {Object} params The query params * @return {ResultSet} The result */ - async execQuery (query, params) { - const sql = query.replace(/#\w+/g, key => { - const value = params[key.substring(1)] - return value ? this.renderValue(value) : key - }) + async execQuery (query, params) { + const sql = query.replace(/#\w+/g, (key) => { + const value = params[key.substring(1)] + return value ? this.renderValue(value) : key + }) - return await this.execSql(sql) - } - - async query (query, params) { - const res = await this.execQuery(query, params) - return res.fetchData() - } - - async getObject (query, params) { - const res = await this.execQuery(query, params) - return res.fetchObject() - } - - async getValue (query, params) { - const res = await this.execQuery(query, params) - return res.fetchValue() - } - - renderValue (v) { - switch (typeof v) { - case 'number': - return v - case 'boolean': - return (v) ? 'TRUE' : 'FALSE' - case 'string': - return "'" + v.replace(this.regexp, this.replaceFunc) + "'" - default: - if (v instanceof Date) { - if (!isNaN(v.getTime())) { - const unixTime = parseInt(fixTz(v).getTime() / 1000) - return 'DATE(FROM_UNIXTIME(' + unixTime + '))' - } else { return '0000-00-00' } - } else { return 'NULL' } + return await this.execSql(sql) } - } - /* + async query (query, params) { + const res = await this.execQuery(query, params) + return res.fetchData() + } + + async getObject (query, params) { + const res = await this.execQuery(query, params) + return res.fetchObject() + } + + async getValue (query, params) { + const res = await this.execQuery(query, params) + return res.fetchValue() + } + + renderValue (v) { + switch (typeof v) { + case 'number': + return v + case 'boolean': + return v ? 'TRUE' : 'FALSE' + case 'string': + return "'" + v.replace(this.regexp, this.replaceFunc) + "'" + default: + if (v instanceof Date) { + if (!isNaN(v.getTime())) { + const unixTime = parseInt(fixTz(v).getTime() / 1000) + return 'DATE(FROM_UNIXTIME(' + unixTime + '))' + } else { + return '0000-00-00' + } + } else { + return 'NULL' + } + } + } + + /* * Parses a value to date. */ - valueToDate (value) { - return fixTz(new Date(value)) - } + valueToDate (value) { + return fixTz(new Date(value)) + } } // TODO: Read time zone from db configuration const tz = { timeZone: 'Europe/Madrid' } -const isLocal = Intl - .DateTimeFormat() - .resolvedOptions() - .timeZone === tz.timeZone +const isLocal = Intl.DateTimeFormat().resolvedOptions().timeZone === tz.timeZone function fixTz (date) { - if (isLocal) return date + if (isLocal) return date - const localDate = new Date(date.toLocaleString('en-US', tz)) - const hasTime = localDate.getHours() || + const localDate = new Date(date.toLocaleString('en-US', tz)) + const hasTime = + localDate.getHours() || localDate.getMinutes() || localDate.getSeconds() || localDate.getMilliseconds() - if (!hasTime) { - date.setHours(date.getHours() + 12) - date.setHours(0, 0, 0, 0) - } + if (!hasTime) { + date.setHours(date.getHours() + 12) + date.setHours(0, 0, 0, 0) + } - return date + return date } diff --git a/src/js/db/result-set.js b/src/js/db/result-set.js index 4283f4ad..bb2d03d9 100644 --- a/src/js/db/result-set.js +++ b/src/js/db/result-set.js @@ -1,121 +1,130 @@ - import { Result } from './result' /** * This class stores the database results. */ export class ResultSet { - results = null - error = null + results = null + error = null - /** + /** * Initilizes the resultset object. */ - constructor (results, error) { - this.results = results - this.error = error - } + constructor (results, error) { + this.results = results + this.error = error + } - /** + /** * Gets the query error. * * @return {Db.Err} the error or null if no errors hapened */ - getError () { - return this.error - } + getError () { + return this.error + } - fetch () { - if (this.error) { throw this.error } + fetch () { + if (this.error) { + throw this.error + } - if (this.results !== null && - this.results.length > 0) { return this.results.shift() } + if (this.results !== null && this.results.length > 0) { + return this.results.shift() + } - return null - } + return null + } - /** + /** * Fetchs the next result from the resultset. * * @return {Db.Result} the result or %null if error or there are no more results */ - fetchResult () { - const result = this.fetch() + fetchResult () { + const result = this.fetch() - if (result !== null) { - if (result.data instanceof Array) { - return new Result(result) - } else { - return true - } + if (result !== null) { + if (result.data instanceof Array) { + return new Result(result) + } else { + return true + } + } + + return null } - return null - } - - /** + /** * Fetchs the first row object from the next resultset. * * @return {Array} the row if success, %null otherwise */ - fetchObject () { - const result = this.fetch() + fetchObject () { + const result = this.fetch() - if (result !== null && - result.data instanceof Array && - result.data.length > 0) { return result.data[0] } + if ( + result !== null && + result.data instanceof Array && + result.data.length > 0 + ) { + return result.data[0] + } - return null - } + return null + } - /** + /** * Fetchs data from the next resultset. * * @return {Array} the data */ - fetchData () { - const result = this.fetch() + fetchData () { + const result = this.fetch() - if (result !== null && - result.data instanceof Array) { - return result.data + if (result !== null && result.data instanceof Array) { + return result.data + } + + return null } - return null - } - - /** + /** * Fetchs the first row and column value from the next resultset. * * @return {Object} the value if success, %null otherwise */ - fetchValue () { - const row = this.fetchRow() + fetchValue () { + const row = this.fetchRow() - if (row instanceof Array && row.length > 0) { return row[0] } + if (row instanceof Array && row.length > 0) { + return row[0] + } - return null - } + return null + } - /** + /** * Fetchs the first row from the next resultset. * * @return {Array} the row if success, %null otherwise */ - fetchRow () { - const result = this.fetch() + fetchRow () { + const result = this.fetch() - if (result !== null && - result.data instanceof Array && - result.data.length > 0) { - const object = result.data[0] - const row = new Array(result.columns.length) - for (let i = 0; i < row.length; i++) { - row[i] = object[result.columns[i].name] - } - return row + if ( + result !== null && + result.data instanceof Array && + result.data.length > 0 + ) { + const object = result.data[0] + const row = new Array(result.columns.length) + for (let i = 0; i < row.length; i++) { + row[i] = object[result.columns[i].name] + } + return row + } + + return null } - - return null - } } diff --git a/src/js/db/result.js b/src/js/db/result.js index 47f47d23..fe1c9e32 100644 --- a/src/js/db/result.js +++ b/src/js/db/result.js @@ -2,60 +2,64 @@ * This class stores a database result. */ export class Result { - /** + /** * Initilizes the result object. */ - constructor (result) { - this.data = result.data - this.tables = result.tables - this.columns = result.columns - this.row = -1 + constructor (result) { + this.data = result.data + this.tables = result.tables + this.columns = result.columns + this.row = -1 - if (this.columns) { - this.columnMap = {} + if (this.columns) { + this.columnMap = {} - for (let i = 0; i < this.columns.length; i++) { - const col = this.columns[i] - col.index = i - this.columnMap[col.name] = col - } - } else { this.columnMap = null } - } + for (let i = 0; i < this.columns.length; i++) { + const col = this.columns[i] + col.index = i + this.columnMap[col.name] = col + } + } else { + this.columnMap = null + } + } - /** + /** * Gets a value from de result. * * @param {String} columnName The column name * @return {Object} The cell value */ - get (columnName) { - return this.data[this.row][columnName] - } + get (columnName) { + return this.data[this.row][columnName] + } - /** + /** * Gets a row. * * @return {Object} The cell value */ - getObject () { - return this.data[this.row] - } + getObject () { + return this.data[this.row] + } - /** + /** * Resets the result iterator. */ - reset () { - this.row = -1 - } + reset () { + this.row = -1 + } - /** + /** * Moves the internal iterator to the next row. */ - next () { - this.row++ + next () { + this.row++ - if (this.row >= this.data.length) { return false } + if (this.row >= this.data.length) { + return false + } - return true - } + return true + } } diff --git a/src/js/vn/json-connection.js b/src/js/vn/json-connection.js index abd030d8..21ea745e 100644 --- a/src/js/vn/json-connection.js +++ b/src/js/vn/json-connection.js @@ -1,4 +1,3 @@ - import { VnObject } from './object' import { JsonException } from './json-exception' @@ -6,16 +5,16 @@ import { JsonException } from './json-exception' * Handler for JSON rest connections. */ export class JsonConnection extends VnObject { - _connected = false - _requestsCount = 0 - token = null - interceptors = [] + _connected = false + _requestsCount = 0 + token = null + interceptors = [] - use (fn) { - this.interceptors.push(fn) - } + use (fn) { + this.interceptors.push(fn) + } - /** + /** * Executes the specified REST service with the given params and calls * the callback when response is received. * @@ -23,164 +22,179 @@ export class JsonConnection extends VnObject { * @param {Object} params The params to pass to the service * @return {Object} The parsed JSON response */ - async send (url, params) { - if (!params) params = {} - params.srv = `json:${url}` - return this.sendWithUrl('POST', '.', params) - } - - async sendForm (form) { - const params = {} - const elements = form.elements - - for (let i = 0; i < elements.length; i++) { - if (elements[i].name) { params[elements[i].name] = elements[i].value } + async send (url, params) { + if (!params) params = {} + params.srv = `json:${url}` + return this.sendWithUrl('POST', '.', params) } - return this.sendWithUrl('POST', form.action, params) - } + async sendForm (form) { + const params = {} + const elements = form.elements - async sendFormMultipart (form) { - return this.request({ - method: 'POST', - url: form.action, - data: new FormData(form) - }) - } - - async sendFormData (formData) { - return this.request({ - method: 'POST', - url: '', - data: formData - }) - } - - /* - * Called when REST response is received. - */ - async sendWithUrl (method, url, params) { - const urlParams = new URLSearchParams() - for (const key in params) { - if (params[key] != null) { - urlParams.set(key, params[key]) - } - } - - return this.request({ - method, - url, - data: urlParams.toString(), - headers: { - 'Content-Type': 'application/x-www-form-urlencoded' - } - }) - } - - async request (config) { - const request = new XMLHttpRequest() - request.open(config.method, config.url, true) - - for (const fn of this.interceptors) { - config = fn(config) - } - - const headers = config.headers - if (headers) { - for (const header in headers) { - request.setRequestHeader(header, headers[header]) - } - } - - const promise = new Promise((resolve, reject) => { - request.onreadystatechange = - () => this._onStateChange(request, resolve, reject) - }) - - request.send(config.data) - - this._requestsCount++ - - if (this._requestsCount === 1) { this.emit('loading-changed', true) } - - return promise - } - - _onStateChange (request, resolve, reject) { - if (request.readyState !== 4) { return } - - this._requestsCount-- - - if (this._requestsCount === 0) { this.emit('loading-changed', false) } - - let data = null - let error = null - try { - if (request.status === 0) { - const err = new JsonException() - err.message = 'The server does not respond, please check your Internet connection' - err.statusCode = request.status - throw err - } - - let contentType = null - - try { - contentType = request - .getResponseHeader('Content-Type') - .split(';')[0] - .trim() - } catch (err) { - console.warn(err) - } - - if (contentType !== 'application/json') { - const err = new JsonException() - err.message = request.statusText - err.statusCode = request.status - throw err - } - - let json - let jsData - - if (request.responseText) { json = JSON.parse(request.responseText) } - if (json) { jsData = json.data || json } - - if (request.status >= 200 && request.status < 300) { - data = jsData - } else { - let exception = jsData.exception - - const err = new JsonException() - err.statusCode = request.status - - if (exception) { - exception = exception - .replace(/\\/g, '.') - .replace(/Exception$/, '') - .replace(/^Vn\.Web\./, '') - - err.exception = exception - err.message = jsData.message - err.code = jsData.code - err.file = jsData.file - err.line = jsData.line - err.trace = jsData.trace - } else { - err.message = request.statusText + for (let i = 0; i < elements.length; i++) { + if (elements[i].name) { + params[elements[i].name] = elements[i].value + } } - throw err - } - } catch (e) { - data = null - error = e + return this.sendWithUrl('POST', form.action, params) } - if (error) { - this.emit('error', error) - reject(error) - } else { resolve(data) } - } + async sendFormMultipart (form) { + return this.request({ + method: 'POST', + url: form.action, + data: new FormData(form) + }) + } + + async sendFormData (formData) { + return this.request({ + method: 'POST', + url: '', + data: formData + }) + } + + /* + * Called when REST response is received. + */ + async sendWithUrl (method, url, params) { + const urlParams = new URLSearchParams() + for (const key in params) { + if (params[key] != null) { + urlParams.set(key, params[key]) + } + } + + return this.request({ + method, + url, + data: urlParams.toString(), + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + } + }) + } + + async request (config) { + const request = new XMLHttpRequest() + request.open(config.method, config.url, true) + + for (const fn of this.interceptors) { + config = fn(config) + } + + const headers = config.headers + if (headers) { + for (const header in headers) { + request.setRequestHeader(header, headers[header]) + } + } + + const promise = new Promise((resolve, reject) => { + request.onreadystatechange = () => + this._onStateChange(request, resolve, reject) + }) + + request.send(config.data) + + this._requestsCount++ + + if (this._requestsCount === 1) { + this.emit('loading-changed', true) + } + + return promise + } + + _onStateChange (request, resolve, reject) { + if (request.readyState !== 4) { + return + } + + this._requestsCount-- + + if (this._requestsCount === 0) { + this.emit('loading-changed', false) + } + + let data = null + let error = null + try { + if (request.status === 0) { + const err = new JsonException() + err.message = + 'The server does not respond, please check your Internet connection' + err.statusCode = request.status + throw err + } + + let contentType = null + + try { + contentType = request + .getResponseHeader('Content-Type') + .split(';')[0] + .trim() + } catch (err) { + console.warn(err) + } + + if (contentType !== 'application/json') { + const err = new JsonException() + err.message = request.statusText + err.statusCode = request.status + throw err + } + + let json + let jsData + + if (request.responseText) { + json = JSON.parse(request.responseText) + } + if (json) { + jsData = json.data || json + } + + if (request.status >= 200 && request.status < 300) { + data = jsData + } else { + let exception = jsData.exception + + const err = new JsonException() + err.statusCode = request.status + + if (exception) { + exception = exception + .replace(/\\/g, '.') + .replace(/Exception$/, '') + .replace(/^Vn\.Web\./, '') + + err.exception = exception + err.message = jsData.message + err.code = jsData.code + err.file = jsData.file + err.line = jsData.line + err.trace = jsData.trace + } else { + err.message = request.statusText + } + + throw err + } + } catch (e) { + data = null + error = e + } + + if (error) { + this.emit('error', error) + reject(error) + } else { + resolve(data) + } + } } diff --git a/src/js/vn/json-exception.js b/src/js/vn/json-exception.js index 823c4f1c..bc83c3b0 100644 --- a/src/js/vn/json-exception.js +++ b/src/js/vn/json-exception.js @@ -2,14 +2,14 @@ * This class stores the database errors. */ export class JsonException { - constructor (exception, message, code, file, line, trace, statucCode) { - this.name = 'JsonException' - this.exception = exception - this.message = message - this.code = code - this.file = file - this.line = line - this.trace = trace - this.statusCode = statucCode - } + constructor (exception, message, code, file, line, trace, statucCode) { + this.name = 'JsonException' + this.exception = exception + this.message = message + this.code = code + this.file = file + this.line = line + this.trace = trace + this.statusCode = statucCode + } } diff --git a/src/js/vn/object.js b/src/js/vn/object.js index 7180e889..586d5370 100644 --- a/src/js/vn/object.js +++ b/src/js/vn/object.js @@ -1,248 +1,289 @@ - /** * The main base class. Manages the signal system. Objects based on this class * can be instantiated declaratively using XML. */ export class VnObject { - /** + /** * Tag to be used when the class instance is defined via XML. All classes * must define this attribute, even if it is not used. */ - static Tag = 'vn-object' + static Tag = 'vn-object' - /** + /** * Class public properties. */ - static Properties = {} + static Properties = {} - /* + /* * Reference count. */ - _refCount = 1 + _refCount = 1 - /* + /* * Signal handlers data. */ - _thisArg = null + _thisArg = null - /** + /** * Initializes the object and sets all properties passed to the class * constructor. * * @param {Object} props The properties passed to the contructor */ - constructor (props) { - this.setProperties(props) - } + constructor (props) { + this.setProperties(props) + } - initialize (props) { - this.setProperties(props) - } + initialize (props) { + this.setProperties(props) + } - /** + /** * Sets a group of object properties. * * @param {Object} props Properties */ - setProperties (props) { - for (const prop in props) { this[prop] = props[prop] } - } + setProperties (props) { + for (const prop in props) { + this[prop] = props[prop] + } + } - /** + /** * Increases the object reference count. */ - ref () { - this._refCount++ - return this - } + ref () { + this._refCount++ + return this + } - /** + /** * Decreases the object reference count. */ - unref () { - this._refCount-- + unref () { + this._refCount-- - if (this._refCount === 0) { this._destroy() } - } + if (this._refCount === 0) { + this._destroy() + } + } - /** + /** * Called from @Vn.Builder when it finds a custom tag as a child of the * element. * * @param {Vn.Scope} scope The scope instance * @param {Node} node The custom tag child nodes */ - loadXml () {} + loadXml () {} - /** + /** * Called from @Vn.Builder when it finds a a child tag that isn't * associated to any property. * * @param {Object} child The child object instance */ - appendChild () {} + appendChild () {} - /** + /** * Conects a signal with a function. * * @param {string} id The signal identifier * @param {function} callback The callback * @param {Object} instance The instance */ - on (id, callback, instance) { - if (!(callback instanceof Function)) { - console.warn('Vn.Object: Invalid callback for signal \'%s\'', id) - return + on (id, callback, instance) { + if (!(callback instanceof Function)) { + console.warn("Vn.Object: Invalid callback for signal '%s'", id) + return + } + + this._signalInit() + let callbacks = this._thisArg.signals[id] + + if (!callbacks) { + callbacks = this._thisArg.signals[id] = [] + } + + callbacks.push({ + blocked: false, + callback, + instance + }) } - this._signalInit() - let callbacks = this._thisArg.signals[id] - - if (!callbacks) { callbacks = this._thisArg.signals[id] = [] } - - callbacks.push({ - blocked: false, - callback, - instance - }) - } - - /** + /** * Locks/Unlocks a signal emission to the specified object. * * @param {string} id The signal identifier * @param {function} callback The callback * @param {boolean} block %true for lock the signal, %false for unlock */ - blockSignal (id, callback, block, instance) { - if (!this._thisArg) { return } + blockSignal (id, callback, block, instance) { + if (!this._thisArg) { + return + } - const callbacks = this._thisArg.signals[id] + const callbacks = this._thisArg.signals[id] - if (!callbacks) { return } + if (!callbacks) { + return + } - for (let i = 0; i < callbacks.length; i++) { - if (callbacks[i].callback === callback && - callbacks[i].instance === instance) { callbacks[i].blocked = block } + for (let i = 0; i < callbacks.length; i++) { + if ( + callbacks[i].callback === callback && + callbacks[i].instance === instance + ) { + callbacks[i].blocked = block + } + } } - } - /** + /** * Emits a signal in the object. * * @param {string} id The signal identifier */ - emit (id) { - if (!this._thisArg) { return } + emit (id) { + if (!this._thisArg) { + return + } - const callbacks = this._thisArg.signals[id] + const callbacks = this._thisArg.signals[id] - if (!callbacks) { return } + if (!callbacks) { + return + } - const callbackArgs = [] - callbackArgs.push(this) + const callbackArgs = [] + callbackArgs.push(this) - for (let i = 1; i < arguments.length; i++) { callbackArgs.push(arguments[i]) } + for (let i = 1; i < arguments.length; i++) { + callbackArgs.push(arguments[i]) + } - for (let i = 0; i < callbacks.length; i++) { - if (!callbacks[i].blocked) { callbacks[i].callback.apply(callbacks[i].instance, callbackArgs) } + for (let i = 0; i < callbacks.length; i++) { + if (!callbacks[i].blocked) { + callbacks[i].callback.apply(callbacks[i].instance, callbackArgs) + } + } } - } - /** + /** * Disconnects a signal from current object. * * @param {string} id The signal identifier * @param {function} callback The connected callback * @param {Object} instance The instance */ - disconnect (id, callback, instance) { - if (!this._thisArg) { return } + disconnect (id, callback, instance) { + if (!this._thisArg) { + return + } - const callbacks = this._thisArg.signals[id] + const callbacks = this._thisArg.signals[id] - if (callbacks) { - for (let i = callbacks.length; i--;) { - if (callbacks[i].callback === callback && - callbacks[i].instance === instance) { callbacks.splice(i, 1) } - } + if (callbacks) { + for (let i = callbacks.length; i--;) { + if ( + callbacks[i].callback === callback && + callbacks[i].instance === instance + ) { + callbacks.splice(i, 1) + } + } + } } - } - /** + /** * Disconnects all signals for the given instance. * * @param {Object} instance The instance */ - disconnectByInstance (instance) { - if (!this._thisArg) { return } - - const signals = this._thisArg.signals - - for (const signalId in signals) { - const callbacks = signals[signalId] - - if (callbacks) { - for (let i = callbacks.length; i--;) { - if (callbacks[i].instance === instance) { callbacks.splice(i, 1) } + disconnectByInstance (instance) { + if (!this._thisArg) { + return } - } - } - } - /** + const signals = this._thisArg.signals + + for (const signalId in signals) { + const callbacks = signals[signalId] + + if (callbacks) { + for (let i = callbacks.length; i--;) { + if (callbacks[i].instance === instance) { + callbacks.splice(i, 1) + } + } + } + } + } + + /** * Destroys the object, this method should only be called before losing * the last reference to the object. It can be overwritten by child classes * but should always call the parent method. */ - _destroy () { - if (!this._thisArg) { return } + _destroy () { + if (!this._thisArg) { + return + } - const links = this._thisArg.links + const links = this._thisArg.links - for (const key in links) { this._unlink(links[key]) } + for (const key in links) { + this._unlink(links[key]) + } - this._thisArg = null - } + this._thisArg = null + } - /** + /** * Links the object with another object. * * @param {Object} prop The linked property * @param {Object} handlers The object events to listen with */ - link (prop, handlers) { - this._signalInit() - const links = this._thisArg.links + link (prop, handlers) { + this._signalInit() + const links = this._thisArg.links - for (const key in prop) { - const newObject = prop[key] - const oldObject = this[key] + for (const key in prop) { + const newObject = prop[key] + const oldObject = this[key] - if (oldObject) { this._unlink(oldObject) } + if (oldObject) { + this._unlink(oldObject) + } - this[key] = newObject + this[key] = newObject - if (newObject) { - links[key] = newObject.ref() + if (newObject) { + links[key] = newObject.ref() - for (const signal in handlers) { newObject.on(signal, handlers[signal], this) } - } else if (oldObject) { links[key] = undefined } + for (const signal in handlers) { + newObject.on(signal, handlers[signal], this) + } + } else if (oldObject) { + links[key] = undefined + } + } } - } - _unlink (object) { - if (!object) return - object.disconnectByInstance(this) - object.unref() - } - - _signalInit () { - if (!this._thisArg) { - this._thisArg = { - signals: {}, - links: {} - } + _unlink (object) { + if (!object) return + object.disconnectByInstance(this) + object.unref() + } + + _signalInit () { + if (!this._thisArg) { + this._thisArg = { + signals: {}, + links: {} + } + } } - } } diff --git a/src/layouts/LoginLayout.vue b/src/layouts/LoginLayout.vue index bc1feddd..5a5769af 100644 --- a/src/layouts/LoginLayout.vue +++ b/src/layouts/LoginLayout.vue @@ -1,5 +1,8 @@