Skip to content

Commit 2b09682

Browse files
committed
chore: update deps
1 parent 19bf794 commit 2b09682

File tree

16 files changed

+7704
-6608
lines changed

16 files changed

+7704
-6608
lines changed

.demo/app.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ export default defineAppConfig({
33
cover: '/cover.jpg',
44
socials: {
55
twitter: 'elonehoo',
6-
github: 'elonehoo/content-unocss'
6+
github: 'elonehoo/content-unocss',
77
},
88
prose: {
99
h1: {
10-
icon: 'carbon:sailboat-coastal'
11-
}
12-
}
10+
icon: 'carbon:sailboat-coastal',
11+
},
12+
},
1313
})

.demo/content/1.index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ This is the default content of my alert!
113113

114114
If you want to go deeper, take a look at the [`<List>`](https://github.com/elonehoo/content-unocss/blob/main/theme/components/content/List.vue) component to see some `useUnwrap()` magic :magic_wand:
115115

116-
117116
## Refer
118117

119118
- [Content Wind](https://github.com/Atinux/content-wind)

.demo/nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export default defineNuxtConfig({
2-
extends: 'content-unocss'
2+
extends: 'content-unocss',
33
})

.demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
},
99
"dependencies": {
1010
"content-unocss": "workspace:*",
11-
"nuxt": "^3.15.1"
11+
"nuxt": "^3.15.4"
1212
}
1313
}

app.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
export default defineAppConfig({
22
socials: {
33
twitter: '',
4-
github: ''
4+
github: '',
55
},
66
nuxtIcon: {
77
aliases: {
88
'dark-mode': 'ph:moon-bold',
9-
'light-mode': 'ph:sun-bold'
10-
}
11-
}
9+
'light-mode': 'ph:sun-bold',
10+
},
11+
},
1212
})

app/router.options.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { RouterConfig } from '@nuxt/schema'
22

33
// https://router.vuejs.org/api/#routeroptions
44
export default <RouterConfig>{
5-
scrollBehavior (to, _, savedPosition) {
5+
scrollBehavior(to, _, savedPosition) {
66
const nuxtApp = useNuxtApp()
77

88
// If history back
@@ -21,13 +21,13 @@ export default <RouterConfig>{
2121

2222
return window.scrollTo({
2323
top: heading.offsetTop,
24-
behavior: 'smooth'
24+
behavior: 'smooth',
2525
})
2626
})
2727
return
2828
}
2929

3030
// Scroll to top of window
3131
return { top: 0 }
32-
}
32+
},
3333
}

components/AppLoadingBar.vue

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,59 @@
11
<script setup>
2-
import { useNuxtApp, onBeforeUnmount, reactive } from '#imports'
2+
import { onBeforeUnmount, reactive, useNuxtApp } from '#imports'
3+
34
const props = defineProps({
45
throttle: {
56
type: Number,
6-
default: 200
7+
default: 200,
78
},
89
duration: {
910
type: Number,
10-
default: 2000
11+
default: 2000,
1112
},
1213
height: {
1314
type: Number,
14-
default: 3
15-
}
15+
default: 3,
16+
},
1617
})
1718
const nuxtApp = useNuxtApp()
1819
// Options & Data
1920
const data = reactive({
2021
percent: 0,
2122
show: false,
22-
canSucceed: true
23+
canSucceed: true,
2324
})
2425
// Local variables
2526
let _timer = null
2627
let _throttle = null
2728
let _cut
2829
// Functions
29-
function clear () {
30+
function clear() {
3031
_timer && clearInterval(_timer)
3132
_throttle && clearTimeout(_throttle)
3233
_timer = null
3334
}
34-
function start () {
35-
if (data.show) { return }
35+
function start() {
36+
if (data.show) {
37+
return
38+
}
3639
clear()
3740
data.percent = 0
3841
data.canSucceed = true
3942
if (props.throttle) {
4043
_throttle = setTimeout(startTimer, props.throttle)
41-
} else {
44+
}
45+
else {
4246
startTimer()
4347
}
4448
}
45-
function increase (num) {
49+
function increase(num) {
4650
data.percent = Math.min(100, Math.floor(data.percent + num))
4751
}
48-
function finish () {
52+
function finish() {
4953
data.percent = 100
5054
hide()
5155
}
52-
function hide () {
56+
function hide() {
5357
clear()
5458
setTimeout(() => {
5559
data.show = false
@@ -58,7 +62,7 @@ function hide () {
5862
}, 400)
5963
}, 500)
6064
}
61-
function startTimer () {
65+
function startTimer() {
6266
data.show = true
6367
_cut = 10000 / Math.floor(props.duration)
6468
_timer = setInterval(() => {

components/AppSlots.vue

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import type { Slot, VNode } from 'vue'
3-
import { defineComponent, getCurrentInstance, useSlots, computed, useUnwrap, h } from '#imports'
3+
import { computed, defineComponent, getCurrentInstance, h, useSlots, useUnwrap } from '#imports'
44
55
/**
66
* ContentSlot component
@@ -10,76 +10,86 @@ export default defineComponent({
1010
functional: true,
1111
props: {
1212
/**
13-
* A slot name or function
13+
* A slot name or function
1414
*/
1515
use: {
1616
type: Function,
17-
default: undefined
17+
default: undefined,
1818
},
1919
/**
2020
* Tags to unwrap separated by spaces
2121
* Example: 'ul li'
2222
*/
2323
unwrap: {
2424
type: [Boolean, String],
25-
default: false
26-
}
25+
default: false,
26+
},
2727
},
28-
setup (props) {
28+
setup(props) {
2929
const { parent } = getCurrentInstance()!
3030
const { between, default: fallbackSlot } = useSlots()
3131
3232
const tags = computed(() => {
33-
if (typeof props.unwrap === 'string') { return props.unwrap.split(' ') }
33+
if (typeof props.unwrap === 'string') {
34+
return props.unwrap.split(' ')
35+
}
3436
return ['*']
3537
})
3638
3739
return {
3840
fallbackSlot,
3941
tags,
4042
between,
41-
parent
43+
parent,
4244
}
4345
},
44-
render ({ use, unwrap, fallbackSlot, between, tags, parent }: any) {
46+
render({ use, unwrap, fallbackSlot, between, tags, parent }: any) {
4547
try {
4648
let slot: Slot = use
4749
if (typeof use === 'string') {
4850
slot = parent?.slots[use] || parent?.parent?.slots[use]
49-
// eslint-disable-next-line no-console
51+
5052
console.warn(`Please set :use="$slots.${use}" in <ContentSlot> component to enable reactivity`)
5153
}
5254
53-
if (!slot) { return fallbackSlot ? fallbackSlot() : h('div') }
55+
if (!slot) {
56+
return fallbackSlot ? fallbackSlot() : h('div')
57+
}
5458
55-
if (!unwrap) { return [slot()] }
59+
if (!unwrap) {
60+
return [slot()]
61+
}
5662
5763
const { flatUnwrap } = useUnwrap()
5864
5965
const unwrapped = flatUnwrap(slot(), tags)
6066
6167
if (between) {
6268
return unwrapped.flatMap(
63-
(vnode, index) => index === 0 ? [vnode] : [between(), vnode]
69+
(vnode, index) => index === 0 ? [vnode] : [between(), vnode],
6470
)
6571
}
6672
6773
return unwrapped.reduce((acc, item) => {
6874
if (typeof item.children === 'string') {
6975
if (typeof acc[acc.length - 1] === 'string') {
7076
acc[acc.length - 1] += item.children
71-
} else {
77+
}
78+
else {
7279
acc.push(item.children)
7380
}
74-
} else {
81+
}
82+
else {
7583
acc.push(item)
7684
}
7785
return acc
7886
}, [] as Array<VNode | string>)
79-
} catch (e) {
87+
}
88+
catch (e) {
8089
// Catching errors to allow content reactivity
90+
console.error(e)
8191
return h('div')
8292
}
83-
}
93+
},
8494
})
8595
</script>

components/content/Alert.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
defineProps({
33
icon: {
44
type: String,
5-
default: 'heroicons-outline:exclamation'
6-
}
5+
default: 'heroicons-outline:exclamation',
6+
},
77
})
88
</script>
99

components/content/List.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script setup lang="ts">
2-
// Utils from Nuxt Content
3-
const { flatUnwrap } = useUnwrap()
42
defineProps({
53
icon: {
64
type: String,
7-
default: 'ph:check-circle-duotone'
8-
}
5+
default: 'ph:check-circle-duotone',
6+
},
97
})
8+
// Utils from Nuxt Content
9+
const { flatUnwrap } = useUnwrap()
1010
</script>
1111

1212
<template>

0 commit comments

Comments
 (0)