css-in-props 2.25.3 → 2.27.8

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/index.js CHANGED
@@ -17,16 +17,16 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var src_exports = {};
21
- __export(src_exports, {
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
22
  exetuteClassPerComponent: () => exetuteClassPerComponent
23
23
  });
24
- module.exports = __toCommonJS(src_exports);
25
- __reExport(src_exports, require("./transform"), module.exports);
26
- __reExport(src_exports, require("./set"), module.exports);
27
- __reExport(src_exports, require("./emotion"), module.exports);
28
- __reExport(src_exports, require("./registry"), module.exports);
29
- __reExport(src_exports, require("./defaults"), module.exports);
24
+ module.exports = __toCommonJS(index_exports);
25
+ __reExport(index_exports, require("./transform"), module.exports);
26
+ __reExport(index_exports, require("./set"), module.exports);
27
+ __reExport(index_exports, require("./emotion"), module.exports);
28
+ __reExport(index_exports, require("./registry"), module.exports);
29
+ __reExport(index_exports, require("./defaults"), module.exports);
30
30
  const exetuteClassPerComponent = (component, element) => {
31
31
  const classObj = {};
32
32
  if (component.class) {
@@ -27,8 +27,7 @@ var import_scratch = require("@symbo.ls/scratch");
27
27
  const applyAnimationProps = (animation, element) => {
28
28
  const { emotion: ctxEmotion } = element.context;
29
29
  const { keyframes } = ctxEmotion || import_emotion.emotion;
30
- if ((0, import_utils.isObject)(animation))
31
- return { animationName: keyframes(animation) };
30
+ if ((0, import_utils.isObject)(animation)) return { animationName: keyframes(animation) };
32
31
  const { ANIMATION } = element.context && element.context.designSystem;
33
32
  const record = ANIMATION[animation];
34
33
  return keyframes(record);
@@ -34,8 +34,7 @@ const BLOCK_PROPS = {
34
34
  width: ({ props }) => (0, import_scratch.transformSizeRatio)("width", props),
35
35
  boxSizing: ({ props }) => !(0, import_utils.isUndefined)(props.boxSizing) ? { boxSizing: props.boxSizing } : { boxSizing: "border-box" },
36
36
  boxSize: ({ props }) => {
37
- if (!(0, import_utils.isString)(props.boxSize))
38
- return;
37
+ if (!(0, import_utils.isString)(props.boxSize)) return;
39
38
  const [height, width] = props.boxSize.split(" ");
40
39
  return {
41
40
  ...(0, import_scratch.transformSize)("height", height),
@@ -47,8 +46,7 @@ const BLOCK_PROPS = {
47
46
  minWidth: ({ props }) => (0, import_scratch.transformSizeRatio)("minWidth", props),
48
47
  maxWidth: ({ props }) => (0, import_scratch.transformSizeRatio)("maxWidth", props),
49
48
  widthRange: ({ props }) => {
50
- if (!(0, import_utils.isString)(props.widthRange))
51
- return;
49
+ if (!(0, import_utils.isString)(props.widthRange)) return;
52
50
  const [minWidth, maxWidth] = props.widthRange.split(" ");
53
51
  return {
54
52
  ...(0, import_scratch.transformSize)("minWidth", minWidth),
@@ -58,8 +56,7 @@ const BLOCK_PROPS = {
58
56
  minHeight: ({ props }) => (0, import_scratch.transformSizeRatio)("minHeight", props),
59
57
  maxHeight: ({ props }) => (0, import_scratch.transformSizeRatio)("maxHeight", props),
60
58
  heightRange: ({ props }) => {
61
- if (!(0, import_utils.isString)(props.heightRange))
62
- return;
59
+ if (!(0, import_utils.isString)(props.heightRange)) return;
63
60
  const [minHeight, maxHeight] = props.heightRange.split(" ");
64
61
  return {
65
62
  ...(0, import_scratch.transformSize)("minHeight", minHeight),
@@ -67,8 +64,7 @@ const BLOCK_PROPS = {
67
64
  };
68
65
  },
69
66
  size: ({ props }) => {
70
- if (!(0, import_utils.isString)(props.size))
71
- return;
67
+ if (!(0, import_utils.isString)(props.size)) return;
72
68
  const [inlineSize, blockSize] = props.size.split(" ");
73
69
  return {
74
70
  ...(0, import_scratch.transformSizeRatio)("inlineSize", inlineSize),
@@ -80,8 +76,7 @@ const BLOCK_PROPS = {
80
76
  maxBlockSize: ({ props }) => (0, import_scratch.transformSizeRatio)("maxBlockSize", props),
81
77
  maxInlineSize: ({ props }) => (0, import_scratch.transformSizeRatio)("maxInlineSize", props),
82
78
  minSize: ({ props }) => {
83
- if (!(0, import_utils.isString)(props.minSize))
84
- return;
79
+ if (!(0, import_utils.isString)(props.minSize)) return;
85
80
  const [minInlineSize, minBlockSize] = props.minSize.split(" ");
86
81
  return {
87
82
  ...(0, import_scratch.transformSize)("minInlineSize", minInlineSize),
@@ -89,8 +84,7 @@ const BLOCK_PROPS = {
89
84
  };
90
85
  },
91
86
  maxSize: ({ props }) => {
92
- if (!(0, import_utils.isString)(props.maxSize))
93
- return;
87
+ if (!(0, import_utils.isString)(props.maxSize)) return;
94
88
  const [maxInlineSize, maxBlockSize] = props.maxSize.split(" ");
95
89
  return {
96
90
  ...(0, import_scratch.transformSize)("maxInlineSize", maxInlineSize),
@@ -101,8 +95,7 @@ const BLOCK_PROPS = {
101
95
  padding: ({ props }) => (0, import_scratch.transformSizeRatio)("padding", props),
102
96
  scrollPadding: ({ props }) => (0, import_scratch.transformSizeRatio)("scrollPadding", props),
103
97
  paddingInline: ({ props }) => {
104
- if (!(0, import_utils.isString)(props.paddingInline))
105
- return;
98
+ if (!(0, import_utils.isString)(props.paddingInline)) return;
106
99
  const [paddingInlineStart, paddingInlineEnd] = props.paddingInline.split(" ");
107
100
  return {
108
101
  ...(0, import_scratch.transformSize)("paddingInlineStart", paddingInlineStart),
@@ -110,8 +103,7 @@ const BLOCK_PROPS = {
110
103
  };
111
104
  },
112
105
  paddingBlock: ({ props }) => {
113
- if (!(0, import_utils.isString)(props.paddingBlock))
114
- return;
106
+ if (!(0, import_utils.isString)(props.paddingBlock)) return;
115
107
  const [paddingBlockStart, paddingBlockEnd] = props.paddingBlock.split(" ");
116
108
  return {
117
109
  ...(0, import_scratch.transformSize)("paddingBlockStart", paddingBlockStart),
@@ -124,8 +116,7 @@ const BLOCK_PROPS = {
124
116
  paddingBlockEnd: ({ props }) => (0, import_scratch.transformSizeRatio)("paddingBlockEnd", props),
125
117
  margin: ({ props }) => (0, import_scratch.transformSizeRatio)("margin", props),
126
118
  marginInline: ({ props }) => {
127
- if (!(0, import_utils.isString)(props.marginInline))
128
- return;
119
+ if (!(0, import_utils.isString)(props.marginInline)) return;
129
120
  const [marginInlineStart, marginInlineEnd] = props.marginInline.split(" ");
130
121
  return {
131
122
  ...(0, import_scratch.transformSize)("marginInlineStart", marginInlineStart),
@@ -133,8 +124,7 @@ const BLOCK_PROPS = {
133
124
  };
134
125
  },
135
126
  marginBlock: ({ props }) => {
136
- if (!(0, import_utils.isString)(props.marginBlock))
137
- return;
127
+ if (!(0, import_utils.isString)(props.marginBlock)) return;
138
128
  const [marginBlockStart, marginBlockEnd] = props.marginBlock.split(" ");
139
129
  return {
140
130
  ...(0, import_scratch.transformSize)("marginBlockStart", marginBlockStart),
@@ -156,21 +146,17 @@ const BLOCK_PROPS = {
156
146
  }),
157
147
  flexFlow: ({ props }) => {
158
148
  const { flexFlow, reverse } = props;
159
- if (!(0, import_utils.isString)(flexFlow))
160
- return;
149
+ if (!(0, import_utils.isString)(flexFlow)) return;
161
150
  let [direction, wrap] = (flexFlow || "row").split(" ");
162
- if (flexFlow.startsWith("x") || flexFlow === "row")
163
- direction = "row";
164
- if (flexFlow.startsWith("y") || flexFlow === "column")
165
- direction = "column";
151
+ if (flexFlow.startsWith("x") || flexFlow === "row") direction = "row";
152
+ if (flexFlow.startsWith("y") || flexFlow === "column") direction = "column";
166
153
  return {
167
154
  display: "flex",
168
155
  flexFlow: (direction || "") + (!direction.includes("-reverse") && reverse ? "-reverse" : "") + " " + (wrap || "")
169
156
  };
170
157
  },
171
158
  flexAlign: ({ props }) => {
172
- if (!(0, import_utils.isString)(props.flexAlign))
173
- return;
159
+ if (!(0, import_utils.isString)(props.flexAlign)) return;
174
160
  const [alignItems, justifyContent] = props.flexAlign.split(" ");
175
161
  return {
176
162
  display: "flex",
@@ -28,11 +28,9 @@ const MISC_PROPS = {
28
28
  },
29
29
  cursor: (el, s, ctx) => {
30
30
  let val = el.props.cursor;
31
- if (!val)
32
- return;
31
+ if (!val) return;
33
32
  const file = ctx.files && ctx.files[val];
34
- if (file && file.content)
35
- val = `url(${file.content.src})`;
33
+ if (file && file.content) val = `url(${file.content.src})`;
36
34
  return { cursor: val };
37
35
  }
38
36
  };
@@ -25,10 +25,8 @@ var import_scratch = require("@symbo.ls/scratch");
25
25
  const POSITION_PROPS = {
26
26
  inset: ({ props, context }) => {
27
27
  const { inset } = props;
28
- if (context.utils.isNumber(inset))
29
- return { inset };
30
- if (!context.utils.isString(inset))
31
- return;
28
+ if (context.utils.isNumber(inset)) return { inset };
29
+ if (!context.utils.isString(inset)) return;
32
30
  return { inset: inset.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k).join(" ") };
33
31
  },
34
32
  left: ({ props }) => (0, import_scratch.getSpacingByKey)(props.left, "left"),
@@ -37,8 +35,7 @@ const POSITION_PROPS = {
37
35
  bottom: ({ props }) => (0, import_scratch.getSpacingByKey)(props.bottom, "bottom"),
38
36
  verticalInset: ({ props }) => {
39
37
  const { verticalInset } = props;
40
- if (typeof verticalInset !== "string")
41
- return;
38
+ if (typeof verticalInset !== "string") return;
42
39
  const vi = verticalInset.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k);
43
40
  return {
44
41
  top: vi[0],
@@ -47,8 +44,7 @@ const POSITION_PROPS = {
47
44
  },
48
45
  horizontalInset: ({ props }) => {
49
46
  const { horizontalInset } = props;
50
- if (typeof horizontalInset !== "string")
51
- return;
47
+ if (typeof horizontalInset !== "string") return;
52
48
  const vi = horizontalInset.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k);
53
49
  return {
54
50
  left: vi[0],
@@ -32,23 +32,20 @@ const THEME_PROPS = {
32
32
  theme: (element) => {
33
33
  const { props } = element;
34
34
  const globalTheme = getSystemGlobalTheme(element);
35
- if (!props.theme)
36
- return;
35
+ if (!props.theme) return;
37
36
  const hasSubtheme = props.theme.includes(" ") && !props.theme.includes("@");
38
37
  const globalThemeForced = `@${props.themeModifier || globalTheme}`;
39
38
  if (hasSubtheme) {
40
39
  const themeAppliedInVal = props.theme.split(" ");
41
40
  themeAppliedInVal.splice(1, 0, globalThemeForced);
42
41
  return (0, import_scratch.getMediaTheme)(themeAppliedInVal);
43
- } else if (props.theme.includes("@{globalTheme}"))
44
- props.theme.replace("@{globalTheme}", globalThemeForced);
42
+ } else if (props.theme.includes("@{globalTheme}")) props.theme.replace("@{globalTheme}", globalThemeForced);
45
43
  return (0, import_scratch.getMediaTheme)(props.theme, `@${props.themeModifier || globalTheme}`);
46
44
  },
47
45
  color: (element) => {
48
46
  const { props } = element;
49
47
  const globalTheme = getSystemGlobalTheme(element);
50
- if (!props.color)
51
- return;
48
+ if (!props.color) return;
52
49
  return {
53
50
  color: (0, import_scratch.getMediaColor)(props.color, globalTheme)
54
51
  };
@@ -56,8 +53,7 @@ const THEME_PROPS = {
56
53
  background: (element) => {
57
54
  const { props } = element;
58
55
  const globalTheme = getSystemGlobalTheme(element);
59
- if (!props.background)
60
- return;
56
+ if (!props.background) return;
61
57
  return {
62
58
  background: (0, import_scratch.getMediaColor)(props.background, globalTheme)
63
59
  };
@@ -65,8 +61,7 @@ const THEME_PROPS = {
65
61
  backgroundColor: (element) => {
66
62
  const { props } = element;
67
63
  const globalTheme = getSystemGlobalTheme(element);
68
- if (!props.backgroundColor)
69
- return;
64
+ if (!props.backgroundColor) return;
70
65
  return {
71
66
  backgroundColor: (0, import_scratch.getMediaColor)(props.backgroundColor, globalTheme)
72
67
  };
@@ -75,11 +70,9 @@ const THEME_PROPS = {
75
70
  const { props } = element;
76
71
  const globalTheme = getSystemGlobalTheme(element);
77
72
  let val = props.backgroundImage;
78
- if (!val)
79
- return;
73
+ if (!val) return;
80
74
  const file = ctx.files && ctx.files[val];
81
- if (file && file.content)
82
- val = file.content.src;
75
+ if (file && file.content) val = file.content.src;
83
76
  return {
84
77
  backgroundImage: (0, import_scratch.transformBackgroundImage)(val, globalTheme)
85
78
  };
@@ -106,8 +99,7 @@ const THEME_PROPS = {
106
99
  borderColor: (element) => {
107
100
  const { props } = element;
108
101
  const globalTheme = getSystemGlobalTheme(element);
109
- if (!props.borderColor)
110
- return;
102
+ if (!props.borderColor) return;
111
103
  return {
112
104
  borderColor: (0, import_scratch.getMediaColor)(props.borderColor, globalTheme)
113
105
  };
@@ -127,16 +119,14 @@ const THEME_PROPS = {
127
119
  shadow: (element) => {
128
120
  const { props } = element;
129
121
  const globalTheme = getSystemGlobalTheme(element);
130
- if (!props.backgroundImage)
131
- return;
122
+ if (!props.backgroundImage) return;
132
123
  return {
133
124
  boxShadow: (0, import_scratch.transformShadow)(props.shadow, globalTheme)
134
125
  };
135
126
  },
136
127
  boxShadow: (element, state, context) => {
137
128
  const { props } = element;
138
- if (!(0, import_utils.isString)(props.boxShadow))
139
- return;
129
+ if (!(0, import_utils.isString)(props.boxShadow)) return;
140
130
  const [val, hasImportant] = props.boxShadow.split("!importan");
141
131
  const globalTheme = getSystemGlobalTheme(element);
142
132
  const important = hasImportant ? " !important" : "";
@@ -29,13 +29,11 @@ var import_defaults = require("./defaults");
29
29
  const transformClassname = (element, restProps = {}) => {
30
30
  const classCss = {};
31
31
  const { props, class: elementClass } = element;
32
- if (!(0, import_utils.isObject)(props))
33
- return;
32
+ if (!(0, import_utils.isObject)(props)) return;
34
33
  for (const key in props) {
35
34
  const setter = import_atoms.keySetters[key.slice(0, 1)];
36
35
  const hasCSS = elementClass[key];
37
- if (setter)
38
- setter(key, props[key], classCss, element, true);
36
+ if (setter) setter(key, props[key], classCss, element, true);
39
37
  else if ((0, import_utils.isFunction)(hasCSS)) {
40
38
  const stack = hasCSS(element, element.state, element.context);
41
39
  const exec = (0, import_utils.isArray)(stack) ? stack.reduce((a, c) => {
@@ -44,8 +42,7 @@ const transformClassname = (element, restProps = {}) => {
44
42
  (0, import_utils.deepMerge)(classCss, exec);
45
43
  } else if (key === "style") {
46
44
  (0, import_utils.deepMerge)(classCss, props[key]);
47
- } else
48
- restProps[key] = props[key];
45
+ } else restProps[key] = props[key];
49
46
  }
50
47
  return classCss;
51
48
  };
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.25.3",
5
+ "version": "2.27.8",
6
6
  "repository": "https://github.com/symbo-ls/smbls",
7
7
  "type": "module",
8
8
  "module": "src/index.js",
@@ -14,9 +14,9 @@
14
14
  "publishConfig": {},
15
15
  "scripts": {
16
16
  "copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
17
- "build:esm": "npx esbuild ./src/*.js ./src/**/*.js --target=es2017 --format=esm --outdir=dist/esm",
18
- "build:cjs": "npx esbuild ./src/*.js ./src/**/*.js --target=node16 --format=cjs --outdir=dist/cjs",
19
- "build:iife": "npx esbuild ./src/index.js --target=es2017 --format=iife --outdir=dist/iife --bundle --minify",
17
+ "build:esm": "cross-env NODE_ENV=$NODE_ENV npx esbuild ./src/*.js ./src/**/*.js --target=es2017 --format=esm --outdir=dist/esm",
18
+ "build:cjs": "cross-env NODE_ENV=$NODE_ENV npx esbuild ./src/*.js ./src/**/*.js --target=node16 --format=cjs --outdir=dist/cjs",
19
+ "build:iife": "cross-env NODE_ENV=$NODE_ENV npx esbuild ./src/index.js --target=es2017 --format=iife --outdir=dist/iife --bundle --minify",
20
20
  "build": "npm run build:cjs",
21
21
  "prepublish": "rimraf -I dist && npm run build && npm run copy:package:cjs"
22
22
  },
@@ -25,10 +25,10 @@
25
25
  "dist"
26
26
  ],
27
27
  "dependencies": {
28
- "@domql/utils": "^2.25.3",
29
- "@symbo.ls/atoms": "^2.25.3",
30
- "@symbo.ls/emotion": "^2.25.3",
31
- "@symbo.ls/scratch": "^2.25.3"
28
+ "@domql/utils": "^2.27.8",
29
+ "@symbo.ls/atoms": "^2.27.8",
30
+ "@symbo.ls/emotion": "^2.27.8",
31
+ "@symbo.ls/scratch": "^2.27.8"
32
32
  },
33
- "gitHead": "1e749ee3ef95b5a4a618c4eda1961f7c3011beff"
33
+ "gitHead": "e783fd54228d5c7aaab9d4b5624199a17a6c4713"
34
34
  }