@domql/emotion 3.0.1 → 3.0.7

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.
Files changed (2) hide show
  1. package/index.js +17 -8
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -5,26 +5,35 @@ 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
 
8
- export const transformEmotionStyle = (emotion) => {
8
+ export const transformEmotionStyle = emotion => {
9
9
  return (params, element, state) => {
10
10
  const execParams = exec(params, element)
11
11
  if (params) {
12
- if (isObjectLike(element.class)) element.class.elementStyle = execParams
13
- else element.class = { elementStyle: execParams }
12
+ const { __ref: ref } = element
13
+ ref.__class.style = execParams
14
14
  }
15
- transformEmotionClass(emotion)(element.class, element, element.state, true)
15
+ transformEmotionClass(emotion)(
16
+ element.classlist,
17
+ element,
18
+ element.state,
19
+ true
20
+ )
16
21
  }
17
22
  }
18
23
 
19
- export const transformEmotionClass = (emotion) => {
24
+ export const transformEmotionClass = emotion => {
20
25
  return (params, element, state, flag) => {
21
26
  if (element.style && !flag) return
22
27
  const { __ref } = element
23
28
  const { __class, __classNames } = __ref
24
29
 
25
30
  if (!isObjectLike(params)) return
26
- if (element.props.class) { __classNames.classProps = element.props.class }
27
- if (element.attr?.class) { __classNames.class = element.attr.class }
31
+ if (element.props.class) {
32
+ __classNames.classProps = element.props.class
33
+ }
34
+ if (element.attr?.class) {
35
+ __classNames.class = element.attr.class
36
+ }
28
37
 
29
38
  // for (const key in params) {
30
39
  // const prop = exec(params[key], element)
@@ -59,6 +68,6 @@ export const transformDOMQLEmotion = (emotion, options) => {
59
68
 
60
69
  return {
61
70
  style: transformEmotionStyle(emotion),
62
- class: transformEmotionClass(emotion)
71
+ classlist: transformEmotionClass(emotion)
63
72
  }
64
73
  }
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@domql/emotion",
3
- "version": "3.0.1",
3
+ "version": "3.0.7",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
7
7
  "@domql/classlist": "latest",
8
- "@domql/utils": "^3.0.1"
8
+ "@domql/utils": "^3.0.7"
9
9
  },
10
10
  "peerDependencies": {
11
11
  "@emotion/css": "*"
12
12
  },
13
- "gitHead": "bdadc70a00c5ddde21ca889746bf28db0c3d7c2f",
13
+ "gitHead": "ad8d42d52cce0024e5df6b2e364f660e0e4dd02d",
14
14
  "source": "index.js"
15
15
  }