@ptsecurity/mosaic 13.6.2 → 13.7.1
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/_theming.scss +103 -6
- package/_visual.scss +30 -1
- package/design-tokens/legacy-2017/tokens/components/loader-overlay.json5 +23 -0
- package/design-tokens/legacy-2017/tokens/properties/globals.json5 +18 -18
- package/design-tokens/legacy-2017/tokens.d.ts +29 -0
- package/design-tokens/pt-2022/tokens/components/badge.json5 +1 -1
- package/design-tokens/pt-2022/tokens/components/loader-overlay.json5 +23 -0
- package/design-tokens/pt-2022/tokens/properties/globals.json5 +18 -18
- package/design-tokens/pt-2022/tokens.d.ts +30 -1
- package/design-tokens/style-dictionary/build.js +13 -0
- package/design-tokens/style-dictionary/configs/figma.js +11 -0
- package/design-tokens/style-dictionary/configs/index.js +3 -3
- package/design-tokens/style-dictionary/formats/figma.js +104 -0
- package/design-tokens/style-dictionary/transformGroups/figma.js +21 -0
- package/design-tokens/style-dictionary/transforms/attribute/figma-border.js +18 -0
- package/design-tokens/style-dictionary/transforms/attribute/figma-color.js +25 -0
- package/design-tokens/style-dictionary/transforms/attribute/figma-default.js +10 -0
- package/design-tokens/style-dictionary/transforms/attribute/figma-font.js +31 -0
- package/design-tokens/style-dictionary/transforms/attribute/figma-group.js +17 -0
- package/design-tokens/style-dictionary/transforms/attribute/figma-opacity.js +10 -0
- package/design-tokens/style-dictionary/transforms/attribute/figma-shadow.js +66 -0
- package/design-tokens/style-dictionary/transforms/attribute/figma-sizing.js +16 -0
- package/design-tokens/style-dictionary/transforms/attribute/figma-spacing.js +15 -0
- package/design-tokens/style-dictionary/transforms/attribute/figma-typography.js +24 -0
- package/design-tokens/style-dictionary/transforms/value/figma-values.js +7 -0
- package/esm2020/design-tokens/legacy-2017/tokens.mjs +30 -1
- package/esm2020/design-tokens/pt-2022/tokens.mjs +31 -2
- package/esm2020/form-field/hint.mjs +18 -7
- package/esm2020/list/list-selection.component.mjs +4 -1
- package/esm2020/loader-overlay/index.mjs +2 -0
- package/esm2020/loader-overlay/loader-overlay.component.mjs +99 -0
- package/esm2020/loader-overlay/loader-overlay.module.mjs +50 -0
- package/esm2020/loader-overlay/ptsecurity-mosaic-loader-overlay.mjs +5 -0
- package/esm2020/loader-overlay/public-api.mjs +3 -0
- package/esm2020/modal/modal.component.mjs +11 -3
- package/esm2020/modal/modal.type.mjs +1 -1
- package/esm2020/navbar/navbar.component.mjs +6 -4
- package/esm2020/navbar/vertical-navbar.component.mjs +3 -3
- package/esm2020/progress-spinner/progress-spinner.component.mjs +2 -2
- package/esm2020/select/select.component.mjs +3 -3
- package/esm2020/tree/tree-selection.component.mjs +2 -1
- package/esm2020/tree-select/tree-select.component.mjs +3 -3
- package/fesm2015/ptsecurity-mosaic-design-tokens.mjs +89 -2
- package/fesm2015/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-form-field.mjs +16 -6
- package/fesm2015/ptsecurity-mosaic-form-field.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-list.mjs +3 -0
- package/fesm2015/ptsecurity-mosaic-list.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-loader-overlay.mjs +155 -0
- package/fesm2015/ptsecurity-mosaic-loader-overlay.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-modal.mjs +11 -2
- package/fesm2015/ptsecurity-mosaic-modal.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-navbar.mjs +6 -4
- package/fesm2015/ptsecurity-mosaic-navbar.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs +2 -2
- package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-select.mjs +2 -2
- package/fesm2015/ptsecurity-mosaic-select.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-tree-select.mjs +2 -2
- package/fesm2015/ptsecurity-mosaic-tree-select.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-tree.mjs +1 -0
- package/fesm2015/ptsecurity-mosaic-tree.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-design-tokens.mjs +89 -2
- package/fesm2020/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-form-field.mjs +16 -6
- package/fesm2020/ptsecurity-mosaic-form-field.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-list.mjs +3 -0
- package/fesm2020/ptsecurity-mosaic-list.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-loader-overlay.mjs +153 -0
- package/fesm2020/ptsecurity-mosaic-loader-overlay.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-modal.mjs +10 -2
- package/fesm2020/ptsecurity-mosaic-modal.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-navbar.mjs +6 -4
- package/fesm2020/ptsecurity-mosaic-navbar.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs +2 -2
- package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-select.mjs +2 -2
- package/fesm2020/ptsecurity-mosaic-select.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-tree-select.mjs +2 -2
- package/fesm2020/ptsecurity-mosaic-tree-select.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-tree.mjs +1 -0
- package/fesm2020/ptsecurity-mosaic-tree.mjs.map +1 -1
- package/form-field/hint.d.ts +10 -2
- package/loader-overlay/README.md +0 -0
- package/loader-overlay/index.d.ts +1 -0
- package/loader-overlay/loader-overlay.component.d.ts +33 -0
- package/loader-overlay/loader-overlay.module.d.ts +11 -0
- package/loader-overlay/package.json +10 -0
- package/loader-overlay/ptsecurity-mosaic-loader-overlay.d.ts +5 -0
- package/loader-overlay/public-api.d.ts +2 -0
- package/modal/modal.component.d.ts +3 -1
- package/modal/modal.type.d.ts +1 -0
- package/package.json +12 -4
- package/prebuilt-themes/dark-theme.css +1 -1
- package/prebuilt-themes/default-theme.css +1 -1
- package/schematics/collection.json +0 -4
- package/schematics/migration.json +0 -10
- package/schematics/ng-update/data/attribute-selectors.d.ts +0 -2
- package/schematics/ng-update/data/attribute-selectors.js +0 -5
- package/schematics/ng-update/data/attribute-selectors.js.map +0 -1
- package/schematics/ng-update/data/class-names.d.ts +0 -2
- package/schematics/ng-update/data/class-names.js +0 -5
- package/schematics/ng-update/data/class-names.js.map +0 -1
- package/schematics/ng-update/data/constructor-checks.d.ts +0 -2
- package/schematics/ng-update/data/constructor-checks.js +0 -5
- package/schematics/ng-update/data/constructor-checks.js.map +0 -1
- package/schematics/ng-update/data/css-selectors.d.ts +0 -2
- package/schematics/ng-update/data/css-selectors.js +0 -5
- package/schematics/ng-update/data/css-selectors.js.map +0 -1
- package/schematics/ng-update/data/element-selectors.d.ts +0 -2
- package/schematics/ng-update/data/element-selectors.js +0 -5
- package/schematics/ng-update/data/element-selectors.js.map +0 -1
- package/schematics/ng-update/data/index.d.ts +0 -10
- package/schematics/ng-update/data/index.js +0 -14
- package/schematics/ng-update/data/index.js.map +0 -1
- package/schematics/ng-update/data/input-names.d.ts +0 -2
- package/schematics/ng-update/data/input-names.js +0 -35
- package/schematics/ng-update/data/input-names.js.map +0 -1
- package/schematics/ng-update/data/method-call-checks.d.ts +0 -2
- package/schematics/ng-update/data/method-call-checks.js +0 -5
- package/schematics/ng-update/data/method-call-checks.js.map +0 -1
- package/schematics/ng-update/data/output-names.d.ts +0 -2
- package/schematics/ng-update/data/output-names.js +0 -5
- package/schematics/ng-update/data/output-names.js.map +0 -1
- package/schematics/ng-update/data/property-names.d.ts +0 -2
- package/schematics/ng-update/data/property-names.js +0 -5
- package/schematics/ng-update/data/property-names.js.map +0 -1
- package/schematics/ng-update/data/symbol-removal.d.ts +0 -2
- package/schematics/ng-update/data/symbol-removal.js +0 -5
- package/schematics/ng-update/data/symbol-removal.js.map +0 -1
- package/schematics/ng-update/index.d.ts +0 -2
- package/schematics/ng-update/index.js +0 -23
- package/schematics/ng-update/index.js.map +0 -1
- package/schematics/ng-update/update-9.0.0/mosaic-symbols.json +0 -255
- package/schematics/ng-update/update-9.0.0/secondary-entry-points-migration.d.ts +0 -7
- package/schematics/ng-update/update-9.0.0/secondary-entry-points-migration.js +0 -154
- package/schematics/ng-update/update-9.0.0/secondary-entry-points-migration.js.map +0 -1
- package/schematics/ng-update/upgrade-data.d.ts +0 -2
- package/schematics/ng-update/upgrade-data.js +0 -17
- package/schematics/ng-update/upgrade-data.js.map +0 -1
- package/schematics/tsconfig.json +0 -29
- package/schematics/tsconfig.lib-test.json +0 -8
- package/schematics/tsconfig.lib.json +0 -17
@@ -0,0 +1,104 @@
|
|
1
|
+
const { typographySingleTypes, figmaTypes } = require('../../figma-types');
|
2
|
+
const setProperty = require('lodash/set');
|
3
|
+
|
4
|
+
const JSON_INDENTATION = 2;
|
5
|
+
|
6
|
+
function buildTypography(tokens) {
|
7
|
+
return {
|
8
|
+
value: Object.entries(tokens).reduce(
|
9
|
+
(accum, [, item]) => {
|
10
|
+
const { value, attributes: { figmaPropType }} = item;
|
11
|
+
accum[figmaPropType] = cleanValue(value);
|
12
|
+
|
13
|
+
return accum;
|
14
|
+
},
|
15
|
+
{}
|
16
|
+
),
|
17
|
+
type: figmaTypes.typography
|
18
|
+
};
|
19
|
+
}
|
20
|
+
|
21
|
+
function rebuildTokes(tokens, parentCategory = null) {
|
22
|
+
if (tokens.value === undefined) {
|
23
|
+
const firstItemType = Object.values(tokens)[0] ?.attributes?.figmaPropType;
|
24
|
+
if (Object.values(typographySingleTypes).includes(firstItemType)) {
|
25
|
+
return buildTypography(tokens);
|
26
|
+
}
|
27
|
+
|
28
|
+
return Object.entries(tokens).reduce(
|
29
|
+
(accum, [tokenKey, tokenValue]) => {
|
30
|
+
accum[tokenKey] = cleanValue(rebuildTokes(tokenValue, parentCategory));
|
31
|
+
|
32
|
+
return accum;
|
33
|
+
},
|
34
|
+
{}
|
35
|
+
);
|
36
|
+
}
|
37
|
+
|
38
|
+
if (typeof tokens.value === 'object') {
|
39
|
+
return rebuildTokes(tokens.value, tokens.attributes.category);
|
40
|
+
}
|
41
|
+
|
42
|
+
let { category, figmaPropType, figmaValue, figmaLink } = tokens.attributes;
|
43
|
+
const { original } = tokens;
|
44
|
+
figmaValue = figmaLink ? `{${figmaValue}}` : figmaValue;
|
45
|
+
let value = figmaValue ?? original.value;
|
46
|
+
|
47
|
+
if (parentCategory && category !== parentCategory) {
|
48
|
+
value = buildRefFromAttributes(tokens.attributes);
|
49
|
+
}
|
50
|
+
|
51
|
+
return { value: cleanValue(value), type: figmaPropType };
|
52
|
+
}
|
53
|
+
|
54
|
+
function cleanValue(value) {
|
55
|
+
return typeof value === 'string' ? value.replaceAll('.value.', '.') : value;
|
56
|
+
}
|
57
|
+
|
58
|
+
function buildRefFromAttributes(attributes) {
|
59
|
+
const { category, type, item, subitem } = attributes;
|
60
|
+
const ref = [category, type, item, subitem].filter((refPart) => !!refPart);
|
61
|
+
|
62
|
+
return `{${ref.join('.')}}`;
|
63
|
+
}
|
64
|
+
|
65
|
+
function findLastLeafAttributes(property) {
|
66
|
+
if (!property.attributes) {
|
67
|
+
return findLastLeafAttributes(property[Object.keys(property)[0]]);
|
68
|
+
}
|
69
|
+
|
70
|
+
return property.attributes;
|
71
|
+
}
|
72
|
+
|
73
|
+
function prepareFigmaTitle(value) {
|
74
|
+
return value
|
75
|
+
.replaceAll('-', ' ')
|
76
|
+
.split(' ')
|
77
|
+
.map((titlePart) => titlePart.charAt(0).toUpperCase() + titlePart.slice(1))
|
78
|
+
.join(' ');
|
79
|
+
}
|
80
|
+
|
81
|
+
module.exports = (styleDictionary) => {
|
82
|
+
styleDictionary.registerFormat({
|
83
|
+
name: 'figmaTokensPlugin',
|
84
|
+
formatter: ({ dictionary }) => {
|
85
|
+
const groupedDict = Object.entries(dictionary.tokens)
|
86
|
+
.filter(([, propValue]) => typeof propValue === 'object')
|
87
|
+
.reduce(
|
88
|
+
(accum, [propName, propValue]) => {
|
89
|
+
const { group, subgroup } = findLastLeafAttributes(propValue);
|
90
|
+
const propPath = group === 'properties'
|
91
|
+
? `${prepareFigmaTitle(group)}.${propName}`
|
92
|
+
: `${prepareFigmaTitle(subgroup)}.${propName}`;
|
93
|
+
setProperty(accum, propPath, propValue);
|
94
|
+
|
95
|
+
return accum;
|
96
|
+
},
|
97
|
+
{}
|
98
|
+
);
|
99
|
+
const figmaTokens = rebuildTokes(groupedDict);
|
100
|
+
|
101
|
+
return JSON.stringify(figmaTokens, null, JSON_INDENTATION);
|
102
|
+
}
|
103
|
+
});
|
104
|
+
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module.exports = (StyleDictionary) => {
|
2
|
+
|
3
|
+
StyleDictionary.registerTransformGroup({
|
4
|
+
name: 'mc/figma',
|
5
|
+
transforms: [
|
6
|
+
'attribute/cti',
|
7
|
+
"name/cti/kebab",
|
8
|
+
'mc-attribute/figma-group',
|
9
|
+
'mc-attribute/figma-border',
|
10
|
+
'mc-attribute/figma-typography',
|
11
|
+
'mc-attribute/figma-font',
|
12
|
+
'mc-attribute/figma-opacity',
|
13
|
+
'mc-attribute/figma-spacing',
|
14
|
+
'mc-attribute/figma-sizing',
|
15
|
+
'mc-attribute/figma-shadow',
|
16
|
+
'mc-attribute/figma-color',
|
17
|
+
'mc-attribute/figma-default',
|
18
|
+
'mc-value/figma-values',
|
19
|
+
]
|
20
|
+
});
|
21
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
const { figmaTypes } = require('../../../figma-types');
|
2
|
+
|
3
|
+
module.exports = (styleDictionary) => {
|
4
|
+
styleDictionary.registerTransform({
|
5
|
+
name: 'mc-attribute/figma-border',
|
6
|
+
type: 'attribute',
|
7
|
+
matcher: ({ name, attributes }) => name.includes('border') && !attributes.figmaPropType,
|
8
|
+
transformer: ({ name, attributes }) => {
|
9
|
+
const props = {
|
10
|
+
width: figmaTypes.borderWidth,
|
11
|
+
radius: figmaTypes.borderRadius
|
12
|
+
};
|
13
|
+
const entry = Object.entries(props).find(([key]) => name.includes(key));
|
14
|
+
|
15
|
+
return entry ? { figmaPropType: entry[1] } : attributes;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
const { figmaTypes } = require('../../../figma-types');
|
2
|
+
|
3
|
+
const COLOR_MAX_PARTS = 4;
|
4
|
+
|
5
|
+
module.exports = (styleDictionary) => {
|
6
|
+
styleDictionary.registerTransform({
|
7
|
+
name: 'mc-attribute/figma-color',
|
8
|
+
type: 'attribute',
|
9
|
+
matcher: ({name, value, attributes: { category, figmaPropType }}) => {
|
10
|
+
if (figmaPropType) {
|
11
|
+
return false;
|
12
|
+
}
|
13
|
+
|
14
|
+
const stringValue = value.toString();
|
15
|
+
const isColorValue = (
|
16
|
+
stringValue.startsWith('#') ||
|
17
|
+
stringValue.startsWith('rgba') ||
|
18
|
+
name.includes('color')
|
19
|
+
) && stringValue.split(' ').length <= COLOR_MAX_PARTS;
|
20
|
+
|
21
|
+
return isColorValue || category === 'palette';
|
22
|
+
},
|
23
|
+
transformer: () => ({ figmaPropType: figmaTypes.color })
|
24
|
+
});
|
25
|
+
};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
const { figmaTypes } = require('../../../figma-types');
|
2
|
+
|
3
|
+
module.exports = (styleDictionary) => {
|
4
|
+
styleDictionary.registerTransform({
|
5
|
+
name: 'mc-attribute/figma-default',
|
6
|
+
type: 'attribute',
|
7
|
+
matcher: ({ attributes }) => !attributes.figmaPropType,
|
8
|
+
transformer: () => ({ figmaPropType: figmaTypes.other })
|
9
|
+
});
|
10
|
+
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
const { figmaTypes } = require('../../../figma-types');
|
2
|
+
|
3
|
+
module.exports = (styleDictionary) => {
|
4
|
+
styleDictionary.registerTransform({
|
5
|
+
name: 'mc-attribute/figma-font',
|
6
|
+
type: 'attribute',
|
7
|
+
matcher: ({ name, attributes }) => name.includes('font') && !attributes.figmaPropType,
|
8
|
+
transformer: ({ name, value }) => {
|
9
|
+
const props = {
|
10
|
+
family: figmaTypes.fontFamilies,
|
11
|
+
size: figmaTypes.fontSizes,
|
12
|
+
weight: figmaTypes.fontWeights,
|
13
|
+
height: figmaTypes.lineHeights,
|
14
|
+
spacing: figmaTypes.letterSpacing,
|
15
|
+
transform: figmaTypes.textCase,
|
16
|
+
settings: figmaTypes.fontFeatureSettings
|
17
|
+
};
|
18
|
+
const [, typeName] = Object.entries(props).find(([key]) => name.includes(key)) ?? [];
|
19
|
+
|
20
|
+
if (!typeName) {
|
21
|
+
return {
|
22
|
+
figmaPropType: 'typography',
|
23
|
+
figmaValue: `typography.${value}`,
|
24
|
+
figmaLink: true
|
25
|
+
};
|
26
|
+
}
|
27
|
+
|
28
|
+
return { figmaPropType: typeName };
|
29
|
+
}
|
30
|
+
});
|
31
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
|
3
|
+
const GROUP_BACK_STEP_INDEX = 2;
|
4
|
+
|
5
|
+
module.exports = (styleDictionary) => {
|
6
|
+
styleDictionary.registerTransform({
|
7
|
+
name: 'mc-attribute/figma-group',
|
8
|
+
type: 'attribute',
|
9
|
+
transformer: (prop) => {
|
10
|
+
const filePathParts = prop.filePath.split('/');
|
11
|
+
const group = filePathParts[filePathParts.length - GROUP_BACK_STEP_INDEX];
|
12
|
+
const subgroup = path.parse(prop.filePath).name;
|
13
|
+
|
14
|
+
return { group, subgroup };
|
15
|
+
}
|
16
|
+
});
|
17
|
+
};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
const { figmaTypes } = require('../../../figma-types');
|
2
|
+
|
3
|
+
module.exports = (styleDictionary) => {
|
4
|
+
styleDictionary.registerTransform({
|
5
|
+
name: 'mc-attribute/figma-opacity',
|
6
|
+
type: 'attribute',
|
7
|
+
matcher: ({ name, attributes }) => name.includes('opacity') && !attributes.figmaPropType,
|
8
|
+
transformer: () => ({ figmaPropType: figmaTypes.opacity })
|
9
|
+
});
|
10
|
+
};
|
@@ -0,0 +1,66 @@
|
|
1
|
+
const { figmaTypes } = require('../../../figma-types');
|
2
|
+
|
3
|
+
const BLUR_SHADOW_INDEX = 2;
|
4
|
+
const SPREAD_SHADOW_INDEX = 3;
|
5
|
+
const X_SHADOW_INDEX = 0;
|
6
|
+
const Y_SHADOW_INDEX = 1;
|
7
|
+
const SHADOW_MIN_PARTS = 4;
|
8
|
+
|
9
|
+
function transformShadow(value) {
|
10
|
+
const isInnerShadow = value.includes('inset');
|
11
|
+
const valueParts = value.split(' ');
|
12
|
+
|
13
|
+
if (isInnerShadow) {
|
14
|
+
valueParts.shift();
|
15
|
+
}
|
16
|
+
|
17
|
+
return {
|
18
|
+
color: valueParts.pop(),
|
19
|
+
type: isInnerShadow ? 'innerShadow' : 'dropShadow',
|
20
|
+
x: valueParts[X_SHADOW_INDEX] ?? 0,
|
21
|
+
y: valueParts[Y_SHADOW_INDEX] ?? 0,
|
22
|
+
blur: valueParts[BLUR_SHADOW_INDEX] ?? 0,
|
23
|
+
spread: valueParts[SPREAD_SHADOW_INDEX] ?? 0
|
24
|
+
};
|
25
|
+
}
|
26
|
+
|
27
|
+
module.exports = (styleDictionary) => {
|
28
|
+
styleDictionary.registerTransform({
|
29
|
+
name: 'mc-attribute/figma-shadow',
|
30
|
+
type: 'attribute',
|
31
|
+
matcher: ({name, value, attributes }) => (
|
32
|
+
name.includes('shadow') &&
|
33
|
+
value.split(' ').length > SHADOW_MIN_PARTS &&
|
34
|
+
!attributes.figmaPropType
|
35
|
+
),
|
36
|
+
transformer: ({ value }) => {
|
37
|
+
const rgbaGroups = [];
|
38
|
+
let figmaValue = value;
|
39
|
+
|
40
|
+
const check = figmaValue.match(/(rgba\([\w\d\. \,]+\))/) ?? [];
|
41
|
+
|
42
|
+
for (let i = 1; i < check.length; i++) {
|
43
|
+
figmaValue = figmaValue.replace(check[i], `rgba${i - 1}`);
|
44
|
+
rgbaGroups.push(check[i]);
|
45
|
+
}
|
46
|
+
|
47
|
+
const shadowParts = figmaValue.split(',');
|
48
|
+
figmaValue = shadowParts.length > 1
|
49
|
+
? shadowParts.map(transformShadow)
|
50
|
+
: transformShadow(figmaValue);
|
51
|
+
|
52
|
+
rgbaGroups.forEach((rgbaValue, rgbaIndex) => {
|
53
|
+
if (Array.isArray(figmaValue)) {
|
54
|
+
figmaValue.forEach((shadow) => {
|
55
|
+
shadow.color = shadow.color.replace(`rgba${rgbaIndex}`, rgbaValue);
|
56
|
+
});
|
57
|
+
|
58
|
+
return;
|
59
|
+
}
|
60
|
+
figmaValue.color = figmaValue.color.replace(`rgba${rgbaIndex}`, rgbaValue);
|
61
|
+
});
|
62
|
+
|
63
|
+
return { figmaPropType: figmaTypes.boxShadow, figmaValue };
|
64
|
+
}
|
65
|
+
});
|
66
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
const { figmaTypes } = require('../../../figma-types');
|
2
|
+
|
3
|
+
module.exports = (styleDictionary) => {
|
4
|
+
styleDictionary.registerTransform({
|
5
|
+
name: 'mc-attribute/figma-sizing',
|
6
|
+
type: 'attribute',
|
7
|
+
matcher: ({name, attributes}) => (
|
8
|
+
(
|
9
|
+
name.includes('height') ||
|
10
|
+
name.includes('width') ||
|
11
|
+
name.includes('size')
|
12
|
+
) && !attributes.figmaPropType
|
13
|
+
),
|
14
|
+
transformer: () => ({ figmaPropType: figmaTypes.sizing })
|
15
|
+
});
|
16
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
const { figmaTypes } = require('../../../figma-types');
|
2
|
+
|
3
|
+
module.exports = (styleDictionary) => {
|
4
|
+
styleDictionary.registerTransform({
|
5
|
+
name: 'mc-attribute/figma-spacing',
|
6
|
+
type: 'attribute',
|
7
|
+
matcher: ({name, attributes}) => (
|
8
|
+
(
|
9
|
+
name.includes('padding') ||
|
10
|
+
name.includes('margin')
|
11
|
+
) && !attributes.figmaPropType
|
12
|
+
),
|
13
|
+
transformer: (() => ({ figmaPropType: figmaTypes.spacing }))
|
14
|
+
});
|
15
|
+
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
const { figmaTypes } = require('../../../figma-types');
|
2
|
+
|
3
|
+
module.exports = (styleDictionary) => {
|
4
|
+
styleDictionary.registerTransform({
|
5
|
+
name: 'mc-attribute/figma-typography',
|
6
|
+
type: 'attribute',
|
7
|
+
matcher: ({ name, attributes}) => name.includes('typography') && !attributes.figmaPropType,
|
8
|
+
transformer: ({ name, attributes }) => {
|
9
|
+
const props = {
|
10
|
+
spacing: figmaTypes.letterSpacing,
|
11
|
+
transform: figmaTypes.textCase,
|
12
|
+
settings: figmaTypes.fontFeatureSettings,
|
13
|
+
family: figmaTypes.fontFamily,
|
14
|
+
size: figmaTypes.fontSize,
|
15
|
+
weight: figmaTypes.fontWeight,
|
16
|
+
height: figmaTypes.lineHeight
|
17
|
+
};
|
18
|
+
|
19
|
+
const entry = Object.entries(props).find(([key]) => name.includes(key));
|
20
|
+
|
21
|
+
return entry ? { figmaPropType: entry[1] } : attributes;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
};
|