Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/core-components/platforms/mobile/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/core-components/platforms/mobile/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.9.0",
"version": "0.10.0",
"name": "@salutejs/core-components",
"description": "Core-components package for native platform on mobile.",
"author": "Salute Frontend Team <salute.developers@gmail.com>",
Expand Down
4 changes: 2 additions & 2 deletions core/core-components/platforms/tv/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/core-components/platforms/tv/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.9.0",
"version": "0.10.0",
"name": "@salutejs/core-components",
"description": "Core-components package native platform on tv.",
"author": "Salute Frontend Team <salute.developers@gmail.com>",
Expand Down
4 changes: 2 additions & 2 deletions core/core-themes/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/core-themes/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.9.0",
"version": "0.10.0",
"name": "@salutejs/core-themes-native",
"description": "Core-themes package for native platform.",
"author": "Salute Frontend Team <salute.developers@gmail.com>",
Expand Down
33 changes: 33 additions & 0 deletions core/core-themes/src/creators/createSpacingTokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { TokenType } from '../types';
import { kebabToCamel, writeTokens } from '../utils';

const getSpacing = (spacing: any, tokens: TokenType[], kind: 'spacing') =>
tokens
.filter((token) => token.tags[0] === kind)
.map((token) => {
const [, ...rest] = token.name.split('.');
const value = spacing[token.name];
const tokenName = kebabToCamel(rest.join('-')).replace(/(.*)x/gi, 'x$1');

return `/** ${token.description} */\n ${tokenName}: ${JSON.stringify(value.value)},`;
})
.join('\n ');

const getContent = (sizeSpacing: string) => `export const spacing = {
size: {
${sizeSpacing}
},
};
`;

export const createSpacingTokens = (themeDir: string, spacing: any, tokens?: Array<TokenType>) => {
if (!tokens?.length) {
return;
}

const sizeSpacing = getSpacing(spacing, tokens, 'spacing');

const content = getContent(sizeSpacing);

writeTokens(content, themeDir, 'spacing.ts');
};
1 change: 1 addition & 0 deletions core/core-themes/src/creators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export { createColorTokens } from './createColorTokens';
export { createGradientTokens } from './createGradientTokens';
export { createShadowTokens } from './createShadowTokens';
export { createShapeTokens } from './createShapeTokens';
export { createSpacingTokens } from './createSpacingTokens';
export { createFontFamilyTokens } from './createFontFamilyTokens';
export { createTypographyTokens } from './createTypographyTokens';
4 changes: 3 additions & 1 deletion core/core-themes/src/generators/generateTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ import fs from 'fs';

import { getMetaGrouped } from '../utils';
import { ThemeSource } from '../types';

import {
createColorTokens,
createFontFamilyTokens,
createGradientTokens,
createShadowTokens,
createShapeTokens,
createSpacingTokens,
createTypographyTokens,
} from '../creators';

import { generateIndex } from '.';

export const generateTheme = (outDir: string, themeSource: ThemeSource) => {
Expand All @@ -25,6 +26,7 @@ export const generateTheme = (outDir: string, themeSource: ThemeSource) => {
createGradientTokens(themeDir, variations.gradient, metaGrouped.gradient);
createShadowTokens(themeDir, variations.shadow, metaGrouped.shadow);
createShapeTokens(themeDir, variations.shape, metaGrouped.shape);
createSpacingTokens(themeDir, variations.spacing, metaGrouped.spacing);
createFontFamilyTokens(themeDir, variations.fontFamily, metaGrouped.fontFamily);
createTypographyTokens(themeDir, variations.typography, metaGrouped.typography);

Expand Down
12 changes: 7 additions & 5 deletions core/core-themes/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ export interface Variations<
T3 extends any = any,
T4 extends any = any,
T5 extends any = any,
T6 extends any = any
T6 extends any = any,
T7 extends any = any
> {
color: T1;
gradient: T2;
shape: T4;
shadow: T3;
typography: T5;
fontFamily: T6;
shape: T3;
spacing: T4;
shadow: T5;
typography: T6;
fontFamily: T7;
}

export type Variation = keyof Variations;
Expand Down
4 changes: 2 additions & 2 deletions libraries/plasma-b2c/platforms/mobile/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions libraries/plasma-b2c/platforms/mobile/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.9.0",
"version": "0.10.0",
"name": "@salutejs/plasma-b2c",
"description": "Plasma-b2c components library for native platform on mobile.",
"author": "Salute Frontend Team <salute.developers@gmail.com>",
Expand Down Expand Up @@ -32,8 +32,8 @@
"dependencies": {
"@expo/metro-runtime": "^3.2.1",
"@expo/vector-icons": "^14.0.0",
"@salutejs/core-components": "0.9.0",
"@salutejs/plasma-themes-native": "0.9.0",
"@salutejs/core-components": "0.10.0",
"@salutejs/plasma-themes-native": "0.10.0",
"@types/react": "~18.2.45",
"install": "^0.13.0",
"react": "^18.2.0",
Expand All @@ -50,7 +50,7 @@
"@react-native-community/datetimepicker": "8.0.1",
"@react-native-community/slider": "4.5.2",
"@react-native-tvos/config-tv": "^0.0.10",
"@salutejs/plasma-icons-native": "0.1.0",
"@salutejs/plasma-icons-native": "0.2.0",
"@storybook/addon-ondevice-actions": "^7.6.16",
"@storybook/addon-ondevice-controls": "^7.6.16",
"@storybook/addon-ondevice-notes": "^7.6.19",
Expand Down
4 changes: 2 additions & 2 deletions libraries/plasma-b2c/platforms/tv/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions libraries/plasma-b2c/platforms/tv/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.9.0",
"version": "0.10.0",
"name": "@salutejs/plasma-b2c",
"description": "Plasma-b2c components library for native platform on tv.",
"author": "Salute Frontend Team <salute.developers@gmail.com>",
Expand Down Expand Up @@ -38,8 +38,8 @@
}
},
"dependencies": {
"@salutejs/core-components": "0.9.0",
"@salutejs/plasma-themes-native": "0.9.0",
"@salutejs/core-components": "0.10.0",
"@salutejs/plasma-themes-native": "0.10.0",
"@types/react": "18.2.45",
"install": "^0.13.0",
"react": "^18.2.0",
Expand All @@ -56,7 +56,7 @@
"@react-native-community/datetimepicker": "8.0.1",
"@react-native-community/slider": "4.5.2",
"@react-native-tvos/config-tv": "^0.0.10",
"@salutejs/plasma-icons-native": "0.1.0",
"@salutejs/plasma-icons-native": "0.2.0",
"@storybook/addon-ondevice-actions": "^7.6.16",
"@storybook/addon-ondevice-controls": "^7.6.16",
"@storybook/addon-ondevice-notes": "^7.6.19",
Expand Down
4 changes: 2 additions & 2 deletions libraries/star-ds/platforms/mobile/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions libraries/star-ds/platforms/mobile/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.7.0",
"version": "0.8.0",
"name": "@salutejs/star-ds",
"description": "Star-ds components library for native platform on mobile.",
"author": "Salute Frontend Team <salute.developers@gmail.com>",
Expand Down Expand Up @@ -32,8 +32,8 @@
"dependencies": {
"@expo/metro-runtime": "^3.2.1",
"@expo/vector-icons": "^14.0.0",
"@salutejs/core-components": "0.9.0",
"@salutejs/plasma-themes-native": "0.9.0",
"@salutejs/core-components": "0.10.0",
"@salutejs/plasma-themes-native": "0.10.0",
"@types/react": "~18.2.45",
"install": "^0.13.0",
"react": "^18.2.0",
Expand All @@ -50,7 +50,7 @@
"@react-native-community/datetimepicker": "8.0.1",
"@react-native-community/slider": "4.5.2",
"@react-native-tvos/config-tv": "^0.0.10",
"@salutejs/plasma-icons-native": "0.1.0",
"@salutejs/plasma-icons-native": "0.2.0",
"@storybook/addon-ondevice-actions": "^7.6.16",
"@storybook/addon-ondevice-controls": "^7.6.16",
"@storybook/addon-ondevice-notes": "^7.6.19",
Expand Down
4 changes: 2 additions & 2 deletions libraries/star-ds/platforms/tv/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions libraries/star-ds/platforms/tv/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.7.0",
"version": "0.8.0",
"name": "@salutejs/star-ds",
"description": "Star-ds components library for native platform on tv.",
"author": "Salute Frontend Team <salute.developers@gmail.com>",
Expand Down Expand Up @@ -38,8 +38,8 @@
}
},
"dependencies": {
"@salutejs/core-components": "0.9.0",
"@salutejs/plasma-themes-native": "0.9.0",
"@salutejs/core-components": "0.10.0",
"@salutejs/plasma-themes-native": "0.10.0",
"@types/react": "18.2.45",
"install": "^0.13.0",
"react": "^18.2.0",
Expand All @@ -56,7 +56,7 @@
"@react-native-community/datetimepicker": "8.0.1",
"@react-native-community/slider": "4.5.2",
"@react-native-tvos/config-tv": "^0.0.10",
"@salutejs/plasma-icons-native": "0.1.0",
"@salutejs/plasma-icons-native": "0.2.0",
"@storybook/addon-ondevice-actions": "^7.6.16",
"@storybook/addon-ondevice-controls": "^7.6.16",
"@storybook/addon-ondevice-notes": "^7.6.19",
Expand Down
4 changes: 2 additions & 2 deletions packages/plasma-icons/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/plasma-icons/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.1.0",
"version": "0.2.0",
"name": "@salutejs/plasma-icons-native",
"description": "Plasma-icons package for native platform.",
"author": "Salute Frontend Team <salute.developers@gmail.com>",
Expand All @@ -23,11 +23,11 @@
"devDependencies": {
"@types/node": "16.7.13",
"@types/react": "18.2.45",
"ts-node": "10.2.1",
"typescript": "4.2.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-native": "0.74.5"
"react-native": "0.74.5",
"ts-node": "10.2.1",
"typescript": "4.2.4"
},
"dependencies": {
"react-native-svg": "15.2.0"
Expand Down
4 changes: 2 additions & 2 deletions themes/plasma-themes/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions themes/plasma-themes/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.9.0",
"version": "0.10.0",
"name": "@salutejs/plasma-themes-native",
"description": "Plasma-themes package for native platform.",
"author": "Salute Frontend Team <salute.developers@gmail.com>",
Expand All @@ -22,7 +22,7 @@
"build"
],
"dependencies": {
"@salutejs/core-themes-native": "0.9.0"
"@salutejs/core-themes-native": "0.10.0"
},
"devDependencies": {
"@types/node": "16.7.13",
Expand Down
Loading
Loading