@nuxt/devtools-ui-kit 3.3.1 → 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
|
@@ -1,13 +1,22 @@
|
|
|
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?: any
|
|
7
|
+
placeholder?: string
|
|
8
|
+
icon?: string
|
|
9
|
+
disabled?: boolean
|
|
10
|
+
}>(),
|
|
11
|
+
{
|
|
12
|
+
modelValue: undefined,
|
|
13
|
+
placeholder: '',
|
|
14
|
+
disabled: false,
|
|
15
|
+
icon: '',
|
|
16
|
+
},
|
|
17
|
+
)
|
|
18
|
+
const emit = defineEmits<{ (...args: any): void }>()
|
|
19
|
+
const input = useVModel(props, 'modelValue', emit, { passive: true })
|
|
11
20
|
</script>
|
|
12
21
|
|
|
13
22
|
<template>
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { useVModel } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useVModel } from '@vueuse/core'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(
|
|
5
|
+
defineProps<{
|
|
6
|
+
modelValue?: any
|
|
7
|
+
disabled?: boolean
|
|
8
|
+
options: { value: any, label: string }[]
|
|
9
|
+
}>(),
|
|
10
|
+
{
|
|
11
|
+
modelValue: undefined,
|
|
12
|
+
disabled: false,
|
|
13
|
+
},
|
|
14
|
+
)
|
|
15
|
+
const emit = defineEmits<{ (...args: any): void }>()
|
|
16
|
+
const input = useVModel(props, 'modelValue', emit, { passive: true })
|
|
10
17
|
</script>
|
|
11
18
|
|
|
12
19
|
<template>
|
|
@@ -19,15 +26,15 @@ const input = useVModel(props, "modelValue", emit, { passive: true });
|
|
|
19
26
|
:disabled="disabled"
|
|
20
27
|
class="relative n-border-base px-0.5em py-0.1em hover:n-bg-active"
|
|
21
28
|
:class="[
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
]"
|
|
29
|
+
idx ? 'border-l n-border-base ml--1px' : '',
|
|
30
|
+
i.value === input ? 'n-bg-active' : '',
|
|
31
|
+
]"
|
|
25
32
|
:title="i.label"
|
|
26
33
|
>
|
|
27
34
|
<div
|
|
28
35
|
:class="[
|
|
29
|
-
|
|
30
|
-
]"
|
|
36
|
+
i.value === input ? '' : 'op35',
|
|
37
|
+
]"
|
|
31
38
|
>{{ i.label }}</div>
|
|
32
39
|
<input
|
|
33
40
|
v-model="input"
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useLocalStorage } from '@vueuse/core'
|
|
3
|
+
import { Pane, Splitpanes } from 'splitpanes'
|
|
4
|
+
import { computed, ref } from 'vue'
|
|
5
|
+
|
|
6
|
+
import 'splitpanes/dist/splitpanes.css'
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(defineProps<{
|
|
9
|
+
/**
|
|
10
|
+
* The key to use for storing the pane sizes in localStorage.
|
|
11
|
+
*/
|
|
12
|
+
storageKey?: string
|
|
13
|
+
stateKey?: string
|
|
14
|
+
leftSize?: number
|
|
15
|
+
minSize?: number
|
|
16
|
+
horizontal?: boolean
|
|
17
|
+
}>(), {
|
|
18
|
+
stateKey: 'nuxt-devtools-panels-state',
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const state = useLocalStorage<Record<string, number>>(props.stateKey, {} as any, { listenToStorageChanges: false })
|
|
22
|
+
|
|
23
|
+
const DEFAULT = 30
|
|
24
|
+
|
|
25
|
+
const key = props.storageKey
|
|
26
|
+
const size = key
|
|
27
|
+
? computed({
|
|
28
|
+
get: () => state.value[key] || props.leftSize || DEFAULT,
|
|
29
|
+
set: (v) => { state.value[key] = v },
|
|
30
|
+
})
|
|
31
|
+
: ref(props.leftSize || DEFAULT)
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<Splitpanes :horizontal="horizontal" h-full of-hidden @resize="size = $event[0].size">
|
|
36
|
+
<Pane h-full class="of-auto!" :size="size" :min-size="$slots.right ? (minSize || 10) : 100">
|
|
37
|
+
<slot name="left" />
|
|
38
|
+
</Pane>
|
|
39
|
+
<Pane v-if="$slots.right" relative h-full class="of-auto!" :min-size="minSize || 10">
|
|
40
|
+
<slot name="right" />
|
|
41
|
+
</Pane>
|
|
42
|
+
</Splitpanes>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<style>
|
|
46
|
+
.splitpanes__splitter {
|
|
47
|
+
position: relative;
|
|
48
|
+
}
|
|
49
|
+
.splitpanes__splitter:before {
|
|
50
|
+
position: absolute;
|
|
51
|
+
left: 0;
|
|
52
|
+
top: 0;
|
|
53
|
+
transition: 0.2s ease;
|
|
54
|
+
content: '';
|
|
55
|
+
transition: opacity 0.4s;
|
|
56
|
+
z-index: 1;
|
|
57
|
+
}
|
|
58
|
+
.splitpanes__splitter:hover:before {
|
|
59
|
+
background: #8881;
|
|
60
|
+
opacity: 1;
|
|
61
|
+
}
|
|
62
|
+
.splitpanes--vertical > .splitpanes__splitter {
|
|
63
|
+
min-width: 0 !important;
|
|
64
|
+
width: 0 !important;
|
|
65
|
+
--at-apply: border-r border-base;
|
|
66
|
+
}
|
|
67
|
+
.splitpanes--horizontal > .splitpanes__splitter {
|
|
68
|
+
min-height: 0 !important;
|
|
69
|
+
height: 0 !important;
|
|
70
|
+
--at-apply: border-t border-base;
|
|
71
|
+
}
|
|
72
|
+
.splitpanes--vertical > .splitpanes__splitter:before {
|
|
73
|
+
left: -5px;
|
|
74
|
+
right: -4px;
|
|
75
|
+
height: 100%;
|
|
76
|
+
}
|
|
77
|
+
.splitpanes--horizontal > .splitpanes__splitter:before {
|
|
78
|
+
top: -5px;
|
|
79
|
+
bottom: -4px;
|
|
80
|
+
width: 100%;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
withDefaults(
|
|
3
|
+
defineProps<{
|
|
4
|
+
disabled?: boolean
|
|
5
|
+
}>(),
|
|
6
|
+
{
|
|
7
|
+
disabled: false,
|
|
8
|
+
},
|
|
9
|
+
)
|
|
10
|
+
const checked = defineModel('modelValue', {
|
|
6
11
|
type: Boolean,
|
|
7
|
-
default: false
|
|
8
|
-
})
|
|
12
|
+
default: false,
|
|
13
|
+
})
|
|
9
14
|
</script>
|
|
10
15
|
|
|
11
16
|
<template>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useVModel } from '@vueuse/core'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(
|
|
5
|
+
defineProps<{
|
|
6
|
+
modelValue?: string | number
|
|
7
|
+
icon?: string
|
|
8
|
+
placeholder?: string
|
|
9
|
+
disabled?: boolean
|
|
10
|
+
autofocus?: boolean
|
|
11
|
+
autocomplete?: string
|
|
12
|
+
readonly?: boolean
|
|
13
|
+
type?: string
|
|
14
|
+
}>(),
|
|
15
|
+
{
|
|
16
|
+
modelValue: '',
|
|
17
|
+
type: 'text',
|
|
18
|
+
},
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
const emit = defineEmits<{
|
|
22
|
+
(name: 'keydown', event: KeyboardEvent): void
|
|
23
|
+
(name: 'keyup', event: KeyboardEvent): void
|
|
24
|
+
(name: 'change', event: Event): void
|
|
25
|
+
}>()
|
|
26
|
+
const input = useVModel(props, 'modelValue', emit, { passive: true })
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<div class="n-text-input flex flex items-center border n-border-base rounded n-bg-base py-1 pl-1 pr-2 focus-within:border-context focus-within:n-focus-base">
|
|
31
|
+
<slot name="icon">
|
|
32
|
+
<NIcon v-if="icon" :icon="icon" class="ml-0.3em mr-0.1em text-1.1em op50" />
|
|
33
|
+
</slot>
|
|
34
|
+
<input
|
|
35
|
+
v-model="input"
|
|
36
|
+
v-bind="$props as any"
|
|
37
|
+
class="ml-0.4em w-full flex-auto n-bg-base !outline-none"
|
|
38
|
+
>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
package/dist/module.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/devtools-ui-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://devtools.nuxt.com/module/ui-kit",
|
|
7
7
|
"repository": {
|
|
@@ -28,33 +28,33 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@nuxt/devtools": "3.
|
|
31
|
+
"@nuxt/devtools": "3.4.1"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@iconify-json/carbon": "^1.2.
|
|
35
|
-
"@iconify-json/logos": "^1.2.
|
|
34
|
+
"@iconify-json/carbon": "^1.2.25",
|
|
35
|
+
"@iconify-json/logos": "^1.2.12",
|
|
36
36
|
"@iconify-json/ri": "^1.2.10",
|
|
37
|
-
"@iconify-json/tabler": "^1.2.
|
|
38
|
-
"@nuxt/kit": "^4.
|
|
39
|
-
"@unocss/core": "^66.
|
|
40
|
-
"@unocss/nuxt": "^66.
|
|
41
|
-
"@unocss/preset-attributify": "^66.
|
|
42
|
-
"@unocss/preset-icons": "^66.
|
|
43
|
-
"@unocss/preset-mini": "^66.
|
|
44
|
-
"@unocss/reset": "^66.
|
|
45
|
-
"@vueuse/core": "^14.
|
|
46
|
-
"@vueuse/integrations": "^14.
|
|
47
|
-
"@vueuse/nuxt": "^14.
|
|
37
|
+
"@iconify-json/tabler": "^1.2.38",
|
|
38
|
+
"@nuxt/kit": "^4.5.1",
|
|
39
|
+
"@unocss/core": "^66.7.5",
|
|
40
|
+
"@unocss/nuxt": "^66.7.5",
|
|
41
|
+
"@unocss/preset-attributify": "^66.7.5",
|
|
42
|
+
"@unocss/preset-icons": "^66.7.5",
|
|
43
|
+
"@unocss/preset-mini": "^66.7.5",
|
|
44
|
+
"@unocss/reset": "^66.7.5",
|
|
45
|
+
"@vueuse/core": "^14.4.0",
|
|
46
|
+
"@vueuse/integrations": "^14.4.0",
|
|
47
|
+
"@vueuse/nuxt": "^14.4.0",
|
|
48
48
|
"defu": "^6.1.7",
|
|
49
|
-
"focus-trap": "^8.
|
|
50
|
-
"splitpanes": "^4.
|
|
51
|
-
"unocss": "^66.
|
|
49
|
+
"focus-trap": "^8.2.2",
|
|
50
|
+
"splitpanes": "^4.1.2",
|
|
51
|
+
"unocss": "^66.7.5",
|
|
52
52
|
"v-lazy-show": "^0.3.0",
|
|
53
|
-
"@nuxt/devtools-kit": "3.
|
|
53
|
+
"@nuxt/devtools-kit": "3.4.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"nuxt": "^4.
|
|
57
|
-
"@nuxt/devtools": "3.
|
|
56
|
+
"nuxt": "^4.5.1",
|
|
57
|
+
"@nuxt/devtools": "3.4.1"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
3
|
-
import { getHslColorFromStringHash } from "../composables/color";
|
|
4
|
-
import NBadge from "./NBadge.vue";
|
|
5
|
-
const props = defineProps({
|
|
6
|
-
text: { type: String, required: true }
|
|
7
|
-
});
|
|
8
|
-
const color = computed(() => {
|
|
9
|
-
const foreground = getHslColorFromStringHash(props.text, 50, 60);
|
|
10
|
-
const background = getHslColorFromStringHash(props.text, 50, 60, 0.05);
|
|
11
|
-
return { color: foreground, background };
|
|
12
|
-
});
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<template>
|
|
16
|
-
<NBadge :style="color">
|
|
17
|
-
{{ text }}<slot />
|
|
18
|
-
</NBadge>
|
|
19
|
-
</template>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed, nextTick } from "vue";
|
|
3
|
-
import { devToolsClient } from "../runtime/client";
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
code: { type: String, required: true },
|
|
6
|
-
lang: { type: String, required: false },
|
|
7
|
-
lines: { type: Boolean, required: false, default: true },
|
|
8
|
-
inline: { type: Boolean, required: false },
|
|
9
|
-
grammarContextCode: { type: String, required: false },
|
|
10
|
-
transformRendered: { type: Function, required: false }
|
|
11
|
-
});
|
|
12
|
-
const emit = defineEmits(["loaded"]);
|
|
13
|
-
const rendered = computed(() => {
|
|
14
|
-
const result = props.lang === "text" ? { code: props.code, supported: false } : devToolsClient.value?.devtools.renderCodeHighlight(props.code, props.lang, { grammarContextCode: props.grammarContextCode }) || { code: props.code, supported: false };
|
|
15
|
-
if (result.supported && props.transformRendered)
|
|
16
|
-
result.code = props.transformRendered(result.code);
|
|
17
|
-
if (result.supported)
|
|
18
|
-
nextTick(() => emit("loaded"));
|
|
19
|
-
return result;
|
|
20
|
-
});
|
|
21
|
-
const classes = computed(() => [
|
|
22
|
-
"n-code-block shiki",
|
|
23
|
-
props.lines && !props.inline ? "n-code-block-lines" : ""
|
|
24
|
-
]);
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<template>
|
|
28
|
-
<template v-if="lang && rendered.supported">
|
|
29
|
-
<pre :class="classes"><code v-html="rendered.code" /></pre>
|
|
30
|
-
</template>
|
|
31
|
-
<template v-else>
|
|
32
|
-
<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>
|
|
33
|
-
</template>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<style>
|
|
37
|
-
.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}
|
|
38
|
-
</style>
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { useColorMode } from "@vueuse/core";
|
|
3
|
-
import { computed, nextTick } from "vue";
|
|
4
|
-
const mode = useColorMode({
|
|
5
|
-
storageKey: "nuxt-devtools-color-mode"
|
|
6
|
-
});
|
|
7
|
-
const isDark = computed({
|
|
8
|
-
get() {
|
|
9
|
-
return mode.value === "dark";
|
|
10
|
-
},
|
|
11
|
-
set() {
|
|
12
|
-
mode.value = isDark.value ? "light" : "dark";
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
const isAppearanceTransition = typeof document !== "undefined" && document.startViewTransition && !window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
16
|
-
function toggle(event) {
|
|
17
|
-
if (!isAppearanceTransition || !event) {
|
|
18
|
-
isDark.value = !isDark.value;
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const x = event.clientX;
|
|
22
|
-
const y = event.clientY;
|
|
23
|
-
const endRadius = Math.hypot(
|
|
24
|
-
Math.max(x, innerWidth - x),
|
|
25
|
-
Math.max(y, innerHeight - y)
|
|
26
|
-
);
|
|
27
|
-
const transition = document.startViewTransition(async () => {
|
|
28
|
-
isDark.value = !isDark.value;
|
|
29
|
-
await nextTick();
|
|
30
|
-
});
|
|
31
|
-
transition.ready.then(() => {
|
|
32
|
-
const clipPath = [
|
|
33
|
-
`circle(0px at ${x}px ${y}px)`,
|
|
34
|
-
`circle(${endRadius}px at ${x}px ${y}px)`
|
|
35
|
-
];
|
|
36
|
-
document.documentElement.animate(
|
|
37
|
-
{
|
|
38
|
-
clipPath: isDark.value ? clipPath.toReversed() : clipPath
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
duration: 400,
|
|
42
|
-
easing: "ease-in",
|
|
43
|
-
fill: "forwards",
|
|
44
|
-
pseudoElement: isDark.value ? "::view-transition-old(root)" : "::view-transition-new(root)"
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
const context = {
|
|
50
|
-
mode,
|
|
51
|
-
isDark,
|
|
52
|
-
toggle
|
|
53
|
-
};
|
|
54
|
-
</script>
|
|
55
|
-
|
|
56
|
-
<template>
|
|
57
|
-
<ClientOnly placeholder-tag="span">
|
|
58
|
-
<slot v-bind="context" />
|
|
59
|
-
</ClientOnly>
|
|
60
|
-
</template>
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { onClickOutside, useVModel } from "@vueuse/core";
|
|
3
|
-
import { useFocusTrap } from "@vueuse/integrations/useFocusTrap";
|
|
4
|
-
import { computed, nextTick, ref, watchEffect } from "vue";
|
|
5
|
-
const props = defineProps({
|
|
6
|
-
modelValue: { type: Boolean, required: false, default: false },
|
|
7
|
-
dim: { type: Boolean, required: false, default: true },
|
|
8
|
-
autoClose: { type: Boolean, required: false, default: true }
|
|
9
|
-
});
|
|
10
|
-
const emit = defineEmits(["close", "update:modelValue"]);
|
|
11
|
-
const show = useVModel(props, "modelValue", emit, { passive: true });
|
|
12
|
-
const card = ref(null);
|
|
13
|
-
const shown = ref(false);
|
|
14
|
-
const { activate, deactivate } = useFocusTrap(computed(() => card.value || document.body), { immediate: false });
|
|
15
|
-
watchEffect(
|
|
16
|
-
() => {
|
|
17
|
-
if (!shown.value && show.value)
|
|
18
|
-
shown.value = true;
|
|
19
|
-
if (show.value && card.value)
|
|
20
|
-
nextTick(activate);
|
|
21
|
-
else
|
|
22
|
-
deactivate();
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
onClickOutside(card, () => {
|
|
26
|
-
if (props.modelValue && props.autoClose) {
|
|
27
|
-
show.value = false;
|
|
28
|
-
emit("close");
|
|
29
|
-
}
|
|
30
|
-
}, {
|
|
31
|
-
ignore: ["a", "button", "summary"]
|
|
32
|
-
});
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
<script>
|
|
36
|
-
export default {
|
|
37
|
-
inheritAttrs: false
|
|
38
|
-
};
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<template>
|
|
42
|
-
<Teleport v-if="shown" to="body">
|
|
43
|
-
<div
|
|
44
|
-
v-show="show"
|
|
45
|
-
class="fixed inset-0 z-100 flex items-center justify-center n-glass-effect n-transition"
|
|
46
|
-
role="dialog"
|
|
47
|
-
aria-modal="true"
|
|
48
|
-
:class="[
|
|
49
|
-
show ? '' : 'op0 pointer-events-none visibility-none'
|
|
50
|
-
]"
|
|
51
|
-
>
|
|
52
|
-
<div
|
|
53
|
-
class="absolute inset-0 -z-1"
|
|
54
|
-
:class="[
|
|
55
|
-
dim ? 'glass-effect' : ''
|
|
56
|
-
]"
|
|
57
|
-
/>
|
|
58
|
-
<NCard v-bind="$attrs" ref="card" class="max-h-screen of-auto">
|
|
59
|
-
<slot />
|
|
60
|
-
</NCard>
|
|
61
|
-
</div>
|
|
62
|
-
</Teleport>
|
|
63
|
-
</template>
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { onClickOutside, useElementSize } from "@vueuse/core";
|
|
3
|
-
import { ref } from "vue";
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
modelValue: { type: Boolean, required: false },
|
|
6
|
-
top: { type: null, required: false },
|
|
7
|
-
left: { type: null, required: false },
|
|
8
|
-
autoClose: { type: Boolean, required: false },
|
|
9
|
-
transition: { type: String, required: false, default: "right" }
|
|
10
|
-
});
|
|
11
|
-
const emit = defineEmits(["close"]);
|
|
12
|
-
const el = ref();
|
|
13
|
-
const { height } = useElementSize(() => props.top, void 0, { box: "border-box" });
|
|
14
|
-
const width = typeof props.left === "string" && props.left.startsWith("#") ? document.querySelector(props.left)?.getBoundingClientRect().width : useElementSize(() => props.left, void 0, { box: "border-box" }).width;
|
|
15
|
-
onClickOutside(el, () => {
|
|
16
|
-
if (props.modelValue && props.autoClose)
|
|
17
|
-
emit("close");
|
|
18
|
-
}, {
|
|
19
|
-
ignore: ["a", "button", "summary", '[role="dialog"]']
|
|
20
|
-
});
|
|
21
|
-
const transitionType = {
|
|
22
|
-
right: {
|
|
23
|
-
"enter-from-class": "transform translate-x-1/1",
|
|
24
|
-
"leave-to-class": "transform translate-x-1/1"
|
|
25
|
-
},
|
|
26
|
-
top: {
|
|
27
|
-
"enter-from-class": "transform translate-y--1/1",
|
|
28
|
-
"leave-to-class": "transform translate-y--1/1"
|
|
29
|
-
},
|
|
30
|
-
bottom: {
|
|
31
|
-
"enter-from-class": "transform translate-y-1/1",
|
|
32
|
-
"leave-to-class": "transform translate-y-1/1"
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<template>
|
|
38
|
-
<Transition
|
|
39
|
-
v-bind="transitionType[transition]"
|
|
40
|
-
enter-active-class="duration-200 ease-in"
|
|
41
|
-
enter-to-class="opacity-100"
|
|
42
|
-
leave-active-class="duration-200 ease-out"
|
|
43
|
-
leave-from-class="opacity-100"
|
|
44
|
-
>
|
|
45
|
-
<div
|
|
46
|
-
v-if="modelValue"
|
|
47
|
-
ref="el"
|
|
48
|
-
:border="`${transition === 'right' ? 'l' : transition === 'bottom' ? 't' : 'b'} base`"
|
|
49
|
-
flex="~ col gap-1"
|
|
50
|
-
:class="{ 'right-0': transition === 'right' || transition === 'bottom' }"
|
|
51
|
-
absolute bottom-0 z-10 z-20 of-auto n-glass-effect text-sm
|
|
52
|
-
:style="{
|
|
53
|
-
top: transition === 'bottom' ? 'auto' : `${height}px`,
|
|
54
|
-
left: transition === 'right' && !width ? 'auto' : `${width}px`
|
|
55
|
-
}"
|
|
56
|
-
v-bind="$attrs"
|
|
57
|
-
>
|
|
58
|
-
<NButton absolute right-2 top-2 z-20 text-xl icon="carbon-close" :border="false" @click="$emit('close')" />
|
|
59
|
-
<div relative h-full w-full of-auto>
|
|
60
|
-
<slot />
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
</Transition>
|
|
64
|
-
</template>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
3
|
-
const props = defineProps({
|
|
4
|
-
to: { type: String, required: false },
|
|
5
|
-
href: { type: String, required: false },
|
|
6
|
-
target: { type: String, required: false },
|
|
7
|
-
underline: { type: Boolean, required: false }
|
|
8
|
-
});
|
|
9
|
-
const link = computed(() => props.href || props.to);
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<template>
|
|
13
|
-
<NuxtLink
|
|
14
|
-
v-bind="link ? {
|
|
15
|
-
href: link,
|
|
16
|
-
target,
|
|
17
|
-
rel: target === '_blank' ? 'noopener noreferrer' : void 0
|
|
18
|
-
} : {}"
|
|
19
|
-
:class="{ 'n-link n-transition hover:n-link-hover n-link-base': link || underline }"
|
|
20
|
-
>
|
|
21
|
-
<slot />
|
|
22
|
-
<div
|
|
23
|
-
v-if="link && target === '_blank'"
|
|
24
|
-
i-carbon:arrow-up-right translate-y--1 text-xs op50
|
|
25
|
-
/>
|
|
26
|
-
</NuxtLink>
|
|
27
|
-
</template>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref } from "vue";
|
|
3
|
-
import { devtoolsUiProvideNotificationFn } from "../composables/notification";
|
|
4
|
-
const show = ref(false);
|
|
5
|
-
const icon = ref();
|
|
6
|
-
const text = ref();
|
|
7
|
-
const classes = ref();
|
|
8
|
-
const position = ref("top-center");
|
|
9
|
-
devtoolsUiProvideNotificationFn((data) => {
|
|
10
|
-
text.value = data.message;
|
|
11
|
-
icon.value = data.icon;
|
|
12
|
-
classes.value = data.classes ?? "text-primary border-primary";
|
|
13
|
-
icon.value = data.icon;
|
|
14
|
-
show.value = true;
|
|
15
|
-
position.value = data.position ?? "top-center";
|
|
16
|
-
setTimeout(() => {
|
|
17
|
-
show.value = false;
|
|
18
|
-
}, data.duration ?? 1500);
|
|
19
|
-
});
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<template>
|
|
23
|
-
<div
|
|
24
|
-
fixed left-0 right-0 z-999 text-center
|
|
25
|
-
:class="[
|
|
26
|
-
{ 'pointer-events-none overflow-hidden': !show },
|
|
27
|
-
{ 'top-0': position.startsWith('top') },
|
|
28
|
-
{ 'bottom-0': position.startsWith('bottom') }
|
|
29
|
-
]"
|
|
30
|
-
>
|
|
31
|
-
<div flex :style="{ justifyContent: position.includes('right') ? 'right' : position.includes('left') ? 'left' : 'center' }">
|
|
32
|
-
<div
|
|
33
|
-
border="~ base"
|
|
34
|
-
flex="~ inline gap2"
|
|
35
|
-
m-3 inline-block items-center rounded bg-base px-4 py-1 transition-all duration-300
|
|
36
|
-
:style="show ? {} : { transform: `translateY(${position.startsWith('top') ? '-' : ''}300%)` }"
|
|
37
|
-
:class="[show ? 'shadow' : 'shadow-none', classes]"
|
|
38
|
-
>
|
|
39
|
-
<div v-if="icon" :class="icon" />
|
|
40
|
-
<div>{{ text }}</div>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|