@wordup-md/nuxt-layer-shadcn-unocss 0.3.3 → 0.3.5

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.
@@ -0,0 +1,38 @@
1
+ import type { RouterConfig } from '@nuxt/schema'
2
+
3
+ // https://router.vuejs.org/api/interfaces/routeroptions.html
4
+ export default <RouterConfig>{
5
+ scrollBehavior(to, _form, savedPosition) {
6
+ return new Promise((resolve) => {
7
+ setTimeout(() => {
8
+ if (history.state.smooth) {
9
+ resolve({
10
+ el: history.state.smooth,
11
+ behavior: 'smooth',
12
+ })
13
+ }
14
+
15
+ if (to.hash) {
16
+ const el = document.querySelector(to.hash) as any
17
+ if (!el)
18
+ resolve({ el: to.hash, top: 0 })
19
+
20
+ const { marginTop } = getComputedStyle(el)
21
+ const marginTopValue = Number.parseInt(marginTop)
22
+ const offset = (document.querySelector(to.hash) as any).offsetTop - marginTopValue
23
+
24
+ resolve({
25
+ top: offset,
26
+ behavior: 'smooth',
27
+ })
28
+ }
29
+
30
+ // Scroll to top of window
31
+ if (savedPosition)
32
+ resolve(savedPosition)
33
+ else
34
+ resolve({ top: 0 })
35
+ }, 1) // Hack page wise navigation
36
+ })
37
+ },
38
+ }
@@ -11,7 +11,7 @@
11
11
  class="absolute md:ml-1.5 left-0 top-0 bottom-0 w-px transition-colors duration-300 ease-in-out"
12
12
  :class="isActive(link) ? 'bg-primary' : 'bg-border'"
13
13
  />
14
- <NuxtLinkLocale
14
+ <NuxtLink
15
15
  :to="`#${link.id}`"
16
16
  class="text-muted-foreground transition-all hover:text-primary"
17
17
  :class="{
@@ -20,7 +20,7 @@
20
20
  }"
21
21
  >
22
22
  {{ link.text }}
23
- </NuxtLinkLocale>
23
+ </NuxtLink>
24
24
  </div>
25
25
  <TocTree
26
26
  v-if="link.children"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wordup-md/nuxt-layer-shadcn-unocss",
3
3
  "type": "module",
4
- "version": "0.3.3",
4
+ "version": "0.3.5",
5
5
  "author": "Emmanuel Salomon <emmanuel.salomon@gmail.com>",
6
6
  "main": "./nuxt.config.ts",
7
7
  "repository": {
package/pages/index.vue CHANGED
@@ -1,12 +1,14 @@
1
1
  <template>
2
2
  <NuxtLayout :class="page?.header?.position === 'over' && 'header-over'">
3
- <ContentCms
4
- v-if="page"
5
- :key="page._id"
6
- :value="page"
7
- class="content-grid"
8
- />
9
- <!-- <ContentRenderer :key="page._id" :value="page" class="content-grid" /> -->
3
+ <main>
4
+ <ContentCms
5
+ v-if="page"
6
+ :key="page._id"
7
+ :value="page"
8
+ class="content-grid"
9
+ />
10
+ <!-- <ContentRenderer :key="page._id" :value="page" class="content-grid" /> -->
11
+ </main>
10
12
  </NuxtLayout>
11
13
  </template>
12
14