anubis-ui 1.2.4 → 1.2.5
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
package/src/manual/build.js
CHANGED
|
@@ -43,16 +43,17 @@ const mapClassIntoRule = (stringClass: string) => {
|
|
|
43
43
|
const getClassInfos = (stringClass: string) => {
|
|
44
44
|
const { cleanedClass, state } = getStateInfos(stringClass)
|
|
45
45
|
const { cleanedColor, prefix } = getPrefixInfos(cleanedClass)
|
|
46
|
-
const { preset, variation } = getPresetInfos({ cleanedColor, prefix })
|
|
46
|
+
const { baseColor, preset, variation, variationName } = getPresetInfos({ cleanedColor, prefix })
|
|
47
47
|
|
|
48
48
|
return {
|
|
49
49
|
state,
|
|
50
50
|
|
|
51
|
-
color:
|
|
51
|
+
color: baseColor,
|
|
52
52
|
prefix,
|
|
53
53
|
|
|
54
54
|
preset,
|
|
55
|
-
variation
|
|
55
|
+
variation,
|
|
56
|
+
variationName
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -122,18 +123,24 @@ const getPresetInfos = ({ cleanedColor, prefix }: { cleanedColor: string, prefix
|
|
|
122
123
|
|
|
123
124
|
const possibleVariations = (matchingPreset.variations || { default: '' })
|
|
124
125
|
|
|
126
|
+
const defaultVariation = 'default'
|
|
125
127
|
const matchingVariation = Object.keys(possibleVariations)
|
|
126
|
-
?.find(v => cleanedColor.endsWith(v))
|
|
128
|
+
?.find(v => cleanedColor.endsWith(v))
|
|
127
129
|
|
|
128
|
-
const variation = possibleVariations[matchingVariation]
|
|
130
|
+
const variation = possibleVariations[matchingVariation || defaultVariation]
|
|
131
|
+
const baseColor = matchingVariation
|
|
132
|
+
? cleanedColor?.slice(0, -matchingVariation?.length - 1)
|
|
133
|
+
: cleanedColor
|
|
129
134
|
|
|
130
135
|
return {
|
|
136
|
+
baseColor,
|
|
131
137
|
preset: matchingPreset,
|
|
138
|
+
variationName: matchingVariation,
|
|
132
139
|
variation,
|
|
133
140
|
}
|
|
134
141
|
}
|
|
135
142
|
|
|
136
|
-
const mapIntoRule = ({ state, prefix, color, preset, variation }) => {
|
|
143
|
+
const mapIntoRule = ({ state, prefix, color, preset, variation, variationName }) => {
|
|
137
144
|
// _ Set state selector
|
|
138
145
|
let stateSelector = ''
|
|
139
146
|
switch (state) {
|
|
@@ -146,7 +153,7 @@ const mapIntoRule = ({ state, prefix, color, preset, variation }) => {
|
|
|
146
153
|
break
|
|
147
154
|
}
|
|
148
155
|
|
|
149
|
-
let selector = `${prefix}${color ? `-${color}` : ''}`
|
|
156
|
+
let selector = `${prefix}${color ? `-${color}` : ''}${variationName ? `-${variationName}` : ''}`
|
|
150
157
|
if (state) {
|
|
151
158
|
selector = `${state}\\:${selector}${stateSelector}`
|
|
152
159
|
}
|