@kong/design-tokens 1.18.3-pr.613.cb30259.0 → 1.18.3-pr.613.d9d2a3d.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/dist/stylelint-plugin/rules/use-css-token/index.mjs +17 -17
- package/dist/tokens/css/custom-properties.css +1 -1
- package/dist/tokens/js/cjs/index.d.ts +1 -1
- package/dist/tokens/js/cjs/index.js +1 -1
- package/dist/tokens/js/index.d.ts +1 -1
- package/dist/tokens/js/index.mjs +1 -1
- package/dist/tokens/less/variables.less +1 -1
- package/dist/tokens/scss/_map.scss +1 -1
- package/dist/tokens/scss/_variables.scss +1 -1
- package/package.json +1 -1
|
@@ -35,25 +35,25 @@ const findAllTokenOccurrences = (value, token) => {
|
|
|
35
35
|
// Check if token at given position is properly wrapped in var()
|
|
36
36
|
// Enforces exact format: var(--token, $token) with exactly one space before comma
|
|
37
37
|
const isTokenProperlyWrapped = (value, tokenIndex, token, cssToken) => {
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
// Use regex to find all var(--token, $token) patterns
|
|
39
|
+
// Escape regex metacharacters in token so it is treated literally in the pattern
|
|
40
|
+
const escapedToken = token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
41
|
+
const pattern = new RegExp(`var\\(${cssToken}, ${escapedToken}\\)`, 'g')
|
|
42
|
+
|
|
43
|
+
// Find all matches
|
|
44
|
+
let match
|
|
45
|
+
while ((match = pattern.exec(value)) !== null) {
|
|
46
|
+
const matchStart = match.index
|
|
47
|
+
const matchEnd = matchStart + match[0].length
|
|
48
|
+
|
|
49
|
+
// Check if our token at tokenIndex is inside this match
|
|
50
|
+
const tokenEndIndex = tokenIndex + token.length
|
|
51
|
+
if (tokenIndex >= matchStart && tokenEndIndex <= matchEnd) {
|
|
52
|
+
return true
|
|
53
|
+
}
|
|
49
54
|
}
|
|
50
55
|
|
|
51
|
-
|
|
52
|
-
const substring = value.substring(startIndex, endIndex)
|
|
53
|
-
|
|
54
|
-
// Check if it matches the exact pattern: var(--token, $token)
|
|
55
|
-
const expectedPattern = new RegExp(`^var\\(${cssToken}, ${token}\\)$`)
|
|
56
|
-
return expectedPattern.test(substring)
|
|
56
|
+
return false
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
const ruleFunction = () => {
|
package/dist/tokens/js/index.mjs
CHANGED