@nuxtify/core 0.1.5 → 0.1.7
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.d.mts +20 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +8 -1
- package/dist/runtime/utils/text.d.ts +13 -2
- package/dist/runtime/utils/text.js +16 -0
- package/package.json +1 -1
package/dist/module.d.mts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
|
|
3
|
+
interface Link {
|
|
4
|
+
text: string;
|
|
5
|
+
to?: string;
|
|
6
|
+
href?: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
openInNew?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface TitledLinks {
|
|
11
|
+
title: string;
|
|
12
|
+
links: Link[];
|
|
13
|
+
}
|
|
3
14
|
interface BrandOptions {
|
|
4
15
|
/**
|
|
5
16
|
* The name of the brand.
|
|
@@ -75,6 +86,15 @@ interface ModuleOptions {
|
|
|
75
86
|
buttonText?: string;
|
|
76
87
|
buttonUrl?: string;
|
|
77
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* Navigation options
|
|
91
|
+
*/
|
|
92
|
+
navigation?: {
|
|
93
|
+
primary?: Link[];
|
|
94
|
+
secondary?: Link[];
|
|
95
|
+
altPrimary?: TitledLinks[];
|
|
96
|
+
altSecondary?: Link[];
|
|
97
|
+
};
|
|
78
98
|
/**
|
|
79
99
|
* Credits options
|
|
80
100
|
*/
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { defineNuxtModule, createResolver, installModule, addComponentsDir, addI
|
|
|
2
2
|
import { defu } from 'defu';
|
|
3
3
|
|
|
4
4
|
const name = "@nuxtify/core";
|
|
5
|
-
const version = "0.1.
|
|
5
|
+
const version = "0.1.7";
|
|
6
6
|
|
|
7
7
|
const module = defineNuxtModule({
|
|
8
8
|
meta: {
|
|
@@ -41,6 +41,13 @@ const module = defineNuxtModule({
|
|
|
41
41
|
buttonText: "",
|
|
42
42
|
buttonUrl: ""
|
|
43
43
|
},
|
|
44
|
+
// Navigation
|
|
45
|
+
navigation: {
|
|
46
|
+
primary: [],
|
|
47
|
+
secondary: [],
|
|
48
|
+
altPrimary: [],
|
|
49
|
+
altSecondary: []
|
|
50
|
+
},
|
|
44
51
|
// Credits
|
|
45
52
|
credits: {
|
|
46
53
|
creator: {
|
|
@@ -13,11 +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
|
-
export declare function formatDate(date: string, locale?: string): string;
|
|
17
|
-
export declare function formatDateTime(date: string, locale?: string): string;
|
|
16
|
+
export declare function formatDate(date: number | string | Date, locale?: string): string;
|
|
17
|
+
export declare function formatDateTime(date: number | string | Date, locale?: string): string;
|
|
18
18
|
export declare function booleanToText(bool: boolean): "Yes" | "No";
|
|
19
19
|
export declare const truncate: (text: string, maxLength?: number, ellipses?: boolean) => string;
|
|
20
20
|
export declare const slugify: (text: string) => string;
|
|
21
21
|
export declare const unslugify: (text: string) => string;
|
|
22
22
|
export declare function pluralize(value: number, units: string, showValue?: boolean): string;
|
|
23
23
|
export declare const getLanguageName: (languageCode: string, displayLanguage?: string) => string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Determines the correct indefinite article ("a" or "an") for a given string
|
|
26
|
+
* and optionally prepends it to the string.
|
|
27
|
+
*
|
|
28
|
+
* @param text The input string for which to determine the article.
|
|
29
|
+
* @param includeText If true (default), returns the article followed by the original text (e.g., "an apple").
|
|
30
|
+
* If false, returns only the article (e.g., "an").
|
|
31
|
+
* @returns The determined article, optionally with the original text, or an empty string
|
|
32
|
+
* if the input text is empty and includeText is false, or the original text if empty and includeText is true.
|
|
33
|
+
*/
|
|
34
|
+
export declare function addArticle(text: string | undefined, includeText?: boolean): string;
|
|
@@ -155,3 +155,19 @@ export const getLanguageName = (languageCode, displayLanguage = "en") => {
|
|
|
155
155
|
return languageCode;
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
|
+
export function addArticle(text, includeText = true) {
|
|
159
|
+
if (!text) return "";
|
|
160
|
+
const firstLetter = text[0].toLowerCase();
|
|
161
|
+
const vowels = ["a", "e", "i", "o", "u"];
|
|
162
|
+
let article;
|
|
163
|
+
if (vowels.includes(firstLetter)) {
|
|
164
|
+
article = "an";
|
|
165
|
+
} else {
|
|
166
|
+
article = "a";
|
|
167
|
+
}
|
|
168
|
+
if (includeText) {
|
|
169
|
+
return `${article} ${text}`;
|
|
170
|
+
} else {
|
|
171
|
+
return article;
|
|
172
|
+
}
|
|
173
|
+
}
|