@tnotesjs/core 0.1.22 → 0.1.24
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 +368 -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 +79 -78
- package/vitepress/theme/styles/utilities.scss +39 -39
- package/vitepress/theme/styles/vitepress-override.scss +25 -25
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="docBeforeContainer">
|
|
3
|
-
<div class="leftArea">
|
|
4
|
-
<div
|
|
5
|
-
class="toggleSidebarBox pcOnly"
|
|
6
|
-
v-show="!isFullContentMode"
|
|
7
|
-
>
|
|
8
|
-
<ToggleSidebar />
|
|
9
|
-
</div>
|
|
10
|
-
<div class="vscodeBox pcOnly" v-show="vscodeNotesDir">
|
|
11
|
-
<a
|
|
12
|
-
:href="vscodeNotesDir"
|
|
13
|
-
title="open in vscode"
|
|
14
|
-
target="_blank"
|
|
15
|
-
>
|
|
16
|
-
<img :src="icon__vscode" alt="open in vscode" />
|
|
17
|
-
</a>
|
|
18
|
-
</div>
|
|
19
|
-
<div class="contentToggleBox pcOnly">
|
|
20
|
-
<ToggleFullContent />
|
|
21
|
-
</div>
|
|
22
|
-
<!-- 知识库的 GitHub 链接(仅首页显示,PC 端) -->
|
|
23
|
-
<div class="githubRepoBox pcOnly" v-show="isHomeReadme">
|
|
24
|
-
<a
|
|
25
|
-
:href="`https://github.com/tnotesjs/${vpData.page.value.title.toLowerCase()}/blob/main/README.md`"
|
|
26
|
-
:title="`tnotesjs github - ${vpData.page.value.title.toLowerCase()} 笔记仓库链接`"
|
|
27
|
-
target="_blank"
|
|
28
|
-
rel="noopener"
|
|
29
|
-
>
|
|
30
|
-
<img :src="icon__github" alt="github icon" />
|
|
31
|
-
</a>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
<div class="rightArea">
|
|
35
|
-
<!-- 一键复制笔记内容按钮 -->
|
|
36
|
-
<div class="collapseAllBtn" v-show="currentNoteId">
|
|
37
|
-
<button
|
|
38
|
-
class="collapseAllButton"
|
|
39
|
-
@click="copyNoteContent"
|
|
40
|
-
title="复制笔记原始内容"
|
|
41
|
-
type="button"
|
|
42
|
-
>
|
|
43
|
-
<img :src="icon__clipboard" alt="copy note content" />
|
|
44
|
-
</button>
|
|
45
|
-
</div>
|
|
46
|
-
<Transition name="toast">
|
|
47
|
-
<div v-if="showCopyToast" class="toast">✓ 复制成功</div>
|
|
48
|
-
</Transition>
|
|
49
|
-
<!-- 全局折叠/展开按钮 -->
|
|
50
|
-
<div
|
|
51
|
-
class="collapseAllBtn"
|
|
52
|
-
v-show="currentNoteId || isHomeReadme"
|
|
53
|
-
>
|
|
54
|
-
<button
|
|
55
|
-
class="collapseAllButton"
|
|
56
|
-
@click="toggleAllCollapse"
|
|
57
|
-
:title="allCollapsed ? '展开所有区域' : '折叠所有区域'"
|
|
58
|
-
type="button"
|
|
59
|
-
>
|
|
60
|
-
<img :src="icon__fold" alt="collapse all" />
|
|
61
|
-
</button>
|
|
62
|
-
</div>
|
|
63
|
-
<!-- 单个图标,点击打开 modal,只在有笔记数据的页面显示 -->
|
|
64
|
-
<div
|
|
65
|
-
class="aboutBtn"
|
|
66
|
-
v-show="
|
|
67
|
-
(currentNoteId && created_at && updated_at) ||
|
|
68
|
-
(isHomeReadme && homeReadmeCreatedAt && homeReadmeUpdatedAt)
|
|
69
|
-
"
|
|
70
|
-
>
|
|
71
|
-
<button
|
|
72
|
-
class="aboutIconButton"
|
|
73
|
-
@click="$emit('open-time-modal')"
|
|
74
|
-
:title="isHomeReadme ? '关于这个知识库' : '关于这篇笔记'"
|
|
75
|
-
type="button"
|
|
76
|
-
>
|
|
77
|
-
!
|
|
78
|
-
</button>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
</template>
|
|
83
|
-
|
|
84
|
-
<script setup lang="ts">
|
|
85
|
-
import { useData } from 'vitepress'
|
|
86
|
-
import { ref } from 'vue'
|
|
87
|
-
|
|
88
|
-
import ToggleFullContent from './ToggleFullContent.vue'
|
|
89
|
-
import ToggleSidebar from './ToggleSidebar.vue'
|
|
90
|
-
import {
|
|
91
|
-
icon__github,
|
|
92
|
-
icon__vscode,
|
|
93
|
-
icon__fold,
|
|
94
|
-
icon__clipboard,
|
|
95
|
-
} from '../../assets/icons'
|
|
96
|
-
|
|
97
|
-
const props = defineProps<{
|
|
98
|
-
isFullContentMode: boolean
|
|
99
|
-
vscodeNotesDir: string
|
|
100
|
-
isHomeReadme: boolean
|
|
101
|
-
currentNoteId: string | null
|
|
102
|
-
created_at: string | undefined
|
|
103
|
-
updated_at: string | undefined
|
|
104
|
-
homeReadmeCreatedAt: string | undefined
|
|
105
|
-
homeReadmeUpdatedAt: string | undefined
|
|
106
|
-
timeModalOpen: boolean
|
|
107
|
-
allCollapsed: boolean
|
|
108
|
-
}>()
|
|
109
|
-
|
|
110
|
-
const showCopyToast = ref(false)
|
|
111
|
-
let copyToastTimer: ReturnType<typeof setTimeout> | null = null
|
|
112
|
-
|
|
113
|
-
async function copyNoteContent() {
|
|
114
|
-
const encoded = vpData.frontmatter.value.rawContent
|
|
115
|
-
if (!encoded) return
|
|
116
|
-
try {
|
|
117
|
-
// rawContent 为 base64(UTF-8) —— 在构建期编码以规避 VitePress 把
|
|
118
|
-
// `<script>` 字面量注入 SFC 时的多重正则误匹配。
|
|
119
|
-
const bin = atob(encoded)
|
|
120
|
-
const bytes = Uint8Array.from(bin, (c) => c.charCodeAt(0))
|
|
121
|
-
const raw = new TextDecoder('utf-8').decode(bytes)
|
|
122
|
-
await navigator.clipboard.writeText(raw)
|
|
123
|
-
if (copyToastTimer) clearTimeout(copyToastTimer)
|
|
124
|
-
showCopyToast.value = true
|
|
125
|
-
copyToastTimer = setTimeout(() => {
|
|
126
|
-
showCopyToast.value = false
|
|
127
|
-
}, 2000)
|
|
128
|
-
} catch (e) {
|
|
129
|
-
console.error('复制失败', e)
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const emit = defineEmits<{
|
|
134
|
-
(e: 'open-time-modal'): void
|
|
135
|
-
(e: 'toggle-all-collapse'): void
|
|
136
|
-
}>()
|
|
137
|
-
|
|
138
|
-
const vpData = useData()
|
|
139
|
-
|
|
140
|
-
function toggleAllCollapse() {
|
|
141
|
-
emit('toggle-all-collapse')
|
|
142
|
-
}
|
|
143
|
-
</script>
|
|
144
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="docBeforeContainer">
|
|
3
|
+
<div class="leftArea">
|
|
4
|
+
<div
|
|
5
|
+
class="toggleSidebarBox pcOnly"
|
|
6
|
+
v-show="!isFullContentMode"
|
|
7
|
+
>
|
|
8
|
+
<ToggleSidebar />
|
|
9
|
+
</div>
|
|
10
|
+
<div class="vscodeBox pcOnly" v-show="vscodeNotesDir">
|
|
11
|
+
<a
|
|
12
|
+
:href="vscodeNotesDir"
|
|
13
|
+
title="open in vscode"
|
|
14
|
+
target="_blank"
|
|
15
|
+
>
|
|
16
|
+
<img :src="icon__vscode" alt="open in vscode" />
|
|
17
|
+
</a>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="contentToggleBox pcOnly">
|
|
20
|
+
<ToggleFullContent />
|
|
21
|
+
</div>
|
|
22
|
+
<!-- 知识库的 GitHub 链接(仅首页显示,PC 端) -->
|
|
23
|
+
<div class="githubRepoBox pcOnly" v-show="isHomeReadme">
|
|
24
|
+
<a
|
|
25
|
+
:href="`https://github.com/tnotesjs/${vpData.page.value.title.toLowerCase()}/blob/main/README.md`"
|
|
26
|
+
:title="`tnotesjs github - ${vpData.page.value.title.toLowerCase()} 笔记仓库链接`"
|
|
27
|
+
target="_blank"
|
|
28
|
+
rel="noopener"
|
|
29
|
+
>
|
|
30
|
+
<img :src="icon__github" alt="github icon" />
|
|
31
|
+
</a>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="rightArea">
|
|
35
|
+
<!-- 一键复制笔记内容按钮 -->
|
|
36
|
+
<div class="collapseAllBtn" v-show="currentNoteId">
|
|
37
|
+
<button
|
|
38
|
+
class="collapseAllButton"
|
|
39
|
+
@click="copyNoteContent"
|
|
40
|
+
title="复制笔记原始内容"
|
|
41
|
+
type="button"
|
|
42
|
+
>
|
|
43
|
+
<img :src="icon__clipboard" alt="copy note content" />
|
|
44
|
+
</button>
|
|
45
|
+
</div>
|
|
46
|
+
<Transition name="toast">
|
|
47
|
+
<div v-if="showCopyToast" class="toast">✓ 复制成功</div>
|
|
48
|
+
</Transition>
|
|
49
|
+
<!-- 全局折叠/展开按钮 -->
|
|
50
|
+
<div
|
|
51
|
+
class="collapseAllBtn"
|
|
52
|
+
v-show="currentNoteId || isHomeReadme"
|
|
53
|
+
>
|
|
54
|
+
<button
|
|
55
|
+
class="collapseAllButton"
|
|
56
|
+
@click="toggleAllCollapse"
|
|
57
|
+
:title="allCollapsed ? '展开所有区域' : '折叠所有区域'"
|
|
58
|
+
type="button"
|
|
59
|
+
>
|
|
60
|
+
<img :src="icon__fold" alt="collapse all" />
|
|
61
|
+
</button>
|
|
62
|
+
</div>
|
|
63
|
+
<!-- 单个图标,点击打开 modal,只在有笔记数据的页面显示 -->
|
|
64
|
+
<div
|
|
65
|
+
class="aboutBtn"
|
|
66
|
+
v-show="
|
|
67
|
+
(currentNoteId && created_at && updated_at) ||
|
|
68
|
+
(isHomeReadme && homeReadmeCreatedAt && homeReadmeUpdatedAt)
|
|
69
|
+
"
|
|
70
|
+
>
|
|
71
|
+
<button
|
|
72
|
+
class="aboutIconButton"
|
|
73
|
+
@click="$emit('open-time-modal')"
|
|
74
|
+
:title="isHomeReadme ? '关于这个知识库' : '关于这篇笔记'"
|
|
75
|
+
type="button"
|
|
76
|
+
>
|
|
77
|
+
!
|
|
78
|
+
</button>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<script setup lang="ts">
|
|
85
|
+
import { useData } from 'vitepress'
|
|
86
|
+
import { ref } from 'vue'
|
|
87
|
+
|
|
88
|
+
import ToggleFullContent from './ToggleFullContent.vue'
|
|
89
|
+
import ToggleSidebar from './ToggleSidebar.vue'
|
|
90
|
+
import {
|
|
91
|
+
icon__github,
|
|
92
|
+
icon__vscode,
|
|
93
|
+
icon__fold,
|
|
94
|
+
icon__clipboard,
|
|
95
|
+
} from '../../assets/icons'
|
|
96
|
+
|
|
97
|
+
const props = defineProps<{
|
|
98
|
+
isFullContentMode: boolean
|
|
99
|
+
vscodeNotesDir: string
|
|
100
|
+
isHomeReadme: boolean
|
|
101
|
+
currentNoteId: string | null
|
|
102
|
+
created_at: string | undefined
|
|
103
|
+
updated_at: string | undefined
|
|
104
|
+
homeReadmeCreatedAt: string | undefined
|
|
105
|
+
homeReadmeUpdatedAt: string | undefined
|
|
106
|
+
timeModalOpen: boolean
|
|
107
|
+
allCollapsed: boolean
|
|
108
|
+
}>()
|
|
109
|
+
|
|
110
|
+
const showCopyToast = ref(false)
|
|
111
|
+
let copyToastTimer: ReturnType<typeof setTimeout> | null = null
|
|
112
|
+
|
|
113
|
+
async function copyNoteContent() {
|
|
114
|
+
const encoded = vpData.frontmatter.value.rawContent
|
|
115
|
+
if (!encoded) return
|
|
116
|
+
try {
|
|
117
|
+
// rawContent 为 base64(UTF-8) —— 在构建期编码以规避 VitePress 把
|
|
118
|
+
// `<script>` 字面量注入 SFC 时的多重正则误匹配。
|
|
119
|
+
const bin = atob(encoded)
|
|
120
|
+
const bytes = Uint8Array.from(bin, (c) => c.charCodeAt(0))
|
|
121
|
+
const raw = new TextDecoder('utf-8').decode(bytes)
|
|
122
|
+
await navigator.clipboard.writeText(raw)
|
|
123
|
+
if (copyToastTimer) clearTimeout(copyToastTimer)
|
|
124
|
+
showCopyToast.value = true
|
|
125
|
+
copyToastTimer = setTimeout(() => {
|
|
126
|
+
showCopyToast.value = false
|
|
127
|
+
}, 2000)
|
|
128
|
+
} catch (e) {
|
|
129
|
+
console.error('复制失败', e)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const emit = defineEmits<{
|
|
134
|
+
(e: 'open-time-modal'): void
|
|
135
|
+
(e: 'toggle-all-collapse'): void
|
|
136
|
+
}>()
|
|
137
|
+
|
|
138
|
+
const vpData = useData()
|
|
139
|
+
|
|
140
|
+
function toggleAllCollapse() {
|
|
141
|
+
emit('toggle-all-collapse')
|
|
142
|
+
}
|
|
143
|
+
</script>
|
|
144
|
+
|
|
145
145
|
<style scoped lang="scss">
|
|
146
146
|
/* doc-before-container 主容器 */
|
|
147
147
|
.docBeforeContainer {
|
|
@@ -348,4 +348,4 @@ function toggleAllCollapse() {
|
|
|
348
348
|
opacity: 0;
|
|
349
349
|
transform: translateY(20px);
|
|
350
350
|
}
|
|
351
|
-
</style>
|
|
351
|
+
</style>
|