@onereach/styles 2.9.6-beta.666.0 → 2.9.6

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 (2) hide show
  1. package/package.json +3 -2
  2. package/tailwind-utils.js +9 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/styles",
3
- "version": "2.9.6-beta.666.0",
3
+ "version": "2.9.6",
4
4
  "description": "Styles for or-ui-next",
5
5
  "main": "./main.css",
6
6
  "unpkg": "./main.css",
@@ -41,5 +41,6 @@
41
41
  "postcss-preset-env": "^7.7.1",
42
42
  "sass": "^1.35.1",
43
43
  "tailwindcss": "^3.1.3"
44
- }
44
+ },
45
+ "gitHead": "9e7c3a53eb4f45940e6c9a78a66548fb95cd2498"
45
46
  }
package/tailwind-utils.js CHANGED
@@ -1,19 +1,19 @@
1
1
  module.exports = {
2
2
  parseColorTokens(designTokens, colorGroups) {
3
- const isBackgroundColor = (name) => /\b(?:container|background|surface)\b/.test(name) && !isTextColor(name);
4
- const isTextColor = (name) => /\b(?:on)\b/.test(name);
5
- const isShadowColor = (name) => /\b(?:shadow)\b/.test(name);
3
+ const isBackground = (name) => /\b(?:container|background|surface)\b/.test(name) && !isText(name);
4
+ const isText = (name) => /\b(?:on)\b/.test(name);
5
+ const isShadow = (name) => /\b(?:shadow)\b/.test(name);
6
6
  const isOpacity = (name) => /\b(?:opacity)\b/.test(name);
7
7
 
8
8
  const defineColorGroup = (name) => {
9
9
  switch (true) {
10
- case isBackgroundColor(name):
10
+ case isBackground(name):
11
11
  return 'background';
12
12
 
13
- case isTextColor(name):
13
+ case isText(name):
14
14
  return 'text';
15
15
 
16
- case isShadowColor(name):
16
+ case isShadow(name):
17
17
  case isOpacity(name):
18
18
  return null;
19
19
 
@@ -36,10 +36,7 @@ module.exports = {
36
36
  .filter(({ group }) => colorGroups.includes(group))
37
37
  .reduce((preset, { name, theme, value }) => ({
38
38
  ...preset,
39
- [name]: !theme ? value : {
40
- ...preset[name],
41
- ...theme === 'light' ? { DEFAULT: value } : { [theme]: value },
42
- },
39
+ [!theme || theme === 'light' ? name : `${name}-${theme}`]: value,
43
40
  }), {});
44
41
  },
45
42
 
@@ -69,10 +66,9 @@ module.exports = {
69
66
  .replace(/\b0px\b/g, '0')
70
67
  .replace(/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/g, 'rgba($1 $2 $3 / $4)'),
71
68
  }))
72
- .filter(({ theme }) => theme === 'light')
73
- .reduce((preset, { name, value }) => ({
69
+ .reduce((preset, { name, theme, value }) => ({
74
70
  ...preset,
75
- [name]: value,
71
+ [!theme || theme === 'light' ? name : `${name}-${theme}`]: value,
76
72
  }), {});
77
73
  },
78
74