@tnotesjs/core 0.1.22 → 0.1.23
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/README.md +87 -87
- package/package.json +1 -1
- package/types/config.ts +60 -60
- package/types/index.ts +11 -11
- package/types/note.ts +33 -33
- package/vitepress/assets/icons/icon__check.svg +3 -3
- package/vitepress/assets/icons/icon__clipboard.svg +7 -7
- package/vitepress/assets/icons/icon__close.svg +1 -1
- package/vitepress/assets/icons/icon__collapse.svg +1 -1
- package/vitepress/assets/icons/icon__confirm.svg +1 -1
- package/vitepress/assets/icons/icon__copy.svg +4 -4
- package/vitepress/assets/icons/icon__focus.svg +1 -1
- package/vitepress/assets/icons/icon__fold.svg +3 -3
- package/vitepress/assets/icons/icon__folder.svg +1 -1
- package/vitepress/assets/icons/icon__fullscreen.svg +1 -1
- package/vitepress/assets/icons/icon__fullscreen_exit.svg +1 -1
- package/vitepress/assets/icons/icon__github.svg +3 -3
- package/vitepress/assets/icons/icon__mindmap.svg +1 -1
- package/vitepress/assets/icons/icon__next.svg +1 -1
- package/vitepress/assets/icons/icon__number_gray.svg +1 -1
- package/vitepress/assets/icons/icon__number_purple.svg +1 -1
- package/vitepress/assets/icons/icon__prev.svg +1 -1
- package/vitepress/assets/icons/icon__restore.svg +1 -1
- package/vitepress/assets/icons/icon__rotate.svg +4 -4
- package/vitepress/assets/icons/icon__search.svg +1 -1
- package/vitepress/assets/icons/icon__sidebar_collapsed.svg +1 -1
- package/vitepress/assets/icons/icon__sidebar_opened.svg +1 -1
- package/vitepress/assets/icons/icon__totop.svg +5 -5
- package/vitepress/assets/icons/icon__vscode.svg +5 -5
- package/vitepress/assets/icons/icon__zoom_fit.svg +1 -1
- package/vitepress/assets/icons/icon__zoom_in.svg +1 -1
- package/vitepress/assets/icons/icon__zoom_out.svg +1 -1
- package/vitepress/assets/icons/icon__zoom_reset.svg +1 -1
- package/vitepress/assets/icons/index.ts +39 -39
- package/vitepress/components/BilibiliOutsidePlayer/BilibiliOutsidePlayer.vue +20 -20
- package/vitepress/components/CodeBlockFullscreen/CodeBlockFullscreen.vue +369 -369
- package/vitepress/components/CodeBlockFullscreen/index.ts +209 -209
- package/vitepress/components/CodeBlockFullscreen/styles.css +126 -126
- package/vitepress/components/Discussions/Discussions.vue +242 -242
- package/vitepress/components/EnWordList/EnWordList.vue +664 -664
- package/vitepress/components/EnWordList/RightClickMenu.vue +87 -87
- package/vitepress/components/Footprints/Footprints.vue +472 -472
- package/vitepress/components/Layout/AboutModal.vue +329 -329
- package/vitepress/components/Layout/AboutPanel.vue +485 -485
- package/vitepress/components/Layout/ContentCollapse.vue +591 -591
- package/vitepress/components/Layout/CustomSidebar.vue +817 -817
- package/vitepress/components/Layout/DocBeforeControls.vue +145 -145
- package/vitepress/components/Layout/DocFooter.vue +233 -233
- package/vitepress/components/Layout/ImagePreview.vue +485 -485
- package/vitepress/components/Layout/Layout.vue +744 -744
- package/vitepress/components/Layout/NoteStatus.vue +140 -140
- package/vitepress/components/Layout/SidebarItems.vue +1083 -1083
- package/vitepress/components/Layout/SidebarNavBefore.vue +170 -170
- package/vitepress/components/Layout/SidebarResizeHandle.vue +311 -311
- package/vitepress/components/Layout/Swiper.vue +167 -167
- package/vitepress/components/Layout/ToggleFullContent.vue +45 -45
- package/vitepress/components/Layout/ToggleSidebar.vue +35 -35
- package/vitepress/components/Layout/composables/useCollapseControl.ts +88 -88
- package/vitepress/components/Layout/composables/useNoteConfig.ts +119 -119
- package/vitepress/components/Layout/composables/useNoteSave.ts +178 -178
- package/vitepress/components/Layout/composables/useNoteValidation.ts +85 -85
- package/vitepress/components/Layout/composables/useRedirect.ts +113 -113
- package/vitepress/components/Layout/composables/useSidebarLayout.ts +122 -122
- package/vitepress/components/Layout/composables/useVSCodeIntegration.ts +85 -85
- package/vitepress/components/Layout/homeReadme.data.ts +124 -124
- package/vitepress/components/MarkMap/MarkMap.vue +562 -562
- package/vitepress/components/Mermaid/Mermaid.vue +644 -644
- package/vitepress/components/NotesTable/NotesTable.vue +175 -175
- package/vitepress/components/NotesTable/README.md +67 -67
- package/vitepress/components/Settings/Settings.vue +711 -711
- package/vitepress/components/SidebarCard/MindMapView.vue +484 -484
- package/vitepress/components/SidebarCard/NotesTrendChart.vue +108 -108
- package/vitepress/components/SidebarCard/SidebarCard.vue +945 -945
- package/vitepress/components/Tooltip/Tooltip.vue +70 -70
- package/vitepress/components/constants.ts +109 -109
- package/vitepress/components/notesConfig.data.ts +73 -73
- package/vitepress/components/sidebar.data.ts +59 -59
- package/vitepress/components/tnotes-config.data.ts +21 -21
- package/vitepress/components/utils.ts +26 -26
- package/vitepress/config/index.ts +169 -169
- package/vitepress/configs/constants.ts +26 -26
- package/vitepress/configs/head.config.ts +25 -25
- package/vitepress/configs/index.ts +9 -9
- package/vitepress/configs/markdown-it.d.ts +23 -23
- package/vitepress/configs/markdown.config.ts +368 -368
- package/vitepress/configs/theme.config.ts +108 -108
- package/vitepress/plugins/buildProgressPlugin.ts +434 -434
- package/vitepress/plugins/getNoteByConfigIdPlugin.ts +107 -107
- package/vitepress/plugins/renameNotePlugin.ts +68 -68
- package/vitepress/plugins/sidebarStructurePlugin.ts +260 -260
- package/vitepress/plugins/updateConfigPlugin.ts +63 -63
- package/vitepress/theme/index.ts +137 -137
- package/vitepress/theme/styles/base.scss +66 -64
- package/vitepress/theme/styles/components/404.scss +31 -31
- package/vitepress/theme/styles/components/collapse.scss +172 -172
- package/vitepress/theme/styles/components/markmap.scss +101 -101
- package/vitepress/theme/styles/components/swiper.scss +255 -255
- package/vitepress/theme/styles/index.scss +25 -25
- package/vitepress/theme/styles/layout.scss +78 -78
- package/vitepress/theme/styles/utilities.scss +39 -39
- package/vitepress/theme/styles/vitepress-override.scss +25 -25
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="sidebar-toggle-wrapper">
|
|
3
|
-
<div class="toolbar-row">
|
|
4
|
-
<div class="group group-left">
|
|
5
|
-
<!-- 展开/折叠全部按钮 -->
|
|
6
|
-
<button
|
|
7
|
-
class="toggle-btn"
|
|
8
|
-
@click="$emit('toggle-expand')"
|
|
9
|
-
:title="isExpanded ? '全部折叠' : '全部展开'"
|
|
10
|
-
>
|
|
11
|
-
<img :src="icon__fold" class="toggle-icon" alt="切换展开折叠" />
|
|
12
|
-
</button>
|
|
13
|
-
<a
|
|
14
|
-
:class="[
|
|
15
|
-
'group-label',
|
|
16
|
-
'group-label-link',
|
|
17
|
-
{ 'is-active': isCatalogActive },
|
|
18
|
-
]"
|
|
19
|
-
:href="catalogLink"
|
|
20
|
-
>
|
|
21
|
-
目录
|
|
22
|
-
</a>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<div class="group group-right">
|
|
26
|
-
<!-- 聚焦到当前笔记按钮 -->
|
|
27
|
-
<button
|
|
28
|
-
class="toggle-btn"
|
|
29
|
-
@click="$emit('focus-current')"
|
|
30
|
-
title="聚焦到当前笔记(点击切换多个位置)"
|
|
31
|
-
>
|
|
32
|
-
<img :src="icon__focus" class="toggle-icon" alt="聚焦当前笔记" />
|
|
33
|
-
</button>
|
|
34
|
-
|
|
35
|
-
<!-- 笔记编号显示切换按钮 -->
|
|
36
|
-
<button
|
|
37
|
-
class="toggle-btn"
|
|
38
|
-
@click="$emit('toggle-note-id')"
|
|
39
|
-
:title="showNoteId ? '隐藏笔记编号' : '显示笔记编号'"
|
|
40
|
-
>
|
|
41
|
-
<img
|
|
42
|
-
:src="showNoteId ? icon__number_purple : icon__number_gray"
|
|
43
|
-
class="toggle-icon"
|
|
44
|
-
alt="切换笔记编号"
|
|
45
|
-
/>
|
|
46
|
-
</button>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</template>
|
|
51
|
-
|
|
52
|
-
<script setup lang="ts">
|
|
53
|
-
import { useData, useRoute } from 'vitepress'
|
|
54
|
-
import { computed } from 'vue'
|
|
55
|
-
|
|
56
|
-
import {
|
|
57
|
-
icon__fold,
|
|
58
|
-
icon__number_purple,
|
|
59
|
-
icon__number_gray,
|
|
60
|
-
icon__focus,
|
|
61
|
-
} from '../../assets/icons'
|
|
62
|
-
|
|
63
|
-
defineProps<{
|
|
64
|
-
isExpanded: boolean
|
|
65
|
-
showNoteId: boolean
|
|
66
|
-
}>()
|
|
67
|
-
|
|
68
|
-
defineEmits<{
|
|
69
|
-
'toggle-expand': []
|
|
70
|
-
'toggle-note-id': []
|
|
71
|
-
'focus-current': []
|
|
72
|
-
}>()
|
|
73
|
-
|
|
74
|
-
const { site } = useData()
|
|
75
|
-
const route = useRoute()
|
|
76
|
-
|
|
77
|
-
const base = computed(() => site.value.base || '/')
|
|
78
|
-
const catalogLink = computed(() => `${base.value}README`)
|
|
79
|
-
const catalogPath = computed(() => normalizeRoutePath(catalogLink.value))
|
|
80
|
-
const isCatalogActive = computed(() => {
|
|
81
|
-
const currentPath = normalizeRoutePath(route.path)
|
|
82
|
-
|
|
83
|
-
return currentPath === catalogPath.value || currentPath === '/README'
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
function normalizeRoutePath(path: string): string {
|
|
87
|
-
const normalizedPath = path.split(/[?#]/)[0].replace(/\.html$/, '')
|
|
88
|
-
|
|
89
|
-
return normalizedPath.length > 1
|
|
90
|
-
? normalizedPath.replace(/\/$/, '')
|
|
91
|
-
: normalizedPath
|
|
92
|
-
}
|
|
93
|
-
</script>
|
|
94
|
-
|
|
95
|
-
<style scoped>
|
|
96
|
-
.sidebar-toggle-wrapper {
|
|
97
|
-
position: sticky;
|
|
98
|
-
top: 0;
|
|
99
|
-
z-index: 2;
|
|
100
|
-
display: flex;
|
|
101
|
-
flex-direction: column;
|
|
102
|
-
gap: 8px;
|
|
103
|
-
padding: 10px 8px 12px;
|
|
104
|
-
/* border-bottom: 1px solid var(--vp-c-divider); */
|
|
105
|
-
margin-bottom: 10px;
|
|
106
|
-
background: var(--vp-sidebar-bg-color, var(--vp-c-bg));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.toolbar-row {
|
|
110
|
-
display: flex;
|
|
111
|
-
align-items: center;
|
|
112
|
-
justify-content: space-between;
|
|
113
|
-
gap: 8px;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.group {
|
|
117
|
-
display: flex;
|
|
118
|
-
align-items: center;
|
|
119
|
-
gap: 4px;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.group-label {
|
|
123
|
-
font-size: 13px;
|
|
124
|
-
color: var(--vp-c-text-2);
|
|
125
|
-
text-decoration: none;
|
|
126
|
-
user-select: none;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.group-label-link:hover {
|
|
130
|
-
color: var(--vp-c-brand-1);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.group-label-link.is-active {
|
|
134
|
-
color: var(--vp-c-brand-1);
|
|
135
|
-
font-weight: 600;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.toggle-btn {
|
|
139
|
-
display: inline-flex;
|
|
140
|
-
align-items: center;
|
|
141
|
-
justify-content: center;
|
|
142
|
-
width: 30px;
|
|
143
|
-
height: 30px;
|
|
144
|
-
padding: 0;
|
|
145
|
-
cursor: pointer;
|
|
146
|
-
background: transparent;
|
|
147
|
-
border: none;
|
|
148
|
-
border-radius: 6px;
|
|
149
|
-
transition: all 0.2s ease;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.toggle-btn:hover {
|
|
153
|
-
background: var(--vp-c-bg-soft);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.toggle-btn:active .toggle-icon {
|
|
157
|
-
transform: scale(0.95);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.toggle-icon {
|
|
161
|
-
width: 18px;
|
|
162
|
-
height: 18px;
|
|
163
|
-
display: block;
|
|
164
|
-
transition: transform 0.2s ease;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.toggle-btn:hover .toggle-icon {
|
|
168
|
-
transform: scale(1.1);
|
|
169
|
-
}
|
|
170
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sidebar-toggle-wrapper">
|
|
3
|
+
<div class="toolbar-row">
|
|
4
|
+
<div class="group group-left">
|
|
5
|
+
<!-- 展开/折叠全部按钮 -->
|
|
6
|
+
<button
|
|
7
|
+
class="toggle-btn"
|
|
8
|
+
@click="$emit('toggle-expand')"
|
|
9
|
+
:title="isExpanded ? '全部折叠' : '全部展开'"
|
|
10
|
+
>
|
|
11
|
+
<img :src="icon__fold" class="toggle-icon" alt="切换展开折叠" />
|
|
12
|
+
</button>
|
|
13
|
+
<a
|
|
14
|
+
:class="[
|
|
15
|
+
'group-label',
|
|
16
|
+
'group-label-link',
|
|
17
|
+
{ 'is-active': isCatalogActive },
|
|
18
|
+
]"
|
|
19
|
+
:href="catalogLink"
|
|
20
|
+
>
|
|
21
|
+
目录
|
|
22
|
+
</a>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div class="group group-right">
|
|
26
|
+
<!-- 聚焦到当前笔记按钮 -->
|
|
27
|
+
<button
|
|
28
|
+
class="toggle-btn"
|
|
29
|
+
@click="$emit('focus-current')"
|
|
30
|
+
title="聚焦到当前笔记(点击切换多个位置)"
|
|
31
|
+
>
|
|
32
|
+
<img :src="icon__focus" class="toggle-icon" alt="聚焦当前笔记" />
|
|
33
|
+
</button>
|
|
34
|
+
|
|
35
|
+
<!-- 笔记编号显示切换按钮 -->
|
|
36
|
+
<button
|
|
37
|
+
class="toggle-btn"
|
|
38
|
+
@click="$emit('toggle-note-id')"
|
|
39
|
+
:title="showNoteId ? '隐藏笔记编号' : '显示笔记编号'"
|
|
40
|
+
>
|
|
41
|
+
<img
|
|
42
|
+
:src="showNoteId ? icon__number_purple : icon__number_gray"
|
|
43
|
+
class="toggle-icon"
|
|
44
|
+
alt="切换笔记编号"
|
|
45
|
+
/>
|
|
46
|
+
</button>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script setup lang="ts">
|
|
53
|
+
import { useData, useRoute } from 'vitepress'
|
|
54
|
+
import { computed } from 'vue'
|
|
55
|
+
|
|
56
|
+
import {
|
|
57
|
+
icon__fold,
|
|
58
|
+
icon__number_purple,
|
|
59
|
+
icon__number_gray,
|
|
60
|
+
icon__focus,
|
|
61
|
+
} from '../../assets/icons'
|
|
62
|
+
|
|
63
|
+
defineProps<{
|
|
64
|
+
isExpanded: boolean
|
|
65
|
+
showNoteId: boolean
|
|
66
|
+
}>()
|
|
67
|
+
|
|
68
|
+
defineEmits<{
|
|
69
|
+
'toggle-expand': []
|
|
70
|
+
'toggle-note-id': []
|
|
71
|
+
'focus-current': []
|
|
72
|
+
}>()
|
|
73
|
+
|
|
74
|
+
const { site } = useData()
|
|
75
|
+
const route = useRoute()
|
|
76
|
+
|
|
77
|
+
const base = computed(() => site.value.base || '/')
|
|
78
|
+
const catalogLink = computed(() => `${base.value}README`)
|
|
79
|
+
const catalogPath = computed(() => normalizeRoutePath(catalogLink.value))
|
|
80
|
+
const isCatalogActive = computed(() => {
|
|
81
|
+
const currentPath = normalizeRoutePath(route.path)
|
|
82
|
+
|
|
83
|
+
return currentPath === catalogPath.value || currentPath === '/README'
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
function normalizeRoutePath(path: string): string {
|
|
87
|
+
const normalizedPath = path.split(/[?#]/)[0].replace(/\.html$/, '')
|
|
88
|
+
|
|
89
|
+
return normalizedPath.length > 1
|
|
90
|
+
? normalizedPath.replace(/\/$/, '')
|
|
91
|
+
: normalizedPath
|
|
92
|
+
}
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<style scoped>
|
|
96
|
+
.sidebar-toggle-wrapper {
|
|
97
|
+
position: sticky;
|
|
98
|
+
top: 0;
|
|
99
|
+
z-index: 2;
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
gap: 8px;
|
|
103
|
+
padding: 10px 8px 12px;
|
|
104
|
+
/* border-bottom: 1px solid var(--vp-c-divider); */
|
|
105
|
+
margin-bottom: 10px;
|
|
106
|
+
background: var(--vp-sidebar-bg-color, var(--vp-c-bg));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.toolbar-row {
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: space-between;
|
|
113
|
+
gap: 8px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.group {
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
gap: 4px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.group-label {
|
|
123
|
+
font-size: 13px;
|
|
124
|
+
color: var(--vp-c-text-2);
|
|
125
|
+
text-decoration: none;
|
|
126
|
+
user-select: none;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.group-label-link:hover {
|
|
130
|
+
color: var(--vp-c-brand-1);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.group-label-link.is-active {
|
|
134
|
+
color: var(--vp-c-brand-1);
|
|
135
|
+
font-weight: 600;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.toggle-btn {
|
|
139
|
+
display: inline-flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
justify-content: center;
|
|
142
|
+
width: 30px;
|
|
143
|
+
height: 30px;
|
|
144
|
+
padding: 0;
|
|
145
|
+
cursor: pointer;
|
|
146
|
+
background: transparent;
|
|
147
|
+
border: none;
|
|
148
|
+
border-radius: 6px;
|
|
149
|
+
transition: all 0.2s ease;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.toggle-btn:hover {
|
|
153
|
+
background: var(--vp-c-bg-soft);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.toggle-btn:active .toggle-icon {
|
|
157
|
+
transform: scale(0.95);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.toggle-icon {
|
|
161
|
+
width: 18px;
|
|
162
|
+
height: 18px;
|
|
163
|
+
display: block;
|
|
164
|
+
transition: transform 0.2s ease;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.toggle-btn:hover .toggle-icon {
|
|
168
|
+
transform: scale(1.1);
|
|
169
|
+
}
|
|
170
|
+
</style>
|