@onereach/styles 2.9.9 → 2.9.10-beta.774.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/styles",
3
- "version": "2.9.9",
3
+ "version": "2.9.10-beta.774.0",
4
4
  "description": "Styles for or-ui-next",
5
5
  "main": "./main.css",
6
6
  "unpkg": "./main.css",
@@ -44,6 +44,5 @@
44
44
  "dependencies": {
45
45
  "@tailwindcss/typography": "^0.5.4",
46
46
  "tailwindcss": "^3.1.3"
47
- },
48
- "gitHead": "f8a686f695442e8a89f1d051e57d763dba924065"
47
+ }
49
48
  }
@@ -470,15 +470,15 @@
470
470
  ],
471
471
  "BorderRadiuses" : [
472
472
  {
473
- "name" : "radius-2",
473
+ "name" : "sm",
474
474
  "value" : "2px"
475
475
  },
476
476
  {
477
- "name" : "radius-4",
477
+ "name" : "md",
478
478
  "value" : "4px"
479
479
  },
480
480
  {
481
- "name" : "radius-8",
481
+ "name" : "lg",
482
482
  "value" : "8px"
483
483
  }
484
484
  ],
@@ -638,7 +638,7 @@
638
638
  "value" : "0px"
639
639
  },
640
640
  {
641
- "name" : "2-xs",
641
+ "name" : "2xs",
642
642
  "value" : "2px"
643
643
  },
644
644
  {
@@ -658,11 +658,11 @@
658
658
  "value" : "32px"
659
659
  },
660
660
  {
661
- "name" : "3-xl",
661
+ "name" : "3xl",
662
662
  "value" : "64px"
663
663
  },
664
664
  {
665
- "name" : "4-xl",
665
+ "name" : "4xl",
666
666
  "value" : "128px"
667
667
  },
668
668
  {
@@ -670,7 +670,7 @@
670
670
  "value" : "24px"
671
671
  },
672
672
  {
673
- "name" : "2-xl",
673
+ "name" : "2xl",
674
674
  "value" : "48px"
675
675
  }
676
676
  ]
package/tailwind-utils.js CHANGED
@@ -1,11 +1,6 @@
1
1
  module.exports = {
2
2
  parseSpacingTokens(designTokens) {
3
3
  return Object.values(designTokens)
4
- .map(({ value }) => value)
5
- .map((value) => ({
6
- name: value.slice(0, -2),
7
- value,
8
- }))
9
4
  .reduce((preset, { name, value }) => ({
10
5
  ...preset,
11
6
  [name]: value,
@@ -38,13 +33,12 @@ module.exports = {
38
33
  return Object.values(designTokens)
39
34
  .map(({ name, value }) => ({
40
35
  ...name.match(/^(?:(?<theme>light|dark)-)?(?<name>.+)$/).groups,
41
- value,
36
+ value: value.replace(/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/, 'rgba($1 $2 $3 / $4)'),
42
37
  }))
43
- .map(({ name, theme, value }) => ({
38
+ .map(({ name, ...props }) => ({
44
39
  name,
45
- theme,
46
- value: value.replace(/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/, 'rgba($1 $2 $3 / $4)'),
47
40
  group: defineColorGroup(name),
41
+ ...props,
48
42
  }))
49
43
  .filter(({ group }) => colorGroups.includes(group))
50
44
  .reduce((preset, { name, theme, value }) => ({
@@ -53,28 +47,8 @@ module.exports = {
53
47
  }), {});
54
48
  },
55
49
 
56
- parseTypographyTokens(designTokens) {
57
- return Object.values(designTokens)
58
- .map(({ name, fontFamily, fontWeight, fontSizeRem, lineHeightRem }) => ({
59
- name,
60
- fontFamily,
61
- fontWeight,
62
- fontSize: `${fontSizeRem}rem`,
63
- lineHeight: `${lineHeightRem}rem`,
64
- }))
65
- .reduce((preset, { name, ...css }) => ({
66
- ...preset,
67
- [name]: { css },
68
- }), {});
69
- },
70
-
71
50
  parseBorderRadiusTokens(designTokens) {
72
51
  return Object.values(designTokens)
73
- .map(({ value }) => value)
74
- .map((value) => ({
75
- name: value.slice(0, -2),
76
- value: value,
77
- }))
78
52
  .reduce((preset, { name, value }) => ({
79
53
  ...preset,
80
54
  [name]: value,
@@ -86,7 +60,7 @@ module.exports = {
86
60
  .map(({ value }) => value.split(' ')[0])
87
61
  .map((value) => ({
88
62
  name: value.slice(0, -2),
89
- value: value,
63
+ value,
90
64
  }))
91
65
  .reduce((preset, { name, value }) => ({
92
66
  ...preset,
@@ -98,11 +72,6 @@ module.exports = {
98
72
  return Object.values(designTokens)
99
73
  .map(({ name, value }) => ({
100
74
  ...name.match(/^(?:(?<theme>light|dark)-)?(?<name>.+)$/).groups,
101
- value,
102
- }))
103
- .map(({ name, theme, value }) => ({
104
- name,
105
- theme,
106
75
  value: value
107
76
  .replace(/\b0px\b/g, '0')
108
77
  .replace(/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/g, 'rgba($1 $2 $3 / $4)'),
@@ -112,4 +81,28 @@ module.exports = {
112
81
  [!theme || theme === 'light' ? name : `${name}-${theme}`]: value,
113
82
  }), {});
114
83
  },
84
+
85
+ parseFontFamilyTokens(designTokens) {
86
+ return Object.values(designTokens)
87
+ .reduce((preset, { name, fontFamily }) => ({
88
+ ...preset,
89
+ [name]: fontFamily,
90
+ }), {});
91
+ },
92
+
93
+ parseFontSizeTokens(designTokens) {
94
+ return Object.values(designTokens)
95
+ .reduce((preset, { name, fontSize, lineHeight }) => ({
96
+ ...preset,
97
+ [name]: [fontSize, { lineHeight }],
98
+ }), {});
99
+ },
100
+
101
+ parseFontWeightTokens(designTokens) {
102
+ return Object.values(designTokens)
103
+ .reduce((preset, { name, fontWeight }) => ({
104
+ ...preset,
105
+ [name]: fontWeight,
106
+ }), {});
107
+ },
115
108
  };
@@ -3,19 +3,21 @@ const plugin = require('tailwindcss/plugin');
3
3
  const {
4
4
  parseSpacingTokens,
5
5
  parseColorTokens,
6
- parseTypographyTokens,
7
6
  parseBorderRadiusTokens,
8
7
  parseBorderWidthTokens,
9
8
  parseBoxShadowTokens,
9
+ parseFontFamilyTokens,
10
+ parseFontSizeTokens,
11
+ parseFontWeightTokens,
10
12
  } = require('./tailwind-utils');
11
13
 
12
14
  const {
13
15
  SpacePatterns: spacingTokens,
14
16
  colors: colorTokens,
15
- typeStyles: typographyTokens,
16
17
  BorderRadiuses: borderRadiusTokens,
17
18
  Borders: borderWidthTokens,
18
19
  Shadows: boxShadowTokens,
20
+ typeStyles: typographyTokens,
19
21
  } = require('./src/variables/tokens/design-tokens-next.json');
20
22
 
21
23
  module.exports = {
@@ -27,23 +29,76 @@ module.exports = {
27
29
  backgroundColor: parseColorTokens(colorTokens, ['generic', 'background']),
28
30
  textColor: parseColorTokens(colorTokens, ['generic', 'text']),
29
31
  borderColor: parseColorTokens(colorTokens, ['generic']),
32
+ outlineColor: parseColorTokens(colorTokens, ['generic']),
33
+
34
+ // SVG Palette
35
+ fill: parseColorTokens(colorTokens, ['generic', 'background', 'text']),
36
+ stroke: parseColorTokens(colorTokens, ['generic', 'background', 'text']),
37
+
38
+ animation: {
39
+ 'circular-loader': 'circular-loader 1400ms linear infinite',
40
+ 'linear-loader': 'linear-loader 1400ms linear infinite',
41
+ },
42
+
43
+ keyframes: {
44
+ 'circular-loader': {
45
+ '0%': {
46
+ transform: 'rotate(0deg)',
47
+ strokeDasharray: '0, 200',
48
+ strokeDashoffset: '0',
49
+ },
50
+
51
+ '50%': {
52
+ transform: 'rotate(180deg)',
53
+ strokeDasharray: '100, 200',
54
+ strokeDashoffset: 'calc((50% - 2px) * -3.14)',
55
+ },
56
+
57
+ '100%': {
58
+ transform: 'rotate(360deg)',
59
+ strokeDasharray: '100, 200',
60
+ strokeDashoffset: 'calc((100% - 2px) * -3.14)',
61
+ },
62
+ },
63
+
64
+ 'linear-loader': {
65
+ '0%': {
66
+ strokeDasharray: '25%, 100%',
67
+ strokeDashoffset: '0',
68
+ },
30
69
 
31
- typography: parseTypographyTokens(typographyTokens),
70
+ '100%': {
71
+ strokeDasharray: '25%, 100%',
72
+ strokeDashoffset: '-250%',
73
+ },
74
+ },
75
+ },
32
76
 
33
77
  borderRadius: parseBorderRadiusTokens(borderRadiusTokens),
34
78
  borderWidth: parseBorderWidthTokens(borderWidthTokens),
35
79
  boxShadow: parseBoxShadowTokens(boxShadowTokens),
36
- fontFamily: false,
37
- fontSize: false,
38
- fontWeight: false,
80
+
81
+ fontFamily: {
82
+ ...parseFontFamilyTokens(typographyTokens),
83
+ 'inherit': 'inherit',
84
+ },
85
+
86
+ fontSize: {
87
+ ...parseFontSizeTokens(typographyTokens),
88
+ 'inherit': 'inherit',
89
+ },
90
+
91
+ fontWeight: {
92
+ ...parseFontWeightTokens(typographyTokens),
93
+ 'inherit': 'inherit',
94
+ },
95
+
39
96
  letterSpacing: false,
40
97
  lineHeight: false,
41
98
  opacity: false,
42
99
  },
43
100
 
44
101
  plugins: [
45
- require('@tailwindcss/typography'),
46
-
47
102
  plugin(({ addBase, addVariant, addUtilities, theme }) => {
48
103
  addBase({
49
104
  '@font-face': [
@@ -55,14 +110,6 @@ module.exports = {
55
110
  'src': 'url("https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19") format("woff2")',
56
111
  },
57
112
 
58
- {
59
- 'font-family': '"Inter"',
60
- 'font-style': 'normal',
61
- 'font-weight': '500',
62
- 'font-display': 'swap',
63
- 'src': 'url("https://rsms.me/inter/font-files/Inter-Medium.woff2?v=3.19") format("woff2")',
64
- },
65
-
66
113
  {
67
114
  'font-family': '"Inter"',
68
115
  'font-style': 'normal',
@@ -81,7 +128,9 @@ module.exports = {
81
128
  ],
82
129
 
83
130
  ':root': {
84
- ...theme('typography.body-1-regular.css'),
131
+ fontFamily: theme('fontFamily.body-1-regular'),
132
+ fontSize: theme('fontSize.body-1-regular'),
133
+ fontWeight: theme('fontWeight.body-1-regular'),
85
134
  },
86
135
  });
87
136