@wix/zero-config-implementation 1.66.0 → 1.67.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/{index-CtX9f415.js → index-BfHROU60.js} +1 -1
- package/dist/{index-BEdi2EUy.js → index-Ps7eUbv5.js} +12159 -12035
- package/dist/index.d.ts +26 -0
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/converters/custom-states-builder.test.ts +72 -0
- package/src/converters/custom-states-builder.ts +75 -0
- package/src/converters/to-editor-component.ts +47 -3
- package/src/information-extractors/css/parse.test.ts +122 -0
- package/src/information-extractors/css/parse.ts +177 -1
- package/src/information-extractors/css/types.ts +27 -0
- package/src/utils/css-class.ts +10 -0
package/src/utils/css-class.ts
CHANGED
|
@@ -46,3 +46,13 @@ export function findPreferredSemanticClass(classNames: string[]): string | undef
|
|
|
46
46
|
const semanticClasses = classNames.filter(isGlobalSemanticClass)
|
|
47
47
|
return semanticClasses.find((className) => !HAS_BEM_MODIFIER.test(className)) ?? semanticClasses[0]
|
|
48
48
|
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Derives the state name from a BEM modifier class: the segment after the last `--`
|
|
52
|
+
* (`custom-states--featured` → `featured`, `card__label--in-progress` → `in-progress`).
|
|
53
|
+
* Falls back to the whole modifier when no `--` is present.
|
|
54
|
+
*/
|
|
55
|
+
export function stateNameFromModifier(modifier: string): string {
|
|
56
|
+
const separatorIndex = modifier.lastIndexOf('--')
|
|
57
|
+
return separatorIndex >= 0 ? modifier.slice(separatorIndex + 2) : modifier
|
|
58
|
+
}
|