@pelatform/starter.shared 0.2.0 → 0.2.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/extend.d.ts +31 -1
- package/dist/extend.js +201 -0
- package/dist/index.js +4 -2
- package/package.json +8 -8
package/dist/extend.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Metadata } from 'next';
|
|
1
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
import * as react from 'react';
|
|
3
4
|
import { ComponentType } from 'react';
|
|
@@ -5,6 +6,35 @@ export { A as AvatarClassNames, a as AvatarProps, C as CardClassNames, b as Card
|
|
|
5
6
|
import 'pelatform-ui/default';
|
|
6
7
|
import '@pelatform/starter.utils';
|
|
7
8
|
|
|
9
|
+
declare function mapLocale(locale?: string): string | undefined;
|
|
10
|
+
|
|
11
|
+
type metadataProps = {
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
fullTitle?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
icons?: Metadata["icons"];
|
|
17
|
+
url?: string;
|
|
18
|
+
image?: string | null;
|
|
19
|
+
video?: string | null;
|
|
20
|
+
openGraph?: {
|
|
21
|
+
type?: "website" | "article" | "book" | "profile" | "music.song" | "music.album" | "music.playlist" | "music.radio_station" | "video.movie" | "video.episode" | "video.tv_show" | "video.other";
|
|
22
|
+
locale?: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
};
|
|
25
|
+
twitter?: {
|
|
26
|
+
site?: string;
|
|
27
|
+
creator?: string;
|
|
28
|
+
};
|
|
29
|
+
canonicalUrl?: string;
|
|
30
|
+
alternateLanguages?: Record<string, string>;
|
|
31
|
+
noIndex?: boolean;
|
|
32
|
+
noArchive?: boolean;
|
|
33
|
+
noSnippet?: boolean;
|
|
34
|
+
manifest?: string | URL | null;
|
|
35
|
+
};
|
|
36
|
+
declare function constructMetadata({ baseUrl, title, fullTitle, description, icons, image, video, url, openGraph, twitter, canonicalUrl, alternateLanguages, noIndex, noArchive, noSnippet, manifest, }: metadataProps): Metadata;
|
|
37
|
+
|
|
8
38
|
declare const socialProviders: readonly [{
|
|
9
39
|
readonly provider: "apple";
|
|
10
40
|
readonly name: "Apple";
|
|
@@ -104,4 +134,4 @@ type Provider = {
|
|
|
104
134
|
icon?: ProviderIcon;
|
|
105
135
|
};
|
|
106
136
|
|
|
107
|
-
export { type Provider, type ProviderIcon, socialProviders };
|
|
137
|
+
export { type Provider, type ProviderIcon, constructMetadata, mapLocale, type metadataProps, socialProviders };
|
package/dist/extend.js
CHANGED
|
@@ -1,3 +1,202 @@
|
|
|
1
|
+
// src/lib/locale.ts
|
|
2
|
+
function mapLocale(locale) {
|
|
3
|
+
if (!locale) return "en_US";
|
|
4
|
+
const mapping = {
|
|
5
|
+
af: "af_ZA",
|
|
6
|
+
// Afrikaans - South Africa
|
|
7
|
+
am: "am_ET",
|
|
8
|
+
// Amharic - Ethiopia
|
|
9
|
+
ar: "ar_AR",
|
|
10
|
+
// Arabic - Saudi Arabia
|
|
11
|
+
bn: "bn_BD",
|
|
12
|
+
// Bengali - Bangladesh
|
|
13
|
+
bg: "bg_BG",
|
|
14
|
+
// Bulgarian - Bulgaria
|
|
15
|
+
cs: "cs_CZ",
|
|
16
|
+
// Czech - Czech Republic
|
|
17
|
+
da: "da_DK",
|
|
18
|
+
// Danish - Denmark
|
|
19
|
+
de: "de_DE",
|
|
20
|
+
// German - Germany
|
|
21
|
+
el: "el_GR",
|
|
22
|
+
// Greek - Greece
|
|
23
|
+
en: "en_US",
|
|
24
|
+
// English - United States
|
|
25
|
+
en_uk: "en_GB",
|
|
26
|
+
// English - United Kingdom
|
|
27
|
+
es: "es_ES",
|
|
28
|
+
// Spanish - Spain
|
|
29
|
+
es_mx: "es_MX",
|
|
30
|
+
// Spanish - Mexico
|
|
31
|
+
fa: "fa_IR",
|
|
32
|
+
// Persian/Farsi - Iran
|
|
33
|
+
fi: "fi_FI",
|
|
34
|
+
// Finnish - Finland
|
|
35
|
+
fr: "fr_FR",
|
|
36
|
+
// French - France
|
|
37
|
+
fr_ca: "fr_CA",
|
|
38
|
+
// French - Canada
|
|
39
|
+
he: "he_IL",
|
|
40
|
+
// Hebrew - Israel
|
|
41
|
+
hi: "hi_IN",
|
|
42
|
+
// Hindi - India
|
|
43
|
+
hr: "hr_HR",
|
|
44
|
+
// Croatian - Croatia
|
|
45
|
+
hu: "hu_HU",
|
|
46
|
+
// Hungarian - Hungary
|
|
47
|
+
id: "id_ID",
|
|
48
|
+
// Indonesian - Indonesia
|
|
49
|
+
it: "it_IT",
|
|
50
|
+
// Italian - Italy
|
|
51
|
+
ja: "ja_JP",
|
|
52
|
+
// Japanese - Japan
|
|
53
|
+
ko: "ko_KR",
|
|
54
|
+
// Korean - South Korea
|
|
55
|
+
ms: "ms_MY",
|
|
56
|
+
// Malay - Malaysia
|
|
57
|
+
nl: "nl_NL",
|
|
58
|
+
// Dutch - Netherlands
|
|
59
|
+
no: "nb_NO",
|
|
60
|
+
// Norwegian Bokmål - Norway
|
|
61
|
+
pl: "pl_PL",
|
|
62
|
+
// Polish - Poland
|
|
63
|
+
pt: "pt_PT",
|
|
64
|
+
// Portuguese - Portugal
|
|
65
|
+
pt_br: "pt_BR",
|
|
66
|
+
// Portuguese - Brazil
|
|
67
|
+
ro: "ro_RO",
|
|
68
|
+
// Romanian - Romania
|
|
69
|
+
ru: "ru_RU",
|
|
70
|
+
// Russian - Russia
|
|
71
|
+
sk: "sk_SK",
|
|
72
|
+
// Slovak - Slovakia
|
|
73
|
+
sr: "sr_RS",
|
|
74
|
+
// Serbian - Serbia
|
|
75
|
+
sv: "sv_SE",
|
|
76
|
+
// Swedish - Sweden
|
|
77
|
+
sw: "sw_KE",
|
|
78
|
+
// Swahili - Kenya
|
|
79
|
+
th: "th_TH",
|
|
80
|
+
// Thai - Thailand
|
|
81
|
+
tl: "tl_PH",
|
|
82
|
+
// Filipino/Tagalog - Philippines
|
|
83
|
+
tr: "tr_TR",
|
|
84
|
+
// Turkish - Türkiye
|
|
85
|
+
uk: "uk_UA",
|
|
86
|
+
// Ukrainian - Ukraine
|
|
87
|
+
ur: "ur_PK",
|
|
88
|
+
// Urdu - Pakistan
|
|
89
|
+
vi: "vi_VN",
|
|
90
|
+
// Vietnamese - Vietnam
|
|
91
|
+
zh: "zh_CN",
|
|
92
|
+
// Chinese (Simplified) - China
|
|
93
|
+
zh_hk: "zh_HK",
|
|
94
|
+
// Chinese (Traditional) - Hong Kong
|
|
95
|
+
zh_tw: "zh_TW"
|
|
96
|
+
// Chinese (Traditional) - Taiwan
|
|
97
|
+
};
|
|
98
|
+
return mapping[locale] || locale;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// src/lib/metadata.ts
|
|
102
|
+
import { getAssetsUrl } from "pelatform-ui";
|
|
103
|
+
function constructMetadata({
|
|
104
|
+
baseUrl,
|
|
105
|
+
title,
|
|
106
|
+
fullTitle,
|
|
107
|
+
description,
|
|
108
|
+
icons = [
|
|
109
|
+
{
|
|
110
|
+
rel: "apple-touch-icon",
|
|
111
|
+
sizes: "32x32",
|
|
112
|
+
url: getAssetsUrl("favicon/apple-touch-icon.png")
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
rel: "icon",
|
|
116
|
+
type: "image/png",
|
|
117
|
+
sizes: "32x32",
|
|
118
|
+
url: getAssetsUrl("favicon/favicon-32x32.png")
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
rel: "icon",
|
|
122
|
+
type: "image/png",
|
|
123
|
+
sizes: "16x16",
|
|
124
|
+
url: getAssetsUrl("favicon/favicon-16x16.png")
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
image,
|
|
128
|
+
video,
|
|
129
|
+
url,
|
|
130
|
+
openGraph = {
|
|
131
|
+
type: "website",
|
|
132
|
+
locale: "en_US"
|
|
133
|
+
},
|
|
134
|
+
twitter = {},
|
|
135
|
+
canonicalUrl,
|
|
136
|
+
alternateLanguages,
|
|
137
|
+
noIndex = false,
|
|
138
|
+
noArchive = false,
|
|
139
|
+
noSnippet = false,
|
|
140
|
+
manifest
|
|
141
|
+
}) {
|
|
142
|
+
return {
|
|
143
|
+
metadataBase: baseUrl ? new URL(baseUrl) : void 0,
|
|
144
|
+
title: fullTitle || title,
|
|
145
|
+
description,
|
|
146
|
+
icons,
|
|
147
|
+
openGraph: {
|
|
148
|
+
title,
|
|
149
|
+
description,
|
|
150
|
+
type: openGraph.type ?? "website",
|
|
151
|
+
locale: mapLocale(openGraph.locale),
|
|
152
|
+
...openGraph.name && {
|
|
153
|
+
siteName: openGraph.name
|
|
154
|
+
},
|
|
155
|
+
url,
|
|
156
|
+
...image && {
|
|
157
|
+
images: image
|
|
158
|
+
},
|
|
159
|
+
...video && {
|
|
160
|
+
videos: video
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
twitter: {
|
|
164
|
+
title,
|
|
165
|
+
description,
|
|
166
|
+
...image && {
|
|
167
|
+
card: "summary_large_image",
|
|
168
|
+
images: [image]
|
|
169
|
+
},
|
|
170
|
+
...video && {
|
|
171
|
+
player: video
|
|
172
|
+
},
|
|
173
|
+
...twitter.site && {
|
|
174
|
+
site: twitter.site
|
|
175
|
+
},
|
|
176
|
+
...twitter.creator && {
|
|
177
|
+
creator: twitter.creator
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
...(url || canonicalUrl || alternateLanguages) && {
|
|
181
|
+
alternates: {
|
|
182
|
+
...url || canonicalUrl ? { canonical: url || canonicalUrl } : {},
|
|
183
|
+
...alternateLanguages ? { languages: alternateLanguages } : {}
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
...(noIndex || noArchive || noSnippet) && {
|
|
187
|
+
robots: {
|
|
188
|
+
...noIndex ? { index: false, follow: false } : {},
|
|
189
|
+
...noArchive ? { noarchive: true } : {},
|
|
190
|
+
...noSnippet ? { nosnippet: true } : {}
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
...manifest && {
|
|
194
|
+
manifest
|
|
195
|
+
},
|
|
196
|
+
creator: "lukmanaviccena"
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
1
200
|
// src/lib/social-providers.ts
|
|
2
201
|
import { Icons } from "pelatform-ui";
|
|
3
202
|
var socialProviders = [
|
|
@@ -113,5 +312,7 @@ var socialProviders = [
|
|
|
113
312
|
}
|
|
114
313
|
];
|
|
115
314
|
export {
|
|
315
|
+
constructMetadata,
|
|
316
|
+
mapLocale,
|
|
116
317
|
socialProviders
|
|
117
318
|
};
|
package/dist/index.js
CHANGED
|
@@ -669,7 +669,7 @@ function HeaderSidebarMobile({ children }) {
|
|
|
669
669
|
import { useCallback as useCallback2, useMemo } from "react";
|
|
670
670
|
import Link5 from "next/link";
|
|
671
671
|
import { usePathname as usePathname3 } from "next/navigation";
|
|
672
|
-
import { useTranslations as useTranslations8 } from "next-intl";
|
|
672
|
+
import { useLocale as useLocale3, useTranslations as useTranslations8 } from "next-intl";
|
|
673
673
|
import { useLayout as useLayout2 } from "@pelatform/starter.hook";
|
|
674
674
|
import { BackLink } from "pelatform-ui/components";
|
|
675
675
|
import {
|
|
@@ -709,6 +709,7 @@ function SidebarContentMenu({
|
|
|
709
709
|
menu,
|
|
710
710
|
type = "default"
|
|
711
711
|
}) {
|
|
712
|
+
const locale = useLocale3();
|
|
712
713
|
const pathname = usePathname3();
|
|
713
714
|
const normalize = useCallback2((p) => {
|
|
714
715
|
if (!p) return "/";
|
|
@@ -794,7 +795,8 @@ function SidebarContentMenu({
|
|
|
794
795
|
return /* @__PURE__ */ jsx11(AccordionMenuItem, { value: child.path || "#", children: /* @__PURE__ */ jsx11(Link5, { href: child.path || "#", children: content }) }, idx);
|
|
795
796
|
}) })
|
|
796
797
|
] }, index))
|
|
797
|
-
}
|
|
798
|
+
},
|
|
799
|
+
`toggle-menu-${locale}`
|
|
798
800
|
);
|
|
799
801
|
}
|
|
800
802
|
return /* @__PURE__ */ jsx11(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pelatform/starter.shared",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "A part of SaaS starter kit for Pelatform applications.",
|
|
5
5
|
"author": "Pelatform",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@tanstack/react-query-devtools": "^5.91.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@pelatform/starter.config": "0.2.
|
|
43
|
-
"@pelatform/starter.hook": "0.2.
|
|
44
|
-
"@pelatform/starter.utils": "0.2.
|
|
42
|
+
"@pelatform/starter.config": "0.2.1",
|
|
43
|
+
"@pelatform/starter.hook": "0.2.1",
|
|
44
|
+
"@pelatform/starter.utils": "0.2.1",
|
|
45
45
|
"@pelatform/tsconfig": "^0.1.3",
|
|
46
46
|
"@types/react": "^19.2.7",
|
|
47
|
-
"lucide-react": "^0.
|
|
47
|
+
"lucide-react": "^0.559.0",
|
|
48
48
|
"next": "^16.0.8",
|
|
49
49
|
"next-intl": "^4.5.8",
|
|
50
50
|
"pelatform-ui": "^1.1.3",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"tsup": "^8.5.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@pelatform/starter.config": ">=0.
|
|
57
|
-
"@pelatform/starter.hook": ">=0.
|
|
58
|
-
"@pelatform/starter.utils": ">=0.
|
|
56
|
+
"@pelatform/starter.config": ">=0.2.0",
|
|
57
|
+
"@pelatform/starter.hook": ">=0.2.0",
|
|
58
|
+
"@pelatform/starter.utils": ">=0.2.0",
|
|
59
59
|
"lucide-react": ">=0.55.0",
|
|
60
60
|
"next": ">=16.0.0",
|
|
61
61
|
"next-intl": ">=4.5.0",
|