@verdaccio/ui-components 5.0.0-next-9.5 → 5.0.0-next-9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/Dependencies/DependencyBlock.mjs +2 -2
- package/build/components/Dependencies/DependencyBlock.mjs.map +1 -1
- package/build/components/Developers/Title.mjs +2 -2
- package/build/components/Developers/Title.mjs.map +1 -1
- package/build/components/Distribution/styles.mjs +2 -2
- package/build/components/Distribution/styles.mjs.map +1 -1
- package/build/components/Engines/styles.mjs +2 -2
- package/build/components/Engines/styles.mjs.map +1 -1
- package/build/components/Heading/Heading.mjs +2 -2
- package/build/components/Heading/Heading.mjs.map +1 -1
- package/build/components/Help/Help.mjs +3 -3
- package/build/components/Help/Help.mjs.map +1 -1
- package/build/components/Keywords/Keywords.mjs +2 -2
- package/build/components/Keywords/Keywords.mjs.map +1 -1
- package/build/components/Link/Link.mjs +2 -2
- package/build/components/Link/Link.mjs.map +1 -1
- package/build/components/LoginForm/Login.mjs +2 -2
- package/build/components/LoginForm/Login.mjs.map +1 -1
- package/build/components/NoItems/NoItems.mjs +2 -2
- package/build/components/NoItems/NoItems.mjs.map +1 -1
- package/build/components/Person/PersonTooltip.mjs +2 -2
- package/build/components/Person/PersonTooltip.mjs.map +1 -1
- package/build/components/Repository/Repository.mjs +2 -2
- package/build/components/Repository/Repository.mjs.map +1 -1
- package/build/components/Search/Search.js +2 -3
- package/build/components/Search/Search.js.map +1 -1
- package/build/components/Search/Search.mjs +1 -1
- package/build/components/Search/Search.mjs.map +1 -1
- package/build/components/UpLinks/styles.mjs +2 -2
- package/build/components/UpLinks/styles.mjs.map +1 -1
- package/build/components/Versions/Versions.js +2 -3
- package/build/components/Versions/Versions.js.map +1 -1
- package/build/components/Versions/Versions.mjs +3 -3
- package/build/components/Versions/Versions.mjs.map +1 -1
- package/build/sections/Header/LanguageSwitch.mjs +2 -2
- package/build/sections/Header/LanguageSwitch.mjs.map +1 -1
- package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.mjs +5 -5
- package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.mjs.map +1 -1
- package/build/sections/Security/utils.js +1 -2
- package/build/sections/Security/utils.js.map +1 -1
- package/build/sections/Security/utils.mjs +1 -1
- package/build/sections/Security/utils.mjs.map +1 -1
- package/build/utils/token.js +4 -7
- package/build/utils/token.js.map +1 -1
- package/build/utils/token.mjs +2 -3
- package/build/utils/token.mjs.map +1 -1
- package/build/utils/utils.js +2 -4
- package/build/utils/utils.js.map +1 -1
- package/build/utils/utils.mjs +2 -3
- package/build/utils/utils.mjs.map +1 -1
- package/package.json +22 -21
|
@@ -6,10 +6,10 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import Box from "@mui/material/Box";
|
|
7
7
|
import { useTranslation } from "react-i18next";
|
|
8
8
|
import { useNavigate } from "react-router";
|
|
9
|
-
import
|
|
9
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
10
10
|
import Chip from "@mui/material/Chip";
|
|
11
11
|
//#region src/components/Dependencies/DependencyBlock.tsx
|
|
12
|
-
var StyledText = styled(
|
|
12
|
+
var StyledText = styled(MaterialUITypography)((props) => ({
|
|
13
13
|
fontWeight: props.theme.fontWeight.bold,
|
|
14
14
|
textTransform: "capitalize"
|
|
15
15
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependencyBlock.mjs","names":[],"sources":["../../../src/components/Dependencies/DependencyBlock.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Box from '@mui/material/Box';\nimport Chip from '@mui/material/Chip';\nimport Typography from '@mui/material/Typography';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate } from 'react-router';\n\nimport type { Theme } from '../../Theme';\nimport type { PackageDependencies } from '../../types/packageMeta';\nimport { Route } from '../../utils';\n\ninterface DependencyBlockProps {\n title: string;\n dependencies: PackageDependencies;\n}\n\nexport const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nexport const Tags = styled('div')<{ theme?: Theme }>((props) => ({\n display: 'flex',\n justifyContent: 'start',\n flexWrap: 'wrap',\n // force title to be on the same line as the title\n // could be better to avoid margin on the first element\n // but it is a bit tricky to do with flexbox\n marginLeft: props.theme.spacing(-0.6),\n}));\n\nexport const Tag = styled(Chip)<{ theme?: Theme }>((props) => ({\n margin: props.theme.spacing(0.6),\n}));\n\nexport const DependencyBlock: React.FC<DependencyBlockProps> = ({ title, dependencies }) => {\n const navigate = useNavigate();\n const { t } = useTranslation();\n const deps = Object.entries(dependencies);\n\n function handleClick(name: string): void {\n navigate(`${Route.DETAIL}${name}`);\n }\n\n function labelText(title: string, name: string, version: string): string {\n if (title === 'bundleDependencies') {\n return t('dependencies.dependency-block-bundle', { package: name });\n } else {\n return t('dependencies.dependency-block', { package: name, version });\n }\n }\n\n return (\n <Box data-testid={title} sx={{ margin: 2 }}>\n <StyledText sx={{ marginBottom: 1 }} variant=\"subtitle1\">\n {`${title} (${deps.length})`}\n </StyledText>\n <Tags>\n {deps.map(([name, version]: [string, string]) => {\n // Bundle dependencies are stored as array, for example [ 0: \"semver\" ]\n // so the package name arrives here in the version field\n const packageName = title == 'bundleDependencies' ? version : name;\n return (\n <Tag\n className={'dep-tag'}\n clickable={true}\n data-testid={packageName}\n key={packageName}\n label={labelText(title, packageName, version)}\n onClick={() => {\n handleClick(packageName);\n }}\n />\n );\n })}\n </Tags>\n </Box>\n );\n};\n"],"mappings":";;;;;;;;;;;AAiBA,IAAa,aAAa,OAAO,
|
|
1
|
+
{"version":3,"file":"DependencyBlock.mjs","names":[],"sources":["../../../src/components/Dependencies/DependencyBlock.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Box from '@mui/material/Box';\nimport Chip from '@mui/material/Chip';\nimport Typography from '@mui/material/Typography';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate } from 'react-router';\n\nimport type { Theme } from '../../Theme';\nimport type { PackageDependencies } from '../../types/packageMeta';\nimport { Route } from '../../utils';\n\ninterface DependencyBlockProps {\n title: string;\n dependencies: PackageDependencies;\n}\n\nexport const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nexport const Tags = styled('div')<{ theme?: Theme }>((props) => ({\n display: 'flex',\n justifyContent: 'start',\n flexWrap: 'wrap',\n // force title to be on the same line as the title\n // could be better to avoid margin on the first element\n // but it is a bit tricky to do with flexbox\n marginLeft: props.theme.spacing(-0.6),\n}));\n\nexport const Tag = styled(Chip)<{ theme?: Theme }>((props) => ({\n margin: props.theme.spacing(0.6),\n}));\n\nexport const DependencyBlock: React.FC<DependencyBlockProps> = ({ title, dependencies }) => {\n const navigate = useNavigate();\n const { t } = useTranslation();\n const deps = Object.entries(dependencies);\n\n function handleClick(name: string): void {\n navigate(`${Route.DETAIL}${name}`);\n }\n\n function labelText(title: string, name: string, version: string): string {\n if (title === 'bundleDependencies') {\n return t('dependencies.dependency-block-bundle', { package: name });\n } else {\n return t('dependencies.dependency-block', { package: name, version });\n }\n }\n\n return (\n <Box data-testid={title} sx={{ margin: 2 }}>\n <StyledText sx={{ marginBottom: 1 }} variant=\"subtitle1\">\n {`${title} (${deps.length})`}\n </StyledText>\n <Tags>\n {deps.map(([name, version]: [string, string]) => {\n // Bundle dependencies are stored as array, for example [ 0: \"semver\" ]\n // so the package name arrives here in the version field\n const packageName = title == 'bundleDependencies' ? version : name;\n return (\n <Tag\n className={'dep-tag'}\n clickable={true}\n data-testid={packageName}\n key={packageName}\n label={labelText(title, packageName, version)}\n onClick={() => {\n handleClick(packageName);\n }}\n />\n );\n })}\n </Tags>\n </Box>\n );\n};\n"],"mappings":";;;;;;;;;;;AAiBA,IAAa,aAAa,OAAO,qBAAW,EAAqB,WAAW;CAC1E,YAAY,MAAM,MAAM,WAAW;CACnC,eAAe;CAChB,EAAE;AAEH,IAAa,OAAO,OAAO,MAAM,EAAqB,WAAW;CAC/D,SAAS;CACT,gBAAgB;CAChB,UAAU;CAIV,YAAY,MAAM,MAAM,QAAQ,IAAK;CACtC,EAAE;AAEH,IAAa,MAAM,OAAO,KAAK,EAAqB,WAAW,EAC7D,QAAQ,MAAM,MAAM,QAAQ,GAAI,EACjC,EAAE;AAEH,IAAa,mBAAmD,EAAE,OAAO,mBAAmB;CAC1F,MAAM,WAAW,aAAa;CAC9B,MAAM,EAAE,MAAM,gBAAgB;CAC9B,MAAM,OAAO,OAAO,QAAQ,aAAa;CAEzC,SAAS,YAAY,MAAoB;AACvC,WAAS,GAAG,QAAM,SAAS,OAAO;;CAGpC,SAAS,UAAU,OAAe,MAAc,SAAyB;AACvE,MAAI,UAAU,qBACZ,QAAO,EAAE,wCAAwC,EAAE,SAAS,MAAM,CAAC;MAEnE,QAAO,EAAE,iCAAiC;GAAE,SAAS;GAAM;GAAS,CAAC;;AAIzE,QACE,qBAAC,KAAD;EAAK,eAAa;EAAO,IAAI,EAAE,QAAQ,GAAG;YAA1C,CACE,oBAAC,YAAD;GAAY,IAAI,EAAE,cAAc,GAAG;GAAE,SAAQ;aAC1C,GAAG,MAAM,IAAI,KAAK,OAAO;GACf,CAAA,EACb,oBAAC,MAAD,EAAA,UACG,KAAK,KAAK,CAAC,MAAM,aAA+B;GAG/C,MAAM,cAAc,SAAS,uBAAuB,UAAU;AAC9D,UACE,oBAAC,KAAD;IACE,WAAW;IACX,WAAW;IACX,eAAa;IAEb,OAAO,UAAU,OAAO,aAAa,QAAQ;IAC7C,eAAe;AACb,iBAAY,YAAY;;IAE1B,EALK,YAKL;IAEJ,EACG,CAAA,CACH"}
|
|
@@ -4,7 +4,7 @@ import styled from "@emotion/styled";
|
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { useTranslation } from "react-i18next";
|
|
7
|
-
import
|
|
7
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
8
8
|
//#region src/components/Developers/Title.tsx
|
|
9
9
|
var Title = ({ type }) => {
|
|
10
10
|
const { t } = useTranslation();
|
|
@@ -19,7 +19,7 @@ var Title = ({ type }) => {
|
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
var StyledText = styled(
|
|
22
|
+
var StyledText = styled(MaterialUITypography)(({ theme }) => ({
|
|
23
23
|
fontWeight: theme.fontWeight.bold,
|
|
24
24
|
marginBottom: "10px"
|
|
25
25
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Title.mjs","names":[],"sources":["../../../src/components/Developers/Title.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Typography from '@mui/material/Typography';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport { DeveloperType } from './';\n\ninterface Props {\n type: DeveloperType;\n}\n\nconst Title: React.FC<Props> = ({ type }) => {\n const { t } = useTranslation();\n switch (type) {\n case DeveloperType.CONTRIBUTORS:\n return <StyledText variant={'subtitle1'}>{t('sidebar.contributors.title')}</StyledText>;\n case DeveloperType.MAINTAINERS:\n return <StyledText variant={'subtitle1'}>{t('sidebar.maintainers.title')}</StyledText>;\n }\n};\n\nexport default Title;\n\nconst StyledText = styled(Typography)<{ theme?: Theme }>(({ theme }) => ({\n fontWeight: theme.fontWeight.bold,\n marginBottom: '10px',\n}));\n"],"mappings":";;;;;;;;AAYA,IAAM,SAA0B,EAAE,WAAW;CAC3C,MAAM,EAAE,MAAM,gBAAgB;AAC9B,SAAQ,MAAR;EACE,KAAK,cAAc,aACjB,QAAO,oBAAC,YAAD;GAAY,SAAS;aAAc,EAAE,6BAA6B;GAAc,CAAA;EACzF,KAAK,cAAc,YACjB,QAAO,oBAAC,YAAD;GAAY,SAAS;aAAc,EAAE,4BAA4B;GAAc,CAAA;;;AAM5F,IAAM,aAAa,OAAO,
|
|
1
|
+
{"version":3,"file":"Title.mjs","names":[],"sources":["../../../src/components/Developers/Title.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Typography from '@mui/material/Typography';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport { DeveloperType } from './';\n\ninterface Props {\n type: DeveloperType;\n}\n\nconst Title: React.FC<Props> = ({ type }) => {\n const { t } = useTranslation();\n switch (type) {\n case DeveloperType.CONTRIBUTORS:\n return <StyledText variant={'subtitle1'}>{t('sidebar.contributors.title')}</StyledText>;\n case DeveloperType.MAINTAINERS:\n return <StyledText variant={'subtitle1'}>{t('sidebar.maintainers.title')}</StyledText>;\n }\n};\n\nexport default Title;\n\nconst StyledText = styled(Typography)<{ theme?: Theme }>(({ theme }) => ({\n fontWeight: theme.fontWeight.bold,\n marginBottom: '10px',\n}));\n"],"mappings":";;;;;;;;AAYA,IAAM,SAA0B,EAAE,WAAW;CAC3C,MAAM,EAAE,MAAM,gBAAgB;AAC9B,SAAQ,MAAR;EACE,KAAK,cAAc,aACjB,QAAO,oBAAC,YAAD;GAAY,SAAS;aAAc,EAAE,6BAA6B;GAAc,CAAA;EACzF,KAAK,cAAc,YACjB,QAAO,oBAAC,YAAD;GAAY,SAAS;aAAc,EAAE,4BAA4B;GAAc,CAAA;;;AAM5F,IAAM,aAAa,OAAO,qBAAW,EAAqB,EAAE,aAAa;CACvE,YAAY,MAAM,WAAW;CAC7B,cAAc;CACf,EAAE"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import styled from "@emotion/styled";
|
|
2
|
-
import
|
|
2
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
3
3
|
import ListItem from "@mui/material/ListItem";
|
|
4
4
|
import Chip from "@mui/material/Chip";
|
|
5
5
|
//#region src/components/Distribution/styles.ts
|
|
6
|
-
var StyledText = styled(
|
|
6
|
+
var StyledText = styled(MaterialUITypography)((props) => ({
|
|
7
7
|
fontWeight: props.theme.fontWeight.bold,
|
|
8
8
|
textTransform: "capitalize"
|
|
9
9
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.mjs","names":[],"sources":["../../../src/components/Distribution/styles.ts"],"sourcesContent":["import styled from '@emotion/styled';\nimport Chip from '@mui/material/Chip';\nimport ListItem from '@mui/material/ListItem';\nimport Typography from '@mui/material/Typography';\n\nimport type { Theme } from '../../Theme';\n\nexport const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nexport const DistListItem = styled(ListItem)({\n paddingLeft: 0,\n paddingRight: 0,\n flexWrap: 'wrap',\n});\n\nexport const DistChips = styled(Chip)({\n marginRight: 5,\n textTransform: 'capitalize',\n marginTop: 5,\n});\n"],"mappings":";;;;;AAOA,IAAa,aAAa,OAAO,
|
|
1
|
+
{"version":3,"file":"styles.mjs","names":[],"sources":["../../../src/components/Distribution/styles.ts"],"sourcesContent":["import styled from '@emotion/styled';\nimport Chip from '@mui/material/Chip';\nimport ListItem from '@mui/material/ListItem';\nimport Typography from '@mui/material/Typography';\n\nimport type { Theme } from '../../Theme';\n\nexport const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nexport const DistListItem = styled(ListItem)({\n paddingLeft: 0,\n paddingRight: 0,\n flexWrap: 'wrap',\n});\n\nexport const DistChips = styled(Chip)({\n marginRight: 5,\n textTransform: 'capitalize',\n marginTop: 5,\n});\n"],"mappings":";;;;;AAOA,IAAa,aAAa,OAAO,qBAAW,EAAqB,WAAW;CAC1E,YAAY,MAAM,MAAM,WAAW;CACnC,eAAe;CAChB,EAAE;AAEH,IAAa,eAAe,OAAO,SAAS,CAAC;CAC3C,aAAa;CACb,cAAc;CACd,UAAU;CACX,CAAC;AAEF,IAAa,YAAY,OAAO,KAAK,CAAC;CACpC,aAAa;CACb,eAAe;CACf,WAAW;CACZ,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styled from "@emotion/styled";
|
|
2
|
-
import
|
|
2
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
3
3
|
import ListItem from "@mui/material/ListItem";
|
|
4
4
|
//#region src/components/Engines/styles.ts
|
|
5
|
-
var StyledText = styled(
|
|
5
|
+
var StyledText = styled(MaterialUITypography)((props) => ({
|
|
6
6
|
fontWeight: props.theme.fontWeight.bold,
|
|
7
7
|
textTransform: "capitalize"
|
|
8
8
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.mjs","names":[],"sources":["../../../src/components/Engines/styles.ts"],"sourcesContent":["import styled from '@emotion/styled';\nimport ListItem from '@mui/material/ListItem';\nimport Typography from '@mui/material/Typography';\n\nimport type { Theme } from '../../Theme';\n\nexport const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nexport const EngineListItem = styled(ListItem)({\n padding: 0,\n});\n"],"mappings":";;;;AAMA,IAAa,aAAa,OAAO,
|
|
1
|
+
{"version":3,"file":"styles.mjs","names":[],"sources":["../../../src/components/Engines/styles.ts"],"sourcesContent":["import styled from '@emotion/styled';\nimport ListItem from '@mui/material/ListItem';\nimport Typography from '@mui/material/Typography';\n\nimport type { Theme } from '../../Theme';\n\nexport const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nexport const EngineListItem = styled(ListItem)({\n padding: 0,\n});\n"],"mappings":";;;;AAMA,IAAa,aAAa,OAAO,qBAAW,EAAqB,WAAW;CAC1E,YAAY,MAAM,MAAM,WAAW;CACnC,eAAe;CAChB,EAAE;AAEH,IAAa,iBAAiB,OAAO,SAAS,CAAC,EAC7C,SAAS,GACV,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
4
4
|
//#region src/components/Heading/Heading.tsx
|
|
5
5
|
var Heading = function Heading({ ref, variant = "h6", ...props }) {
|
|
6
|
-
return /* @__PURE__ */ jsx(
|
|
6
|
+
return /* @__PURE__ */ jsx(MaterialUITypography, {
|
|
7
7
|
...props,
|
|
8
8
|
ref,
|
|
9
9
|
variant
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.mjs","names":[],"sources":["../../../src/components/Heading/Heading.tsx"],"sourcesContent":["import type { TypographyProps } from '@mui/material/Typography';\nimport { default as MaterialUITypography } from '@mui/material/Typography';\nimport React from 'react';\n\ntype HeadingType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\ntype HeadingRef = HTMLHeadingElement;\n\ninterface Props extends Omit<TypographyProps, 'variant'> {\n variant?: HeadingType;\n}\n\nconst Heading = function Heading({\n ref,\n variant = 'h6',\n ...props\n}: Props & { ref?: React.RefObject<HeadingRef | null> }) {\n return <MaterialUITypography {...props} ref={ref} variant={variant} />;\n};\n\nexport default Heading;\n"],"mappings":";;;;AAWA,IAAM,UAAU,SAAS,QAAQ,EAC/B,KACA,UAAU,MACV,GAAG,SACoD;AACvD,QAAO,oBAAC,
|
|
1
|
+
{"version":3,"file":"Heading.mjs","names":[],"sources":["../../../src/components/Heading/Heading.tsx"],"sourcesContent":["import type { TypographyProps } from '@mui/material/Typography';\nimport { default as MaterialUITypography } from '@mui/material/Typography';\nimport React from 'react';\n\ntype HeadingType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\ntype HeadingRef = HTMLHeadingElement;\n\ninterface Props extends Omit<TypographyProps, 'variant'> {\n variant?: HeadingType;\n}\n\nconst Heading = function Heading({\n ref,\n variant = 'h6',\n ...props\n}: Props & { ref?: React.RefObject<HeadingRef | null> }) {\n return <MaterialUITypography {...props} ref={ref} variant={variant} />;\n};\n\nexport default Heading;\n"],"mappings":";;;;AAWA,IAAM,UAAU,SAAS,QAAQ,EAC/B,KACA,UAAU,MACV,GAAG,SACoD;AACvD,QAAO,oBAAC,sBAAD;EAAsB,GAAI;EAAY;EAAc;EAAW,CAAA"}
|
|
@@ -6,13 +6,13 @@ import "../../index.mjs";
|
|
|
6
6
|
import { Fragment } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { useTranslation } from "react-i18next";
|
|
9
|
-
import
|
|
9
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
10
10
|
import CardContent from "@mui/material/CardContent";
|
|
11
11
|
import Button from "@mui/material/Button";
|
|
12
12
|
import CardActions from "@mui/material/CardActions";
|
|
13
13
|
//#region src/components/Help/Help.tsx
|
|
14
14
|
function renderHeadingClipboardSegments(title, text) {
|
|
15
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(
|
|
15
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MaterialUITypography, {
|
|
16
16
|
variant: "body1",
|
|
17
17
|
children: title
|
|
18
18
|
}), /* @__PURE__ */ jsx(CopyToClipBoard, {
|
|
@@ -42,7 +42,7 @@ var Help = () => {
|
|
|
42
42
|
}),
|
|
43
43
|
renderHeadingClipboardSegments(t("help.first-step"), t("help.first-step-command-line", { registryUrl })),
|
|
44
44
|
renderHeadingClipboardSegments(t("help.second-step"), t("help.second-step-command-line", { registryUrl })),
|
|
45
|
-
/* @__PURE__ */ jsx(
|
|
45
|
+
/* @__PURE__ */ jsx(MaterialUITypography, {
|
|
46
46
|
variant: "body1",
|
|
47
47
|
children: t("help.third-step")
|
|
48
48
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Help.mjs","names":[],"sources":["../../../src/components/Help/Help.tsx"],"sourcesContent":["import Button from '@mui/material/Button';\nimport CardActions from '@mui/material/CardActions';\nimport CardContent from '@mui/material/CardContent';\nimport Typography from '@mui/material/Typography';\nimport React, { Fragment } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport { CopyClipboard, Heading, useConfig } from '../../';\nimport { CardStyled as Card } from './styles';\n\nfunction renderHeadingClipboardSegments(title: string, text: string): React.ReactNode {\n return (\n <Fragment>\n <Typography variant={'body1'}>{title}</Typography>\n <CopyClipboard dataTestId=\"segments\" text={text} />\n </Fragment>\n );\n}\n\nconst Help: React.FC = () => {\n const { configOptions } = useConfig();\n const registryUrl = configOptions.base;\n const { t } = useTranslation();\n\n return (\n <Card data-testid=\"help-card\" id=\"help-card\">\n <CardContent>\n <Heading gutterBottom={true} id=\"help-card__title\" variant=\"h5\">\n {t('help.title')}\n </Heading>\n <Heading color=\"textSecondary\" gutterBottom={true} sx={{ marginBottom: 1 }}>\n {t('help.sub-title')}\n </Heading>\n {renderHeadingClipboardSegments(\n t('help.first-step'),\n t('help.first-step-command-line', { registryUrl })\n )}\n {renderHeadingClipboardSegments(\n t('help.second-step'),\n t('help.second-step-command-line', { registryUrl })\n )}\n <Typography variant=\"body1\">{t('help.third-step')}</Typography>\n </CardContent>\n <CardActions>\n <Button color=\"primary\" href=\"https://verdaccio.org/docs/cli-registry\" size=\"small\">\n {t('button.learn-more')}\n </Button>\n </CardActions>\n </Card>\n );\n};\n\nexport default Help;\n"],"mappings":";;;;;;;;;;;;;AAUA,SAAS,+BAA+B,OAAe,MAA+B;AACpF,QACE,qBAAC,UAAD,EAAA,UAAA,CACE,oBAAC,
|
|
1
|
+
{"version":3,"file":"Help.mjs","names":[],"sources":["../../../src/components/Help/Help.tsx"],"sourcesContent":["import Button from '@mui/material/Button';\nimport CardActions from '@mui/material/CardActions';\nimport CardContent from '@mui/material/CardContent';\nimport Typography from '@mui/material/Typography';\nimport React, { Fragment } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport { CopyClipboard, Heading, useConfig } from '../../';\nimport { CardStyled as Card } from './styles';\n\nfunction renderHeadingClipboardSegments(title: string, text: string): React.ReactNode {\n return (\n <Fragment>\n <Typography variant={'body1'}>{title}</Typography>\n <CopyClipboard dataTestId=\"segments\" text={text} />\n </Fragment>\n );\n}\n\nconst Help: React.FC = () => {\n const { configOptions } = useConfig();\n const registryUrl = configOptions.base;\n const { t } = useTranslation();\n\n return (\n <Card data-testid=\"help-card\" id=\"help-card\">\n <CardContent>\n <Heading gutterBottom={true} id=\"help-card__title\" variant=\"h5\">\n {t('help.title')}\n </Heading>\n <Heading color=\"textSecondary\" gutterBottom={true} sx={{ marginBottom: 1 }}>\n {t('help.sub-title')}\n </Heading>\n {renderHeadingClipboardSegments(\n t('help.first-step'),\n t('help.first-step-command-line', { registryUrl })\n )}\n {renderHeadingClipboardSegments(\n t('help.second-step'),\n t('help.second-step-command-line', { registryUrl })\n )}\n <Typography variant=\"body1\">{t('help.third-step')}</Typography>\n </CardContent>\n <CardActions>\n <Button color=\"primary\" href=\"https://verdaccio.org/docs/cli-registry\" size=\"small\">\n {t('button.learn-more')}\n </Button>\n </CardActions>\n </Card>\n );\n};\n\nexport default Help;\n"],"mappings":";;;;;;;;;;;;;AAUA,SAAS,+BAA+B,OAAe,MAA+B;AACpF,QACE,qBAAC,UAAD,EAAA,UAAA,CACE,oBAAC,sBAAD;EAAY,SAAS;YAAU;EAAmB,CAAA,EAClD,oBAAC,iBAAD;EAAe,YAAW;EAAiB;EAAQ,CAAA,CAC1C,EAAA,CAAA;;AAIf,IAAM,aAAuB;CAC3B,MAAM,EAAE,kBAAkB,WAAW;CACrC,MAAM,cAAc,cAAc;CAClC,MAAM,EAAE,MAAM,gBAAgB;AAE9B,QACE,qBAAC,YAAD;EAAM,eAAY;EAAY,IAAG;YAAjC,CACE,qBAAC,aAAD,EAAA,UAAA;GACE,oBAAC,SAAD;IAAS,cAAc;IAAM,IAAG;IAAmB,SAAQ;cACxD,EAAE,aAAa;IACR,CAAA;GACV,oBAAC,SAAD;IAAS,OAAM;IAAgB,cAAc;IAAM,IAAI,EAAE,cAAc,GAAG;cACvE,EAAE,iBAAiB;IACZ,CAAA;GACT,+BACC,EAAE,kBAAkB,EACpB,EAAE,gCAAgC,EAAE,aAAa,CAAC,CACnD;GACA,+BACC,EAAE,mBAAmB,EACrB,EAAE,iCAAiC,EAAE,aAAa,CAAC,CACpD;GACD,oBAAC,sBAAD;IAAY,SAAQ;cAAS,EAAE,kBAAkB;IAAc,CAAA;GACnD,EAAA,CAAA,EACd,oBAAC,aAAD,EAAA,UACE,oBAAC,QAAD;GAAQ,OAAM;GAAU,MAAK;GAA0C,MAAK;aACzE,EAAE,oBAAoB;GAChB,CAAA,EACG,CAAA,CACT"}
|
|
@@ -4,7 +4,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
4
4
|
import { useTheme } from "@mui/material/styles";
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
|
6
6
|
import List from "@mui/material/List";
|
|
7
|
-
import
|
|
7
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
8
8
|
//#region src/components/Keywords/Keywords.tsx
|
|
9
9
|
var Keywords = ({ packageMeta }) => {
|
|
10
10
|
const { t } = useTranslation();
|
|
@@ -12,7 +12,7 @@ var Keywords = ({ packageMeta }) => {
|
|
|
12
12
|
if (!packageMeta?.latest?.keywords) return null;
|
|
13
13
|
return /* @__PURE__ */ jsx(List, {
|
|
14
14
|
"data-testid": "keyword-list",
|
|
15
|
-
subheader: /* @__PURE__ */ jsx(
|
|
15
|
+
subheader: /* @__PURE__ */ jsx(MaterialUITypography, {
|
|
16
16
|
sx: {
|
|
17
17
|
fontWeight: theme.fontWeight.bold,
|
|
18
18
|
textTransform: "capitalize"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Keywords.mjs","names":[],"sources":["../../../src/components/Keywords/Keywords.tsx"],"sourcesContent":["import List from '@mui/material/List';\nimport Typography from '@mui/material/Typography';\nimport { useTheme } from '@mui/material/styles';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport type { PackageMetaInterface } from '../../types/packageMeta';\nimport KeywordListItems from './KeywordListItems';\n\nconst Keywords: React.FC<{ packageMeta: PackageMetaInterface }> = ({ packageMeta }) => {\n const { t } = useTranslation();\n const theme: Theme = useTheme();\n\n if (!packageMeta?.latest?.keywords) {\n return null;\n }\n\n return (\n <List\n data-testid=\"keyword-list\"\n subheader={\n <Typography\n sx={{ fontWeight: theme.fontWeight.bold, textTransform: 'capitalize' }}\n variant=\"subtitle1\"\n >\n {t('sidebar.keywords.title')}\n </Typography>\n }\n >\n <KeywordListItems keywords={packageMeta?.latest?.keywords} />\n </List>\n );\n};\n\nexport default Keywords;\n"],"mappings":";;;;;;;;AAUA,IAAM,YAA6D,EAAE,kBAAkB;CACrF,MAAM,EAAE,MAAM,gBAAgB;CAC9B,MAAM,QAAe,UAAU;AAE/B,KAAI,CAAC,aAAa,QAAQ,SACxB,QAAO;AAGT,QACE,oBAAC,MAAD;EACE,eAAY;EACZ,WACE,oBAAC,
|
|
1
|
+
{"version":3,"file":"Keywords.mjs","names":[],"sources":["../../../src/components/Keywords/Keywords.tsx"],"sourcesContent":["import List from '@mui/material/List';\nimport Typography from '@mui/material/Typography';\nimport { useTheme } from '@mui/material/styles';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport type { PackageMetaInterface } from '../../types/packageMeta';\nimport KeywordListItems from './KeywordListItems';\n\nconst Keywords: React.FC<{ packageMeta: PackageMetaInterface }> = ({ packageMeta }) => {\n const { t } = useTranslation();\n const theme: Theme = useTheme();\n\n if (!packageMeta?.latest?.keywords) {\n return null;\n }\n\n return (\n <List\n data-testid=\"keyword-list\"\n subheader={\n <Typography\n sx={{ fontWeight: theme.fontWeight.bold, textTransform: 'capitalize' }}\n variant=\"subtitle1\"\n >\n {t('sidebar.keywords.title')}\n </Typography>\n }\n >\n <KeywordListItems keywords={packageMeta?.latest?.keywords} />\n </List>\n );\n};\n\nexport default Keywords;\n"],"mappings":";;;;;;;;AAUA,IAAM,YAA6D,EAAE,kBAAkB;CACrF,MAAM,EAAE,MAAM,gBAAgB;CAC9B,MAAM,QAAe,UAAU;AAE/B,KAAI,CAAC,aAAa,QAAQ,SACxB,QAAO;AAGT,QACE,oBAAC,MAAD;EACE,eAAY;EACZ,WACE,oBAAC,sBAAD;GACE,IAAI;IAAE,YAAY,MAAM,WAAW;IAAM,eAAe;IAAc;GACtE,SAAQ;aAEP,EAAE,yBAAyB;GACjB,CAAA;YAGf,oBAAC,kBAAD,EAAkB,UAAU,aAAa,QAAQ,UAAY,CAAA;EACxD,CAAA"}
|
|
@@ -2,7 +2,7 @@ import styled from "@emotion/styled";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { Link } from "react-router";
|
|
5
|
-
import
|
|
5
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
6
6
|
//#region src/components/Link/Link.tsx
|
|
7
7
|
var CustomRouterLink = styled(Link)`
|
|
8
8
|
text-decoration: none;
|
|
@@ -17,7 +17,7 @@ var Link$1 = function LinkFunction({ ref, to, children, variant, className, onCl
|
|
|
17
17
|
onClick,
|
|
18
18
|
ref,
|
|
19
19
|
to,
|
|
20
|
-
children: /* @__PURE__ */ jsx(
|
|
20
|
+
children: /* @__PURE__ */ jsx(MaterialUITypography, {
|
|
21
21
|
color: "primary",
|
|
22
22
|
variant,
|
|
23
23
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.mjs","names":[],"sources":["../../../src/components/Link/Link.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Typography from '@mui/material/Typography';\nimport React from 'react';\nimport { Link as RouterLink } from 'react-router';\n\nconst CustomRouterLink = styled(RouterLink)`\n text-decoration: none;\n &:hover,\n &:focus {\n text-decoration: underline;\n }\n`;\n\nconst Link = function LinkFunction({\n ref,\n to,\n children,\n variant,\n className,\n onClick,\n}: any & { ref?: React.RefObject<HTMLAnchorElement | null> }) {\n return (\n <CustomRouterLink className={className} onClick={onClick} ref={ref} to={to}>\n <Typography color=\"primary\" variant={variant}>\n {children}\n </Typography>\n </CustomRouterLink>\n );\n};\n\nexport default Link;\n"],"mappings":";;;;;;AAKA,IAAM,mBAAmB,OAAO,KAAW;;;;;;;AAQ3C,IAAM,SAAO,SAAS,aAAa,EACjC,KACA,IACA,UACA,SACA,WACA,WAC4D;AAC5D,QACE,oBAAC,kBAAD;EAA6B;EAAoB;EAAc;EAAS;YACtE,oBAAC,
|
|
1
|
+
{"version":3,"file":"Link.mjs","names":[],"sources":["../../../src/components/Link/Link.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Typography from '@mui/material/Typography';\nimport React from 'react';\nimport { Link as RouterLink } from 'react-router';\n\nconst CustomRouterLink = styled(RouterLink)`\n text-decoration: none;\n &:hover,\n &:focus {\n text-decoration: underline;\n }\n`;\n\nconst Link = function LinkFunction({\n ref,\n to,\n children,\n variant,\n className,\n onClick,\n}: any & { ref?: React.RefObject<HTMLAnchorElement | null> }) {\n return (\n <CustomRouterLink className={className} onClick={onClick} ref={ref} to={to}>\n <Typography color=\"primary\" variant={variant}>\n {children}\n </Typography>\n </CustomRouterLink>\n );\n};\n\nexport default Link;\n"],"mappings":";;;;;;AAKA,IAAM,mBAAmB,OAAO,KAAW;;;;;;;AAQ3C,IAAM,SAAO,SAAS,aAAa,EACjC,KACA,IACA,UACA,SACA,WACA,WAC4D;AAC5D,QACE,oBAAC,kBAAD;EAA6B;EAAoB;EAAc;EAAS;YACtE,oBAAC,sBAAD;GAAY,OAAM;GAAmB;GAClC;GACU,CAAA;EACI,CAAA"}
|
|
@@ -9,7 +9,7 @@ import "react";
|
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { useTranslation } from "react-i18next";
|
|
11
11
|
import Link from "@mui/material/Link";
|
|
12
|
-
import
|
|
12
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
13
13
|
import Button from "@mui/material/Button";
|
|
14
14
|
//#region src/components/LoginForm/Login.tsx
|
|
15
15
|
var StyledForm = styled("form")(({ theme }) => ({ marginTop: theme.spacing(1) }));
|
|
@@ -41,7 +41,7 @@ var LoginForm = ({ register, handleSubmit, onSubmit, errors, isValid }) => {
|
|
|
41
41
|
variant: "contained",
|
|
42
42
|
children: t("button.login")
|
|
43
43
|
}),
|
|
44
|
-
changePasswordEnabled && /* @__PURE__ */ jsx(
|
|
44
|
+
changePasswordEnabled && /* @__PURE__ */ jsx(MaterialUITypography, {
|
|
45
45
|
align: "center",
|
|
46
46
|
sx: {
|
|
47
47
|
mt: 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Login.mjs","names":[],"sources":["../../../src/components/LoginForm/Login.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Button from '@mui/material/Button';\nimport Link from '@mui/material/Link';\nimport Typography from '@mui/material/Typography';\nimport type { FC } from 'react';\nimport React from 'react';\nimport type { FieldErrors, UseFormHandleSubmit, UseFormRegister } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../';\nimport { getConfiguration } from '../../configuration';\nimport { Route } from '../../utils';\nimport LoginDialogFormError from '../LoginDialog/LoginDialogFormError';\nimport PasswordField from './PasswordField';\nimport UsernameField from './UsernameField';\n\nconst StyledForm = styled('form')<{ theme?: Theme }>(({ theme }) => ({\n marginTop: theme.spacing(1),\n}));\n\nconst StyledButton = styled(Button)<{ theme?: Theme }>(({ theme }) => ({\n margin: theme.spacing(3, 0, 2),\n}));\n\nexport interface LoginFormValues {\n username: string;\n password: string;\n}\n\ninterface Props {\n register: UseFormRegister<LoginFormValues>;\n handleSubmit: UseFormHandleSubmit<LoginFormValues>;\n onSubmit: (data: LoginFormValues) => void;\n errors: FieldErrors<LoginFormValues>;\n isValid: boolean;\n}\n\nconst LoginForm: FC<Props> = ({ register, handleSubmit, onSubmit, errors, isValid }) => {\n const { t } = useTranslation();\n const configuration = getConfiguration();\n const changePasswordEnabled = configuration?.flags?.changePassword;\n\n return (\n <StyledForm noValidate={true} onSubmit={handleSubmit(onSubmit)}>\n <UsernameField errors={errors} register={register} />\n <PasswordField errors={errors} register={register} />\n\n {errors.root && <LoginDialogFormError error={errors.root} />}\n\n <StyledButton\n color=\"primary\"\n data-testid=\"login-dialog-form-login-button\"\n disabled={!isValid}\n fullWidth={true}\n id=\"login--dialog-button-submit\"\n size=\"large\"\n type=\"submit\"\n variant=\"contained\"\n >\n {t('button.login')}\n </StyledButton>\n {changePasswordEnabled && (\n <Typography align=\"center\" sx={{ mt: 2, fontSize: 12 }} variant=\"body2\">\n <Link href={Route.CHANGE_PASSWORD} sx={{ ml: 1 }}>\n {t('security.changePassword.title')}\n </Link>\n </Typography>\n )}\n </StyledForm>\n );\n};\n\nexport default LoginForm;\n"],"mappings":";;;;;;;;;;;;;;AAgBA,IAAM,aAAa,OAAO,OAAO,EAAqB,EAAE,aAAa,EACnE,WAAW,MAAM,QAAQ,EAAE,EAC5B,EAAE;AAEH,IAAM,eAAe,OAAO,OAAO,EAAqB,EAAE,aAAa,EACrE,QAAQ,MAAM,QAAQ,GAAG,GAAG,EAAE,EAC/B,EAAE;AAeH,IAAM,aAAwB,EAAE,UAAU,cAAc,UAAU,QAAQ,cAAc;CACtF,MAAM,EAAE,MAAM,gBAAgB;CAE9B,MAAM,wBADgB,kBAAkB,EACK,OAAO;AAEpD,QACE,qBAAC,YAAD;EAAY,YAAY;EAAM,UAAU,aAAa,SAAS;YAA9D;GACE,oBAAC,eAAD;IAAuB;IAAkB;IAAY,CAAA;GACrD,oBAAC,eAAD;IAAuB;IAAkB;IAAY,CAAA;GAEpD,OAAO,QAAQ,oBAAC,sBAAD,EAAsB,OAAO,OAAO,MAAQ,CAAA;GAE5D,oBAAC,cAAD;IACE,OAAM;IACN,eAAY;IACZ,UAAU,CAAC;IACX,WAAW;IACX,IAAG;IACH,MAAK;IACL,MAAK;IACL,SAAQ;cAEP,EAAE,eAAe;IACL,CAAA;GACd,yBACC,oBAAC,
|
|
1
|
+
{"version":3,"file":"Login.mjs","names":[],"sources":["../../../src/components/LoginForm/Login.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Button from '@mui/material/Button';\nimport Link from '@mui/material/Link';\nimport Typography from '@mui/material/Typography';\nimport type { FC } from 'react';\nimport React from 'react';\nimport type { FieldErrors, UseFormHandleSubmit, UseFormRegister } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../';\nimport { getConfiguration } from '../../configuration';\nimport { Route } from '../../utils';\nimport LoginDialogFormError from '../LoginDialog/LoginDialogFormError';\nimport PasswordField from './PasswordField';\nimport UsernameField from './UsernameField';\n\nconst StyledForm = styled('form')<{ theme?: Theme }>(({ theme }) => ({\n marginTop: theme.spacing(1),\n}));\n\nconst StyledButton = styled(Button)<{ theme?: Theme }>(({ theme }) => ({\n margin: theme.spacing(3, 0, 2),\n}));\n\nexport interface LoginFormValues {\n username: string;\n password: string;\n}\n\ninterface Props {\n register: UseFormRegister<LoginFormValues>;\n handleSubmit: UseFormHandleSubmit<LoginFormValues>;\n onSubmit: (data: LoginFormValues) => void;\n errors: FieldErrors<LoginFormValues>;\n isValid: boolean;\n}\n\nconst LoginForm: FC<Props> = ({ register, handleSubmit, onSubmit, errors, isValid }) => {\n const { t } = useTranslation();\n const configuration = getConfiguration();\n const changePasswordEnabled = configuration?.flags?.changePassword;\n\n return (\n <StyledForm noValidate={true} onSubmit={handleSubmit(onSubmit)}>\n <UsernameField errors={errors} register={register} />\n <PasswordField errors={errors} register={register} />\n\n {errors.root && <LoginDialogFormError error={errors.root} />}\n\n <StyledButton\n color=\"primary\"\n data-testid=\"login-dialog-form-login-button\"\n disabled={!isValid}\n fullWidth={true}\n id=\"login--dialog-button-submit\"\n size=\"large\"\n type=\"submit\"\n variant=\"contained\"\n >\n {t('button.login')}\n </StyledButton>\n {changePasswordEnabled && (\n <Typography align=\"center\" sx={{ mt: 2, fontSize: 12 }} variant=\"body2\">\n <Link href={Route.CHANGE_PASSWORD} sx={{ ml: 1 }}>\n {t('security.changePassword.title')}\n </Link>\n </Typography>\n )}\n </StyledForm>\n );\n};\n\nexport default LoginForm;\n"],"mappings":";;;;;;;;;;;;;;AAgBA,IAAM,aAAa,OAAO,OAAO,EAAqB,EAAE,aAAa,EACnE,WAAW,MAAM,QAAQ,EAAE,EAC5B,EAAE;AAEH,IAAM,eAAe,OAAO,OAAO,EAAqB,EAAE,aAAa,EACrE,QAAQ,MAAM,QAAQ,GAAG,GAAG,EAAE,EAC/B,EAAE;AAeH,IAAM,aAAwB,EAAE,UAAU,cAAc,UAAU,QAAQ,cAAc;CACtF,MAAM,EAAE,MAAM,gBAAgB;CAE9B,MAAM,wBADgB,kBAAkB,EACK,OAAO;AAEpD,QACE,qBAAC,YAAD;EAAY,YAAY;EAAM,UAAU,aAAa,SAAS;YAA9D;GACE,oBAAC,eAAD;IAAuB;IAAkB;IAAY,CAAA;GACrD,oBAAC,eAAD;IAAuB;IAAkB;IAAY,CAAA;GAEpD,OAAO,QAAQ,oBAAC,sBAAD,EAAsB,OAAO,OAAO,MAAQ,CAAA;GAE5D,oBAAC,cAAD;IACE,OAAM;IACN,eAAY;IACZ,UAAU,CAAC;IACX,WAAW;IACX,IAAG;IACH,MAAK;IACL,MAAK;IACL,SAAQ;cAEP,EAAE,eAAe;IACL,CAAA;GACd,yBACC,oBAAC,sBAAD;IAAY,OAAM;IAAS,IAAI;KAAE,IAAI;KAAG,UAAU;KAAI;IAAE,SAAQ;cAC9D,oBAAC,MAAD;KAAM,MAAM,MAAM;KAAiB,IAAI,EAAE,IAAI,GAAG;eAC7C,EAAE,gCAAgC;KAC9B,CAAA;IACI,CAAA;GAEJ"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
4
4
|
import Alert from "@mui/material/Alert";
|
|
5
5
|
//#region src/components/NoItems/NoItems.tsx
|
|
6
6
|
var NoItems = ({ text, ...props }) => /* @__PURE__ */ jsx(Alert, {
|
|
7
7
|
severity: "info",
|
|
8
|
-
children: /* @__PURE__ */ jsx(
|
|
8
|
+
children: /* @__PURE__ */ jsx(MaterialUITypography, {
|
|
9
9
|
...props,
|
|
10
10
|
children: text
|
|
11
11
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoItems.mjs","names":[],"sources":["../../../src/components/NoItems/NoItems.tsx"],"sourcesContent":["import Alert from '@mui/material/Alert';\nimport Typography from '@mui/material/Typography';\nimport React from 'react';\n\ninterface Props {\n text: string;\n}\n\nconst NoItems: React.FC<Props> = ({ text, ...props }) => (\n // @ts-ignore - Alert does accept children despite the type error\n <Alert severity=\"info\">\n <Typography {...props}>{text}</Typography>\n </Alert>\n);\n\nexport default NoItems;\n"],"mappings":";;;;;AAQA,IAAM,WAA4B,EAAE,MAAM,GAAG,YAE3C,oBAAC,OAAD;CAAO,UAAS;WACd,oBAAC,
|
|
1
|
+
{"version":3,"file":"NoItems.mjs","names":[],"sources":["../../../src/components/NoItems/NoItems.tsx"],"sourcesContent":["import Alert from '@mui/material/Alert';\nimport Typography from '@mui/material/Typography';\nimport React from 'react';\n\ninterface Props {\n text: string;\n}\n\nconst NoItems: React.FC<Props> = ({ text, ...props }) => (\n // @ts-ignore - Alert does accept children despite the type error\n <Alert severity=\"info\">\n <Typography {...props}>{text}</Typography>\n </Alert>\n);\n\nexport default NoItems;\n"],"mappings":";;;;;AAQA,IAAM,WAA4B,EAAE,MAAM,GAAG,YAE3C,oBAAC,OAAD;CAAO,UAAS;WACd,oBAAC,sBAAD;EAAY,GAAI;YAAQ;EAAkB,CAAA;CACpC,CAAA"}
|
|
@@ -4,9 +4,9 @@ import LinkExternal from "../LinkExternal/LinkExternal.mjs";
|
|
|
4
4
|
import "../LinkExternal/index.mjs";
|
|
5
5
|
import "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import
|
|
7
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
8
8
|
//#region src/components/Person/PersonTooltip.tsx
|
|
9
|
-
var PersonTooltip = ({ person }) => /* @__PURE__ */ jsxs(
|
|
9
|
+
var PersonTooltip = ({ person }) => /* @__PURE__ */ jsxs(MaterialUITypography, {
|
|
10
10
|
"data-testid": person.name + "-tooltip",
|
|
11
11
|
children: [
|
|
12
12
|
person.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonTooltip.mjs","names":[],"sources":["../../../src/components/Person/PersonTooltip.tsx"],"sourcesContent":["import Typography from '@mui/material/Typography';\nimport React from 'react';\n\nimport type { Developer } from '../../types/packageMeta';\nimport { url } from '../../utils';\nimport LinkExternal from '../LinkExternal';\n\nconst PersonTooltip: React.FC<{ person: Developer }> = ({ person }) => (\n <Typography data-testid={person.name + '-tooltip'}>\n {person.name}\n {person.email && url.isEmail(person.email) && (\n <LinkExternal to={`mailto:${person.email}`}>\n <br />\n {person.email}\n </LinkExternal>\n )}\n {person.url && url.isURL(person.url) && (\n <LinkExternal to={person.url}>\n <br />\n {person.url}\n </LinkExternal>\n )}\n </Typography>\n);\n\nexport default PersonTooltip;\n"],"mappings":";;;;;;;;AAOA,IAAM,iBAAkD,EAAE,aACxD,qBAAC,
|
|
1
|
+
{"version":3,"file":"PersonTooltip.mjs","names":[],"sources":["../../../src/components/Person/PersonTooltip.tsx"],"sourcesContent":["import Typography from '@mui/material/Typography';\nimport React from 'react';\n\nimport type { Developer } from '../../types/packageMeta';\nimport { url } from '../../utils';\nimport LinkExternal from '../LinkExternal';\n\nconst PersonTooltip: React.FC<{ person: Developer }> = ({ person }) => (\n <Typography data-testid={person.name + '-tooltip'}>\n {person.name}\n {person.email && url.isEmail(person.email) && (\n <LinkExternal to={`mailto:${person.email}`}>\n <br />\n {person.email}\n </LinkExternal>\n )}\n {person.url && url.isURL(person.url) && (\n <LinkExternal to={person.url}>\n <br />\n {person.url}\n </LinkExternal>\n )}\n </Typography>\n);\n\nexport default PersonTooltip;\n"],"mappings":";;;;;;;;AAOA,IAAM,iBAAkD,EAAE,aACxD,qBAAC,sBAAD;CAAY,eAAa,OAAO,OAAO;WAAvC;EACG,OAAO;EACP,OAAO,SAAS,QAAY,OAAO,MAAM,IACxC,qBAAC,cAAD;GAAc,IAAI,UAAU,OAAO;aAAnC,CACE,oBAAC,MAAD,EAAM,CAAA,EACL,OAAO,MACK;;EAEhB,OAAO,OAAO,MAAU,OAAO,IAAI,IAClC,qBAAC,cAAD;GAAc,IAAI,OAAO;aAAzB,CACE,oBAAC,MAAD,EAAM,CAAA,EACL,OAAO,IACK;;EAEN"}
|
|
@@ -13,11 +13,11 @@ import { useTranslation } from "react-i18next";
|
|
|
13
13
|
import { common } from "@mui/material/colors";
|
|
14
14
|
import List from "@mui/material/List";
|
|
15
15
|
import Avatar from "@mui/material/Avatar";
|
|
16
|
-
import
|
|
16
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
17
17
|
import ListItem from "@mui/material/ListItem";
|
|
18
18
|
import ListItemText from "@mui/material/ListItemText";
|
|
19
19
|
//#region src/components/Repository/Repository.tsx
|
|
20
|
-
var StyledText = styled(
|
|
20
|
+
var StyledText = styled(MaterialUITypography)((props) => ({
|
|
21
21
|
fontWeight: props.theme.fontWeight.bold,
|
|
22
22
|
textTransform: "capitalize"
|
|
23
23
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Repository.mjs","names":[],"sources":["../../../src/components/Repository/Repository.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Avatar from '@mui/material/Avatar';\nimport List from '@mui/material/List';\nimport ListItem from '@mui/material/ListItem';\nimport ListItemText from '@mui/material/ListItemText';\nimport Typography from '@mui/material/Typography';\nimport { common } from '@mui/material/colors';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport { url as urlUtils } from '../../utils';\nimport CopyClipboard from '../CopyClipboard';\nimport { Git } from '../Icons';\nimport LinkExternal from '../LinkExternal';\n\nconst StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nconst RepositoryListItem = styled(ListItem)({\n padding: 0,\n ':hover': {\n backgroundColor: 'transparent',\n },\n});\n\nconst RepositoryListItemText = styled(ListItemText)({\n padding: '0 0 0 10px',\n margin: 0,\n});\n\nconst RepositoryAvatar = styled(Avatar)({\n padding: 0,\n marginLeft: 0,\n backgroundColor: 'transparent',\n});\n\nconst Repository: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {\n const { t } = useTranslation();\n const url = packageMeta?.latest?.repository?.url;\n if (!url || !urlUtils.isURL(url)) {\n return null;\n }\n\n const getCorrectRepositoryURL = (): string => {\n if (!url.includes('git+')) {\n return url;\n }\n\n return url.split('git+')[1];\n };\n\n const repositoryURL = getCorrectRepositoryURL();\n\n return (\n <List\n dense={true}\n subheader={<StyledText variant=\"subtitle1\">{t('sidebar.repository.title')}</StyledText>}\n >\n <RepositoryListItem>\n <RepositoryAvatar sx={{ bgcolor: common.white }}>\n <Git />\n </RepositoryAvatar>\n <RepositoryListItemText\n primary={\n <CopyClipboard dataTestId=\"repositoryID\" text={repositoryURL} title={repositoryURL}>\n <LinkExternal to={repositoryURL} variant=\"outline\">\n {repositoryURL}\n </LinkExternal>\n </CopyClipboard>\n }\n />\n </RepositoryListItem>\n </List>\n );\n};\n\nexport default Repository;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBA,IAAM,aAAa,OAAO,
|
|
1
|
+
{"version":3,"file":"Repository.mjs","names":[],"sources":["../../../src/components/Repository/Repository.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Avatar from '@mui/material/Avatar';\nimport List from '@mui/material/List';\nimport ListItem from '@mui/material/ListItem';\nimport ListItemText from '@mui/material/ListItemText';\nimport Typography from '@mui/material/Typography';\nimport { common } from '@mui/material/colors';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport { url as urlUtils } from '../../utils';\nimport CopyClipboard from '../CopyClipboard';\nimport { Git } from '../Icons';\nimport LinkExternal from '../LinkExternal';\n\nconst StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nconst RepositoryListItem = styled(ListItem)({\n padding: 0,\n ':hover': {\n backgroundColor: 'transparent',\n },\n});\n\nconst RepositoryListItemText = styled(ListItemText)({\n padding: '0 0 0 10px',\n margin: 0,\n});\n\nconst RepositoryAvatar = styled(Avatar)({\n padding: 0,\n marginLeft: 0,\n backgroundColor: 'transparent',\n});\n\nconst Repository: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {\n const { t } = useTranslation();\n const url = packageMeta?.latest?.repository?.url;\n if (!url || !urlUtils.isURL(url)) {\n return null;\n }\n\n const getCorrectRepositoryURL = (): string => {\n if (!url.includes('git+')) {\n return url;\n }\n\n return url.split('git+')[1];\n };\n\n const repositoryURL = getCorrectRepositoryURL();\n\n return (\n <List\n dense={true}\n subheader={<StyledText variant=\"subtitle1\">{t('sidebar.repository.title')}</StyledText>}\n >\n <RepositoryListItem>\n <RepositoryAvatar sx={{ bgcolor: common.white }}>\n <Git />\n </RepositoryAvatar>\n <RepositoryListItemText\n primary={\n <CopyClipboard dataTestId=\"repositoryID\" text={repositoryURL} title={repositoryURL}>\n <LinkExternal to={repositoryURL} variant=\"outline\">\n {repositoryURL}\n </LinkExternal>\n </CopyClipboard>\n }\n />\n </RepositoryListItem>\n </List>\n );\n};\n\nexport default Repository;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBA,IAAM,aAAa,OAAO,qBAAW,EAAqB,WAAW;CACnE,YAAY,MAAM,MAAM,WAAW;CACnC,eAAe;CAChB,EAAE;AAEH,IAAM,qBAAqB,OAAO,SAAS,CAAC;CAC1C,SAAS;CACT,UAAU,EACR,iBAAiB,eAClB;CACF,CAAC;AAEF,IAAM,yBAAyB,OAAO,aAAa,CAAC;CAClD,SAAS;CACT,QAAQ;CACT,CAAC;AAEF,IAAM,mBAAmB,OAAO,OAAO,CAAC;CACtC,SAAS;CACT,YAAY;CACZ,iBAAiB;CAClB,CAAC;AAEF,IAAM,cAA8C,EAAE,kBAAkB;CACtE,MAAM,EAAE,MAAM,gBAAgB;CAC9B,MAAM,MAAM,aAAa,QAAQ,YAAY;AAC7C,KAAI,CAAC,OAAO,CAAC,MAAe,IAAI,CAC9B,QAAO;CAGT,MAAM,gCAAwC;AAC5C,MAAI,CAAC,IAAI,SAAS,OAAO,CACvB,QAAO;AAGT,SAAO,IAAI,MAAM,OAAO,CAAC;;CAG3B,MAAM,gBAAgB,yBAAyB;AAE/C,QACE,oBAAC,MAAD;EACE,OAAO;EACP,WAAW,oBAAC,YAAD;GAAY,SAAQ;aAAa,EAAE,2BAA2B;GAAc,CAAA;YAEvF,qBAAC,oBAAD,EAAA,UAAA,CACE,oBAAC,kBAAD;GAAkB,IAAI,EAAE,SAAS,OAAO,OAAO;aAC7C,oBAAC,KAAD,EAAO,CAAA;GACU,CAAA,EACnB,oBAAC,wBAAD,EACE,SACE,oBAAC,iBAAD;GAAe,YAAW;GAAe,MAAM;GAAe,OAAO;aACnE,oBAAC,cAAD;IAAc,IAAI;IAAe,SAAQ;cACtC;IACY,CAAA;GACD,CAAA,EAElB,CAAA,CACiB,EAAA,CAAA;EAChB,CAAA"}
|
|
@@ -11,10 +11,9 @@ require("../../index.js");
|
|
|
11
11
|
let react = require("react");
|
|
12
12
|
react = require_runtime.__toESM(react);
|
|
13
13
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
|
+
let lodash_es = require("lodash-es");
|
|
14
15
|
let react_i18next = require("react-i18next");
|
|
15
16
|
let react_router = require("react-router");
|
|
16
|
-
let lodash_debounce = require("lodash/debounce");
|
|
17
|
-
lodash_debounce = require_runtime.__toESM(lodash_debounce);
|
|
18
17
|
let _mui_icons_material_Search = require("@mui/icons-material/Search");
|
|
19
18
|
_mui_icons_material_Search = require_runtime.__toESM(_mui_icons_material_Search);
|
|
20
19
|
//#region src/components/Search/Search.tsx
|
|
@@ -68,7 +67,7 @@ var Search = () => {
|
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
}, [cancelAllSearchRequests]);
|
|
71
|
-
const debouncedFetch = (0, react.useMemo)(() => (0,
|
|
70
|
+
const debouncedFetch = (0, react.useMemo)(() => (0, lodash_es.debounce)(handleFetchPackages, CONSTANTS.API_DELAY), [handleFetchPackages]);
|
|
72
71
|
(0, react.useEffect)(() => {
|
|
73
72
|
return () => {
|
|
74
73
|
debouncedFetch.cancel?.();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.js","names":[],"sources":["../../../src/components/Search/Search.tsx"],"sourcesContent":["import SearchMui from '@mui/icons-material/Search';\nimport debounce from 'lodash
|
|
1
|
+
{"version":3,"file":"Search.js","names":[],"sources":["../../../src/components/Search/Search.tsx"],"sourcesContent":["import SearchMui from '@mui/icons-material/Search';\nimport { debounce } from 'lodash-es';\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate } from 'react-router';\n\nimport type { SearchResultWeb } from '@verdaccio/types';\n\nimport { useConfig, useSearch } from '../../';\nimport { Route } from '../../utils';\nimport AutoComplete from './AutoComplete';\nimport SearchItem from './SearchItem';\nimport { StyledInputAdornment, StyledTextField } from './styles';\n\nconst CONSTANTS = {\n API_DELAY: 300,\n ABORT_ERROR: 'AbortError',\n};\n\nconst Search: React.FC = () => {\n const { t } = useTranslation();\n const navigate = useNavigate();\n const { searchResults, isLoading, doSearch } = useSearch();\n const {\n configOptions: { flags },\n } = useConfig();\n const searchRemote = flags?.searchRemote ?? false;\n\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const cancelAllSearchRequests = useCallback(() => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n abortControllerRef.current = null;\n }\n }, []);\n\n const handleOnBlur = useCallback(\n (event: React.SyntheticEvent) => {\n event.stopPropagation();\n cancelAllSearchRequests();\n },\n [cancelAllSearchRequests]\n );\n\n const handleClickSearch = useCallback(\n (event: React.SyntheticEvent, value: SearchResultWeb, reason: string): void => {\n event.stopPropagation();\n if (reason === 'selectOption') {\n const pkgName = value['package']?.name ?? value.name;\n navigate(`${Route.DETAIL}${pkgName}`);\n }\n },\n [navigate, searchRemote]\n );\n\n // Use a ref to always access the latest doSearch without re-creating the debounced function\n const doSearchRef = useRef(doSearch);\n doSearchRef.current = doSearch;\n\n /**\n * Stable fetch function that reads the latest doSearch from a ref,\n * avoiding dependency changes that would break the debounce.\n */\n const handleFetchPackages = useCallback(\n async ({ value }: { value: string }) => {\n if (value?.trim() !== '') {\n // Abort any previous pending request before starting a new one\n cancelAllSearchRequests();\n\n // Create a new controller for the current request\n const controller = new AbortController();\n abortControllerRef.current = controller;\n\n try {\n await doSearchRef.current?.({\n text: value,\n signal: controller.signal,\n });\n } catch (err: any) {\n if (err.name === CONSTANTS.ABORT_ERROR) {\n console.warn('Search request aborted');\n } else {\n console.error('Search error:', err);\n }\n }\n }\n },\n [cancelAllSearchRequests]\n );\n\n // Memoize the debounced function so a single instance is reused across renders,\n // ensuring the debounce timer works correctly instead of creating a new timer per render.\n const debouncedFetch = useMemo(\n () => debounce(handleFetchPackages, CONSTANTS.API_DELAY),\n [handleFetchPackages]\n );\n\n useEffect(() => {\n return () => {\n debouncedFetch.cancel?.();\n cancelAllSearchRequests();\n };\n }, [debouncedFetch, cancelAllSearchRequests]);\n\n const renderOption = (props, option) => {\n const { key, ...otherProps } = props;\n\n if (searchRemote) {\n const item: SearchResultWeb = option.package;\n const isPrivate = option?.verdaccioPrivate;\n const isCached = option?.verdaccioPkgCached;\n const isRemote = !isCached && !isPrivate;\n return (\n <SearchItem\n key={key}\n {...otherProps}\n description={item?.description}\n isCached={isCached}\n isPrivate={isPrivate}\n isRemote={isRemote}\n name={item?.name}\n version={item?.version}\n />\n );\n } else {\n const item: SearchResultWeb = option.package;\n return (\n <SearchItem\n key={key}\n {...otherProps}\n description={item?.description}\n name={item?.name}\n version={item?.version}\n />\n );\n }\n };\n\n const renderInput = (params) => {\n return (\n <StyledTextField\n {...params}\n InputProps={{\n ...params.InputProps,\n startAdornment: (\n <StyledInputAdornment position=\"start\">\n <SearchMui />\n </StyledInputAdornment>\n ),\n }}\n label=\"\"\n placeholder={t('search.packages')}\n variant=\"standard\"\n />\n );\n };\n\n const getOptionLabel = (option) => {\n return option?.package?.name;\n };\n\n return (\n <AutoComplete\n getOptionLabel={getOptionLabel}\n onCleanSuggestions={handleOnBlur}\n onSelectItem={handleClickSearch}\n onSuggestionsFetch={debouncedFetch}\n placeholder={t('search.packages')}\n renderInput={renderInput}\n renderOption={renderOption}\n suggestions={searchResults}\n suggestionsLoading={isLoading}\n />\n );\n};\n\nexport default Search;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAcA,IAAM,YAAY;CAChB,WAAW;CACX,aAAa;CACd;AAED,IAAM,eAAyB;CAC7B,MAAM,EAAE,OAAA,GAAA,cAAA,iBAAsB;CAC9B,MAAM,YAAA,GAAA,aAAA,cAAwB;CAC9B,MAAM,EAAE,eAAe,WAAW,aAAa,uBAAA,WAAW;CAC1D,MAAM,EACJ,eAAe,EAAE,YACf,iCAAA,WAAW;CACf,MAAM,eAAe,OAAO,gBAAgB;CAE5C,MAAM,sBAAA,GAAA,MAAA,QAAoD,KAAK;CAE/D,MAAM,2BAAA,GAAA,MAAA,mBAA4C;AAChD,MAAI,mBAAmB,SAAS;AAC9B,sBAAmB,QAAQ,OAAO;AAClC,sBAAmB,UAAU;;IAE9B,EAAE,CAAC;CAEN,MAAM,gBAAA,GAAA,MAAA,cACH,UAAgC;AAC/B,QAAM,iBAAiB;AACvB,2BAAyB;IAE3B,CAAC,wBAAwB,CAC1B;CAED,MAAM,qBAAA,GAAA,MAAA,cACH,OAA6B,OAAwB,WAAyB;AAC7E,QAAM,iBAAiB;AACvB,MAAI,WAAW,gBAAgB;GAC7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nB,MAAM,MAAM;IACZ,SAAS,MAAM;IACf,EALK,IAKL;;;CAKR,MAAM,eAAe,WAAW;AAC9B,SACE,iBAAA,GAAA,kBAAA,KAAC,eAAA,iBAAD;GACE,GAAI;GACJ,YAAY;IACV,GAAG,OAAO;IACV,gBACE,iBAAA,GAAA,kBAAA,KAAC,eAAA,sBAAD;KAAsB,UAAS;eAC7B,iBAAA,GAAA,kBAAA,KAAC,2BAAA,SAAD,EAAa,CAAA;KACQ,CAAA;IAE1B;GACD,OAAM;GACN,aAAa,EAAE,kBAAkB;GACjC,SAAQ;GACR,CAAA;;CAIN,MAAM,kBAAkB,WAAW;AACjC,SAAO,QAAQ,SAAS;;AAG1B,QACE,iBAAA,GAAA,kBAAA,KAAC,qBAAA,SAAD;EACkB;EAChB,oBAAoB;EACpB,cAAc;EACd,oBAAoB;EACpB,aAAa,EAAE,kBAAkB;EACpB;EACC;EACd,aAAa;EACb,oBAAoB;EACpB,CAAA"}
|
|
@@ -9,9 +9,9 @@ import { StyledInputAdornment, StyledTextField } from "./styles.mjs";
|
|
|
9
9
|
import "../../index.mjs";
|
|
10
10
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
11
11
|
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
import { debounce } from "lodash-es";
|
|
12
13
|
import { useTranslation } from "react-i18next";
|
|
13
14
|
import { useNavigate } from "react-router";
|
|
14
|
-
import debounce from "lodash/debounce";
|
|
15
15
|
import SearchMui from "@mui/icons-material/Search";
|
|
16
16
|
//#region src/components/Search/Search.tsx
|
|
17
17
|
var CONSTANTS = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.mjs","names":[],"sources":["../../../src/components/Search/Search.tsx"],"sourcesContent":["import SearchMui from '@mui/icons-material/Search';\nimport debounce from 'lodash
|
|
1
|
+
{"version":3,"file":"Search.mjs","names":[],"sources":["../../../src/components/Search/Search.tsx"],"sourcesContent":["import SearchMui from '@mui/icons-material/Search';\nimport { debounce } from 'lodash-es';\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate } from 'react-router';\n\nimport type { SearchResultWeb } from '@verdaccio/types';\n\nimport { useConfig, useSearch } from '../../';\nimport { Route } from '../../utils';\nimport AutoComplete from './AutoComplete';\nimport SearchItem from './SearchItem';\nimport { StyledInputAdornment, StyledTextField } from './styles';\n\nconst CONSTANTS = {\n API_DELAY: 300,\n ABORT_ERROR: 'AbortError',\n};\n\nconst Search: React.FC = () => {\n const { t } = useTranslation();\n const navigate = useNavigate();\n const { searchResults, isLoading, doSearch } = useSearch();\n const {\n configOptions: { flags },\n } = useConfig();\n const searchRemote = flags?.searchRemote ?? false;\n\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const cancelAllSearchRequests = useCallback(() => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n abortControllerRef.current = null;\n }\n }, []);\n\n const handleOnBlur = useCallback(\n (event: React.SyntheticEvent) => {\n event.stopPropagation();\n cancelAllSearchRequests();\n },\n [cancelAllSearchRequests]\n );\n\n const handleClickSearch = useCallback(\n (event: React.SyntheticEvent, value: SearchResultWeb, reason: string): void => {\n event.stopPropagation();\n if (reason === 'selectOption') {\n const pkgName = value['package']?.name ?? value.name;\n navigate(`${Route.DETAIL}${pkgName}`);\n }\n },\n [navigate, searchRemote]\n );\n\n // Use a ref to always access the latest doSearch without re-creating the debounced function\n const doSearchRef = useRef(doSearch);\n doSearchRef.current = doSearch;\n\n /**\n * Stable fetch function that reads the latest doSearch from a ref,\n * avoiding dependency changes that would break the debounce.\n */\n const handleFetchPackages = useCallback(\n async ({ value }: { value: string }) => {\n if (value?.trim() !== '') {\n // Abort any previous pending request before starting a new one\n cancelAllSearchRequests();\n\n // Create a new controller for the current request\n const controller = new AbortController();\n abortControllerRef.current = controller;\n\n try {\n await doSearchRef.current?.({\n text: value,\n signal: controller.signal,\n });\n } catch (err: any) {\n if (err.name === CONSTANTS.ABORT_ERROR) {\n console.warn('Search request aborted');\n } else {\n console.error('Search error:', err);\n }\n }\n }\n },\n [cancelAllSearchRequests]\n );\n\n // Memoize the debounced function so a single instance is reused across renders,\n // ensuring the debounce timer works correctly instead of creating a new timer per render.\n const debouncedFetch = useMemo(\n () => debounce(handleFetchPackages, CONSTANTS.API_DELAY),\n [handleFetchPackages]\n );\n\n useEffect(() => {\n return () => {\n debouncedFetch.cancel?.();\n cancelAllSearchRequests();\n };\n }, [debouncedFetch, cancelAllSearchRequests]);\n\n const renderOption = (props, option) => {\n const { key, ...otherProps } = props;\n\n if (searchRemote) {\n const item: SearchResultWeb = option.package;\n const isPrivate = option?.verdaccioPrivate;\n const isCached = option?.verdaccioPkgCached;\n const isRemote = !isCached && !isPrivate;\n return (\n <SearchItem\n key={key}\n {...otherProps}\n description={item?.description}\n isCached={isCached}\n isPrivate={isPrivate}\n isRemote={isRemote}\n name={item?.name}\n version={item?.version}\n />\n );\n } else {\n const item: SearchResultWeb = option.package;\n return (\n <SearchItem\n key={key}\n {...otherProps}\n description={item?.description}\n name={item?.name}\n version={item?.version}\n />\n );\n }\n };\n\n const renderInput = (params) => {\n return (\n <StyledTextField\n {...params}\n InputProps={{\n ...params.InputProps,\n startAdornment: (\n <StyledInputAdornment position=\"start\">\n <SearchMui />\n </StyledInputAdornment>\n ),\n }}\n label=\"\"\n placeholder={t('search.packages')}\n variant=\"standard\"\n />\n );\n };\n\n const getOptionLabel = (option) => {\n return option?.package?.name;\n };\n\n return (\n <AutoComplete\n getOptionLabel={getOptionLabel}\n onCleanSuggestions={handleOnBlur}\n onSelectItem={handleClickSearch}\n onSuggestionsFetch={debouncedFetch}\n placeholder={t('search.packages')}\n renderInput={renderInput}\n renderOption={renderOption}\n suggestions={searchResults}\n suggestionsLoading={isLoading}\n />\n );\n};\n\nexport default Search;\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,IAAM,YAAY;CAChB,WAAW;CACX,aAAa;CACd;AAED,IAAM,eAAyB;CAC7B,MAAM,EAAE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gB,OAAO,WAAW;EACtC,MAAM,EAAE,KAAK,GAAG,eAAe;AAE/B,MAAI,cAAc;GAChB,MAAM,OAAwB,OAAO;GACrC,MAAM,YAAY,QAAQ;GAC1B,MAAM,WAAW,QAAQ;GACzB,MAAM,WAAW,CAAC,YAAY,CAAC;AAC/B,UACE,oBAAC,YAAD;IAEE,GAAI;IACJ,aAAa,MAAM;IACT;IACC;IACD;IACV,MAAM,MAAM;IACZ,SAAS,MAAM;IACf,EARK,IAQL;SAEC;GACL,MAAM,OAAwB,OAAO;AACrC,UACE,oBAAC,YAAD;IAEE,GAAI;IACJ,aAAa,MAAM;IACnB,MAAM,MAAM;IACZ,SAAS,MAAM;IACf,EALK,IAKL;;;CAKR,MAAM,eAAe,WAAW;AAC9B,SACE,oBAAC,iBAAD;GACE,GAAI;GACJ,YAAY;IACV,GAAG,OAAO;IACV,gBACE,oBAAC,sBAAD;KAAsB,UAAS;eAC7B,oBAAC,WAAD,EAAa,CAAA;KACQ,CAAA;IAE1B;GACD,OAAM;GACN,aAAa,EAAE,kBAAkB;GACjC,SAAQ;GACR,CAAA;;CAIN,MAAM,kBAAkB,WAAW;AACjC,SAAO,QAAQ,SAAS;;AAG1B,QACE,oBAAC,cAAD;EACkB;EAChB,oBAAoB;EACpB,cAAc;EACd,oBAAoB;EACpB,aAAa,EAAE,kBAAkB;EACpB;EACC;EACd,aAAa;EACb,oBAAoB;EACpB,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import styled from "@emotion/styled";
|
|
2
2
|
import { common } from "@mui/material/colors";
|
|
3
|
-
import
|
|
3
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
4
4
|
import ListItemText from "@mui/material/ListItemText";
|
|
5
5
|
//#region src/components/UpLinks/styles.ts
|
|
6
|
-
var StyledText = styled(
|
|
6
|
+
var StyledText = styled(MaterialUITypography)((props) => ({ fontWeight: props.theme.fontWeight.bold }));
|
|
7
7
|
var Spacer = styled("div")(({ theme }) => ({
|
|
8
8
|
flex: "1 1 auto",
|
|
9
9
|
borderBottom: `1px dotted ${theme.palette.mode == "light" ? "rgba(0, 0, 0, 0.2)" : "rgba(255, 255, 255, 0.2)"} `,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.mjs","names":[],"sources":["../../../src/components/UpLinks/styles.ts"],"sourcesContent":["import styled from '@emotion/styled';\nimport { default as MuiListItemText } from '@mui/material/ListItemText';\nimport Typography from '@mui/material/Typography';\nimport { common } from '@mui/material/colors';\n\nimport type { Theme } from '../../Theme';\n\nexport const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n}));\n\nexport const Spacer = styled('div')<{ theme?: Theme }>(({ theme }) => ({\n flex: '1 1 auto',\n borderBottom: `1px dotted ${\n theme.palette.mode == 'light' ? 'rgba(0, 0, 0, 0.2)' : 'rgba(255, 255, 255, 0.2)'\n } `,\n whiteSpace: 'nowrap',\n height: '0.5em',\n margin: '0 16px',\n}));\n\nexport const ListItemText = styled(MuiListItemText)<{ theme?: Theme }>(({ theme }) => ({\n flex: 'none',\n color: theme.palette.mode == 'light' ? theme.palette.black : common.white,\n opacity: 0.6,\n}));\n"],"mappings":";;;;;AAOA,IAAa,aAAa,OAAO,
|
|
1
|
+
{"version":3,"file":"styles.mjs","names":[],"sources":["../../../src/components/UpLinks/styles.ts"],"sourcesContent":["import styled from '@emotion/styled';\nimport { default as MuiListItemText } from '@mui/material/ListItemText';\nimport Typography from '@mui/material/Typography';\nimport { common } from '@mui/material/colors';\n\nimport type { Theme } from '../../Theme';\n\nexport const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n}));\n\nexport const Spacer = styled('div')<{ theme?: Theme }>(({ theme }) => ({\n flex: '1 1 auto',\n borderBottom: `1px dotted ${\n theme.palette.mode == 'light' ? 'rgba(0, 0, 0, 0.2)' : 'rgba(255, 255, 255, 0.2)'\n } `,\n whiteSpace: 'nowrap',\n height: '0.5em',\n margin: '0 16px',\n}));\n\nexport const ListItemText = styled(MuiListItemText)<{ theme?: Theme }>(({ theme }) => ({\n flex: 'none',\n color: theme.palette.mode == 'light' ? theme.palette.black : common.white,\n opacity: 0.6,\n}));\n"],"mappings":";;;;;AAOA,IAAa,aAAa,OAAO,qBAAW,EAAqB,WAAW,EAC1E,YAAY,MAAM,MAAM,WAAW,MACpC,EAAE;AAEH,IAAa,SAAS,OAAO,MAAM,EAAqB,EAAE,aAAa;CACrE,MAAM;CACN,cAAc,cACZ,MAAM,QAAQ,QAAQ,UAAU,uBAAuB,2BACxD;CACD,YAAY;CACZ,QAAQ;CACR,QAAQ;CACT,EAAE;AAEH,IAAa,iBAAe,OAAO,aAAgB,EAAqB,EAAE,aAAa;CACrF,MAAM;CACN,OAAO,MAAM,QAAQ,QAAQ,UAAU,MAAM,QAAQ,QAAQ,OAAO;CACpE,SAAS;CACV,EAAE"}
|
|
@@ -10,6 +10,7 @@ react = require_runtime.__toESM(react);
|
|
|
10
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
11
|
let _mui_material_Box = require("@mui/material/Box");
|
|
12
12
|
_mui_material_Box = require_runtime.__toESM(_mui_material_Box);
|
|
13
|
+
let lodash_es = require("lodash-es");
|
|
13
14
|
let react_i18next = require("react-i18next");
|
|
14
15
|
let _mui_material_Typography = require("@mui/material/Typography");
|
|
15
16
|
_mui_material_Typography = require_runtime.__toESM(_mui_material_Typography);
|
|
@@ -21,8 +22,6 @@ let _mui_material_Alert = require("@mui/material/Alert");
|
|
|
21
22
|
_mui_material_Alert = require_runtime.__toESM(_mui_material_Alert);
|
|
22
23
|
let _mui_material_TextField = require("@mui/material/TextField");
|
|
23
24
|
_mui_material_TextField = require_runtime.__toESM(_mui_material_TextField);
|
|
24
|
-
let lodash_debounce = require("lodash/debounce");
|
|
25
|
-
lodash_debounce = require_runtime.__toESM(lodash_debounce);
|
|
26
25
|
let semver = require("semver");
|
|
27
26
|
semver = require_runtime.__toESM(semver);
|
|
28
27
|
//#region src/components/Versions/Versions.tsx
|
|
@@ -71,7 +70,7 @@ var Versions = ({ packageMeta, packageName }) => {
|
|
|
71
70
|
children: [t("versions.version-history"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: ` (${Object.keys(packageVersions).length})` })]
|
|
72
71
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material_TextField.default, {
|
|
73
72
|
helperText: t("versions.search.placeholder"),
|
|
74
|
-
onChange: (0,
|
|
73
|
+
onChange: (0, lodash_es.debounce)((e) => {
|
|
75
74
|
filterVersions(e.target.value);
|
|
76
75
|
}, 200),
|
|
77
76
|
size: "small",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Versions.js","names":[],"sources":["../../../src/components/Versions/Versions.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Alert from '@mui/material/Alert';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\nimport debounce from 'lodash
|
|
1
|
+
{"version":3,"file":"Versions.js","names":[],"sources":["../../../src/components/Versions/Versions.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Alert from '@mui/material/Alert';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\nimport { debounce } from 'lodash-es';\nimport React, { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport semver from 'semver';\n\nimport type { Theme } from '../../Theme';\nimport { useConfig } from '../../providers';\nimport VersionsHistoryList from './HistoryList';\nimport VersionsTagList from './TagList';\n\nexport type Props = { packageMeta: any; packageName: string };\n\nexport const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme && props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nconst Versions: React.FC<Props> = ({ packageMeta, packageName }) => {\n const { t } = useTranslation();\n const { configOptions } = useConfig();\n const { versions = {}, time = {}, ['dist-tags']: distTags = {} } = packageMeta;\n\n const [packageVersions, setPackageVersions] = useState(versions);\n if (!packageMeta || Object.keys(packageMeta).length === 0) {\n return null;\n }\n const hideDeprecatedVersions = configOptions.hideDeprecatedVersions;\n const hasDistTags = distTags && Object.keys(distTags).length > 0 && packageName;\n const hasVersionHistory =\n packageVersions && Object.keys(packageVersions).length > 0 && packageName;\n\n const filterVersions = (textSearch) => {\n const filteredVersions = Object.keys(versions).reduce((acc, version) => {\n if (textSearch !== '') {\n if (typeof versions[version] !== 'undefined') {\n if (semver.satisfies(version, textSearch, { includePrerelease: true, loose: true })) {\n acc[version] = versions[version];\n }\n }\n } else {\n acc[version] = versions[version];\n }\n return acc;\n }, {});\n\n setPackageVersions(filteredVersions);\n };\n\n return (\n <Card sx={{ mb: 2 }}>\n <CardContent>\n <Box data-testid=\"versions\" sx={{ m: 2 }}>\n {hasDistTags ? (\n <>\n <StyledText variant=\"subtitle1\">\n {t('versions.current-tags')}\n <span>{` (${Object.keys(distTags).length})`}</span>\n </StyledText>\n <VersionsTagList packageName={packageName} tags={distTags} time={time} />\n </>\n ) : null}\n <>\n <StyledText variant=\"subtitle1\">\n {t('versions.version-history')}\n <span>{` (${Object.keys(packageVersions).length})`}</span>\n </StyledText>\n <TextField\n helperText={t('versions.search.placeholder')}\n onChange={debounce((e) => {\n filterVersions(e.target.value);\n }, 200)}\n size=\"small\"\n variant=\"standard\"\n sx={{ width: '50%' }}\n />\n </>\n {hasVersionHistory ? (\n <>\n {hideDeprecatedVersions === true && (\n // @ts-ignore - Alert does accept children despite the type error\n <Alert severity=\"info\" sx={{ marginTop: 1, marginBottom: 1 }}>\n {t('versions.hide-deprecated')}\n </Alert>\n )}\n <VersionsHistoryList\n packageName={packageName}\n time={time}\n versions={packageVersions}\n />\n </>\n ) : null}\n </Box>\n </CardContent>\n </Card>\n );\n};\n\nexport default Vers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AAA,UAAA,CACE,iBAAA,GAAA,kBAAA,MAAC,YAAD;KAAY,SAAQ;eAApB,CACG,EAAE,wBAAwB,EAC3B,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAA,UAAO,KAAK,OAAO,KAAK,SAAS,CAAC,OAAO,IAAU,CAAA,CACxC;QACb,iBAAA,GAAA,kBAAA,KAAC,gBAAA,SAAD;KAA8B;KAAa,MAAM;KAAgB;KAAQ,CAAA,CACxE,EAAA,CAAA,GACD;IACJ,iBAAA,GAAA,kBAAA,MAAA,kBAAA,UAAA,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,MAAC,YAAD;KAAY,SAAQ;eAApB,CACG,EAAE,2BAA2B,EAC9B,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAA,UAAO,KAAK,OAAO,KAAK,gBAAgB,CAAC,OAAO,IAAU,CAAA,CAC/C;QACb,iBAAA,GAAA,kBAAA,KAAC,wBAAA,SAAD;KACE,YAAY,EAAE,8BAA8B;KAC5C,WAAA,GAAA,UAAA,WAAoB,MAAM;AACxB,qBAAe,EAAE,OAAO,MAAM;QAC7B,IAAI;KACP,MAAK;KACL,SAAQ;KACR,IAAI,EAAE,OAAO,OAAO;KACpB,CAAA,CACD,EAAA,CAAA;IACF,oBACC,iBAAA,GAAA,kBAAA,MAAA,kBAAA,UAAA,EAAA,UAAA,CACG,2BAA2B,QAE1B,iBAAA,GAAA,kBAAA,KAAC,oBAAA,SAAD;KAAO,UAAS;KAAO,IAAI;MAAE,WAAW;MAAG,cAAc;MAAG;eACzD,EAAE,2BAA2B;KACxB,CAAA,EAEV,iBAAA,GAAA,kBAAA,KAAC,oBAAA,SAAD;KACe;KACP;KACN,UAAU;KACV,CAAA,CACD,EAAA,CAAA,GACD;IACA;MACM,CAAA;EACT,CAAA"}
|
|
@@ -6,16 +6,16 @@ import styled from "@emotion/styled";
|
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import Box from "@mui/material/Box";
|
|
9
|
+
import { debounce } from "lodash-es";
|
|
9
10
|
import { useTranslation } from "react-i18next";
|
|
10
|
-
import
|
|
11
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
11
12
|
import Card from "@mui/material/Card";
|
|
12
13
|
import CardContent from "@mui/material/CardContent";
|
|
13
14
|
import Alert from "@mui/material/Alert";
|
|
14
15
|
import TextField from "@mui/material/TextField";
|
|
15
|
-
import debounce from "lodash/debounce";
|
|
16
16
|
import semver from "semver";
|
|
17
17
|
//#region src/components/Versions/Versions.tsx
|
|
18
|
-
var StyledText = styled(
|
|
18
|
+
var StyledText = styled(MaterialUITypography)((props) => ({
|
|
19
19
|
fontWeight: props.theme && props.theme.fontWeight.bold,
|
|
20
20
|
textTransform: "capitalize"
|
|
21
21
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Versions.mjs","names":[],"sources":["../../../src/components/Versions/Versions.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Alert from '@mui/material/Alert';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\nimport debounce from 'lodash
|
|
1
|
+
{"version":3,"file":"Versions.mjs","names":[],"sources":["../../../src/components/Versions/Versions.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Alert from '@mui/material/Alert';\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\nimport { debounce } from 'lodash-es';\nimport React, { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport semver from 'semver';\n\nimport type { Theme } from '../../Theme';\nimport { useConfig } from '../../providers';\nimport VersionsHistoryList from './HistoryList';\nimport VersionsTagList from './TagList';\n\nexport type Props = { packageMeta: any; packageName: string };\n\nexport const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme && props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nconst Versions: React.FC<Props> = ({ packageMeta, packageName }) => {\n const { t } = useTranslation();\n const { configOptions } = useConfig();\n const { versions = {}, time = {}, ['dist-tags']: distTags = {} } = packageMeta;\n\n const [packageVersions, setPackageVersions] = useState(versions);\n if (!packageMeta || Object.keys(packageMeta).length === 0) {\n return null;\n }\n const hideDeprecatedVersions = configOptions.hideDeprecatedVersions;\n const hasDistTags = distTags && Object.keys(distTags).length > 0 && packageName;\n const hasVersionHistory =\n packageVersions && Object.keys(packageVersions).length > 0 && packageName;\n\n const filterVersions = (textSearch) => {\n const filteredVersions = Object.keys(versions).reduce((acc, version) => {\n if (textSearch !== '') {\n if (typeof versions[version] !== 'undefined') {\n if (semver.satisfies(version, textSearch, { includePrerelease: true, loose: true })) {\n acc[version] = versions[version];\n }\n }\n } else {\n acc[version] = versions[version];\n }\n return acc;\n }, {});\n\n setPackageVersions(filteredVersions);\n };\n\n return (\n <Card sx={{ mb: 2 }}>\n <CardContent>\n <Box data-testid=\"versions\" sx={{ m: 2 }}>\n {hasDistTags ? (\n <>\n <StyledText variant=\"subtitle1\">\n {t('versions.current-tags')}\n <span>{` (${Object.keys(distTags).length})`}</span>\n </StyledText>\n <VersionsTagList packageName={packageName} tags={distTags} time={time} />\n </>\n ) : null}\n <>\n <StyledText variant=\"subtitle1\">\n {t('versions.version-history')}\n <span>{` (${Object.keys(packageVersions).length})`}</span>\n </StyledText>\n <TextField\n helperText={t('versions.search.placeholder')}\n onChange={debounce((e) => {\n filterVersions(e.target.value);\n }, 200)}\n size=\"small\"\n variant=\"standard\"\n sx={{ width: '50%' }}\n />\n </>\n {hasVersionHistory ? (\n <>\n {hideDeprecatedVersions === true && (\n // @ts-ignore - Alert does accept children despite the type error\n <Alert severity=\"info\" sx={{ marginTop: 1, marginBottom: 1 }}>\n {t('versions.hide-deprecated')}\n </Alert>\n )}\n <VersionsHistoryList\n packageName={packageName}\n time={time}\n versions={packageVersions}\n />\n </>\n ) : null}\n </Box>\n </CardContent>\n </Card>\n );\n};\n\nexport default Versions;\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,IAAa,aAAa,OAAO,qBAAW,EAAqB,WAAW;CAC1E,YAAY,MAAM,SAAS,MAAM,MAAM,WAAW;CAClD,eAAe;CAChB,EAAE;AAEH,IAAM,YAA6B,EAAE,aAAa,kBAAkB;CAClE,MAAM,EAAE,MAAM,gBAAgB;CAC9B,MAAM,EAAE,kBAAkB,WAAW;CACrC,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,GAAG,cAAc,WAAW,EAAE,KAAK;CAEnE,MAAM,CAAC,iBAAiB,sBAAsB,SAAS,SAAS;AAChE,KAAI,CAAC,eAAe,OAAO,KAAK,YAAY,CAAC,WAAW,EACtD,QAAO;CAET,MAAM,yBAAyB,cAAc;CAC7C,MAAM,cAAc,YAAY,OAAO,KAAK,SAAS,CAAC,SAAS,KAAK;CACpE,MAAM,oBACJ,mBAAmB,OAAO,KAAK,gBAAgB,CAAC,SAAS,KAAK;CAEhE,MAAM,kBAAkB,eAAe;AAcrC,qBAbyB,OAAO,KAAK,SAAS,CAAC,QAAQ,KAAK,YAAY;AACtE,OAAI,eAAe;QACb,OAAO,SAAS,aAAa;SAC3B,OAAO,UAAU,SAAS,YAAY;MAAE,mBAAmB;MAAM,OAAO;MAAM,CAAC,CACjF,KAAI,WAAW,SAAS;;SAI5B,KAAI,WAAW,SAAS;AAE1B,UAAO;KACN,EAAE,CAAC,CAE8B;;AAGtC,QACE,oBAAC,MAAD;EAAM,IAAI,EAAE,IAAI,GAAG;YACjB,oBAAC,aAAD,EAAA,UACE,qBAAC,KAAD;GAAK,eAAY;GAAW,IAAI,EAAE,GAAG,GAAG;aAAxC;IACG,cACC,qBAAA,YAAA,EAAA,UAAA,CACE,qBAAC,YAAD;KAAY,SAAQ;eAApB,CACG,EAAE,wBAAwB,EAC3B,oBAAC,QAAD,EAAA,UAAO,KAAK,OAAO,KAAK,SAAS,CAAC,OAAO,IAAU,CAAA,CACxC;QACb,oBAAC,iBAAD;KAA8B;KAAa,MAAM;KAAgB;KAAQ,CAAA,CACxE,EAAA,CAAA,GACD;IACJ,qBAAA,YAAA,EAAA,UAAA,CACE,qBAAC,YAAD;KAAY,SAAQ;eAApB,CACG,EAAE,2BAA2B,EAC9B,oBAAC,QAAD,EAAA,UAAO,KAAK,OAAO,KAAK,gBAAgB,CAAC,OAAO,IAAU,CAAA,CAC/C;QACb,oBAAC,WAAD;KACE,YAAY,EAAE,8BAA8B;KAC5C,UAAU,UAAU,MAAM;AACxB,qBAAe,EAAE,OAAO,MAAM;QAC7B,IAAI;KACP,MAAK;KACL,SAAQ;KACR,IAAI,EAAE,OAAO,OAAO;KACpB,CAAA,CACD,EAAA,CAAA;IACF,oBACC,qBAAA,YAAA,EAAA,UAAA,CACG,2BAA2B,QAE1B,oBAAC,OAAD;KAAO,UAAS;KAAO,IAAI;MAAE,WAAW;MAAG,cAAc;MAAG;eACzD,EAAE,2BAA2B;KACxB,CAAA,EAEV,oBAAC,qBAAD;KACe;KACP;KACN,UAAU;KACV,CAAA,CACD,EAAA,CAAA,GACD;IACA;MACM,CAAA;EACT,CAAA"}
|
|
@@ -5,7 +5,7 @@ import { useCallback, useState } from "react";
|
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import i18next from "i18next";
|
|
7
7
|
import { useTranslation } from "react-i18next";
|
|
8
|
-
import
|
|
8
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
9
9
|
import Card from "@mui/material/Card";
|
|
10
10
|
import CardContent from "@mui/material/CardContent";
|
|
11
11
|
import Grid from "@mui/material/Grid";
|
|
@@ -24,7 +24,7 @@ var CardUnSelected = styled(Card)(({ theme }) => {
|
|
|
24
24
|
":hover": { backgroundColor: theme.palette.greyGainsboro }
|
|
25
25
|
};
|
|
26
26
|
});
|
|
27
|
-
var LanguageContent = ({ translation, icon }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(
|
|
27
|
+
var LanguageContent = ({ translation, icon }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(MaterialUITypography, {
|
|
28
28
|
display: "block",
|
|
29
29
|
gutterBottom: true,
|
|
30
30
|
variant: "caption",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LanguageSwitch.mjs","names":[],"sources":["../../../src/sections/Header/LanguageSwitch.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport Grid from '@mui/material/Grid';\nimport Typography from '@mui/material/Typography';\nimport i18next from 'i18next';\nimport React, { useCallback, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../';\nimport { useLanguage } from '../../';\n\nexport const CardSelected = styled(Card)<{ theme?: Theme }>(({ theme }) => {\n return {\n backgroundColor: theme.palette.grey['600'],\n opacity: '0.9',\n color: theme.palette.error.contrastText,\n fontWeight: 'bold',\n };\n});\n\nexport const CardUnSelected = styled(Card)<{ theme?: Theme }>(({ theme }) => {\n return {\n cursor: 'pointer',\n ':hover': {\n backgroundColor: theme.palette.greyGainsboro,\n },\n };\n});\n\nconst LanguageContent = ({ translation, icon }) => (\n <>\n <CardContent>\n <Typography display=\"block\" gutterBottom={true} variant=\"caption\">\n {translation}\n </Typography>\n </CardContent>\n <CardContent>{icon}</CardContent>\n </>\n);\n\nconst LanguageSwitch = () => {\n const { language, setLanguage, listLanguages } = useLanguage();\n const listConverted = listLanguages.reduce(\n (prev, item) => {\n prev[item.lng] = {\n translation: item.menuKey,\n icon: item.icon,\n };\n return prev;\n },\n {} as Record<string, { translation: string; icon: any }>\n );\n\n const [languages] = useState<string[]>(Object.keys(i18next.options?.resources || {}));\n const { t } = useTranslation();\n const currentLanguage = language;\n const getCurrentLngDetails = useCallback(\n (language: string) => {\n const lng = listConverted[language] || listConverted['en-US'];\n return {\n icon: <lng.icon />,\n translation: t(lng.translation),\n };\n },\n [listConverted, t]\n );\n const handleChangeLanguage = useCallback(\n (language: string) => {\n setLanguage(language);\n },\n [setLanguage]\n );\n\n return (\n <div>\n <Grid columns={{ xs: 12, sm: 12, md: 12 }} container={true} spacing={{ xs: 1, md: 1 }}>\n {languages.map((language, index) => {\n const { icon, translation } = getCurrentLngDetails(language);\n return (\n <Grid key={index} size={{ sm: 2, xs: 6 }}>\n {language === currentLanguage ? (\n <CardSelected sx={{ maxWidth: 80 }}>\n <LanguageContent icon={icon} translation={translation} />\n </CardSelected>\n ) : (\n <CardUnSelected onClick={() => handleChangeLanguage(language)}>\n <LanguageContent icon={icon} translation={translation} />\n </CardUnSelected>\n )}\n </Grid>\n );\n })}\n </Grid>\n </div>\n );\n};\n\nexport default LanguageSwitch;\n"],"mappings":";;;;;;;;;;;;AAYA,IAAa,eAAe,OAAO,KAAK,EAAqB,EAAE,YAAY;AACzE,QAAO;EACL,iBAAiB,MAAM,QAAQ,KAAK;EACpC,SAAS;EACT,OAAO,MAAM,QAAQ,MAAM;EAC3B,YAAY;EACb;EACD;AAEF,IAAa,iBAAiB,OAAO,KAAK,EAAqB,EAAE,YAAY;AAC3E,QAAO;EACL,QAAQ;EACR,UAAU,EACR,iBAAiB,MAAM,QAAQ,eAChC;EACF;EACD;AAEF,IAAM,mBAAmB,EAAE,aAAa,WACtC,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,aAAD,EAAA,UACE,oBAAC,
|
|
1
|
+
{"version":3,"file":"LanguageSwitch.mjs","names":[],"sources":["../../../src/sections/Header/LanguageSwitch.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport Grid from '@mui/material/Grid';\nimport Typography from '@mui/material/Typography';\nimport i18next from 'i18next';\nimport React, { useCallback, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../';\nimport { useLanguage } from '../../';\n\nexport const CardSelected = styled(Card)<{ theme?: Theme }>(({ theme }) => {\n return {\n backgroundColor: theme.palette.grey['600'],\n opacity: '0.9',\n color: theme.palette.error.contrastText,\n fontWeight: 'bold',\n };\n});\n\nexport const CardUnSelected = styled(Card)<{ theme?: Theme }>(({ theme }) => {\n return {\n cursor: 'pointer',\n ':hover': {\n backgroundColor: theme.palette.greyGainsboro,\n },\n };\n});\n\nconst LanguageContent = ({ translation, icon }) => (\n <>\n <CardContent>\n <Typography display=\"block\" gutterBottom={true} variant=\"caption\">\n {translation}\n </Typography>\n </CardContent>\n <CardContent>{icon}</CardContent>\n </>\n);\n\nconst LanguageSwitch = () => {\n const { language, setLanguage, listLanguages } = useLanguage();\n const listConverted = listLanguages.reduce(\n (prev, item) => {\n prev[item.lng] = {\n translation: item.menuKey,\n icon: item.icon,\n };\n return prev;\n },\n {} as Record<string, { translation: string; icon: any }>\n );\n\n const [languages] = useState<string[]>(Object.keys(i18next.options?.resources || {}));\n const { t } = useTranslation();\n const currentLanguage = language;\n const getCurrentLngDetails = useCallback(\n (language: string) => {\n const lng = listConverted[language] || listConverted['en-US'];\n return {\n icon: <lng.icon />,\n translation: t(lng.translation),\n };\n },\n [listConverted, t]\n );\n const handleChangeLanguage = useCallback(\n (language: string) => {\n setLanguage(language);\n },\n [setLanguage]\n );\n\n return (\n <div>\n <Grid columns={{ xs: 12, sm: 12, md: 12 }} container={true} spacing={{ xs: 1, md: 1 }}>\n {languages.map((language, index) => {\n const { icon, translation } = getCurrentLngDetails(language);\n return (\n <Grid key={index} size={{ sm: 2, xs: 6 }}>\n {language === currentLanguage ? (\n <CardSelected sx={{ maxWidth: 80 }}>\n <LanguageContent icon={icon} translation={translation} />\n </CardSelected>\n ) : (\n <CardUnSelected onClick={() => handleChangeLanguage(language)}>\n <LanguageContent icon={icon} translation={translation}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ED,QACE,oBAAC,OAAD,EAAA,UACE,oBAAC,MAAD;EAAM,SAAS;GAAE,IAAI;GAAI,IAAI;GAAI,IAAI;GAAI;EAAE,WAAW;EAAM,SAAS;GAAE,IAAI;GAAG,IAAI;GAAG;YAClF,UAAU,KAAK,UAAU,UAAU;GAClC,MAAM,EAAE,MAAM,gBAAgB,qBAAqB,SAAS;AAC5D,UACE,oBAAC,MAAD;IAAkB,MAAM;KAAE,IAAI;KAAG,IAAI;KAAG;cACrC,aAAa,kBACZ,oBAAC,cAAD;KAAc,IAAI,EAAE,UAAU,IAAI;eAChC,oBAAC,iBAAD;MAAuB;MAAmB;MAAe,CAAA;KAC5C,CAAA,GAEf,oBAAC,gBAAD;KAAgB,eAAe,qBAAqB,SAAS;eAC3D,oBAAC,iBAAD;MAAuB;MAAmB;MAAe,CAAA;KAC1C,CAAA;IAEd,EAVI,MAUJ;IAET;EACG,CAAA,EACH,CAAA"}
|
|
@@ -9,7 +9,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
import Box from "@mui/material/Box";
|
|
10
10
|
import { useTranslation } from "react-i18next";
|
|
11
11
|
import Link from "@mui/material/Link";
|
|
12
|
-
import
|
|
12
|
+
import MaterialUITypography from "@mui/material/Typography";
|
|
13
13
|
import ReactMarkdown from "react-markdown";
|
|
14
14
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
15
15
|
import Accordion from "@mui/material/Accordion";
|
|
@@ -104,7 +104,7 @@ var RegistryInfoContent = ({ scope, registryUrl }) => {
|
|
|
104
104
|
"aria-controls": "panel1a-content",
|
|
105
105
|
expandIcon: /* @__PURE__ */ jsx(ExpandMoreIcon, {}),
|
|
106
106
|
id: "panel1a-header",
|
|
107
|
-
children: /* @__PURE__ */ jsx(
|
|
107
|
+
children: /* @__PURE__ */ jsx(MaterialUITypography, {
|
|
108
108
|
sx: {
|
|
109
109
|
fontSize: "1rem",
|
|
110
110
|
fontWeight: "bold"
|
|
@@ -122,7 +122,7 @@ var RegistryInfoContent = ({ scope, registryUrl }) => {
|
|
|
122
122
|
"aria-controls": "panel2a-content",
|
|
123
123
|
expandIcon: /* @__PURE__ */ jsx(ExpandMoreIcon, {}),
|
|
124
124
|
id: "panel2a-header",
|
|
125
|
-
children: /* @__PURE__ */ jsx(
|
|
125
|
+
children: /* @__PURE__ */ jsx(MaterialUITypography, {
|
|
126
126
|
sx: {
|
|
127
127
|
fontSize: "1rem",
|
|
128
128
|
fontWeight: "bold"
|
|
@@ -148,7 +148,7 @@ var RegistryInfoContent = ({ scope, registryUrl }) => {
|
|
|
148
148
|
"aria-controls": "panel3a-content",
|
|
149
149
|
expandIcon: /* @__PURE__ */ jsx(ExpandMoreIcon, {}),
|
|
150
150
|
id: "panel3a-header",
|
|
151
|
-
children: /* @__PURE__ */ jsx(
|
|
151
|
+
children: /* @__PURE__ */ jsx(MaterialUITypography, {
|
|
152
152
|
sx: {
|
|
153
153
|
fontSize: "1rem",
|
|
154
154
|
fontWeight: "bold"
|
|
@@ -163,7 +163,7 @@ var RegistryInfoContent = ({ scope, registryUrl }) => {
|
|
|
163
163
|
/* @__PURE__ */ jsx(LinkContainer, { children: /* @__PURE__ */ jsx(Link, {
|
|
164
164
|
href: "https://verdaccio.org/docs/cli-registry",
|
|
165
165
|
target: "_blank",
|
|
166
|
-
children: /* @__PURE__ */ jsx(
|
|
166
|
+
children: /* @__PURE__ */ jsx(MaterialUITypography, { children: t("header.registry-info-link") })
|
|
167
167
|
}) })
|
|
168
168
|
] })] });
|
|
169
169
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegistryInfoContent.mjs","names":[],"sources":["../../../../src/sections/Header/RegistryInfoContent/RegistryInfoContent.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore';\nimport Accordion from '@mui/material/Accordion';\nimport AccordionDetails from '@mui/material/AccordionDetails';\nimport AccordionSummary from '@mui/material/AccordionSummary';\nimport Box from '@mui/material/Box';\nimport Link from '@mui/material/Link';\nimport Typography from '@mui/material/Typography';\nimport type { FC } from 'react';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport ReactMarkdown from 'react-markdown';\n\nimport {\n CopyClipboard,\n getCLIChangePassword,\n getCLISBerryYamlRegistry,\n getCLISetConfigRegistry,\n getCLISetRegistry,\n useConfig,\n} from '../../../';\nimport { Description, TextContent } from './styles';\n\nexport const NODE_MANAGER = {\n npm: 'npm',\n yarn: 'yarn',\n pnpm: 'pnpm',\n};\n\nconst renderNpmTab = (scope: string | undefined, registryUrl: string): React.JSX.Element => {\n return (\n <Box display=\"flex\" flexDirection=\"column\">\n <CopyClipboard\n dataTestId=\"copy\"\n text={getCLISetConfigRegistry(`${NODE_MANAGER.npm} set`, scope, registryUrl)}\n />\n <CopyClipboard\n dataTestId=\"copy\"\n text={getCLISetRegistry(`${NODE_MANAGER.npm} adduser`, registryUrl)}\n />\n <CopyClipboard dataTestId=\"copy\" text={getCLIChangePassword(NODE_MANAGER.npm, registryUrl)} />\n </Box>\n );\n};\n\nconst renderPnpmTab = (scope: string | undefined, registryUrl: string): React.JSX.Element => {\n return (\n <Box display=\"flex\" flexDirection=\"column\">\n <CopyClipboard\n dataTestId=\"copy\"\n text={getCLISetConfigRegistry(`${NODE_MANAGER.pnpm} set`, scope, registryUrl)}\n />\n <CopyClipboard\n dataTestId=\"copy\"\n text={getCLISetRegistry(`${NODE_MANAGER.pnpm} adduser`, registryUrl)}\n />\n <CopyClipboard\n dataTestId=\"copy\"\n text={getCLIChangePassword(NODE_MANAGER.pnpm, registryUrl)}\n />\n </Box>\n );\n};\n\nconst renderYarnTab = (scope: string | undefined, registryUrl: string): React.JSX.Element => {\n return (\n <Box display=\"flex\" flexDirection=\"column\">\n <CopyClipboard\n dataTestId=\"copy\"\n text={getCLISetConfigRegistry(`${NODE_MANAGER.yarn} config set`, scope, registryUrl)}\n />\n </Box>\n );\n};\n\nconst renderYarnBerryTab = (scope: string | undefined, registryUrl: string): React.JSX.Element => {\n return (\n <Box display=\"flex\" flexDirection=\"column\">\n <CopyClipboard dataTestId=\"copy\" text={getCLISBerryYamlRegistry(scope, registryUrl)} />\n </Box>\n );\n};\n\nexport const AccordionContainer = styled('div')({\n padding: 0,\n paddingLeft: 0,\n paddingRight: 0,\n});\n\nexport const CommandContainer = styled('div')({\n padding: 5,\n});\n\nexport const LinkContainer = styled('div')({\n margin: 10,\n marginLeft: 0,\n});\n\nexport type Props = {\n registryUrl: string;\n scope: string | undefined;\n};\n\nconst RegistryInfoContent: FC<Props> = ({ scope, registryUrl }) => {\n const { t } = useTranslation();\n const { configOptions } = useConfig();\n\n const hasNpm = configOptions?.pkgManagers?.includes('npm');\n const hasYarn = configOptions?.pkgManagers?.includes('yarn');\n const hasPnpm = configOptions?.pkgManagers?.includes('pnpm');\n // TODO: we can improve this logic, expanding only one accordion based on which package manager is enabled\n // feel free to contribute here\n return (\n <>\n <TextContent>{t('packageManagers.description')}</TextContent>\n <AccordionContainer>\n <Accordion disabled={!hasNpm}>\n <AccordionSummary\n aria-controls=\"panel1a-content\"\n expandIcon={<ExpandMoreIcon />}\n id=\"panel1a-header\"\n >\n <Typography sx={{ fontSize: '1rem', fontWeight: 'bold' }}>{'npm'}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <CommandContainer data-testid={'tab-content'}>\n {renderNpmTab(scope, registryUrl)}\n </CommandContainer>\n </AccordionDetails>\n </Accordion>\n <Accordion disabled={!hasYarn}>\n <AccordionSummary\n aria-controls=\"panel2a-content\"\n expandIcon={<ExpandMoreIcon />}\n id=\"panel2a-header\"\n >\n <Typography sx={{ fontSize: '1rem', fontWeight: 'bold' }}>{'yarn'}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <Description>\n <ReactMarkdown>{t('packageManagers.yarnclassicDetails')}</ReactMarkdown>\n </Description>\n <CommandContainer data-testid={'tab-content'}>\n {renderYarnTab(scope, registryUrl)}\n </CommandContainer>\n <Description>\n <ReactMarkdown>{t('packageManagers.yarnBerryDetails')}</ReactMarkdown>\n </Description>\n <CommandContainer data-testid={'tab-content'}>\n {renderYarnBerryTab(scope, registryUrl)}\n </CommandContainer>\n </AccordionDetails>\n </Accordion>\n\n <Accordion disabled={!hasPnpm}>\n <AccordionSummary\n aria-controls=\"panel3a-content\"\n expandIcon={<ExpandMoreIcon />}\n id=\"panel3a-header\"\n >\n <Typography sx={{ fontSize: '1rem', fontWeight: 'bold' }}>{'pnpm'}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <CommandContainer data-testid={'tab-content'}>\n {renderPnpmTab(scope, registryUrl)}\n </CommandContainer>\n </AccordionDetails>\n </Accordion>\n\n <LinkContainer>\n <Link href=\"https://verdaccio.org/docs/cli-registry\" target=\"_blank\">\n <Typography>{t('header.registry-info-link')}</Typography>\n </Link>\n </LinkContainer>\n </AccordionContainer>\n </>\n );\n};\n\nexport default RegistryInfoContent;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,IAAa,eAAe;CAC1B,KAAK;CACL,MAAM;CACN,MAAM;CACP;AAED,IAAM,gBAAgB,OAA2B,gBAA2C;AAC1F,QACE,qBAAC,KAAD;EAAK,SAAQ;EAAO,eAAc;YAAlC;GACE,oBAAC,iBAAD;IACE,YAAW;IACX,MAAM,wBAAwB,GAAG,aAAa,IAAI,OAAO,OAAO,YAAY;IAC5E,CAAA;GACF,oBAAC,iBAAD;IACE,YAAW;IACX,MAAM,kBAAkB,GAAG,aAAa,IAAI,WAAW,YAAY;IACnE,CAAA;GACF,oBAAC,iBAAD;IAAe,YAAW;IAAO,MAAM,qBAAqB,aAAa,KAAK,YAAY;IAAI,CAAA;GAC1F;;;AAIV,IAAM,iBAAiB,OAA2B,gBAA2C;AAC3F,QACE,qBAAC,KAAD;EAAK,SAAQ;EAAO,eAAc;YAAlC;GACE,oBAAC,iBAAD;IACE,YAAW;IACX,MAAM,wBAAwB,GAAG,aAAa,KAAK,OAAO,OAAO,YAAY;IAC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BAAC,gBAAD,EAAkB,CAAA;IAC9B,IAAG;cAEH,oBAAC,
|
|
1
|
+
{"version":3,"file":"RegistryInfoContent.mjs","names":[],"sources":["../../../../src/sections/Header/RegistryInfoContent/RegistryInfoContent.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore';\nimport Accordion from '@mui/material/Accordion';\nimport AccordionDetails from '@mui/material/AccordionDetails';\nimport AccordionSummary from '@mui/material/AccordionSummary';\nimport Box from '@mui/material/Box';\nimport Link from '@mui/material/Link';\nimport Typography from '@mui/material/Typography';\nimport type { FC } from 'react';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport ReactMarkdown from 'react-markdown';\n\nimport {\n CopyClipboard,\n getCLIChangePassword,\n getCLISBerryYamlRegistry,\n getCLISetConfigRegistry,\n getCLISetRegistry,\n useConfig,\n} from '../../../';\nimport { Description, TextContent } from './styles';\n\nexport const NODE_MANAGER = {\n npm: 'npm',\n yarn: 'yarn',\n pnpm: 'pnpm',\n};\n\nconst renderNpmTab = (scope: string | undefined, registryUrl: string): React.JSX.Element => {\n return (\n <Box display=\"flex\" flexDirection=\"column\">\n <CopyClipboard\n dataTestId=\"copy\"\n text={getCLISetConfigRegistry(`${NODE_MANAGER.npm} set`, scope, registryUrl)}\n />\n <CopyClipboard\n dataTestId=\"copy\"\n text={getCLISetRegistry(`${NODE_MANAGER.npm} adduser`, registryUrl)}\n />\n <CopyClipboard dataTestId=\"copy\" text={getCLIChangePassword(NODE_MANAGER.npm, registryUrl)} />\n </Box>\n );\n};\n\nconst renderPnpmTab = (scope: string | undefined, registryUrl: string): React.JSX.Element => {\n return (\n <Box display=\"flex\" flexDirection=\"column\">\n <CopyClipboard\n dataTestId=\"copy\"\n text={getCLISetConfigRegistry(`${NODE_MANAGER.pnpm} set`, scope, registryUrl)}\n />\n <CopyClipboard\n dataTestId=\"copy\"\n text={getCLISetRegistry(`${NODE_MANAGER.pnpm} adduser`, registryUrl)}\n />\n <CopyClipboard\n dataTestId=\"copy\"\n text={getCLIChangePassword(NODE_MANAGER.pnpm, registryUrl)}\n />\n </Box>\n );\n};\n\nconst renderYarnTab = (scope: string | undefined, registryUrl: string): React.JSX.Element => {\n return (\n <Box display=\"flex\" flexDirection=\"column\">\n <CopyClipboard\n dataTestId=\"copy\"\n text={getCLISetConfigRegistry(`${NODE_MANAGER.yarn} config set`, scope, registryUrl)}\n />\n </Box>\n );\n};\n\nconst renderYarnBerryTab = (scope: string | undefined, registryUrl: string): React.JSX.Element => {\n return (\n <Box display=\"flex\" flexDirection=\"column\">\n <CopyClipboard dataTestId=\"copy\" text={getCLISBerryYamlRegistry(scope, registryUrl)} />\n </Box>\n );\n};\n\nexport const AccordionContainer = styled('div')({\n padding: 0,\n paddingLeft: 0,\n paddingRight: 0,\n});\n\nexport const CommandContainer = styled('div')({\n padding: 5,\n});\n\nexport const LinkContainer = styled('div')({\n margin: 10,\n marginLeft: 0,\n});\n\nexport type Props = {\n registryUrl: string;\n scope: string | undefined;\n};\n\nconst RegistryInfoContent: FC<Props> = ({ scope, registryUrl }) => {\n const { t } = useTranslation();\n const { configOptions } = useConfig();\n\n const hasNpm = configOptions?.pkgManagers?.includes('npm');\n const hasYarn = configOptions?.pkgManagers?.includes('yarn');\n const hasPnpm = configOptions?.pkgManagers?.includes('pnpm');\n // TODO: we can improve this logic, expanding only one accordion based on which package manager is enabled\n // feel free to contribute here\n return (\n <>\n <TextContent>{t('packageManagers.description')}</TextContent>\n <AccordionContainer>\n <Accordion disabled={!hasNpm}>\n <AccordionSummary\n aria-controls=\"panel1a-content\"\n expandIcon={<ExpandMoreIcon />}\n id=\"panel1a-header\"\n >\n <Typography sx={{ fontSize: '1rem', fontWeight: 'bold' }}>{'npm'}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <CommandContainer data-testid={'tab-content'}>\n {renderNpmTab(scope, registryUrl)}\n </CommandContainer>\n </AccordionDetails>\n </Accordion>\n <Accordion disabled={!hasYarn}>\n <AccordionSummary\n aria-controls=\"panel2a-content\"\n expandIcon={<ExpandMoreIcon />}\n id=\"panel2a-header\"\n >\n <Typography sx={{ fontSize: '1rem', fontWeight: 'bold' }}>{'yarn'}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <Description>\n <ReactMarkdown>{t('packageManagers.yarnclassicDetails')}</ReactMarkdown>\n </Description>\n <CommandContainer data-testid={'tab-content'}>\n {renderYarnTab(scope, registryUrl)}\n </CommandContainer>\n <Description>\n <ReactMarkdown>{t('packageManagers.yarnBerryDetails')}</ReactMarkdown>\n </Description>\n <CommandContainer data-testid={'tab-content'}>\n {renderYarnBerryTab(scope, registryUrl)}\n </CommandContainer>\n </AccordionDetails>\n </Accordion>\n\n <Accordion disabled={!hasPnpm}>\n <AccordionSummary\n aria-controls=\"panel3a-content\"\n expandIcon={<ExpandMoreIcon />}\n id=\"panel3a-header\"\n >\n <Typography sx={{ fontSize: '1rem', fontWeight: 'bold' }}>{'pnpm'}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <CommandContainer data-testid={'tab-content'}>\n {renderPnpmTab(scope, registryUrl)}\n </CommandContainer>\n </AccordionDetails>\n </Accordion>\n\n <LinkContainer>\n <Link href=\"https://verdaccio.org/docs/cli-registry\" target=\"_blank\">\n <Typography>{t('header.registry-info-link')}</Typography>\n </Link>\n </LinkContainer>\n </AccordionContainer>\n </>\n );\n};\n\nexport default RegistryInfoContent;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,IAAa,eAAe;CAC1B,KAAK;CACL,MAAM;CACN,MAAM;CACP;AAED,IAAM,gBAAgB,OAA2B,gBAA2C;AAC1F,QACE,qBAAC,KAAD;EAAK,SAAQ;EAAO,eAAc;YAAlC;GACE,oBAAC,iBAAD;IACE,YAAW;IACX,MAAM,wBAAwB,GAAG,aAAa,IAAI,OAAO,OAAO,YAAY;IAC5E,CAAA;GACF,oBAAC,iBAAD;IACE,YAAW;IACX,MAAM,kBAAkB,GAAG,aAAa,IAAI,W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,iBAAc;IACd,YAAY,oBAAC,gBAAD,EAAkB,CAAA;IAC9B,IAAG;cAEH,oBAAC,sBAAD;KAAY,IAAI;MAAE,UAAU;MAAQ,YAAY;MAAQ;eAAG;KAAoB,CAAA;IAC9D,CAAA,EACnB,oBAAC,kBAAD,EAAA,UACE,oBAAC,kBAAD;IAAkB,eAAa;cAC5B,cAAc,OAAO,YAAY;IACjB,CAAA,EACF,CAAA,CACT;;EAEZ,oBAAC,eAAD,EAAA,UACE,oBAAC,MAAD;GAAM,MAAK;GAA0C,QAAO;aAC1D,oBAAC,sBAAD,EAAA,UAAa,EAAE,4BAA4B,EAAc,CAAA;GACpD,CAAA,EACO,CAAA;EACG,EAAA,CAAA,CACpB,EAAA,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
require("../../_virtual/_rolldown/runtime.js");
|
|
2
1
|
const require_routes = require("../../utils/routes.js");
|
|
3
2
|
require("../../utils/index.js");
|
|
4
|
-
require("lodash
|
|
3
|
+
require("lodash-es");
|
|
5
4
|
//#region src/sections/Security/utils.ts
|
|
6
5
|
function getSecurityUrlParams(location) {
|
|
7
6
|
const queryParams = new URLSearchParams(location.search);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/sections/Security/utils.ts"],"sourcesContent":["import isEmpty from 'lodash
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/sections/Security/utils.ts"],"sourcesContent":["import { isEmpty } from 'lodash-es';\n\nimport { Route } from '../../utils';\n\nexport interface SecurityUrlParams {\n readonly next: string;\n readonly user: string;\n}\n\nexport interface LocationLike {\n readonly search: string;\n}\n\nexport function getSecurityUrlParams(location: LocationLike): SecurityUrlParams {\n const queryParams = new URLSearchParams(location.search);\n\n // Get next parameter to match v1 URLs\n let next = queryParams.get('next') || '';\n if (next.length > 0 && (!next.startsWith(Route.LOGIN_API) || !next.match(/\\/[-0-9a-f]{36}$/))) {\n next = '';\n }\n\n // Ignore user parameter if it does not match expected format (prevent XSS attacks)\n let user = queryParams.get('user') || '';\n if (user.length > 0 && !user.match(/^[a-zA-Z0-9-_]{1,255}$/)) {\n user = '';\n }\n\n return { next, user };\n}\n\nexport interface TranslationFunction {\n (key: string, options?: Record<string, unknown>): string;\n}\n\nexport interface DispatchAction {\n (payload: { type: string; description: string }): void;\n}\n\nexport const validateCredentials = (\n username: string,\n password: string,\n t: TranslationFunction,\n dispatchAction: DispatchAction\n): boolean => {\n if (!username || !password || isEmpty(username) || isEmpty(password)) {\n dispatchAction({\n type: 'error',\n description: t('security.error.username-or-password-cant-be-empty'),\n });\n return false;\n }\n\n if (username.length < 2) {\n dispatchAction({\n type: 'error',\n description: t('security.error.username-min-length', { length: 2 }),\n });\n return false;\n }\n\n // Validate username contains only url-safe characters\n if (!username.match(/^[-a-zA-Z0-9_.!~*'()@]+$/)) {\n dispatchAction({\n type: 'error',\n description: t('security.error.username-must-be-url-safe'),\n });\n return false;\n }\n\n // Note: password rules should be checked in auth plugin\n return true;\n};\n"],"mappings":";;;;AAaA,SAAgB,qBAAqB,UAA2C;CAC9E,MAAM,cAAc,IAAI,gBAAgB,SAAS,OAAO;CAGxD,IAAI,OAAO,YAAY,IAAI,OAAO,IAAI;AACtC,KAAI,KAAK,SAAS,MAAM,CAAC,KAAK,WAAW,eAAA,MAAM,UAAU,IAAI,CAAC,KAAK,MAAM,mBAAmB,EAC1F,QAAO;CAIT,IAAI,OAAO,YAAY,IAAI,OAAO,IAAI;AACtC,KAAI,KAAK,SAAS,KAAK,CAAC,KAAK,MAAM,yBAAyB,CAC1D,QAAO;AAGT,QAAO;EAAE;EAAM;EAAM"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Route } from "../../utils/routes.mjs";
|
|
2
2
|
import "../../utils/index.mjs";
|
|
3
|
-
import "lodash
|
|
3
|
+
import "lodash-es";
|
|
4
4
|
//#region src/sections/Security/utils.ts
|
|
5
5
|
function getSecurityUrlParams(location) {
|
|
6
6
|
const queryParams = new URLSearchParams(location.search);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/sections/Security/utils.ts"],"sourcesContent":["import isEmpty from 'lodash
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/sections/Security/utils.ts"],"sourcesContent":["import { isEmpty } from 'lodash-es';\n\nimport { Route } from '../../utils';\n\nexport interface SecurityUrlParams {\n readonly next: string;\n readonly user: string;\n}\n\nexport interface LocationLike {\n readonly search: string;\n}\n\nexport function getSecurityUrlParams(location: LocationLike): SecurityUrlParams {\n const queryParams = new URLSearchParams(location.search);\n\n // Get next parameter to match v1 URLs\n let next = queryParams.get('next') || '';\n if (next.length > 0 && (!next.startsWith(Route.LOGIN_API) || !next.match(/\\/[-0-9a-f]{36}$/))) {\n next = '';\n }\n\n // Ignore user parameter if it does not match expected format (prevent XSS attacks)\n let user = queryParams.get('user') || '';\n if (user.length > 0 && !user.match(/^[a-zA-Z0-9-_]{1,255}$/)) {\n user = '';\n }\n\n return { next, user };\n}\n\nexport interface TranslationFunction {\n (key: string, options?: Record<string, unknown>): string;\n}\n\nexport interface DispatchAction {\n (payload: { type: string; description: string }): void;\n}\n\nexport const validateCredentials = (\n username: string,\n password: string,\n t: TranslationFunction,\n dispatchAction: DispatchAction\n): boolean => {\n if (!username || !password || isEmpty(username) || isEmpty(password)) {\n dispatchAction({\n type: 'error',\n description: t('security.error.username-or-password-cant-be-empty'),\n });\n return false;\n }\n\n if (username.length < 2) {\n dispatchAction({\n type: 'error',\n description: t('security.error.username-min-length', { length: 2 }),\n });\n return false;\n }\n\n // Validate username contains only url-safe characters\n if (!username.match(/^[-a-zA-Z0-9_.!~*'()@]+$/)) {\n dispatchAction({\n type: 'error',\n description: t('security.error.username-must-be-url-safe'),\n });\n return false;\n }\n\n // Note: password rules should be checked in auth plugin\n return true;\n};\n"],"mappings":";;;;AAaA,SAAgB,qBAAqB,UAA2C;CAC9E,MAAM,cAAc,IAAI,gBAAgB,SAAS,OAAO;CAGxD,IAAI,OAAO,YAAY,IAAI,OAAO,IAAI;AACtC,KAAI,KAAK,SAAS,MAAM,CAAC,KAAK,WAAW,MAAM,UAAU,IAAI,CAAC,KAAK,MAAM,mBAAmB,EAC1F,QAAO;CAIT,IAAI,OAAO,YAAY,IAAI,OAAO,IAAI;AACtC,KAAI,KAAK,SAAS,KAAK,CAAC,KAAK,MAAM,yBAAyB,CAC1D,QAAO;AAGT,QAAO;EAAE;EAAM;EAAM"}
|
package/build/utils/token.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
let lodash_isString = require("lodash/isString");
|
|
3
|
-
lodash_isString = require_runtime.__toESM(lodash_isString);
|
|
1
|
+
require("../_virtual/_rolldown/runtime.js");
|
|
4
2
|
let js_base64 = require("js-base64");
|
|
5
|
-
let
|
|
6
|
-
lodash_isNumber = require_runtime.__toESM(lodash_isNumber);
|
|
3
|
+
let lodash_es = require("lodash-es");
|
|
7
4
|
//#region src/utils/token.ts
|
|
8
5
|
function isTokenExpire(token) {
|
|
9
|
-
if (
|
|
6
|
+
if (typeof token !== "string") return true;
|
|
10
7
|
const [, payload] = token.split(".");
|
|
11
8
|
if (!payload) return true;
|
|
12
9
|
let exp;
|
|
@@ -16,7 +13,7 @@ function isTokenExpire(token) {
|
|
|
16
13
|
console.error("Invalid token:", error, token);
|
|
17
14
|
return true;
|
|
18
15
|
}
|
|
19
|
-
if (!exp || !(0,
|
|
16
|
+
if (!exp || !(0, lodash_es.isNumber)(exp)) return true;
|
|
20
17
|
const jsTimestamp = exp * 1e3 - 3e4;
|
|
21
18
|
return Date.now() >= jsTimestamp;
|
|
22
19
|
}
|
package/build/utils/token.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","names":[],"sources":["../../src/utils/token.ts"],"sourcesContent":["import { Base64 } from 'js-base64';\nimport
|
|
1
|
+
{"version":3,"file":"token.js","names":[],"sources":["../../src/utils/token.ts"],"sourcesContent":["import { Base64 } from 'js-base64';\nimport { isNumber } from 'lodash-es';\n\nexport function isTokenExpire(token: string | null): boolean {\n if (typeof token !== 'string') {\n return true;\n }\n\n const [, payload] = token.split('.');\n\n if (!payload) {\n return true;\n }\n\n let exp: number;\n try {\n exp = JSON.parse(Base64.decode(payload)).exp;\n } catch (error: unknown) {\n console.error('Invalid token:', error, token);\n return true;\n }\n\n if (!exp || !isNumber(exp)) {\n return true;\n }\n // Report as expire before (real expire time - 30s)\n const jsTimestamp = exp * 1000 - 30000;\n const expired = Date.now() >= jsTimestamp;\n\n return expired;\n}\n"],"mappings":";;;;AAGA,SAAgB,cAAc,OAA+B;AAC3D,KAAI,OAAO,UAAU,SACnB,QAAO;CAGT,MAAM,GAAG,WAAW,MAAM,MAAM,IAAI;AAEpC,KAAI,CAAC,QACH,QAAO;CAGT,IAAI;AACJ,KAAI;AACF,QAAM,KAAK,MAAM,UAAA,OAAO,OAAO,QAAQ,CAAC,CAAC;UAClC,OAAgB;AACvB,UAAQ,MAAM,kBAAkB,OAAO,MAAM;AAC7C,SAAO;;AAGT,KAAI,CAAC,OAAO,EAAA,GAAA,UAAA,UAAU,IAAI,CACxB,QAAO;CAGT,MAAM,cAAc,MAAM,MAAO;AAGjC,QAFgB,KAAK,KAAK,IAAI"}
|
package/build/utils/token.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import isString from "lodash/isString";
|
|
2
1
|
import { Base64 } from "js-base64";
|
|
3
|
-
import isNumber from "lodash
|
|
2
|
+
import { isNumber } from "lodash-es";
|
|
4
3
|
//#region src/utils/token.ts
|
|
5
4
|
function isTokenExpire(token) {
|
|
6
|
-
if (
|
|
5
|
+
if (typeof token !== "string") return true;
|
|
7
6
|
const [, payload] = token.split(".");
|
|
8
7
|
if (!payload) return true;
|
|
9
8
|
let exp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.mjs","names":[],"sources":["../../src/utils/token.ts"],"sourcesContent":["import { Base64 } from 'js-base64';\nimport
|
|
1
|
+
{"version":3,"file":"token.mjs","names":[],"sources":["../../src/utils/token.ts"],"sourcesContent":["import { Base64 } from 'js-base64';\nimport { isNumber } from 'lodash-es';\n\nexport function isTokenExpire(token: string | null): boolean {\n if (typeof token !== 'string') {\n return true;\n }\n\n const [, payload] = token.split('.');\n\n if (!payload) {\n return true;\n }\n\n let exp: number;\n try {\n exp = JSON.parse(Base64.decode(payload)).exp;\n } catch (error: unknown) {\n console.error('Invalid token:', error, token);\n return true;\n }\n\n if (!exp || !isNumber(exp)) {\n return true;\n }\n // Report as expire before (real expire time - 30s)\n const jsTimestamp = exp * 1000 - 30000;\n const expired = Date.now() >= jsTimestamp;\n\n return expired;\n}\n"],"mappings":";;;AAGA,SAAgB,cAAc,OAA+B;AAC3D,KAAI,OAAO,UAAU,SACnB,QAAO;CAGT,MAAM,GAAG,WAAW,MAAM,MAAM,IAAI;AAEpC,KAAI,CAAC,QACH,QAAO;CAGT,IAAI;AACJ,KAAI;AACF,QAAM,KAAK,MAAM,OAAO,OAAO,QAAQ,CAAC,CAAC;UAClC,OAAgB;AACvB,UAAQ,MAAM,kBAAkB,OAAO,MAAM;AAC7C,SAAO;;AAGT,KAAI,CAAC,OAAO,CAAC,SAAS,IAAI,CACxB,QAAO;CAGT,MAAM,cAAc,MAAM,MAAO;AAGjC,QAFgB,KAAK,KAAK,IAAI"}
|
package/build/utils/utils.js
CHANGED
|
@@ -7,8 +7,6 @@ let dayjs_plugin_relativeTime = require("dayjs/plugin/relativeTime");
|
|
|
7
7
|
dayjs_plugin_relativeTime = require_runtime.__toESM(dayjs_plugin_relativeTime);
|
|
8
8
|
let i18next = require("i18next");
|
|
9
9
|
i18next = require_runtime.__toESM(i18next);
|
|
10
|
-
let lodash_isString = require("lodash/isString");
|
|
11
|
-
lodash_isString = require_runtime.__toESM(lodash_isString);
|
|
12
10
|
//#region src/utils/utils.ts
|
|
13
11
|
var utils_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
14
12
|
TIMEFORMAT: () => TIMEFORMAT,
|
|
@@ -30,7 +28,7 @@ dayjs.default.extend(dayjs_plugin_localizedFormat.default);
|
|
|
30
28
|
* @see https://docs.npmjs.com/files/package.json#license
|
|
31
29
|
*/
|
|
32
30
|
function formatLicense(license) {
|
|
33
|
-
if (
|
|
31
|
+
if (typeof license === "string") return license;
|
|
34
32
|
if (license && typeof license === "object" && "type" in license && typeof license.type === "string") return license.type;
|
|
35
33
|
}
|
|
36
34
|
/**
|
|
@@ -38,7 +36,7 @@ function formatLicense(license) {
|
|
|
38
36
|
* @see https://docs.npmjs.com/files/package.json#repository
|
|
39
37
|
*/
|
|
40
38
|
function formatRepository(repository) {
|
|
41
|
-
if (
|
|
39
|
+
if (typeof repository === "string") return repository;
|
|
42
40
|
if (repository && typeof repository === "object" && "url" in repository && typeof repository.url === "string") return repository.url;
|
|
43
41
|
return null;
|
|
44
42
|
}
|
package/build/utils/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../src/utils/utils.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport localizedFormat from 'dayjs/plugin/localizedFormat';\nimport relativeTime from 'dayjs/plugin/relativeTime';\nimport i18next from 'i18next';\
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../src/utils/utils.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport localizedFormat from 'dayjs/plugin/localizedFormat';\nimport relativeTime from 'dayjs/plugin/relativeTime';\nimport i18next from 'i18next';\n\nimport type { UpLinks } from '@verdaccio/types';\n\nimport type { Time } from '../types/packageMeta';\n\nexport const TIMEFORMAT = 'L LTS';\n\ndayjs.extend(relativeTime);\ndayjs.extend(localizedFormat);\n\n/**\n * Formats license field for webui.\n * @see https://docs.npmjs.com/files/package.json#license\n */\nexport function formatLicense(license: string | { type?: string } | unknown): string | undefined {\n if (typeof license === 'string') {\n return license;\n }\n\n if (\n license &&\n typeof license === 'object' &&\n 'type' in license &&\n typeof license.type === 'string'\n ) {\n return license.type;\n }\n\n return undefined;\n}\n\nexport interface Repository {\n readonly type: string;\n readonly url: string;\n}\n\n/**\n * Formats repository field for webui.\n * @see https://docs.npmjs.com/files/package.json#repository\n */\nexport function formatRepository(repository: string | { url?: string } | unknown): string | null {\n if (typeof repository === 'string') {\n return repository;\n }\n\n if (\n repository &&\n typeof repository === 'object' &&\n 'url' in repository &&\n typeof repository.url === 'string'\n ) {\n return repository.url;\n }\n\n return null;\n}\n\nexport function formatDate(lastUpdate: string | number): string {\n return dayjs(new Date(lastUpdate)).format(TIMEFORMAT);\n}\n\nexport function formatDateDistance(lastUpdate: Date | string | number): string {\n return dayjs(new Date(lastUpdate)).fromNow();\n}\n\n/**\n * For <LastSync /> component\n * @param {array} uplinks\n */\nexport function getLastUpdatedPackageTime(uplinks: UpLinks = {}): string {\n let lastUpdate = 0;\n Object.keys(uplinks).forEach(function computeUplink(upLinkName): void {\n const status = uplinks[upLinkName];\n if (status.fetched > lastUpdate) {\n lastUpdate = status.fetched;\n }\n });\n\n return lastUpdate ? formatDate(lastUpdate) : '';\n}\n\n/**\n * For <LastSync /> component\n * @param {Object} time\n * @returns {Array} last 3 releases\n */\nexport function getRecentReleases(time: Time = {}): Time[] {\n const recent = Object.keys(time).map((version) => ({\n version,\n time: formatDate(time[version]),\n }));\n\n return recent.slice(recent.length - 3, recent.length).reverse();\n}\n\nexport function getAuthorName(authorName?: string): string {\n if (!authorName) {\n return i18next.t('author-unknown');\n }\n\n if (authorName.toLowerCase() === 'anonymous') {\n return i18next.t('author-anonymous');\n }\n\n return authorName;\n}\n\nexport function getUplink(upLinkName: string, packageName: string): string | null {\n // TODO: make this a config like \"uplinks: npmjs: web: https://www.npmjs.com/package/\"\n switch (upLinkName) {\n case 'npmjs':\n return `https://www.npmjs.com/package/${packageName}`;\n }\n return null;\n}\n\nexport function fileSizeSI(\n a: number,\n b?: typeof Math,\n c?: (p: number) => number,\n d?: number,\n e?: number\n): string {\n b = Math;\n c = b.log;\n d = 1e3;\n e = (c(a) / c(d)) | 0;\n const size = a / b.pow(d, e);\n // no decimals for Bytes\n if (e === 0) {\n return Math.floor(size) + ' Bytes';\n } else {\n return size.toFixed(1) + ' ' + 'kMGTPEZY'[--e] + 'B';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AASA,IAAa,aAAa;AAE1B,MAAA,QAAM,OAAO,0BAAA,QAAa;AAC1B,MAAA,QAAM,OAAO,6BAAA,QAAgB;;;;;AAM7B,SAAgB,cAAc,SAAmE;AAC/F,KAAI,OAAO,YAAY,SACrB,QAAO;AAGT,KACE,WACA,OAAO,YAAY,YACnB,UAAU,WACV,OAAO,QAAQ,SAAS,SAExB,QAAO,QAAQ;;;;;;AAenB,SAAgB,iBAAiB,YAAgE;AAC/F,KAAI,OAAO,eAAe,SACxB,QAAO;AAGT,KACE,cACA,OAAO,eAAe,YACtB,SAAS,cACT,OAAO,WAAW,QAAQ,SAE1B,QAAO,WAAW;AAGpB,QAAO;;AAGT,SAAgB,WAAW,YAAqC;AAC9D,SAAA,GAAA,MAAA,SAAa,IAAI,KAAK,WAAW,CAAC,CAAC,OAAO,WAAW;;AAGvD,SAAgB,mBAAmB,YAA4C;AAC7E,SAAA,GAAA,MAAA,SAAa,IAAI,KAAK,WAAW,CAAC,CAAC,SAAS;;;;;;AAO9C,SAAgB,0BAA0B,UAAmB,EAAE,EAAU;CACvE,IAAI,aAAa;AACjB,QAAO,KAAK,QAAQ,CAAC,QAAQ,SAAS,cAAc,YAAkB;EACpE,MAAM,SAAS,QAAQ;AACvB,MAAI,OAAO,UAAU,WACnB,cAAa,OAAO;GAEtB;AAEF,QAAO,aAAa,WAAW,WAAW,GAAG;;;;;;;AAQ/C,SAAgB,kBAAkB,OAAa,EAAE,EAAU;CACzD,MAAM,SAAS,OAAO,KAAK,KAAK,CAAC,KAAK,aAAa;EACjD;EACA,MAAM,WAAW,KAAK,SAAS;EAChC,EAAE;AAEH,QAAO,OAAO,MAAM,OAAO,SAAS,GAAG,OAAO,OAAO,CAAC,SAAS;;AAGjE,SAAgB,cAAc,YAA6B;AACzD,KAAI,CAAC,WACH,QAAO,QAAA,QAAQ,EAAE,iBAAiB;AAGpC,KAAI,WAAW,aAAa,KAAK,YAC/B,QAAO,QAAA,QAAQ,EAAE,mBAAmB;AAGtC,QAAO;;AAGT,SAAgB,UAAU,YAAoB,aAAoC;AAEhF,SAAQ,YAAR;EACE,KAAK,QACH,QAAO,iCAAiC;;AAE5C,QAAO;;AAGT,SAAgB,WACd,GACA,GACA,GACA,GACA,GACQ;AACR,KAAI;AACJ,KAAI,EAAE;AACN,KAAI;AACJ,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,GAAI;CACpB,MAAM,OAAO,IAAI,EAAE,IAAI,GAAG,EAAE;AAE5B,KAAI,MAAM,EACR,QAAO,KAAK,MAAM,KAAK,GAAG;KAE1B,QAAO,KAAK,QAAQ,EAAE,GAAG,MAAM,WAAW,EAAE,KAAK"}
|
package/build/utils/utils.mjs
CHANGED
|
@@ -3,7 +3,6 @@ import dayjs from "dayjs";
|
|
|
3
3
|
import localizedFormat from "dayjs/plugin/localizedFormat";
|
|
4
4
|
import relativeTime from "dayjs/plugin/relativeTime";
|
|
5
5
|
import i18next from "i18next";
|
|
6
|
-
import isString from "lodash/isString";
|
|
7
6
|
//#region src/utils/utils.ts
|
|
8
7
|
var utils_exports = /* @__PURE__ */ __exportAll({
|
|
9
8
|
TIMEFORMAT: () => TIMEFORMAT,
|
|
@@ -25,7 +24,7 @@ dayjs.extend(localizedFormat);
|
|
|
25
24
|
* @see https://docs.npmjs.com/files/package.json#license
|
|
26
25
|
*/
|
|
27
26
|
function formatLicense(license) {
|
|
28
|
-
if (
|
|
27
|
+
if (typeof license === "string") return license;
|
|
29
28
|
if (license && typeof license === "object" && "type" in license && typeof license.type === "string") return license.type;
|
|
30
29
|
}
|
|
31
30
|
/**
|
|
@@ -33,7 +32,7 @@ function formatLicense(license) {
|
|
|
33
32
|
* @see https://docs.npmjs.com/files/package.json#repository
|
|
34
33
|
*/
|
|
35
34
|
function formatRepository(repository) {
|
|
36
|
-
if (
|
|
35
|
+
if (typeof repository === "string") return repository;
|
|
37
36
|
if (repository && typeof repository === "object" && "url" in repository && typeof repository.url === "string") return repository.url;
|
|
38
37
|
return null;
|
|
39
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":[],"sources":["../../src/utils/utils.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport localizedFormat from 'dayjs/plugin/localizedFormat';\nimport relativeTime from 'dayjs/plugin/relativeTime';\nimport i18next from 'i18next';\
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../src/utils/utils.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport localizedFormat from 'dayjs/plugin/localizedFormat';\nimport relativeTime from 'dayjs/plugin/relativeTime';\nimport i18next from 'i18next';\n\nimport type { UpLinks } from '@verdaccio/types';\n\nimport type { Time } from '../types/packageMeta';\n\nexport const TIMEFORMAT = 'L LTS';\n\ndayjs.extend(relativeTime);\ndayjs.extend(localizedFormat);\n\n/**\n * Formats license field for webui.\n * @see https://docs.npmjs.com/files/package.json#license\n */\nexport function formatLicense(license: string | { type?: string } | unknown): string | undefined {\n if (typeof license === 'string') {\n return license;\n }\n\n if (\n license &&\n typeof license === 'object' &&\n 'type' in license &&\n typeof license.type === 'string'\n ) {\n return license.type;\n }\n\n return undefined;\n}\n\nexport interface Repository {\n readonly type: string;\n readonly url: string;\n}\n\n/**\n * Formats repository field for webui.\n * @see https://docs.npmjs.com/files/package.json#repository\n */\nexport function formatRepository(repository: string | { url?: string } | unknown): string | null {\n if (typeof repository === 'string') {\n return repository;\n }\n\n if (\n repository &&\n typeof repository === 'object' &&\n 'url' in repository &&\n typeof repository.url === 'string'\n ) {\n return repository.url;\n }\n\n return null;\n}\n\nexport function formatDate(lastUpdate: string | number): string {\n return dayjs(new Date(lastUpdate)).format(TIMEFORMAT);\n}\n\nexport function formatDateDistance(lastUpdate: Date | string | number): string {\n return dayjs(new Date(lastUpdate)).fromNow();\n}\n\n/**\n * For <LastSync /> component\n * @param {array} uplinks\n */\nexport function getLastUpdatedPackageTime(uplinks: UpLinks = {}): string {\n let lastUpdate = 0;\n Object.keys(uplinks).forEach(function computeUplink(upLinkName): void {\n const status = uplinks[upLinkName];\n if (status.fetched > lastUpdate) {\n lastUpdate = status.fetched;\n }\n });\n\n return lastUpdate ? formatDate(lastUpdate) : '';\n}\n\n/**\n * For <LastSync /> component\n * @param {Object} time\n * @returns {Array} last 3 releases\n */\nexport function getRecentReleases(time: Time = {}): Time[] {\n const recent = Object.keys(time).map((version) => ({\n version,\n time: formatDate(time[version]),\n }));\n\n return recent.slice(recent.length - 3, recent.length).reverse();\n}\n\nexport function getAuthorName(authorName?: string): string {\n if (!authorName) {\n return i18next.t('author-unknown');\n }\n\n if (authorName.toLowerCase() === 'anonymous') {\n return i18next.t('author-anonymous');\n }\n\n return authorName;\n}\n\nexport function getUplink(upLinkName: string, packageName: string): string | null {\n // TODO: make this a config like \"uplinks: npmjs: web: https://www.npmjs.com/package/\"\n switch (upLinkName) {\n case 'npmjs':\n return `https://www.npmjs.com/package/${packageName}`;\n }\n return null;\n}\n\nexport function fileSizeSI(\n a: number,\n b?: typeof Math,\n c?: (p: number) => number,\n d?: number,\n e?: number\n): string {\n b = Math;\n c = b.log;\n d = 1e3;\n e = (c(a) / c(d)) | 0;\n const size = a / b.pow(d, e);\n // no decimals for Bytes\n if (e === 0) {\n return Math.floor(size) + ' Bytes';\n } else {\n return size.toFixed(1) + ' ' + 'kMGTPEZY'[--e] + 'B';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AASA,IAAa,aAAa;AAE1B,MAAM,OAAO,aAAa;AAC1B,MAAM,OAAO,gBAAgB;;;;;AAM7B,SAAgB,cAAc,SAAmE;AAC/F,KAAI,OAAO,YAAY,S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AACJ,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,GAAI;CACpB,MAAM,OAAO,IAAI,EAAE,IAAI,GAAG,EAAE;AAE5B,KAAI,MAAM,EACR,QAAO,KAAK,MAAM,KAAK,GAAG;KAE1B,QAAO,KAAK,QAAQ,EAAE,GAAG,MAAM,WAAW,EAAE,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/ui-components",
|
|
3
|
-
"version": "5.0.0-next-9.
|
|
3
|
+
"version": "5.0.0-next-9.7",
|
|
4
4
|
"description": "Verdaccio UI Components",
|
|
5
5
|
"author": "Juan Picado <juanpicado19@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,33 +22,33 @@
|
|
|
22
22
|
"./build/*": "./build/*"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@emotion/react": "11.
|
|
26
|
-
"@emotion/styled": "11.
|
|
25
|
+
"@emotion/react": "11.14.0",
|
|
26
|
+
"@emotion/styled": "11.14.1",
|
|
27
27
|
"@hookform/resolvers": "5.2.2",
|
|
28
28
|
"@microlink/react-json-view": "1.31.12",
|
|
29
|
-
"@mui/icons-material": "7.3.
|
|
30
|
-
"@mui/material": "7.3.
|
|
29
|
+
"@mui/icons-material": "7.3.9",
|
|
30
|
+
"@mui/material": "7.3.9",
|
|
31
31
|
"@verdaccio/ui-i18n": "10.0.0-next-9.2",
|
|
32
|
-
"country-flag-icons": "1.
|
|
33
|
-
"dayjs": "1.11.
|
|
34
|
-
"dompurify": "3.3.
|
|
32
|
+
"country-flag-icons": "1.6.15",
|
|
33
|
+
"dayjs": "1.11.20",
|
|
34
|
+
"dompurify": "3.3.3",
|
|
35
35
|
"highlight.js": "11.11.1",
|
|
36
|
-
"i18next": "25.8.
|
|
36
|
+
"i18next": "25.8.18",
|
|
37
37
|
"js-base64": "3.7.8",
|
|
38
38
|
"localstorage-memory": "1.0.3",
|
|
39
|
-
"lodash": "4.17.23",
|
|
40
|
-
"marked": "17.0.
|
|
39
|
+
"lodash-es": "4.17.23",
|
|
40
|
+
"marked": "17.0.4",
|
|
41
41
|
"marked-highlight": "2.2.3",
|
|
42
42
|
"normalize.css": "8.0.1",
|
|
43
|
-
"react": "19.2.
|
|
44
|
-
"react-dom": "19.2.
|
|
45
|
-
"react-hook-form": "7.71.
|
|
46
|
-
"react-i18next": "16.5.
|
|
43
|
+
"react": "19.2.4",
|
|
44
|
+
"react-dom": "19.2.4",
|
|
45
|
+
"react-hook-form": "7.71.2",
|
|
46
|
+
"react-i18next": "16.5.8",
|
|
47
47
|
"react-markdown": "10.1.0",
|
|
48
|
-
"react-router": "7.13.
|
|
48
|
+
"react-router": "7.13.1",
|
|
49
49
|
"react-virtualized": "9.22.6",
|
|
50
50
|
"semver": "7.7.4",
|
|
51
|
-
"swr": "2.
|
|
51
|
+
"swr": "2.4.1",
|
|
52
52
|
"validator": "13.15.26",
|
|
53
53
|
"yup": "1.7.1"
|
|
54
54
|
},
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"@storybook/addon-links": "10.2.17",
|
|
58
58
|
"@storybook/react-vite": "10.2.17",
|
|
59
59
|
"@testing-library/dom": "10.4.1",
|
|
60
|
-
"@testing-library/jest-dom": "6.
|
|
61
|
-
"@testing-library/react": "16.3.
|
|
60
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
61
|
+
"@testing-library/react": "16.3.2",
|
|
62
|
+
"@types/lodash-es": "4.17.12",
|
|
62
63
|
"@types/node": "24.10.13",
|
|
63
|
-
"@verdaccio/types": "14.0.0-next-9.
|
|
64
|
+
"@verdaccio/types": "14.0.0-next-9.4",
|
|
64
65
|
"@vitejs/plugin-react": "6.0.1",
|
|
65
|
-
"vite": "^8.0.0",
|
|
66
66
|
"eslint-plugin-storybook": "10.2.17",
|
|
67
67
|
"eslint-plugin-verdaccio": "10.0.0",
|
|
68
68
|
"jsdom": "28.1.0",
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"msw-storybook-addon": "2.0.6",
|
|
72
72
|
"mutationobserver-shim": "0.3.7",
|
|
73
73
|
"storybook": "10.2.17",
|
|
74
|
+
"vite": "^8.0.0",
|
|
74
75
|
"vitest": "4.1.0",
|
|
75
76
|
"whatwg-fetch": "3.6.20"
|
|
76
77
|
},
|