valaxy 1.2.1 → 1.3.0
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/client/components/ValaxyDecrypt.vue +6 -25
- package/client/components/ValaxyDynamicComponent.vue +13 -34
- package/client/components/ValaxyFootnoteTooltip.vue +140 -11
- package/client/composables/app/index.ts +1 -0
- package/client/composables/app/usePageSeo.ts +40 -0
- package/client/composables/app/useValaxyApp.ts +24 -23
- package/client/composables/app/useValaxyHead.ts +5 -12
- package/client/composables/dark.ts +8 -1
- package/client/composables/post/filter.ts +1 -1
- package/client/composables/post/index.ts +4 -4
- package/client/composables/search/index.ts +2 -0
- package/client/composables/search/package.json +4 -0
- package/client/composables/search/useFuseSearch.ts +1 -1
- package/client/composables/widgets/backToTop.ts +30 -6
- package/client/main.ts +6 -6
- package/client/runtime/ValaxyRuntimeTemplate.vue +26 -0
- package/client/setup/main.ts +0 -2
- package/client/shims.d.ts +4 -0
- package/client/stores/router.ts +12 -0
- package/client/stores/site.ts +5 -50
- package/client/utils/index.ts +1 -0
- package/client/utils/seo.ts +79 -0
- package/client/utils/time.ts +7 -4
- package/dist/node/cli/index.mjs +3 -4
- package/dist/node/index.d.mts +295 -48
- package/dist/node/index.mjs +3 -4
- package/dist/shared/{valaxy.DvkRJomf.mjs → valaxy.BrBGPvyF.mjs} +1251 -209
- package/dist/shared/{valaxy.EzGcrVef.d.mts → valaxy.Jqi53gnQ.d.mts} +42 -15
- package/dist/types/index.d.mts +2 -2
- package/package.json +5 -6
- package/shared/index.ts +2 -0
- package/shared/page-policy.ts +123 -0
- package/shared/seo.ts +182 -0
- package/types/config.ts +39 -17
- package/types/vue-router.d.ts +4 -0
- package/vendor/README.md +5 -0
- package/client/components/footnote/FootnotePopover.vue +0 -146
- package/client/components/footnote/LegacyFootnoteTooltip.vue +0 -25
- package/client/modules/floating-vue.ts +0 -11
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { PopoverArrow, PopoverClose, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger } from 'reka-ui'
|
|
3
|
-
import { onBeforeUnmount, shallowRef } from 'vue'
|
|
4
|
-
import { useI18n } from 'vue-i18n'
|
|
5
|
-
|
|
6
|
-
const { t } = useI18n()
|
|
7
|
-
const open = shallowRef(false)
|
|
8
|
-
// Hover previews must neither steal focus nor return it when dismissed.
|
|
9
|
-
const interactive = shallowRef(false)
|
|
10
|
-
const contentFocused = shallowRef(false)
|
|
11
|
-
let closeTimer: ReturnType<typeof setTimeout> | undefined
|
|
12
|
-
|
|
13
|
-
function cancelClose() {
|
|
14
|
-
clearTimeout(closeTimer)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function preview(event: PointerEvent) {
|
|
18
|
-
if (event.pointerType === 'touch')
|
|
19
|
-
return
|
|
20
|
-
cancelClose()
|
|
21
|
-
if (!open.value) {
|
|
22
|
-
interactive.value = false
|
|
23
|
-
open.value = true
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function scheduleClose() {
|
|
28
|
-
cancelClose()
|
|
29
|
-
closeTimer = setTimeout(() => {
|
|
30
|
-
if (!interactive.value && !contentFocused.value)
|
|
31
|
-
open.value = false
|
|
32
|
-
}, 200)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function updateOpen(value: boolean) {
|
|
36
|
-
cancelClose()
|
|
37
|
-
if (value)
|
|
38
|
-
interactive.value = true
|
|
39
|
-
open.value = value
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function followFootnote() {
|
|
43
|
-
cancelClose()
|
|
44
|
-
interactive.value = false
|
|
45
|
-
open.value = false
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function autoFocus(event: Event) {
|
|
49
|
-
if (!interactive.value)
|
|
50
|
-
event.preventDefault()
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
onBeforeUnmount(cancelClose)
|
|
54
|
-
</script>
|
|
55
|
-
|
|
56
|
-
<template>
|
|
57
|
-
<PopoverRoot :open="open" :modal="false" @update:open="updateOpen">
|
|
58
|
-
<span class="va-footnote">
|
|
59
|
-
<span @pointerenter="preview" @pointerleave="scheduleClose" @click="followFootnote">
|
|
60
|
-
<slot />
|
|
61
|
-
</span>
|
|
62
|
-
<PopoverTrigger
|
|
63
|
-
class="va-footnote-preview"
|
|
64
|
-
:aria-label="t('post.footnote_preview')"
|
|
65
|
-
@pointerenter="cancelClose"
|
|
66
|
-
@pointerleave="scheduleClose"
|
|
67
|
-
>
|
|
68
|
-
<span aria-hidden="true">⋯</span>
|
|
69
|
-
</PopoverTrigger>
|
|
70
|
-
<PopoverPortal to="#valaxy-teleports">
|
|
71
|
-
<PopoverContent
|
|
72
|
-
class="va-footnote-popover markdown-body"
|
|
73
|
-
side="top"
|
|
74
|
-
:side-offset="8"
|
|
75
|
-
:collision-padding="12"
|
|
76
|
-
@open-auto-focus="autoFocus"
|
|
77
|
-
@close-auto-focus="autoFocus"
|
|
78
|
-
@pointerenter="cancelClose"
|
|
79
|
-
@pointerleave="scheduleClose"
|
|
80
|
-
@focusin="contentFocused = true"
|
|
81
|
-
@focusout="contentFocused = false"
|
|
82
|
-
>
|
|
83
|
-
<PopoverClose class="va-footnote-close" :aria-label="t('post.footnote_close')">
|
|
84
|
-
<span aria-hidden="true">×</span>
|
|
85
|
-
</PopoverClose>
|
|
86
|
-
<slot name="popper" />
|
|
87
|
-
<PopoverArrow class="va-footnote-arrow" />
|
|
88
|
-
</PopoverContent>
|
|
89
|
-
</PopoverPortal>
|
|
90
|
-
</span>
|
|
91
|
-
</PopoverRoot>
|
|
92
|
-
</template>
|
|
93
|
-
|
|
94
|
-
<style>
|
|
95
|
-
.va-footnote {
|
|
96
|
-
display: inline-block;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.va-footnote-preview {
|
|
100
|
-
vertical-align: super;
|
|
101
|
-
padding: 0 0.2em;
|
|
102
|
-
color: var(--va-c-primary);
|
|
103
|
-
font-size: 0.75em;
|
|
104
|
-
line-height: 1;
|
|
105
|
-
cursor: pointer;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.va-footnote-popover {
|
|
109
|
-
box-sizing: border-box;
|
|
110
|
-
z-index: 100;
|
|
111
|
-
width: max-content;
|
|
112
|
-
max-width: min(24rem, var(--reka-popover-content-available-width));
|
|
113
|
-
max-height: var(--reka-popover-content-available-height);
|
|
114
|
-
overflow: auto;
|
|
115
|
-
padding: 0.75rem 1rem;
|
|
116
|
-
border: 1px solid var(--va-c-divider);
|
|
117
|
-
border-radius: 0.5rem;
|
|
118
|
-
background: var(--va-c-bg);
|
|
119
|
-
color: var(--va-c-text);
|
|
120
|
-
box-shadow: 0 4px 16px rgb(0 0 0 / 0.15);
|
|
121
|
-
font-size: 0.875rem;
|
|
122
|
-
line-height: 1.6;
|
|
123
|
-
overflow-wrap: anywhere;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.va-footnote-popover > p:last-of-type {
|
|
127
|
-
margin-bottom: 0;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.va-footnote-close {
|
|
131
|
-
float: right;
|
|
132
|
-
margin-inline-start: 0.5rem;
|
|
133
|
-
padding: 0 0.25rem;
|
|
134
|
-
cursor: pointer;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.va-footnote-preview:focus-visible,
|
|
138
|
-
.va-footnote-close:focus-visible {
|
|
139
|
-
outline: 2px solid var(--va-c-primary);
|
|
140
|
-
outline-offset: 2px;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.va-footnote-arrow {
|
|
144
|
-
fill: var(--va-c-bg);
|
|
145
|
-
}
|
|
146
|
-
</style>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { Tooltip } from 'floating-vue'
|
|
3
|
-
import { onMounted, ref } from 'vue'
|
|
4
|
-
|
|
5
|
-
// floating-vue Tooltip generates different DOM during SSR vs client hydration.
|
|
6
|
-
// Only mount the Tooltip after the component is mounted on the client to avoid mismatches.
|
|
7
|
-
// During SSR and initial client render, a plain <span> is shown instead.
|
|
8
|
-
const mounted = ref(false)
|
|
9
|
-
onMounted(() => {
|
|
10
|
-
mounted.value = true
|
|
11
|
-
})
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<template>
|
|
15
|
-
<Tooltip v-if="mounted" class="inline-block" :distance="8">
|
|
16
|
-
<slot />
|
|
17
|
-
|
|
18
|
-
<template #popper>
|
|
19
|
-
<slot name="popper" />
|
|
20
|
-
</template>
|
|
21
|
-
</Tooltip>
|
|
22
|
-
<span v-else class="inline-block">
|
|
23
|
-
<slot />
|
|
24
|
-
</span>
|
|
25
|
-
</template>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DefaultTheme, ValaxyConfig } from 'valaxy/types'
|
|
2
|
-
import type { ComputedRef } from 'vue'
|
|
3
|
-
import type { ValaxySSGContext } from '../setups'
|
|
4
|
-
import FloatingVue from 'floating-vue'
|
|
5
|
-
import 'floating-vue/dist/style.css'
|
|
6
|
-
|
|
7
|
-
export async function install({ app }: ValaxySSGContext, config: ComputedRef<ValaxyConfig<DefaultTheme.Config>>) {
|
|
8
|
-
// @see https://floating-vue.starpad.dev/guide/config#default-values
|
|
9
|
-
const defaultFloatingVueConfig = {}
|
|
10
|
-
app.use(FloatingVue, Object.assign(defaultFloatingVueConfig, config.value.siteConfig.floatingVue || {}))
|
|
11
|
-
}
|