@nuxt/devtools-ui-kit 3.4.1 → 3.4.2
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/NBadge.d.vue.ts +13 -5
- package/dist/components/NBadge.vue +5 -0
- package/dist/components/NBadgeHashed.d.vue.ts +16 -21
- package/dist/components/NBadgeHashed.vue +19 -0
- package/dist/components/NCard.d.vue.ts +13 -5
- package/dist/components/NCard.vue +5 -0
- package/dist/components/NCheckbox.d.vue.ts +24 -36
- package/dist/components/NCheckbox.vue +29 -0
- package/dist/components/NCodeBlock.d.vue.ts +18 -64
- package/dist/components/NCodeBlock.vue +38 -0
- package/dist/components/NDarkToggle.d.vue.ts +18 -74
- package/dist/components/NDarkToggle.vue +60 -0
- package/dist/components/NDialog.d.vue.ts +28 -80
- package/dist/components/NDialog.vue +63 -0
- package/dist/components/NDrawer.d.vue.ts +26 -77
- package/dist/components/NDrawer.vue +64 -0
- package/dist/components/NDropdown.d.vue.ts +28 -36
- package/dist/components/NDropdown.vue +31 -0
- package/dist/components/NIcon.d.vue.ts +6 -9
- package/dist/components/NIcon.vue +9 -0
- package/dist/components/NIconTitle.d.vue.ts +17 -15
- package/dist/components/NIconTitle.vue +15 -0
- package/dist/components/NLink.d.vue.ts +19 -29
- package/dist/components/NLink.vue +27 -0
- package/dist/components/NLoading.d.vue.ts +13 -10
- package/dist/components/NLoading.vue +10 -0
- package/dist/components/NMarkdown.d.vue.ts +7 -19
- package/dist/components/NMarkdown.vue +16 -0
- package/dist/components/NNavbar.d.vue.ts +25 -34
- package/dist/components/NNavbar.vue +30 -0
- package/dist/components/NNotification.d.vue.ts +3 -48
- package/dist/components/NNotification.vue +44 -0
- package/dist/components/NPanelGrids.d.vue.ts +13 -5
- package/dist/components/NPanelGrids.vue +5 -0
- package/dist/components/NRadio.d.vue.ts +26 -40
- package/dist/components/NRadio.vue +33 -0
- package/dist/components/NSectionBlock.d.vue.ts +38 -97
- package/dist/components/NSectionBlock.vue +67 -0
- package/dist/components/NSelect.d.vue.ts +30 -37
- package/dist/components/NSelect.vue +28 -0
- package/dist/components/NSelectTabs.d.vue.ts +18 -49
- package/dist/components/NSelectTabs.vue +42 -0
- package/dist/components/NSplitPane.d.vue.ts +28 -82
- package/dist/components/NSplitPane.vue +37 -0
- package/dist/components/NSwitch.d.vue.ts +27 -34
- package/dist/components/NSwitch.vue +29 -0
- package/dist/components/NTextInput.d.vue.ts +34 -40
- package/dist/components/NTextInput.vue +28 -0
- package/dist/components/NTip.d.vue.ts +18 -16
- package/dist/components/NTip.vue +16 -0
- package/dist/module.json +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
declare var __VLS_1: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
default?: (props: typeof __VLS_1) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
9
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
10
|
+
new (): {
|
|
11
|
+
$slots: S;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}>()
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<template>
|
|
18
|
-
<NBadge :style="color">
|
|
19
|
-
{{ text }}<slot />
|
|
20
|
-
</NBadge>
|
|
21
|
-
</template>
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
text: string;
|
|
3
|
+
};
|
|
4
|
+
declare var __VLS_8: {};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
default?: (props: typeof __VLS_8) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
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,5 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
declare var __VLS_1: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
default?: (props: typeof __VLS_1) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
9
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
10
|
+
new (): {
|
|
11
|
+
$slots: S;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -1,36 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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-transition n-checked:n-checkbox-box-checked peer-active:n-active-base peer-focus-visible:n-focus-base">
|
|
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>
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
modelValue?: boolean | null;
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare var __VLS_6: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
default?: (props: typeof __VLS_6) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
[x: `on${Capitalize<any>}`]: ((...args: unknown[]) => any) | undefined;
|
|
13
|
+
}>, {
|
|
14
|
+
modelValue: boolean | null;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useVModel } from "@vueuse/core";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
modelValue: { type: [Boolean, null], required: false, default: false },
|
|
5
|
+
disabled: { type: Boolean, required: false, default: false }
|
|
6
|
+
});
|
|
7
|
+
const emit = defineEmits([]);
|
|
8
|
+
const checked = useVModel(props, "modelValue", emit, { passive: true });
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<label
|
|
13
|
+
class="n-checkbox select-none items-center hover:n-checkbox-hover n-disabled:n-disabled"
|
|
14
|
+
:checked="checked || null"
|
|
15
|
+
:disabled="disabled || null"
|
|
16
|
+
>
|
|
17
|
+
<input
|
|
18
|
+
v-model="checked"
|
|
19
|
+
type="checkbox"
|
|
20
|
+
class="peer absolute op0"
|
|
21
|
+
:disabled="disabled"
|
|
22
|
+
@keypress.enter="checked = !checked"
|
|
23
|
+
>
|
|
24
|
+
<span class="n-checkbox-box n-transition n-checked:n-checkbox-box-checked peer-active:n-active-base peer-focus-visible:n-focus-base">
|
|
25
|
+
<NIcon class="n-checkbox-icon scale-0 transform op0 n-transition n-checked:scale-100 n-checked:op100" />
|
|
26
|
+
</span>
|
|
27
|
+
<span :class="checked ? '' : 'op50'" class="n-transition"><slot /></span>
|
|
28
|
+
</label>
|
|
29
|
+
</template>
|
|
@@ -1,64 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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>
|
|
1
|
+
import type { BuiltinLanguage } from 'shiki';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
code: string;
|
|
4
|
+
lang?: BuiltinLanguage | 'text';
|
|
5
|
+
lines?: boolean;
|
|
6
|
+
inline?: boolean;
|
|
7
|
+
grammarContextCode?: string;
|
|
8
|
+
transformRendered?: (code: string) => string;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
loaded: (...args: any[]) => void;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
+
onLoaded?: ((...args: any[]) => any) | undefined;
|
|
14
|
+
}>, {
|
|
15
|
+
lines: boolean;
|
|
16
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
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,78 +1,22 @@
|
|
|
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
1
|
/**
|
|
24
2
|
* Credit to [@hooray](https://github.com/hooray)
|
|
25
3
|
* @see https://github.com/vuejs/vitepress/pull/2347
|
|
26
4
|
*/
|
|
27
|
-
function toggle(event?: MouseEvent)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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>
|
|
5
|
+
declare function toggle(event?: MouseEvent): void;
|
|
6
|
+
declare var __VLS_8: {
|
|
7
|
+
mode: import("@vueuse/core").UseColorModeReturn<import("@vueuse/core").BasicColorMode>;
|
|
8
|
+
isDark: import("vue").WritableComputedRef<boolean, boolean>;
|
|
9
|
+
toggle: typeof toggle;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_Slots = {} & {
|
|
12
|
+
default?: (props: typeof __VLS_8) => any;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
15
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
18
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
19
|
+
new (): {
|
|
20
|
+
$slots: S;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
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,80 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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>
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
4
|
+
modelValue?: boolean;
|
|
5
|
+
dim?: boolean;
|
|
6
|
+
autoClose?: boolean;
|
|
7
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
+
close: () => any;
|
|
9
|
+
"update:modelValue": (value: boolean) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
11
|
+
modelValue?: boolean;
|
|
12
|
+
dim?: boolean;
|
|
13
|
+
autoClose?: boolean;
|
|
14
|
+
}> & Readonly<{
|
|
15
|
+
onClose?: (() => any) | undefined;
|
|
16
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
17
|
+
}>, {
|
|
18
|
+
modelValue: boolean;
|
|
19
|
+
dim: boolean;
|
|
20
|
+
autoClose: boolean;
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
22
|
+
default?: (props: {}) => any;
|
|
23
|
+
}>;
|
|
24
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
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>
|