@nuxtify/core 0.1.9 → 0.1.10
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 +6 -3
- package/dist/runtime/utils/text.d.ts +16 -2
- package/dist/runtime/utils/text.js +33 -15
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, installModule, addComponentsDir, addImportsDir, addServerImportsDir, addRouteMiddleware } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, createResolver, useLogger, installModule, addComponentsDir, addImportsDir, addServerImportsDir, addRouteMiddleware } from '@nuxt/kit';
|
|
2
2
|
import { defu } from 'defu';
|
|
3
3
|
|
|
4
4
|
const name = "@nuxtify/core";
|
|
5
|
-
const version = "0.1.
|
|
5
|
+
const version = "0.1.10";
|
|
6
6
|
|
|
7
7
|
const module = defineNuxtModule({
|
|
8
8
|
meta: {
|
|
@@ -66,7 +66,7 @@ const module = defineNuxtModule({
|
|
|
66
66
|
},
|
|
67
67
|
async setup(_options, _nuxt) {
|
|
68
68
|
const resolver = createResolver(import.meta.url);
|
|
69
|
-
if (_options.verboseLogs)
|
|
69
|
+
if (_options.verboseLogs) useLogger("[nuxtify-core] Verbose logging enabled.");
|
|
70
70
|
await installModule("vuetify-nuxt-module", {
|
|
71
71
|
vuetifyOptions: {
|
|
72
72
|
icons: {
|
|
@@ -90,6 +90,9 @@ const module = defineNuxtModule({
|
|
|
90
90
|
},
|
|
91
91
|
VFooter: {
|
|
92
92
|
VBtn: { color: "inherit" }
|
|
93
|
+
},
|
|
94
|
+
VNumberInput: {
|
|
95
|
+
VBtn: { color: "inherit", variant: "inherit" }
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
}
|
|
@@ -13,8 +13,22 @@ export declare function getPronouns(gender: string): {
|
|
|
13
13
|
possessivePlural: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const formatPhone: (input: string, separator?: string) => string;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Formats a date or a date-time using the Intl.DateTimeFormat API.
|
|
18
|
+
*
|
|
19
|
+
* @param date The date to format (number, string, or Date).
|
|
20
|
+
* @param config Optional configuration object.
|
|
21
|
+
* @param config.type The format to use: 'date' (default) or 'datetime'.
|
|
22
|
+
* @param config.locale A string with a BCP 47 language tag (e.g., 'en-US').
|
|
23
|
+
* @param config.options Custom formatting options to override the default.
|
|
24
|
+
* @param config.defaultString The string to return if the date is invalid.
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatDate(date: number | string | Date, { type, locale, options, defaultString, }?: {
|
|
27
|
+
type?: 'date' | 'datetime';
|
|
28
|
+
locale?: string;
|
|
29
|
+
options?: Intl.DateTimeFormatOptions;
|
|
30
|
+
defaultString?: string;
|
|
31
|
+
}): string;
|
|
18
32
|
export declare function booleanToText(bool: boolean): "Yes" | "No";
|
|
19
33
|
export declare const truncate: (text: string, maxLength?: number, ellipses?: boolean) => string;
|
|
20
34
|
export declare const slugify: (text: string) => string;
|
|
@@ -84,21 +84,39 @@ export const formatPhone = (input, separator = "-") => {
|
|
|
84
84
|
}
|
|
85
85
|
return phone;
|
|
86
86
|
};
|
|
87
|
-
export function formatDate(date,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
87
|
+
export function formatDate(date, {
|
|
88
|
+
type = "date",
|
|
89
|
+
locale = "en-US",
|
|
90
|
+
options,
|
|
91
|
+
defaultString = "-"
|
|
92
|
+
} = {}) {
|
|
93
|
+
if (date === null || date === void 0) {
|
|
94
|
+
return defaultString;
|
|
95
|
+
}
|
|
96
|
+
const dateObj = new Date(date);
|
|
97
|
+
if (Number.isNaN(dateObj.getTime())) {
|
|
98
|
+
return defaultString;
|
|
99
|
+
}
|
|
100
|
+
const defaultOptions = {
|
|
101
|
+
date: {
|
|
102
|
+
year: "numeric",
|
|
103
|
+
month: "long",
|
|
104
|
+
day: "numeric"
|
|
105
|
+
},
|
|
106
|
+
datetime: {
|
|
107
|
+
year: "numeric",
|
|
108
|
+
month: "short",
|
|
109
|
+
day: "numeric",
|
|
110
|
+
hour: "numeric",
|
|
111
|
+
minute: "numeric"
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const formatOptions = { ...defaultOptions[type], ...options };
|
|
115
|
+
try {
|
|
116
|
+
return new Intl.DateTimeFormat(locale, formatOptions).format(dateObj);
|
|
117
|
+
} catch {
|
|
118
|
+
return defaultString;
|
|
119
|
+
}
|
|
102
120
|
}
|
|
103
121
|
export function booleanToText(bool) {
|
|
104
122
|
return bool ? "Yes" : "No";
|