@anywayseo/tools 5.2.0 → 5.4.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 (30) hide show
  1. package/dist/components/base/image/index.d.ts +10 -0
  2. package/dist/components/base/index.d.ts +3 -0
  3. package/dist/components/base/social-network/icons/facebook/index.d.ts +2 -0
  4. package/dist/components/base/social-network/icons/index.d.ts +5 -0
  5. package/dist/components/base/social-network/icons/instagram/index.d.ts +2 -0
  6. package/dist/components/base/social-network/icons/pinterest/index.d.ts +2 -0
  7. package/dist/components/base/social-network/icons/x/index.d.ts +2 -0
  8. package/dist/components/base/social-network/icons/youtube/index.d.ts +2 -0
  9. package/dist/components/base/social-network/index.d.ts +5 -0
  10. package/dist/components/base/social-networks/index.d.ts +8 -0
  11. package/dist/components/game-demo/preview/index.d.ts +2 -2
  12. package/dist/components/index.cjs +5 -2
  13. package/dist/components/index.mjs +5 -2
  14. package/dist/{index-bNvgXBvA.js → index-4Zb1neOM.js} +306 -231
  15. package/dist/{index-CtmxlomQ.mjs → index-BM-_Lr_j.mjs} +115 -40
  16. package/dist/{index-BFhrFJqB.js → index-BbxOP7UY.js} +8 -4
  17. package/dist/{index-Cn8RI_2O.js → index-BltrZp3R.js} +32 -9
  18. package/dist/{index-DA6TBpuE.mjs → index-Bwlxdh5F.mjs} +24 -1
  19. package/dist/{index-BJQgELmZ.mjs → index-C4sJXfkN.mjs} +6 -2
  20. package/dist/index.cjs +6 -3
  21. package/dist/index.mjs +6 -3
  22. package/dist/providers/index.cjs +2 -2
  23. package/dist/providers/index.mjs +2 -2
  24. package/dist/types/components/how-to/index.d.ts +2 -2
  25. package/dist/types/components/image/index.d.ts +4 -2
  26. package/dist/types/components/index.d.ts +1 -0
  27. package/dist/types/components/social-network/index.d.ts +6 -0
  28. package/dist/types/content/author/index.d.ts +3 -8
  29. package/dist/types/site/index.d.ts +4 -3
  30. package/package.json +3 -2
@@ -1,7 +1,8 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { Box, Collapse, Text, Button, Flex, Stack, Image, Center as Center$1, SimpleGrid, Link as Link$1, 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, Menu, MenuButton, HStack, Icon, MenuList, MenuItem, List as List$1, ListItem, ListIcon, TableContainer, Table as Table$1, Thead, Tr, Th, Tbody, Td, TableCaption, Tabs as Tabs$1, TabList, Tab, TabPanels, TabPanel } from "@chakra-ui/react";
2
+ import { Flex, Box, Collapse, Text, Button, Stack, Center as Center$1, SimpleGrid, Link as Link$1, 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, Menu, MenuButton, HStack, Icon, MenuList, MenuItem, List as List$1, ListItem, 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 useSiteContext, L as Link, u as usePageContext } from "./index-DA6TBpuE.mjs";
4
+ import "react-medium-image-zoom";
5
+ import { L as Link, I as Image, a as useSiteContext, u as usePageContext } from "./index-Bwlxdh5F.mjs";
5
6
  import { useRef, useState, useLayoutEffect, Fragment as Fragment$1, useMemo, forwardRef, useEffect } from "react";
6
7
  import { A as Animation } from "./index-BJRvnR8Q.mjs";
7
8
  import { a as GameCharacteristic } from "./index-Bts2DBYS.mjs";
@@ -12,6 +13,89 @@ import { i as isRelativePath, b as buildPath } from "./index-BmaWfWLV.mjs";
12
13
  import { u as usePrimaryColors } from "./index-tj12BA6U.mjs";
13
14
  import { t } from "i18next";
14
15
  import Markdown from "react-markdown";
16
+ const FacebookIcon = (props) => {
17
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", "aria-label": "Facebook", ...props, children: [
18
+ /* @__PURE__ */ jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "5", fill: "none", stroke: "currentColor", strokeWidth: "2" }),
19
+ /* @__PURE__ */ jsx(
20
+ "path",
21
+ {
22
+ d: "M13.5 8h2V6h-2c-2.2 0-3.5 1.3-3.5 3.5V11H8v2h2v5h2v-5h2l.5-2h-2v-1.3c0-.5.2-.7 1-.7Z",
23
+ fill: "currentColor"
24
+ }
25
+ )
26
+ ] });
27
+ };
28
+ const InstagramIcon = (props) => {
29
+ return /* @__PURE__ */ jsxs(
30
+ "svg",
31
+ {
32
+ xmlns: "http://www.w3.org/2000/svg",
33
+ width: "24",
34
+ height: "24",
35
+ viewBox: "0 0 24 24",
36
+ "aria-label": "Instagram",
37
+ ...props,
38
+ children: [
39
+ /* @__PURE__ */ jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "5", fill: "none", stroke: "currentColor", strokeWidth: "2" }),
40
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "4", fill: "none", stroke: "currentColor", "stroke-width": "2" }),
41
+ /* @__PURE__ */ jsx("circle", { cx: "17", cy: "7", r: "1.25", fill: "currentColor" })
42
+ ]
43
+ }
44
+ );
45
+ };
46
+ const PinterestIcon = (props) => {
47
+ return /* @__PURE__ */ jsx(
48
+ "svg",
49
+ {
50
+ xmlns: "http://www.w3.org/2000/svg",
51
+ width: "24",
52
+ height: "24",
53
+ viewBox: "0 0 24 24",
54
+ "aria-label": "Pinterest",
55
+ ...props,
56
+ children: /* @__PURE__ */ jsx(
57
+ "path",
58
+ {
59
+ fill: "currentColor",
60
+ d: "M12 0C5.373 0 0 5.373 0 12c0 4.99 3.657 9.128 8.438 10.122-.117-.858-.222-2.178.047-3.116.242-.83 1.557-5.288 1.557-5.288s-.396-.792-.396-1.963c0-1.84 1.067-3.215 2.395-3.215 1.13 0 1.675.848 1.675 1.866 0 1.138-.724 2.842-1.097 4.421-.312 1.319.663 2.395 1.965 2.395 2.358 0 3.947-3.032 3.947-6.617 0-2.727-1.84-4.769-5.178-4.769-3.774 0-6.134 2.822-6.134 5.97 0 1.086.322 1.852.827 2.443.232.274.264.384.18.698-.06.23-.197.786-.256 1.007-.084.322-.34.437-.628.318-1.75-.714-2.564-2.63-2.564-4.785 0-3.555 2.998-7.817 8.946-7.817 4.782 0 7.923 3.454 7.923 7.168 0 4.924-2.74 8.6-6.781 8.6-1.356 0-2.63-.73-3.066-1.565l-.833 3.173c-.301 1.147-1.118 2.582-1.667 3.455C9.708 23.812 10.828 24 12 24c6.627 0 12-5.373 12-12S18.627 0 12 0z"
61
+ }
62
+ )
63
+ }
64
+ );
65
+ };
66
+ const XcomIcon = (props) => {
67
+ return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", "aria-label": "X", ...props, children: /* @__PURE__ */ jsx(
68
+ "path",
69
+ {
70
+ fill: "currentColor",
71
+ d: "M18.244 2H21l-6.57 7.498L22 22h-5.657l-4.403-5.808L6.06 22H3.302l7.02-8.006L2 2h5.822l3.983 5.293L18.244 2zM16.97 20h1.9L8.153 4h-1.9L16.97 20z"
72
+ }
73
+ ) });
74
+ };
75
+ const YoutubeIcon = (props) => {
76
+ return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", "aria-label": "YouTube", ...props, children: /* @__PURE__ */ jsx(
77
+ "path",
78
+ {
79
+ fill: "currentColor",
80
+ d: "M23.498 6.186a2.974 2.974 0 0 0-2.095-2.107C19.505 3.5 12 3.5 12 3.5s-7.505 0-9.403.579A2.974 2.974 0 0 0 .502 6.186C0 8.09 0 12 0 12s0 3.91.502 5.814a2.974 2.974 0 0 0 2.095 2.107C4.495 20.5 12 20.5 12 20.5s7.505 0 9.403-.579a2.974 2.974 0 0 0 2.095-2.107C24 15.91 24 12 24 12s0-3.91-.502-5.814zM9.75 15.02V8.98L15.5 12l-5.75 3.02z"
81
+ }
82
+ ) });
83
+ };
84
+ const SocialNetworkMap = {
85
+ facebook: FacebookIcon,
86
+ instagram: InstagramIcon,
87
+ pinterest: PinterestIcon,
88
+ x: XcomIcon,
89
+ youtube: YoutubeIcon
90
+ };
91
+ const SocialNetwork = ({ kind, url }) => {
92
+ const Icon2 = SocialNetworkMap[kind];
93
+ return /* @__PURE__ */ jsx(Link, { to: url, children: /* @__PURE__ */ jsx(Icon2, {}) });
94
+ };
95
+ const SocialNetworks = ({ socialNetworks, ...flexProps }) => {
96
+ const uniqueSocialNetworks = [...new Map(socialNetworks.map((item) => [item.kind, item])).values()];
97
+ return /* @__PURE__ */ jsx(Flex, { gap: 2, ...flexProps, children: uniqueSocialNetworks.map((socialNetwork) => /* @__PURE__ */ jsx(SocialNetwork, { ...socialNetwork }, socialNetwork.kind)) });
98
+ };
15
99
  const ONE_LINE_HEIGHT = 24;
16
100
  const Bio = ({ content, maxLines = 1 }) => {
17
101
  const ref = useRef(null);
@@ -37,25 +121,24 @@ const Bio = ({ content, maxLines = 1 }) => {
37
121
  ] });
38
122
  };
39
123
  const Author = ({ author, variant }) => {
40
- const { name, role, bio, avatar } = author;
41
- const imageComponent = typeof avatar === "string" ? /* @__PURE__ */ jsx(Image, { src: avatar, alt: name, rounded: "full" }) : avatar;
124
+ const { name, role, bio, avatar, socialNetworks } = author;
42
125
  if (variant === "short") {
43
- return /* @__PURE__ */ jsxs(Flex, { as: "article", align: "center", gap: 4, children: [
44
- !!imageComponent && /* @__PURE__ */ jsx(Box, { w: 12, h: 12, children: imageComponent }),
126
+ return /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 4, children: [
127
+ /* @__PURE__ */ jsx(Box, { w: 12, h: 12, children: /* @__PURE__ */ jsx(Image, { src: avatar, alt: name, rounded: "full" }) }),
45
128
  /* @__PURE__ */ jsxs(Box, { fontWeight: "semibold", children: [
46
129
  /* @__PURE__ */ jsx(Text, { children: name }),
47
130
  /* @__PURE__ */ jsx(Text, { color: "gray.500", children: role })
48
131
  ] })
49
132
  ] });
50
133
  }
51
- return /* @__PURE__ */ jsxs(Fragment, { children: [
52
- !!imageComponent && /* @__PURE__ */ jsx(Flex, { grow: 1, maxW: { base: 48, sm: 32 }, children: imageComponent }),
53
- /* @__PURE__ */ jsx(Flex, { w: "100%", children: /* @__PURE__ */ jsxs(Stack, { children: [
134
+ return /* @__PURE__ */ jsxs(Flex, { direction: { base: "column", sm: "row" }, align: { base: "center", sm: "flex-start" }, gap: 4, children: [
135
+ /* @__PURE__ */ jsx(Flex, { flex: 1, maxW: { base: 48, sm: 32 }, children: /* @__PURE__ */ jsx(Image, { src: avatar, alt: name, rounded: "full" }) }),
136
+ /* @__PURE__ */ jsx(Flex, { flex: 1, children: /* @__PURE__ */ jsxs(Stack, { children: [
54
137
  /* @__PURE__ */ jsxs(Text, { fontSize: "lg", fontWeight: 600, children: [
55
- name,
56
- ", ",
57
- /* @__PURE__ */ jsx(Text, { as: "span", color: "gray.500", children: role })
138
+ `${name}, `,
139
+ /* @__PURE__ */ jsx(Text, { as: "span", display: "inline-block", color: "gray.500", children: role })
58
140
  ] }),
141
+ (socialNetworks == null ? void 0 : socialNetworks.length) && /* @__PURE__ */ jsx(SocialNetworks, { socialNetworks }),
59
142
  /* @__PURE__ */ jsx(Bio, { content: bio })
60
143
  ] }) })
61
144
  ] });
@@ -115,16 +198,7 @@ const AuthorCard = ({ author, ...boxProps }) => {
115
198
  const { t: t2 } = useTranslation("author");
116
199
  return /* @__PURE__ */ jsxs(Card, { as: "article", variant: "filled", ...boxProps, children: [
117
200
  /* @__PURE__ */ jsx(CardHeader, { pb: 0, children: /* @__PURE__ */ jsx(Heading, { size: "md", children: t2("title") }) }),
118
- /* @__PURE__ */ jsx(
119
- CardBody,
120
- {
121
- display: "flex",
122
- flexDirection: { base: "column", sm: "row" },
123
- alignItems: { base: "center", sm: "flex-start" },
124
- gap: 4,
125
- children: /* @__PURE__ */ jsx(Author, { author, variant: "full" })
126
- }
127
- )
201
+ /* @__PURE__ */ jsx(CardBody, { children: /* @__PURE__ */ jsx(Author, { author, variant: "full" }) })
128
202
  ] });
129
203
  };
130
204
  const BonusCardContent = ({ content, buttonColor }) => {
@@ -337,7 +411,7 @@ const GameCard = ({ name, description, image, href, height = "auto" }) => {
337
411
  height,
338
412
  _hover: { transform: "scale(1.05)" },
339
413
  children: [
340
- typeof image === "string" ? /* @__PURE__ */ jsx(Image, { src: image, alt: name, w: "100%", aspectRatio: "16/9", objectFit: "cover", objectPosition: "center" }) : !!image && /* @__PURE__ */ jsx(Box, { w: "100%", aspectRatio: "16/9", children: image }),
414
+ /* @__PURE__ */ jsx(Image, { src: image, alt: name, mode: "thumbnail" }),
341
415
  /* @__PURE__ */ jsxs(Box, { as: "section", rounded: "md", p: 4, children: [
342
416
  /* @__PURE__ */ jsx(Text, { as: "span", children: href ? /* @__PURE__ */ jsx(LinkOverlay, { href, children: name }) : name }),
343
417
  !!description && /* @__PURE__ */ jsx(Text, { fontSize: "sm", color: "gray.600", children: description })
@@ -429,9 +503,8 @@ const GameDemoContent = ({
429
503
  };
430
504
  const GameDemoPreview = ({ image, alt, href, imageFit = "contain", onPlayDemo }) => {
431
505
  const { t: t2 } = useTranslation("gameDemo");
432
- const imageComponent = typeof image === "string" ? /* @__PURE__ */ jsx(Image, { src: image, alt, objectFit: imageFit, w: "100%", h: "100%" }) : image;
433
506
  return /* @__PURE__ */ jsxs(Fragment, { children: [
434
- imageComponent,
507
+ /* @__PURE__ */ jsx(Image, { src: image, alt, objectFit: imageFit, w: "100%", h: "100%" }),
435
508
  /* @__PURE__ */ jsx(AbsoluteCenter, { children: /* @__PURE__ */ jsxs(Stack, { spacing: 4, children: [
436
509
  /* @__PURE__ */ jsx(
437
510
  LinkButton,
@@ -599,7 +672,7 @@ const HowTo = ({ steps, ...boxProps }) => {
599
672
  /* @__PURE__ */ jsx(Circle, { size: 12, bgColor, color: invertedColor, fontSize: "lg", fontWeight: "bold", children: String(index + 1) }),
600
673
  /* @__PURE__ */ jsxs(Stack, { flex: 1, children: [
601
674
  /* @__PURE__ */ jsx(Text, { fontSize: "lg", fontWeight: "bold", children: title }),
602
- typeof thumbnail === "string" ? /* @__PURE__ */ jsx(Image, { src: thumbnail, alt: title, aspectRatio: "16/9", objectFit: "cover" }) : thumbnail,
675
+ /* @__PURE__ */ jsx(Image, { src: thumbnail, alt: title, mode: "thumbnail", hasZoom: true }),
603
676
  /* @__PURE__ */ jsx(Text, { children: description })
604
677
  ] })
605
678
  ] }, index)) });
@@ -613,7 +686,7 @@ const Content = ({ children }) => {
613
686
  const Logo = () => {
614
687
  const { metadata } = useSiteContext();
615
688
  const { logo } = metadata;
616
- return /* @__PURE__ */ jsx(Box, { display: "flex", h: { base: 10, md: 14 }, overflow: "hidden", children: typeof logo === "string" ? /* @__PURE__ */ jsx(Image, { src: logo, alt: "Logo", objectFit: "contain" }) : logo });
689
+ return /* @__PURE__ */ jsx(Box, { display: "flex", h: { base: 10, md: 14 }, overflow: "hidden", children: /* @__PURE__ */ jsx(Image, { src: logo, alt: "Logo", objectFit: "contain" }) });
617
690
  };
618
691
  const Brand$1 = ({ brand }) => {
619
692
  return /* @__PURE__ */ jsxs(Box, { position: "relative", my: 2, py: 8, children: [
@@ -668,13 +741,13 @@ const Navigation$1 = ({ menu }) => {
668
741
  );
669
742
  };
670
743
  const Footer = () => {
671
- var _a, _b;
672
- const { navigation, config } = useSiteContext();
744
+ const { metadata, navigation, config } = useSiteContext();
673
745
  const { currentLocale } = usePageContext();
674
746
  const menu = navigation.footer[currentLocale.code] ?? [];
675
- const extra = (_a = config == null ? void 0 : config.footer) == null ? void 0 : _a.extra;
676
- const showDisclaimer = ((_b = config == null ? void 0 : config.footer) == null ? void 0 : _b.showDisclaimer) ?? true;
747
+ const socialNetworks = metadata.socialNetworks ?? [];
748
+ const { extra, showDisclaimer = true } = (config == null ? void 0 : config.footer) ?? {};
677
749
  const hasNavigation = !!menu.length;
750
+ const hasSocialNetworks = !!socialNetworks.length;
678
751
  const hasExtra = !!extra;
679
752
  return /* @__PURE__ */ jsx(
680
753
  Box,
@@ -688,6 +761,7 @@ const Footer = () => {
688
761
  hasExtra && /* @__PURE__ */ jsx(Extra, { children: extra }),
689
762
  showDisclaimer && /* @__PURE__ */ jsx(Disclaimer, {}),
690
763
  /* @__PURE__ */ jsx(Brand$1, { brand: /* @__PURE__ */ jsx(Logo, {}) }),
764
+ hasSocialNetworks && /* @__PURE__ */ jsx(SocialNetworks, { socialNetworks, justify: "center", my: 2 }),
691
765
  /* @__PURE__ */ jsx(Copyright, {})
692
766
  ] })
693
767
  }
@@ -1080,7 +1154,7 @@ const Layout = ({ children }) => {
1080
1154
  ] });
1081
1155
  };
1082
1156
  const List = ({ items, bullet = "—", render, ...boxProps }) => {
1083
- return /* @__PURE__ */ jsx(List$1, { pl: 0, ml: 2, mb: 4, ...boxProps, children: items.map((item, index) => /* @__PURE__ */ jsxs(ListItem, { display: "flex", gap: 1, children: [
1157
+ return /* @__PURE__ */ jsx(List$1, { pl: 0, ml: 2, ...boxProps, children: items.map((item, index) => /* @__PURE__ */ jsxs(ListItem, { display: "flex", gap: 1, children: [
1084
1158
  /* @__PURE__ */ jsx(Box, { children: bullet }),
1085
1159
  render ? render(item) : item
1086
1160
  ] }, index)) });
@@ -1248,7 +1322,7 @@ const Tip = ({ tip, author = null, ...boxProps }) => {
1248
1322
  const ExternalImage = ({ image, component: ImageComponent, alt = "", ...imageProps }) => {
1249
1323
  var _a, _b;
1250
1324
  const imageData = (_b = (_a = image == null ? void 0 : image.localFile) == null ? void 0 : _a.childImageSharp) == null ? void 0 : _b.gatsbyImageData;
1251
- return imageData ? /* @__PURE__ */ jsx(ImageComponent, { image: imageData, alt, ...imageProps }) : /* @__PURE__ */ jsx(Fragment, {});
1325
+ return imageData ? /* @__PURE__ */ jsx(ImageComponent, { image: imageData, alt, ...imageProps }) : null;
1252
1326
  };
1253
1327
  const RichText = ({ content }) => {
1254
1328
  const components = useMDXComponents();
@@ -1302,15 +1376,14 @@ const StrapiComponent = ({ type, props, imageComponent }) => {
1302
1376
  }
1303
1377
  );
1304
1378
  case "STRAPI__COMPONENT_CONTENT_LIST":
1305
- return /* @__PURE__ */ jsx(List, { bullet: props.bullet, items: extractItemsFromJson(props.content) });
1379
+ return /* @__PURE__ */ jsx(List, { bullet: props.bullet, items: extractItemsFromJson(props.content), mb: 4 });
1306
1380
  case "STRAPI__COMPONENT_CONTENT_MEDIA":
1307
1381
  return /* @__PURE__ */ jsx(
1308
- ExternalImage,
1382
+ Image,
1309
1383
  {
1310
- component: imageComponent,
1311
- image: props.file,
1312
- alt: props.alternativeText,
1313
- style: { display: "inline-block", marginBottom: 16 }
1384
+ src: /* @__PURE__ */ jsx(ExternalImage, { component: imageComponent, image: props.file, alt: props.alternativeText }),
1385
+ mb: 4,
1386
+ hasZoom: true
1314
1387
  }
1315
1388
  );
1316
1389
  case "STRAPI__COMPONENT_CONTENT_PROS_CONS":
@@ -1405,5 +1478,7 @@ export {
1405
1478
  Author as k,
1406
1479
  Center as l,
1407
1480
  Grid as m,
1408
- LinkButton as n
1481
+ LinkButton as n,
1482
+ SocialNetwork as o,
1483
+ SocialNetworks as p
1409
1484
  };
@@ -2,12 +2,12 @@
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const react$1 = require("@chakra-ui/react");
4
4
  const react = require("@mdx-js/react");
5
+ const index = require("./index-BltrZp3R.js");
5
6
  require("react");
6
7
  require("react-i18next");
7
- const index$1 = require("./index-Cn8RI_2O.js");
8
8
  require("./index-C6MG_f24.js");
9
9
  require("./index-CJVr79Z2.js");
10
- const index = require("./index-At00w6EN.js");
10
+ const index$1 = require("./index-At00w6EN.js");
11
11
  function omitProps(props, omittedKeys) {
12
12
  const result = { ...props };
13
13
  omittedKeys.forEach((key) => {
@@ -25,7 +25,7 @@ function renderLink({
25
25
  href,
26
26
  ...props
27
27
  }) {
28
- return index.isRelativePath(href) ? /* @__PURE__ */ jsxRuntime.jsx(react$1.Link, { as: index$1.Link, to: href, color: "brand.400", ...props }) : /* @__PURE__ */ jsxRuntime.jsx(
28
+ return index$1.isRelativePath(href) ? /* @__PURE__ */ jsxRuntime.jsx(react$1.Link, { as: index.Link, to: href, color: "brand.400", ...props }) : /* @__PURE__ */ jsxRuntime.jsx(
29
29
  react$1.Link,
30
30
  {
31
31
  href,
@@ -37,6 +37,9 @@ function renderLink({
37
37
  }
38
38
  );
39
39
  }
40
+ function renderImage(props) {
41
+ return /* @__PURE__ */ jsxRuntime.jsx(index.Image, { ...props, mt: 4, mb: 4, hasZoom: true });
42
+ }
40
43
  const components = {
41
44
  h1: preprocessProps((props) => /* @__PURE__ */ jsxRuntime.jsx(react$1.Heading, { as: "h1", size: "xl", mb: 4, ...props })),
42
45
  h2: preprocessProps((props) => /* @__PURE__ */ jsxRuntime.jsx(react$1.Heading, { as: "h2", size: "lg", mt: 6, mb: 4, ...props })),
@@ -44,7 +47,8 @@ const components = {
44
47
  ol: preprocessProps((props) => /* @__PURE__ */ jsxRuntime.jsx(react$1.OrderedList, { mb: 4, ...props })),
45
48
  ul: preprocessProps((props) => /* @__PURE__ */ jsxRuntime.jsx(react$1.UnorderedList, { mb: 4, ...props })),
46
49
  p: preprocessProps((props) => /* @__PURE__ */ jsxRuntime.jsx(react$1.Text, { mb: 4, ...props })),
47
- a: preprocessProps((props) => renderLink(props))
50
+ a: preprocessProps((props) => renderLink(props)),
51
+ img: preprocessProps((props) => renderImage(props))
48
52
  };
49
53
  const MdxProvider = ({ children }) => {
50
54
  return /* @__PURE__ */ jsxRuntime.jsx(react.MDXProvider, { components, children });
@@ -1,35 +1,57 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
- const react = require("react");
3
+ const react = require("@chakra-ui/react");
4
+ const Zoom = require("react-medium-image-zoom");
5
+ const react$1 = require("react");
4
6
  const gatsby = require("gatsby");
5
- require("@chakra-ui/react");
6
7
  require("@mdx-js/react");
7
8
  require("react-i18next");
8
9
  require("./index-C6MG_f24.js");
9
10
  require("./index-CJVr79Z2.js");
10
11
  const index = require("./index-WFgDSB1A.js");
11
12
  const index$1 = require("./index-At00w6EN.js");
12
- const SiteContext = react.createContext(null);
13
+ const Image = ({ src, mode = "default", hasZoom, ...plainImageProps }) => {
14
+ if (!src) {
15
+ return null;
16
+ }
17
+ let image;
18
+ if (typeof src === "string") {
19
+ image = /* @__PURE__ */ jsxRuntime.jsx(
20
+ react.Image,
21
+ {
22
+ src,
23
+ ...mode === "thumbnail" && { aspectRatio: "16/9", objectFit: "cover", objectPosition: "center" },
24
+ ...plainImageProps
25
+ }
26
+ );
27
+ } else if (src.props.image) {
28
+ image = mode === "thumbnail" ? /* @__PURE__ */ jsxRuntime.jsx(react.Box, { aspectRatio: "16/9", children: src }) : src;
29
+ } else {
30
+ return null;
31
+ }
32
+ return hasZoom ? /* @__PURE__ */ jsxRuntime.jsx(Zoom, { wrapElement: "span", zoomMargin: 40, children: image }) : image;
33
+ };
34
+ const SiteContext = react$1.createContext(null);
13
35
  const SiteProvider = ({ children, ...context }) => {
14
- const value = react.useMemo(() => context, []);
36
+ const value = react$1.useMemo(() => context, []);
15
37
  return /* @__PURE__ */ jsxRuntime.jsx(SiteContext.Provider, { value, children });
16
38
  };
17
39
  function useSiteContext() {
18
- const context = react.useContext(SiteContext);
40
+ const context = react$1.useContext(SiteContext);
19
41
  if (!context) {
20
42
  throw new Error("useSiteContext must be used within SiteProvider");
21
43
  }
22
44
  return context;
23
45
  }
24
- const PageContext = react.createContext(null);
46
+ const PageContext = react$1.createContext(null);
25
47
  const PageProvider = ({ children, location }) => {
26
48
  const { localization } = useSiteContext();
27
49
  const { currentLocale } = index.useLocalization({ location, ...localization });
28
- const value = react.useMemo(() => ({ currentLocale }), [currentLocale]);
50
+ const value = react$1.useMemo(() => ({ currentLocale }), [currentLocale]);
29
51
  return /* @__PURE__ */ jsxRuntime.jsx(PageContext.Provider, { value, children });
30
52
  };
31
53
  function usePageContext() {
32
- const context = react.useContext(PageContext);
54
+ const context = react$1.useContext(PageContext);
33
55
  if (!context) {
34
56
  throw new Error("usePageContext must be used within PageProvider");
35
57
  }
@@ -49,13 +71,14 @@ function getLocalizedPath(path, currentLocaleCode, defaultLocaleCode) {
49
71
  }
50
72
  return `${localePrefix}${normalizePath(path)}`;
51
73
  }
52
- const Link = react.forwardRef(({ to, ...props }, ref) => {
74
+ const Link = react$1.forwardRef(({ to, ...props }, ref) => {
53
75
  const { localization } = useSiteContext();
54
76
  const { currentLocale } = usePageContext();
55
77
  const defaultLocale = localization.defaultLocale;
56
78
  const path = getLocalizedPath(to, currentLocale.code, defaultLocale.code);
57
79
  return /* @__PURE__ */ jsxRuntime.jsx(gatsby.Link, { ref, to: path, ...props });
58
80
  });
81
+ exports.Image = Image;
59
82
  exports.Link = Link;
60
83
  exports.PageProvider = PageProvider;
61
84
  exports.SiteProvider = SiteProvider;
@@ -1,13 +1,35 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { Image as Image$1, Box } from "@chakra-ui/react";
3
+ import Zoom from "react-medium-image-zoom";
2
4
  import { createContext, useContext, useMemo, forwardRef } from "react";
3
5
  import { Link as Link$1 } from "gatsby";
4
- import "@chakra-ui/react";
5
6
  import "@mdx-js/react";
6
7
  import "react-i18next";
7
8
  import "./index-BJRvnR8Q.mjs";
8
9
  import "./index-Bts2DBYS.mjs";
9
10
  import { u as useLocalization } from "./index-BzbpMLDD.mjs";
10
11
  import { i as isRelativePath } from "./index-BmaWfWLV.mjs";
12
+ const Image = ({ src, mode = "default", hasZoom, ...plainImageProps }) => {
13
+ if (!src) {
14
+ return null;
15
+ }
16
+ let image;
17
+ if (typeof src === "string") {
18
+ image = /* @__PURE__ */ jsx(
19
+ Image$1,
20
+ {
21
+ src,
22
+ ...mode === "thumbnail" && { aspectRatio: "16/9", objectFit: "cover", objectPosition: "center" },
23
+ ...plainImageProps
24
+ }
25
+ );
26
+ } else if (src.props.image) {
27
+ image = mode === "thumbnail" ? /* @__PURE__ */ jsx(Box, { aspectRatio: "16/9", children: src }) : src;
28
+ } else {
29
+ return null;
30
+ }
31
+ return hasZoom ? /* @__PURE__ */ jsx(Zoom, { wrapElement: "span", zoomMargin: 40, children: image }) : image;
32
+ };
11
33
  const SiteContext = createContext(null);
12
34
  const SiteProvider = ({ children, ...context }) => {
13
35
  const value = useMemo(() => context, []);
@@ -56,6 +78,7 @@ const Link = forwardRef(({ to, ...props }, ref) => {
56
78
  return /* @__PURE__ */ jsx(Link$1, { ref, to: path, ...props });
57
79
  });
58
80
  export {
81
+ Image as I,
59
82
  Link as L,
60
83
  PageProvider as P,
61
84
  SiteProvider as S,
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Text, UnorderedList, OrderedList, Heading, Link } from "@chakra-ui/react";
3
3
  import { MDXProvider } from "@mdx-js/react";
4
+ import { I as Image, L as Link$1 } from "./index-Bwlxdh5F.mjs";
4
5
  import "react";
5
6
  import "react-i18next";
6
- import { L as Link$1 } from "./index-DA6TBpuE.mjs";
7
7
  import "./index-BJRvnR8Q.mjs";
8
8
  import "./index-Bts2DBYS.mjs";
9
9
  import { i as isRelativePath } from "./index-BmaWfWLV.mjs";
@@ -36,6 +36,9 @@ function renderLink({
36
36
  }
37
37
  );
38
38
  }
39
+ function renderImage(props) {
40
+ return /* @__PURE__ */ jsx(Image, { ...props, mt: 4, mb: 4, hasZoom: true });
41
+ }
39
42
  const components = {
40
43
  h1: preprocessProps((props) => /* @__PURE__ */ jsx(Heading, { as: "h1", size: "xl", mb: 4, ...props })),
41
44
  h2: preprocessProps((props) => /* @__PURE__ */ jsx(Heading, { as: "h2", size: "lg", mt: 6, mb: 4, ...props })),
@@ -43,7 +46,8 @@ const components = {
43
46
  ol: preprocessProps((props) => /* @__PURE__ */ jsx(OrderedList, { mb: 4, ...props })),
44
47
  ul: preprocessProps((props) => /* @__PURE__ */ jsx(UnorderedList, { mb: 4, ...props })),
45
48
  p: preprocessProps((props) => /* @__PURE__ */ jsx(Text, { mb: 4, ...props })),
46
- a: preprocessProps((props) => renderLink(props))
49
+ a: preprocessProps((props) => renderLink(props)),
50
+ img: preprocessProps((props) => renderImage(props))
47
51
  };
48
52
  const MdxProvider = ({ children }) => {
49
53
  return /* @__PURE__ */ jsx(MDXProvider, { components, children });
package/dist/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-bNvgXBvA.js");
4
- const index$1 = require("./index-Cn8RI_2O.js");
3
+ const index = require("./index-4Zb1neOM.js");
4
+ const index$1 = require("./index-BltrZp3R.js");
5
5
  const index$2 = require("./index-WFgDSB1A.js");
6
6
  const index$3 = require("./index-CAfBnNV6.js");
7
7
  const i18n = require("./i18n/index.cjs");
8
- const index$4 = require("./index-BFhrFJqB.js");
8
+ const index$4 = require("./index-BbxOP7UY.js");
9
9
  const index$5 = require("./index-CJVr79Z2.js");
10
10
  const index$6 = require("./index-C6MG_f24.js");
11
11
  const index$7 = require("./index-CYr1ct1t.js");
@@ -33,10 +33,13 @@ exports.List = index.List;
33
33
  exports.NotFound = index.NotFound;
34
34
  exports.ProsCons = index.ProsCons;
35
35
  exports.Seo = index.Seo;
36
+ exports.SocialNetwork = index.SocialNetwork;
37
+ exports.SocialNetworks = index.SocialNetworks;
36
38
  exports.StrapiContentRenderer = index.StrapiContentRenderer;
37
39
  exports.Table = index.Table;
38
40
  exports.Tabs = index.Tabs;
39
41
  exports.Tip = index.Tip;
42
+ exports.Image = index$1.Image;
40
43
  exports.Link = index$1.Link;
41
44
  exports.PageProvider = index$1.PageProvider;
42
45
  exports.SiteProvider = index$1.SiteProvider;
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
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-CtmxlomQ.mjs";
2
- import { L as L2, P as P2, S as S2, u, a as a2 } from "./index-DA6TBpuE.mjs";
1
+ import { k, A, B, a, l, C, F, b, c, G, d, e, f, m, H, L, n, g, N, P, S, o, p, h, T, i, j } from "./index-BM-_Lr_j.mjs";
2
+ import { I, L as L2, P as P2, S as S2, u, a as a2 } from "./index-Bwlxdh5F.mjs";
3
3
  import { u as u2 } from "./index-BzbpMLDD.mjs";
4
4
  import { u as u3 } from "./index-tj12BA6U.mjs";
5
5
  import { DEFAULT_LANGUAGE, resources } from "./i18n/index.mjs";
6
- import { M } from "./index-BJQgELmZ.mjs";
6
+ import { M } from "./index-C4sJXfkN.mjs";
7
7
  import { a as a3, G as G2 } from "./index-Bts2DBYS.mjs";
8
8
  import { A as A2 } from "./index-BJRvnR8Q.mjs";
9
9
  import { b as b2, c as c2, g as g2, a as a4 } from "./index-cQqALZIW.mjs";
@@ -31,6 +31,7 @@ export {
31
31
  G2 as GameVolatility,
32
32
  m as Grid,
33
33
  H as HowTo,
34
+ I as Image,
34
35
  L3 as LIGHT_THEME_COLOR,
35
36
  L as Layout,
36
37
  L2 as Link,
@@ -42,6 +43,8 @@ export {
42
43
  P as ProsCons,
43
44
  S as Seo,
44
45
  S2 as SiteProvider,
46
+ o as SocialNetwork,
47
+ p as SocialNetworks,
45
48
  h as StrapiContentRenderer,
46
49
  T as Table,
47
50
  i as Tabs,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-BFhrFJqB.js");
4
- const index$1 = require("../index-Cn8RI_2O.js");
3
+ const index = require("../index-BbxOP7UY.js");
4
+ const index$1 = require("../index-BltrZp3R.js");
5
5
  exports.MdxProvider = index.MdxProvider;
6
6
  exports.PageProvider = index$1.PageProvider;
7
7
  exports.SiteProvider = index$1.SiteProvider;
@@ -1,5 +1,5 @@
1
- import { M } from "../index-BJQgELmZ.mjs";
2
- import { P, S, u, a } from "../index-DA6TBpuE.mjs";
1
+ import { M } from "../index-C4sJXfkN.mjs";
2
+ import { P, S, u, a } from "../index-Bwlxdh5F.mjs";
3
3
  export {
4
4
  M as MdxProvider,
5
5
  P as PageProvider,
@@ -1,6 +1,6 @@
1
- import { Image } from '../image';
1
+ import { ImageType } from '../image';
2
2
  export interface IHowToStep {
3
3
  title: string;
4
4
  description?: string;
5
- thumbnail?: Image;
5
+ thumbnail?: ImageType;
6
6
  }
@@ -1,6 +1,8 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { ImageProps } from '@chakra-ui/react';
3
3
  export type ImageUrl = string;
4
- export type ImageComponent = ReactElement;
5
- export type Image = ImageUrl | ImageComponent;
4
+ export type ImageComponent = ReactElement<{
5
+ image: unknown;
6
+ }>;
7
+ export type ImageType = ImageUrl | ImageComponent;
6
8
  export type ImageFit = ImageProps['objectFit'];
@@ -13,5 +13,6 @@ export * from './link';
13
13
  export * from './locale-switcher';
14
14
  export * from './navigation';
15
15
  export * from './pros-cons';
16
+ export * from './social-network';
16
17
  export * from './strapi-component';
17
18
  export * from './tabs';
@@ -0,0 +1,6 @@
1
+ type SocialNetwork = 'facebook' | 'x' | 'pinterest' | 'youtube' | 'instagram';
2
+ export interface ISocialNetwork {
3
+ kind: SocialNetwork;
4
+ url: string;
5
+ }
6
+ export {};
@@ -1,18 +1,13 @@
1
- import { Image } from '../../components';
2
- type SocialNetwork = 'fb' | 'tw';
1
+ import { ImageType, ISocialNetwork } from '../../components';
3
2
  type Phone = string;
4
- interface ISocialNetwork {
5
- type: SocialNetwork;
6
- link: string;
7
- }
8
3
  export interface IAuthor {
9
4
  name: string;
10
5
  role: string;
11
6
  bio: string;
12
- avatar: Image;
7
+ avatar: ImageType;
8
+ socialNetworks?: ISocialNetwork[];
13
9
  /** Planned */
14
10
  address?: string;
15
11
  phone?: Phone;
16
- socialNetworks?: ISocialNetwork[];
17
12
  }
18
13
  export {};
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { Image, INavigation } from '../components';
2
+ import { ImageType, INavigation, ISocialNetwork } from '../components';
3
3
  import { ISeo } from '../content';
4
4
  import { Currency, ILocale } from '../i18n';
5
5
  interface ISiteHeaderConfig {
@@ -30,8 +30,9 @@ export interface ISiteMetadata {
30
30
  name: string;
31
31
  lang: ILocale['code'];
32
32
  seo: ISeo;
33
- logo: Image;
33
+ logo: ImageType;
34
+ socialNetworks?: ISocialNetwork[];
34
35
  /** Planned */
35
- favicon?: Image;
36
+ favicon?: ImageType;
36
37
  }
37
38
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@anywayseo/tools",
3
3
  "description": "Shared UI Components and Modules",
4
- "version": "5.2.0",
4
+ "version": "5.4.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -102,6 +102,7 @@
102
102
  "react": "^18.3.1",
103
103
  "react-dom": "^18.3.1",
104
104
  "react-i18next": "^15.0.0",
105
- "react-markdown": "^10.1.0"
105
+ "react-markdown": "^10.1.0",
106
+ "react-medium-image-zoom": "^5.3.0"
106
107
  }
107
108
  }