@anywayseo/tools 5.4.1 → 5.4.3

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,3 @@
1
+ import { ImageComponent, ImageType, ImageUrl } from '../../../types';
2
+ export declare function isImageUrl(image: ImageType): image is ImageUrl;
3
+ export declare function isImageComponent(image: ImageType): image is ImageComponent;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-DGc-4DpA.js");
4
- const index$1 = require("../index-BltrZp3R.js");
3
+ const index = require("../index-BmuHYofN.js");
4
+ const index$1 = require("../index-BLUHHmn6.js");
5
5
  exports.Author = index.Author;
6
6
  exports.AuthorCard = index.AuthorCard;
7
7
  exports.BonusCard = index.BonusCard;
@@ -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, o, p, h, T, i, j } from "../index-PLwa86VY.mjs";
2
- import { I, L as L2 } from "../index-Bwlxdh5F.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-BIg4-TxP.mjs";
2
+ import { I, L as L2 } from "../index-BHhn1SKu.mjs";
3
3
  export {
4
4
  k as Author,
5
5
  A as AuthorCard,
@@ -9,12 +9,21 @@ import "./index-BJRvnR8Q.mjs";
9
9
  import "./index-Bts2DBYS.mjs";
10
10
  import { u as useLocalization } from "./index-BzbpMLDD.mjs";
11
11
  import { i as isRelativePath } from "./index-BmaWfWLV.mjs";
12
- const Image = ({ src, mode = "default", hasZoom, ...plainImageProps }) => {
13
- if (!src) {
14
- return null;
15
- }
12
+ function isImageUrl(image) {
13
+ return Boolean(typeof image === "string" && image.trim() !== "");
14
+ }
15
+ function isGatsbyImage(image) {
16
+ return Boolean(image.props.image);
17
+ }
18
+ function isStaticImage(image) {
19
+ return Boolean(typeof image.type === "function");
20
+ }
21
+ function isImageComponent(image) {
22
+ return Boolean(typeof image !== "string" && (isGatsbyImage(image) || isStaticImage(image)));
23
+ }
24
+ const Image = ({ src = "", mode = "default", hasZoom, ...plainImageProps }) => {
16
25
  let image;
17
- if (typeof src === "string") {
26
+ if (isImageUrl(src)) {
18
27
  image = /* @__PURE__ */ jsx(
19
28
  Image$1,
20
29
  {
@@ -23,7 +32,7 @@ const Image = ({ src, mode = "default", hasZoom, ...plainImageProps }) => {
23
32
  ...plainImageProps
24
33
  }
25
34
  );
26
- } else if (src.props.image) {
35
+ } else if (isImageComponent(src)) {
27
36
  image = mode === "thumbnail" ? /* @__PURE__ */ jsx(Box, { aspectRatio: "16/9", children: src }) : src;
28
37
  } else {
29
38
  return null;
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { Link, Flex, Box, Collapse, Text, Button, Stack, Center as Center$1, SimpleGrid, 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
4
  import "react-medium-image-zoom";
5
- import { I as Image, a as useSiteContext, L as Link$1, u as usePageContext } from "./index-Bwlxdh5F.mjs";
5
+ import { I as Image, a as useSiteContext, L as Link$1, u as usePageContext } from "./index-BHhn1SKu.mjs";
6
6
  import { useRef, useState, useLayoutEffect, Fragment as Fragment$1, useMemo, forwardRef, useEffect } from "react";
7
7
  import { A as Animation } from "./index-BJRvnR8Q.mjs";
8
8
  import { a as GameCharacteristic } from "./index-Bts2DBYS.mjs";
@@ -10,12 +10,21 @@ require("./index-C6MG_f24.js");
10
10
  require("./index-CJVr79Z2.js");
11
11
  const index = require("./index-WFgDSB1A.js");
12
12
  const index$1 = require("./index-At00w6EN.js");
13
- const Image = ({ src, mode = "default", hasZoom, ...plainImageProps }) => {
14
- if (!src) {
15
- return null;
16
- }
13
+ function isImageUrl(image) {
14
+ return Boolean(typeof image === "string" && image.trim() !== "");
15
+ }
16
+ function isGatsbyImage(image) {
17
+ return Boolean(image.props.image);
18
+ }
19
+ function isStaticImage(image) {
20
+ return Boolean(typeof image.type === "function");
21
+ }
22
+ function isImageComponent(image) {
23
+ return Boolean(typeof image !== "string" && (isGatsbyImage(image) || isStaticImage(image)));
24
+ }
25
+ const Image = ({ src = "", mode = "default", hasZoom, ...plainImageProps }) => {
17
26
  let image;
18
- if (typeof src === "string") {
27
+ if (isImageUrl(src)) {
19
28
  image = /* @__PURE__ */ jsxRuntime.jsx(
20
29
  react.Image,
21
30
  {
@@ -24,7 +33,7 @@ const Image = ({ src, mode = "default", hasZoom, ...plainImageProps }) => {
24
33
  ...plainImageProps
25
34
  }
26
35
  );
27
- } else if (src.props.image) {
36
+ } else if (isImageComponent(src)) {
28
37
  image = mode === "thumbnail" ? /* @__PURE__ */ jsxRuntime.jsx(react.Box, { aspectRatio: "16/9", children: src }) : src;
29
38
  } else {
30
39
  return null;
@@ -3,7 +3,7 @@ const jsxRuntime = require("react/jsx-runtime");
3
3
  const react = require("@chakra-ui/react");
4
4
  const reactI18next = require("react-i18next");
5
5
  require("react-medium-image-zoom");
6
- const index = require("./index-BltrZp3R.js");
6
+ const index = require("./index-BLUHHmn6.js");
7
7
  const react$1 = require("react");
8
8
  const index$3 = require("./index-C6MG_f24.js");
9
9
  const index$5 = require("./index-CJVr79Z2.js");
@@ -2,7 +2,7 @@
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
+ const index = require("./index-BLUHHmn6.js");
6
6
  require("react");
7
7
  require("react-i18next");
8
8
  require("./index-C6MG_f24.js");
@@ -1,7 +1,7 @@
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
+ import { I as Image, L as Link$1 } from "./index-BHhn1SKu.mjs";
5
5
  import "react";
6
6
  import "react-i18next";
7
7
  import "./index-BJRvnR8Q.mjs";
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-DGc-4DpA.js");
4
- const index$1 = require("./index-BltrZp3R.js");
3
+ const index = require("./index-BmuHYofN.js");
4
+ const index$1 = require("./index-BLUHHmn6.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-BbxOP7UY.js");
8
+ const index$4 = require("./index-BuxP2ZlR.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");
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, o, p, h, T, i, j } from "./index-PLwa86VY.mjs";
2
- import { I, L as L2, P as P2, S as S2, u, a as a2 } from "./index-Bwlxdh5F.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-BIg4-TxP.mjs";
2
+ import { I, L as L2, P as P2, S as S2, u, a as a2 } from "./index-BHhn1SKu.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-C4sJXfkN.mjs";
6
+ import { M } from "./index-C7Y6A1Y-.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";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-BbxOP7UY.js");
4
- const index$1 = require("../index-BltrZp3R.js");
3
+ const index = require("../index-BuxP2ZlR.js");
4
+ const index$1 = require("../index-BLUHHmn6.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-C4sJXfkN.mjs";
2
- import { P, S, u, a } from "../index-Bwlxdh5F.mjs";
1
+ import { M } from "../index-C7Y6A1Y-.mjs";
2
+ import { P, S, u, a } from "../index-BHhn1SKu.mjs";
3
3
  export {
4
4
  M as MdxProvider,
5
5
  P as PageProvider,
@@ -2,7 +2,7 @@ import { ReactElement } from 'react';
2
2
  import { ImageProps } from '@chakra-ui/react';
3
3
  export type ImageUrl = string;
4
4
  export type ImageComponent = ReactElement<{
5
- image: unknown;
5
+ image?: unknown;
6
6
  }>;
7
7
  export type ImageType = ImageUrl | ImageComponent;
8
8
  export type ImageFit = ImageProps['objectFit'];
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.4.1",
4
+ "version": "5.4.3",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",