stylelint-gamut 1.2.0 → 1.2.3

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 +1 -1
  2. package/src/index.js +9 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stylelint-gamut",
3
- "version": "1.2.0",
3
+ "version": "1.2.3",
4
4
  "description": "Stylelint plugin for working with different color spaces",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -43,21 +43,25 @@ const ruleFunction = (primary) => {
43
43
  let customPropValue
44
44
  if (value.startsWith('var(--')) {
45
45
  const varName = value.slice(4, -1)
46
- customPropValue = customProperties[varName]
47
- if (!customPropValue) return
46
+
47
+ if (customProperties[varName] && !customProperties[varName].inQuery) {
48
+ customPropValue = customProperties[varName].value
49
+ } else {
50
+ return
51
+ }
48
52
  }
49
53
 
50
54
  const isInSrgbGamut = new Color(customPropValue || value).inGamut('srgb')
51
55
 
52
56
  if (isInSrgbGamut) return
53
57
 
58
+ if (isInColorGamutP3MediaQuery(decl)) return
59
+
54
60
  if (decl.prop && decl.prop.startsWith('--')) {
55
- customProperties[decl.prop] = decl.value.trim()
61
+ customProperties[decl.prop] = { value: decl.value.trim(), inQuery: false }
56
62
  return
57
63
  }
58
64
 
59
- if (isInColorGamutP3MediaQuery(decl)) return
60
-
61
65
  const index = declarationValueIndex(decl)
62
66
  const endIndex = index + decl.value.length
63
67