@anywayseo/tools 3.1.1 → 4.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.
Files changed (44) hide show
  1. package/dist/components/base/grid/index.d.ts +3 -4
  2. package/dist/components/base/grid/utils.d.ts +2 -2
  3. package/dist/components/bonus-card/content/index.d.ts +2 -1
  4. package/dist/components/bonus-card/index.d.ts +5 -1
  5. package/dist/components/bonus-card/title/index.d.ts +3 -1
  6. package/dist/components/bonus-card-grid/index.d.ts +9 -0
  7. package/dist/components/feature-card-grid/index.d.ts +9 -0
  8. package/dist/components/game-card/index.d.ts +2 -2
  9. package/dist/components/game-card-grid/index.d.ts +12 -0
  10. package/dist/components/index.cjs +5 -3
  11. package/dist/components/index.d.ts +4 -2
  12. package/dist/components/index.mjs +16 -14
  13. package/dist/components/strapi-component/external-image/index.d.ts +7 -0
  14. package/dist/components/strapi-component/index.d.ts +9 -0
  15. package/dist/components/strapi-component/rich-text/index.d.ts +6 -0
  16. package/dist/components/strapi-component/utils.d.ts +3 -0
  17. package/dist/components/strapi-content-renderer/index.d.ts +8 -0
  18. package/dist/components/strapi-content-renderer/utils.d.ts +2 -0
  19. package/dist/{index-eta4hdHD.js → index-BmkMQFW1.js} +192 -39
  20. package/dist/{index-Cte2-g6s.js → index-Bw7vqsyw.js} +15 -0
  21. package/dist/{index-25M8hPOF.mjs → index-DLy2LYCD.mjs} +15 -0
  22. package/dist/{index-Cin-9-As.mjs → index-DbwY2gVh.mjs} +203 -50
  23. package/dist/index-DzEvPZny.mjs +87 -0
  24. package/dist/index-NsIHOkeN.js +86 -0
  25. package/dist/index.cjs +9 -7
  26. package/dist/index.mjs +23 -21
  27. package/dist/types/components/common/index.d.ts +2 -1
  28. package/dist/types/components/external-image/index.d.ts +14 -0
  29. package/dist/types/components/game-card/index.d.ts +1 -0
  30. package/dist/types/components/grid/index.d.ts +3 -0
  31. package/dist/types/components/index.d.ts +3 -0
  32. package/dist/types/components/strapi-component/index.d.ts +5 -0
  33. package/dist/utils/index.cjs +4 -4
  34. package/dist/utils/index.d.ts +1 -2
  35. package/dist/utils/index.mjs +7 -7
  36. package/dist/utils/sorting/index.d.ts +2 -0
  37. package/package.json +2 -1
  38. package/dist/components/base/grid/types.d.ts +0 -3
  39. package/dist/components/features/index.d.ts +0 -7
  40. package/dist/components/rich-text-renderer/index.d.ts +0 -6
  41. package/dist/index-CHnNtadm.mjs +0 -294
  42. package/dist/index-D2JqGE4u.js +0 -293
  43. package/dist/utils/api/index.d.ts +0 -1
  44. package/dist/utils/gatsby/index.d.ts +0 -3
@@ -1,16 +1,16 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { Box, Collapse, Text, Button, Flex, Stack, Image, Center as Center$1, SimpleGrid, Link, Card, CardHeader, Heading, CardBody, Popover, PopoverTrigger, Portal, PopoverContent, PopoverBody, CardFooter, useToast, useColorModeValue, VStack, FormControl, FormLabel, InputGroup, InputLeftElement, Input, Textarea, Accordion, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, LinkBox, LinkOverlay, IconButton, AbsoluteCenter, Spinner, useDisclosure, Divider, Circle, Container as Container$1, List as List$1, ListItem, Icon, ListIcon, TableContainer, Table as Table$1, Thead, Tr, Th, Tbody, Td, TableCaption, Tabs as Tabs$1, TabList, Tab, TabPanels, TabPanel } from "@chakra-ui/react";
3
3
  import { useTranslation } from "react-i18next";
4
- import { A as Animation, b as formatNumber, c as getCurrencySymbol, f as formatDate, g as getCurrentYear, a as getCurrentMonth } from "./index-25M8hPOF.mjs";
4
+ import { A as Animation, e as getSeedRandomComparator, d as randomComparator, b as formatNumber, c as getCurrencySymbol, f as formatDate, g as getCurrentYear, a as getCurrentMonth } from "./index-DLy2LYCD.mjs";
5
5
  import { a as GameCharacteristic } from "./index-DoBCANwf.mjs";
6
6
  import "@ctrl/tinycolor";
7
7
  import { useRef, useState, useLayoutEffect, Fragment as Fragment$1, forwardRef, useEffect, useMemo } from "react";
8
8
  import { EmailIcon, StarIcon, CloseIcon, ExternalLinkIcon, ChevronRightIcon, ChevronDownIcon, HamburgerIcon, ChevronUpIcon, WarningIcon, CheckCircleIcon } from "@chakra-ui/icons";
9
- import { u as usePrimaryColors } from "./index-xuSxvz5z.mjs";
10
9
  import { useMDXComponents } from "@mdx-js/react";
11
10
  import { u as useSiteContext } from "./index-BNb-P8a6.mjs";
12
- import { t } from "i18next";
13
11
  import { Link as Link$1 } from "gatsby";
12
+ import { u as usePrimaryColors } from "./index-xuSxvz5z.mjs";
13
+ import { t } from "i18next";
14
14
  import Markdown from "react-markdown";
15
15
  const ONE_LINE_HEIGHT = 24;
16
16
  const Bio = ({ content, maxLines = 1 }) => {
@@ -117,14 +117,14 @@ const AuthorCard = ({ author, ...boxProps }) => {
117
117
  )
118
118
  ] });
119
119
  };
120
- const BonusCardContent = ({ content }) => {
120
+ const BonusCardContent = ({ content, buttonColor }) => {
121
121
  const { t: t2 } = useTranslation("author");
122
122
  return /* @__PURE__ */ jsx(Popover, { autoFocus: false, isLazy: true, lazyBehavior: "keepMounted", children: ({ isOpen }) => /* @__PURE__ */ jsxs(Fragment, { children: [
123
- /* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(Button, { size: "sm", variant: "link", color: "white", children: isOpen ? t2("action.collapse") : t2("action.expand") }) }),
123
+ /* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(Button, { size: "sm", variant: "link", color: buttonColor, children: isOpen ? t2("action.collapse") : t2("action.expand") }) }),
124
124
  /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(PopoverContent, { children: /* @__PURE__ */ jsx(PopoverBody, { children: Array.isArray(content) ? /* @__PURE__ */ jsx(Stack, { children: content.map((paragraph, index) => /* @__PURE__ */ jsx(Text, { as: "span", children: paragraph }, index)) }) : /* @__PURE__ */ jsx(Text, { children: content }) }) }) })
125
125
  ] }) });
126
126
  };
127
- const BonusCardTitle = ({ content }) => {
127
+ const BonusCardTitle = ({ content, color, textColor }) => {
128
128
  return /* @__PURE__ */ jsx(
129
129
  Text,
130
130
  {
@@ -133,22 +133,33 @@ const BonusCardTitle = ({ content }) => {
133
133
  py: 1,
134
134
  px: 2,
135
135
  borderRadius: "md",
136
- bg: "yellow",
137
- color: "black",
136
+ bg: color,
137
+ fontSize: "md",
138
138
  fontWeight: "bold",
139
- fontSize: "lg",
139
+ color: textColor,
140
140
  children: content
141
141
  }
142
142
  );
143
143
  };
144
- const BonusCard = ({ title, subtitle, content, link, image, className }) => {
144
+ const BonusCard = ({
145
+ title,
146
+ subtitle,
147
+ content,
148
+ link,
149
+ image,
150
+ color = "linear-gradient(90deg, #3b1f47, #731d58)",
151
+ textColor = "whiteAlpha.900",
152
+ titleColor = "yellow",
153
+ titleTextColor = "black",
154
+ className
155
+ }) => {
145
156
  return /* @__PURE__ */ jsxs(
146
157
  Card,
147
158
  {
148
159
  as: "article",
149
160
  h: "full",
150
- color: "whiteAlpha.900",
151
- bg: "linear-gradient(90deg, #3b1f47, #731d58)",
161
+ color: textColor,
162
+ bg: color,
152
163
  _before: image ? {
153
164
  content: '""',
154
165
  position: "absolute",
@@ -165,15 +176,23 @@ const BonusCard = ({ title, subtitle, content, link, image, className }) => {
165
176
  className,
166
177
  children: [
167
178
  /* @__PURE__ */ jsxs(CardBody, { as: "section", pb: 0, flex: 1, children: [
168
- /* @__PURE__ */ jsx(BonusCardTitle, { content: title }),
179
+ /* @__PURE__ */ jsx(BonusCardTitle, { content: title, color: titleColor, textColor: titleTextColor }),
169
180
  /* @__PURE__ */ jsx(Text, { fontSize: "2xl", fontWeight: "bold", my: 2, children: subtitle }),
170
- /* @__PURE__ */ jsx(BonusCardContent, { content })
181
+ /* @__PURE__ */ jsx(BonusCardContent, { content, buttonColor: textColor })
171
182
  ] }),
172
183
  /* @__PURE__ */ jsx(CardFooter, { as: "footer", p: 4, children: /* @__PURE__ */ jsx(LinkButton, { ...link, width: "full" }) })
173
184
  ]
174
185
  }
175
186
  );
176
187
  };
188
+ const BonusCardGrid = ({
189
+ items,
190
+ columns = { base: 1, md: 2, lg: 3 },
191
+ gap = 4,
192
+ ...boxProps
193
+ }) => {
194
+ return /* @__PURE__ */ jsx(Grid, { items, columns, gap, render: (item) => /* @__PURE__ */ jsx(BonusCard, { ...item }), ...boxProps });
195
+ };
177
196
  const ContactForm = ({ ...boxProps }) => {
178
197
  const toast = useToast();
179
198
  const { t: t2 } = useTranslation("contactForm");
@@ -266,13 +285,18 @@ const FeatureCard = ({ title, description }) => {
266
285
  /* @__PURE__ */ jsx(CardBody, { as: "section", pt: 0, children: /* @__PURE__ */ jsx(Text, { color: "gray.500", children: description }) })
267
286
  ] });
268
287
  };
269
- const Features = ({ features, ...boxProps }) => {
288
+ const FeatureCardGrid = ({
289
+ items,
290
+ columns = { base: 1, md: 2, lg: 3 },
291
+ gap = 4,
292
+ ...boxProps
293
+ }) => {
270
294
  return /* @__PURE__ */ jsx(
271
295
  Grid,
272
296
  {
273
- items: features,
274
- columns: { base: 1, md: 2, lg: 3 },
275
- gap: 10,
297
+ items,
298
+ columns,
299
+ gap,
276
300
  getKey: ({ title }) => title,
277
301
  render: (item) => /* @__PURE__ */ jsx(FeatureCard, { ...item }),
278
302
  ...boxProps
@@ -302,6 +326,30 @@ const GameCard = ({ name, description, image, link, height = "auto" }) => {
302
326
  }
303
327
  );
304
328
  };
329
+ const GameCardGrid = ({
330
+ items,
331
+ columns = { base: 1, md: 2, lg: 3 },
332
+ gap = 4,
333
+ cardHeight = "full",
334
+ order = "default",
335
+ randomSeed,
336
+ ...boxProps
337
+ }) => {
338
+ let sortedItems = items;
339
+ if (order === "random") {
340
+ sortedItems = [...items].sort(randomSeed ? getSeedRandomComparator(randomSeed) : randomComparator);
341
+ }
342
+ return /* @__PURE__ */ jsx(
343
+ Grid,
344
+ {
345
+ items: sortedItems,
346
+ columns,
347
+ gap,
348
+ render: (item) => /* @__PURE__ */ jsx(GameCard, { ...item, height: cardHeight }),
349
+ ...boxProps
350
+ }
351
+ );
352
+ };
305
353
  const GameDemoContent = ({ src, isFullscreen, isLoaded, onLoad, onToggleFullscreen }) => {
306
354
  const { t: t2 } = useTranslation("gameDemo");
307
355
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -912,10 +960,6 @@ const ProsCons = ({ items, ...boxProps }) => {
912
960
  /* @__PURE__ */ jsx(ProsConsCard, { itemType: "cons", items: cons })
913
961
  ] });
914
962
  };
915
- const RichTextRenderer = ({ content }) => {
916
- const components = useMDXComponents();
917
- return /* @__PURE__ */ jsx(Markdown, { components, children: content });
918
- };
919
963
  function replacePlaceholders(text, placeholders) {
920
964
  Object.entries(placeholders).forEach(([placeholder, replacement]) => {
921
965
  const regex = new RegExp(`{{${placeholder}}}`, "g");
@@ -972,21 +1016,6 @@ const Table = ({
972
1016
  }
973
1017
  );
974
1018
  };
975
- const Tabs = ({ items, render, ...boxProps }) => {
976
- const { tabs, panels } = useMemo(() => {
977
- const tabs2 = [];
978
- const panels2 = [];
979
- items.forEach(({ content, ...tab }) => {
980
- tabs2.push(tab);
981
- panels2.push(content);
982
- });
983
- return { tabs: tabs2, panels: panels2 };
984
- }, []);
985
- return /* @__PURE__ */ jsxs(Tabs$1, { overflow: "hidden", colorScheme: "brand", ...boxProps, children: [
986
- /* @__PURE__ */ jsx(TabList, { overflow: "auto hidden", children: tabs.map(({ label, icon }, index) => /* @__PURE__ */ jsx(Tab, { children: /* @__PURE__ */ jsx(Text, { as: "h3", isTruncated: true, children: icon ? `${icon} ${label}` : label }) }, index)) }),
987
- /* @__PURE__ */ jsx(TabPanels, { children: panels.map((panel, index) => /* @__PURE__ */ jsx(TabPanel, { children: render ? render(panel) : panel }, index)) })
988
- ] });
989
- };
990
1019
  const Tip = ({ tip, author = null, ...boxProps }) => {
991
1020
  return /* @__PURE__ */ jsxs(
992
1021
  Card,
@@ -1012,6 +1041,128 @@ const Tip = ({ tip, author = null, ...boxProps }) => {
1012
1041
  }
1013
1042
  );
1014
1043
  };
1044
+ const ExternalImage = ({ image, component: ImageComponent, alt = "", ...imageProps }) => {
1045
+ var _a, _b;
1046
+ const imageData = (_b = (_a = image == null ? void 0 : image.localFile) == null ? void 0 : _a.childImageSharp) == null ? void 0 : _b.gatsbyImageData;
1047
+ return imageData ? /* @__PURE__ */ jsx(ImageComponent, { image: imageData, alt, ...imageProps }) : /* @__PURE__ */ jsx(Fragment, {});
1048
+ };
1049
+ const RichText = ({ content }) => {
1050
+ const components = useMDXComponents();
1051
+ return /* @__PURE__ */ jsx(Markdown, { components, children: content });
1052
+ };
1053
+ function extractItemsFromJson(content) {
1054
+ return content.strapi_json_value;
1055
+ }
1056
+ const StrapiComponent = ({ type, props, imageComponent }) => {
1057
+ switch (type) {
1058
+ case "STRAPI__COMPONENT_CONTENT_FAQ":
1059
+ return /* @__PURE__ */ jsx(Faq, { items: props.items, mb: 4 });
1060
+ case "STRAPI__COMPONENT_CONTENT_FEATURES":
1061
+ return /* @__PURE__ */ jsx(FeatureCardGrid, { items: props.items, mb: 4 });
1062
+ case "STRAPI__COMPONENT_CONTENT_GAME_DEMO":
1063
+ return /* @__PURE__ */ jsx(
1064
+ GameDemo,
1065
+ {
1066
+ name: props.name,
1067
+ src: props.src,
1068
+ previewImage: /* @__PURE__ */ jsx(ExternalImage, { image: props.previewImage, alt: props.name, component: imageComponent }),
1069
+ mb: 4
1070
+ }
1071
+ );
1072
+ case "STRAPI__COMPONENT_CONTENT_GAME_INFO":
1073
+ return /* @__PURE__ */ jsx(GameInfo, { info: { ...props } });
1074
+ case "STRAPI__COMPONENT_CONTENT_HOW_TO":
1075
+ return /* @__PURE__ */ jsx(
1076
+ HowTo,
1077
+ {
1078
+ steps: props.steps.map((step) => {
1079
+ return {
1080
+ ...step,
1081
+ thumbnail: /* @__PURE__ */ jsx(ExternalImage, { image: step.thumbnail, alt: step.title, component: imageComponent })
1082
+ };
1083
+ }),
1084
+ mb: 4
1085
+ }
1086
+ );
1087
+ case "STRAPI__COMPONENT_CONTENT_LIST":
1088
+ return /* @__PURE__ */ jsx(List, { bullet: props.bullet, items: extractItemsFromJson(props.content) });
1089
+ case "STRAPI__COMPONENT_CONTENT_MEDIA":
1090
+ return /* @__PURE__ */ jsx(
1091
+ ExternalImage,
1092
+ {
1093
+ component: imageComponent,
1094
+ image: props.file,
1095
+ alt: props.alternativeText,
1096
+ style: { display: "inline-block", marginBottom: 16 }
1097
+ }
1098
+ );
1099
+ case "STRAPI__COMPONENT_CONTENT_PROS_CONS":
1100
+ return /* @__PURE__ */ jsx(ProsCons, { items: { ...props }, mb: 4 });
1101
+ case "STRAPI__COMPONENT_CONTENT_RICH_TEXT":
1102
+ return /* @__PURE__ */ jsx(RichText, { content: props.content.data.content });
1103
+ case "STRAPI__COMPONENT_CONTENT_TABLE":
1104
+ return /* @__PURE__ */ jsx(
1105
+ Table,
1106
+ {
1107
+ columnNumber: props.columnNumber,
1108
+ items: extractItemsFromJson(props.content),
1109
+ caption: props.caption,
1110
+ bordered: props.bordered,
1111
+ scrollable: props.scrollable,
1112
+ striped: props.striped,
1113
+ mb: 4
1114
+ }
1115
+ );
1116
+ case "STRAPI__COMPONENT_CONTENT_TIP":
1117
+ return /* @__PURE__ */ jsx(
1118
+ Tip,
1119
+ {
1120
+ tip: props.tip,
1121
+ author: props.author ? {
1122
+ ...props.author,
1123
+ avatar: /* @__PURE__ */ jsx(
1124
+ ExternalImage,
1125
+ {
1126
+ component: imageComponent,
1127
+ image: props.author.avatar,
1128
+ alt: props.author.name,
1129
+ style: { borderRadius: "50%" }
1130
+ }
1131
+ )
1132
+ } : null,
1133
+ mb: 4
1134
+ }
1135
+ );
1136
+ default:
1137
+ return null;
1138
+ }
1139
+ };
1140
+ function isStrapiContent(array) {
1141
+ return Array.isArray(array) && array.every(
1142
+ (item) => typeof item === "object" && item !== null && "__typename" in item && typeof item.__typename === "string"
1143
+ );
1144
+ }
1145
+ const StrapiContentRenderer = ({ content, imageComponent }) => {
1146
+ if (!isStrapiContent(content)) {
1147
+ return null;
1148
+ }
1149
+ return content.map(({ __typename: type, ...props }, index) => /* @__PURE__ */ jsx(StrapiComponent, { type, props, imageComponent }, index));
1150
+ };
1151
+ const Tabs = ({ items, render, ...boxProps }) => {
1152
+ const { tabs, panels } = useMemo(() => {
1153
+ const tabs2 = [];
1154
+ const panels2 = [];
1155
+ items.forEach(({ content, ...tab }) => {
1156
+ tabs2.push(tab);
1157
+ panels2.push(content);
1158
+ });
1159
+ return { tabs: tabs2, panels: panels2 };
1160
+ }, []);
1161
+ return /* @__PURE__ */ jsxs(Tabs$1, { overflow: "hidden", colorScheme: "brand", ...boxProps, children: [
1162
+ /* @__PURE__ */ jsx(TabList, { overflow: "auto hidden", children: tabs.map(({ label, icon }, index) => /* @__PURE__ */ jsx(Tab, { children: /* @__PURE__ */ jsx(Text, { as: "h3", isTruncated: true, children: icon ? `${icon} ${label}` : label }) }, index)) }),
1163
+ /* @__PURE__ */ jsx(TabPanels, { children: panels.map((panel, index) => /* @__PURE__ */ jsx(TabPanel, { children: render ? render(panel) : panel }, index)) })
1164
+ ] });
1165
+ };
1015
1166
  export {
1016
1167
  AuthorCard as A,
1017
1168
  BonusCard as B,
@@ -1022,19 +1173,21 @@ export {
1022
1173
  Layout as L,
1023
1174
  NotFound as N,
1024
1175
  ProsCons as P,
1025
- RichTextRenderer as R,
1026
1176
  Seo as S,
1027
1177
  Table as T,
1028
- FeatureCard as a,
1029
- Features as b,
1030
- GameDemo as c,
1031
- GameInfo as d,
1032
- List as e,
1033
- Tabs as f,
1034
- Tip as g,
1035
- Author as h,
1036
- Center as i,
1037
- Grid as j,
1038
- LinkButton as k,
1039
- PulseButton as l
1178
+ BonusCardGrid as a,
1179
+ FeatureCard as b,
1180
+ FeatureCardGrid as c,
1181
+ GameCardGrid as d,
1182
+ GameDemo as e,
1183
+ GameInfo as f,
1184
+ List as g,
1185
+ StrapiContentRenderer as h,
1186
+ Tabs as i,
1187
+ Tip as j,
1188
+ Author as k,
1189
+ Center as l,
1190
+ Grid as m,
1191
+ LinkButton as n,
1192
+ PulseButton as o
1040
1193
  };
@@ -0,0 +1,87 @@
1
+ import { TinyColor } from "@ctrl/tinycolor";
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
+ const DEFAULT_THEME = "system";
41
+ const DEFAULT_COLOR = "#333333";
42
+ const DefaultColorShadeMap = {
43
+ 50: 52,
44
+ 100: 40,
45
+ 200: 30,
46
+ 300: 20,
47
+ 400: 10,
48
+ 600: 10,
49
+ 700: 20,
50
+ 800: 30,
51
+ 900: 40
52
+ };
53
+ function extractTheme(value, defaultTheme = DEFAULT_THEME) {
54
+ let theme = defaultTheme;
55
+ if (value) {
56
+ const themes = ["dark", "light", "system"];
57
+ const probablyTheme = value;
58
+ if (themes.includes(probablyTheme)) {
59
+ theme = probablyTheme;
60
+ }
61
+ }
62
+ return theme;
63
+ }
64
+ function generateColorPalette(value, defaultColor = DEFAULT_COLOR, colorShadeMap = DefaultColorShadeMap) {
65
+ let baseColor = defaultColor;
66
+ if (value && typeof value === "string") {
67
+ baseColor = value;
68
+ }
69
+ const color = new TinyColor(baseColor);
70
+ return {
71
+ 50: color.lighten(colorShadeMap[50]).toHexString(),
72
+ 100: color.lighten(colorShadeMap[100]).toHexString(),
73
+ 200: color.lighten(colorShadeMap[200]).toHexString(),
74
+ 300: color.lighten(colorShadeMap[300]).toHexString(),
75
+ 400: color.lighten(colorShadeMap[400]).toHexString(),
76
+ 500: color.toHexString(),
77
+ 600: color.darken(colorShadeMap[600]).toHexString(),
78
+ 700: color.darken(colorShadeMap[700]).toHexString(),
79
+ 800: color.darken(colorShadeMap[800]).toHexString(),
80
+ 900: color.darken(colorShadeMap[900]).toHexString()
81
+ };
82
+ }
83
+ export {
84
+ extractTheme as e,
85
+ generateColorPalette as g,
86
+ transformSiteNavigation as t
87
+ };
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ const tinycolor = require("@ctrl/tinycolor");
3
+ const DUMMY_PAGE_TYPE = "DUMMY";
4
+ function isValidPath(value) {
5
+ return typeof value === "string" && (value === "" || value.startsWith("/"));
6
+ }
7
+ function isValidType(value) {
8
+ return typeof value === "string" && value !== DUMMY_PAGE_TYPE;
9
+ }
10
+ function transformNavItems(items, parentPath = "") {
11
+ if (!items || !items.length) {
12
+ return [];
13
+ }
14
+ const transformed = [];
15
+ items.forEach((item) => {
16
+ var _a;
17
+ if (item && item.title && isValidType(item.type) && isValidPath(item.path)) {
18
+ let path = `${parentPath}${item.path}`;
19
+ let children = [];
20
+ if ((_a = item.items) == null ? void 0 : _a.length) {
21
+ path = "";
22
+ children = transformNavItems(item.items, path);
23
+ }
24
+ transformed.push({ label: item.title, path, children });
25
+ }
26
+ });
27
+ return transformed;
28
+ }
29
+ function transformSiteNavigation(strapiNavigation) {
30
+ if (!strapiNavigation) {
31
+ return null;
32
+ }
33
+ const navGroups = strapiNavigation.items;
34
+ const headerNav = navGroups == null ? void 0 : navGroups.find((item) => (item == null ? void 0 : item.slug) === "header-navigation");
35
+ const footerNav = navGroups == null ? void 0 : navGroups.find((item) => (item == null ? void 0 : item.slug) === "footer-navigation");
36
+ return {
37
+ header: transformNavItems(headerNav == null ? void 0 : headerNav.items),
38
+ footer: transformNavItems(footerNav == null ? void 0 : footerNav.items)
39
+ };
40
+ }
41
+ const DEFAULT_THEME = "system";
42
+ const DEFAULT_COLOR = "#333333";
43
+ const DefaultColorShadeMap = {
44
+ 50: 52,
45
+ 100: 40,
46
+ 200: 30,
47
+ 300: 20,
48
+ 400: 10,
49
+ 600: 10,
50
+ 700: 20,
51
+ 800: 30,
52
+ 900: 40
53
+ };
54
+ function extractTheme(value, defaultTheme = DEFAULT_THEME) {
55
+ let theme = defaultTheme;
56
+ if (value) {
57
+ const themes = ["dark", "light", "system"];
58
+ const probablyTheme = value;
59
+ if (themes.includes(probablyTheme)) {
60
+ theme = probablyTheme;
61
+ }
62
+ }
63
+ return theme;
64
+ }
65
+ function generateColorPalette(value, defaultColor = DEFAULT_COLOR, colorShadeMap = DefaultColorShadeMap) {
66
+ let baseColor = defaultColor;
67
+ if (value && typeof value === "string") {
68
+ baseColor = value;
69
+ }
70
+ const color = new tinycolor.TinyColor(baseColor);
71
+ return {
72
+ 50: color.lighten(colorShadeMap[50]).toHexString(),
73
+ 100: color.lighten(colorShadeMap[100]).toHexString(),
74
+ 200: color.lighten(colorShadeMap[200]).toHexString(),
75
+ 300: color.lighten(colorShadeMap[300]).toHexString(),
76
+ 400: color.lighten(colorShadeMap[400]).toHexString(),
77
+ 500: color.toHexString(),
78
+ 600: color.darken(colorShadeMap[600]).toHexString(),
79
+ 700: color.darken(colorShadeMap[700]).toHexString(),
80
+ 800: color.darken(colorShadeMap[800]).toHexString(),
81
+ 900: color.darken(colorShadeMap[900]).toHexString()
82
+ };
83
+ }
84
+ exports.extractTheme = extractTheme;
85
+ exports.generateColorPalette = generateColorPalette;
86
+ exports.transformSiteNavigation = transformSiteNavigation;
package/dist/index.cjs CHANGED
@@ -1,22 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-eta4hdHD.js");
3
+ const index = require("./index-BmkMQFW1.js");
4
4
  const index$1 = require("./index-IpSV-c71.js");
5
5
  const i18n$1 = require("./index-Biz1dDqA.js");
6
6
  const index$2 = require("./index-d3V0A4lN.js");
7
7
  const index$3 = require("./index-BhsXlbd8.js");
8
- const index$4 = require("./index-Cte2-g6s.js");
9
- const index$5 = require("./index-D2JqGE4u.js");
8
+ const index$4 = require("./index-Bw7vqsyw.js");
9
+ const index$5 = require("./index-NsIHOkeN.js");
10
10
  const i18n = require("i18next");
11
11
  exports.Author = index.Author;
12
12
  exports.AuthorCard = index.AuthorCard;
13
13
  exports.BonusCard = index.BonusCard;
14
+ exports.BonusCardGrid = index.BonusCardGrid;
14
15
  exports.Center = index.Center;
15
16
  exports.ContactForm = index.ContactForm;
16
17
  exports.Faq = index.Faq;
17
18
  exports.FeatureCard = index.FeatureCard;
18
- exports.Features = index.Features;
19
+ exports.FeatureCardGrid = index.FeatureCardGrid;
19
20
  exports.GameCard = index.GameCard;
21
+ exports.GameCardGrid = index.GameCardGrid;
20
22
  exports.GameDemo = index.GameDemo;
21
23
  exports.GameInfo = index.GameInfo;
22
24
  exports.Grid = index.Grid;
@@ -27,8 +29,8 @@ exports.List = index.List;
27
29
  exports.NotFound = index.NotFound;
28
30
  exports.ProsCons = index.ProsCons;
29
31
  exports.PulseButton = index.PulseButton;
30
- exports.RichTextRenderer = index.RichTextRenderer;
31
32
  exports.Seo = index.Seo;
33
+ exports.StrapiContentRenderer = index.StrapiContentRenderer;
32
34
  exports.Table = index.Table;
33
35
  exports.Tabs = index.Tabs;
34
36
  exports.Tip = index.Tip;
@@ -45,12 +47,12 @@ exports.formatNumber = index$4.formatNumber;
45
47
  exports.getCurrencySymbol = index$4.getCurrencySymbol;
46
48
  exports.getCurrentMonth = index$4.getCurrentMonth;
47
49
  exports.getCurrentYear = index$4.getCurrentYear;
50
+ exports.getSeedRandomComparator = index$4.getSeedRandomComparator;
48
51
  exports.parseNumber = index$4.parseNumber;
52
+ exports.randomComparator = index$4.randomComparator;
49
53
  exports.round = index$4.round;
50
54
  exports.toFixedTwo = index$4.toFixedTwo;
51
55
  exports.extractTheme = index$5.extractTheme;
52
56
  exports.generateColorPalette = index$5.generateColorPalette;
53
- exports.getValidSource = index$5.getValidSource;
54
57
  exports.transformSiteNavigation = index$5.transformSiteNavigation;
55
- exports.typeDefs = index$5.typeDefs;
56
58
  exports.i18n = i18n;
package/dist/index.mjs CHANGED
@@ -1,56 +1,58 @@
1
- import { h, A, B, i, C, F, a, b, G, c, d, j, H, L, k, e, N, P, l, R, S, T, f, g } from "./index-Cin-9-As.mjs";
1
+ import { k, A, B, a, l, C, F, b, c, G, d, e, f, m, H, L, n, g, N, P, o, S, h, T, i, j } from "./index-DbwY2gVh.mjs";
2
2
  import { u } from "./index-xuSxvz5z.mjs";
3
3
  import { a as a2, G as G2, r } from "./index-DoBCANwf.mjs";
4
4
  import { M } from "./index-Bx3B21Dh.mjs";
5
5
  import { S as S2, u as u2 } from "./index-BNb-P8a6.mjs";
6
- import { A as A2, f as f2, b as b2, c as c2, a as a3, g as g2, p, r as r2, t } from "./index-25M8hPOF.mjs";
7
- import { e as e2, b as b3, g as g3, a as a4, t as t2 } from "./index-CHnNtadm.mjs";
6
+ import { A as A2, f as f2, b as b2, c as c2, a as a3, g as g2, e as e2, p, d as d2, r as r2, t } from "./index-DLy2LYCD.mjs";
7
+ import { e as e3, g as g3, t as t2 } from "./index-DzEvPZny.mjs";
8
8
  import { default as default2 } from "i18next";
9
9
  export {
10
10
  A2 as Animation,
11
- h as Author,
11
+ k as Author,
12
12
  A as AuthorCard,
13
13
  B as BonusCard,
14
- i as Center,
14
+ a as BonusCardGrid,
15
+ l as Center,
15
16
  C as ContactForm,
16
17
  F as Faq,
17
- a as FeatureCard,
18
- b as Features,
18
+ b as FeatureCard,
19
+ c as FeatureCardGrid,
19
20
  G as GameCard,
21
+ d as GameCardGrid,
20
22
  a2 as GameCharacteristic,
21
- c as GameDemo,
22
- d as GameInfo,
23
+ e as GameDemo,
24
+ f as GameInfo,
23
25
  G2 as GameVolatility,
24
- j as Grid,
26
+ m as Grid,
25
27
  H as HowTo,
26
28
  L as Layout,
27
- k as LinkButton,
28
- e as List,
29
+ n as LinkButton,
30
+ g as List,
29
31
  M as MdxProvider,
30
32
  N as NotFound,
31
33
  P as ProsCons,
32
- l as PulseButton,
33
- R as RichTextRenderer,
34
+ o as PulseButton,
34
35
  S as Seo,
35
36
  S2 as SiteProvider,
37
+ h as StrapiContentRenderer,
36
38
  T as Table,
37
- f as Tabs,
38
- g as Tip,
39
- e2 as extractTheme,
39
+ i as Tabs,
40
+ j as Tip,
41
+ e3 as extractTheme,
40
42
  f2 as formatDate,
41
43
  b2 as formatNumber,
42
- b3 as generateColorPalette,
44
+ g3 as generateColorPalette,
43
45
  c2 as getCurrencySymbol,
44
46
  a3 as getCurrentMonth,
45
47
  g2 as getCurrentYear,
46
- g3 as getValidSource,
48
+ e2 as getSeedRandomComparator,
47
49
  default2 as i18n,
48
50
  p as parseNumber,
51
+ d2 as randomComparator,
49
52
  r as resources,
50
53
  r2 as round,
51
54
  t as toFixedTwo,
52
- a4 as transformSiteNavigation,
53
- t2 as typeDefs,
55
+ t2 as transformSiteNavigation,
54
56
  u as usePrimaryColors,
55
57
  u2 as useSiteContext
56
58
  };
@@ -1,8 +1,9 @@
1
1
  import { Key, ReactElement } from 'react';
2
- import { BoxProps } from '@chakra-ui/react';
2
+ import { BoxProps, ColorProps } from '@chakra-ui/react';
3
3
  export type KeyGetter<T> = (item: T) => Key;
4
4
  export type RenderFunction<T> = (item: T) => ReactElement;
5
5
  type BoxPaddingProps = Pick<BoxProps, 'p' | 'pt' | 'pr' | 'pb' | 'pl' | 'px' | 'py' | 'ps' | 'pe'>;
6
6
  type BoxMarginProps = Pick<BoxProps, 'm' | 'mt' | 'mr' | 'mb' | 'ml' | 'mx' | 'my' | 'ms' | 'me'>;
7
7
  export type BoxPositionProps = BoxMarginProps & BoxPaddingProps;
8
+ export type Color = ColorProps['color'];
8
9
  export {};