@tnotesjs/core 0.1.14 → 0.1.15

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tnotesjs/core",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "TNotes 知识库核心框架 —— 基于 VitePress 的笔记管理系统",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.17.1",
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#67676c" d="M19.9 12.66a1 1 0 0 1 0-1.32l1.28-1.44a1 1 0 0 0 .12-1.17l-2-3.46a1 1 0 0 0-1.07-.48l-1.88.38a1 1 0 0 1-1.15-.66l-.61-1.83a1 1 0 0 0-.95-.68h-4a1 1 0 0 0-1 .68l-.56 1.83a1 1 0 0 1-1.15.66L5 4.79a1 1 0 0 0-1 .48L2 8.73a1 1 0 0 0 .1 1.17l1.27 1.44a1 1 0 0 1 0 1.32L2.1 14.1a1 1 0 0 0-.1 1.17l2 3.46a1 1 0 0 0 1.07.48l1.88-.38a1 1 0 0 1 1.15.66l.61 1.83a1 1 0 0 0 1 .68h4a1 1 0 0 0 .95-.68l.61-1.83a1 1 0 0 1 1.15-.66l1.88.38a1 1 0 0 0 1.07-.48l2-3.46a1 1 0 0 0-.12-1.17ZM18.41 14l.8.9l-1.28 2.22l-1.18-.24a3 3 0 0 0-3.45 2L12.92 20h-2.56L10 18.86a3 3 0 0 0-3.45-2l-1.18.24l-1.3-2.21l.8-.9a3 3 0 0 0 0-4l-.8-.9l1.28-2.2l1.18.24a3 3 0 0 0 3.45-2L10.36 4h2.56l.38 1.14a3 3 0 0 0 3.45 2l1.18-.24l1.28 2.22l-.8.9a3 3 0 0 0 0 3.98m-6.77-6a4 4 0 1 0 4 4a4 4 0 0 0-4-4m0 6a2 2 0 1 1 2-2a2 2 0 0 1-2 2"/></svg>
@@ -28,6 +28,7 @@ export { default as icon__prev } from './icon__prev.svg'
28
28
  export { default as icon__restore } from './icon__restore.svg'
29
29
  export { default as icon__rotate } from './icon__rotate.svg'
30
30
  export { default as icon__search } from './icon__search.svg'
31
+ export { default as icon__setting } from './icon__setting.svg'
31
32
  export { default as icon__sidebar_collapsed } from './icon__sidebar_collapsed.svg'
32
33
  export { default as icon__sidebar_opened } from './icon__sidebar_opened.svg'
33
34
  export { default as icon__totop } from './icon__totop.svg'
@@ -156,7 +156,6 @@
156
156
  @toggle-expand="toggleSidebarSections"
157
157
  @toggle-note-id="toggleNoteId"
158
158
  @focus-current="focusCurrentNote"
159
- @open-settings="openSettings"
160
159
  />
161
160
  </template>
162
161
 
@@ -175,7 +174,10 @@
175
174
  <!-- <template #nav-bar-title-before>nav-bar-title-before</template> -->
176
175
  <!-- <template #nav-bar-title-after>nav-bar-title-after</template> -->
177
176
  <!-- <template #nav-bar-content-before>nav-bar-content-before</template> -->
178
- <!-- <template #nav-bar-content-after>nav-bar-content-after</template> -->
177
+ <!-- 设置入口:固定在 VPNav 右侧(social-links / appearance 之后,extra 之前) -->
178
+ <template #nav-bar-content-after>
179
+ <NavBarSettingsTrigger />
180
+ </template>
179
181
 
180
182
  <!-- !NOTE 不清楚下面的插槽所对应的位置 -->
181
183
  <!-- <template #nav-screen-content-before>nav-screen-content-before</template> -->
@@ -218,10 +220,10 @@ import DocBeforeControls from "./DocBeforeControls.vue";
218
220
  import DocFooter from "./DocFooter.vue";
219
221
  import { data as readmeData } from "./homeReadme.data.ts";
220
222
  import ImagePreview from "./ImagePreview.vue";
223
+ import NavBarSettingsTrigger from "./NavBarSettingsTrigger.vue";
221
224
  import NoteStatus from "./NoteStatus.vue";
222
225
  import SidebarNavBefore from "./SidebarNavBefore.vue";
223
226
  import Swiper from "./Swiper.vue";
224
- import { useSettingsDialog } from "../Settings/composables/useSettingsDialog";
225
227
  import SettingsDialog from "../Settings/SettingsDialog.vue";
226
228
 
227
229
  const { Layout } = DefaultTheme;
@@ -235,9 +237,6 @@ useCodeBlockFullscreen();
235
237
  // 全局重命名遮罩状态(由 useRenameRedirect 控制 show/hide)
236
238
  const { state: renameOverlayState } = useRenameOverlay();
237
239
 
238
- // 全局设置 Dialog 控制
239
- const { open: openSettings } = useSettingsDialog();
240
-
241
240
  // 自定义侧边栏引用
242
241
  const customSidebarRef = ref(null);
243
242
  const showNoteId = ref(false);
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <button
3
+ type="button"
4
+ class="tnotes-nav-settings-trigger"
5
+ title="打开设置"
6
+ aria-label="打开设置"
7
+ @click="open"
8
+ >
9
+ <img
10
+ :src="icon__setting"
11
+ class="tnotes-nav-settings-icon"
12
+ alt=""
13
+ aria-hidden="true"
14
+ />
15
+ </button>
16
+ </template>
17
+
18
+ <script setup lang="ts">
19
+ import { icon__setting } from '../../assets/icons'
20
+ import { useSettingsDialog } from '../Settings/composables/useSettingsDialog'
21
+
22
+ const { open } = useSettingsDialog()
23
+ </script>
24
+
25
+ <style scoped>
26
+ .tnotes-nav-settings-trigger {
27
+ display: inline-flex;
28
+ align-items: center;
29
+ justify-content: center;
30
+ width: 36px;
31
+ height: 36px;
32
+ margin: 0 4px;
33
+ padding: 0;
34
+ background: transparent;
35
+ border: none;
36
+ border-radius: 6px;
37
+ color: var(--vp-c-text-2);
38
+ cursor: pointer;
39
+ transition:
40
+ background 0.15s ease,
41
+ color 0.15s ease;
42
+ }
43
+
44
+ .tnotes-nav-settings-trigger:hover {
45
+ background: var(--vp-c-default-soft);
46
+ color: var(--vp-c-text-1);
47
+ }
48
+
49
+ .tnotes-nav-settings-icon {
50
+ width: 20px;
51
+ height: 20px;
52
+ display: block;
53
+ transition: transform 0.2s ease;
54
+ }
55
+
56
+ .tnotes-nav-settings-trigger:hover .tnotes-nav-settings-icon {
57
+ transform: scale(1.1);
58
+ }
59
+ </style>
@@ -1,45 +1,40 @@
1
1
  <template>
2
2
  <div class="sidebar-toggle-wrapper">
3
- <!-- 笔记编号显示切换按钮 -->
4
- <button
5
- class="toggle-btn"
6
- @click="$emit('toggle-note-id')"
7
- :title="showNoteId ? '隐藏笔记编号' : '显示笔记编号'"
8
- >
9
- <img
10
- :src="showNoteId ? icon__number_purple : icon__number_gray"
11
- class="toggle-icon"
12
- alt="切换笔记编号"
13
- />
14
- </button>
3
+ <div class="group group-left">
4
+ <!-- 展开/折叠全部按钮 -->
5
+ <button
6
+ class="toggle-btn"
7
+ @click="$emit('toggle-expand')"
8
+ :title="isExpanded ? '全部折叠' : '全部展开'"
9
+ >
10
+ <img :src="icon__fold" class="toggle-icon" alt="切换展开折叠" />
11
+ </button>
12
+ <span class="group-label">目录</span>
13
+ </div>
15
14
 
16
- <!-- 展开/折叠全部按钮 -->
17
- <button
18
- class="toggle-btn"
19
- @click="$emit('toggle-expand')"
20
- :title="isExpanded ? '全部折叠' : '全部展开'"
21
- >
22
- <img :src="icon__fold" class="toggle-icon" alt="切换展开折叠" />
23
- </button>
15
+ <div class="group group-right">
16
+ <!-- 聚焦到当前笔记按钮 -->
17
+ <button
18
+ class="toggle-btn"
19
+ @click="$emit('focus-current')"
20
+ title="聚焦到当前笔记(点击切换多个位置)"
21
+ >
22
+ <img :src="icon__focus" class="toggle-icon" alt="聚焦当前笔记" />
23
+ </button>
24
24
 
25
- <!-- 聚焦到当前笔记按钮 -->
26
- <button
27
- class="toggle-btn"
28
- @click="$emit('focus-current')"
29
- title="聚焦到当前笔记(点击切换多个位置)"
30
- >
31
- <img :src="icon__focus" class="toggle-icon" alt="聚焦当前笔记" />
32
- </button>
33
-
34
- <!-- 设置按钮 -->
35
- <button
36
- class="toggle-btn settings-btn"
37
- @click="$emit('open-settings')"
38
- title="打开设置"
39
- aria-label="打开设置"
40
- >
41
- <span class="settings-icon" aria-hidden="true">⚙️</span>
42
- </button>
25
+ <!-- 笔记编号显示切换按钮 -->
26
+ <button
27
+ class="toggle-btn"
28
+ @click="$emit('toggle-note-id')"
29
+ :title="showNoteId ? '隐藏笔记编号' : '显示笔记编号'"
30
+ >
31
+ <img
32
+ :src="showNoteId ? icon__number_purple : icon__number_gray"
33
+ class="toggle-icon"
34
+ alt="切换笔记编号"
35
+ />
36
+ </button>
37
+ </div>
43
38
  </div>
44
39
  </template>
45
40
 
@@ -55,7 +50,6 @@ defineEmits<{
55
50
  'toggle-expand': []
56
51
  'toggle-note-id': []
57
52
  'focus-current': []
58
- 'open-settings': []
59
53
  }>()
60
54
  </script>
61
55
 
@@ -63,13 +57,24 @@ defineEmits<{
63
57
  .sidebar-toggle-wrapper {
64
58
  display: flex;
65
59
  align-items: center;
66
- justify-content: center;
67
- gap: 8px;
68
- padding: 12px 0 16px 0;
60
+ justify-content: space-between;
61
+ padding: 12px 8px 16px;
69
62
  border-bottom: 1px solid var(--vp-c-divider);
70
63
  margin-bottom: 16px;
71
64
  }
72
65
 
66
+ .group {
67
+ display: flex;
68
+ align-items: center;
69
+ gap: 4px;
70
+ }
71
+
72
+ .group-label {
73
+ font-size: 13px;
74
+ color: var(--vp-c-text-2);
75
+ user-select: none;
76
+ }
77
+
73
78
  .toggle-btn {
74
79
  display: inline-flex;
75
80
  align-items: center;
@@ -100,15 +105,4 @@ defineEmits<{
100
105
  .toggle-btn:hover .toggle-icon {
101
106
  transform: scale(1.1);
102
107
  }
103
-
104
- .settings-icon {
105
- font-size: 18px;
106
- line-height: 1;
107
- display: inline-block;
108
- transition: transform 0.2s ease;
109
- }
110
-
111
- .toggle-btn:hover .settings-icon {
112
- transform: scale(1.1);
113
- }
114
108
  </style>