diff --git a/packages/ui/certd-client/package.json b/packages/ui/certd-client/package.json index fe37e8c07..8557ab78a 100644 --- a/packages/ui/certd-client/package.json +++ b/packages/ui/certd-client/package.json @@ -15,7 +15,8 @@ "serve": "vite preview", "preview": "vite preview", "pretty-quick": "pretty-quick", - "lint-fix": "eslint --fix --ext .js --ext .jsx --ext .vue src/", + "lint-fix": "eslint --fix --ext .js --ext .jsx --ext .vue --ext .ts --ext .tsx src/", + "format": "prettier --write src", "upgrade": "yarn upgrade-interactive --latest", "tsc": "vue-tsc --noEmit --skipLibCheck", "circle:check": "pnpm dependency-cruise --validate --output-type err-html -f dependency-report.html src", diff --git a/packages/ui/certd-client/src/components/code-editor/index.vue b/packages/ui/certd-client/src/components/code-editor/index.vue index 56fe939c7..c6194948b 100644 --- a/packages/ui/certd-client/src/components/code-editor/index.vue +++ b/packages/ui/certd-client/src/components/code-editor/index.vue @@ -10,6 +10,10 @@ import { cloneDeep, debounce as lodashDebounce } from "lodash-es"; import { initWorkers } from "./workers"; import { importJavascriptContribution, importJsonContribution, importMonacoYaml, importYamlContribution } from "./async-import"; +defineOptions({ + name: "CodeEditor", +}); + /** * config: * value: '', // 编辑器初始文本 diff --git a/packages/ui/certd-client/src/components/container.vue b/packages/ui/certd-client/src/components/container.vue index dd92b4545..b7f42d9f3 100644 --- a/packages/ui/certd-client/src/components/container.vue +++ b/packages/ui/certd-client/src/components/container.vue @@ -18,7 +18,7 @@ diff --git a/packages/ui/certd-client/src/components/cron-editor/index.vue b/packages/ui/certd-client/src/components/cron-editor/index.vue index c411b4de0..aadaa3404 100644 --- a/packages/ui/certd-client/src/components/cron-editor/index.vue +++ b/packages/ui/certd-client/src/components/cron-editor/index.vue @@ -1,21 +1,17 @@ - diff --git a/packages/ui/certd-client/src/components/email-selector/index.vue b/packages/ui/certd-client/src/components/email-selector/index.vue index 81c3cca35..f36101aff 100644 --- a/packages/ui/certd-client/src/components/email-selector/index.vue +++ b/packages/ui/certd-client/src/components/email-selector/index.vue @@ -26,7 +26,9 @@ import { defineComponent, onMounted, ref } from "vue"; import * as api from "./api"; import { Modal, notification } from "ant-design-vue"; - +defineOptions({ + name: "EmailEditor", +}); const props = defineProps<{}>(); const VNodes = defineComponent({ props: { diff --git a/packages/ui/certd-client/src/components/expires-time-text.vue b/packages/ui/certd-client/src/components/expires-time-text.vue index f7f00b161..bfe19e2e9 100644 --- a/packages/ui/certd-client/src/components/expires-time-text.vue +++ b/packages/ui/certd-client/src/components/expires-time-text.vue @@ -16,7 +16,7 @@ import dayjs from "dayjs"; import { computed } from "vue"; defineOptions({ - name: "ExpiresTimeText" + name: "ExpiresTimeText", }); const props = defineProps<{ diff --git a/packages/ui/certd-client/src/components/highlight-styles/androidstudio.css b/packages/ui/certd-client/src/components/highlight-styles/androidstudio.css index bc8e473b5..8adf4d577 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/androidstudio.css +++ b/packages/ui/certd-client/src/components/highlight-styles/androidstudio.css @@ -15,7 +15,7 @@ Author: Pedro Oliveira .hljs-literal, .hljs-symbol, .hljs-bullet { - color: #6897BB; + color: #6897bb; } .hljs-keyword, @@ -42,7 +42,7 @@ Author: Pedro Oliveira .hljs-string, .hljs-attribute, .hljs-addition { - color: #6A8759; + color: #6a8759; } .hljs-section, diff --git a/packages/ui/certd-client/src/components/highlight-styles/arduino-light.css b/packages/ui/certd-client/src/components/highlight-styles/arduino-light.css index 4b8b7fd3c..fdfdff5a0 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/arduino-light.css +++ b/packages/ui/certd-client/src/components/highlight-styles/arduino-light.css @@ -8,7 +8,7 @@ Arduino® Light Theme - Stefania Mellai display: block; overflow-x: auto; padding: 0.5em; - background: #FFFFFF; + background: #ffffff; } .hljs, @@ -21,7 +21,7 @@ Arduino® Light Theme - Stefania Mellai .hljs-selector-tag, .hljs-doctag, .hljs-name { - color: #00979D; + color: #00979d; } .hljs-built_in, @@ -29,7 +29,7 @@ Arduino® Light Theme - Stefania Mellai .hljs-bullet, .hljs-code, .hljs-addition { - color: #D35400; + color: #d35400; } .hljs-regexp, @@ -39,7 +39,7 @@ Arduino® Light Theme - Stefania Mellai .hljs-link, .hljs-selector-attr, .hljs-selector-pseudo { - color: #00979D; + color: #00979d; } .hljs-type, @@ -49,7 +49,7 @@ Arduino® Light Theme - Stefania Mellai .hljs-quote, .hljs-template-tag, .hljs-deletion { - color: #005C5F; + color: #005c5f; } .hljs-title, @@ -59,15 +59,15 @@ Arduino® Light Theme - Stefania Mellai } .hljs-comment { - color: rgba(149,165,166,.8); + color: rgba(149, 165, 166, 0.8); } .hljs-meta-keyword { - color: #728E00; + color: #728e00; } .hljs-meta { - color: #728E00; + color: #728e00; color: #434f54; } @@ -80,9 +80,9 @@ Arduino® Light Theme - Stefania Mellai } .hljs-function { - color: #728E00; + color: #728e00; } .hljs-number { - color: #8A7B52; + color: #8a7b52; } diff --git a/packages/ui/certd-client/src/components/highlight-styles/brown-paper.css b/packages/ui/certd-client/src/components/highlight-styles/brown-paper.css index f0197b924..4382c2516 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/brown-paper.css +++ b/packages/ui/certd-client/src/components/highlight-styles/brown-paper.css @@ -8,14 +8,14 @@ Brown Paper style from goldblog.com.ua (c) Zaripov Yura display: block; overflow-x: auto; padding: 0.5em; - background:#b7a68e url(./brown-papersq.png); + background: #b7a68e url(./brown-papersq.png); } .hljs-keyword, .hljs-selector-tag, .hljs-literal { - color:#005599; - font-weight:bold; + color: #005599; + font-weight: bold; } .hljs, diff --git a/packages/ui/certd-client/src/components/highlight-styles/color-brewer.css b/packages/ui/certd-client/src/components/highlight-styles/color-brewer.css index 7934d986a..17f58afb2 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/color-brewer.css +++ b/packages/ui/certd-client/src/components/highlight-styles/color-brewer.css @@ -45,8 +45,6 @@ Ported by Fabrício Tavares de Oliveira color: #88f; } - - .hljs-keyword, .hljs-selector-tag, .hljs-title, diff --git a/packages/ui/certd-client/src/components/highlight-styles/darcula.css b/packages/ui/certd-client/src/components/highlight-styles/darcula.css index be182d0b5..1d3826b20 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/darcula.css +++ b/packages/ui/certd-client/src/components/highlight-styles/darcula.css @@ -4,7 +4,6 @@ Darcula color scheme from the JetBrains family of IDEs */ - .hljs { display: block; overflow-x: auto; diff --git a/packages/ui/certd-client/src/components/highlight-styles/darkula.css b/packages/ui/certd-client/src/components/highlight-styles/darkula.css index f4646c3c5..7c57266f2 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/darkula.css +++ b/packages/ui/certd-client/src/components/highlight-styles/darkula.css @@ -3,4 +3,4 @@ Please use darcula.css instead. */ -@import url('darcula.css'); +@import url("darcula.css"); diff --git a/packages/ui/certd-client/src/components/highlight-styles/default.css b/packages/ui/certd-client/src/components/highlight-styles/default.css index f1bfade31..eba516dd6 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/default.css +++ b/packages/ui/certd-client/src/components/highlight-styles/default.css @@ -8,10 +8,9 @@ Original highlight.js style (c) Ivan Sagalaev display: block; overflow-x: auto; padding: 0.5em; - background: #F0F0F0; + background: #f0f0f0; } - /* Base color: saturation 0; */ .hljs, @@ -32,7 +31,6 @@ Original highlight.js style (c) Ivan Sagalaev font-weight: bold; } - /* User color: hue: 0 */ .hljs-type, @@ -59,14 +57,13 @@ Original highlight.js style (c) Ivan Sagalaev .hljs-link, .hljs-selector-attr, .hljs-selector-pseudo { - color: #BC6060; + color: #bc6060; } - /* Language color: hue: 90; */ .hljs-literal { - color: #78A960; + color: #78a960; } .hljs-built_in, @@ -76,7 +73,6 @@ Original highlight.js style (c) Ivan Sagalaev color: #397300; } - /* Meta color: hue: 200 */ .hljs-meta { @@ -87,7 +83,6 @@ Original highlight.js style (c) Ivan Sagalaev color: #4d99bf; } - /* Misc effects */ .hljs-emphasis { diff --git a/packages/ui/certd-client/src/components/highlight-styles/foundation.css b/packages/ui/certd-client/src/components/highlight-styles/foundation.css index f1fe64b37..67c6e1015 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/foundation.css +++ b/packages/ui/certd-client/src/components/highlight-styles/foundation.css @@ -10,7 +10,8 @@ Date: 2013-04-02 display: block; overflow-x: auto; padding: 0.5em; - background: #eee; color: black; + background: #eee; + color: black; } .hljs-link, diff --git a/packages/ui/certd-client/src/components/highlight-styles/googlecode.css b/packages/ui/certd-client/src/components/highlight-styles/googlecode.css index 884ad6353..d7a18d2cb 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/googlecode.css +++ b/packages/ui/certd-client/src/components/highlight-styles/googlecode.css @@ -68,7 +68,7 @@ Google Code style (c) Aahan Krish .hljs-selector-id, .hljs-selector-class { - color: #9B703F + color: #9b703f; } .hljs-addition { diff --git a/packages/ui/certd-client/src/components/highlight-styles/grayscale.css b/packages/ui/certd-client/src/components/highlight-styles/grayscale.css index 5376f3406..0d5669fa3 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/grayscale.css +++ b/packages/ui/certd-client/src/components/highlight-styles/grayscale.css @@ -60,8 +60,8 @@ grayscale style (c) MY Sun } .hljs-regexp { - color: #333; - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAICAYAAADA+m62AAAAPUlEQVQYV2NkQAN37979r6yszIgujiIAU4RNMVwhuiQ6H6wQl3XI4oy4FMHcCJPHcDS6J2A2EqUQpJhohQDexSef15DBCwAAAABJRU5ErkJggg==) repeat; + color: #333; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAICAYAAADA+m62AAAAPUlEQVQYV2NkQAN37979r6yszIgujiIAU4RNMVwhuiQ6H6wQl3XI4oy4FMHcCJPHcDS6J2A2EqUQpJhohQDexSef15DBCwAAAABJRU5ErkJggg==) repeat; } .hljs-symbol, @@ -84,7 +84,7 @@ grayscale style (c) MY Sun .hljs-deletion { color: #fff; - background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAADCAYAAABS3WWCAAAAE0lEQVQIW2MMDQ39zzhz5kwIAQAyxweWgUHd1AAAAABJRU5ErkJggg==) repeat; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAADCAYAAABS3WWCAAAAE0lEQVQIW2MMDQ39zzhz5kwIAQAyxweWgUHd1AAAAABJRU5ErkJggg==) repeat; } .hljs-addition { diff --git a/packages/ui/certd-client/src/components/highlight-styles/hybrid.css b/packages/ui/certd-client/src/components/highlight-styles/hybrid.css index 29735a189..34203ed26 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/hybrid.css +++ b/packages/ui/certd-client/src/components/highlight-styles/hybrid.css @@ -47,7 +47,7 @@ vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid) .hljs-literal, .hljs-deletion, .hljs-link { - color: #cc6666 + color: #cc6666; } /*color: fg_green*/ @@ -64,7 +64,7 @@ vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid) .hljs-attribute, .hljs-code, .hljs-selector-id { - color: #b294bb; + color: #b294bb; } /*color: fg_blue*/ @@ -72,7 +72,7 @@ vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid) .hljs-selector-tag, .hljs-bullet, .hljs-tag { - color: #81a2be; + color: #81a2be; } /*color: fg_aqua*/ diff --git a/packages/ui/certd-client/src/components/highlight-styles/ir-black.css b/packages/ui/certd-client/src/components/highlight-styles/ir-black.css index bd4c755ed..dda1d7a9a 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/ir-black.css +++ b/packages/ui/certd-client/src/components/highlight-styles/ir-black.css @@ -61,7 +61,7 @@ .hljs-number, .hljs-deletion { - color:#ff73fd; + color: #ff73fd; } .hljs-emphasis { diff --git a/packages/ui/certd-client/src/components/highlight-styles/monokai.css b/packages/ui/certd-client/src/components/highlight-styles/monokai.css index 775d53f91..af24834a9 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/monokai.css +++ b/packages/ui/certd-client/src/components/highlight-styles/monokai.css @@ -6,7 +6,8 @@ Monokai style - ported by Luigi Maselli - http://grigio.org display: block; overflow-x: auto; padding: 0.5em; - background: #272822; color: #ddd; + background: #272822; + color: #ddd; } .hljs-tag, diff --git a/packages/ui/certd-client/src/components/highlight-styles/obsidian.css b/packages/ui/certd-client/src/components/highlight-styles/obsidian.css index 356630fa2..b33aec2b4 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/obsidian.css +++ b/packages/ui/certd-client/src/components/highlight-styles/obsidian.css @@ -72,7 +72,7 @@ } .hljs-selector-class { - color: #A082BD + color: #a082bd; } .hljs-keyword, diff --git a/packages/ui/certd-client/src/components/highlight-styles/purebasic.css b/packages/ui/certd-client/src/components/highlight-styles/purebasic.css index 5ce9b9e07..d31f09699 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/purebasic.css +++ b/packages/ui/certd-client/src/components/highlight-styles/purebasic.css @@ -21,12 +21,13 @@ NOTE_2: Color names provided in comments were derived using "Name that Color" on http://chir.ag/projects/name-that-color */ -.hljs { /* Common set of rules required by highlight.js (don'r remove!) */ - display: block; - overflow-x: auto; - padding: 0.5em; - background: #FFFFDF; /* Half and Half (approx.) */ -/* --- Uncomment to add PureBASIC native IDE styled font! +.hljs { + /* Common set of rules required by highlight.js (don'r remove!) */ + display: block; + overflow-x: auto; + padding: 0.5em; + background: #ffffdf; /* Half and Half (approx.) */ + /* --- Uncomment to add PureBASIC native IDE styled font! font-family: Consolas; */ } @@ -39,7 +40,7 @@ NOTE_2: Color names provided in comments were derived using "Name that Color" on .hljs-attr, .hljs-params, .hljs-subst { - color: #000000; /* Black */ + color: #000000; /* Black */ } .hljs-comment, /* --- used for PureBASIC Comments --- */ @@ -47,14 +48,14 @@ NOTE_2: Color names provided in comments were derived using "Name that Color" on .hljs-section, .hljs-selector-pseudo, .hljs-addition { - color: #00AAAA; /* Persian Green (approx.) */ + color: #00aaaa; /* Persian Green (approx.) */ } .hljs-title, /* --- used for PureBASIC Procedures Names --- */ .hljs-tag, .hljs-variable, -.hljs-code { - color: #006666; /* Blue Stone (approx.) */ +.hljs-code { + color: #006666; /* Blue Stone (approx.) */ } .hljs-keyword, /* --- used for PureBASIC Keywords --- */ @@ -63,34 +64,34 @@ NOTE_2: Color names provided in comments were derived using "Name that Color" on .hljs-selector-class, .hljs-built_in, .hljs-builtin-name { - color: #006666; /* Blue Stone (approx.) */ - font-weight: bold; + color: #006666; /* Blue Stone (approx.) */ + font-weight: bold; } .hljs-string, /* --- used for PureBASIC Strings --- */ .hljs-selector-attr { - color: #0080FF; /* Azure Radiance (approx.) */ + color: #0080ff; /* Azure Radiance (approx.) */ } .hljs-symbol, /* --- used for PureBASIC Constants --- */ .hljs-link, .hljs-deletion, .hljs-attribute { - color: #924B72; /* Cannon Pink (approx.) */ + color: #924b72; /* Cannon Pink (approx.) */ } .hljs-meta, .hljs-literal, .hljs-selector-id { - color: #924B72; /* Cannon Pink (approx.) */ - font-weight: bold; + color: #924b72; /* Cannon Pink (approx.) */ + font-weight: bold; } .hljs-strong, .hljs-name { - font-weight: bold; + font-weight: bold; } .hljs-emphasis { - font-style: italic; + font-style: italic; } diff --git a/packages/ui/certd-client/src/components/highlight-styles/qtcreator_dark.css b/packages/ui/certd-client/src/components/highlight-styles/qtcreator_dark.css index 7aa56a365..d10256dd4 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/qtcreator_dark.css +++ b/packages/ui/certd-client/src/components/highlight-styles/qtcreator_dark.css @@ -4,7 +4,6 @@ Qt Creator dark color scheme */ - .hljs { display: block; overflow-x: auto; @@ -32,8 +31,7 @@ Qt Creator dark color scheme color: #ff55ff; } -.hljs-code -.hljs-selector-class { +.hljs-code .hljs-selector-class { color: #aaaaff; } diff --git a/packages/ui/certd-client/src/components/highlight-styles/qtcreator_light.css b/packages/ui/certd-client/src/components/highlight-styles/qtcreator_light.css index 1efa2c660..8cacde09e 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/qtcreator_light.css +++ b/packages/ui/certd-client/src/components/highlight-styles/qtcreator_light.css @@ -4,7 +4,6 @@ Qt Creator light color scheme */ - .hljs { display: block; overflow-x: auto; @@ -32,8 +31,7 @@ Qt Creator light color scheme color: #000080; } -.hljs-code -.hljs-selector-class { +.hljs-code .hljs-selector-class { color: #800080; } @@ -59,7 +57,7 @@ Qt Creator light color scheme .hljs-variable, .hljs-params, .hljs-class .hljs-title { - color: #0055AF; + color: #0055af; } .hljs-string, diff --git a/packages/ui/certd-client/src/components/highlight-styles/railscasts.css b/packages/ui/certd-client/src/components/highlight-styles/railscasts.css index 008cdc5bf..1c6e518b6 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/railscasts.css +++ b/packages/ui/certd-client/src/components/highlight-styles/railscasts.css @@ -44,7 +44,6 @@ Railscasts-like style (c) Visoft, Inc. (Damien White) color: #da4939; } - .hljs-symbol, .hljs-bullet, .hljs-built_in, diff --git a/packages/ui/certd-client/src/components/highlight-styles/rainbow.css b/packages/ui/certd-client/src/components/highlight-styles/rainbow.css index 905eb8ef1..47d2a698e 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/rainbow.css +++ b/packages/ui/certd-client/src/components/highlight-styles/rainbow.css @@ -12,7 +12,6 @@ Style with support for rainbow parens color: #d1d9e1; } - .hljs-comment, .hljs-quote { color: #969896; @@ -50,7 +49,7 @@ Style with support for rainbow parens .hljs-template-variable, .hljs-selector-id, .hljs-class .hljs-title { - color: #ffcc66; + color: #ffcc66; } .hljs-section, diff --git a/packages/ui/certd-client/src/components/highlight-styles/routeros.css b/packages/ui/certd-client/src/components/highlight-styles/routeros.css index ebe23990d..51c3cc998 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/routeros.css +++ b/packages/ui/certd-client/src/components/highlight-styles/routeros.css @@ -8,7 +8,7 @@ display: block; overflow-x: auto; padding: 0.5em; - background: #F0F0F0; + background: #f0f0f0; } /* Base color: saturation 0; */ @@ -31,15 +31,15 @@ } .hljs-attribute { - color: #0E9A00; -} + color: #0e9a00; +} .hljs-function { - color: #99069A; + color: #99069a; } .hljs-builtin-name { - color: #99069A; + color: #99069a; } /* User color: hue: 0 */ @@ -68,24 +68,22 @@ .hljs-link, .hljs-selector-attr, .hljs-selector-pseudo { - color: #BC6060; + color: #bc6060; } - /* Language color: hue: 90; */ .hljs-literal { - color: #78A960; + color: #78a960; } .hljs-built_in, .hljs-bullet, .hljs-code, .hljs-addition { - color: #0C9A9A; + color: #0c9a9a; } - /* Meta color: hue: 200 */ .hljs-meta { @@ -96,7 +94,6 @@ color: #4d99bf; } - /* Misc effects */ .hljs-emphasis { diff --git a/packages/ui/certd-client/src/components/highlight-styles/school-book.css b/packages/ui/certd-client/src/components/highlight-styles/school-book.css index 964b51d84..1648b0681 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/school-book.css +++ b/packages/ui/certd-client/src/components/highlight-styles/school-book.css @@ -9,11 +9,11 @@ School Book style from goldblog.com.ua (c) Zaripov Yura overflow-x: auto; padding: 15px 0.5em 0.5em 30px; font-size: 11px; - line-height:16px; + line-height: 16px; } -pre{ - background:#f6f6ae url(./school-book.png); +pre { + background: #f6f6ae url(./school-book.png); border-top: solid 2px #d2e8b9; border-bottom: solid 1px #d2e8b9; } @@ -21,8 +21,8 @@ pre{ .hljs-keyword, .hljs-selector-tag, .hljs-literal { - color:#005599; - font-weight:bold; + color: #005599; + font-weight: bold; } .hljs, diff --git a/packages/ui/certd-client/src/components/highlight-styles/vs.css b/packages/ui/certd-client/src/components/highlight-styles/vs.css index c5d07d311..6703b6415 100644 --- a/packages/ui/certd-client/src/components/highlight-styles/vs.css +++ b/packages/ui/certd-client/src/components/highlight-styles/vs.css @@ -58,7 +58,6 @@ Visual Studio-like style based on original C# coloring by Jason Diamond diff --git a/packages/ui/certd-client/src/components/highlight/libs/htmlFormat.js b/packages/ui/certd-client/src/components/highlight/libs/htmlFormat.js index 637e1ab54..4327b24ac 100644 --- a/packages/ui/certd-client/src/components/highlight/libs/htmlFormat.js +++ b/packages/ui/certd-client/src/components/highlight/libs/htmlFormat.js @@ -3,40 +3,40 @@ // 功能 // 将HTML字符串格式化 -const format = (function() { +const format = (function () { function style_html(html_source, indent_size, indent_character, max_char) { var Parser, multi_parser; function Parser() { this.pos = 0; - this.token = ''; - this.current_mode = 'CONTENT'; + this.token = ""; + this.current_mode = "CONTENT"; this.tags = { - parent: 'parent1', + parent: "parent1", parentcount: 1, - parent1: '' + parent1: "", }; - this.tag_type = ''; - this.token_text = this.last_token = this.last_text = this.token_type = ''; + this.tag_type = ""; + this.token_text = this.last_token = this.last_text = this.token_type = ""; this.Utils = { - whitespace: "\n\r\t ".split(''), - single_token: 'br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed'.split(','), - extra_liners: 'head,body,/html'.split(','), - in_array: function(what, arr) { + whitespace: "\n\r\t ".split(""), + single_token: "br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed".split(","), + extra_liners: "head,body,/html".split(","), + in_array: function (what, arr) { for (var i = 0; i < arr.length; i++) { if (what === arr[i]) { return true; } } return false; - } - } - this.get_content = function() { - var char = ''; + }, + }; + this.get_content = function () { + var char = ""; var content = []; var space = false; - while (this.input.charAt(this.pos) !== '<') { + while (this.input.charAt(this.pos) !== "<") { if (this.pos >= this.input.length) { - return content.length ? content.join('') : ['', 'TK_EOF']; + return content.length ? content.join("") : ["", "TK_EOF"]; } char = this.input.charAt(this.pos); this.pos++; @@ -49,78 +49,78 @@ const format = (function() { continue; } else if (space) { if (this.line_char_count >= this.max_char) { - content.push('\n'); + content.push("\n"); for (var i = 0; i < this.indent_level; i++) { content.push(this.indent_string); } this.line_char_count = 0; } else { - content.push(' '); + content.push(" "); this.line_char_count++; } space = false; } content.push(char); } - return content.length ? content.join('') : ''; - } - this.get_script = function() { - var char = ''; + return content.length ? content.join("") : ""; + }; + this.get_script = function () { + var char = ""; var content = []; - var reg_match = new RegExp('\<\/script' + '\>', 'igm'); + var reg_match = new RegExp("", "igm"); reg_match.lastIndex = this.pos; var reg_array = reg_match.exec(this.input); - var end_script = reg_array ? reg_array.index: this.input.length; + var end_script = reg_array ? reg_array.index : this.input.length; while (this.pos < end_script) { if (this.pos >= this.input.length) { - return content.length ? content.join('') : ['', 'TK_EOF']; + return content.length ? content.join("") : ["", "TK_EOF"]; } char = this.input.charAt(this.pos); this.pos++; content.push(char); } - return content.length ? content.join('') : ''; - } - this.record_tag = function(tag) { - if (this.tags[tag + 'count']) { - this.tags[tag + 'count']++; - this.tags[tag + this.tags[tag + 'count']] = this.indent_level; + return content.length ? content.join("") : ""; + }; + this.record_tag = function (tag) { + if (this.tags[tag + "count"]) { + this.tags[tag + "count"]++; + this.tags[tag + this.tags[tag + "count"]] = this.indent_level; } else { - this.tags[tag + 'count'] = 1; - this.tags[tag + this.tags[tag + 'count']] = this.indent_level; + this.tags[tag + "count"] = 1; + this.tags[tag + this.tags[tag + "count"]] = this.indent_level; } - this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; - this.tags.parent = tag + this.tags[tag + 'count']; - } - this.retrieve_tag = function(tag) { - if (this.tags[tag + 'count']) { + this.tags[tag + this.tags[tag + "count"] + "parent"] = this.tags.parent; + this.tags.parent = tag + this.tags[tag + "count"]; + }; + this.retrieve_tag = function (tag) { + if (this.tags[tag + "count"]) { var temp_parent = this.tags.parent; while (temp_parent) { - if (tag + this.tags[tag + 'count'] === temp_parent) { + if (tag + this.tags[tag + "count"] === temp_parent) { break; } - temp_parent = this.tags[temp_parent + 'parent']; + temp_parent = this.tags[temp_parent + "parent"]; } if (temp_parent) { - this.indent_level = this.tags[tag + this.tags[tag + 'count']]; - this.tags.parent = this.tags[temp_parent + 'parent']; + this.indent_level = this.tags[tag + this.tags[tag + "count"]]; + this.tags.parent = this.tags[temp_parent + "parent"]; } - delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; - delete this.tags[tag + this.tags[tag + 'count']]; - if (this.tags[tag + 'count'] == 1) { - delete this.tags[tag + 'count']; + delete this.tags[tag + this.tags[tag + "count"] + "parent"]; + delete this.tags[tag + this.tags[tag + "count"]]; + if (this.tags[tag + "count"] == 1) { + delete this.tags[tag + "count"]; } else { - this.tags[tag + 'count']--; + this.tags[tag + "count"]--; } } - } - this.get_tag = function() { - var char = ''; + }; + this.get_tag = function () { + var char = ""; var content = []; var space = false; do { if (this.pos >= this.input.length) { - return content.length ? content.join('') : ['', 'TK_EOF']; + return content.length ? content.join("") : ["", "TK_EOF"]; } char = this.input.charAt(this.pos); this.pos++; @@ -131,92 +131,92 @@ const format = (function() { continue; } if (char === "'" || char === '"') { - if (!content[1] || content[1] !== '!') { + if (!content[1] || content[1] !== "!") { char += this.get_unformatted(char); space = true; } } - if (char === '=') { + if (char === "=") { space = false; } - if (content.length && content[content.length - 1] !== '=' && char !== '>' && space) { + if (content.length && content[content.length - 1] !== "=" && char !== ">" && space) { if (this.line_char_count >= this.max_char) { this.print_newline(false, content); this.line_char_count = 0; } else { - content.push(' '); + content.push(" "); this.line_char_count++; } space = false; } content.push(char); - } while ( char !== '>'); - var tag_complete = content.join(''); + } while (char !== ">"); + var tag_complete = content.join(""); var tag_index; - if (tag_complete.indexOf(' ') != -1) { - tag_index = tag_complete.indexOf(' '); + if (tag_complete.indexOf(" ") != -1) { + tag_index = tag_complete.indexOf(" "); } else { - tag_index = tag_complete.indexOf('>'); + tag_index = tag_complete.indexOf(">"); } var tag_check = tag_complete.substring(1, tag_index).toLowerCase(); - if (tag_complete.charAt(tag_complete.length - 2) === '/' || this.Utils.in_array(tag_check, this.Utils.single_token)) { - this.tag_type = 'SINGLE'; - } else if (tag_check === 'script') { + if (tag_complete.charAt(tag_complete.length - 2) === "/" || this.Utils.in_array(tag_check, this.Utils.single_token)) { + this.tag_type = "SINGLE"; + } else if (tag_check === "script") { this.record_tag(tag_check); - this.tag_type = 'SCRIPT'; - } else if (tag_check === 'style') { + this.tag_type = "SCRIPT"; + } else if (tag_check === "style") { this.record_tag(tag_check); - this.tag_type = 'STYLE'; - } else if (tag_check.charAt(0) === '!') { - if (tag_check.indexOf('[if') != -1) { - if (tag_complete.indexOf('!IE') != -1) { - var comment = this.get_unformatted('-->', tag_complete); + this.tag_type = "STYLE"; + } else if (tag_check.charAt(0) === "!") { + if (tag_check.indexOf("[if") != -1) { + if (tag_complete.indexOf("!IE") != -1) { + var comment = this.get_unformatted("-->", tag_complete); content.push(comment); } - this.tag_type = 'START'; - } else if (tag_check.indexOf('[endif') != -1) { - this.tag_type = 'END'; + this.tag_type = "START"; + } else if (tag_check.indexOf("[endif") != -1) { + this.tag_type = "END"; this.unindent(); - } else if (tag_check.indexOf('[cdata[') != -1) { - var comment = this.get_unformatted(']]>', tag_complete); + } else if (tag_check.indexOf("[cdata[") != -1) { + var comment = this.get_unformatted("]]>", tag_complete); content.push(comment); - this.tag_type = 'SINGLE'; + this.tag_type = "SINGLE"; } else { - var comment = this.get_unformatted('-->', tag_complete); + var comment = this.get_unformatted("-->", tag_complete); content.push(comment); - this.tag_type = 'SINGLE'; + this.tag_type = "SINGLE"; } } else { - if (tag_check.charAt(0) === '/') { + if (tag_check.charAt(0) === "/") { this.retrieve_tag(tag_check.substring(1)); - this.tag_type = 'END'; + this.tag_type = "END"; } else { this.record_tag(tag_check); - this.tag_type = 'START'; + this.tag_type = "START"; } if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { this.print_newline(true, this.output); } } - return content.join(''); - } - this.get_unformatted = function(delimiter, orig_tag) { + return content.join(""); + }; + this.get_unformatted = function (delimiter, orig_tag) { if (orig_tag && orig_tag.indexOf(delimiter) != -1) { - return ''; + return ""; } - var char = ''; - var content = ''; + var char = ""; + var content = ""; var space = true; do { char = this.input.charAt(this.pos); - this.pos++ + this.pos++; if (this.Utils.in_array(char, this.Utils.whitespace)) { if (!space) { this.line_char_count--; continue; } - if (char === '\n' || char === '\r') { - content += '\n'; + if (char === "\n" || char === "\r") { + content += "\n"; for (var i = 0; i < this.indent_level; i++) { content += this.indent_string; } @@ -228,44 +228,43 @@ const format = (function() { content += char; this.line_char_count++; space = true; - - } while ( content . indexOf ( delimiter ) == -1); + } while (content.indexOf(delimiter) == -1); return content; - } - this.get_token = function() { + }; + this.get_token = function () { var token; - if (this.last_token === 'TK_TAG_SCRIPT') { + if (this.last_token === "TK_TAG_SCRIPT") { var temp_token = this.get_script(); - if (typeof temp_token !== 'string') { + if (typeof temp_token !== "string") { return temp_token; } //token = js_beautify(temp_token, this.indent_size, this.indent_character, this.indent_level); //return [token, 'TK_CONTENT']; - return [temp_token, 'TK_CONTENT']; + return [temp_token, "TK_CONTENT"]; } - if (this.current_mode === 'CONTENT') { + if (this.current_mode === "CONTENT") { token = this.get_content(); - if (typeof token !== 'string') { + if (typeof token !== "string") { return token; } else { - return [token, 'TK_CONTENT']; + return [token, "TK_CONTENT"]; } } - if (this.current_mode === 'TAG') { + if (this.current_mode === "TAG") { token = this.get_tag(); - if (typeof token !== 'string') { + if (typeof token !== "string") { return token; } else { - var tag_name_type = 'TK_TAG_' + this.tag_type; + var tag_name_type = "TK_TAG_" + this.tag_type; return [token, tag_name_type]; } } - } - this.printer = function(js_source, indent_character, indent_size, max_char) { - this.input = js_source || ''; + }; + this.printer = function (js_source, indent_character, indent_size, max_char) { + this.input = js_source || ""; this.output = []; - this.indent_character = indent_character || ' '; - this.indent_string = ''; + this.indent_character = indent_character || " "; + this.indent_string = ""; this.indent_size = indent_size || 2; this.indent_level = 0; this.max_char = max_char || 70; @@ -273,7 +272,7 @@ const format = (function() { for (var i = 0; i < this.indent_size; i++) { this.indent_string += this.indent_character; } - this.print_newline = function(ignore, arr) { + this.print_newline = function (ignore, arr) { this.line_char_count = 0; if (!arr || !arr.length) { return; @@ -283,23 +282,23 @@ const format = (function() { arr.pop(); } } - arr.push('\n'); + arr.push("\n"); for (var i = 0; i < this.indent_level; i++) { arr.push(this.indent_string); } - } - this.print_token = function(text) { + }; + this.print_token = function (text) { this.output.push(text); - } - this.indent = function() { + }; + this.indent = function () { this.indent_level++; - } - this.unindent = function() { + }; + this.unindent = function () { if (this.indent_level > 0) { this.indent_level--; } - } - } + }; + }; return this; } multi_parser = new Parser(); @@ -308,58 +307,56 @@ const format = (function() { var t = multi_parser.get_token(); multi_parser.token_text = t[0]; multi_parser.token_type = t[1]; - if (multi_parser.token_type === 'TK_EOF') { + if (multi_parser.token_type === "TK_EOF") { break; } switch (multi_parser.token_type) { - case 'TK_TAG_START': - case 'TK_TAG_SCRIPT': - case 'TK_TAG_STYLE': - multi_parser.print_newline(false, multi_parser.output); - multi_parser.print_token(multi_parser.token_text); - multi_parser.indent(); - multi_parser.current_mode = 'CONTENT'; - break; - case 'TK_TAG_END': - multi_parser.print_newline(true, multi_parser.output); - multi_parser.print_token(multi_parser.token_text); - multi_parser.current_mode = 'CONTENT'; - break; - case 'TK_TAG_SINGLE': - multi_parser.print_newline(false, multi_parser.output); - multi_parser.print_token(multi_parser.token_text); - multi_parser.current_mode = 'CONTENT'; - break; - case 'TK_CONTENT': - if (multi_parser.token_text !== '') { + case "TK_TAG_START": + case "TK_TAG_SCRIPT": + case "TK_TAG_STYLE": multi_parser.print_newline(false, multi_parser.output); multi_parser.print_token(multi_parser.token_text); - } - multi_parser.current_mode = 'TAG'; - break; + multi_parser.indent(); + multi_parser.current_mode = "CONTENT"; + break; + case "TK_TAG_END": + multi_parser.print_newline(true, multi_parser.output); + multi_parser.print_token(multi_parser.token_text); + multi_parser.current_mode = "CONTENT"; + break; + case "TK_TAG_SINGLE": + multi_parser.print_newline(false, multi_parser.output); + multi_parser.print_token(multi_parser.token_text); + multi_parser.current_mode = "CONTENT"; + break; + case "TK_CONTENT": + if (multi_parser.token_text !== "") { + multi_parser.print_newline(false, multi_parser.output); + multi_parser.print_token(multi_parser.token_text); + } + multi_parser.current_mode = "TAG"; + break; } multi_parser.last_token = multi_parser.token_type; multi_parser.last_text = multi_parser.token_text; } - return multi_parser.output.join(''); + return multi_parser.output.join(""); } - return function(data) { - var dataHolder = ['__dataHolder_', [Math.random(), Math.random(), Math.random(), Math.random()].join('_').replace(/[^0-9]/g, '_'), '_'].join('_'); + return function (data) { + var dataHolder = ["__dataHolder_", [Math.random(), Math.random(), Math.random(), Math.random()].join("_").replace(/[^0-9]/g, "_"), "_"].join("_"); var dataHolders = {}; var index = 0; - data = data.replace(/(\")(data:[^\"]*)(\")/g, - function($0, $1, $2, $3) { + data = data.replace(/(\")(data:[^\"]*)(\")/g, function ($0, $1, $2, $3) { var name = dataHolder + index++; dataHolders[name] = $2; return $1 + name + $3; - }) - data = style_html(data, 2, ' ', 0x10000000); - data = data.replace(new RegExp(dataHolder + '[0-9]+', 'g'), - function($0) { + }); + data = style_html(data, 2, " ", 0x10000000); + data = data.replace(new RegExp(dataHolder + "[0-9]+", "g"), function ($0) { return dataHolders[$0]; }); return data; - } + }; })(); -export default format +export default format; diff --git a/packages/ui/certd-client/src/components/icon-select.vue b/packages/ui/certd-client/src/components/icon-select.vue index 985a31fae..52e748b54 100644 --- a/packages/ui/certd-client/src/components/icon-select.vue +++ b/packages/ui/certd-client/src/components/icon-select.vue @@ -1,6 +1,6 @@