From ecac75bac0341ff6944c70255010838794069e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=92=AC=E8=BD=AE=E7=8C=AB?= <10928033@qq.com> Date: Mon, 11 Jul 2022 22:38:23 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintignore | 5 + .eslintrc.js | 59 + .gitignore | 21 +- .husky/.gitignore | 1 + .husky/commit-msg | 4 + .husky/common.sh | 9 + .husky/pre-commit | 5 + .prettierignore | 3 + .vscode/extensions.json | 2 +- LICENSE | 21 - commitlint.config.js | 1 + index.html | 2 +- package-lock.json | 1587 --------- package.json | 59 +- pnpm-lock.yaml | 2582 ++++++++++++++ prettier.config.js | 20 + public/AlternatorSvg.png | Bin 4452 -> 0 bytes public/ArrowDownSvg.png | Bin 2190 -> 0 bytes public/ArrowUpSvg.png | Bin 2135 -> 0 bytes public/ChemicalFeederSvg.png | Bin 4332 -> 0 bytes public/CircuitBreakerSvg.png | Bin 2407 -> 0 bytes public/ConnHorizontalLineSvg.png | Bin 4084 -> 0 bytes public/CoolingTowerSvg.png | Bin 3210 -> 0 bytes public/DoubleWindingSvg.png | Bin 4526 -> 0 bytes public/DoubleWindingSvgB.png | Bin 4497 -> 0 bytes public/ECharts_BasicBar.png | Bin 3079 -> 0 bytes public/ECharts_PieSvg.png | Bin 5357 -> 0 bytes public/GGJSvg.png | Bin 4410 -> 0 bytes public/GroundGraySvg.png | Bin 3153 -> 0 bytes public/InterfaceReturn.json | 1034 ------ public/IsolatingSwitchSvg.png | Bin 3801 -> 0 bytes public/LightningArresterSvg.png | Bin 3376 -> 0 bytes public/Pipeline_H_Svg.png | Bin 1709 -> 0 bytes public/Pipeline_V_Svg.png | Bin 1759 -> 0 bytes public/PolylineSvg.png | Bin 3673 -> 0 bytes public/RectSvg.png | Bin 3495 -> 0 bytes public/RectangleSvg.png | Bin 1774 -> 0 bytes public/ReservoirSvg.png | Bin 2628 -> 0 bytes public/RightAnglePipeSvg.png | Bin 1790 -> 0 bytes public/SignalLampSvg.png | Bin 4593 -> 0 bytes public/StandardCapacitorSvg.png | Bin 3589 -> 0 bytes public/StandardReactanceSvg.png | Bin 4807 -> 0 bytes public/TextSvg.png | Bin 4377 -> 0 bytes public/TransformerTriphaseOpenSvg.png | Bin 6152 -> 0 bytes public/TransformerYSvg.png | Bin 4977 -> 0 bytes public/TwoCircleSvg.png | Bin 6415 -> 0 bytes public/VerticalLineSvg.png | Bin 4085 -> 0 bytes public/WaterPipeValveSvg.png | Bin 1891 -> 0 bytes public/WireBreakSvg.png | Bin 4476 -> 0 bytes public/example.json | 3170 ----------------- public/example2.json | 1 - public/index.html | 17 - public/logo.png | Bin 6849 -> 0 bytes public/test.png | Bin 3407 -> 0 bytes src/App.vue | 162 +- src/Model.ts | 77 - src/assets/css/svgAnimation/index.css | 111 - src/components/BottomBar.vue | 20 - src/components/LeftToolBar.vue | 155 - src/components/RightToolBar.vue | 81 - src/components/SvgDynamic.vue | 50 - src/components/SvgEditor.vue | 555 --- src/components/SvgPrview.vue | 46 - src/components/TopBar.vue | 68 - .../components/bottom-panel/index.vue | 0 .../components/center-panel/index.vue | 0 .../components/left-panel/index.vue | 0 .../components/right-panel/index.vue | 0 .../components/top-panel/index.vue | 0 src/components/webtopo-svgedit/index.vue | 0 src/env.d.ts | 6 +- src/export.ts | 4 - src/func/HotkeyFunc.ts | 105 - src/main.ts | 8 +- src/router/index.ts | 23 + src/views/edit/index.vue | 3 + src/views/preview/index.vue | 3 + tsconfig.json | 7 +- tsconfig.node.json | 8 + vite.config.ts | 36 +- 80 files changed, 2812 insertions(+), 7319 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.js create mode 100644 .husky/.gitignore create mode 100644 .husky/commit-msg create mode 100644 .husky/common.sh create mode 100644 .husky/pre-commit create mode 100644 .prettierignore delete mode 100644 LICENSE create mode 100644 commitlint.config.js delete mode 100644 package-lock.json create mode 100644 pnpm-lock.yaml create mode 100644 prettier.config.js delete mode 100644 public/AlternatorSvg.png delete mode 100644 public/ArrowDownSvg.png delete mode 100644 public/ArrowUpSvg.png delete mode 100644 public/ChemicalFeederSvg.png delete mode 100644 public/CircuitBreakerSvg.png delete mode 100644 public/ConnHorizontalLineSvg.png delete mode 100644 public/CoolingTowerSvg.png delete mode 100644 public/DoubleWindingSvg.png delete mode 100644 public/DoubleWindingSvgB.png delete mode 100644 public/ECharts_BasicBar.png delete mode 100644 public/ECharts_PieSvg.png delete mode 100644 public/GGJSvg.png delete mode 100644 public/GroundGraySvg.png delete mode 100644 public/InterfaceReturn.json delete mode 100644 public/IsolatingSwitchSvg.png delete mode 100644 public/LightningArresterSvg.png delete mode 100644 public/Pipeline_H_Svg.png delete mode 100644 public/Pipeline_V_Svg.png delete mode 100644 public/PolylineSvg.png delete mode 100644 public/RectSvg.png delete mode 100644 public/RectangleSvg.png delete mode 100644 public/ReservoirSvg.png delete mode 100644 public/RightAnglePipeSvg.png delete mode 100644 public/SignalLampSvg.png delete mode 100644 public/StandardCapacitorSvg.png delete mode 100644 public/StandardReactanceSvg.png delete mode 100644 public/TextSvg.png delete mode 100644 public/TransformerTriphaseOpenSvg.png delete mode 100644 public/TransformerYSvg.png delete mode 100644 public/TwoCircleSvg.png delete mode 100644 public/VerticalLineSvg.png delete mode 100644 public/WaterPipeValveSvg.png delete mode 100644 public/WireBreakSvg.png delete mode 100644 public/example.json delete mode 100644 public/example2.json delete mode 100644 public/index.html delete mode 100644 public/logo.png delete mode 100644 public/test.png delete mode 100644 src/Model.ts delete mode 100644 src/assets/css/svgAnimation/index.css delete mode 100644 src/components/BottomBar.vue delete mode 100644 src/components/LeftToolBar.vue delete mode 100644 src/components/RightToolBar.vue delete mode 100644 src/components/SvgDynamic.vue delete mode 100644 src/components/SvgEditor.vue delete mode 100644 src/components/SvgPrview.vue delete mode 100644 src/components/TopBar.vue create mode 100644 src/components/webtopo-svgedit/components/bottom-panel/index.vue create mode 100644 src/components/webtopo-svgedit/components/center-panel/index.vue create mode 100644 src/components/webtopo-svgedit/components/left-panel/index.vue create mode 100644 src/components/webtopo-svgedit/components/right-panel/index.vue create mode 100644 src/components/webtopo-svgedit/components/top-panel/index.vue create mode 100644 src/components/webtopo-svgedit/index.vue delete mode 100644 src/export.ts delete mode 100644 src/func/HotkeyFunc.ts create mode 100644 src/router/index.ts create mode 100644 src/views/edit/index.vue create mode 100644 src/views/preview/index.vue create mode 100644 tsconfig.node.json diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..0c7da02 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,5 @@ +*.md +.vscode +.idea +dist +node_modules \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..682d754 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,59 @@ +module.exports = { + root: true, + env: { + browser: true, + node: true, + es6: true + }, + parser: 'vue-eslint-parser', + parserOptions: { + parser: '@typescript-eslint/parser', + ecmaVersion: 'latest', + sourceType: 'module', + jsxPragma: 'React', + ecmaFeatures: { + jsx: true + } + }, + extends: [ + 'plugin:vue/vue3-recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier', + 'plugin:prettier/recommended' // 一定要放在最后。因为 extends 中后引入的规则会覆盖前面的规则。 + ], + rules: { + // @typescript-eslint + '@typescript-eslint/explicit-function-return-type': 'off', // 需要函数和类方法的显式返回类型 + '@typescript-eslint/no-explicit-any': 'off', // 禁止使用该 any 类型 + '@typescript-eslint/no-var-requires': 'off', // 不允许使用 require 语句,除了在 import 语句中 + '@typescript-eslint/no-empty-function': 'off', // 禁止空函数 + '@typescript-eslint/no-use-before-define': 'off', // 在定义之前禁止使用变量 + '@typescript-eslint/ban-ts-comment': 'off', // 禁止 @ts- 使用评论或在指令后要求描述 + '@typescript-eslint/ban-types': 'off', // 禁止使用特定类型 + '@typescript-eslint/no-non-null-assertion': 'off', // '!'不允许使用后缀运算符的非空断言 + '@typescript-eslint/explicit-module-boundary-types': 'off', // 需要导出函数和类的公共类方法的显式返回和参数类型 + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_' + } + ], // 禁止未使用的变量 + // vue + 'vue/custom-event-name-casing': 'off', // 为自定义事件名称强制使用特定大小写 + 'vue/attributes-order': 'off', // 强制执行属性顺序 + 'vue/one-component-per-file': 'off', // 强制每个组件都应该在自己的文件中 + 'vue/html-closing-bracket-newline': 'off', // 在标签的右括号之前要求或禁止换行 + 'vue/multiline-html-element-content-newline': 'off', // 在多行元素的内容之前和之后需要换行符 + 'vue/singleline-html-element-content-newline': 'off', // 在单行元素的内容之前和之后需要换行符 + 'vue/attribute-hyphenation': 'off', // 对模板中的自定义组件强制执行属性命名样式 + 'vue/require-default-prop': 'off', // 需要 props 的默认值 + 'vue/html-indent': ['error', 2], // 在