css-in-props 2.10.157 → 2.10.161
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/cjs/registry.js +2 -2
- package/dist/cjs/set.js +0 -1
- package/dist/cjs/transform.js +3 -4
- package/dist/esm/registry.js +2 -2
- package/dist/esm/set.js +0 -1
- package/dist/esm/transform.js +4 -5
- package/package.json +2 -2
- package/src/registry.js +1 -1
- package/src/set.js +0 -1
- package/src/transform.js +4 -5
package/dist/cjs/registry.js
CHANGED
|
@@ -18,12 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var registry_exports = {};
|
|
20
20
|
__export(registry_exports, {
|
|
21
|
-
|
|
21
|
+
CSS_PROPS_REGISTRY: () => CSS_PROPS_REGISTRY
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(registry_exports);
|
|
24
24
|
var import_utils = require("@domql/utils");
|
|
25
25
|
var import_atoms = require("@symbo.ls/atoms");
|
|
26
|
-
const
|
|
26
|
+
const CSS_PROPS_REGISTRY = (0, import_utils.mergeArray)([
|
|
27
27
|
import_atoms.Shape,
|
|
28
28
|
import_atoms.Position,
|
|
29
29
|
import_atoms.Theme,
|
package/dist/cjs/set.js
CHANGED
|
@@ -24,7 +24,6 @@ module.exports = __toCommonJS(set_exports);
|
|
|
24
24
|
var import_transform = require("./transform");
|
|
25
25
|
var import_emotion = require("./emotion");
|
|
26
26
|
const setClassname = (props, emotionCss) => {
|
|
27
|
-
console.log(props);
|
|
28
27
|
const transform = (0, import_transform.transformClassname)(props);
|
|
29
28
|
return (0, import_emotion.transformEmotion)(transform, emotionCss);
|
|
30
29
|
};
|
package/dist/cjs/transform.js
CHANGED
|
@@ -24,18 +24,17 @@ module.exports = __toCommonJS(transform_exports);
|
|
|
24
24
|
var import_utils = require("@domql/utils");
|
|
25
25
|
var import_atoms = require("@symbo.ls/atoms");
|
|
26
26
|
var import_registry = require("./registry");
|
|
27
|
-
const transformClassname = (props, registry = import_registry.
|
|
27
|
+
const transformClassname = (props, context = {}, registry = import_registry.CSS_PROPS_REGISTRY) => {
|
|
28
28
|
const CLASS_NAMES = {};
|
|
29
29
|
if (!(0, import_utils.isObject)(props))
|
|
30
30
|
return;
|
|
31
31
|
for (const key in props) {
|
|
32
32
|
const setter = import_atoms.keySetters[key.slice(0, 1)];
|
|
33
|
-
const
|
|
34
|
-
const hasCSS = reg2[key];
|
|
33
|
+
const hasCSS = registry[key];
|
|
35
34
|
if (setter)
|
|
36
35
|
setter(key, props[key], CLASS_NAMES);
|
|
37
36
|
else if ((0, import_utils.isFunction)(hasCSS)) {
|
|
38
|
-
const stack = hasCSS({ props, context
|
|
37
|
+
const stack = hasCSS({ props, context });
|
|
39
38
|
const exec = (0, import_utils.isArray)(stack) ? stack.reduce((a, c) => {
|
|
40
39
|
return (0, import_utils.merge)(a, c);
|
|
41
40
|
}, {}) : stack;
|
package/dist/esm/registry.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
XYZ,
|
|
14
14
|
Animation
|
|
15
15
|
} from "@symbo.ls/atoms";
|
|
16
|
-
const
|
|
16
|
+
const CSS_PROPS_REGISTRY = mergeArray([
|
|
17
17
|
Shape,
|
|
18
18
|
Position,
|
|
19
19
|
Theme,
|
|
@@ -28,5 +28,5 @@ const registry = mergeArray([
|
|
|
28
28
|
Animation
|
|
29
29
|
]).class;
|
|
30
30
|
export {
|
|
31
|
-
|
|
31
|
+
CSS_PROPS_REGISTRY
|
|
32
32
|
};
|
package/dist/esm/set.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { transformClassname } from "./transform";
|
|
2
2
|
import { transformEmotion } from "./emotion";
|
|
3
3
|
const setClassname = (props, emotionCss) => {
|
|
4
|
-
console.log(props);
|
|
5
4
|
const transform = transformClassname(props);
|
|
6
5
|
return transformEmotion(transform, emotionCss);
|
|
7
6
|
};
|
package/dist/esm/transform.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { merge, isFunction, isObject, isArray } from "@domql/utils";
|
|
2
2
|
import { keySetters } from "@symbo.ls/atoms";
|
|
3
|
-
import {
|
|
4
|
-
const transformClassname = (props, registry =
|
|
3
|
+
import { CSS_PROPS_REGISTRY } from "./registry";
|
|
4
|
+
const transformClassname = (props, context = {}, registry = CSS_PROPS_REGISTRY) => {
|
|
5
5
|
const CLASS_NAMES = {};
|
|
6
6
|
if (!isObject(props))
|
|
7
7
|
return;
|
|
8
8
|
for (const key in props) {
|
|
9
9
|
const setter = keySetters[key.slice(0, 1)];
|
|
10
|
-
const
|
|
11
|
-
const hasCSS = reg2[key];
|
|
10
|
+
const hasCSS = registry[key];
|
|
12
11
|
if (setter)
|
|
13
12
|
setter(key, props[key], CLASS_NAMES);
|
|
14
13
|
else if (isFunction(hasCSS)) {
|
|
15
|
-
const stack = hasCSS({ props, context
|
|
14
|
+
const stack = hasCSS({ props, context });
|
|
16
15
|
const exec = isArray(stack) ? stack.reduce((a, c) => {
|
|
17
16
|
return merge(a, c);
|
|
18
17
|
}, {}) : stack;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "css-in-props",
|
|
3
3
|
"description": "Utilize props as CSS methods",
|
|
4
4
|
"author": "symbo.ls",
|
|
5
|
-
"version": "2.10.
|
|
5
|
+
"version": "2.10.161",
|
|
6
6
|
"repository": "https://github.com/symbo-ls/smbls",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"module": "dist/esm/index.js",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"@symbo.ls/emotion": "latest",
|
|
31
31
|
"@symbo.ls/scratch": "latest"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "f9ad1b5f9b5230f9219b31df4b6b4b451d5dfa8f"
|
|
34
34
|
}
|
package/src/registry.js
CHANGED
package/src/set.js
CHANGED
|
@@ -4,7 +4,6 @@ import { transformClassname } from './transform'
|
|
|
4
4
|
import { transformEmotion } from './emotion'
|
|
5
5
|
|
|
6
6
|
export const setClassname = (props, emotionCss) => {
|
|
7
|
-
console.log(props)
|
|
8
7
|
const transform = transformClassname(props)
|
|
9
8
|
return transformEmotion(transform, emotionCss)
|
|
10
9
|
}
|
package/src/transform.js
CHANGED
|
@@ -3,20 +3,19 @@
|
|
|
3
3
|
import { merge, isFunction, isObject, isArray } from '@domql/utils'
|
|
4
4
|
import { keySetters } from '@symbo.ls/atoms'
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { CSS_PROPS_REGISTRY } from './registry'
|
|
7
7
|
|
|
8
|
-
export const transformClassname = (props, registry =
|
|
8
|
+
export const transformClassname = (props, context = {}, registry = CSS_PROPS_REGISTRY) => {
|
|
9
9
|
const CLASS_NAMES = {}
|
|
10
10
|
if (!isObject(props)) return
|
|
11
11
|
|
|
12
12
|
for (const key in props) {
|
|
13
13
|
const setter = keySetters[key.slice(0, 1)]
|
|
14
|
-
const
|
|
15
|
-
const hasCSS = reg[key]
|
|
14
|
+
const hasCSS = registry[key]
|
|
16
15
|
|
|
17
16
|
if (setter) setter(key, props[key], CLASS_NAMES)
|
|
18
17
|
else if (isFunction(hasCSS)) {
|
|
19
|
-
const stack = hasCSS({ props, context
|
|
18
|
+
const stack = hasCSS({ props, context })
|
|
20
19
|
const exec = isArray(stack) ? stack.reduce((a, c) => {
|
|
21
20
|
return merge(a, c)
|
|
22
21
|
}, {}) : stack
|