diff --git a/plugins/frontend/console/client/components/form/schema.vue b/plugins/frontend/console/client/components/form/schema.vue
index 752e6976b5..5d07047ce0 100644
--- a/plugins/frontend/console/client/components/form/schema.vue
+++ b/plugins/frontend/console/client/components/form/schema.vue
@@ -15,12 +15,11 @@
:type="schema.type === 'number' ? 'number' : schema.meta.role === 'secret' && !showPass ? 'password' : 'text'">
-
+
-
-
+
@@ -39,7 +38,7 @@
@@ -191,7 +190,7 @@ watch(config, (value) => {
color: var(--fg3);
opacity: 0.4;
transition: 0.3s ease;
- font-size: 0.875rem;
+ height: 0.875rem;
margin-right: 0.25rem;
&:hover {
diff --git a/plugins/frontend/console/client/components/icons/index.ts b/plugins/frontend/console/client/components/icons/index.ts
deleted file mode 100644
index ffcaca09d1..0000000000
--- a/plugins/frontend/console/client/components/icons/index.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { App } from 'vue'
-import ExternalLink from './external-link.vue'
-import EyeSlash from './eye-slash.vue'
-import Eye from './eye.vue'
-
-export default function (app: App) {
- app.component('k-icon-external-link', ExternalLink)
- app.component('k-icon-eye-slash', EyeSlash)
- app.component('k-icon-eye', Eye)
-}
diff --git a/plugins/frontend/console/client/components/notice/comment.vue b/plugins/frontend/console/client/components/notice/comment.vue
index d3f8a80bb6..5fb7eed635 100644
--- a/plugins/frontend/console/client/components/notice/comment.vue
+++ b/plugins/frontend/console/client/components/notice/comment.vue
@@ -1,7 +1,9 @@
@@ -17,10 +19,10 @@ const props = defineProps({
const icon = computed(() => {
switch (props.type) {
- case 'success': return 'fas fa-check-circle'
- case 'error': return 'fas fa-times-circle'
- case 'warning': return 'fas fa-exclamation-circle'
- default: return 'fas fa-info-circle'
+ case 'success': return 'check-circle'
+ case 'error': return 'times-circle'
+ case 'warning': return 'exclamation-circle'
+ default: return 'info-circle'
}
})
@@ -31,7 +33,7 @@ const icon = computed(() => {
@mixin apply-color($name) {
&.#{$name} {
border-left-color: var(--#{$name});
- i {
+ .k-icon {
color: var(--#{$name});
}
}
@@ -50,7 +52,7 @@ const icon = computed(() => {
margin: 1rem 0;
}
- > i {
+ > .k-icon {
position: absolute;
top: 20px;
left: -12px;
diff --git a/plugins/frontend/console/client/main.ts b/plugins/frontend/console/client/main.ts
index 77511cb660..335245daa0 100644
--- a/plugins/frontend/console/client/main.ts
+++ b/plugins/frontend/console/client/main.ts
@@ -3,7 +3,7 @@
import { createApp } from 'vue'
import { connect, router, config } from './client'
-import icons from './components/icons'
+import icons from '@koishijs/icons'
import form from './components/form'
import Badge from './components/notice/badge.vue'
diff --git a/plugins/frontend/icons/global.d.ts b/plugins/frontend/icons/global.d.ts
new file mode 100644
index 0000000000..12862afa2c
--- /dev/null
+++ b/plugins/frontend/icons/global.d.ts
@@ -0,0 +1,8 @@
+///
+
+declare module '*.vue' {
+ import { Component } from 'vue'
+
+ const component: Component
+ export default component
+}
diff --git a/plugins/frontend/icons/package.json b/plugins/frontend/icons/package.json
new file mode 100644
index 0000000000..c1dbcd90fc
--- /dev/null
+++ b/plugins/frontend/icons/package.json
@@ -0,0 +1,23 @@
+{
+ "name": "@koishijs/icons",
+ "description": "Icon components for Koishi",
+ "version": "1.0.0",
+ "private": true,
+ "main": "src/index.ts",
+ "files": [
+ "src"
+ ],
+ "author": "Shigma ",
+ "license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/koishijs/koishi.git"
+ },
+ "bugs": {
+ "url": "https://github.com/koishijs/koishi/issues"
+ },
+ "homepage": "https://koishi.js.org",
+ "peerDependencies": {
+ "vue": "^3.2.21"
+ }
+}
diff --git a/plugins/frontend/icons/src/index.ts b/plugins/frontend/icons/src/index.ts
new file mode 100644
index 0000000000..687e22b6ad
--- /dev/null
+++ b/plugins/frontend/icons/src/index.ts
@@ -0,0 +1,56 @@
+import { App, camelize, capitalize, defineComponent, h } from 'vue'
+import Book from './svg/book.vue'
+import CheckCircle from './svg/check-circle.vue'
+import ClipboardList from './svg/clipboard-list.vue'
+import ExclamationCircle from './svg/exclamation-circle.vue'
+import External from './svg/external.vue'
+import EyeSlash from './svg/eye-slash.vue'
+import Eye from './svg/eye.vue'
+import HeartEmpty from './svg/heart-empty.vue'
+import HeartFull from './svg/heart-full.vue'
+import InfoCircle from './svg/info-circle.vue'
+import LayerGroup from './svg/layer-group.vue'
+import Link from './svg/link.vue'
+import Robot from './svg/robot.vue'
+import Search from './svg/search.vue'
+import StarEmpty from './svg/star-empty.vue'
+import StarFull from './svg/star-full.vue'
+import TimesCircle from './svg/times-circle.vue'
+import Tools from './svg/tools.vue'
+
+import './style.scss'
+
+export {
+ Book,
+ CheckCircle,
+ ClipboardList,
+ ExclamationCircle,
+ External,
+ EyeSlash,
+ Eye,
+ HeartEmpty,
+ HeartFull,
+ InfoCircle,
+ LayerGroup,
+ Link,
+ Robot,
+ Search,
+ StarEmpty,
+ StarFull,
+ TimesCircle,
+ Tools,
+}
+
+import * as icons from '.'
+
+export default function (app: App) {
+ app.component('k-icon', defineComponent({
+ props: {
+ name: String,
+ },
+ render(props) {
+ const name = capitalize(camelize(props.name))
+ return h(icons[name])
+ },
+ }))
+}
diff --git a/plugins/frontend/icons/src/style.scss b/plugins/frontend/icons/src/style.scss
new file mode 100644
index 0000000000..2aea260fbd
--- /dev/null
+++ b/plugins/frontend/icons/src/style.scss
@@ -0,0 +1,3 @@
+.k-icon {
+ height: 1rem;
+}
diff --git a/plugins/frontend/icons/src/svg/book.vue b/plugins/frontend/icons/src/svg/book.vue
new file mode 100644
index 0000000000..3cfe7a0cc4
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/book.vue
@@ -0,0 +1,5 @@
+
+
+
diff --git a/plugins/frontend/icons/src/svg/check-circle.vue b/plugins/frontend/icons/src/svg/check-circle.vue
new file mode 100644
index 0000000000..24b00ffaf0
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/check-circle.vue
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/frontend/icons/src/svg/clipboard-list.vue b/plugins/frontend/icons/src/svg/clipboard-list.vue
new file mode 100644
index 0000000000..3ca3581061
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/clipboard-list.vue
@@ -0,0 +1,5 @@
+
+
+
diff --git a/plugins/frontend/icons/src/svg/exclamation-circle.vue b/plugins/frontend/icons/src/svg/exclamation-circle.vue
new file mode 100644
index 0000000000..9d014f03b2
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/exclamation-circle.vue
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/frontend/console/client/components/icons/external-link.vue b/plugins/frontend/icons/src/svg/external.vue
similarity index 100%
rename from plugins/frontend/console/client/components/icons/external-link.vue
rename to plugins/frontend/icons/src/svg/external.vue
diff --git a/plugins/frontend/console/client/components/icons/eye-slash.vue b/plugins/frontend/icons/src/svg/eye-slash.vue
similarity index 100%
rename from plugins/frontend/console/client/components/icons/eye-slash.vue
rename to plugins/frontend/icons/src/svg/eye-slash.vue
diff --git a/plugins/frontend/console/client/components/icons/eye.vue b/plugins/frontend/icons/src/svg/eye.vue
similarity index 100%
rename from plugins/frontend/console/client/components/icons/eye.vue
rename to plugins/frontend/icons/src/svg/eye.vue
diff --git a/plugins/frontend/icons/src/svg/heart-empty.vue b/plugins/frontend/icons/src/svg/heart-empty.vue
new file mode 100644
index 0000000000..82555ff7d1
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/heart-empty.vue
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/frontend/icons/src/svg/heart-full.vue b/plugins/frontend/icons/src/svg/heart-full.vue
new file mode 100644
index 0000000000..f5ab4ee3f6
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/heart-full.vue
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/frontend/icons/src/svg/info-circle.vue b/plugins/frontend/icons/src/svg/info-circle.vue
new file mode 100644
index 0000000000..787be728bc
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/info-circle.vue
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/frontend/icons/src/svg/layer-group.vue b/plugins/frontend/icons/src/svg/layer-group.vue
new file mode 100644
index 0000000000..0ce7bbff9c
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/layer-group.vue
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/frontend/icons/src/svg/link.vue b/plugins/frontend/icons/src/svg/link.vue
new file mode 100644
index 0000000000..881c1aa978
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/link.vue
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/frontend/icons/src/svg/robot.vue b/plugins/frontend/icons/src/svg/robot.vue
new file mode 100644
index 0000000000..289bd1224e
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/robot.vue
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/frontend/icons/src/svg/search.vue b/plugins/frontend/icons/src/svg/search.vue
new file mode 100644
index 0000000000..1302659667
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/search.vue
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/frontend/icons/src/svg/star-empty.vue b/plugins/frontend/icons/src/svg/star-empty.vue
new file mode 100644
index 0000000000..6510af4961
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/star-empty.vue
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/frontend/icons/src/svg/star-full.vue b/plugins/frontend/icons/src/svg/star-full.vue
new file mode 100644
index 0000000000..e108a70ae1
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/star-full.vue
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/frontend/icons/src/svg/times-circle.vue b/plugins/frontend/icons/src/svg/times-circle.vue
new file mode 100644
index 0000000000..69c3366e39
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/times-circle.vue
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/frontend/icons/src/svg/tools.vue b/plugins/frontend/icons/src/svg/tools.vue
new file mode 100644
index 0000000000..df0af14f8e
--- /dev/null
+++ b/plugins/frontend/icons/src/svg/tools.vue
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/frontend/icons/tsconfig.json b/plugins/frontend/icons/tsconfig.json
new file mode 100644
index 0000000000..8b4835b4ac
--- /dev/null
+++ b/plugins/frontend/icons/tsconfig.json
@@ -0,0 +1,16 @@
+{
+ "extends": "../../../tsconfig.base",
+ "compilerOptions": {
+ "rootDir": ".",
+ "noEmit": true,
+ "target": "es2020",
+ "module": "esnext",
+ "emitDeclarationOnly": false,
+ "types": [
+ "vite/client",
+ ],
+ },
+ "include": [
+ ".",
+ ],
+}
\ No newline at end of file
{{ title }}
++{{ title }}
+