@mevbg/nuxt-kit 0.1.4 → 0.1.5
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/module.json +1 -1
- package/dist/module.mjs +13 -3
- package/dist/runtime/components/ConditionalClientOnly.vue +15 -0
- package/dist/runtime/components/ConditionalClientOnly.vue.d.ts +19 -0
- package/dist/runtime/composables/client-info.composable.d.ts +44 -0
- package/dist/runtime/composables/client-info.composable.js +8 -0
- package/package.json +3 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addPlugin,
|
|
1
|
+
import { defineNuxtModule, installModule, createResolver, addPlugin, addImports, addComponent } from '@nuxt/kit';
|
|
2
2
|
import { DEFAULT_COLOR_SCHEME } from '../dist/runtime/defaults.js';
|
|
3
3
|
export * from '@mevbg/nuxt-color-scheme';
|
|
4
4
|
|
|
@@ -17,12 +17,22 @@ const module = defineNuxtModule({
|
|
|
17
17
|
},
|
|
18
18
|
async setup(options, nuxt) {
|
|
19
19
|
nuxt.options.runtimeConfig.public.wm = options.wm;
|
|
20
|
-
const resolver = createResolver(import.meta.url);
|
|
21
|
-
addPlugin(resolver.resolve("./runtime/plugins/wm.plugin"));
|
|
22
20
|
await installModule("@mevbg/nuxt-color-scheme", {
|
|
23
21
|
default: options.colorScheme?.default ?? DEFAULT_COLOR_SCHEME,
|
|
24
22
|
systemScheme: options.colorScheme?.systemScheme ?? true
|
|
25
23
|
});
|
|
24
|
+
const resolver = createResolver(import.meta.url);
|
|
25
|
+
addPlugin(resolver.resolve("./runtime/plugins/wm.plugin"));
|
|
26
|
+
addImports([
|
|
27
|
+
{
|
|
28
|
+
name: "useClientInfo",
|
|
29
|
+
from: resolver.resolve("./runtime/composables/client-info.composable")
|
|
30
|
+
}
|
|
31
|
+
]);
|
|
32
|
+
addComponent({
|
|
33
|
+
name: "ConditionalClientOnly",
|
|
34
|
+
filePath: resolver.resolve("./runtime/components/ConditionalClientOnly.vue")
|
|
35
|
+
});
|
|
26
36
|
}
|
|
27
37
|
});
|
|
28
38
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ClientOnly v-if="condition" fallback-tag="div">
|
|
3
|
+
<slot />
|
|
4
|
+
</ClientOnly>
|
|
5
|
+
|
|
6
|
+
<div v-else>
|
|
7
|
+
<slot />
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup>
|
|
12
|
+
defineProps({
|
|
13
|
+
condition: { type: Boolean, required: false, default: false }
|
|
14
|
+
});
|
|
15
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
condition?: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare var __VLS_7: {}, __VLS_9: {};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
default?: (props: typeof __VLS_7) => any;
|
|
7
|
+
} & {
|
|
8
|
+
default?: (props: typeof __VLS_9) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
11
|
+
condition: boolean;
|
|
12
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
14
|
+
export default _default;
|
|
15
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
16
|
+
new (): {
|
|
17
|
+
$slots: S;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare function useClientInfo(): {
|
|
2
|
+
data: {
|
|
3
|
+
isBrowser: boolean;
|
|
4
|
+
isMobile: boolean;
|
|
5
|
+
isTablet: boolean;
|
|
6
|
+
isSmartTV: boolean;
|
|
7
|
+
isConsole: boolean;
|
|
8
|
+
isWearable: boolean;
|
|
9
|
+
isMobileSafari: boolean;
|
|
10
|
+
isChromium: boolean;
|
|
11
|
+
isMobileOnly: boolean;
|
|
12
|
+
isAndroid: boolean;
|
|
13
|
+
isWinPhone: boolean;
|
|
14
|
+
isIOS: boolean;
|
|
15
|
+
isChrome: boolean;
|
|
16
|
+
isFirefox: boolean;
|
|
17
|
+
isSafari: boolean;
|
|
18
|
+
isOpera: boolean;
|
|
19
|
+
isIE: boolean;
|
|
20
|
+
isEdge: boolean;
|
|
21
|
+
isYandex: boolean;
|
|
22
|
+
isIOS13: boolean;
|
|
23
|
+
isIPad13: boolean;
|
|
24
|
+
isIPhone13: boolean;
|
|
25
|
+
isIPod13: boolean;
|
|
26
|
+
isElectron: boolean;
|
|
27
|
+
isEdgeChromium: boolean;
|
|
28
|
+
isLegacyEdge: boolean;
|
|
29
|
+
isWindows: boolean;
|
|
30
|
+
isMacOs: boolean;
|
|
31
|
+
osVersion: string;
|
|
32
|
+
osName: string;
|
|
33
|
+
fullBrowserVersion: string;
|
|
34
|
+
browserVersion: string;
|
|
35
|
+
browserName: string;
|
|
36
|
+
mobileVendor: string;
|
|
37
|
+
mobileModel: string;
|
|
38
|
+
engineName: string;
|
|
39
|
+
engineVersion: string;
|
|
40
|
+
getUA: string;
|
|
41
|
+
deviceType: string;
|
|
42
|
+
};
|
|
43
|
+
classes: string[];
|
|
44
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as clientInfo from "mobile-device-detect";
|
|
2
|
+
export function useClientInfo() {
|
|
3
|
+
const { default: defaultInfo, deviceDetect, ...data } = clientInfo;
|
|
4
|
+
const classes = Object.keys(data).filter(
|
|
5
|
+
(key) => typeof data[key] === "boolean" && data[key]
|
|
6
|
+
);
|
|
7
|
+
return { data, classes };
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mevbg/nuxt-kit",
|
|
3
3
|
"title": "Mev’s Nuxt Kit",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.5",
|
|
5
5
|
"description": "Mev’s personal Nuxt kit module.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"nuxt kit",
|
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@mevbg/design-essentials-vendor": "^2.0.4",
|
|
65
65
|
"@mevbg/nuxt-color-scheme": "^1.0.4",
|
|
66
|
-
"@nuxt/kit": "^4.0.3"
|
|
66
|
+
"@nuxt/kit": "^4.0.3",
|
|
67
|
+
"mobile-device-detect": "^0.4.3"
|
|
67
68
|
},
|
|
68
69
|
"devDependencies": {
|
|
69
70
|
"@nuxt/devtools": "^2.6.2",
|