@koishi-ce/client 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +56 -0
  2. package/app/home/home.vue +4 -0
  3. package/app/home/index.ts +4 -0
  4. package/app/home/welcome.en-US.yml +4 -0
  5. package/app/home/welcome.vue +16 -6
  6. package/app/home/welcome.zh-CN.yml +4 -0
  7. package/app/index.scss +4 -0
  8. package/app/index.ts +12 -2
  9. package/app/layout/header.vue +16 -4
  10. package/app/layout/index.ts +4 -0
  11. package/app/layout/layout.vue +8 -1
  12. package/app/layout/menu-item.vue +7 -1
  13. package/app/settings/index.ts +4 -0
  14. package/app/settings/settings.vue +10 -4
  15. package/app/settings/theme.vue +8 -1
  16. package/app/shims.d.ts +3 -0
  17. package/app/status/index.ts +4 -0
  18. package/app/status/loading.vue +8 -1
  19. package/app/status/status.vue +4 -0
  20. package/app/styles/element.scss +4 -0
  21. package/app/styles/hc.scss +4 -0
  22. package/app/styles/index.scss +4 -0
  23. package/app/styles/index.ts +4 -0
  24. package/app/styles/layout.scss +4 -0
  25. package/app/theme/activity/button.vue +8 -1
  26. package/app/theme/activity/index.vue +16 -4
  27. package/app/theme/activity/item.vue +22 -4
  28. package/app/theme/activity/separator.vue +48 -12
  29. package/app/theme/activity/utils.ts +4 -0
  30. package/app/theme/blank.vue +4 -0
  31. package/app/theme/index.ts +9 -1
  32. package/app/theme/index.vue +7 -1
  33. package/app/theme/menu/index.vue +4 -0
  34. package/app/theme/menu/menu-item.vue +14 -4
  35. package/app/theme/menu/menu.vue +13 -4
  36. package/app/theme/status.vue +4 -0
  37. package/client/components/chat/image.vue +4 -0
  38. package/client/components/chat/overlay.vue +34 -8
  39. package/client/components/chat/utils.ts +4 -0
  40. package/client/components/common/index.ts +4 -0
  41. package/client/components/common/k-button.vue +4 -0
  42. package/client/components/common/k-hint.vue +7 -1
  43. package/client/components/common/k-tab.vue +4 -0
  44. package/client/components/dynamic.vue +6 -1
  45. package/client/components/icons/activity/default.vue +4 -0
  46. package/client/components/icons/activity/ellipsis.vue +4 -0
  47. package/client/components/icons/activity/home.vue +4 -0
  48. package/client/components/icons/activity/moon.vue +4 -0
  49. package/client/components/icons/activity/settings.vue +4 -0
  50. package/client/components/icons/activity/sun.vue +4 -0
  51. package/client/components/icons/index.ts +11 -2
  52. package/client/components/icons/style.scss +4 -0
  53. package/client/components/icons/svg/arrow-left.vue +4 -0
  54. package/client/components/icons/svg/arrow-right.vue +4 -0
  55. package/client/components/icons/svg/box-open.vue +4 -0
  56. package/client/components/icons/svg/check-full.vue +4 -0
  57. package/client/components/icons/svg/chevron-down.vue +4 -0
  58. package/client/components/icons/svg/chevron-left.vue +4 -0
  59. package/client/components/icons/svg/chevron-right.vue +4 -0
  60. package/client/components/icons/svg/chevron-up.vue +4 -0
  61. package/client/components/icons/svg/clipboard-list.vue +4 -0
  62. package/client/components/icons/svg/edit.vue +4 -0
  63. package/client/components/icons/svg/exclamation-full.vue +4 -0
  64. package/client/components/icons/svg/expand.vue +4 -0
  65. package/client/components/icons/svg/file-archive.vue +4 -0
  66. package/client/components/icons/svg/filter.vue +4 -0
  67. package/client/components/icons/svg/github.vue +4 -0
  68. package/client/components/icons/svg/gitlab.vue +4 -0
  69. package/client/components/icons/svg/info-full.vue +4 -0
  70. package/client/components/icons/svg/koishi.vue +4 -0
  71. package/client/components/icons/svg/link.vue +4 -0
  72. package/client/components/icons/svg/paper-plane.vue +4 -0
  73. package/client/components/icons/svg/question-empty.vue +4 -0
  74. package/client/components/icons/svg/redo.vue +4 -0
  75. package/client/components/icons/svg/search-minus.vue +4 -0
  76. package/client/components/icons/svg/search-plus.vue +4 -0
  77. package/client/components/icons/svg/search.vue +4 -0
  78. package/client/components/icons/svg/star-empty.vue +4 -0
  79. package/client/components/icons/svg/star-full.vue +4 -0
  80. package/client/components/icons/svg/start.vue +4 -0
  81. package/client/components/icons/svg/tag.vue +4 -0
  82. package/client/components/icons/svg/times-full.vue +4 -0
  83. package/client/components/icons/svg/tools.vue +4 -0
  84. package/client/components/icons/svg/undo.vue +4 -0
  85. package/client/components/icons/svg/user.vue +4 -0
  86. package/client/components/index.ts +12 -2
  87. package/client/components/layout/card.vue +4 -0
  88. package/client/components/layout/content.vue +4 -0
  89. package/client/components/layout/empty.vue +4 -0
  90. package/client/components/layout/index.ts +4 -0
  91. package/client/components/layout/tab-group.vue +4 -0
  92. package/client/components/layout/tab-item.vue +4 -0
  93. package/client/components/link.ts +9 -2
  94. package/client/components/perms.vue +26 -5
  95. package/client/components/slot.ts +23 -4
  96. package/client/context.ts +16 -4
  97. package/client/data.ts +61 -26
  98. package/client/index.ts +6 -1
  99. package/client/plugins/action.ts +50 -13
  100. package/client/plugins/i18n.ts +4 -0
  101. package/client/plugins/loader.ts +71 -45
  102. package/client/plugins/router.ts +38 -11
  103. package/client/plugins/setting.ts +49 -12
  104. package/client/plugins/theme.ts +25 -6
  105. package/client/shims.d.ts +3 -0
  106. package/client/utils.ts +11 -2
  107. package/global.d.ts +4 -0
  108. package/lib/bin.mjs +7 -3
  109. package/lib/{client-CaTn_gVG.mjs → client-C97iYPCr.mjs} +1 -1
  110. package/lib/index.mjs +1 -1
  111. package/lib/{src-lTfcJ1xA.mjs → src-BOakssV3.mjs} +8 -2
  112. package/package.json +6 -2
  113. package/src/bin.ts +13 -3
  114. package/src/index.ts +72 -14
  115. package/src/yaml.ts +3 -0
@@ -1,10 +1,18 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+ // Copyright (c) 2026-present Koishi-CE contributors.
4
+
1
5
  /**
2
6
  * 主题插件(控制台外壳):
3
7
  * - 向 "root" 插槽注册应用根组件(活动栏 + 路由视图 + 状态栏 + 全局菜单层);
4
8
  * - 注册活动栏右键菜单 "theme.activity" 及其动作(重置活动栏自定义配置)。
5
9
  */
6
10
 
7
- import { type Context, router, useConfig } from "@koishi-ce/client";
11
+ import {
12
+ type Context,
13
+ router,
14
+ useConfig,
15
+ } from "@koishi-ce/client";
8
16
  import App from "./index.vue";
9
17
 
10
18
  export default function (ctx: Context) {
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!--
2
6
  控制台根组件:活动栏 + 路由页面(keep-alive 缓存) + 状态栏 + 全局菜单层。
3
7
  路由声明了所需 store 字段(route.meta.activity.fields)时,
@@ -29,6 +33,8 @@ const route = useRoute();
29
33
  // 否则要求 meta.activity.fields 中每个 store 字段都有数据
30
34
  const loaded = computed(() => {
31
35
  if (!route.meta.activity?.fields) return true;
32
- return route.meta.activity.fields.every((key) => store[key]);
36
+ return route.meta.activity.fields.every(
37
+ (key) => store[key],
38
+ );
33
39
  });
34
40
  </script>
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!--
2
6
  全局菜单层:渲染当前处于活动状态的所有上下文菜单(activeMenus)。
3
7
  任意 click / contextmenu 事件都视为点击了菜单外区域,关闭全部活动菜单。
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!--
2
6
  上下文菜单的单个菜单项:点击时调用对应 action。
3
7
  id 支持两种特殊写法:"!" 前缀会被去除(兼容旧的否定式 id),
@@ -17,7 +21,11 @@
17
21
  </template>
18
22
 
19
23
  <script lang="ts" setup>
20
- import { type MaybeGetter, type MenuItem, useContext } from "@koishi-ce/client";
24
+ import {
25
+ type MaybeGetter,
26
+ type MenuItem,
27
+ useContext,
28
+ } from "@koishi-ce/client";
21
29
  import { computed } from "vue";
22
30
 
23
31
  const props = defineProps<MenuItem & { prefix: string }>();
@@ -51,8 +59,10 @@ const icon = computed(() => toValue(props.icon));
51
59
  function toValue<T>(getter: MaybeGetter<T>): T {
52
60
  if (typeof getter !== "function") return getter;
53
61
  // 收窄到 MaybeGetter 的函数分支(以作用域为参的 getter)
54
- return (getter as (current: ReturnType<typeof ctx.$action.createScope>) => T)(
55
- ctx.$action.createScope(),
56
- );
62
+ return (
63
+ getter as (
64
+ current: ReturnType<typeof ctx.$action.createScope>,
65
+ ) => T
66
+ )(ctx.$action.createScope());
57
67
  }
58
68
  </script>
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!--
2
6
  单个浮动上下文菜单(页面模板中 <k-menu> 的内置实现):
3
7
  依据触发点的锚点矩形(props.relative)与自身实际尺寸,
@@ -13,7 +17,10 @@
13
17
  </template>
14
18
 
15
19
  <script lang="ts" setup>
16
- import { type ActiveMenu, useContext } from "@koishi-ce/client";
20
+ import {
21
+ type ActiveMenu,
22
+ useContext,
23
+ } from "@koishi-ce/client";
17
24
  import { ref } from "vue";
18
25
  import MenuItem from "./menu-item.vue";
19
26
 
@@ -27,9 +34,11 @@ const el = ref<HTMLElement>();
27
34
  // 结合菜单自身渲染后的实际宽高计算定位;尚未挂载时先隐藏避免闪烁
28
35
  const getStyle = () => {
29
36
  if (!el.value) return { visibility: "hidden" };
30
- const { height, width } = el.value.getBoundingClientRect();
31
- const style: Partial<Record<"top" | "right" | "bottom" | "left", string>> =
32
- {};
37
+ const { height, width } =
38
+ el.value.getBoundingClientRect();
39
+ const style: Partial<
40
+ Record<"top" | "right" | "bottom" | "left", string>
41
+ > = {};
33
42
  if (props.relative.right + width > window.innerWidth) {
34
43
  style.right = `${window.innerWidth - props.relative.left}px`;
35
44
  } else {
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!--
2
6
  底部状态栏容器:左右两组插槽(status-left / status-right),
3
7
  移动端(<=768px)整条隐藏。
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!--
2
6
  chat-image:聊天消息中的图片。
3
7
  普通点击打开内置大图查看器(overlay.vue,经 global 插槽全局挂载);
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!--
2
6
  overlay.vue:全屏图片查看器(经 router 的 global 插槽挂载)。
3
7
  打开时把图片从原位"飞入"屏幕中心(appear 阶段从原坐标过渡到居中),
@@ -38,7 +42,13 @@
38
42
  </template>
39
43
 
40
44
  <script lang="ts" setup>
41
- import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
45
+ import {
46
+ computed,
47
+ onBeforeUnmount,
48
+ onMounted,
49
+ ref,
50
+ watch,
51
+ } from "vue";
42
52
  import { shared } from "./utils";
43
53
 
44
54
  // 用户手动调整的缩放与旋转量(复原即回到 1 / 0)
@@ -54,7 +64,9 @@ const transform = computed(() => {
54
64
  const siblings = computed(() => {
55
65
  if (!shared.overlayImage) return;
56
66
  const elements = Array.from(
57
- document.querySelectorAll<HTMLImageElement>(".chat-image"),
67
+ document.querySelectorAll<HTMLImageElement>(
68
+ ".chat-image",
69
+ ),
58
70
  );
59
71
  const index = elements.indexOf(shared.overlayImage);
60
72
  return {
@@ -65,10 +77,15 @@ const siblings = computed(() => {
65
77
 
66
78
  // 初始(适配屏幕)缩放比:按视口剩余空间把图片等比缩小,不放大
67
79
  const defaultScale = computed(() => {
68
- const { naturalHeight, naturalWidth } = shared.overlayImage;
80
+ const { naturalHeight, naturalWidth } =
81
+ shared.overlayImage;
69
82
  const maxHeight = innerHeight - paddingVertical * 2;
70
83
  const maxWidth = innerWidth - paddingHorizontal * 2;
71
- return Math.min(1, maxHeight / naturalHeight, maxWidth / naturalWidth);
84
+ return Math.min(
85
+ 1,
86
+ maxHeight / naturalHeight,
87
+ maxWidth / naturalWidth,
88
+ );
72
89
  });
73
90
 
74
91
  // 切换/关闭查看器时重置手动缩放与旋转;
@@ -92,7 +109,10 @@ function setImage(el: HTMLImageElement) {
92
109
  }
93
110
 
94
111
  /** 把大图元素摆到原图片所在的位置与尺寸(关闭时的"飞回"动画终点) */
95
- function moveToOrigin(el: HTMLImageElement, origin = shared.overlayImage) {
112
+ function moveToOrigin(
113
+ el: HTMLImageElement,
114
+ origin = shared.overlayImage,
115
+ ) {
96
116
  const { height, width } = origin;
97
117
  const { left, top } = origin.getBoundingClientRect();
98
118
  el.style.width = `${width}px`;
@@ -108,7 +128,8 @@ const paddingHorizontal = 0;
108
128
 
109
129
  /** 把图片按适配缩放比居中摆放到视口中央 */
110
130
  function moveToCenter(el: HTMLImageElement) {
111
- const { naturalHeight, naturalWidth } = shared.overlayImage;
131
+ const { naturalHeight, naturalWidth } =
132
+ shared.overlayImage;
112
133
  const scale = defaultScale.value;
113
134
  const width = naturalWidth * scale;
114
135
  const height = naturalHeight * scale;
@@ -132,13 +153,18 @@ function onKeyDown(ev: KeyboardEvent) {
132
153
  ev.preventDefault();
133
154
  if (ev.key === "ArrowUp" || ev.key === "ArrowLeft") {
134
155
  setImage(siblings.value.prev);
135
- } else if (ev.key === "ArrowDown" || ev.key === "ArrowRight") {
156
+ } else if (
157
+ ev.key === "ArrowDown" ||
158
+ ev.key === "ArrowRight"
159
+ ) {
136
160
  setImage(siblings.value.next);
137
161
  } else if (ev.key === "Escape") {
138
162
  setImage(null);
139
163
  } else if (ev.key === "Enter") {
140
164
  // 关闭并把页面滚动到原图所在位置,便于继续浏览消息
141
- shared.overlayImage.offsetParent.scrollIntoView({ behavior: "smooth" });
165
+ shared.overlayImage.offsetParent.scrollIntoView({
166
+ behavior: "smooth",
167
+ });
142
168
  setImage(null);
143
169
  }
144
170
  }
@@ -1,3 +1,7 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+ // Copyright (c) 2026-present Koishi-CE contributors.
4
+
1
5
  import { reactive } from "vue";
2
6
 
3
7
  /** chat 子模块的跨组件共享状态:当前在大图查看器(overlay)中展示的图片 */
@@ -1,3 +1,7 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+ // Copyright (c) 2026-present Koishi-CE contributors.
4
+
1
5
  import type { App } from "vue";
2
6
  import Button from "./k-button.vue";
3
7
  import Hint from "./k-hint.vue";
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!--
2
6
  k-button:通用按钮组件。
3
7
  通过 type(primary / warning / success / error)着色,支持 solid(实心)、
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!--
2
6
  k-hint:带悬浮提示(tooltip)的问号图标。
3
7
  默认是纯展示的提示图标;当传入 v-model(modelValue 有值)时变为
@@ -28,7 +32,9 @@ const props = defineProps({
28
32
  const emit = defineEmits(["update:modelValue"]);
29
33
 
30
34
  // modelValue 被显式传入时才呈现手型光标并响应点击(开关语义)
31
- const pointer = computed(() => props.modelValue !== undefined);
35
+ const pointer = computed(
36
+ () => props.modelValue !== undefined,
37
+ );
32
38
 
33
39
  function onClick() {
34
40
  if (!pointer.value) return;
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!--
2
6
  k-tab:水平选项卡(文字式切换器)。
3
7
  data 为 "键 → 文案" 映射,点击某项时通过 v-model 更新选中键;
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!--
2
6
  dynamic.vue:动态 schema 表单控件(any + dynamic 角色)。
3
7
  适用于"具体结构由服务端决定"的配置项:本地 schema 只带 meta.extra.name,
@@ -54,7 +58,8 @@ defineEmits(["update:modelValue"]);
54
58
  // 按本地 schema 标注的名称,从服务端下发的 schema 仓库中取出完整定义;
55
59
  // 元信息做一层合并,保留本地的 meta 覆盖权
56
60
  const inner = computed(() => {
57
- const hydrated = store.schema?.[props.schema?.meta.extra?.name];
61
+ const hydrated =
62
+ store.schema?.[props.schema?.meta.extra?.name];
58
63
  return hydrated && new Schema(hydrated);
59
64
  });
60
65
  </script>
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- activity 侧栏页面默认图标(注册名 "activity:default"):仪表盘样式 -->
2
6
  <template>
3
7
  <svg class="k-icon" viewBox="0 0 448 512" xmlns="http://www.w3.org/2000/svg">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- activity 侧栏"更多"图标(注册名 "activity:ellipsis"):三点省略号 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- activity 侧栏主页图标(注册名 "activity:home"):田字格仪表盘 -->
2
6
  <template>
3
7
  <svg class="k-icon" viewBox="-64 0 1152 1024" xmlns="http://www.w3.org/2000/svg">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- activity 侧栏夜间模式图标(注册名 "activity:moon"):弯月 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- activity 侧栏设置页图标(注册名 "activity:settings"):三组滑杆 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- activity 侧栏日间模式图标(注册名 "activity:sun"):太阳 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+ // Copyright (c) 2026-present Koishi-CE contributors.
4
+
1
5
  /**
2
6
  * 图标中心:所有内置图标的注册表与 <k-icon> 组件。
3
7
  *
@@ -112,7 +116,10 @@ register("undo", Undo);
112
116
  register("user", User);
113
117
 
114
118
  /** 向注册表登记一个图标(markRaw 避免组件被响应式代理) */
115
- export function register(name: string, component: Component) {
119
+ export function register(
120
+ name: string,
121
+ component: Component,
122
+ ) {
116
123
  registry[name] = markRaw(component);
117
124
  }
118
125
 
@@ -125,7 +132,9 @@ export function install(app: App) {
125
132
  name: String,
126
133
  },
127
134
  render(props: { name?: string }) {
128
- const component = props.name ? registry[props.name] : undefined;
135
+ const component = props.name
136
+ ? registry[props.name]
137
+ : undefined;
129
138
  return component && h(component);
130
139
  },
131
140
  }),
@@ -1,3 +1,7 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+ // Copyright (c) 2026-present Koishi-CE contributors.
4
+
1
5
  .k-icon {
2
6
  height: 1em;
3
7
  }
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 左箭头图标(注册名 "arrow-left"),用于返回上一步 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 右箭头图标(注册名 "arrow-right"),用于前进到下一步 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 打开的收纳盒图标(注册名 "box-open"),用于插件市场类页面 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 实心圆形对勾图标(注册名 "check-full"),用于成功/已选状态 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 向下的尖角箭头图标(注册名 "chevron-down"),用于展开/下拉 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 向左的尖角箭头图标(注册名 "chevron-left"),用于折叠侧栏/上一张 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 向右的尖角箭头图标(注册名 "chevron-right"),用于展开侧栏/下一张 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 向上的尖角箭头图标(注册名 "chevron-up"),用于收起/上拉 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 带列表的写字板图标(注册名 "clipboard-list"),用于日志/列表类页面 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 铅笔编辑图标(注册名 "edit"),用于编辑入口 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 实心圆形感叹号图标(注册名 "exclamation-full"),用于错误/警告状态 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 四角外扩图标(注册名 "expand"),用于复原/全屏切换 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 压缩包文件图标(注册名 "file-archive"),用于导出/备份文件 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 漏斗筛选图标(注册名 "filter"),用于列表过滤开关 -->
2
6
  <template>
3
7
  <svg class="k-icon k-icon-filter" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- GitHub 品牌图标(注册名 "github"),用于源码/Issue 链接 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- GitLab 品牌图标(注册名 "gitlab"),用于 GitLab 相关链接 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 实心圆形信息图标(注册名 "info-full"),用于提示/说明状态 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- Koishi 官方徽标图标(注册名 "koishi"),用于品牌展示与空状态占位 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 双环链条图标(注册名 "link"),用于链接/关联 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 纸飞机图标(注册名 "paper-plane"),用于发送消息/指令 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 空心圆形问号图标(注册名 "question-empty"),k-hint 提示图标的默认图标 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 顺时针旋转箭头图标(注册名 "redo"),用于向右旋转/重做 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 带减号的放大镜图标(注册名 "search-minus"),用于缩小视图 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 带加号的放大镜图标(注册名 "search-plus"),用于放大视图 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 放大镜图标(注册名 "search"),用于搜索入口 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -1,3 +1,7 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
+ <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
+
1
5
  <!-- 空心五角星图标(注册名 "star-empty"),用于未收藏/未订阅状态 -->
2
6
  <template>
3
7
  <svg class="k-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">