Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ea0aec9

Browse filesBrowse files
OrbisKantfu
andauthored
docs: remove docs-utils and inline stringify function into demos (#4710)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
1 parent 08f7dc4 commit ea0aec9
Copy full SHA for ea0aec9

File tree

Expand file treeCollapse file tree

67 files changed

+367
-134
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

67 files changed

+367
-134
lines changed

‎packages/.vitepress/plugins/utils.ts

Copy file name to clipboardExpand all lines: packages/.vitepress/plugins/utils.ts
-14Lines changed: 0 additions & 14 deletions
This file was deleted.

‎packages/.vitepress/vite.config.ts

Copy file name to clipboardExpand all lines: packages/.vitepress/vite.config.ts
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default defineConfig({
4040
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
4141
resolvers: [
4242
IconsResolver({
43-
componentPrefix: '',
43+
prefix: '',
4444
}),
4545
],
4646
dts: resolve(__dirname, 'components.d.mts'),
@@ -62,7 +62,6 @@ export default defineConfig({
6262
'@vueuse/integrations': resolve(__dirname, '../integrations/index.ts'),
6363
'@vueuse/components': resolve(__dirname, '../components/index.ts'),
6464
'@vueuse/metadata': resolve(__dirname, '../metadata/index.ts'),
65-
'@vueuse/docs-utils': resolve(__dirname, 'plugins/utils.ts'),
6665
},
6766
dedupe: [
6867
'vue',

‎packages/core/createTemplatePromise/demo.vue

Copy file name to clipboardExpand all lines: packages/core/createTemplatePromise/demo.vue
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { createTemplatePromise } from './index'
2+
import { createTemplatePromise } from '@vueuse/core'
33
44
type DialogResult = 'ok' | 'cancel'
55

‎packages/core/onClickOutside/demo.vue

Copy file name to clipboardExpand all lines: packages/core/onClickOutside/demo.vue
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script setup lang="ts">
22
import type { OnClickOutsideHandler } from '@vueuse/core'
3+
import { vOnClickOutside } from '@vueuse/components'
34
import { onClickOutside } from '@vueuse/core'
45
import { shallowRef, useTemplateRef } from 'vue'
5-
import { vOnClickOutside } from './directive'
66
77
const modal = shallowRef(false)
88
const modalRef = useTemplateRef('modalRef')

‎packages/core/onLongPress/demo.vue

Copy file name to clipboardExpand all lines: packages/core/onLongPress/demo.vue
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
2+
import { onLongPress } from '@vueuse/core'
23
import { shallowRef } from 'vue'
3-
import { onLongPress } from './'
44
55
const htmlRef = shallowRef<HTMLElement | null>(null)
66
const htmlRefOptions = shallowRef<HTMLElement | null>(null)

‎packages/core/useAnimate/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useAnimate/demo.vue
+14-2Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
<script setup lang="ts">
22
import type { MaybeElement } from '@vueuse/core'
3-
import { useAnimate } from '@vueuse/core'
4-
import { stringify } from '@vueuse/docs-utils'
3+
import { reactify, useAnimate } from '@vueuse/core'
54
import { reactive, useTemplateRef } from 'vue'
5+
import YAML from 'yaml'
6+
7+
const stringify = reactify(
8+
(input: any) => YAML.stringify(input, (k, v) => {
9+
if (typeof v === 'function') {
10+
return undefined
11+
}
12+
return v
13+
}, {
14+
singleQuote: true,
15+
flowCollectionPadding: false,
16+
}),
17+
)
618
719
const el = useTemplateRef<MaybeElement>('el')
820

‎packages/core/useAsyncState/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useAsyncState/demo.vue
+15-3Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
<script setup lang="ts">
2-
import { useAsyncState } from '@vueuse/core'
2+
import { reactify, useAsyncState } from '@vueuse/core'
33
import axios from 'axios'
4-
import yaml from 'yaml'
4+
import YAML from 'yaml'
5+
6+
const stringify = reactify(
7+
(input: any) => YAML.stringify(input, (k, v) => {
8+
if (typeof v === 'function') {
9+
return undefined
10+
}
11+
return v
12+
}, {
13+
singleQuote: true,
14+
flowCollectionPadding: false,
15+
}),
16+
)
517
618
const { isLoading, state, isReady, execute } = useAsyncState(
719
(args) => {
@@ -20,7 +32,7 @@ const { isLoading, state, isReady, execute } = useAsyncState(
2032
<div>
2133
<note>Ready: {{ isReady.toString() }}</note>
2234
<note>Loading: {{ isLoading.toString() }}</note>
23-
<pre lang="json" class="ml-2">{{ yaml.stringify(state) }}</pre>
35+
<pre lang="json" class="ml-2">{{ stringify(state) }}</pre>
2436
<button @click="() => execute(2000, { id: 2 })">
2537
Execute
2638
</button>

‎packages/core/useBattery/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useBattery/demo.vue
+14-2Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
<script setup lang="ts">
2-
import { useBattery } from '@vueuse/core'
3-
import { stringify } from '@vueuse/docs-utils'
2+
import { reactify, useBattery } from '@vueuse/core'
43
import { reactive } from 'vue'
4+
import YAML from 'yaml'
5+
6+
const stringify = reactify(
7+
(input: any) => YAML.stringify(input, (k, v) => {
8+
if (typeof v === 'function') {
9+
return undefined
10+
}
11+
return v
12+
}, {
13+
singleQuote: true,
14+
flowCollectionPadding: false,
15+
}),
16+
)
517
618
const battery = reactive(useBattery())
719
const text = stringify(battery)

‎packages/core/useBluetooth/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useBluetooth/demo.vue
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { useBluetooth } from './index'
2+
import { useBluetooth } from '@vueuse/core'
33
44
const {
55
isConnected,

‎packages/core/useBrowserLocation/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useBrowserLocation/demo.vue
+14-2Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
<script setup lang="ts">
2-
import { useBrowserLocation } from '@vueuse/core'
3-
import { stringify } from '@vueuse/docs-utils'
2+
import { reactify, useBrowserLocation } from '@vueuse/core'
3+
import YAML from 'yaml'
4+
5+
const stringify = reactify(
6+
(input: any) => YAML.stringify(input, (k, v) => {
7+
if (typeof v === 'function') {
8+
return undefined
9+
}
10+
return v
11+
}, {
12+
singleQuote: true,
13+
flowCollectionPadding: false,
14+
}),
15+
)
416
517
const location = useBrowserLocation()
618
const text = stringify(location)

‎packages/core/useCountdown/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useCountdown/demo.vue
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script setup lang="ts">
2-
import { useEventListener } from '@vueuse/core'
2+
import { useCountdown, useEventListener } from '@vueuse/core'
33
import { shallowRef, useTemplateRef } from 'vue'
4-
import { useCountdown } from './index'
54
65
const countdownSeconds = shallowRef(5)
76
const rocketRef = useTemplateRef<HTMLDivElement>('rocketRef')

‎packages/core/useDark/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useDark/demo.vue
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { useToggle } from '@vueuse/shared'
2+
import { useToggle } from '@vueuse/core'
33
import { isDark } from '../../.vitepress/theme/composables/dark'
44
55
// const isDark = useDark()

‎packages/core/useDebouncedRefHistory/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useDebouncedRefHistory/demo.vue
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script setup lang="ts">
2-
import { formatDate, useDebouncedRefHistory } from '@vueuse/core'
3-
import { useCounter } from '@vueuse/shared'
2+
import { formatDate, useCounter, useDebouncedRefHistory } from '@vueuse/core'
43
import { shallowRef } from 'vue'
54
65
function format(ts: number) {

‎packages/core/useDeviceOrientation/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useDeviceOrientation/demo.vue
+14-2Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
<script setup lang="ts">
2-
import { useDeviceOrientation } from '@vueuse/core'
3-
import { stringify } from '@vueuse/docs-utils'
2+
import { reactify, useDeviceOrientation } from '@vueuse/core'
43
import { reactive } from 'vue'
4+
import YAML from 'yaml'
5+
6+
const stringify = reactify(
7+
(input: any) => YAML.stringify(input, (k, v) => {
8+
if (typeof v === 'function') {
9+
return undefined
10+
}
11+
return v
12+
}, {
13+
singleQuote: true,
14+
flowCollectionPadding: false,
15+
}),
16+
)
517
618
const orientation = reactive(useDeviceOrientation())
719
const text = stringify(orientation)

‎packages/core/useDevicePixelRatio/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useDevicePixelRatio/demo.vue
+14-2Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
<script setup lang="ts">
2-
import { useDevicePixelRatio } from '@vueuse/core'
3-
import { stringify } from '@vueuse/docs-utils'
2+
import { reactify, useDevicePixelRatio } from '@vueuse/core'
43
import { reactive } from 'vue'
4+
import YAML from 'yaml'
5+
6+
const stringify = reactify(
7+
(input: any) => YAML.stringify(input, (k, v) => {
8+
if (typeof v === 'function') {
9+
return undefined
10+
}
11+
return v
12+
}, {
13+
singleQuote: true,
14+
flowCollectionPadding: false,
15+
}),
16+
)
517
618
const pixelRatio = reactive(useDevicePixelRatio())
719
const code = stringify(pixelRatio)

‎packages/core/useDocumentVisibility/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useDocumentVisibility/demo.vue
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script setup lang="ts">
2-
import { useDocumentVisibility } from '@vueuse/core'
3-
import { useTimeoutFn } from '@vueuse/shared'
2+
import { useDocumentVisibility, useTimeoutFn } from '@vueuse/core'
43
import { shallowRef, watch } from 'vue'
54
65
const startMessage = '💡 Minimize the page or switch tab then return'

‎packages/core/useDraggable/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useDraggable/demo.vue
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<script setup lang="ts">
2-
import { useDraggable } from '@vueuse/core'
3-
import { isClient } from '@vueuse/shared'
2+
import { UseDraggable as Draggable } from '@vueuse/components'
3+
import { isClient, useDraggable } from '@vueuse/core'
44
import { shallowRef, useTemplateRef } from 'vue'
5-
import { UseDraggable as Draggable } from './component'
65
76
const el = useTemplateRef<HTMLElement>('el')
87
const handle = useTemplateRef<HTMLElement>('handle')

‎packages/core/useElementBounding/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useElementBounding/demo.vue
+14-2Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
<script setup lang="ts">
2-
import { useElementBounding } from '@vueuse/core'
3-
import { stringify } from '@vueuse/docs-utils'
2+
import { reactify, useElementBounding } from '@vueuse/core'
43
import { reactive, useTemplateRef } from 'vue'
4+
import YAML from 'yaml'
5+
6+
const stringify = reactify(
7+
(input: any) => YAML.stringify(input, (k, v) => {
8+
if (typeof v === 'function') {
9+
return undefined
10+
}
11+
return v
12+
}, {
13+
singleQuote: true,
14+
flowCollectionPadding: false,
15+
}),
16+
)
517
618
const el = useTemplateRef('el')
719
const rect = reactive(useElementBounding(el))

‎packages/core/useElementHover/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useElementHover/demo.vue
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
2+
import { vElementHover } from '@vueuse/components'
23
import { useElementHover } from '@vueuse/core'
34
import { shallowRef, useTemplateRef } from 'vue'
4-
import { vElementHover } from './directive'
55
66
const el = useTemplateRef<HTMLButtonElement>('el')
77
const isDirectiveHovered = shallowRef(false)

‎packages/core/useElementSize/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useElementSize/demo.vue
+14-2Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
<script setup lang="ts">
2-
import { useElementSize } from '@vueuse/core'
3-
import { stringify } from '@vueuse/docs-utils'
2+
import { reactify, useElementSize } from '@vueuse/core'
43
import { reactive, useTemplateRef } from 'vue'
4+
import YAML from 'yaml'
5+
6+
const stringify = reactify(
7+
(input: any) => YAML.stringify(input, (k, v) => {
8+
if (typeof v === 'function') {
9+
return undefined
10+
}
11+
return v
12+
}, {
13+
singleQuote: true,
14+
flowCollectionPadding: false,
15+
}),
16+
)
517
618
const el = useTemplateRef('el')
719
const size = reactive(

‎packages/core/useFetch/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useFetch/demo.vue
+14-3Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
<script setup lang="ts">
2-
import { useFetch } from '@vueuse/core'
3-
import { stringify } from '@vueuse/docs-utils'
4-
import { useToggle } from '@vueuse/shared'
2+
import { reactify, useFetch, useToggle } from '@vueuse/core'
53
import { computed, reactive, shallowRef } from 'vue'
4+
import YAML from 'yaml'
5+
6+
const stringify = reactify(
7+
(input: any) => YAML.stringify(input, (k, v) => {
8+
if (typeof v === 'function') {
9+
return undefined
10+
}
11+
return v
12+
}, {
13+
singleQuote: true,
14+
flowCollectionPadding: false,
15+
}),
16+
)
617
718
const url = shallowRef('https://httpbin.org/get')
819
const refetch = shallowRef(false)

‎packages/core/useFileDialog/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useFileDialog/demo.vue
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { useFileDialog } from './index'
2+
import { useFileDialog } from '@vueuse/core'
33
44
const { files, open, reset, onCancel, onChange } = useFileDialog()
55
onChange((files) => {

‎packages/core/useFileSystemAccess/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useFileSystemAccess/demo.vue
+14-2Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
<script setup lang="ts">
22
import type { ShallowRef } from 'vue'
3-
import { useFileSystemAccess } from '@vueuse/core'
4-
import { stringify } from '@vueuse/docs-utils'
3+
import { reactify, useFileSystemAccess } from '@vueuse/core'
54
import { reactive, shallowRef } from 'vue'
5+
import YAML from 'yaml'
6+
7+
const stringify = reactify(
8+
(input: any) => YAML.stringify(input, (k, v) => {
9+
if (typeof v === 'function') {
10+
return undefined
11+
}
12+
return v
13+
}, {
14+
singleQuote: true,
15+
flowCollectionPadding: false,
16+
}),
17+
)
618
719
const dataType = shallowRef('Text') as ShallowRef<'Text' | 'ArrayBuffer' | 'Blob'>
820
const res = useFileSystemAccess({

‎packages/core/useManualRefHistory/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useManualRefHistory/demo.vue
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script setup lang="ts">
2-
import { formatDate, useManualRefHistory } from '@vueuse/core'
3-
import { useCounter } from '@vueuse/shared'
2+
import { formatDate, useCounter, useManualRefHistory } from '@vueuse/core'
43
54
function format(ts: number) {
65
return formatDate(new Date(ts), 'YYYY-MM-DD HH:mm:ss')

‎packages/core/useMediaControls/demo.vue

Copy file name to clipboardExpand all lines: packages/core/useMediaControls/demo.vue
+14-2Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
<script setup lang="ts">
2-
import { useMediaControls } from '@vueuse/core'
3-
import { stringify } from '@vueuse/docs-utils'
2+
import { reactify, useMediaControls } from '@vueuse/core'
43
import { computed, reactive, shallowRef, useTemplateRef } from 'vue'
4+
import YAML from 'yaml'
55
import Menu from './components/Menu.vue'
66
import MenuItem from './components/MenuItem.vue'
77
import Scrubber from './components/Scrubber.vue'
88
import Spinner from './components/Spinner.vue'
99
10+
const stringify = reactify(
11+
(input: any) => YAML.stringify(input, (k, v) => {
12+
if (typeof v === 'function') {
13+
return undefined
14+
}
15+
return v
16+
}, {
17+
singleQuote: true,
18+
flowCollectionPadding: false,
19+
}),
20+
)
21+
1022
const video = useTemplateRef<HTMLVideoElement>('video')
1123
const loop = shallowRef(false)
1224
const poster = 'https://cdn.bitmovin.com/content/assets/sintel/poster.png'

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.