@codecademy/gamut-patterns 1.0.0-alpha.f6cb5a.0 → 67.0.0-alpha.387605.0
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/LICENSE +1 -1
- package/dist/patterns/CheckerDense.js +39 -32
- package/dist/patterns/CheckerLoose.js +39 -32
- package/dist/patterns/CheckerRegular.js +39 -32
- package/dist/patterns/DiagonalADense.js +73 -66
- package/dist/patterns/DiagonalALoose.js +217 -210
- package/dist/patterns/DiagonalARegular.js +121 -114
- package/dist/patterns/DiagonalBDense.js +55 -48
- package/dist/patterns/DiagonalBLoose.js +123 -116
- package/dist/patterns/DiagonalBRegular.js +79 -72
- package/dist/patterns/DotDense.js +34 -27
- package/dist/patterns/DotLoose.js +77 -70
- package/dist/patterns/DotRegular.js +34 -27
- package/dist/patterns/ExDense.js +56 -49
- package/dist/patterns/ExLoose.js +56 -49
- package/dist/patterns/ExRegular.js +56 -49
- package/dist/patterns/FlowerDense.js +50 -43
- package/dist/patterns/FlowerLoose.js +50 -43
- package/dist/patterns/FlowerRegular.js +50 -43
- package/dist/patterns/GridDense.js +49 -42
- package/dist/patterns/GridLoose.js +49 -42
- package/dist/patterns/GridRegular.js +49 -42
- package/dist/patterns/Herringbone.js +67 -60
- package/dist/patterns/RainDense.js +39 -32
- package/dist/patterns/RainLoose.js +39 -32
- package/dist/patterns/RainRegular.js +39 -32
- package/dist/patterns/StripeDense.js +71 -64
- package/dist/patterns/StripeLoose.js +203 -196
- package/dist/patterns/StripeRegular.js +115 -108
- package/dist/types.js +1 -0
- package/dist/usePatternId.js +4 -6
- package/package.json +16 -17
- package/.svgo.yml +0 -11
- package/CHANGELOG.md +0 -329
- package/babel.config.js +0 -5
- package/emotion-plugin.js +0 -46
- package/index-template.js +0 -10
- package/jest.config.js +0 -1
- package/pattern-template.js +0 -30
- package/svgr.config.js +0 -29
- package/tsconfig.json +0 -12
package/emotion-plugin.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const plugin = (api) => {
|
|
2
|
-
const vistor = {
|
|
3
|
-
JSXElement(path) {
|
|
4
|
-
// We only want to find SVG element
|
|
5
|
-
if (path.get('openingElement.name').isJSXIdentifier({ name: 'svg' })) {
|
|
6
|
-
// Update the opening and closing tags to the styled component identifier
|
|
7
|
-
const emotionTag = api.types.jsxIdentifier('Svg');
|
|
8
|
-
path.get('openingElement.name').replaceWith(emotionTag);
|
|
9
|
-
path.get('closingElement.name').replaceWith(emotionTag);
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
JSXAttribute(path) {
|
|
13
|
-
const valuePath = path.get('value');
|
|
14
|
-
const attrName = path.get('name').toString();
|
|
15
|
-
if (attrName === 'id' && valuePath.isStringLiteral()) {
|
|
16
|
-
valuePath.replaceWith(
|
|
17
|
-
api.types.jsxExpressionContainer(
|
|
18
|
-
api.template.ast('patternId').expression
|
|
19
|
-
)
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
attrName === 'fill' &&
|
|
25
|
-
valuePath.isStringLiteral() &&
|
|
26
|
-
valuePath.toString().includes('url')
|
|
27
|
-
) {
|
|
28
|
-
valuePath.replaceWith(
|
|
29
|
-
api.types.jsxExpressionContainer(
|
|
30
|
-
api.template.ast('`url(#${patternId})`').expression
|
|
31
|
-
)
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
visitor: {
|
|
39
|
-
Program(path) {
|
|
40
|
-
path.traverse(vistor);
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
module.exports = plugin;
|
package/index-template.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
function indexTemplate(files) {
|
|
4
|
-
const exportEntries = files.map((file) => {
|
|
5
|
-
const basename = path.basename(file, path.extname(file));
|
|
6
|
-
return `export * from './${basename}';`;
|
|
7
|
-
});
|
|
8
|
-
return exportEntries.join('\n');
|
|
9
|
-
}
|
|
10
|
-
module.exports = indexTemplate;
|
package/jest.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('../../jest.config.base')('gamut-patterns');
|
package/pattern-template.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const { startCase } = require('lodash');
|
|
3
|
-
|
|
4
|
-
function patternTemplate(api, opts, { jsx }) {
|
|
5
|
-
const template = api.template.smart({ plugins: ['jsx', 'typescript'] });
|
|
6
|
-
const { componentName, filePath } = opts.state;
|
|
7
|
-
const exportName = componentName.replace('Svg', '');
|
|
8
|
-
const title = startCase(path.basename(filePath, '.svg'));
|
|
9
|
-
|
|
10
|
-
return template.ast`
|
|
11
|
-
import * as React from 'react';
|
|
12
|
-
import { Svg, PatternProps } from '../props';
|
|
13
|
-
import { usePatternId } from '../usePatternId';
|
|
14
|
-
|
|
15
|
-
export const ${exportName} = React.forwardRef<SVGSVGElement, PatternProps>(({
|
|
16
|
-
title = "${title}",
|
|
17
|
-
titleId,
|
|
18
|
-
...props
|
|
19
|
-
},
|
|
20
|
-
svgRef
|
|
21
|
-
) => {
|
|
22
|
-
const patternId = usePatternId('${exportName}');
|
|
23
|
-
|
|
24
|
-
return ${jsx};
|
|
25
|
-
}) as React.ForwardRefExoticComponent<
|
|
26
|
-
PatternProps & React.RefAttributes<SVGSVGElement>
|
|
27
|
-
>;
|
|
28
|
-
`;
|
|
29
|
-
}
|
|
30
|
-
module.exports = patternTemplate;
|
package/svgr.config.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const emotionPlugin = require('./emotion-plugin');
|
|
2
|
-
const template = require('./pattern-template');
|
|
3
|
-
const indexTemplate = require('./index-template');
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
dimensions: false,
|
|
7
|
-
titleProp: true,
|
|
8
|
-
ref: true,
|
|
9
|
-
svgProps: {
|
|
10
|
-
fill: 'currentColor',
|
|
11
|
-
role: 'img',
|
|
12
|
-
'aria-hidden': 'true',
|
|
13
|
-
},
|
|
14
|
-
prettierConfig: {
|
|
15
|
-
parser: 'typescript',
|
|
16
|
-
},
|
|
17
|
-
replaceAttrValues: {
|
|
18
|
-
'#000': 'currentColor',
|
|
19
|
-
'#111': 'currentColor',
|
|
20
|
-
'#444': 'currentColor',
|
|
21
|
-
},
|
|
22
|
-
jsx: {
|
|
23
|
-
babelConfig: {
|
|
24
|
-
plugins: [emotionPlugin],
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
indexTemplate,
|
|
28
|
-
template,
|
|
29
|
-
};
|