css-in-props 0.9.7 → 0.9.9
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 +3 -2
- package/src/registry.js +7 -7
- package/src/transform/classname.js +2 -2
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Utilize props as CSS methods",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "symbo.ls",
|
|
6
|
-
"version": "0.9.
|
|
6
|
+
"version": "0.9.9",
|
|
7
7
|
"repository": "https://github.com/symbo-ls/smbls",
|
|
8
8
|
"main": "src/index.js",
|
|
9
9
|
"files": [
|
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
"bump": "npx np"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"@babel/core": "^7.0.0-0",
|
|
26
|
+
"@babel/preset-env": "^7.19.4",
|
|
25
27
|
"@domql/utils": "^2.2.1",
|
|
26
28
|
"@emotion/css": "^11.10.0",
|
|
27
29
|
"@symbo.ls/scratch": "^0.3.19",
|
|
28
|
-
"@babel/core": "^7.14.6",
|
|
29
30
|
"babel-eslint": "^10.0.3",
|
|
30
31
|
"emotion": "^10.0.27",
|
|
31
32
|
"np": "^7.2.0",
|
package/src/registry.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { isArray, isObject } from '@domql/utils'
|
|
4
|
-
import { getColor,
|
|
4
|
+
import { getColor, getSpacingByKey, getTheme, SPACING, getFontSizeByKey, getFontFamily, FONT_FAMILY } from '@symbo.ls/scratch'
|
|
5
5
|
|
|
6
6
|
export const mapBasedOnRatio = (props, prop, unit) => {
|
|
7
7
|
const { spacingRatio } = props
|
|
8
8
|
const val = props[prop]
|
|
9
|
-
// TODO: move this to
|
|
9
|
+
// TODO: move this to getSpacingByKey
|
|
10
10
|
if (spacingRatio) {
|
|
11
11
|
const params = SPACING[spacingRatio]
|
|
12
12
|
|
|
@@ -22,9 +22,9 @@ export const mapBasedOnRatio = (props, prop, unit) => {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
return
|
|
25
|
+
return getSpacingByKey(val, prop, params, unit)
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return getSpacingByKey(val, prop, null, unit)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
const isBorderStyle = str =>
|
|
@@ -179,7 +179,7 @@ export const position = {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
export const text = {
|
|
182
|
-
fontSize: props => props.fontSize ?
|
|
182
|
+
fontSize: props => props.fontSize ? getFontSizeByKey(props.fontSize) : null,
|
|
183
183
|
fontFamily: props => props.fontFamily && ({ fontFamily: getFontFamily(FONT_FAMILY, props.fontFamily) || props.fontFamily }),
|
|
184
184
|
lineHeight: props => props.lineHeight && ({ lineHeight: props.lineHeight }),
|
|
185
185
|
// lineHeight: props => props.lineHeight && mapBasedOnRatio(props, 'lineHeight', null, ''),
|
|
@@ -205,8 +205,8 @@ export const registry = {
|
|
|
205
205
|
if (typeof props.heightRange !== 'string') return
|
|
206
206
|
const [minHeight, maxHeight] = props.heightRange.split(' ')
|
|
207
207
|
return {
|
|
208
|
-
...
|
|
209
|
-
...
|
|
208
|
+
...getSpacingByKey(minHeight, 'minHeight'),
|
|
209
|
+
...getSpacingByKey(maxHeight, 'maxHeight')
|
|
210
210
|
}
|
|
211
211
|
},
|
|
212
212
|
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { merge, isFunction, isObject, isArray } from '@domql/utils'
|
|
4
4
|
import { keySetters } from './subProps'
|
|
5
5
|
|
|
6
|
-
import { registry } from '../registry'
|
|
6
|
+
import { registry as reg } from '../registry'
|
|
7
7
|
|
|
8
|
-
export const transformClassname = props => {
|
|
8
|
+
export const transformClassname = (props, registry = reg) => {
|
|
9
9
|
const CLASS_NAMES = {}
|
|
10
10
|
if (!isObject(props)) return
|
|
11
11
|
|