@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.
Files changed (41) hide show
  1. package/LICENSE +1 -1
  2. package/dist/patterns/CheckerDense.js +39 -32
  3. package/dist/patterns/CheckerLoose.js +39 -32
  4. package/dist/patterns/CheckerRegular.js +39 -32
  5. package/dist/patterns/DiagonalADense.js +73 -66
  6. package/dist/patterns/DiagonalALoose.js +217 -210
  7. package/dist/patterns/DiagonalARegular.js +121 -114
  8. package/dist/patterns/DiagonalBDense.js +55 -48
  9. package/dist/patterns/DiagonalBLoose.js +123 -116
  10. package/dist/patterns/DiagonalBRegular.js +79 -72
  11. package/dist/patterns/DotDense.js +34 -27
  12. package/dist/patterns/DotLoose.js +77 -70
  13. package/dist/patterns/DotRegular.js +34 -27
  14. package/dist/patterns/ExDense.js +56 -49
  15. package/dist/patterns/ExLoose.js +56 -49
  16. package/dist/patterns/ExRegular.js +56 -49
  17. package/dist/patterns/FlowerDense.js +50 -43
  18. package/dist/patterns/FlowerLoose.js +50 -43
  19. package/dist/patterns/FlowerRegular.js +50 -43
  20. package/dist/patterns/GridDense.js +49 -42
  21. package/dist/patterns/GridLoose.js +49 -42
  22. package/dist/patterns/GridRegular.js +49 -42
  23. package/dist/patterns/Herringbone.js +67 -60
  24. package/dist/patterns/RainDense.js +39 -32
  25. package/dist/patterns/RainLoose.js +39 -32
  26. package/dist/patterns/RainRegular.js +39 -32
  27. package/dist/patterns/StripeDense.js +71 -64
  28. package/dist/patterns/StripeLoose.js +203 -196
  29. package/dist/patterns/StripeRegular.js +115 -108
  30. package/dist/types.js +1 -0
  31. package/dist/usePatternId.js +4 -6
  32. package/package.json +16 -17
  33. package/.svgo.yml +0 -11
  34. package/CHANGELOG.md +0 -329
  35. package/babel.config.js +0 -5
  36. package/emotion-plugin.js +0 -46
  37. package/index-template.js +0 -10
  38. package/jest.config.js +0 -1
  39. package/pattern-template.js +0 -30
  40. package/svgr.config.js +0 -29
  41. 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');
@@ -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
- };
package/tsconfig.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "include": [
4
- "../../typings/*.d.ts",
5
- "./src/**/*.ts",
6
- "./src/**/*.tsx",
7
- "../gamut-styles/dist/typings/theme.d.ts"
8
- ],
9
- "compilerOptions": {
10
- "outDir": "./dist"
11
- }
12
- }