@nuxtify/pages 0.2.0 → 0.3.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/LICENSE +21 -0
- package/README.md +222 -203
- package/dist/module.d.mts +0 -83
- package/dist/module.json +2 -2
- package/dist/module.mjs +9 -66
- package/dist/runtime/components/EmailSubscribeForm.vue +75 -75
- package/dist/runtime/components/FooterCallToAction.vue +29 -29
- package/dist/runtime/components/app/AppBar.vue +109 -109
- package/dist/runtime/components/app/AppFooter.vue +132 -132
- package/dist/runtime/components/app/AppNavigationDrawer.vue +86 -86
- package/dist/runtime/layouts/DefaultLayout.vue +25 -23
- package/dist/runtime/pages/DynamicSlug.vue +15 -15
- package/dist/runtime/pages/IndexPage.vue +16 -12
- package/dist/runtime/server/tsconfig.json +3 -3
- package/dist/runtime/utils/icons.d.ts +1 -1
- package/dist/runtime/utils/icons.js +1 -1
- package/package.json +64 -65
- package/dist/runtime/components/app/AppAnnouncementBar.vue +0 -36
- package/dist/runtime/components/app/AppAnnouncementBar.vue.d.ts +0 -2
- package/dist/runtime/components/app/AppDialog.vue +0 -38
- package/dist/runtime/components/app/AppDialog.vue.d.ts +0 -2
- package/dist/runtime/components/app/AppLoading.vue +0 -16
- package/dist/runtime/components/app/AppLoading.vue.d.ts +0 -2
- package/dist/runtime/components/app/AppLogo.vue +0 -41
- package/dist/runtime/components/app/AppLogo.vue.d.ts +0 -23
- package/dist/runtime/components/app/AppToast.vue +0 -16
- package/dist/runtime/components/app/AppToast.vue.d.ts +0 -2
- package/dist/runtime/composables/dialog.d.ts +0 -13
- package/dist/runtime/composables/dialog.js +0 -15
- package/dist/runtime/composables/nuxtify.d.ts +0 -2
- package/dist/runtime/composables/nuxtify.js +0 -2
- package/dist/runtime/composables/state.d.ts +0 -15
- package/dist/runtime/composables/state.js +0 -10
- package/dist/runtime/server/composables/client.d.ts +0 -1
- package/dist/runtime/server/composables/client.js +0 -1
- package/dist/runtime/server/utils/client.d.ts +0 -1
- package/dist/runtime/server/utils/client.js +0 -1
- package/dist/runtime/utils/formRules.d.ts +0 -19
- package/dist/runtime/utils/formRules.js +0 -23
- package/dist/runtime/utils/io.d.ts +0 -2
- package/dist/runtime/utils/io.js +0 -19
- package/dist/runtime/utils/math.d.ts +0 -2
- package/dist/runtime/utils/math.js +0 -13
- package/dist/runtime/utils/text.d.ts +0 -23
- package/dist/runtime/utils/text.js +0 -159
- package/dist/runtime/utils/time.d.ts +0 -2
- package/dist/runtime/utils/time.js +0 -7
- package/dist/runtime/utils/url.d.ts +0 -9
- package/dist/runtime/utils/url.js +0 -27
- package/dist/runtime/utils/util.d.ts +0 -7
- package/dist/runtime/utils/util.js +0 -5
- package/dist/runtime/utils/youtube.d.ts +0 -1
- package/dist/runtime/utils/youtube.js +0 -13
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
export const titleCase = (text, skipShortWords = true) => {
|
|
2
|
-
const shortWords = ["and", "an", "the", "a", "but", "for", "at", "by", "to"];
|
|
3
|
-
const words = text.split(" ");
|
|
4
|
-
const titleWords = [];
|
|
5
|
-
for (const [i] of words.entries()) {
|
|
6
|
-
if (skipShortWords && shortWords.includes(words[i])) {
|
|
7
|
-
if (i === 0) {
|
|
8
|
-
titleWords.push(words[i].charAt(0).toUpperCase() + words[i].slice(1));
|
|
9
|
-
} else {
|
|
10
|
-
titleWords.push(words[i]);
|
|
11
|
-
}
|
|
12
|
-
} else {
|
|
13
|
-
titleWords.push(words[i].charAt(0).toUpperCase() + words[i].slice(1));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return titleWords.join(" ");
|
|
17
|
-
};
|
|
18
|
-
export function capitalizeFirstLetter(text) {
|
|
19
|
-
if (!text) {
|
|
20
|
-
return "";
|
|
21
|
-
}
|
|
22
|
-
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
23
|
-
}
|
|
24
|
-
export function fullName(firstName, lastName) {
|
|
25
|
-
let name = "";
|
|
26
|
-
if (firstName && lastName) {
|
|
27
|
-
name = `${firstName} ${lastName}`;
|
|
28
|
-
} else if (firstName) {
|
|
29
|
-
name = firstName;
|
|
30
|
-
} else if (lastName) {
|
|
31
|
-
name = lastName;
|
|
32
|
-
}
|
|
33
|
-
return name;
|
|
34
|
-
}
|
|
35
|
-
export function parseFullName(fullName2) {
|
|
36
|
-
let firstName = "";
|
|
37
|
-
let lastName = "";
|
|
38
|
-
if (fullName2) {
|
|
39
|
-
const nameSplit = fullName2.split(" ");
|
|
40
|
-
firstName = nameSplit[0];
|
|
41
|
-
if (nameSplit.length > 1) {
|
|
42
|
-
lastName = nameSplit.slice(1).join(" ");
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return { firstName, lastName };
|
|
46
|
-
}
|
|
47
|
-
export const honoraryName = (name, honorificSuffix = "") => {
|
|
48
|
-
return honorificSuffix ? `${name}, ${honorificSuffix}` : name;
|
|
49
|
-
};
|
|
50
|
-
export function getPronouns(gender) {
|
|
51
|
-
if (gender === "male") {
|
|
52
|
-
return {
|
|
53
|
-
single: "he",
|
|
54
|
-
plural: "he's",
|
|
55
|
-
possessive: "his",
|
|
56
|
-
possessivePlural: "his"
|
|
57
|
-
};
|
|
58
|
-
} else if (gender === "female") {
|
|
59
|
-
return {
|
|
60
|
-
single: "she",
|
|
61
|
-
plural: "she's",
|
|
62
|
-
possessive: "her",
|
|
63
|
-
possessivePlural: "her's"
|
|
64
|
-
};
|
|
65
|
-
} else {
|
|
66
|
-
return {
|
|
67
|
-
single: "they",
|
|
68
|
-
plural: "they're",
|
|
69
|
-
possessive: "their",
|
|
70
|
-
possessivePlural: "theirs"
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
export const formatPhone = (input, separator = "-") => {
|
|
75
|
-
let phone = input;
|
|
76
|
-
if (phone.slice(0, 2) === "+1") {
|
|
77
|
-
phone = phone.slice(2);
|
|
78
|
-
}
|
|
79
|
-
if (phone.length === 10) {
|
|
80
|
-
phone = phone.replace(
|
|
81
|
-
/(\d{3})(\d{3})(\d{4})/,
|
|
82
|
-
`$1${separator}$2${separator}$3`
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
return phone;
|
|
86
|
-
};
|
|
87
|
-
export function formatDate(date, locale = "en-us") {
|
|
88
|
-
return new Date(date).toLocaleDateString(locale, {
|
|
89
|
-
year: "numeric",
|
|
90
|
-
month: "long",
|
|
91
|
-
day: "numeric"
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
export function formatDateTime(date, locale = "en-us") {
|
|
95
|
-
return new Date(date).toLocaleString(locale, {
|
|
96
|
-
year: "numeric",
|
|
97
|
-
month: "long",
|
|
98
|
-
day: "numeric",
|
|
99
|
-
hour: "numeric",
|
|
100
|
-
minute: "numeric"
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
export function booleanToText(bool) {
|
|
104
|
-
return bool ? "Yes" : "No";
|
|
105
|
-
}
|
|
106
|
-
export const truncate = (text, maxLength = 80, ellipses = true) => {
|
|
107
|
-
if (text.length > maxLength) {
|
|
108
|
-
let trimmedString = text.substring(0, maxLength + 1);
|
|
109
|
-
trimmedString = trimmedString.substring(
|
|
110
|
-
0,
|
|
111
|
-
Math.min(trimmedString.length, trimmedString.lastIndexOf(" "))
|
|
112
|
-
);
|
|
113
|
-
return `${trimmedString}${ellipses ? "..." : ""}`;
|
|
114
|
-
}
|
|
115
|
-
return text;
|
|
116
|
-
};
|
|
117
|
-
export const slugify = (text) => {
|
|
118
|
-
const slug = text.normalize("NFKD").toLowerCase().trim().replace(/\s+/g, "-").replace(/_/g, "-").replace(/-{2,}/g, "-").replace(/-$/g, "");
|
|
119
|
-
return slug;
|
|
120
|
-
};
|
|
121
|
-
export const unslugify = (text) => {
|
|
122
|
-
const unslug = text.replace(/-/g, " ");
|
|
123
|
-
return unslug;
|
|
124
|
-
};
|
|
125
|
-
export function pluralize(value, units, showValue = true) {
|
|
126
|
-
let text = "";
|
|
127
|
-
let unitsPlural = units;
|
|
128
|
-
if (unitsPlural.slice(-1) === "y") {
|
|
129
|
-
unitsPlural = unitsPlural.slice(0, -1) + "ies";
|
|
130
|
-
} else {
|
|
131
|
-
unitsPlural = units + "s";
|
|
132
|
-
}
|
|
133
|
-
if (showValue) {
|
|
134
|
-
if (value === 1) {
|
|
135
|
-
text = `${value} ${units}`;
|
|
136
|
-
} else {
|
|
137
|
-
text = `${value} ${unitsPlural}`;
|
|
138
|
-
}
|
|
139
|
-
} else if (!value || value === 1) {
|
|
140
|
-
text = `${units}`;
|
|
141
|
-
} else {
|
|
142
|
-
text = `${unitsPlural}`;
|
|
143
|
-
}
|
|
144
|
-
return text;
|
|
145
|
-
}
|
|
146
|
-
export const getLanguageName = (languageCode, displayLanguage = "en") => {
|
|
147
|
-
try {
|
|
148
|
-
const languageNames = new Intl.DisplayNames([displayLanguage], {
|
|
149
|
-
type: "language"
|
|
150
|
-
});
|
|
151
|
-
return languageNames.of(languageCode);
|
|
152
|
-
} catch (error) {
|
|
153
|
-
console.error(
|
|
154
|
-
`Error getting language name for code '${languageCode}' with locale '${displayLanguage}':`,
|
|
155
|
-
error
|
|
156
|
-
);
|
|
157
|
-
return languageCode;
|
|
158
|
-
}
|
|
159
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
2
|
-
export function daysSince(targetDate) {
|
|
3
|
-
const currentDate = /* @__PURE__ */ new Date();
|
|
4
|
-
const timeDifference = currentDate.getTime() - targetDate.getTime();
|
|
5
|
-
const daysDifference = Math.floor(timeDifference / (1e3 * 60 * 60 * 24));
|
|
6
|
-
return daysDifference;
|
|
7
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const getBaseUrl: (url: string) => string;
|
|
2
|
-
export declare const getUtmParams: (url: string) => {
|
|
3
|
-
utmSource: string | null;
|
|
4
|
-
utmMedium: string | null;
|
|
5
|
-
utmCampaign: string | null;
|
|
6
|
-
utmTerm: string | null;
|
|
7
|
-
utmContent: string | null;
|
|
8
|
-
};
|
|
9
|
-
export declare const isExternalUrl: (url: string, hostname: string) => boolean;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export const getBaseUrl = (url) => {
|
|
2
|
-
const urlObject = new URL(url);
|
|
3
|
-
urlObject.search = "";
|
|
4
|
-
urlObject.hash = "";
|
|
5
|
-
return urlObject.href;
|
|
6
|
-
};
|
|
7
|
-
export const getUtmParams = (url) => {
|
|
8
|
-
const urlSearchParams = new URLSearchParams(new URL(url).search);
|
|
9
|
-
return {
|
|
10
|
-
utmSource: urlSearchParams.get("utm_source"),
|
|
11
|
-
utmMedium: urlSearchParams.get("utm_medium"),
|
|
12
|
-
utmCampaign: urlSearchParams.get("utm_campaign"),
|
|
13
|
-
utmTerm: urlSearchParams.get("utm_term"),
|
|
14
|
-
utmContent: urlSearchParams.get("utm_content")
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export const isExternalUrl = (url, hostname) => {
|
|
18
|
-
if (!url) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
if (url.startsWith("/")) {
|
|
22
|
-
return false;
|
|
23
|
-
} else {
|
|
24
|
-
const linkHostname = new URL(url).hostname;
|
|
25
|
-
return linkHostname !== hostname;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function youTubeUrl(url: string): string | null;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
function youTubeId(url) {
|
|
2
|
-
const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/;
|
|
3
|
-
const match = url.match(regExp);
|
|
4
|
-
return match && match[2].length === 11 ? match[2] : null;
|
|
5
|
-
}
|
|
6
|
-
export function youTubeUrl(url) {
|
|
7
|
-
const videoId = youTubeId(url);
|
|
8
|
-
if (videoId) {
|
|
9
|
-
return `https://www.youtube.com/embed/${videoId}`;
|
|
10
|
-
} else {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
}
|