@bem-react/classnames 1.3.10 → 1.4.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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.4.0](https://github.com/bem/bem-react/compare/@bem-react/classnames@1.3.10...@bem-react/classnames@1.4.0) (2025-06-15)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- add dual packaging ([6d78a65](https://github.com/bem/bem-react/commit/6d78a651214abb057390338e4ea249c264c3252d))
|
|
11
|
+
- support esm modules ([7ef51f8](https://github.com/bem/bem-react/commit/7ef51f8a96d1b81f60458a4772237813eb630c42))
|
|
12
|
+
|
|
6
13
|
## [1.3.10](https://github.com/bem/bem-react/compare/@bem-react/classnames@1.3.9...@bem-react/classnames@1.3.10) (2021-06-08)
|
|
7
14
|
|
|
8
15
|
### Bug Fixes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate className string with unique tokens.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* classnames('Button', 'Header-Button', undefined) // -> Button Header-Button
|
|
6
|
+
*
|
|
7
|
+
* @param tokens ClassNames tokens.
|
|
8
|
+
*/
|
|
9
|
+
function classnames() {
|
|
10
|
+
var tokens = [];
|
|
11
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
12
|
+
tokens[_i] = arguments[_i];
|
|
13
|
+
}
|
|
14
|
+
var className = '';
|
|
15
|
+
var uniqueCache = new Set();
|
|
16
|
+
var classNameList = tokens.join(' ').split(' ');
|
|
17
|
+
for (var _a = 0, classNameList_1 = classNameList; _a < classNameList_1.length; _a++) {
|
|
18
|
+
var value = classNameList_1[_a];
|
|
19
|
+
if (value === '' || uniqueCache.has(value)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
uniqueCache.add(value);
|
|
23
|
+
if (className.length > 0) {
|
|
24
|
+
className += ' ';
|
|
25
|
+
}
|
|
26
|
+
className += value;
|
|
27
|
+
}
|
|
28
|
+
return className;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { classnames };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bem-react/classnames",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "BEM React ClassNames merge",
|
|
5
5
|
"homepage": "https://github.com/bem/bem-react/tree/master/packages/classnames",
|
|
6
6
|
"repository": "https://github.com/bem/bem-react",
|
|
@@ -8,20 +8,28 @@
|
|
|
8
8
|
"classes",
|
|
9
9
|
"merge"
|
|
10
10
|
],
|
|
11
|
-
"main": "index.js",
|
|
12
|
-
"typings": "classnames.d.ts",
|
|
13
11
|
"publishConfig": {
|
|
14
12
|
"access": "public"
|
|
15
13
|
},
|
|
16
|
-
"files": [
|
|
17
|
-
"build",
|
|
18
|
-
"classnames.d.ts"
|
|
19
|
-
],
|
|
20
14
|
"license": "MPL-2.0",
|
|
21
15
|
"scripts": {
|
|
22
16
|
"prepublishOnly": "npm run build",
|
|
23
17
|
"build": "node ../../scripts/rollup/build.js",
|
|
24
18
|
"unit": "../../node_modules/.bin/jest --config ../../.config/jest/jest.config.js"
|
|
25
19
|
},
|
|
26
|
-
"
|
|
20
|
+
"files": [
|
|
21
|
+
"build",
|
|
22
|
+
"classnames.d.ts"
|
|
23
|
+
],
|
|
24
|
+
"main": "./build/classnames.cjs",
|
|
25
|
+
"module": "./build/classnames.mjs",
|
|
26
|
+
"types": "./classnames.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./classnames.d.ts",
|
|
30
|
+
"import": "./build/classnames.mjs",
|
|
31
|
+
"require": "./build/classnames.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"gitHead": "2794188cf2a9b30467af1b606286ec65d1fde097"
|
|
27
35
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:!0}),exports.classnames=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r='',n=new Set,s=0,a=e.join(' ').split(' ');s<a.length;s++){var o=a[s];''===o||n.has(o)||(n.add(o),r.length>0&&(r+=' '),r+=o)}return r};
|
package/index.js
DELETED
|
File without changes
|