@tnotesjs/core 0.1.0 → 0.1.1
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.
Potentially problematic release.
This version of @tnotesjs/core might be problematic. Click here for more details.
- package/dist/chunk-NYLJBCWL.js +207 -0
- package/dist/cli/index.js +1635 -347
- package/dist/index.js +1 -1
- package/package.json +74 -74
- package/vitepress/assets/icons/icon__mindmap.svg +1 -1
- package/vitepress/assets/icons/icon__search.svg +1 -1
- package/vitepress/components/SidebarCard/MindMapView.vue +483 -483
- package/vitepress/components/SidebarCard/NotesTrendChart.vue +108 -108
- package/dist/chunk-K3X5OP3N.js +0 -1532
- package/dist/cli/index.d.ts +0 -2
- package/dist/index.d.ts +0 -138
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { BarChart, LineChart } from 'echarts/charts'
|
|
3
|
-
import { GridComponent, TooltipComponent } from 'echarts/components'
|
|
4
|
-
import { use } from 'echarts/core'
|
|
5
|
-
import { CanvasRenderer } from 'echarts/renderers'
|
|
6
|
-
import { computed } from 'vue'
|
|
7
|
-
import VChart from 'vue-echarts'
|
|
8
|
-
|
|
9
|
-
use([CanvasRenderer, BarChart, LineChart, GridComponent, TooltipComponent])
|
|
10
|
-
|
|
11
|
-
const props = defineProps({
|
|
12
|
-
completedNotesCount: {
|
|
13
|
-
type: Object,
|
|
14
|
-
required: true,
|
|
15
|
-
},
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
const chartOption = computed(() => {
|
|
19
|
-
const data = props.completedNotesCount
|
|
20
|
-
if (!data || typeof data === 'number') return {}
|
|
21
|
-
|
|
22
|
-
const sortedEntries = Object.entries(data).sort((a, b) =>
|
|
23
|
-
a[0].localeCompare(b[0]),
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
const dates = sortedEntries.map(([date]) => date)
|
|
27
|
-
const counts = sortedEntries.map(([, count]) => count)
|
|
28
|
-
const increments = counts.map((count, index) =>
|
|
29
|
-
index === 0 ? 0 : count - counts[index - 1],
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
tooltip: {
|
|
34
|
-
trigger: 'axis',
|
|
35
|
-
formatter: (params) => {
|
|
36
|
-
const index = params[0].dataIndex
|
|
37
|
-
const date = params[0].axisValue
|
|
38
|
-
const total = params[0].value
|
|
39
|
-
const increment = increments[index]
|
|
40
|
-
|
|
41
|
-
let result = `${date}<br/>${total}`
|
|
42
|
-
if (increment !== 0) {
|
|
43
|
-
const sign = increment > 0 ? '+' : ''
|
|
44
|
-
const color = increment > 0 ? '#10b981' : '#ef4444'
|
|
45
|
-
result += ` <span style="color: ${color};">(${sign}${increment})</span>`
|
|
46
|
-
}
|
|
47
|
-
return result
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
grid: {
|
|
51
|
-
left: '3%',
|
|
52
|
-
right: '4%',
|
|
53
|
-
bottom: '3%',
|
|
54
|
-
top: '10%',
|
|
55
|
-
containLabel: true,
|
|
56
|
-
},
|
|
57
|
-
xAxis: {
|
|
58
|
-
type: 'category',
|
|
59
|
-
data: dates,
|
|
60
|
-
axisLabel: { fontSize: 11 },
|
|
61
|
-
},
|
|
62
|
-
yAxis: {
|
|
63
|
-
type: 'value',
|
|
64
|
-
axisLabel: { fontSize: 11 },
|
|
65
|
-
splitLine: {
|
|
66
|
-
lineStyle: { type: 'dashed', opacity: 0.3 },
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
series: [
|
|
70
|
-
{
|
|
71
|
-
name: '笔记数量',
|
|
72
|
-
type: 'line',
|
|
73
|
-
smooth: true,
|
|
74
|
-
data: counts,
|
|
75
|
-
itemStyle: { color: '#646cff' },
|
|
76
|
-
lineStyle: { width: 2 },
|
|
77
|
-
areaStyle: {
|
|
78
|
-
color: {
|
|
79
|
-
type: 'linear',
|
|
80
|
-
x: 0,
|
|
81
|
-
y: 0,
|
|
82
|
-
x2: 0,
|
|
83
|
-
y2: 1,
|
|
84
|
-
colorStops: [
|
|
85
|
-
{ offset: 0, color: 'rgba(100, 108, 255, 0.3)' },
|
|
86
|
-
{ offset: 1, color: 'rgba(100, 108, 255, 0.05)' },
|
|
87
|
-
],
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
emphasis: { focus: 'series' },
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
</script>
|
|
96
|
-
|
|
97
|
-
<template>
|
|
98
|
-
<div class="notes-trend-chart">
|
|
99
|
-
<v-chart :option="chartOption" autoresize :style="{ height: '180px' }" />
|
|
100
|
-
</div>
|
|
101
|
-
</template>
|
|
102
|
-
|
|
103
|
-
<style scoped lang="scss">
|
|
104
|
-
.notes-trend-chart {
|
|
105
|
-
padding: 0.75rem;
|
|
106
|
-
border-radius: 8px;
|
|
107
|
-
}
|
|
108
|
-
</style>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { BarChart, LineChart } from 'echarts/charts'
|
|
3
|
+
import { GridComponent, TooltipComponent } from 'echarts/components'
|
|
4
|
+
import { use } from 'echarts/core'
|
|
5
|
+
import { CanvasRenderer } from 'echarts/renderers'
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import VChart from 'vue-echarts'
|
|
8
|
+
|
|
9
|
+
use([CanvasRenderer, BarChart, LineChart, GridComponent, TooltipComponent])
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
completedNotesCount: {
|
|
13
|
+
type: Object,
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const chartOption = computed(() => {
|
|
19
|
+
const data = props.completedNotesCount
|
|
20
|
+
if (!data || typeof data === 'number') return {}
|
|
21
|
+
|
|
22
|
+
const sortedEntries = Object.entries(data).sort((a, b) =>
|
|
23
|
+
a[0].localeCompare(b[0]),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
const dates = sortedEntries.map(([date]) => date)
|
|
27
|
+
const counts = sortedEntries.map(([, count]) => count)
|
|
28
|
+
const increments = counts.map((count, index) =>
|
|
29
|
+
index === 0 ? 0 : count - counts[index - 1],
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
tooltip: {
|
|
34
|
+
trigger: 'axis',
|
|
35
|
+
formatter: (params) => {
|
|
36
|
+
const index = params[0].dataIndex
|
|
37
|
+
const date = params[0].axisValue
|
|
38
|
+
const total = params[0].value
|
|
39
|
+
const increment = increments[index]
|
|
40
|
+
|
|
41
|
+
let result = `${date}<br/>${total}`
|
|
42
|
+
if (increment !== 0) {
|
|
43
|
+
const sign = increment > 0 ? '+' : ''
|
|
44
|
+
const color = increment > 0 ? '#10b981' : '#ef4444'
|
|
45
|
+
result += ` <span style="color: ${color};">(${sign}${increment})</span>`
|
|
46
|
+
}
|
|
47
|
+
return result
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
grid: {
|
|
51
|
+
left: '3%',
|
|
52
|
+
right: '4%',
|
|
53
|
+
bottom: '3%',
|
|
54
|
+
top: '10%',
|
|
55
|
+
containLabel: true,
|
|
56
|
+
},
|
|
57
|
+
xAxis: {
|
|
58
|
+
type: 'category',
|
|
59
|
+
data: dates,
|
|
60
|
+
axisLabel: { fontSize: 11 },
|
|
61
|
+
},
|
|
62
|
+
yAxis: {
|
|
63
|
+
type: 'value',
|
|
64
|
+
axisLabel: { fontSize: 11 },
|
|
65
|
+
splitLine: {
|
|
66
|
+
lineStyle: { type: 'dashed', opacity: 0.3 },
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
series: [
|
|
70
|
+
{
|
|
71
|
+
name: '笔记数量',
|
|
72
|
+
type: 'line',
|
|
73
|
+
smooth: true,
|
|
74
|
+
data: counts,
|
|
75
|
+
itemStyle: { color: '#646cff' },
|
|
76
|
+
lineStyle: { width: 2 },
|
|
77
|
+
areaStyle: {
|
|
78
|
+
color: {
|
|
79
|
+
type: 'linear',
|
|
80
|
+
x: 0,
|
|
81
|
+
y: 0,
|
|
82
|
+
x2: 0,
|
|
83
|
+
y2: 1,
|
|
84
|
+
colorStops: [
|
|
85
|
+
{ offset: 0, color: 'rgba(100, 108, 255, 0.3)' },
|
|
86
|
+
{ offset: 1, color: 'rgba(100, 108, 255, 0.05)' },
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
emphasis: { focus: 'series' },
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
<template>
|
|
98
|
+
<div class="notes-trend-chart">
|
|
99
|
+
<v-chart :option="chartOption" autoresize :style="{ height: '180px' }" />
|
|
100
|
+
</div>
|
|
101
|
+
</template>
|
|
102
|
+
|
|
103
|
+
<style scoped lang="scss">
|
|
104
|
+
.notes-trend-chart {
|
|
105
|
+
padding: 0.75rem;
|
|
106
|
+
border-radius: 8px;
|
|
107
|
+
}
|
|
108
|
+
</style>
|