@nuxt/devtools-ui-kit 3.4.0 → 3.4.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.
- package/dist/components/NBadgeHashed.d.vue.ts +21 -0
- package/dist/components/{NCheckbox.vue → NCheckbox.d.vue.ts} +15 -8
- package/dist/components/NCodeBlock.d.vue.ts +64 -0
- package/dist/components/NDarkToggle.d.vue.ts +78 -0
- package/dist/components/NDialog.d.vue.ts +80 -0
- package/dist/components/NDrawer.d.vue.ts +77 -0
- package/dist/components/{NDropdown.vue → NDropdown.d.vue.ts} +17 -12
- package/dist/components/NIcon.d.vue.ts +9 -0
- package/dist/components/{NIconTitle.vue → NIconTitle.d.vue.ts} +5 -5
- package/dist/components/NLink.d.vue.ts +29 -0
- package/dist/components/{NMarkdown.vue → NMarkdown.d.vue.ts} +9 -6
- package/dist/components/{NNavbar.vue → NNavbar.d.vue.ts} +13 -9
- package/dist/components/NNotification.d.vue.ts +48 -0
- package/dist/components/{NRadio.vue → NRadio.d.vue.ts} +18 -11
- package/dist/components/{NSectionBlock.vue → NSectionBlock.d.vue.ts} +47 -17
- package/dist/components/{NSelect.vue → NSelect.d.vue.ts} +19 -10
- package/dist/components/{NSelectTabs.vue → NSelectTabs.d.vue.ts} +21 -14
- package/dist/components/NSplitPane.d.vue.ts +82 -0
- package/dist/components/{NSwitch.vue → NSwitch.d.vue.ts} +12 -7
- package/dist/components/NTextInput.d.vue.ts +40 -0
- package/dist/components/{NTip.vue → NTip.d.vue.ts} +4 -4
- package/dist/module.json +2 -2
- package/package.json +21 -21
- package/dist/components/NBadgeHashed.vue +0 -19
- package/dist/components/NCodeBlock.vue +0 -38
- package/dist/components/NDarkToggle.vue +0 -60
- package/dist/components/NDialog.vue +0 -63
- package/dist/components/NDrawer.vue +0 -64
- package/dist/components/NIcon.vue +0 -9
- package/dist/components/NLink.vue +0 -27
- package/dist/components/NNotification.vue +0 -44
- package/dist/components/NSplitPane.vue +0 -37
- package/dist/components/NTextInput.vue +0 -28
- /package/dist/components/{NBadge.vue → NBadge.d.vue.ts} +0 -0
- /package/dist/components/{NCard.vue → NCard.d.vue.ts} +0 -0
- /package/dist/components/{NLoading.vue → NLoading.d.vue.ts} +0 -0
- /package/dist/components/{NPanelGrids.vue → NPanelGrids.d.vue.ts} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { getHslColorFromStringHash } from '../composables/color'
|
|
4
|
+
import NBadge from './NBadge.vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
text: string
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const color = computed(() => {
|
|
11
|
+
const foreground = getHslColorFromStringHash(props.text, 50, 60)
|
|
12
|
+
const background = getHslColorFromStringHash(props.text, 50, 60, 0.05)
|
|
13
|
+
return { color: foreground, background }
|
|
14
|
+
})
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<NBadge :style="color">
|
|
19
|
+
{{ text }}<slot />
|
|
20
|
+
</NBadge>
|
|
21
|
+
</template>
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { useVModel } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useVModel } from '@vueuse/core'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(
|
|
5
|
+
defineProps<{
|
|
6
|
+
modelValue?: boolean | null
|
|
7
|
+
disabled?: boolean
|
|
8
|
+
}>(),
|
|
9
|
+
{
|
|
10
|
+
modelValue: false,
|
|
11
|
+
disabled: false,
|
|
12
|
+
},
|
|
13
|
+
)
|
|
14
|
+
const emit = defineEmits<{ (...args: any): void }>()
|
|
15
|
+
const checked = useVModel(props, 'modelValue', emit, { passive: true })
|
|
9
16
|
</script>
|
|
10
17
|
|
|
11
18
|
<template>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { BuiltinLanguage } from 'shiki'
|
|
3
|
+
// This components requires to run in DevTools to render correctly
|
|
4
|
+
import { computed, nextTick } from 'vue'
|
|
5
|
+
import { devToolsClient } from '../runtime/client'
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
code: string
|
|
10
|
+
lang?: BuiltinLanguage | 'text'
|
|
11
|
+
lines?: boolean
|
|
12
|
+
inline?: boolean
|
|
13
|
+
grammarContextCode?: string
|
|
14
|
+
transformRendered?: (code: string) => string
|
|
15
|
+
}>(),
|
|
16
|
+
{
|
|
17
|
+
lines: true,
|
|
18
|
+
},
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
const emit = defineEmits(['loaded'])
|
|
22
|
+
|
|
23
|
+
const rendered = computed(() => {
|
|
24
|
+
const result = props.lang === 'text'
|
|
25
|
+
? { code: props.code, supported: false }
|
|
26
|
+
: devToolsClient.value?.devtools.renderCodeHighlight(props.code, props.lang, { grammarContextCode: props.grammarContextCode }) || { code: props.code, supported: false }
|
|
27
|
+
if (result.supported && props.transformRendered)
|
|
28
|
+
result.code = props.transformRendered(result.code)
|
|
29
|
+
if (result.supported)
|
|
30
|
+
nextTick(() => emit('loaded'))
|
|
31
|
+
return result
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const classes = computed(() => [
|
|
35
|
+
'n-code-block shiki',
|
|
36
|
+
(props.lines && !props.inline) ? 'n-code-block-lines' : '',
|
|
37
|
+
])
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<template v-if="lang && rendered.supported">
|
|
42
|
+
<pre :class="classes"><code v-html="rendered.code" /></pre>
|
|
43
|
+
</template>
|
|
44
|
+
<template v-else>
|
|
45
|
+
<pre :class="classes"><code><template v-for="line, _idx in code.split('\n')" :key="_idx"><span class="line" v-text="line" /><br></template></code></pre>
|
|
46
|
+
</template>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<style>
|
|
50
|
+
.n-code-block-lines code {
|
|
51
|
+
counter-reset: step;
|
|
52
|
+
counter-increment: step calc(var(--start, 1) - 1);
|
|
53
|
+
}
|
|
54
|
+
.n-code-block-lines code .line::before {
|
|
55
|
+
content: counter(step);
|
|
56
|
+
counter-increment: step;
|
|
57
|
+
width: 2.5rem;
|
|
58
|
+
padding-right: 0.5rem;
|
|
59
|
+
margin-right: 0.5rem;
|
|
60
|
+
display: inline-block;
|
|
61
|
+
text-align: right;
|
|
62
|
+
--uno: text-truegray/50;
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useColorMode } from '@vueuse/core'
|
|
3
|
+
|
|
4
|
+
import { computed, nextTick } from 'vue'
|
|
5
|
+
|
|
6
|
+
const mode = useColorMode({
|
|
7
|
+
storageKey: 'nuxt-devtools-color-mode',
|
|
8
|
+
})
|
|
9
|
+
const isDark = computed<boolean>({
|
|
10
|
+
get() {
|
|
11
|
+
return mode.value === 'dark'
|
|
12
|
+
},
|
|
13
|
+
set() {
|
|
14
|
+
mode.value = isDark.value ? 'light' : 'dark'
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const isAppearanceTransition = typeof document !== 'undefined'
|
|
19
|
+
// @ts-expect-error document.startViewTransition can be undefined
|
|
20
|
+
&& document.startViewTransition
|
|
21
|
+
&& !window.matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Credit to [@hooray](https://github.com/hooray)
|
|
25
|
+
* @see https://github.com/vuejs/vitepress/pull/2347
|
|
26
|
+
*/
|
|
27
|
+
function toggle(event?: MouseEvent) {
|
|
28
|
+
if (!isAppearanceTransition || !event) {
|
|
29
|
+
isDark.value = !isDark.value
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const x = event.clientX
|
|
34
|
+
const y = event.clientY
|
|
35
|
+
const endRadius = Math.hypot(
|
|
36
|
+
Math.max(x, innerWidth - x),
|
|
37
|
+
Math.max(y, innerHeight - y),
|
|
38
|
+
)
|
|
39
|
+
const transition = document.startViewTransition(async () => {
|
|
40
|
+
isDark.value = !isDark.value
|
|
41
|
+
await nextTick()
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
transition.ready.then(() => {
|
|
45
|
+
const clipPath = [
|
|
46
|
+
`circle(0px at ${x}px ${y}px)`,
|
|
47
|
+
`circle(${endRadius}px at ${x}px ${y}px)`,
|
|
48
|
+
]
|
|
49
|
+
document.documentElement.animate(
|
|
50
|
+
{
|
|
51
|
+
clipPath: isDark.value
|
|
52
|
+
? clipPath.toReversed()
|
|
53
|
+
: clipPath,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
duration: 400,
|
|
57
|
+
easing: 'ease-in',
|
|
58
|
+
fill: 'forwards',
|
|
59
|
+
pseudoElement: isDark.value
|
|
60
|
+
? '::view-transition-old(root)'
|
|
61
|
+
: '::view-transition-new(root)',
|
|
62
|
+
},
|
|
63
|
+
)
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const context = {
|
|
68
|
+
mode,
|
|
69
|
+
isDark,
|
|
70
|
+
toggle,
|
|
71
|
+
}
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<template>
|
|
75
|
+
<ClientOnly placeholder-tag="span">
|
|
76
|
+
<slot v-bind="context" />
|
|
77
|
+
</ClientOnly>
|
|
78
|
+
</template>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { onClickOutside, useVModel } from '@vueuse/core'
|
|
3
|
+
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
|
|
4
|
+
import { computed, nextTick, ref, watchEffect } from 'vue'
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
modelValue?: boolean
|
|
9
|
+
dim?: boolean
|
|
10
|
+
autoClose?: boolean
|
|
11
|
+
}>(),
|
|
12
|
+
{
|
|
13
|
+
modelValue: false,
|
|
14
|
+
dim: true,
|
|
15
|
+
autoClose: true,
|
|
16
|
+
},
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
const emit = defineEmits<{
|
|
20
|
+
(event: 'close'): void
|
|
21
|
+
(event: 'update:modelValue', value: boolean): void
|
|
22
|
+
}>()
|
|
23
|
+
|
|
24
|
+
const show = useVModel(props, 'modelValue', emit, { passive: true })
|
|
25
|
+
const card = ref(null)
|
|
26
|
+
const shown = ref(false)
|
|
27
|
+
|
|
28
|
+
const { activate, deactivate } = useFocusTrap(computed(() => card.value || document.body), { immediate: false })
|
|
29
|
+
|
|
30
|
+
watchEffect(
|
|
31
|
+
() => {
|
|
32
|
+
if (!shown.value && show.value)
|
|
33
|
+
shown.value = true
|
|
34
|
+
|
|
35
|
+
if (show.value && card.value)
|
|
36
|
+
nextTick(activate)
|
|
37
|
+
else
|
|
38
|
+
deactivate()
|
|
39
|
+
},
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
onClickOutside(card, () => {
|
|
43
|
+
if (props.modelValue && props.autoClose) {
|
|
44
|
+
show.value = false
|
|
45
|
+
emit('close')
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
ignore: ['a', 'button', 'summary'],
|
|
49
|
+
})
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<script lang="ts">
|
|
53
|
+
export default {
|
|
54
|
+
inheritAttrs: false,
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<template>
|
|
59
|
+
<Teleport v-if="shown" to="body">
|
|
60
|
+
<div
|
|
61
|
+
v-show="show"
|
|
62
|
+
class="fixed inset-0 z-100 flex items-center justify-center n-glass-effect n-transition"
|
|
63
|
+
role="dialog"
|
|
64
|
+
aria-modal="true"
|
|
65
|
+
:class="[
|
|
66
|
+
show ? '' : 'op0 pointer-events-none visibility-none',
|
|
67
|
+
]"
|
|
68
|
+
>
|
|
69
|
+
<div
|
|
70
|
+
class="absolute inset-0 -z-1"
|
|
71
|
+
:class="[
|
|
72
|
+
dim ? 'glass-effect' : '',
|
|
73
|
+
]"
|
|
74
|
+
/>
|
|
75
|
+
<NCard v-bind="$attrs" ref="card" class="max-h-screen of-auto">
|
|
76
|
+
<slot />
|
|
77
|
+
</NCard>
|
|
78
|
+
</div>
|
|
79
|
+
</Teleport>
|
|
80
|
+
</template>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { onClickOutside, useElementSize } from '@vueuse/core'
|
|
3
|
+
import { ref } from 'vue'
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<{
|
|
6
|
+
modelValue?: boolean
|
|
7
|
+
top?: HTMLElement | string
|
|
8
|
+
left?: HTMLElement | string
|
|
9
|
+
autoClose?: boolean
|
|
10
|
+
transition?: 'right' | 'bottom' | 'top'
|
|
11
|
+
}>(), {
|
|
12
|
+
transition: 'right',
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits<{
|
|
16
|
+
(e: 'close'): void
|
|
17
|
+
}>()
|
|
18
|
+
|
|
19
|
+
const el = ref<HTMLElement>()
|
|
20
|
+
|
|
21
|
+
const { height } = useElementSize(() => props.top as HTMLElement, undefined, { box: 'border-box' })
|
|
22
|
+
|
|
23
|
+
const width = typeof props.left === 'string' && props.left.startsWith('#')
|
|
24
|
+
? document.querySelector(props.left)?.getBoundingClientRect().width
|
|
25
|
+
: useElementSize(() => props.left as HTMLElement, undefined, { box: 'border-box' }).width
|
|
26
|
+
|
|
27
|
+
onClickOutside(el, () => {
|
|
28
|
+
if (props.modelValue && props.autoClose)
|
|
29
|
+
emit('close')
|
|
30
|
+
}, {
|
|
31
|
+
ignore: ['a', 'button', 'summary', '[role="dialog"]'],
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const transitionType = {
|
|
35
|
+
right: {
|
|
36
|
+
'enter-from-class': 'transform translate-x-1/1',
|
|
37
|
+
'leave-to-class': 'transform translate-x-1/1',
|
|
38
|
+
},
|
|
39
|
+
top: {
|
|
40
|
+
'enter-from-class': 'transform translate-y--1/1',
|
|
41
|
+
'leave-to-class': 'transform translate-y--1/1',
|
|
42
|
+
},
|
|
43
|
+
bottom: {
|
|
44
|
+
'enter-from-class': 'transform translate-y-1/1',
|
|
45
|
+
'leave-to-class': 'transform translate-y-1/1',
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<Transition
|
|
52
|
+
v-bind="transitionType[transition]"
|
|
53
|
+
enter-active-class="duration-200 ease-in"
|
|
54
|
+
enter-to-class="opacity-100"
|
|
55
|
+
leave-active-class="duration-200 ease-out"
|
|
56
|
+
leave-from-class="opacity-100"
|
|
57
|
+
>
|
|
58
|
+
<div
|
|
59
|
+
v-if="modelValue"
|
|
60
|
+
ref="el"
|
|
61
|
+
:border="`${transition === 'right' ? 'l' : transition === 'bottom' ? 't' : 'b'} base`"
|
|
62
|
+
flex="~ col gap-1"
|
|
63
|
+
:class="{ 'right-0': transition === 'right' || transition === 'bottom' }"
|
|
64
|
+
absolute bottom-0 z-10 z-20 of-auto n-glass-effect text-sm
|
|
65
|
+
:style="{
|
|
66
|
+
top: transition === 'bottom' ? 'auto' : `${height}px`,
|
|
67
|
+
left: transition === 'right' && !width ? 'auto' : `${width}px`,
|
|
68
|
+
}"
|
|
69
|
+
v-bind="$attrs"
|
|
70
|
+
>
|
|
71
|
+
<NButton absolute right-2 top-2 z-20 text-xl icon="carbon-close" :border="false" @click="$emit('close')" />
|
|
72
|
+
<div relative h-full w-full of-auto>
|
|
73
|
+
<slot />
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</Transition>
|
|
77
|
+
</template>
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { onClickOutside, useVModel } from
|
|
3
|
-
import { ref } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { onClickOutside, useVModel } from '@vueuse/core'
|
|
3
|
+
import { ref } from 'vue'
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<{
|
|
6
|
+
modelValue?: boolean
|
|
7
|
+
direction?: 'start' | 'end'
|
|
8
|
+
}>(), {
|
|
9
|
+
direction: 'start',
|
|
10
|
+
})
|
|
11
|
+
const emit = defineEmits<{ (...args: any): void }>()
|
|
12
|
+
|
|
13
|
+
const enabled = useVModel(props, 'modelValue', emit, { passive: true })
|
|
14
|
+
const el = ref<HTMLDivElement>()
|
|
15
|
+
|
|
11
16
|
onClickOutside(el, () => {
|
|
12
|
-
enabled.value = false
|
|
13
|
-
})
|
|
17
|
+
enabled.value = false
|
|
18
|
+
})
|
|
14
19
|
</script>
|
|
15
20
|
|
|
16
21
|
<template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
to?: string
|
|
6
|
+
href?: string
|
|
7
|
+
target?: string
|
|
8
|
+
underline?: boolean
|
|
9
|
+
}>()
|
|
10
|
+
|
|
11
|
+
const link = computed(() => props.href || props.to)
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<NuxtLink
|
|
16
|
+
v-bind="link ? {
|
|
17
|
+
href: link,
|
|
18
|
+
target,
|
|
19
|
+
rel: target === '_blank' ? 'noopener noreferrer' : undefined,
|
|
20
|
+
} : {}"
|
|
21
|
+
:class="{ 'n-link n-transition hover:n-link-hover n-link-base': link || underline }"
|
|
22
|
+
>
|
|
23
|
+
<slot />
|
|
24
|
+
<div
|
|
25
|
+
v-if="link && target === '_blank'"
|
|
26
|
+
i-carbon:arrow-up-right translate-y--1 text-xs op50
|
|
27
|
+
/>
|
|
28
|
+
</NuxtLink>
|
|
29
|
+
</template>
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// This components requires to run in DevTools to render correctly
|
|
3
|
+
|
|
4
|
+
import { devToolsClient } from '../runtime/client'
|
|
5
|
+
|
|
6
|
+
defineProps<{
|
|
7
|
+
markdown: string
|
|
8
|
+
tag?: string
|
|
9
|
+
}>()
|
|
7
10
|
</script>
|
|
8
11
|
|
|
9
12
|
<template>
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
defineProps
|
|
3
|
-
search
|
|
4
|
-
noPadding
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
search?: string
|
|
4
|
+
noPadding?: boolean
|
|
5
|
+
}>()
|
|
6
|
+
|
|
7
|
+
const emit = defineEmits<{
|
|
8
|
+
(event: 'update:search', value: string): void
|
|
9
|
+
}>()
|
|
10
|
+
|
|
11
|
+
function update(event: any) {
|
|
12
|
+
emit('update:search', event.target.value)
|
|
9
13
|
}
|
|
10
14
|
</script>
|
|
11
15
|
|
|
@@ -14,7 +18,7 @@ function update(event) {
|
|
|
14
18
|
<div flex="~ gap4 wrap" items-center>
|
|
15
19
|
<slot name="search">
|
|
16
20
|
<NTextInput
|
|
17
|
-
v-if="search !==
|
|
21
|
+
v-if="search !== undefined"
|
|
18
22
|
placeholder="Search..."
|
|
19
23
|
icon="carbon-search"
|
|
20
24
|
n="primary" flex-auto
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script setup lang='ts'>
|
|
2
|
+
import type { DevtoolsUiShowNotificationPosition } from '../composables/notification'
|
|
3
|
+
|
|
4
|
+
import { ref } from 'vue'
|
|
5
|
+
import { devtoolsUiProvideNotificationFn } from '../composables/notification'
|
|
6
|
+
|
|
7
|
+
const show = ref(false)
|
|
8
|
+
const icon = ref<string>()
|
|
9
|
+
const text = ref<string>()
|
|
10
|
+
const classes = ref<string>()
|
|
11
|
+
const position = ref<DevtoolsUiShowNotificationPosition>('top-center')
|
|
12
|
+
|
|
13
|
+
devtoolsUiProvideNotificationFn((data) => {
|
|
14
|
+
text.value = data.message
|
|
15
|
+
icon.value = data.icon
|
|
16
|
+
classes.value = data.classes ?? 'text-primary border-primary'
|
|
17
|
+
icon.value = data.icon
|
|
18
|
+
show.value = true
|
|
19
|
+
position.value = data.position ?? 'top-center'
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
show.value = false
|
|
22
|
+
}, data.duration ?? 1500)
|
|
23
|
+
})
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<div
|
|
28
|
+
fixed left-0 right-0 z-999 text-center
|
|
29
|
+
:class="[
|
|
30
|
+
{ 'pointer-events-none overflow-hidden': !show },
|
|
31
|
+
{ 'top-0': position.startsWith('top') },
|
|
32
|
+
{ 'bottom-0': position.startsWith('bottom') },
|
|
33
|
+
]"
|
|
34
|
+
>
|
|
35
|
+
<div flex :style="{ justifyContent: position.includes('right') ? 'right' : position.includes('left') ? 'left' : 'center' }">
|
|
36
|
+
<div
|
|
37
|
+
border="~ base"
|
|
38
|
+
flex="~ inline gap2"
|
|
39
|
+
m-3 inline-block items-center rounded bg-base px-4 py-1 transition-all duration-300
|
|
40
|
+
:style="show ? {} : { transform: `translateY(${position.startsWith('top') ? '-' : ''}300%)` }"
|
|
41
|
+
:class="[show ? 'shadow' : 'shadow-none', classes]"
|
|
42
|
+
>
|
|
43
|
+
<div v-if="icon" :class="icon" />
|
|
44
|
+
<div>{{ text }}</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { useVModel } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useVModel } from '@vueuse/core'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(
|
|
5
|
+
defineProps<{
|
|
6
|
+
modelValue?: string
|
|
7
|
+
disabled?: boolean
|
|
8
|
+
name?: string
|
|
9
|
+
value?: string
|
|
10
|
+
}>(),
|
|
11
|
+
{
|
|
12
|
+
modelValue: '',
|
|
13
|
+
disabled: false,
|
|
14
|
+
},
|
|
15
|
+
)
|
|
16
|
+
const emit = defineEmits<{ (...args: any): void }>()
|
|
17
|
+
const model = useVModel(props, 'modelValue', emit, { passive: true })
|
|
11
18
|
</script>
|
|
12
19
|
|
|
13
20
|
<template>
|
|
@@ -23,7 +30,7 @@ const model = useVModel(props, "modelValue", emit, { passive: true });
|
|
|
23
30
|
:disabled="disabled"
|
|
24
31
|
:name="name"
|
|
25
32
|
:value="value"
|
|
26
|
-
@keypress.enter="model = value"
|
|
33
|
+
@keypress.enter="model = value!"
|
|
27
34
|
>
|
|
28
35
|
<span class="n-radio-box n-transition n-checked:n-radio-box-checked peer-active:n-active-base peer-focus-visible:n-focus-base">
|
|
29
36
|
<div class="n-radio-inner n-transition n-checked:n-radio-inner-checked" />
|
|
@@ -1,25 +1,35 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { useVModel } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useVModel } from '@vueuse/core'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(
|
|
5
|
+
defineProps<{
|
|
6
|
+
icon?: string
|
|
7
|
+
text?: string
|
|
8
|
+
description?: string
|
|
9
|
+
containerClass?: string
|
|
10
|
+
headerClass?: string
|
|
11
|
+
collapse?: boolean
|
|
12
|
+
open?: boolean
|
|
13
|
+
padding?: boolean | string
|
|
14
|
+
}>(),
|
|
15
|
+
{
|
|
16
|
+
containerClass: '',
|
|
17
|
+
open: true,
|
|
18
|
+
padding: true,
|
|
19
|
+
collapse: true,
|
|
20
|
+
},
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const open = useVModel(props, 'open', undefined, { passive: true })
|
|
24
|
+
function onToggle(e: any) {
|
|
25
|
+
open.value = e.target.open
|
|
16
26
|
}
|
|
17
27
|
</script>
|
|
18
28
|
|
|
19
29
|
<template>
|
|
20
30
|
<!-- TODO: Seems something wrong with the DOM type -->
|
|
21
31
|
<!-- @vue-ignore -->
|
|
22
|
-
<details :open="open" @toggle="onToggle">
|
|
32
|
+
<details :open="open" @toggle="(onToggle as any)">
|
|
23
33
|
<summary
|
|
24
34
|
class="cursor-pointer select-none p4 hover:bg-active"
|
|
25
35
|
:class="collapse ? '' : 'pointer-events-none'"
|
|
@@ -63,5 +73,25 @@ function onToggle(e) {
|
|
|
63
73
|
</template>
|
|
64
74
|
|
|
65
75
|
<style scoped>
|
|
66
|
-
details
|
|
76
|
+
details {
|
|
77
|
+
--at-apply: border-none;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
summary {
|
|
81
|
+
--at-apply: border-none;
|
|
82
|
+
list-style: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
details[open] summary {
|
|
86
|
+
--at-apply: border-none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
details summary::-webkit-details-marker {
|
|
90
|
+
display: none;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
details[open] .chevron {
|
|
94
|
+
transform: rotate(180deg);
|
|
95
|
+
opacity: 0.75;
|
|
96
|
+
}
|
|
67
97
|
</style>
|