@anywayseo/tools 4.2.1 → 5.0.0
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/components/base/index.d.ts +1 -0
- package/dist/components/base/link/index.d.ts +2 -0
- package/dist/components/base/link/utils.d.ts +1 -0
- package/dist/components/game-info/utils.d.ts +2 -2
- package/dist/components/index.cjs +3 -1
- package/dist/components/index.mjs +3 -1
- package/dist/components/layout/header/locale-switcher/icons/earth/index.d.ts +2 -0
- package/dist/components/layout/header/locale-switcher/icons/france/index.d.ts +2 -0
- package/dist/components/layout/header/locale-switcher/icons/germany/index.d.ts +2 -0
- package/dist/components/layout/header/locale-switcher/icons/globe/index.d.ts +2 -0
- package/dist/components/layout/header/locale-switcher/icons/index.d.ts +6 -0
- package/dist/components/layout/header/locale-switcher/icons/italy/index.d.ts +2 -0
- package/dist/components/layout/header/locale-switcher/icons/russia/index.d.ts +2 -0
- package/dist/components/layout/header/locale-switcher/index.d.ts +8 -0
- package/dist/components/layout/header/locale-switcher/utils.d.ts +2 -0
- package/dist/components/layout/header/navigation/desktop/index.d.ts +1 -1
- package/dist/components/layout/header/navigation/index.d.ts +1 -1
- package/dist/components/layout/header/navigation/mobile/index.d.ts +1 -1
- package/dist/components/seo/index.d.ts +2 -3
- package/dist/hooks/index.cjs +4 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.mjs +4 -2
- package/dist/hooks/use-localization/index.d.ts +6 -0
- package/dist/i18n/index.cjs +11 -5
- package/dist/i18n/index.d.ts +3 -2
- package/dist/i18n/index.mjs +11 -5
- package/dist/i18n/resources/fr/index.d.ts +112 -0
- package/dist/{index-BrOQF5EQ.js → index-3nQCWHPU.js} +220 -86
- package/dist/index-At00w6EN.js +9 -0
- package/dist/{index-BPLxhZG_.js → index-BHfpWNqh.js} +183 -73
- package/dist/{index-MpNfBHkQ.mjs → index-BJRvnR8Q.mjs} +1 -5
- package/dist/index-BRVKhbs6.mjs +6 -0
- package/dist/index-BmaWfWLV.mjs +10 -0
- package/dist/{index-BV0hDmYP.js → index-BnmGE5_x.js} +3 -2
- package/dist/{index-DPO0aIC3.mjs → index-Bu4S7kG8.mjs} +7 -10
- package/dist/{index-DVcQxWMZ.js → index-C6MG_f24.js} +0 -4
- package/dist/{index-BE9gNdXx.mjs → index-CACDltm3.mjs} +183 -73
- package/dist/index-CYr1ct1t.js +93 -0
- package/dist/index-CbuiYkSg.js +5 -0
- package/dist/index-Cc85xj4h.mjs +27 -0
- package/dist/index-D1bJmcpz.js +49 -0
- package/dist/{index-DuQjQMNN.js → index-D34TfBTR.js} +7 -10
- package/dist/{index-CcsbqDXL.mjs → index-DVAydNYV.mjs} +7 -3
- package/dist/index-DnvTeCy9.mjs +50 -0
- package/dist/index-DqGO34ef.js +26 -0
- package/dist/{index-DF_u_tzx.js → index-Dur8aLpm.js} +7 -3
- package/dist/{index-CkTgVjZS.mjs → index-QazOxABc.mjs} +3 -2
- package/dist/{index-CaIyg0au.mjs → index-X2ihbchG.mjs} +201 -67
- package/dist/index-cQqALZIW.mjs +94 -0
- package/dist/index.cjs +41 -31
- package/dist/index.mjs +30 -20
- package/dist/providers/index.cjs +2 -2
- package/dist/providers/index.mjs +2 -2
- package/dist/providers/site-provider/index.d.ts +11 -5
- package/dist/types/api/index.d.ts +2 -2
- package/dist/types/components/icon/index.d.ts +2 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/locale-switcher/index.d.ts +5 -0
- package/dist/types/components/navigation/index.d.ts +9 -10
- package/dist/types/i18n/index.d.ts +7 -1
- package/dist/types/site/index.d.ts +15 -13
- package/dist/utils/api/index.d.ts +5 -0
- package/dist/utils/date/index.d.ts +4 -3
- package/dist/utils/index.cjs +23 -16
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.mjs +16 -9
- package/dist/utils/navigation/index.d.ts +2 -2
- package/dist/utils/numbers/index.d.ts +3 -3
- package/package.json +1 -1
- package/dist/components/layout/header/navigation/types.d.ts +0 -4
- package/dist/index-BClxYYix.js +0 -40
- package/dist/index-BNb-P8a6.mjs +0 -17
- package/dist/index-BhsXlbd8.js +0 -16
- package/dist/index-Ca_M-II5.mjs +0 -41
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
const DUMMY_PAGE_TYPE = "DUMMY";
|
|
2
|
+
const NavigationSlug = {
|
|
3
|
+
HEADER: "header-navigation",
|
|
4
|
+
FOOTER: "footer-navigation"
|
|
5
|
+
};
|
|
6
|
+
function isValidPath(value) {
|
|
7
|
+
return typeof value === "string" && (value === "" || value.startsWith("/"));
|
|
8
|
+
}
|
|
9
|
+
function isValidType(value) {
|
|
10
|
+
return typeof value === "string" && value !== DUMMY_PAGE_TYPE;
|
|
11
|
+
}
|
|
12
|
+
function transformNavItems(items) {
|
|
13
|
+
if (!items || !items.length) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
const transformed = [];
|
|
17
|
+
items.forEach((item) => {
|
|
18
|
+
var _a;
|
|
19
|
+
if (item && item.title && isValidType(item.type) && isValidPath(item.path)) {
|
|
20
|
+
const isNavGroup = (_a = item.items) == null ? void 0 : _a.length;
|
|
21
|
+
transformed.push({
|
|
22
|
+
label: item.title,
|
|
23
|
+
slug: isNavGroup ? "" : item.path.slice(1),
|
|
24
|
+
...isNavGroup && { children: transformNavItems(item.items) }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return transformed;
|
|
29
|
+
}
|
|
30
|
+
function transformSiteNavigation(strapiNavigation) {
|
|
31
|
+
const siteNavigation = {
|
|
32
|
+
header: {},
|
|
33
|
+
footer: {}
|
|
34
|
+
};
|
|
35
|
+
if (!strapiNavigation) {
|
|
36
|
+
return siteNavigation;
|
|
37
|
+
}
|
|
38
|
+
const groups = strapiNavigation.items;
|
|
39
|
+
for (const group of groups ?? []) {
|
|
40
|
+
const { slug, locale, items } = group ?? {};
|
|
41
|
+
if (locale && slug === NavigationSlug.HEADER) {
|
|
42
|
+
siteNavigation.header[locale] = transformNavItems(items ?? []);
|
|
43
|
+
}
|
|
44
|
+
if (locale && slug === NavigationSlug.FOOTER) {
|
|
45
|
+
siteNavigation.footer[locale] = transformNavItems(items ?? []);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return siteNavigation;
|
|
49
|
+
}
|
|
50
|
+
function getNavigation(fallback, strapiNavigation) {
|
|
51
|
+
const siteNavigation = {
|
|
52
|
+
header: fallback.header,
|
|
53
|
+
footer: fallback.footer
|
|
54
|
+
};
|
|
55
|
+
if (!strapiNavigation) {
|
|
56
|
+
return siteNavigation;
|
|
57
|
+
}
|
|
58
|
+
const navigation = transformSiteNavigation(strapiNavigation);
|
|
59
|
+
siteNavigation.header = { ...siteNavigation.header, ...navigation.header };
|
|
60
|
+
siteNavigation.footer = { ...siteNavigation.footer, ...navigation.footer };
|
|
61
|
+
return siteNavigation;
|
|
62
|
+
}
|
|
63
|
+
function getSiteName(url) {
|
|
64
|
+
if (!url) {
|
|
65
|
+
return "";
|
|
66
|
+
}
|
|
67
|
+
return url.replace(/^https?:\/\//, "");
|
|
68
|
+
}
|
|
69
|
+
function getLocale(defaultLocaleCode, locales) {
|
|
70
|
+
let locale = { code: "en", name: "Default" };
|
|
71
|
+
if (defaultLocaleCode && (locales == null ? void 0 : locales.length)) {
|
|
72
|
+
const foundLocale = locales.find(({ code }) => code === defaultLocaleCode);
|
|
73
|
+
if (foundLocale) {
|
|
74
|
+
locale = foundLocale;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return locale;
|
|
78
|
+
}
|
|
79
|
+
function getLocales(defaultLocaleCode, locales) {
|
|
80
|
+
if (!locales) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
return [...locales].sort((a, b) => {
|
|
84
|
+
if (a.code === defaultLocaleCode) return -1;
|
|
85
|
+
if (b.code === defaultLocaleCode) return 1;
|
|
86
|
+
return 0;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
getSiteName as a,
|
|
91
|
+
getLocale as b,
|
|
92
|
+
getLocales as c,
|
|
93
|
+
getNavigation as g
|
|
94
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
4
|
-
const index$1 = require("./index-
|
|
5
|
-
const
|
|
6
|
-
const index$
|
|
7
|
-
const
|
|
8
|
-
const index$4 = require("./index-
|
|
9
|
-
const index$5 = require("./index-
|
|
10
|
-
const index$6 = require("./index-
|
|
11
|
-
const
|
|
3
|
+
const index = require("./index-3nQCWHPU.js");
|
|
4
|
+
const index$1 = require("./index-D1bJmcpz.js");
|
|
5
|
+
const index$2 = require("./index-DqGO34ef.js");
|
|
6
|
+
const index$3 = require("./index-BnmGE5_x.js");
|
|
7
|
+
const i18n = require("./i18n/index.cjs");
|
|
8
|
+
const index$4 = require("./index-Dur8aLpm.js");
|
|
9
|
+
const index$5 = require("./index-BHfpWNqh.js");
|
|
10
|
+
const index$6 = require("./index-C6MG_f24.js");
|
|
11
|
+
const index$7 = require("./index-CYr1ct1t.js");
|
|
12
|
+
const index$8 = require("./index-D34TfBTR.js");
|
|
13
|
+
const index$9 = require("./index-At00w6EN.js");
|
|
14
|
+
const index$a = require("./index-CbuiYkSg.js");
|
|
12
15
|
exports.Author = index.Author;
|
|
13
16
|
exports.AuthorCard = index.AuthorCard;
|
|
14
17
|
exports.BonusCard = index.BonusCard;
|
|
@@ -34,25 +37,32 @@ exports.StrapiContentRenderer = index.StrapiContentRenderer;
|
|
|
34
37
|
exports.Table = index.Table;
|
|
35
38
|
exports.Tabs = index.Tabs;
|
|
36
39
|
exports.Tip = index.Tip;
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
45
|
-
exports.
|
|
46
|
-
exports.
|
|
47
|
-
exports.
|
|
48
|
-
exports.
|
|
49
|
-
exports.
|
|
50
|
-
exports.
|
|
51
|
-
exports.
|
|
52
|
-
exports.
|
|
53
|
-
exports.
|
|
54
|
-
exports.
|
|
55
|
-
exports.
|
|
56
|
-
exports.
|
|
57
|
-
exports.
|
|
58
|
-
exports.
|
|
40
|
+
exports.Link = index$1.Link;
|
|
41
|
+
exports.SiteProvider = index$1.SiteProvider;
|
|
42
|
+
exports.useSiteContext = index$1.useSiteContext;
|
|
43
|
+
exports.useLocalization = index$2.useLocalization;
|
|
44
|
+
exports.usePrimaryColors = index$3.usePrimaryColors;
|
|
45
|
+
exports.DEFAULT_LANGUAGE = i18n.DEFAULT_LANGUAGE;
|
|
46
|
+
exports.resources = i18n.resources;
|
|
47
|
+
exports.MdxProvider = index$4.MdxProvider;
|
|
48
|
+
exports.GameCharacteristic = index$5.GameCharacteristic;
|
|
49
|
+
exports.GameVolatility = index$5.GameVolatility;
|
|
50
|
+
exports.Animation = index$6.Animation;
|
|
51
|
+
exports.getLocale = index$7.getLocale;
|
|
52
|
+
exports.getLocales = index$7.getLocales;
|
|
53
|
+
exports.getNavigation = index$7.getNavigation;
|
|
54
|
+
exports.getSiteName = index$7.getSiteName;
|
|
55
|
+
exports.formatDate = index$8.formatDate;
|
|
56
|
+
exports.formatNumber = index$8.formatNumber;
|
|
57
|
+
exports.getCurrencySymbol = index$8.getCurrencySymbol;
|
|
58
|
+
exports.getCurrentMonth = index$8.getCurrentMonth;
|
|
59
|
+
exports.getCurrentYear = index$8.getCurrentYear;
|
|
60
|
+
exports.getSeededRandomComparator = index$8.getSeededRandomComparator;
|
|
61
|
+
exports.parseNumber = index$8.parseNumber;
|
|
62
|
+
exports.randomComparator = index$8.randomComparator;
|
|
63
|
+
exports.round = index$8.round;
|
|
64
|
+
exports.toFixedTwo = index$8.toFixedTwo;
|
|
65
|
+
exports.buildPath = index$9.buildPath;
|
|
66
|
+
exports.isRelativePath = index$9.isRelativePath;
|
|
67
|
+
exports.DARK_THEME_COLOR = index$a.DARK_THEME_COLOR;
|
|
68
|
+
exports.LIGHT_THEME_COLOR = index$a.LIGHT_THEME_COLOR;
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { k, A, B, a, l, C, F, b, c, G, d, e, f, m, H, L, n, g, N, P, S, h, T, i, j } from "./index-
|
|
2
|
-
import { u } from "./index-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { k, A, B, a, l, C, F, b, c, G, d, e, f, m, H, L, n, g, N, P, S, h, T, i, j } from "./index-X2ihbchG.mjs";
|
|
2
|
+
import { L as L2, S as S2, u } from "./index-DnvTeCy9.mjs";
|
|
3
|
+
import { u as u2 } from "./index-Cc85xj4h.mjs";
|
|
4
|
+
import { u as u3 } from "./index-QazOxABc.mjs";
|
|
5
|
+
import { DEFAULT_LANGUAGE, resources } from "./i18n/index.mjs";
|
|
6
|
+
import { M } from "./index-DVAydNYV.mjs";
|
|
7
|
+
import { a as a2, G as G2 } from "./index-CACDltm3.mjs";
|
|
8
|
+
import { A as A2 } from "./index-BJRvnR8Q.mjs";
|
|
9
|
+
import { b as b2, c as c2, g as g2, a as a3 } from "./index-cQqALZIW.mjs";
|
|
10
|
+
import { f as f2, b as b3, c as c3, a as a4, g as g3, e as e2, p, d as d2, r, t } from "./index-Bu4S7kG8.mjs";
|
|
11
|
+
import { b as b4, i as i2 } from "./index-BmaWfWLV.mjs";
|
|
12
|
+
import { D, L as L3 } from "./index-BRVKhbs6.mjs";
|
|
10
13
|
export {
|
|
11
14
|
A2 as Animation,
|
|
12
15
|
k as Author,
|
|
@@ -16,6 +19,7 @@ export {
|
|
|
16
19
|
l as Center,
|
|
17
20
|
C as ContactForm,
|
|
18
21
|
D as DARK_THEME_COLOR,
|
|
22
|
+
DEFAULT_LANGUAGE,
|
|
19
23
|
F as Faq,
|
|
20
24
|
b as FeatureCard,
|
|
21
25
|
c as FeatureCardGrid,
|
|
@@ -27,8 +31,9 @@ export {
|
|
|
27
31
|
G2 as GameVolatility,
|
|
28
32
|
m as Grid,
|
|
29
33
|
H as HowTo,
|
|
30
|
-
|
|
34
|
+
L3 as LIGHT_THEME_COLOR,
|
|
31
35
|
L as Layout,
|
|
36
|
+
L2 as Link,
|
|
32
37
|
n as LinkButton,
|
|
33
38
|
g as List,
|
|
34
39
|
M as MdxProvider,
|
|
@@ -40,19 +45,24 @@ export {
|
|
|
40
45
|
T as Table,
|
|
41
46
|
i as Tabs,
|
|
42
47
|
j as Tip,
|
|
48
|
+
b4 as buildPath,
|
|
43
49
|
f2 as formatDate,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
b3 as formatNumber,
|
|
51
|
+
c3 as getCurrencySymbol,
|
|
52
|
+
a4 as getCurrentMonth,
|
|
53
|
+
g3 as getCurrentYear,
|
|
54
|
+
b2 as getLocale,
|
|
55
|
+
c2 as getLocales,
|
|
56
|
+
g2 as getNavigation,
|
|
48
57
|
e2 as getSeededRandomComparator,
|
|
49
|
-
|
|
58
|
+
a3 as getSiteName,
|
|
59
|
+
i2 as isRelativePath,
|
|
50
60
|
p as parseNumber,
|
|
51
61
|
d2 as randomComparator,
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
resources,
|
|
63
|
+
r as round,
|
|
54
64
|
t as toFixedTwo,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
u2 as useLocalization,
|
|
66
|
+
u3 as usePrimaryColors,
|
|
67
|
+
u as useSiteContext
|
|
58
68
|
};
|
package/dist/providers/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("../index-
|
|
4
|
-
const index$1 = require("../index-
|
|
3
|
+
const index = require("../index-Dur8aLpm.js");
|
|
4
|
+
const index$1 = require("../index-D1bJmcpz.js");
|
|
5
5
|
exports.MdxProvider = index.MdxProvider;
|
|
6
6
|
exports.SiteProvider = index$1.SiteProvider;
|
|
7
7
|
exports.useSiteContext = index$1.useSiteContext;
|
package/dist/providers/index.mjs
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
interface
|
|
2
|
+
import { ILocale, ISiteConfig, ISiteLocalization, ISiteMetadata, ISiteNavigation } from '../../types';
|
|
3
|
+
interface ISiteContextInput {
|
|
4
4
|
metadata: ISiteMetadata;
|
|
5
|
-
|
|
5
|
+
navigation: ISiteNavigation;
|
|
6
|
+
localization: ISiteLocalization;
|
|
7
|
+
config: ISiteConfig;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
interface ISiteContext extends ISiteContextInput {
|
|
10
|
+
localization: ISiteLocalization & {
|
|
11
|
+
currentLocale: ILocale;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
declare const SiteProvider: FC<PropsWithChildren<ISiteContextInput>>;
|
|
9
15
|
export default SiteProvider;
|
|
10
16
|
export declare function useSiteContext(): ISiteContext;
|
|
@@ -2,7 +2,7 @@ export interface IStrapiNavigation {
|
|
|
2
2
|
readonly items: ReadonlyArray<IStrapiNavigationGroup | null> | null;
|
|
3
3
|
}
|
|
4
4
|
export interface IStrapiNavigationGroup {
|
|
5
|
-
readonly
|
|
5
|
+
readonly locale: string | null;
|
|
6
6
|
readonly slug: string | null;
|
|
7
7
|
readonly items: ReadonlyArray<IStrapiNavigationItem | null> | null;
|
|
8
8
|
}
|
|
@@ -11,6 +11,6 @@ export interface IStrapiNavigationItem {
|
|
|
11
11
|
readonly title: string | null;
|
|
12
12
|
readonly slug: string | null;
|
|
13
13
|
readonly path: string | null;
|
|
14
|
-
readonly menuAttached: boolean | null;
|
|
15
14
|
readonly items: ReadonlyArray<IStrapiNavigationItem | null> | null;
|
|
15
|
+
readonly menuAttached?: boolean | null;
|
|
16
16
|
}
|
|
@@ -7,8 +7,10 @@ export * from './game-card';
|
|
|
7
7
|
export * from './game-info';
|
|
8
8
|
export * from './grid';
|
|
9
9
|
export * from './how-to';
|
|
10
|
+
export * from './icon';
|
|
10
11
|
export * from './image';
|
|
11
12
|
export * from './link';
|
|
13
|
+
export * from './locale-switcher';
|
|
12
14
|
export * from './navigation';
|
|
13
15
|
export * from './pros-cons';
|
|
14
16
|
export * from './strapi-component';
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface INavItem<P extends Path = Path> {
|
|
5
|
-
path: P | EmptyPath;
|
|
1
|
+
import { ILocale } from '../../i18n';
|
|
2
|
+
export interface INavItem {
|
|
3
|
+
slug: string;
|
|
6
4
|
label: string;
|
|
7
|
-
children?:
|
|
5
|
+
children?: Omit<INavItem, 'children'>[];
|
|
8
6
|
}
|
|
9
|
-
export interface
|
|
10
|
-
|
|
11
|
-
label: string;
|
|
7
|
+
export interface INavigation {
|
|
8
|
+
[locale: ILocale['code']]: INavItem[] | undefined;
|
|
12
9
|
}
|
|
13
|
-
export {
|
|
10
|
+
export type NavigationProps = {
|
|
11
|
+
menu: INavItem[];
|
|
12
|
+
};
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
export type LanguageCode = 'en' | 'it' | 'de' | 'ru';
|
|
1
|
+
export type LanguageCode = 'en' | 'it' | 'de' | 'fr' | 'ru';
|
|
2
2
|
export type Currency = 'USD' | 'EUR' | 'GBP' | 'RUB';
|
|
3
|
+
type LocaleCode = string;
|
|
4
|
+
export interface ILocale {
|
|
5
|
+
code: LocaleCode;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Image,
|
|
2
|
+
import { Image, INavigation } from '../components';
|
|
3
3
|
import { ISeo } from '../content';
|
|
4
|
-
import { Currency,
|
|
4
|
+
import { Currency, ILocale } from '../i18n';
|
|
5
5
|
interface ISiteHeaderConfig {
|
|
6
|
-
navigation?: INavItem[];
|
|
7
6
|
toolbar?: ReactNode;
|
|
8
7
|
}
|
|
9
8
|
interface ISiteFooterConfig {
|
|
10
|
-
navigation?: INavItem[];
|
|
11
9
|
extra?: ReactNode;
|
|
12
10
|
showDisclaimer?: boolean;
|
|
13
11
|
}
|
|
14
12
|
interface ISiteThemeConfig {
|
|
15
13
|
isInvertedColor?: boolean;
|
|
16
14
|
}
|
|
17
|
-
export interface
|
|
15
|
+
export interface ISiteConfig {
|
|
16
|
+
theme?: ISiteThemeConfig;
|
|
18
17
|
header?: ISiteHeaderConfig;
|
|
19
18
|
footer?: ISiteFooterConfig;
|
|
20
|
-
|
|
19
|
+
}
|
|
20
|
+
export interface ISiteNavigation {
|
|
21
|
+
header: INavigation;
|
|
22
|
+
footer: INavigation;
|
|
23
|
+
}
|
|
24
|
+
export interface ISiteLocalization {
|
|
25
|
+
currency: Currency | Currency[];
|
|
26
|
+
defaultLocale: ILocale;
|
|
27
|
+
locales: ILocale[];
|
|
21
28
|
}
|
|
22
29
|
export interface ISiteMetadata {
|
|
23
30
|
name: string;
|
|
24
|
-
|
|
25
|
-
lang: LanguageCode;
|
|
26
|
-
currency: Currency | Currency[];
|
|
31
|
+
lang: ILocale['code'];
|
|
27
32
|
seo: ISeo;
|
|
33
|
+
logo: Image;
|
|
28
34
|
/** Planned */
|
|
29
35
|
favicon?: Image;
|
|
30
36
|
}
|
|
31
|
-
export interface ISiteNavigation {
|
|
32
|
-
header: INavItem[];
|
|
33
|
-
footer: INavItem[];
|
|
34
|
-
}
|
|
35
37
|
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ILocale, ISiteNavigation, IStrapiNavigation } from '../../types';
|
|
2
|
+
export declare function getNavigation(fallback: ISiteNavigation, strapiNavigation?: IStrapiNavigation | null): ISiteNavigation;
|
|
3
|
+
export declare function getSiteName(url?: string | null): string;
|
|
4
|
+
export declare function getLocale(defaultLocaleCode: ILocale['code'], locales?: ILocale[] | null): ILocale;
|
|
5
|
+
export declare function getLocales(defaultLocaleCode: ILocale['code'], locales?: ILocale[] | null): ILocale[];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
1
|
+
import { ILocale } from '../../types';
|
|
2
|
+
export declare function getCurrentYear(locale?: ILocale['code']): string;
|
|
3
|
+
export declare function getCurrentMonth(locale?: ILocale['code']): string;
|
|
3
4
|
interface IFormatDateOptions {
|
|
4
5
|
value: string | number | Date;
|
|
5
|
-
locale?:
|
|
6
|
+
locale?: ILocale['code'];
|
|
6
7
|
options?: Intl.DateTimeFormatOptions;
|
|
7
8
|
}
|
|
8
9
|
export declare function formatDate({ value, locale, options }: IFormatDateOptions): string;
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("../index-
|
|
4
|
-
const index$1 = require("../index-
|
|
5
|
-
const index$2 = require("../index-
|
|
3
|
+
const index = require("../index-C6MG_f24.js");
|
|
4
|
+
const index$1 = require("../index-CYr1ct1t.js");
|
|
5
|
+
const index$2 = require("../index-D34TfBTR.js");
|
|
6
|
+
const index$3 = require("../index-At00w6EN.js");
|
|
7
|
+
const index$4 = require("../index-CbuiYkSg.js");
|
|
6
8
|
exports.Animation = index.Animation;
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
9
|
+
exports.getLocale = index$1.getLocale;
|
|
10
|
+
exports.getLocales = index$1.getLocales;
|
|
11
|
+
exports.getNavigation = index$1.getNavigation;
|
|
12
|
+
exports.getSiteName = index$1.getSiteName;
|
|
13
|
+
exports.formatDate = index$2.formatDate;
|
|
14
|
+
exports.formatNumber = index$2.formatNumber;
|
|
15
|
+
exports.getCurrencySymbol = index$2.getCurrencySymbol;
|
|
16
|
+
exports.getCurrentMonth = index$2.getCurrentMonth;
|
|
17
|
+
exports.getCurrentYear = index$2.getCurrentYear;
|
|
18
|
+
exports.getSeededRandomComparator = index$2.getSeededRandomComparator;
|
|
19
|
+
exports.parseNumber = index$2.parseNumber;
|
|
20
|
+
exports.randomComparator = index$2.randomComparator;
|
|
21
|
+
exports.round = index$2.round;
|
|
22
|
+
exports.toFixedTwo = index$2.toFixedTwo;
|
|
23
|
+
exports.buildPath = index$3.buildPath;
|
|
24
|
+
exports.isRelativePath = index$3.isRelativePath;
|
|
25
|
+
exports.DARK_THEME_COLOR = index$4.DARK_THEME_COLOR;
|
|
26
|
+
exports.LIGHT_THEME_COLOR = index$4.LIGHT_THEME_COLOR;
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.mjs
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import { A
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { A } from "../index-BJRvnR8Q.mjs";
|
|
2
|
+
import { b, c, g, a } from "../index-cQqALZIW.mjs";
|
|
3
|
+
import { f, b as b2, c as c2, a as a2, g as g2, e, p, d, r, t } from "../index-Bu4S7kG8.mjs";
|
|
4
|
+
import { b as b3, i } from "../index-BmaWfWLV.mjs";
|
|
5
|
+
import { D, L } from "../index-BRVKhbs6.mjs";
|
|
4
6
|
export {
|
|
5
7
|
A as Animation,
|
|
6
8
|
D as DARK_THEME_COLOR,
|
|
7
9
|
L as LIGHT_THEME_COLOR,
|
|
10
|
+
b3 as buildPath,
|
|
8
11
|
f as formatDate,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
b2 as formatNumber,
|
|
13
|
+
c2 as getCurrencySymbol,
|
|
14
|
+
a2 as getCurrentMonth,
|
|
15
|
+
g2 as getCurrentYear,
|
|
16
|
+
b as getLocale,
|
|
17
|
+
c as getLocales,
|
|
18
|
+
g as getNavigation,
|
|
13
19
|
e as getSeededRandomComparator,
|
|
20
|
+
a as getSiteName,
|
|
21
|
+
i as isRelativePath,
|
|
14
22
|
p as parseNumber,
|
|
15
23
|
d as randomComparator,
|
|
16
24
|
r as round,
|
|
17
|
-
t as toFixedTwo
|
|
18
|
-
t2 as transformSiteNavigation
|
|
25
|
+
t as toFixedTwo
|
|
19
26
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
1
|
+
export declare function buildPath(slug: string, parentSlug: string): string;
|
|
2
|
+
export declare function isRelativePath(path?: string): boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Currency,
|
|
1
|
+
import { Currency, ILocale } from '../../types';
|
|
2
2
|
import { PercentFormatType } from './types';
|
|
3
3
|
export declare function round(number: number, precision: number): number;
|
|
4
4
|
export declare function toFixedTwo(number: number): number;
|
|
5
5
|
type FormatNumberOptions = {
|
|
6
|
-
locale?:
|
|
6
|
+
locale?: ILocale['code'];
|
|
7
7
|
precision?: number;
|
|
8
8
|
hasTrailingZeros?: boolean;
|
|
9
9
|
hasSign?: boolean;
|
|
@@ -16,5 +16,5 @@ type FormatNumberOptions = {
|
|
|
16
16
|
});
|
|
17
17
|
export declare function formatNumber(number: number, options?: FormatNumberOptions): string;
|
|
18
18
|
export declare function parseNumber(value: string): number | null;
|
|
19
|
-
export declare function getCurrencySymbol(currencyCode: Currency): string;
|
|
19
|
+
export declare function getCurrencySymbol(currencyCode: Currency, locale?: ILocale['code']): string;
|
|
20
20
|
export {};
|
package/package.json
CHANGED
package/dist/index-BClxYYix.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const DUMMY_PAGE_TYPE = "DUMMY";
|
|
3
|
-
function isValidPath(value) {
|
|
4
|
-
return typeof value === "string" && (value === "" || value.startsWith("/"));
|
|
5
|
-
}
|
|
6
|
-
function isValidType(value) {
|
|
7
|
-
return typeof value === "string" && value !== DUMMY_PAGE_TYPE;
|
|
8
|
-
}
|
|
9
|
-
function transformNavItems(items, parentPath = "") {
|
|
10
|
-
if (!items || !items.length) {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
const transformed = [];
|
|
14
|
-
items.forEach((item) => {
|
|
15
|
-
var _a;
|
|
16
|
-
if (item && item.title && isValidType(item.type) && isValidPath(item.path)) {
|
|
17
|
-
let path = `${parentPath}${item.path}`;
|
|
18
|
-
let children = [];
|
|
19
|
-
if ((_a = item.items) == null ? void 0 : _a.length) {
|
|
20
|
-
path = "";
|
|
21
|
-
children = transformNavItems(item.items, path);
|
|
22
|
-
}
|
|
23
|
-
transformed.push({ label: item.title, path, children });
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
return transformed;
|
|
27
|
-
}
|
|
28
|
-
function transformSiteNavigation(strapiNavigation) {
|
|
29
|
-
if (!strapiNavigation) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
const navGroups = strapiNavigation.items;
|
|
33
|
-
const headerNav = navGroups == null ? void 0 : navGroups.find((item) => (item == null ? void 0 : item.slug) === "header-navigation");
|
|
34
|
-
const footerNav = navGroups == null ? void 0 : navGroups.find((item) => (item == null ? void 0 : item.slug) === "footer-navigation");
|
|
35
|
-
return {
|
|
36
|
-
header: transformNavItems(headerNav == null ? void 0 : headerNav.items),
|
|
37
|
-
footer: transformNavItems(footerNav == null ? void 0 : footerNav.items)
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
exports.transformSiteNavigation = transformSiteNavigation;
|
package/dist/index-BNb-P8a6.mjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
3
|
-
const SiteContext = createContext(null);
|
|
4
|
-
const SiteProvider = ({ children, ...value }) => {
|
|
5
|
-
return /* @__PURE__ */ jsx(SiteContext.Provider, { value, children });
|
|
6
|
-
};
|
|
7
|
-
function useSiteContext() {
|
|
8
|
-
const context = useContext(SiteContext);
|
|
9
|
-
if (!context) {
|
|
10
|
-
throw new Error("useSiteContext must be used within SiteProvider");
|
|
11
|
-
}
|
|
12
|
-
return context;
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
SiteProvider as S,
|
|
16
|
-
useSiteContext as u
|
|
17
|
-
};
|
package/dist/index-BhsXlbd8.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const SiteContext = react.createContext(null);
|
|
5
|
-
const SiteProvider = ({ children, ...value }) => {
|
|
6
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SiteContext.Provider, { value, children });
|
|
7
|
-
};
|
|
8
|
-
function useSiteContext() {
|
|
9
|
-
const context = react.useContext(SiteContext);
|
|
10
|
-
if (!context) {
|
|
11
|
-
throw new Error("useSiteContext must be used within SiteProvider");
|
|
12
|
-
}
|
|
13
|
-
return context;
|
|
14
|
-
}
|
|
15
|
-
exports.SiteProvider = SiteProvider;
|
|
16
|
-
exports.useSiteContext = useSiteContext;
|