@anywayseo/tools 5.2.0 → 5.3.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.
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ import { ImageType } from '../../../types';
3
+ import { ImageProps as ChakraImageProps } from '@chakra-ui/react';
4
+ type ImageProps = Omit<ChakraImageProps, 'src'> & {
5
+ src?: ImageType;
6
+ mode?: 'thumbnail' | 'default';
7
+ hasZoom?: boolean;
8
+ };
9
+ declare const Image: FC<ImageProps>;
10
+ export default Image;
@@ -1,5 +1,6 @@
1
1
  export { default as Author } from './author';
2
2
  export { default as Center } from './center';
3
3
  export { default as Grid } from './grid';
4
+ export { default as Image } from './image';
4
5
  export { default as Link } from './link';
5
6
  export { default as LinkButton } from './link-button';
@@ -1,7 +1,7 @@
1
1
  import { FC } from 'react';
2
- import { Image as TImage, ImageFit } from '../../../types';
2
+ import { ImageType, ImageFit } from '../../../types';
3
3
  type GameDemoPreviewProps = {
4
- image: TImage;
4
+ image: ImageType;
5
5
  alt: string;
6
6
  href?: string;
7
7
  imageFit?: ImageFit;
@@ -1,7 +1,7 @@
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-BGMR4f6W.js");
4
+ const index$1 = require("../index-BltrZp3R.js");
5
5
  exports.Author = index.Author;
6
6
  exports.AuthorCard = index.AuthorCard;
7
7
  exports.BonusCard = index.BonusCard;
@@ -27,4 +27,5 @@ exports.StrapiContentRenderer = index.StrapiContentRenderer;
27
27
  exports.Table = index.Table;
28
28
  exports.Tabs = index.Tabs;
29
29
  exports.Tip = index.Tip;
30
+ exports.Image = index$1.Image;
30
31
  exports.Link = index$1.Link;
@@ -1,5 +1,5 @@
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 } 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, h, T, i, j } from "../index-CjaAcLJf.mjs";
2
+ import { I, L as L2 } from "../index-Bwlxdh5F.mjs";
3
3
  export {
4
4
  k as Author,
5
5
  A as AuthorCard,
@@ -16,6 +16,7 @@ export {
16
16
  f as GameInfo,
17
17
  m as Grid,
18
18
  H as HowTo,
19
+ I as Image,
19
20
  L as Layout,
20
21
  L2 as Link,
21
22
  n as LinkButton,
@@ -2,7 +2,8 @@
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const react$1 = require("@chakra-ui/react");
4
4
  const reactI18next = require("react-i18next");
5
- const index = require("./index-Cn8RI_2O.js");
5
+ require("react-medium-image-zoom");
6
+ const index = require("./index-BltrZp3R.js");
6
7
  const react = require("react");
7
8
  const index$3 = require("./index-C6MG_f24.js");
8
9
  const index$5 = require("./index-CJVr79Z2.js");
@@ -39,22 +40,20 @@ const Bio = ({ content, maxLines = 1 }) => {
39
40
  };
40
41
  const Author = ({ author, variant }) => {
41
42
  const { name, role, bio, avatar } = author;
42
- const imageComponent = typeof avatar === "string" ? /* @__PURE__ */ jsxRuntime.jsx(react$1.Image, { src: avatar, alt: name, rounded: "full" }) : avatar;
43
43
  if (variant === "short") {
44
- return /* @__PURE__ */ jsxRuntime.jsxs(react$1.Flex, { as: "article", align: "center", gap: 4, children: [
45
- !!imageComponent && /* @__PURE__ */ jsxRuntime.jsx(react$1.Box, { w: 12, h: 12, children: imageComponent }),
44
+ return /* @__PURE__ */ jsxRuntime.jsxs(react$1.Flex, { align: "center", gap: 4, children: [
45
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Box, { w: 12, h: 12, children: /* @__PURE__ */ jsxRuntime.jsx(index.Image, { src: avatar, alt: name, rounded: "full" }) }),
46
46
  /* @__PURE__ */ jsxRuntime.jsxs(react$1.Box, { fontWeight: "semibold", children: [
47
47
  /* @__PURE__ */ jsxRuntime.jsx(react$1.Text, { children: name }),
48
48
  /* @__PURE__ */ jsxRuntime.jsx(react$1.Text, { color: "gray.500", children: role })
49
49
  ] })
50
50
  ] });
51
51
  }
52
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
53
- !!imageComponent && /* @__PURE__ */ jsxRuntime.jsx(react$1.Flex, { grow: 1, maxW: { base: 48, sm: 32 }, children: imageComponent }),
54
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Flex, { w: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(react$1.Stack, { children: [
52
+ return /* @__PURE__ */ jsxRuntime.jsxs(react$1.Flex, { direction: { base: "column", sm: "row" }, align: { base: "center", sm: "flex-start" }, gap: 4, children: [
53
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Flex, { flex: 1, maxW: { base: 48, sm: 32 }, children: /* @__PURE__ */ jsxRuntime.jsx(index.Image, { src: avatar, alt: name, rounded: "full" }) }),
54
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Flex, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(react$1.Stack, { children: [
55
55
  /* @__PURE__ */ jsxRuntime.jsxs(react$1.Text, { fontSize: "lg", fontWeight: 600, children: [
56
- name,
57
- ", ",
56
+ `${name}, `,
58
57
  /* @__PURE__ */ jsxRuntime.jsx(react$1.Text, { as: "span", color: "gray.500", children: role })
59
58
  ] }),
60
59
  /* @__PURE__ */ jsxRuntime.jsx(Bio, { content: bio })
@@ -116,16 +115,7 @@ const AuthorCard = ({ author, ...boxProps }) => {
116
115
  const { t } = reactI18next.useTranslation("author");
117
116
  return /* @__PURE__ */ jsxRuntime.jsxs(react$1.Card, { as: "article", variant: "filled", ...boxProps, children: [
118
117
  /* @__PURE__ */ jsxRuntime.jsx(react$1.CardHeader, { pb: 0, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.Heading, { size: "md", children: t("title") }) }),
119
- /* @__PURE__ */ jsxRuntime.jsx(
120
- react$1.CardBody,
121
- {
122
- display: "flex",
123
- flexDirection: { base: "column", sm: "row" },
124
- alignItems: { base: "center", sm: "flex-start" },
125
- gap: 4,
126
- children: /* @__PURE__ */ jsxRuntime.jsx(Author, { author, variant: "full" })
127
- }
128
- )
118
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.CardBody, { children: /* @__PURE__ */ jsxRuntime.jsx(Author, { author, variant: "full" }) })
129
119
  ] });
130
120
  };
131
121
  const BonusCardContent = ({ content, buttonColor }) => {
@@ -338,7 +328,7 @@ const GameCard = ({ name, description, image, href, height = "auto" }) => {
338
328
  height,
339
329
  _hover: { transform: "scale(1.05)" },
340
330
  children: [
341
- typeof image === "string" ? /* @__PURE__ */ jsxRuntime.jsx(react$1.Image, { src: image, alt: name, w: "100%", aspectRatio: "16/9", objectFit: "cover", objectPosition: "center" }) : !!image && /* @__PURE__ */ jsxRuntime.jsx(react$1.Box, { w: "100%", aspectRatio: "16/9", children: image }),
331
+ /* @__PURE__ */ jsxRuntime.jsx(index.Image, { src: image, alt: name, mode: "thumbnail" }),
342
332
  /* @__PURE__ */ jsxRuntime.jsxs(react$1.Box, { as: "section", rounded: "md", p: 4, children: [
343
333
  /* @__PURE__ */ jsxRuntime.jsx(react$1.Text, { as: "span", children: href ? /* @__PURE__ */ jsxRuntime.jsx(react$1.LinkOverlay, { href, children: name }) : name }),
344
334
  !!description && /* @__PURE__ */ jsxRuntime.jsx(react$1.Text, { fontSize: "sm", color: "gray.600", children: description })
@@ -430,9 +420,8 @@ const GameDemoContent = ({
430
420
  };
431
421
  const GameDemoPreview = ({ image, alt, href, imageFit = "contain", onPlayDemo }) => {
432
422
  const { t } = reactI18next.useTranslation("gameDemo");
433
- const imageComponent = typeof image === "string" ? /* @__PURE__ */ jsxRuntime.jsx(react$1.Image, { src: image, alt, objectFit: imageFit, w: "100%", h: "100%" }) : image;
434
423
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
435
- imageComponent,
424
+ /* @__PURE__ */ jsxRuntime.jsx(index.Image, { src: image, alt, objectFit: imageFit, w: "100%", h: "100%" }),
436
425
  /* @__PURE__ */ jsxRuntime.jsx(react$1.AbsoluteCenter, { children: /* @__PURE__ */ jsxRuntime.jsxs(react$1.Stack, { spacing: 4, children: [
437
426
  /* @__PURE__ */ jsxRuntime.jsx(
438
427
  LinkButton,
@@ -596,14 +585,14 @@ const GameInfo = ({ info, currencies }) => {
596
585
  };
597
586
  const HowTo = ({ steps, ...boxProps }) => {
598
587
  const { bgColor, invertedColor } = index$1.usePrimaryColors();
599
- return /* @__PURE__ */ jsxRuntime.jsx(react$1.SimpleGrid, { as: "ol", columns: { base: 1, md: 2, lg: 3 }, gap: 4, p: 0, ...boxProps, children: steps.map(({ title, description, thumbnail }, index2) => /* @__PURE__ */ jsxRuntime.jsxs(react$1.Flex, { as: "li", alignItems: "flex-start", gap: 4, children: [
600
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Circle, { size: 12, bgColor, color: invertedColor, fontSize: "lg", fontWeight: "bold", children: String(index2 + 1) }),
588
+ return /* @__PURE__ */ jsxRuntime.jsx(react$1.SimpleGrid, { as: "ol", columns: { base: 1, md: 2, lg: 3 }, gap: 4, p: 0, ...boxProps, children: steps.map(({ title, description, thumbnail }, index$12) => /* @__PURE__ */ jsxRuntime.jsxs(react$1.Flex, { as: "li", alignItems: "flex-start", gap: 4, children: [
589
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Circle, { size: 12, bgColor, color: invertedColor, fontSize: "lg", fontWeight: "bold", children: String(index$12 + 1) }),
601
590
  /* @__PURE__ */ jsxRuntime.jsxs(react$1.Stack, { flex: 1, children: [
602
591
  /* @__PURE__ */ jsxRuntime.jsx(react$1.Text, { fontSize: "lg", fontWeight: "bold", children: title }),
603
- typeof thumbnail === "string" ? /* @__PURE__ */ jsxRuntime.jsx(react$1.Image, { src: thumbnail, alt: title, aspectRatio: "16/9", objectFit: "cover" }) : thumbnail,
592
+ /* @__PURE__ */ jsxRuntime.jsx(index.Image, { src: thumbnail, alt: title, mode: "thumbnail", hasZoom: true }),
604
593
  /* @__PURE__ */ jsxRuntime.jsx(react$1.Text, { children: description })
605
594
  ] })
606
- ] }, index2)) });
595
+ ] }, index$12)) });
607
596
  };
608
597
  const Container = ({ children }) => {
609
598
  return /* @__PURE__ */ jsxRuntime.jsx(react$1.Container, { maxW: "container.xl", children });
@@ -614,7 +603,7 @@ const Content = ({ children }) => {
614
603
  const Logo = () => {
615
604
  const { metadata } = index.useSiteContext();
616
605
  const { logo } = metadata;
617
- return /* @__PURE__ */ jsxRuntime.jsx(react$1.Box, { display: "flex", h: { base: 10, md: 14 }, overflow: "hidden", children: typeof logo === "string" ? /* @__PURE__ */ jsxRuntime.jsx(react$1.Image, { src: logo, alt: "Logo", objectFit: "contain" }) : logo });
606
+ return /* @__PURE__ */ jsxRuntime.jsx(react$1.Box, { display: "flex", h: { base: 10, md: 14 }, overflow: "hidden", children: /* @__PURE__ */ jsxRuntime.jsx(index.Image, { src: logo, alt: "Logo", objectFit: "contain" }) });
618
607
  };
619
608
  const Brand$1 = ({ brand }) => {
620
609
  return /* @__PURE__ */ jsxRuntime.jsxs(react$1.Box, { position: "relative", my: 2, py: 8, children: [
@@ -1081,7 +1070,7 @@ const Layout = ({ children }) => {
1081
1070
  ] });
1082
1071
  };
1083
1072
  const List = ({ items, bullet = "—", render, ...boxProps }) => {
1084
- return /* @__PURE__ */ jsxRuntime.jsx(react$1.List, { pl: 0, ml: 2, mb: 4, ...boxProps, children: items.map((item, index2) => /* @__PURE__ */ jsxRuntime.jsxs(react$1.ListItem, { display: "flex", gap: 1, children: [
1073
+ return /* @__PURE__ */ jsxRuntime.jsx(react$1.List, { pl: 0, ml: 2, ...boxProps, children: items.map((item, index2) => /* @__PURE__ */ jsxRuntime.jsxs(react$1.ListItem, { display: "flex", gap: 1, children: [
1085
1074
  /* @__PURE__ */ jsxRuntime.jsx(react$1.Box, { children: bullet }),
1086
1075
  render ? render(item) : item
1087
1076
  ] }, index2)) });
@@ -1249,7 +1238,7 @@ const Tip = ({ tip, author = null, ...boxProps }) => {
1249
1238
  const ExternalImage = ({ image, component: ImageComponent, alt = "", ...imageProps }) => {
1250
1239
  var _a, _b;
1251
1240
  const imageData = (_b = (_a = image == null ? void 0 : image.localFile) == null ? void 0 : _a.childImageSharp) == null ? void 0 : _b.gatsbyImageData;
1252
- return imageData ? /* @__PURE__ */ jsxRuntime.jsx(ImageComponent, { image: imageData, alt, ...imageProps }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
1241
+ return imageData ? /* @__PURE__ */ jsxRuntime.jsx(ImageComponent, { image: imageData, alt, ...imageProps }) : null;
1253
1242
  };
1254
1243
  const RichText = ({ content }) => {
1255
1244
  const components = react$2.useMDXComponents();
@@ -1303,15 +1292,14 @@ const StrapiComponent = ({ type, props, imageComponent }) => {
1303
1292
  }
1304
1293
  );
1305
1294
  case "STRAPI__COMPONENT_CONTENT_LIST":
1306
- return /* @__PURE__ */ jsxRuntime.jsx(List, { bullet: props.bullet, items: extractItemsFromJson(props.content) });
1295
+ return /* @__PURE__ */ jsxRuntime.jsx(List, { bullet: props.bullet, items: extractItemsFromJson(props.content), mb: 4 });
1307
1296
  case "STRAPI__COMPONENT_CONTENT_MEDIA":
1308
1297
  return /* @__PURE__ */ jsxRuntime.jsx(
1309
- ExternalImage,
1298
+ index.Image,
1310
1299
  {
1311
- component: imageComponent,
1312
- image: props.file,
1313
- alt: props.alternativeText,
1314
- style: { display: "inline-block", marginBottom: 16 }
1300
+ src: /* @__PURE__ */ jsxRuntime.jsx(ExternalImage, { component: imageComponent, image: props.file, alt: props.alternativeText }),
1301
+ mb: 4,
1302
+ hasZoom: true
1315
1303
  }
1316
1304
  );
1317
1305
  case "STRAPI__COMPONENT_CONTENT_PROS_CONS":
@@ -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 });
@@ -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 { Box, Collapse, Text, Button, Flex, 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 { I as Image, a as useSiteContext, L as Link, 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";
@@ -38,22 +39,20 @@ const Bio = ({ content, maxLines = 1 }) => {
38
39
  };
39
40
  const Author = ({ author, variant }) => {
40
41
  const { name, role, bio, avatar } = author;
41
- const imageComponent = typeof avatar === "string" ? /* @__PURE__ */ jsx(Image, { src: avatar, alt: name, rounded: "full" }) : avatar;
42
42
  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 }),
43
+ return /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 4, children: [
44
+ /* @__PURE__ */ jsx(Box, { w: 12, h: 12, children: /* @__PURE__ */ jsx(Image, { src: avatar, alt: name, rounded: "full" }) }),
45
45
  /* @__PURE__ */ jsxs(Box, { fontWeight: "semibold", children: [
46
46
  /* @__PURE__ */ jsx(Text, { children: name }),
47
47
  /* @__PURE__ */ jsx(Text, { color: "gray.500", children: role })
48
48
  ] })
49
49
  ] });
50
50
  }
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: [
51
+ return /* @__PURE__ */ jsxs(Flex, { direction: { base: "column", sm: "row" }, align: { base: "center", sm: "flex-start" }, gap: 4, children: [
52
+ /* @__PURE__ */ jsx(Flex, { flex: 1, maxW: { base: 48, sm: 32 }, children: /* @__PURE__ */ jsx(Image, { src: avatar, alt: name, rounded: "full" }) }),
53
+ /* @__PURE__ */ jsx(Flex, { flex: 1, children: /* @__PURE__ */ jsxs(Stack, { children: [
54
54
  /* @__PURE__ */ jsxs(Text, { fontSize: "lg", fontWeight: 600, children: [
55
- name,
56
- ", ",
55
+ `${name}, `,
57
56
  /* @__PURE__ */ jsx(Text, { as: "span", color: "gray.500", children: role })
58
57
  ] }),
59
58
  /* @__PURE__ */ jsx(Bio, { content: bio })
@@ -115,16 +114,7 @@ const AuthorCard = ({ author, ...boxProps }) => {
115
114
  const { t: t2 } = useTranslation("author");
116
115
  return /* @__PURE__ */ jsxs(Card, { as: "article", variant: "filled", ...boxProps, children: [
117
116
  /* @__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
- )
117
+ /* @__PURE__ */ jsx(CardBody, { children: /* @__PURE__ */ jsx(Author, { author, variant: "full" }) })
128
118
  ] });
129
119
  };
130
120
  const BonusCardContent = ({ content, buttonColor }) => {
@@ -337,7 +327,7 @@ const GameCard = ({ name, description, image, href, height = "auto" }) => {
337
327
  height,
338
328
  _hover: { transform: "scale(1.05)" },
339
329
  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 }),
330
+ /* @__PURE__ */ jsx(Image, { src: image, alt: name, mode: "thumbnail" }),
341
331
  /* @__PURE__ */ jsxs(Box, { as: "section", rounded: "md", p: 4, children: [
342
332
  /* @__PURE__ */ jsx(Text, { as: "span", children: href ? /* @__PURE__ */ jsx(LinkOverlay, { href, children: name }) : name }),
343
333
  !!description && /* @__PURE__ */ jsx(Text, { fontSize: "sm", color: "gray.600", children: description })
@@ -429,9 +419,8 @@ const GameDemoContent = ({
429
419
  };
430
420
  const GameDemoPreview = ({ image, alt, href, imageFit = "contain", onPlayDemo }) => {
431
421
  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
422
  return /* @__PURE__ */ jsxs(Fragment, { children: [
434
- imageComponent,
423
+ /* @__PURE__ */ jsx(Image, { src: image, alt, objectFit: imageFit, w: "100%", h: "100%" }),
435
424
  /* @__PURE__ */ jsx(AbsoluteCenter, { children: /* @__PURE__ */ jsxs(Stack, { spacing: 4, children: [
436
425
  /* @__PURE__ */ jsx(
437
426
  LinkButton,
@@ -599,7 +588,7 @@ const HowTo = ({ steps, ...boxProps }) => {
599
588
  /* @__PURE__ */ jsx(Circle, { size: 12, bgColor, color: invertedColor, fontSize: "lg", fontWeight: "bold", children: String(index + 1) }),
600
589
  /* @__PURE__ */ jsxs(Stack, { flex: 1, children: [
601
590
  /* @__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,
591
+ /* @__PURE__ */ jsx(Image, { src: thumbnail, alt: title, mode: "thumbnail", hasZoom: true }),
603
592
  /* @__PURE__ */ jsx(Text, { children: description })
604
593
  ] })
605
594
  ] }, index)) });
@@ -613,7 +602,7 @@ const Content = ({ children }) => {
613
602
  const Logo = () => {
614
603
  const { metadata } = useSiteContext();
615
604
  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 });
605
+ return /* @__PURE__ */ jsx(Box, { display: "flex", h: { base: 10, md: 14 }, overflow: "hidden", children: /* @__PURE__ */ jsx(Image, { src: logo, alt: "Logo", objectFit: "contain" }) });
617
606
  };
618
607
  const Brand$1 = ({ brand }) => {
619
608
  return /* @__PURE__ */ jsxs(Box, { position: "relative", my: 2, py: 8, children: [
@@ -1080,7 +1069,7 @@ const Layout = ({ children }) => {
1080
1069
  ] });
1081
1070
  };
1082
1071
  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: [
1072
+ return /* @__PURE__ */ jsx(List$1, { pl: 0, ml: 2, ...boxProps, children: items.map((item, index) => /* @__PURE__ */ jsxs(ListItem, { display: "flex", gap: 1, children: [
1084
1073
  /* @__PURE__ */ jsx(Box, { children: bullet }),
1085
1074
  render ? render(item) : item
1086
1075
  ] }, index)) });
@@ -1248,7 +1237,7 @@ const Tip = ({ tip, author = null, ...boxProps }) => {
1248
1237
  const ExternalImage = ({ image, component: ImageComponent, alt = "", ...imageProps }) => {
1249
1238
  var _a, _b;
1250
1239
  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, {});
1240
+ return imageData ? /* @__PURE__ */ jsx(ImageComponent, { image: imageData, alt, ...imageProps }) : null;
1252
1241
  };
1253
1242
  const RichText = ({ content }) => {
1254
1243
  const components = useMDXComponents();
@@ -1302,15 +1291,14 @@ const StrapiComponent = ({ type, props, imageComponent }) => {
1302
1291
  }
1303
1292
  );
1304
1293
  case "STRAPI__COMPONENT_CONTENT_LIST":
1305
- return /* @__PURE__ */ jsx(List, { bullet: props.bullet, items: extractItemsFromJson(props.content) });
1294
+ return /* @__PURE__ */ jsx(List, { bullet: props.bullet, items: extractItemsFromJson(props.content), mb: 4 });
1306
1295
  case "STRAPI__COMPONENT_CONTENT_MEDIA":
1307
1296
  return /* @__PURE__ */ jsx(
1308
- ExternalImage,
1297
+ Image,
1309
1298
  {
1310
- component: imageComponent,
1311
- image: props.file,
1312
- alt: props.alternativeText,
1313
- style: { display: "inline-block", marginBottom: 16 }
1299
+ src: /* @__PURE__ */ jsx(ExternalImage, { component: imageComponent, image: props.file, alt: props.alternativeText }),
1300
+ mb: 4,
1301
+ hasZoom: true
1314
1302
  }
1315
1303
  );
1316
1304
  case "STRAPI__COMPONENT_CONTENT_PROS_CONS":
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-BGMR4f6W.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");
@@ -37,6 +37,7 @@ exports.StrapiContentRenderer = index.StrapiContentRenderer;
37
37
  exports.Table = index.Table;
38
38
  exports.Tabs = index.Tabs;
39
39
  exports.Tip = index.Tip;
40
+ exports.Image = index$1.Image;
40
41
  exports.Link = index$1.Link;
41
42
  exports.PageProvider = index$1.PageProvider;
42
43
  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, h, T, i, j } from "./index-CjaAcLJf.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,
@@ -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'];
@@ -1,4 +1,4 @@
1
- import { Image } from '../../components';
1
+ import { ImageType } from '../../components';
2
2
  type SocialNetwork = 'fb' | 'tw';
3
3
  type Phone = string;
4
4
  interface ISocialNetwork {
@@ -9,7 +9,7 @@ export interface IAuthor {
9
9
  name: string;
10
10
  role: string;
11
11
  bio: string;
12
- avatar: Image;
12
+ avatar: ImageType;
13
13
  /** Planned */
14
14
  address?: string;
15
15
  phone?: Phone;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { Image, INavigation } from '../components';
2
+ import { ImageType, INavigation } from '../components';
3
3
  import { ISeo } from '../content';
4
4
  import { Currency, ILocale } from '../i18n';
5
5
  interface ISiteHeaderConfig {
@@ -30,8 +30,8 @@ export interface ISiteMetadata {
30
30
  name: string;
31
31
  lang: ILocale['code'];
32
32
  seo: ISeo;
33
- logo: Image;
33
+ logo: ImageType;
34
34
  /** Planned */
35
- favicon?: Image;
35
+ favicon?: ImageType;
36
36
  }
37
37
  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.3.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
  }