@nuxt/devtools-ui-kit-nightly 2.0.0-28980754.13f6fd0

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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +129 -0
  3. package/dist/assets/styles.css +1 -0
  4. package/dist/components/NBadge.vue +5 -0
  5. package/dist/components/NButton.vue +34 -0
  6. package/dist/components/NCard.vue +5 -0
  7. package/dist/components/NCheckbox.vue +36 -0
  8. package/dist/components/NCodeBlock.vue +50 -0
  9. package/dist/components/NDarkToggle.vue +77 -0
  10. package/dist/components/NDialog.vue +80 -0
  11. package/dist/components/NDrawer.vue +77 -0
  12. package/dist/components/NDropdown.vue +36 -0
  13. package/dist/components/NIcon.vue +9 -0
  14. package/dist/components/NIconTitle.vue +15 -0
  15. package/dist/components/NLink.vue +29 -0
  16. package/dist/components/NLoading.vue +10 -0
  17. package/dist/components/NMarkdown.vue +19 -0
  18. package/dist/components/NNavbar.vue +34 -0
  19. package/dist/components/NNotification.vue +48 -0
  20. package/dist/components/NPanelGrids.vue +5 -0
  21. package/dist/components/NRadio.vue +40 -0
  22. package/dist/components/NSectionBlock.vue +77 -0
  23. package/dist/components/NSelect.vue +37 -0
  24. package/dist/components/NSelectTabs.vue +49 -0
  25. package/dist/components/NSplitPane.vue +47 -0
  26. package/dist/components/NSwitch.vue +34 -0
  27. package/dist/components/NTextInput.vue +40 -0
  28. package/dist/components/NTip.vue +16 -0
  29. package/dist/composables/notification.d.ts +9 -0
  30. package/dist/composables/notification.mjs +7 -0
  31. package/dist/module.cjs +5 -0
  32. package/dist/module.d.mts +12 -0
  33. package/dist/module.d.ts +12 -0
  34. package/dist/module.json +9 -0
  35. package/dist/module.mjs +38 -0
  36. package/dist/runtime/client.d.ts +1 -0
  37. package/dist/runtime/client.js +2 -0
  38. package/dist/runtime/client.mjs +2 -0
  39. package/dist/types.d.mts +1 -0
  40. package/dist/types.d.ts +1 -0
  41. package/dist/unocss.d.mts +7 -0
  42. package/dist/unocss.d.ts +7 -0
  43. package/dist/unocss.mjs +168 -0
  44. package/module.cjs +6 -0
  45. package/package.json +68 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022-PRESENT Nuxt Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,129 @@
1
+ <a href="https://devtools.nuxt.com"><img width="1200" alt="Nuxt DevTools" src="https://github-production-user-asset-6210df.s3.amazonaws.com/904724/261577617-a10567bd-ad33-48cc-9bda-9e37dbe1929f.png"></a>
2
+ <br>
3
+
4
+ <h1>
5
+ Nuxt DevTools
6
+ </h1>
7
+
8
+ [![npm version][npm-version-src]][npm-version-href]
9
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
10
+ [![License][license-src]][license-href]
11
+ [![Nuxt][nuxt-src]][nuxt-href]
12
+ [![Volta][volta-src]][volta-href]
13
+
14
+ <p>
15
+ Unleash Nuxt Developer Experience.
16
+ <br>Nuxt DevTools is a set of visual tools that help you to know your app better.
17
+ </p>
18
+
19
+ <p>
20
+ <a href="https://nuxt.com/blog/nuxt-devtools-v1-0">πŸ‘‹ Introduction</a> |
21
+ <a href="https://github.com/nuxt/devtools/discussions/29">πŸ’‘ Ideas & Suggestions</a> |
22
+ <a href="https://github.com/nuxt/devtools/discussions/31">πŸ—ΊοΈ Project Roadmap</a> |
23
+ <a href="https://devtools.nuxt.com/">πŸ“š Documentation</a>
24
+ </p>
25
+
26
+ <br>
27
+
28
+ > [!NOTE]
29
+ > You are viewing the v2.x branch which are in active development. For the latest stable version, please refer to the [v1.x branch](https://github.com/nuxt/devtools/tree/v1)
30
+
31
+ ## Installation
32
+
33
+ > Nuxt DevTools v2 requires **Nuxt v3.15.0 or higher**.
34
+
35
+ Nuxt DevTools is **enabled by default** in Nuxt v3.8.0. You can press <kbd>Shift</kbd> + <kbd>Alt</kbd> / <kbd>⇧ Shift</kbd> + <kbd>βŒ₯ Option</kbd> + <kbd>D</kbd> in your app to open it up.
36
+
37
+ If you want to explicitly enable or disable Nuxt DevTools, you can update your `nuxt.config` with:
38
+
39
+ ```js
40
+ export default defineNuxtConfig({
41
+ devtools: {
42
+ enabled: true // or false to disable
43
+ }
44
+ })
45
+ ```
46
+
47
+ ### Nightly Release Channel
48
+
49
+ Similar to [Nuxt's Nightly Channel](https://nuxt.com/docs/guide/going-further/nightly-release-channel), DevTools also offers a nightly release channel, that automatically releases for every commit to `main` branch.
50
+
51
+ You can opt-in to the nightly release channel by running:
52
+
53
+ ```diff
54
+ {
55
+ "devDependencies": {
56
+ -- "@nuxt/devtools": "^0.1.0"
57
+ ++ "@nuxt/devtools": "npm:@nuxt/devtools-nightly@latest"
58
+ }
59
+ }
60
+ ```
61
+
62
+ Remove lockfile (`package-lock.json`, `yarn.lock`, or `pnpm-lock.yaml`) and reinstall dependencies.
63
+
64
+ ### Module Options
65
+
66
+ To configure Nuxt DevTools, you can pass the `devtools` options.
67
+
68
+ ```ts
69
+ // nuxt.config.ts
70
+ export default defineNuxtConfig({
71
+ devtools: {
72
+ // Enable devtools (default: true)
73
+ enabled: true,
74
+ // VS Code Server options
75
+ vscode: {},
76
+ // ...other options
77
+ }
78
+ })
79
+ ```
80
+
81
+ For all options available, please refer to TSDocs in your IDE, or the [type definition file](https://github.com/nuxt/devtools/blob/main/packages/devtools-kit/src/_types/options.ts).
82
+
83
+ ## Features
84
+
85
+ Read the [**Announcement Blog Post 🎊**](https://nuxt.com/blog/nuxt-devtools-v1-0) for why we built Nuxt DevTools and what it can do!
86
+
87
+ ## Module Authors
88
+
89
+ Please refer to the [Module Authors Guide](https://devtools.nuxt.com/module/guide).
90
+
91
+ ## Contribution Guide
92
+
93
+ Please refer to the [Contribution Guide](https://devtools.nuxt.com/development/contributing).
94
+
95
+ ## Anonymous Usage Analytics
96
+
97
+ Nuxt DevTools collects anonymous telemetry data about general usage. This helps us to accurately gauge feature usage and customization across all our users. This data will let us better understand how each features in Nuxt DevTools are used, measuring improvements made (DX and performances) and their relevance. It would also help us to prioritize our efforts and focus on the features that matter the most to our users.
98
+
99
+ Nuxt DevTools' telemetry data is piped through [Nuxt Telemetry](https://github.com/nuxt/telemetry), meaning that Nuxt DevTools will respect your local and global Nuxt Telemetry settings. You can also opt-out Nuxt DevTools' telemetry in the Nuxt DevTools settings.
100
+
101
+ The data we collect is completely anonymous, not traceable to the source (using hash+seed), and only meaningful in aggregate form. No data we collect is personally identifiable or trackable.
102
+
103
+ ### Events
104
+
105
+ On top of the [default Nuxt Telemetry events](https://github.com/nuxt/telemetry#events), Nuxt DevTools also collects the following events:
106
+
107
+ - Versions of Nuxt DevTools
108
+ - Navigations between tabs/feature
109
+ - This helps us to understand which features are used the most to prioritize our efforts.
110
+ - Browser and OS names and versions
111
+ - This helps us improve compatibility across different browsers and operating systems.
112
+ - Click event on some action buttons
113
+
114
+ ## License
115
+
116
+ [MIT](./LICENSE)
117
+
118
+ <!-- Badges -->
119
+
120
+ [npm-version-src]: https://img.shields.io/npm/v/@nuxt/devtools/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
121
+ [npm-version-href]: https://npmjs.com/package/@nuxt/devtools
122
+ [npm-downloads-src]: https://img.shields.io/npm/dm/@nuxt/devtools.svg?style=flat&colorA=18181B&colorB=28CF8D
123
+ [npm-downloads-href]: https://npm.chart.dev/@nuxt/devtools
124
+ [license-src]: https://img.shields.io/npm/l/@nuxt/devtools.svg?style=flat&colorA=18181B&colorB=28CF8D
125
+ [license-href]: https://npmjs.com/package/@nuxt/devtools
126
+ [nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
127
+ [nuxt-href]: https://nuxt.com
128
+ [volta-src]: https://user-images.githubusercontent.com/904724/209143798-32345f6c-3cf8-4e06-9659-f4ace4a6acde.svg
129
+ [volta-href]: https://volta.net/nuxt/devtools?utm_source=nuxt_devtools_readme
@@ -0,0 +1 @@
1
+ :root{--nui-c-context:125,125,125}html{background-color:#fff}html.dark{background-color:#151515;color:#fff;color-scheme:dark}::-moz-selection{background:#8884}::selection{background:#8884}.shiki .line{display:inline-block;position:relative;width:100%}.shiki.diff .line>span{filter:saturate(.75);opacity:.75}.shiki.diff .line-added,.shiki.diff .line-removed{scroll-margin:5em}.shiki.diff .line-added>span,.shiki.diff .line-removed>span{opacity:1!important;position:inherit;scroll-margin:20px;z-index:100}.shiki.diff .line-added>span{color:#218c3b!important}.shiki.diff .line-removed>span{color:#d15547!important}.shiki .line-added:after{background-color:#43885420}.shiki .line-added:after,.shiki .line-removed:after{bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.shiki .line-removed:after{background-color:#8f4c3926}::view-transition-new(root),::view-transition-old(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:2147483646}.dark::view-transition-old(root){z-index:2147483646}.dark::view-transition-new(root){z-index:1}
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <span class="n-badge">
3
+ <slot />
4
+ </span>
5
+ </template>
@@ -0,0 +1,34 @@
1
+ <script setup lang="ts">
2
+ // eslint-disable-next-line ts/ban-ts-comment
3
+ // @ts-ignore tsconfig
4
+ import { NuxtLink } from '#components'
5
+
6
+ withDefaults(defineProps<{
7
+ to?: string
8
+ icon?: string
9
+ border?: boolean
10
+ disabled?: boolean
11
+ type?: 'submit' | 'reset' | 'button'
12
+ }>(), {
13
+ border: true,
14
+ type: 'button',
15
+ })
16
+ </script>
17
+
18
+ <template>
19
+ <Component
20
+ :is="to ? NuxtLink : 'button'"
21
+ :to="to"
22
+ v-bind="{ ...$attrs, ...(!to && { type }), ...(disabled ? { disabled: true } : { tabindex: 0 }) }"
23
+ :class="[
24
+ { 'n-button-base active:n-button-active focus-visible:n-focus-base hover:n-button-hover': border },
25
+ { 'n-icon-button': !$slots.default },
26
+ ]"
27
+ class="n-button n-transition n-disabled:n-disabled"
28
+ >
29
+ <slot name="icon">
30
+ <NIcon v-if="icon" :icon="icon" :class="{ 'n-button-icon': $slots.default }" />
31
+ </slot>
32
+ <slot />
33
+ </Component>
34
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="n-card n-card-base">
3
+ <slot />
4
+ </div>
5
+ </template>
@@ -0,0 +1,36 @@
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 })
16
+ </script>
17
+
18
+ <template>
19
+ <label
20
+ class="n-checkbox hover:n-checkbox-hover select-none items-center n-disabled:n-disabled"
21
+ :checked="checked || null"
22
+ :disabled="disabled || null"
23
+ >
24
+ <input
25
+ v-model="checked"
26
+ type="checkbox"
27
+ class="peer absolute op0"
28
+ :disabled="disabled"
29
+ @keypress.enter="checked = !checked"
30
+ >
31
+ <span class="n-checkbox-box n-checked:n-checkbox-box-checked peer-active:n-active-base peer-focus-visible:n-focus-base n-transition">
32
+ <NIcon class="n-checkbox-icon scale-0 transform op0 n-transition n-checked:scale-100 n-checked:op100" />
33
+ </span>
34
+ <span :class="checked ? '' : 'op50'" class="n-transition"><slot /></span>
35
+ </label>
36
+ </template>
@@ -0,0 +1,50 @@
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
+ transformRendered?: (code: string) => string
14
+ }>(),
15
+ {
16
+ lines: true,
17
+ },
18
+ )
19
+
20
+ const emit = defineEmits(['loaded'])
21
+
22
+ const rendered = computed(() => {
23
+ const result = props.lang === 'text'
24
+ ? { code: props.code, supported: false }
25
+ : devToolsClient.value?.devtools.renderCodeHighlight(props.code, props.lang) || { code: props.code, supported: false }
26
+ if (result.supported && props.transformRendered)
27
+ result.code = props.transformRendered(result.code)
28
+ if (result.supported)
29
+ nextTick(() => emit('loaded'))
30
+ return result
31
+ })
32
+
33
+ const classes = computed(() => [
34
+ 'n-code-block shiki',
35
+ (props.lines && !props.inline) ? 'n-code-block-lines' : '',
36
+ ])
37
+ </script>
38
+
39
+ <template>
40
+ <template v-if="lang && rendered.supported">
41
+ <pre :class="classes"><code v-html="rendered.code" /></pre>
42
+ </template>
43
+ <template v-else>
44
+ <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>
45
+ </template>
46
+ </template>
47
+
48
+ <style>
49
+ .n-code-block-lines code{counter-increment:step calc(var(--start, 1) - 1);counter-reset:step}.n-code-block-lines code .line:before{content:counter(step);counter-increment:step;display:inline-block;margin-right:.5rem;padding-right:.5rem;text-align:right;width:2.5rem;--uno:text-truegray/50}
50
+ </style>
@@ -0,0 +1,77 @@
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].reverse()
53
+ : clipPath,
54
+ },
55
+ {
56
+ duration: 400,
57
+ easing: 'ease-in',
58
+ pseudoElement: isDark.value
59
+ ? '::view-transition-old(root)'
60
+ : '::view-transition-new(root)',
61
+ },
62
+ )
63
+ })
64
+ }
65
+
66
+ const context = {
67
+ mode,
68
+ isDark,
69
+ toggle,
70
+ }
71
+ </script>
72
+
73
+ <template>
74
+ <ClientOnly placeholder-tag="span">
75
+ <slot v-bind="context" />
76
+ </ClientOnly>
77
+ </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-transition n-glass-effect"
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 text-sm n-glass-effect
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>
@@ -0,0 +1,36 @@
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
+
16
+ onClickOutside(el, () => {
17
+ enabled.value = false
18
+ })
19
+ </script>
20
+
21
+ <template>
22
+ <div ref="el" class="relative">
23
+ <slot name="trigger" :enabled="enabled" :click="() => enabled = !enabled">
24
+ <NButton @click="enabled = !enabled">
25
+ Dropdown
26
+ </NButton>
27
+ </slot>
28
+
29
+ <div
30
+ class="absolute z-10 border n-border-base rounded shadow n-transition n-bg-base"
31
+ :class="[enabled ? 'op-100' : 'op0 pointer-events-none -translate-y-1', direction === 'end' ? 'right-0' : 'left-0']"
32
+ >
33
+ <slot />
34
+ </div>
35
+ </div>
36
+ </template>
@@ -0,0 +1,9 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ icon?: string
4
+ }>()
5
+ </script>
6
+
7
+ <template>
8
+ <div class="n-icon" :class="icon" />
9
+ </template>
@@ -0,0 +1,15 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ icon?: string
4
+ text?: string
5
+ }>()
6
+ </script>
7
+
8
+ <template>
9
+ <div flex="~ gap-3" items-center>
10
+ <div v-if="icon" :class="icon" />
11
+ <slot>
12
+ <div>{{ text }}</div>
13
+ </slot>
14
+ </div>
15
+ </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' : null,
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>
@@ -0,0 +1,10 @@
1
+ <template>
2
+ <div class="n-loading n-panel-grids-center">
3
+ <div class="flex flex-col animate-pulse items-center text-lg">
4
+ <div class="i-carbon-circle-dash animate-spin text-4xl op50" />
5
+ <slot>
6
+ Loading...
7
+ </slot>
8
+ </div>
9
+ </div>
10
+ </template>
@@ -0,0 +1,19 @@
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
+ }>()
10
+ </script>
11
+
12
+ <template>
13
+ <template v-if="markdown && devToolsClient?.devtools?.renderMarkdown">
14
+ <component :is="tag || 'span'" class="n-markdown" v-html="devToolsClient.devtools.renderMarkdown(markdown)" />
15
+ </template>
16
+ <template v-else>
17
+ <component :is="tag || 'span'" class="n-markdown" v-text="markdown" />
18
+ </template>
19
+ </template>