Skip to content

Commit

Permalink
Merge branch 'master' into e.muhamethanov/7699/-custom-scroll-view-na…
Browse files Browse the repository at this point in the history
…tive-approach
  • Loading branch information
EldarMuhamethanov committed Oct 14, 2024
2 parents d644688 + be5ef3e commit cad0131
Show file tree
Hide file tree
Showing 203 changed files with 2,563 additions and 1,038 deletions.
2 changes: 1 addition & 1 deletion benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"dependencies": {
"@playwright/test": "1.47.2",
"@swc/core": "^1.7.26",
"@swc/core": "^1.7.35",
"@vkontakte/vkui": "workspace:packages/vkui",
"cli-table3": "^0.6.1",
"css-loader": "^6.10.0",
Expand Down
2 changes: 1 addition & 1 deletion docs/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
- platform: 'android'
- browserName: 'chromium'
- appearance: 'light'
- colorScheme: 'light'
```tsx
test('Example', async ({ expectScreenshotClippedToContent }) => {
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
"@csstools/postcss-global-data": "3.0.0",
"@playwright/experimental-ct-react": "1.47.2",
"@playwright/test": "1.47.2",
"@size-limit/file": "^11.1.5",
"@size-limit/webpack": "^11.1.5",
"@size-limit/webpack-css": "^11.1.5",
"@size-limit/file": "^11.1.6",
"@size-limit/webpack": "^11.1.6",
"@size-limit/webpack-css": "^11.1.6",
"@swc/cli": "^0.4.0",
"@swc/core": "1.7.26",
"@swc/core": "1.7.35",
"@swc/jest": "^0.2.36",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.5.13",
"@types/jest-axe": "^3.5.9",
"@types/node": "^22.7.4",
"@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0",
"@types/node": "^22.7.5",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1",
"@types/webpack": "^5.28.5",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
Expand All @@ -46,7 +46,7 @@
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-compat": "^6.0.1",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.2.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.33.2",
Expand All @@ -64,7 +64,7 @@
"mini-css-extract-plugin": "^2.9.1",
"postcss": "^8.4.47",
"postcss-cli": "^11.0.0",
"postcss-custom-media": "^11.0.1",
"postcss-custom-media": "^11.0.3",
"postcss-gap-properties": "^6.0.0",
"postcss-import": "^16.1.0",
"postcss-loader": "^8.1.1",
Expand All @@ -77,19 +77,19 @@
"react-dom": "^18.3.1",
"semver": "^7.6.3",
"shx": "^0.3.4",
"size-limit": "^11.1.5",
"size-limit": "^11.1.6",
"style-loader": "^4.0.0",
"stylelint": "^16.9.0",
"stylelint": "^16.10.0",
"stylelint-config-standard": "^36.0.1",
"stylelint-media-use-custom-media": "^4.0.0",
"stylelint-prettier": "^5.0.2",
"stylelint-use-logical": "^2.1.2",
"stylelint-value-no-unknown-custom-properties": "^6.0.1",
"swc-loader": "^0.2.6",
"swc-plugin-css-modules": "0.1.19",
"swc-plugin-transform-remove-imports": "1.21.0",
"swc-plugin-css-modules": "0.1.20",
"swc-plugin-transform-remove-imports": "1.22.0",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"typescript": "^5.6.3",
"typescript-plugin-css-modules": "^5.1.0",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4",
Expand Down
8 changes: 4 additions & 4 deletions packages/codemods/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
"cross-spawn": "^7.0.3",
"jscodeshift": "^17.0.0",
"prompts": "^2.4.2",
"typescript": "^5.6.2"
"typescript": "^5.6.3"
},
"devDependencies": {
"@swc/core": "^1.7.26",
"@swc/core": "^1.7.35",
"@swc/jest": "^0.2.36",
"@types/cross-spawn": "^6.0.6",
"@types/jest": "^29.5.13",
"@types/jscodeshift": "^0.11.11",
"@types/node": "^22.7.4",
"@types/jscodeshift": "^0.12.0",
"@types/node": "^22.7.5",
"@types/prompts": "^2.4.9",
"jest": "^29.7.0",
"ts-node": "^10.9.2"
Expand Down
47 changes: 47 additions & 0 deletions packages/codemods/src/codemod-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,53 @@ export function getImportInfo(
return { localName: localImportName };
}

export function renameImportName(
j: JSCodeshift,
source: Collection,
componentName: string,
newName: string,
alias: string,
renameOnlyImportedName: boolean,
) {
source
.find(j.ImportDeclaration, { source: { value: alias } })
.find(j.ImportSpecifier, { local: { name: componentName } })
.forEach((path) => {
const newSpecifier = j.importSpecifier(
j.identifier(newName),
renameOnlyImportedName ? j.identifier(componentName) : j.identifier(newName),
);
(newSpecifier as any).importKind = (path.value as any).importKind;
j(path).replaceWith(newSpecifier);
});
}

export function renameIdentifier(
j: JSCodeshift,
source: Collection,
oldName: string,
newName: string,
) {
source.find(j.Identifier, { name: oldName }).forEach((path) => {
j(path).replaceWith(j.identifier(newName));
});
}

export function renameTypeIdentifier(
j: JSCodeshift,
source: Collection,
oldName: string,
newName: string,
) {
source
.find(j.TSTypeReference, { typeName: { type: 'Identifier', name: oldName } })
.forEach((path) => {
if (path.node.typeName.type === 'Identifier') {
path.node.typeName.name = newName;
}
});
}

export function renameProp(
j: JSCodeshift,
source: Collection,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { AppearanceProvider as AppearanceProviderAlias, type AppearanceProviderProps as AppearanceProviderPropsAlias, Snackbar } from '@vkontakte/vkui';
import React from 'react';

const App = () => {
const props: AppearanceProviderPropsAlias = {
value: 'dark',
children: (<Snackbar action="Поделиться">Поделиться</Snackbar>)
};

return (
<React.Fragment>
<AppearanceProviderAlias {...props} />
</React.Fragment>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { AppearanceProvider, type AppearanceProviderProps, Snackbar } from '@vkontakte/vkui';
import React from 'react';

type Props = AppearanceProviderProps & {
additionalProp: string,
}

const App = () => {
const props: AppearanceProviderProps = {
value: 'dark',
children: (<Snackbar action="Поделиться">Поделиться</Snackbar>)
};

const getAdditionalProvider = () => (
<AppearanceProvider value={"light"}>
<Snackbar action="Поделиться">Поделиться</Snackbar>
</AppearanceProvider>
)

return (
<React.Fragment>
<AppearanceProvider {...props} />
{getAdditionalProvider()}
</React.Fragment>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Appearance as AppearanceAlias, type AppearanceType as AppearanceTypeAlias } from '@vkontakte/vkui';
import React from 'react';

const Component: React.FC<{
appearance: AppearanceTypeAlias;
}> = () => {
return (
<div></div>
)
}

const App = () => {
const appearance: AppearanceTypeAlias = AppearanceAlias.LIGHT;

return (
<React.Fragment>
<Component appearance={AppearanceAlias.DARK} />
</React.Fragment>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Appearance, type AppearanceType, useAppearance } from '@vkontakte/vkui';
import React from 'react';

const Component: React.FC<{
appearance: AppearanceType;
}> = ({
appearance,
}) => {
return (
<div></div>
)
}

const App = () => {
const appearance: AppearanceType = Appearance.LIGHT;

const fromHookAppearance = useAppearance();

return (
<React.Fragment>
<Component appearance={Appearance.DARK} />
</React.Fragment>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ const App = () => {
before={<Avatar size={48} src={'user_lihachyov'} />}
header="Сегодня день рождения Михаила Лихачёва"
subheader="Подарите подарок"
text="Дополнительный текст"
asideMode="dismiss"
/>
<Banner
before={<Avatar size={48} src={'user_lihachyov'} />}
header="Сегодня день рождения Михаила Лихачёва"
subheader={"Подарите подарок"}
text={"Дополнительный текст"}
asideMode="dismiss"
/>
</React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ConfigProvider, ConfigProviderContext } from '@vkontakte/vkui';
import React, {createContext} from 'react';

const OtherContext = createContext({});


const App = () => {
const contextValue = {}
return (
<>
<ConfigProvider
appearance={"dark"}
{...contextValue}
>
<div></div>
</ConfigProvider>

<ConfigProviderContext.Provider value={{
appearance: 'light',
...contextValue
}}>
<div></div>
</ConfigProviderContext.Provider>

<OtherContext.Provider value={{
appearance: 'light',
...contextValue
}}>
<div></div>
</OtherContext.Provider>
</>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { HorizontalCell, Image } from '@vkontakte/vkui';
import React from 'react';

const App = () => {
return (
<React.Fragment>
<HorizontalCell
header="Title"
subtitle="Subtitle"
extraSubtitle="Extra Subtitle"
size="m"
>
<Image size={88} borderRadius="l" />
</HorizontalCell>

<HorizontalCell
header={'Title'}
subtitle="Subtitle"
extraSubtitle="Extra Subtitle"
size="m"
>
<Image size={88} borderRadius="l" />
</HorizontalCell>
</React.Fragment>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Avatar, RichCell } from '@vkontakte/vkui';
import React from 'react';

const App = () => {
const text = "Text"
return (
<React.Fragment>
<RichCell
before={<Avatar size={72} src="" />}
subhead="Subhead"
text="Text"
caption="Caption"
after="After"
afterCaption="After Caption"
>
Children
</RichCell>

<RichCell
before={<Avatar size={72} src="" />}
subhead={"Subhead"}
text={text}
caption={"Caption"}
after="After"
afterCaption="After Caption"
>
Children
</RichCell>
</React.Fragment>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const App = () => {
<Separator mode="primary" />
<Separator mode="primary-alpha" wide />
<Separator mode={"secondary"} />
<Separator wide={false} />
<Separator wide={true} />
</React.Fragment>
);
};
Loading

0 comments on commit cad0131

Please sign in to comment.