From d4289e8db774aa7e0b8b4b4f2ade078c4fc8748f Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Tue, 19 Sep 2023 15:51:51 +0100 Subject: [PATCH 1/9] chore(dev-deps): update @typescript-eslint to v6 Update the `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser` plugin to v6. The full list of changes needed can be found in the [Announcing typescript-eslint v6 blog post][1], but the ones that affect us are: - Dropped support for Node.JS v14. This isn't a big deal for us, since Mermaid uses a version of `eslint-plugin-jsdoc` that does not support Node.JS v14 either, see 120029913d31668e45daa84f7de70dfa519f3b81 (chore(deps): update dependency eslint-plugin-jsdoc to v46, 2023-06-27) - Changes to the `plugin:@typescript-eslint/recommended` configuration. I've manually changed the following two rules to match their old `@typescript-eslint/parser` v5 settings, to avoid turning ESLint warnings into errors: - `@typescript-eslint/no-explicit-any` to `warn` - `@typescript-eslint/no-unused-vars` to `warn` [1]: https://main--typescript-eslint.netlify.app/blog/announcing-typescript-eslint-v6 --- .eslintrc.cjs | 2 + package.json | 4 +- pnpm-lock.yaml | 179 +++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 147 insertions(+), 38 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 273aa47b9f..49e1aaaa66 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -49,8 +49,10 @@ module.exports = { 'no-unused-vars': 'off', 'cypress/no-async-tests': 'off', '@typescript-eslint/consistent-type-imports': 'error', + '@typescript-eslint/no-explicit-any': 'warn', '@typescript-eslint/no-floating-promises': 'error', '@typescript-eslint/no-misused-promises': 'error', + '@typescript-eslint/no-unused-vars': 'warn', '@typescript-eslint/ban-ts-comment': [ 'error', { diff --git a/package.json b/package.json index 8bdcce0740..167803dc9c 100644 --- a/package.json +++ b/package.json @@ -77,8 +77,8 @@ "@types/node": "^18.16.0", "@types/prettier": "^2.7.2", "@types/rollup-plugin-visualizer": "^4.2.1", - "@typescript-eslint/eslint-plugin": "^5.59.0", - "@typescript-eslint/parser": "^5.59.0", + "@typescript-eslint/eslint-plugin": "^6.7.2", + "@typescript-eslint/parser": "^6.7.2", "@vitest/coverage-v8": "^0.34.0", "@vitest/spy": "^0.34.0", "@vitest/ui": "^0.34.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ef92c63db8..6bc2dd314c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -57,11 +57,11 @@ importers: specifier: ^4.2.1 version: 4.2.1 '@typescript-eslint/eslint-plugin': - specifier: ^5.59.0 - version: 5.59.0(@typescript-eslint/parser@5.59.0)(eslint@8.39.0)(typescript@5.1.3) + specifier: ^6.7.2 + version: 6.7.2(@typescript-eslint/parser@6.7.2)(eslint@8.39.0)(typescript@5.1.3) '@typescript-eslint/parser': - specifier: ^5.59.0 - version: 5.59.0(eslint@8.39.0)(typescript@5.1.3) + specifier: ^6.7.2 + version: 6.7.2(eslint@8.39.0)(typescript@5.1.3) '@vitest/coverage-v8': specifier: ^0.34.0 version: 0.34.0(vitest@0.34.0) @@ -103,7 +103,7 @@ importers: version: 7.1.0 eslint-plugin-jest: specifier: ^27.2.1 - version: 27.2.1(@typescript-eslint/eslint-plugin@5.59.0)(eslint@8.39.0)(jest@29.5.0)(typescript@5.1.3) + version: 27.2.1(@typescript-eslint/eslint-plugin@6.7.2)(eslint@8.39.0)(jest@29.5.0)(typescript@5.1.3) eslint-plugin-jsdoc: specifier: ^46.0.0 version: 46.0.0(eslint@8.39.0) @@ -3627,6 +3627,11 @@ packages: engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} dev: true + /@eslint-community/regexpp@4.8.1: + resolution: {integrity: sha512-PWiOzLIUAjN/w5K17PoF4n6sKBw0gqLHPhywmYHP4t1VFQQVYeb1yWsJwnMVEMl3tUHME7X/SJPZLmtG7XBDxQ==} + engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + dev: true + /@eslint/eslintrc@2.0.2: resolution: {integrity: sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -4631,6 +4636,10 @@ packages: resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==} dev: true + /@types/json-schema@7.0.13: + resolution: {integrity: sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==} + dev: true + /@types/keyv@3.1.4: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} dependencies: @@ -4750,6 +4759,10 @@ packages: resolution: {integrity: sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==} dev: true + /@types/semver@7.5.2: + resolution: {integrity: sha512-7aqorHYgdNO4DM36stTiGO3DvKoex9TQRwsJU6vMaFGyqpBA1MNZkz+PG3gaNUPpTAOYhT1WR7M1JyA3fbS9Cw==} + dev: true + /@types/serve-index@1.9.1: resolution: {integrity: sha512-d/Hs3nWDxNL2xAczmOVZNj92YZCS6RGxfBPjKzuu/XirCgXdpKEb88dYNbrYGint6IVWLNP+yonwVAuRC0T2Dg==} dependencies: @@ -4866,29 +4879,30 @@ packages: - supports-color dev: true - /@typescript-eslint/eslint-plugin@5.59.0(@typescript-eslint/parser@5.59.0)(eslint@8.39.0)(typescript@5.1.3): - resolution: {integrity: sha512-p0QgrEyrxAWBecR56gyn3wkG15TJdI//eetInP3zYRewDh0XS+DhB3VUAd3QqvziFsfaQIoIuZMxZRB7vXYaYw==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/eslint-plugin@6.7.2(@typescript-eslint/parser@6.7.2)(eslint@8.39.0)(typescript@5.1.3): + resolution: {integrity: sha512-ooaHxlmSgZTM6CHYAFRlifqh1OAr3PAQEwi7lhYhaegbnXrnh7CDcHmc3+ihhbQC7H0i4JF0psI5ehzkF6Yl6Q==} + engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: - '@typescript-eslint/parser': ^5.0.0 - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha + eslint: ^7.0.0 || ^8.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@eslint-community/regexpp': 4.5.0 - '@typescript-eslint/parser': 5.59.0(eslint@8.39.0)(typescript@5.1.3) - '@typescript-eslint/scope-manager': 5.59.0 - '@typescript-eslint/type-utils': 5.59.0(eslint@8.39.0)(typescript@5.1.3) - '@typescript-eslint/utils': 5.59.0(eslint@8.39.0)(typescript@5.1.3) + '@eslint-community/regexpp': 4.8.1 + '@typescript-eslint/parser': 6.7.2(eslint@8.39.0)(typescript@5.1.3) + '@typescript-eslint/scope-manager': 6.7.2 + '@typescript-eslint/type-utils': 6.7.2(eslint@8.39.0)(typescript@5.1.3) + '@typescript-eslint/utils': 6.7.2(eslint@8.39.0)(typescript@5.1.3) + '@typescript-eslint/visitor-keys': 6.7.2 debug: 4.3.4(supports-color@8.1.1) eslint: 8.39.0 - grapheme-splitter: 1.0.4 - ignore: 5.2.0 - natural-compare-lite: 1.4.0 - semver: 7.3.8 - tsutils: 3.21.0(typescript@5.1.3) + graphemer: 1.4.0 + ignore: 5.2.4 + natural-compare: 1.4.0 + semver: 7.5.4 + ts-api-utils: 1.0.3(typescript@5.1.3) typescript: 5.1.3 transitivePeerDependencies: - supports-color @@ -4914,19 +4928,20 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@5.59.0(eslint@8.39.0)(typescript@5.1.3): - resolution: {integrity: sha512-qK9TZ70eJtjojSUMrrEwA9ZDQ4N0e/AuoOIgXuNBorXYcBDk397D2r5MIe1B3cok/oCtdNC5j+lUUpVB+Dpb+w==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/parser@6.7.2(eslint@8.39.0)(typescript@5.1.3): + resolution: {integrity: sha512-KA3E4ox0ws+SPyxQf9iSI25R6b4Ne78ORhNHeVKrPQnoYsb9UhieoiRoJgrzgEeKGOXhcY1i8YtOeCHHTDa6Fw==} + engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + eslint: ^7.0.0 || ^8.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.59.0 - '@typescript-eslint/types': 5.59.0 - '@typescript-eslint/typescript-estree': 5.59.0(typescript@5.1.3) + '@typescript-eslint/scope-manager': 6.7.2 + '@typescript-eslint/types': 6.7.2 + '@typescript-eslint/typescript-estree': 6.7.2(typescript@5.1.3) + '@typescript-eslint/visitor-keys': 6.7.2 debug: 4.3.4(supports-color@8.1.1) eslint: 8.39.0 typescript: 5.1.3 @@ -4942,6 +4957,14 @@ packages: '@typescript-eslint/visitor-keys': 5.59.0 dev: true + /@typescript-eslint/scope-manager@6.7.2: + resolution: {integrity: sha512-bgi6plgyZjEqapr7u2mhxGR6E8WCzKNUFWNh6fkpVe9+yzRZeYtDTbsIBzKbcxI+r1qVWt6VIoMSNZ4r2A+6Yw==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.7.2 + '@typescript-eslint/visitor-keys': 6.7.2 + dev: true + /@typescript-eslint/type-utils@5.59.0(eslint@8.39.0)(typescript@5.0.4): resolution: {integrity: sha512-d/B6VSWnZwu70kcKQSCqjcXpVH+7ABKH8P1KNn4K7j5PXXuycZTPXF44Nui0TEm6rbWGi8kc78xRgOC4n7xFgA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -4962,21 +4985,21 @@ packages: - supports-color dev: true - /@typescript-eslint/type-utils@5.59.0(eslint@8.39.0)(typescript@5.1.3): - resolution: {integrity: sha512-d/B6VSWnZwu70kcKQSCqjcXpVH+7ABKH8P1KNn4K7j5PXXuycZTPXF44Nui0TEm6rbWGi8kc78xRgOC4n7xFgA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/type-utils@6.7.2(eslint@8.39.0)(typescript@5.1.3): + resolution: {integrity: sha512-36F4fOYIROYRl0qj95dYKx6kybddLtsbmPIYNK0OBeXv2j9L5nZ17j9jmfy+bIDHKQgn2EZX+cofsqi8NPATBQ==} + engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: - eslint: '*' + eslint: ^7.0.0 || ^8.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.59.0(typescript@5.1.3) - '@typescript-eslint/utils': 5.59.0(eslint@8.39.0)(typescript@5.1.3) + '@typescript-eslint/typescript-estree': 6.7.2(typescript@5.1.3) + '@typescript-eslint/utils': 6.7.2(eslint@8.39.0)(typescript@5.1.3) debug: 4.3.4(supports-color@8.1.1) eslint: 8.39.0 - tsutils: 3.21.0(typescript@5.1.3) + ts-api-utils: 1.0.3(typescript@5.1.3) typescript: 5.1.3 transitivePeerDependencies: - supports-color @@ -4987,6 +5010,11 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true + /@typescript-eslint/types@6.7.2: + resolution: {integrity: sha512-flJYwMYgnUNDAN9/GAI3l8+wTmvTYdv64fcH8aoJK76Y+1FCZ08RtI5zDerM/FYT5DMkAc+19E4aLmd5KqdFyg==} + engines: {node: ^16.0.0 || >=18.0.0} + dev: true + /@typescript-eslint/typescript-estree@5.59.0(typescript@5.0.4): resolution: {integrity: sha512-sUNnktjmI8DyGzPdZ8dRwW741zopGxltGs/SAPgGL/AAgDpiLsCFLcMNSpbfXfmnNeHmK9h3wGmCkGRGAoUZAg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -5029,6 +5057,27 @@ packages: - supports-color dev: true + /@typescript-eslint/typescript-estree@6.7.2(typescript@5.1.3): + resolution: {integrity: sha512-kiJKVMLkoSciGyFU0TOY0fRxnp9qq1AzVOHNeN1+B9erKFCJ4Z8WdjAkKQPP+b1pWStGFqezMLltxO+308dJTQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 6.7.2 + '@typescript-eslint/visitor-keys': 6.7.2 + debug: 4.3.4(supports-color@8.1.1) + globby: 11.1.0 + is-glob: 4.0.3 + semver: 7.5.4 + ts-api-utils: 1.0.3(typescript@5.1.3) + typescript: 5.1.3 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/utils@5.59.0(eslint@8.39.0)(typescript@5.0.4): resolution: {integrity: sha512-GGLFd+86drlHSvPgN/el6dRQNYYGOvRSDVydsUaQluwIW3HvbXuxyuD5JETvBt/9qGYe+lOrDk6gRrWOHb/FvA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -5069,6 +5118,25 @@ packages: - typescript dev: true + /@typescript-eslint/utils@6.7.2(eslint@8.39.0)(typescript@5.1.3): + resolution: {integrity: sha512-ZCcBJug/TS6fXRTsoTkgnsvyWSiXwMNiPzBUani7hDidBdj1779qwM1FIAmpH4lvlOZNF3EScsxxuGifjpLSWQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.39.0) + '@types/json-schema': 7.0.13 + '@types/semver': 7.5.2 + '@typescript-eslint/scope-manager': 6.7.2 + '@typescript-eslint/types': 6.7.2 + '@typescript-eslint/typescript-estree': 6.7.2(typescript@5.1.3) + eslint: 8.39.0 + semver: 7.5.4 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + /@typescript-eslint/visitor-keys@5.59.0: resolution: {integrity: sha512-qZ3iXxQhanchCeaExlKPV3gDQFxMUmU35xfd5eCXB6+kUw1TUAbIy2n7QIrwz9s98DQLzNWyHp61fY0da4ZcbA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -5077,6 +5145,14 @@ packages: eslint-visitor-keys: 3.4.0 dev: true + /@typescript-eslint/visitor-keys@6.7.2: + resolution: {integrity: sha512-uVw9VIMFBUTz8rIeaUT3fFe8xIUx8r4ywAdlQv1ifH+6acn/XF8Y6rwJ7XNmkNMDrTW+7+vxFFPIF40nJCVsMQ==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.7.2 + eslint-visitor-keys: 3.4.3 + dev: true + /@unocss/astro@0.55.2(rollup@2.79.1)(vite@4.3.9): resolution: {integrity: sha512-cSzBKPEveZZQDZp5bq0UlL8CVvzB/1LsgZmZufxi9oMMjMJYqzfTkKg5z65GcP82Xp5c0N3KKkl/R6I+/7Iwvw==} peerDependencies: @@ -8501,7 +8577,7 @@ packages: htmlparser2: 8.0.1 dev: true - /eslint-plugin-jest@27.2.1(@typescript-eslint/eslint-plugin@5.59.0)(eslint@8.39.0)(jest@29.5.0)(typescript@5.1.3): + /eslint-plugin-jest@27.2.1(@typescript-eslint/eslint-plugin@6.7.2)(eslint@8.39.0)(jest@29.5.0)(typescript@5.1.3): resolution: {integrity: sha512-l067Uxx7ZT8cO9NJuf+eJHvt6bqJyz2Z29wykyEdz/OtmcELQl2MQGQLX8J94O1cSJWAwUSEvCjwjA7KEK3Hmg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: @@ -8514,7 +8590,7 @@ packages: jest: optional: true dependencies: - '@typescript-eslint/eslint-plugin': 5.59.0(@typescript-eslint/parser@5.59.0)(eslint@8.39.0)(typescript@5.1.3) + '@typescript-eslint/eslint-plugin': 6.7.2(@typescript-eslint/parser@6.7.2)(eslint@8.39.0)(typescript@5.1.3) '@typescript-eslint/utils': 5.59.0(eslint@8.39.0)(typescript@5.1.3) eslint: 8.39.0 jest: 29.5.0(@types/node@18.16.0)(ts-node@10.9.1) @@ -8630,6 +8706,11 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true + /eslint-visitor-keys@3.4.3: + resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: true + /eslint@8.39.0: resolution: {integrity: sha512-mwiok6cy7KTW7rBpo05k6+p4YVZByLNjAZ/ACB9DRCu4YDRwjXI01tWHp6KAUWelsBetTxKK/2sHB0vdS8Z2Og==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -9651,6 +9732,10 @@ packages: resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} dev: true + /graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + dev: true + /gzip-size@6.0.0: resolution: {integrity: sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==} engines: {node: '>=10'} @@ -9959,6 +10044,11 @@ packages: engines: {node: '>= 4'} dev: true + /ignore@5.2.4: + resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} + engines: {node: '>= 4'} + dev: true + /import-fresh@3.3.0: resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} engines: {node: '>=6'} @@ -13784,6 +13874,14 @@ packages: lru-cache: 6.0.0 dev: true + /semver@7.5.4: + resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: true + /send@0.18.0: resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} engines: {node: '>= 0.8.0'} @@ -14751,6 +14849,15 @@ packages: matchit: 1.1.0 dev: true + /ts-api-utils@1.0.3(typescript@5.1.3): + resolution: {integrity: sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==} + engines: {node: '>=16.13.0'} + peerDependencies: + typescript: '>=4.2.0' + dependencies: + typescript: 5.1.3 + dev: true + /ts-dedent@2.2.0: resolution: {integrity: sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==} engines: {node: '>=6.10'} From a83fab28e16cb2e681dc183b10a577dede92ecb5 Mon Sep 17 00:00:00 2001 From: Hans Blankenhaus Date: Wed, 20 Sep 2023 22:56:45 +0200 Subject: [PATCH 2/9] center labels: removed condition --- .../diagrams/quadrant-chart/quadrantBuilder.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts b/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts index 5b740b0e0e..f3ca3c3a66 100644 --- a/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts +++ b/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts @@ -283,14 +283,14 @@ export class QuadrantBuilder { quadrantTop, quadrantWidth, } = quadrantSpace; - const drawAxisLabelInMiddle = this.data.points.length === 0; + const axisLabels: QuadrantTextType[] = []; if (this.data.xAxisLeftText && showXAxis) { axisLabels.push({ text: this.data.xAxisLeftText, fill: this.themeConfig.quadrantXAxisTextFill, - x: quadrantLeft + (drawAxisLabelInMiddle ? quadrantHalfWidth / 2 : 0), + x: quadrantLeft + quadrantHalfWidth / 2, y: xAxisPosition === 'top' ? this.config.xAxisLabelPadding + titleSpace.top @@ -299,7 +299,7 @@ export class QuadrantBuilder { quadrantHeight + this.config.quadrantPadding, fontSize: this.config.xAxisLabelFontSize, - verticalPos: drawAxisLabelInMiddle ? 'center' : 'left', + verticalPos: 'center', horizontalPos: 'top', rotation: 0, }); @@ -308,7 +308,7 @@ export class QuadrantBuilder { axisLabels.push({ text: this.data.xAxisRightText, fill: this.themeConfig.quadrantXAxisTextFill, - x: quadrantLeft + quadrantHalfWidth + (drawAxisLabelInMiddle ? quadrantHalfWidth / 2 : 0), + x: quadrantLeft + quadrantHalfWidth + quadrantHalfWidth / 2, y: xAxisPosition === 'top' ? this.config.xAxisLabelPadding + titleSpace.top @@ -317,7 +317,7 @@ export class QuadrantBuilder { quadrantHeight + this.config.quadrantPadding, fontSize: this.config.xAxisLabelFontSize, - verticalPos: drawAxisLabelInMiddle ? 'center' : 'left', + verticalPos: 'center', horizontalPos: 'top', rotation: 0, }); @@ -334,9 +334,9 @@ export class QuadrantBuilder { quadrantLeft + quadrantWidth + this.config.quadrantPadding, - y: quadrantTop + quadrantHeight - (drawAxisLabelInMiddle ? quadrantHalfHeight / 2 : 0), + y: quadrantTop + quadrantHeight - quadrantHalfHeight / 2, fontSize: this.config.yAxisLabelFontSize, - verticalPos: drawAxisLabelInMiddle ? 'center' : 'left', + verticalPos: 'center', horizontalPos: 'top', rotation: -90, }); @@ -352,9 +352,9 @@ export class QuadrantBuilder { quadrantLeft + quadrantWidth + this.config.quadrantPadding, - y: quadrantTop + quadrantHalfHeight - (drawAxisLabelInMiddle ? quadrantHalfHeight / 2 : 0), + y: quadrantTop + quadrantHalfHeight - quadrantHalfHeight / 2, fontSize: this.config.yAxisLabelFontSize, - verticalPos: drawAxisLabelInMiddle ? 'center' : 'left', + verticalPos: 'center', horizontalPos: 'top', rotation: -90, }); From 5c39e99e32dc87d20a515b0d3b3187bc25bc0548 Mon Sep 17 00:00:00 2001 From: Hans Blankenhaus Date: Thu, 21 Sep 2023 10:35:18 +0200 Subject: [PATCH 3/9] Revert "center labels: removed condition" This reverts commit a83fab28e16cb2e681dc183b10a577dede92ecb5. --- .../diagrams/quadrant-chart/quadrantBuilder.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts b/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts index f3ca3c3a66..5b740b0e0e 100644 --- a/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts +++ b/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts @@ -283,14 +283,14 @@ export class QuadrantBuilder { quadrantTop, quadrantWidth, } = quadrantSpace; - + const drawAxisLabelInMiddle = this.data.points.length === 0; const axisLabels: QuadrantTextType[] = []; if (this.data.xAxisLeftText && showXAxis) { axisLabels.push({ text: this.data.xAxisLeftText, fill: this.themeConfig.quadrantXAxisTextFill, - x: quadrantLeft + quadrantHalfWidth / 2, + x: quadrantLeft + (drawAxisLabelInMiddle ? quadrantHalfWidth / 2 : 0), y: xAxisPosition === 'top' ? this.config.xAxisLabelPadding + titleSpace.top @@ -299,7 +299,7 @@ export class QuadrantBuilder { quadrantHeight + this.config.quadrantPadding, fontSize: this.config.xAxisLabelFontSize, - verticalPos: 'center', + verticalPos: drawAxisLabelInMiddle ? 'center' : 'left', horizontalPos: 'top', rotation: 0, }); @@ -308,7 +308,7 @@ export class QuadrantBuilder { axisLabels.push({ text: this.data.xAxisRightText, fill: this.themeConfig.quadrantXAxisTextFill, - x: quadrantLeft + quadrantHalfWidth + quadrantHalfWidth / 2, + x: quadrantLeft + quadrantHalfWidth + (drawAxisLabelInMiddle ? quadrantHalfWidth / 2 : 0), y: xAxisPosition === 'top' ? this.config.xAxisLabelPadding + titleSpace.top @@ -317,7 +317,7 @@ export class QuadrantBuilder { quadrantHeight + this.config.quadrantPadding, fontSize: this.config.xAxisLabelFontSize, - verticalPos: 'center', + verticalPos: drawAxisLabelInMiddle ? 'center' : 'left', horizontalPos: 'top', rotation: 0, }); @@ -334,9 +334,9 @@ export class QuadrantBuilder { quadrantLeft + quadrantWidth + this.config.quadrantPadding, - y: quadrantTop + quadrantHeight - quadrantHalfHeight / 2, + y: quadrantTop + quadrantHeight - (drawAxisLabelInMiddle ? quadrantHalfHeight / 2 : 0), fontSize: this.config.yAxisLabelFontSize, - verticalPos: 'center', + verticalPos: drawAxisLabelInMiddle ? 'center' : 'left', horizontalPos: 'top', rotation: -90, }); @@ -352,9 +352,9 @@ export class QuadrantBuilder { quadrantLeft + quadrantWidth + this.config.quadrantPadding, - y: quadrantTop + quadrantHalfHeight - quadrantHalfHeight / 2, + y: quadrantTop + quadrantHalfHeight - (drawAxisLabelInMiddle ? quadrantHalfHeight / 2 : 0), fontSize: this.config.yAxisLabelFontSize, - verticalPos: 'center', + verticalPos: drawAxisLabelInMiddle ? 'center' : 'left', horizontalPos: 'top', rotation: -90, }); From d7591fbeda338961c1a8432c44fa77334104cd8d Mon Sep 17 00:00:00 2001 From: Hans Blankenhaus Date: Thu, 21 Sep 2023 10:55:09 +0200 Subject: [PATCH 4/9] changed condition on which axis labels are centered --- .../quadrant-chart/quadrantBuilder.ts | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts b/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts index 5b740b0e0e..3acb46288a 100644 --- a/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts +++ b/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts @@ -283,14 +283,17 @@ export class QuadrantBuilder { quadrantTop, quadrantWidth, } = quadrantSpace; - const drawAxisLabelInMiddle = this.data.points.length === 0; + + const drawXAxisLabelsInMiddle = this.data.xAxisRightText ? true : false; + const drawYAxisLabelsInMiddle = this.data.yAxisTopText ? true : false; + const axisLabels: QuadrantTextType[] = []; if (this.data.xAxisLeftText && showXAxis) { axisLabels.push({ text: this.data.xAxisLeftText, fill: this.themeConfig.quadrantXAxisTextFill, - x: quadrantLeft + (drawAxisLabelInMiddle ? quadrantHalfWidth / 2 : 0), + x: quadrantLeft + (drawXAxisLabelsInMiddle ? quadrantHalfWidth / 2 : 0), y: xAxisPosition === 'top' ? this.config.xAxisLabelPadding + titleSpace.top @@ -299,7 +302,7 @@ export class QuadrantBuilder { quadrantHeight + this.config.quadrantPadding, fontSize: this.config.xAxisLabelFontSize, - verticalPos: drawAxisLabelInMiddle ? 'center' : 'left', + verticalPos: drawXAxisLabelsInMiddle ? 'center' : 'left', horizontalPos: 'top', rotation: 0, }); @@ -308,7 +311,7 @@ export class QuadrantBuilder { axisLabels.push({ text: this.data.xAxisRightText, fill: this.themeConfig.quadrantXAxisTextFill, - x: quadrantLeft + quadrantHalfWidth + (drawAxisLabelInMiddle ? quadrantHalfWidth / 2 : 0), + x: quadrantLeft + quadrantHalfWidth + (drawXAxisLabelsInMiddle ? quadrantHalfWidth / 2 : 0), y: xAxisPosition === 'top' ? this.config.xAxisLabelPadding + titleSpace.top @@ -317,7 +320,7 @@ export class QuadrantBuilder { quadrantHeight + this.config.quadrantPadding, fontSize: this.config.xAxisLabelFontSize, - verticalPos: drawAxisLabelInMiddle ? 'center' : 'left', + verticalPos: drawXAxisLabelsInMiddle ? 'center' : 'left', horizontalPos: 'top', rotation: 0, }); @@ -334,9 +337,9 @@ export class QuadrantBuilder { quadrantLeft + quadrantWidth + this.config.quadrantPadding, - y: quadrantTop + quadrantHeight - (drawAxisLabelInMiddle ? quadrantHalfHeight / 2 : 0), + y: quadrantTop + quadrantHeight - (drawYAxisLabelsInMiddle ? quadrantHalfHeight / 2 : 0), fontSize: this.config.yAxisLabelFontSize, - verticalPos: drawAxisLabelInMiddle ? 'center' : 'left', + verticalPos: drawYAxisLabelsInMiddle ? 'center' : 'left', horizontalPos: 'top', rotation: -90, }); @@ -352,9 +355,10 @@ export class QuadrantBuilder { quadrantLeft + quadrantWidth + this.config.quadrantPadding, - y: quadrantTop + quadrantHalfHeight - (drawAxisLabelInMiddle ? quadrantHalfHeight / 2 : 0), + y: + quadrantTop + quadrantHalfHeight - (drawYAxisLabelsInMiddle ? quadrantHalfHeight / 2 : 0), fontSize: this.config.yAxisLabelFontSize, - verticalPos: drawAxisLabelInMiddle ? 'center' : 'left', + verticalPos: drawYAxisLabelsInMiddle ? 'center' : 'left', horizontalPos: 'top', rotation: -90, }); From 2d0b22892dc2d7ec33bdf34deafc7836b934fc7a Mon Sep 17 00:00:00 2001 From: Hans Blankenhaus Date: Thu, 21 Sep 2023 12:24:24 +0200 Subject: [PATCH 5/9] added requested changes --- .../mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts b/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts index 3acb46288a..75d6705381 100644 --- a/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts +++ b/packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts @@ -284,8 +284,8 @@ export class QuadrantBuilder { quadrantWidth, } = quadrantSpace; - const drawXAxisLabelsInMiddle = this.data.xAxisRightText ? true : false; - const drawYAxisLabelsInMiddle = this.data.yAxisTopText ? true : false; + const drawXAxisLabelsInMiddle = Boolean(this.data.xAxisRightText); + const drawYAxisLabelsInMiddle = Boolean(this.data.yAxisTopText); const axisLabels: QuadrantTextType[] = []; From 05e94b430aaaec27111dbff19a6f6161f7cadd46 Mon Sep 17 00:00:00 2001 From: Hans Blankenhaus Date: Thu, 21 Sep 2023 15:25:51 +0200 Subject: [PATCH 6/9] add image snapshot test for quadrantchart --- .../rendering/quadrantChart.spec.js | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/cypress/integration/rendering/quadrantChart.spec.js b/cypress/integration/rendering/quadrantChart.spec.js index 50520eb1a5..33830d3b7f 100644 --- a/cypress/integration/rendering/quadrantChart.spec.js +++ b/cypress/integration/rendering/quadrantChart.spec.js @@ -160,4 +160,70 @@ describe('Quadrant Chart', () => { ); cy.get('svg'); }); + it('should render x-axis labels in the center, if x-axis has two labels', () => { + imgSnapshotTest( + ` + quadrantChart + title Reach and engagement of campaigns + x-axis Low Reach --> High Reach + y-axis Low Engagement + quadrant-1 We should expand + quadrant-2 Need to promote + quadrant-3 Re-evaluate + quadrant-4 May be improved + Campaign A: [0.3, 0.6] + Campaign B: [0.45, 0.23] + Campaign C: [0.57, 0.69] + Campaign D: [0.78, 0.34] + Campaign E: [0.40, 0.34] + Campaign F: [0.35, 0.78] + `, + {} + ); + cy.get('svg'); + }); + it('should render y-axis labels in the center, if y-axis has two labels', () => { + imgSnapshotTest( + ` + quadrantChart + title Reach and engagement of campaigns + x-axis Low Reach + y-axis Low Engagement --> High Engagement + quadrant-1 We should expand + quadrant-2 Need to promote + quadrant-3 Re-evaluate + quadrant-4 May be improved + Campaign A: [0.3, 0.6] + Campaign B: [0.45, 0.23] + Campaign C: [0.57, 0.69] + Campaign D: [0.78, 0.34] + Campaign E: [0.40, 0.34] + Campaign F: [0.35, 0.78] + `, + {} + ); + cy.get('svg'); + }); + it('should render both axes labels on the left/bottom, if both axes have only one label', () => { + imgSnapshotTest( + ` + quadrantChart + title Reach and engagement of campaigns + x-axis Low Reach + y-axis Low Engagement + quadrant-1 We should expand + quadrant-2 Need to promote + quadrant-3 Re-evaluate + quadrant-4 May be improved + Campaign A: [0.3, 0.6] + Campaign B: [0.45, 0.23] + Campaign C: [0.57, 0.69] + Campaign D: [0.78, 0.34] + Campaign E: [0.40, 0.34] + Campaign F: [0.35, 0.78] + `, + {} + ); + cy.get('svg'); + }); }); From de770e4c3c7507e7899ddeb884c855b8c10db7ce Mon Sep 17 00:00:00 2001 From: Hans Blankenhaus Date: Thu, 21 Sep 2023 15:42:36 +0200 Subject: [PATCH 7/9] changed name of test --- cypress/integration/rendering/quadrantChart.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/rendering/quadrantChart.spec.js b/cypress/integration/rendering/quadrantChart.spec.js index 33830d3b7f..643356e399 100644 --- a/cypress/integration/rendering/quadrantChart.spec.js +++ b/cypress/integration/rendering/quadrantChart.spec.js @@ -204,7 +204,7 @@ describe('Quadrant Chart', () => { ); cy.get('svg'); }); - it('should render both axes labels on the left/bottom, if both axes have only one label', () => { + it('should render both axes labels on the left and bottom, if both axes have only one label', () => { imgSnapshotTest( ` quadrantChart From b0da3fb786dc792b35dc963054635c13b7e536d1 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Thu, 21 Sep 2023 22:37:37 +0530 Subject: [PATCH 8/9] docs: Wrap email in <> --- CODE_OF_CONDUCT.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 0917a17fc7..d213ac8b58 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -59,8 +59,8 @@ representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at security@mermaid.live -. +reported to the community leaders responsible for enforcement at . + All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the From 2f6c1972e114a04d6d3fdfcf6e936b24cfda500b Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 22 Sep 2023 05:37:49 +0000 Subject: [PATCH 9/9] Update cypress/integration/rendering/quadrantChart.spec.js --- cypress/integration/rendering/quadrantChart.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/integration/rendering/quadrantChart.spec.js b/cypress/integration/rendering/quadrantChart.spec.js index 643356e399..1be1f7deff 100644 --- a/cypress/integration/rendering/quadrantChart.spec.js +++ b/cypress/integration/rendering/quadrantChart.spec.js @@ -209,8 +209,8 @@ describe('Quadrant Chart', () => { ` quadrantChart title Reach and engagement of campaigns - x-axis Low Reach - y-axis Low Engagement + x-axis Reach --> + y-axis Engagement --> quadrant-1 We should expand quadrant-2 Need to promote quadrant-3 Re-evaluate