@domql/emotion 2.5.200 → 3.0.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/index.js +19 -17
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
// import DOM from '../../src'
|
|
4
|
-
import { isObjectLike, isString, isNumber, isBoolean, exec
|
|
4
|
+
import { isObjectLike, isString, isNumber, isBoolean, exec } from '@domql/utils'
|
|
5
5
|
import { applyClassListOnNode } from '@domql/classlist'
|
|
6
6
|
import createEmotion from '@emotion/css/create-instance'
|
|
7
7
|
|
|
@@ -24,31 +24,33 @@ export const transformEmotionClass = (emotion) => {
|
|
|
24
24
|
|
|
25
25
|
if (!isObjectLike(params)) return
|
|
26
26
|
if (element.props.class) { __classNames.classProps = element.props.class }
|
|
27
|
-
if (element.attr
|
|
27
|
+
if (element.attr?.class) { __classNames.class = element.attr.class }
|
|
28
28
|
|
|
29
|
-
for (const key in params) {
|
|
30
|
-
|
|
29
|
+
// for (const key in params) {
|
|
30
|
+
// const prop = exec(params[key], element)
|
|
31
31
|
|
|
32
|
+
// if (!prop) {
|
|
33
|
+
// delete __class[key]
|
|
34
|
+
// continue
|
|
35
|
+
// }
|
|
36
|
+
// }
|
|
37
|
+
|
|
38
|
+
for (const key in __class) {
|
|
39
|
+
const prop = __class[key]
|
|
32
40
|
if (!prop) {
|
|
33
|
-
delete __class[key]
|
|
34
41
|
delete __classNames[key]
|
|
35
42
|
continue
|
|
36
43
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
else className = emotion.css(prop)
|
|
45
|
-
__class[key] = prop
|
|
46
|
-
__classNames[key] = className
|
|
47
|
-
}
|
|
44
|
+
// console.log(prop, key, element)
|
|
45
|
+
let className
|
|
46
|
+
if (isString(prop) || isNumber(prop)) className = prop
|
|
47
|
+
else if (isBoolean(prop)) className = element.key
|
|
48
|
+
else className = emotion.css(prop)
|
|
49
|
+
// console.log(className)
|
|
50
|
+
__classNames[key] = className
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
applyClassListOnNode(__classNames, element, element.node)
|
|
51
|
-
// return element.class
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/emotion",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@domql/classlist": "latest",
|
|
8
|
-
"@domql/utils": "^
|
|
8
|
+
"@domql/utils": "^3.0.0"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
11
|
"@emotion/css": "*"
|
|
12
12
|
},
|
|
13
|
-
"gitHead": "
|
|
13
|
+
"gitHead": "bcbdc271a602b958de6a60ab387ea7715a935dc1",
|
|
14
14
|
"source": "index.js"
|
|
15
15
|
}
|