css-in-props 3.14.0 → 3.14.1

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 (38) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/{props/defaults.js → defaults.js} +2 -2
  3. package/dist/cjs/{transform/index.js → emotion.js} +15 -5
  4. package/dist/cjs/index.js +21 -4
  5. package/dist/cjs/package.json +4 -0
  6. package/dist/cjs/props/animation.js +24 -93
  7. package/dist/cjs/props/block.js +78 -84
  8. package/dist/cjs/props/font.js +8 -7
  9. package/dist/cjs/props/index.js +7 -38
  10. package/dist/cjs/props/misc.js +9 -15
  11. package/dist/cjs/props/position.js +17 -14
  12. package/dist/cjs/props/theme.js +77 -77
  13. package/dist/cjs/props/timing.js +11 -11
  14. package/dist/cjs/registry.js +39 -0
  15. package/dist/cjs/set.js +6 -13
  16. package/dist/cjs/transform.js +80 -0
  17. package/package.json +1 -1
  18. package/dist/cjs/props/flex.js +0 -44
  19. package/dist/cjs/props/grid.js +0 -39
  20. package/dist/cjs/transform/executors.js +0 -131
  21. package/dist/cjs/transform/transformers.js +0 -156
  22. package/dist/esm/index.js +0 -4
  23. package/dist/esm/props/animation.js +0 -106
  24. package/dist/esm/props/block.js +0 -159
  25. package/dist/esm/props/defaults.js +0 -321
  26. package/dist/esm/props/flex.js +0 -24
  27. package/dist/esm/props/font.js +0 -16
  28. package/dist/esm/props/grid.js +0 -19
  29. package/dist/esm/props/index.js +0 -34
  30. package/dist/esm/props/misc.js +0 -22
  31. package/dist/esm/props/position.js +0 -31
  32. package/dist/esm/props/theme.js +0 -137
  33. package/dist/esm/props/timing.js +0 -26
  34. package/dist/esm/set.js +0 -16
  35. package/dist/esm/transform/executors.js +0 -111
  36. package/dist/esm/transform/index.js +0 -2
  37. package/dist/esm/transform/transformers.js +0 -136
  38. package/dist/iife/index.js +0 -1147
package/README.md CHANGED
@@ -71,7 +71,7 @@ import { transformersByPrefix } from 'css-in-props'
71
71
 
72
72
  The `$` prefix is used both by css-in-props (`$isActive` case conditional) and by the define system (e.g. `$router`). The framework resolves this by checking for define handlers before applying prefix rules. Keys with matching define handlers stay at the element root; only `$`-prefixed keys without define handlers are processed by css-in-props.
73
73
 
74
- > In v4, properties go directly on the element (no `props:` wrapper). The CSS engine processes design token properties internally.
74
+ > In v3.14, properties go directly on the element (no `props:` wrapper). The CSS engine processes design token properties internally.
75
75
 
76
76
  ## Global Cases
77
77
 
@@ -20,7 +20,7 @@ __export(defaults_exports, {
20
20
  DEFAULT_CSS_PROPERTIES_LIST: () => DEFAULT_CSS_PROPERTIES_LIST
21
21
  });
22
22
  module.exports = __toCommonJS(defaults_exports);
23
- const DEFAULT_CSS_PROPERTIES_LIST = /* @__PURE__ */ new Set([
23
+ const DEFAULT_CSS_PROPERTIES_LIST = [
24
24
  "accentColor",
25
25
  "alignContent",
26
26
  "alignItems",
@@ -337,4 +337,4 @@ const DEFAULT_CSS_PROPERTIES_LIST = /* @__PURE__ */ new Set([
337
337
  "wordWrap",
338
338
  "writingMode",
339
339
  "zIndex"
340
- ]);
340
+ ];
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
6
10
  var __copyProps = (to, from, except, desc) => {
7
11
  if (from && typeof from === "object" || typeof from === "function") {
8
12
  for (let key of __getOwnPropNames(from))
@@ -11,9 +15,15 @@ var __copyProps = (to, from, except, desc) => {
11
15
  }
12
16
  return to;
13
17
  };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var transform_exports = {};
17
- module.exports = __toCommonJS(transform_exports);
18
- __reExport(transform_exports, require("./executors.js"), module.exports);
19
- __reExport(transform_exports, require("./transformers.js"), module.exports);
19
+ var emotion_exports = {};
20
+ __export(emotion_exports, {
21
+ transformEmotion: () => transformEmotion
22
+ });
23
+ module.exports = __toCommonJS(emotion_exports);
24
+ var import_utils = require("@domql/utils");
25
+ var import_emotion = require("@symbo.ls/emotion");
26
+ const { css } = import_emotion.emotion;
27
+ const transformEmotion = (props, callback) => {
28
+ return (0, import_utils.isFunction)(callback) ? callback(props) : css(props);
29
+ };
package/dist/cjs/index.js CHANGED
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
6
10
  var __copyProps = (to, from, except, desc) => {
7
11
  if (from && typeof from === "object" || typeof from === "function") {
8
12
  for (let key of __getOwnPropNames(from))
@@ -14,8 +18,21 @@ var __copyProps = (to, from, except, desc) => {
14
18
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
20
  var index_exports = {};
21
+ __export(index_exports, {
22
+ exetuteClassPerComponent: () => exetuteClassPerComponent
23
+ });
17
24
  module.exports = __toCommonJS(index_exports);
18
- __reExport(index_exports, require("./transform/index.js"), module.exports);
19
- __reExport(index_exports, require("./set.js"), module.exports);
20
- __reExport(index_exports, require("./props/index.js"), module.exports);
21
- __reExport(index_exports, require("./props/defaults.js"), module.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
+ const exetuteClassPerComponent = (component, element) => {
31
+ const classObj = {};
32
+ if (component.class) {
33
+ for (const classProp in component.class) {
34
+ classObj[classProp] = component.class[classProp](element);
35
+ }
36
+ }
37
+ return classObj;
38
+ };
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "commonjs",
3
+ "main": "index.js"
4
+ }
@@ -21,106 +21,37 @@ __export(animation_exports, {
21
21
  ANIMATION_PROPS: () => ANIMATION_PROPS
22
22
  });
23
23
  module.exports = __toCommonJS(animation_exports);
24
- var import_utils = require("@symbo.ls/utils");
25
- var import_css = require("@symbo.ls/css");
24
+ var import_utils = require("@domql/utils");
25
+ var import_emotion = require("@symbo.ls/emotion");
26
26
  var import_scratch = require("@symbo.ls/scratch");
27
- const TIMING_FUNCTIONS = ["ease", "linear", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end"];
28
- const FILL_MODES = ["none", "forwards", "backwards", "both"];
29
- const DIRECTIONS = ["normal", "reverse", "alternate", "alternate-reverse"];
30
- const PLAY_STATES = ["running", "paused"];
31
- const isDuration = (v) => /^[\d.]+m?s$/.test(v);
32
- let _animCounter = 0;
33
27
  const applyAnimationProps = (animation, element) => {
34
- const { animation: ANIMATION } = element.context && element.context.designSystem || {};
35
- if ((0, import_utils.isObject)(animation)) {
36
- const name = `smbls-anim-${_animCounter++}`;
37
- return { animationName: (0, import_css.keyframes)(name, animation) };
38
- }
39
- const record = ANIMATION && ANIMATION[animation];
40
- if ((0, import_utils.isObject)(record)) {
41
- return (0, import_css.keyframes)(animation, record);
42
- }
43
- return animation;
44
- };
45
- const parseAnimationShorthand = (val, el) => {
46
- const { animation: ANIMATION } = el.context && el.context.designSystem || {};
47
- const tokens = val.split(/\s+/);
48
- let name = null;
49
- const durations = [];
50
- let timingFunction = null;
51
- let iterationCount = null;
52
- let direction = null;
53
- let fillMode = null;
54
- let playState = null;
55
- for (const token of tokens) {
56
- if (ANIMATION && ANIMATION[token]) {
57
- name = token;
58
- } else if (isDuration(token)) {
59
- durations.push(token);
60
- } else if (TIMING_FUNCTIONS.includes(token) || token.startsWith("cubic-bezier") || token.startsWith("steps(")) {
61
- timingFunction = token;
62
- } else if (token === "infinite" || /^\d+$/.test(token)) {
63
- iterationCount = token === "infinite" ? token : Number(token);
64
- } else if (DIRECTIONS.includes(token)) {
65
- direction = token;
66
- } else if (FILL_MODES.includes(token)) {
67
- fillMode = token;
68
- } else if (PLAY_STATES.includes(token)) {
69
- playState = token;
70
- } else if (!name) {
71
- name = token;
72
- }
73
- }
74
- return { name, durations, timingFunction, iterationCount, direction, fillMode, playState };
28
+ const { emotion: ctxEmotion } = element.context;
29
+ const { keyframes } = ctxEmotion || import_emotion.emotion;
30
+ if ((0, import_utils.isObject)(animation)) return { animationName: keyframes(animation) };
31
+ const { ANIMATION } = element.context && element.context.designSystem;
32
+ const record = ANIMATION[animation];
33
+ return keyframes(record);
75
34
  };
76
35
  const ANIMATION_PROPS = {
77
- animation: (val, el) => {
78
- if ((0, import_utils.isString)(val) && val.includes(" ")) {
79
- const parsed = parseAnimationShorthand(val, el);
80
- return {
81
- animationName: applyAnimationProps(parsed.name || val, el),
82
- animationDuration: parsed.durations[0] || (0, import_scratch.getTimingByKey)(el.animationDuration || "A").timing,
83
- animationDelay: parsed.durations[1] || (0, import_scratch.getTimingByKey)(el.animationDelay || "0s").timing,
84
- animationTimingFunction: parsed.timingFunction || (0, import_scratch.getTimingFunction)(el.animationTimingFunction || "ease"),
85
- animationFillMode: parsed.fillMode || el.animationFillMode || "both",
86
- animationIterationCount: parsed.iterationCount != null ? parsed.iterationCount : el.animationIterationCount || 1,
87
- animationPlayState: parsed.playState || el.animationPlayState,
88
- animationDirection: parsed.direction || el.animationDirection
89
- };
90
- }
91
- return {
92
- animationName: applyAnimationProps(val, el),
93
- animationDuration: (0, import_scratch.getTimingByKey)(el.animationDuration || "A").timing,
94
- animationDelay: (0, import_scratch.getTimingByKey)(el.animationDelay || "0s").timing,
95
- animationTimingFunction: (0, import_scratch.getTimingFunction)(el.animationTimingFunction || "ease"),
96
- animationFillMode: el.animationFillMode || "both",
97
- animationIterationCount: el.animationIterationCount || 1,
98
- animationPlayState: el.animationPlayState,
99
- animationDirection: el.animationDirection
100
- };
101
- },
102
- animationName: (val, el) => ({
103
- animationName: applyAnimationProps(val, el)
104
- }),
105
- animationDuration: (val) => ({
106
- animationDuration: (0, import_scratch.getTimingByKey)(val).timing
107
- }),
108
- animationDelay: (val) => ({
109
- animationDelay: (0, import_scratch.getTimingByKey)(val).timing
110
- }),
111
- animationTimingFunction: (val) => ({
112
- animationTimingFunction: (0, import_scratch.getTimingFunction)(val)
36
+ animation: (el) => ({
37
+ animationName: applyAnimationProps(el.props.animation, el),
38
+ animationDuration: (0, import_scratch.getTimingByKey)(el.props.animationDuration || "A").timing,
39
+ animationDelay: (0, import_scratch.getTimingByKey)(el.props.animationDelay || "0s").timing,
40
+ animationTimingFunction: (0, import_scratch.getTimingFunction)(el.props.animationTimingFunction || "ease"),
41
+ animationFillMode: el.props.animationFillMode || "both",
42
+ animationPlayState: el.props.animationPlayState,
43
+ animationDirection: el.props.animationDirection
113
44
  }),
114
- animationIterationCount: (val) => ({
115
- animationIterationCount: val
45
+ animationName: (el) => ({
46
+ animationName: applyAnimationProps(el.props.animationName, el)
116
47
  }),
117
- animationFillMode: (val) => ({
118
- animationFillMode: val
48
+ animationDuration: ({ props, deps }) => ({
49
+ animationDuration: deps.getTimingByKey(props.animationDuration).timing
119
50
  }),
120
- animationPlayState: (val) => ({
121
- animationPlayState: val
51
+ animationDelay: ({ props, deps }) => ({
52
+ animationDelay: deps.getTimingByKey(props.animationDelay).timing
122
53
  }),
123
- animationDirection: (val) => ({
124
- animationDirection: val
54
+ animationTimingFunction: ({ props, deps }) => ({
55
+ animationTimingFunction: deps.getTimingFunction(props.animationTimingFunction)
125
56
  })
126
57
  };
@@ -21,153 +21,147 @@ __export(block_exports, {
21
21
  BLOCK_PROPS: () => BLOCK_PROPS
22
22
  });
23
23
  module.exports = __toCommonJS(block_exports);
24
- var import_utils = require("@symbo.ls/utils");
24
+ var import_utils = require("@domql/utils");
25
25
  var import_scratch = require("@symbo.ls/scratch");
26
26
  const BLOCK_PROPS = {
27
- show: (val) => !val ? { display: "none !important" } : void 0,
28
- hide: (val) => val ? { display: "none !important" } : void 0,
29
- height: (val, el) => (0, import_scratch.transformSizeRatio)("height", val, el),
30
- width: (val, el) => (0, import_scratch.transformSizeRatio)("width", val, el),
31
- boxSizing: (val) => !(0, import_utils.isUndefined)(val) ? { boxSizing: val } : { boxSizing: "border-box" },
32
- boxSize: (val) => {
33
- if (!(0, import_utils.isString)(val)) return;
34
- const [height, width] = val.split(" ");
27
+ show: (el, s, ctx) => !!(ctx.utils.exec(el.props.show, el, s) === false) && {
28
+ display: "none !important"
29
+ },
30
+ hide: (el, s, ctx) => !!ctx.utils.exec(el.props.hide, el, s) && {
31
+ display: "none !important"
32
+ },
33
+ height: ({ props }) => (0, import_scratch.transformSizeRatio)("height", props),
34
+ width: ({ props }) => (0, import_scratch.transformSizeRatio)("width", props),
35
+ boxSizing: ({ props }) => !(0, import_utils.isUndefined)(props.boxSizing) ? { boxSizing: props.boxSizing } : { boxSizing: "border-box" },
36
+ boxSize: ({ props }) => {
37
+ if (!(0, import_utils.isString)(props.boxSize)) return;
38
+ const [height, width] = props.boxSize.split(" ");
35
39
  return {
36
40
  ...(0, import_scratch.transformSize)("height", height),
37
41
  ...(0, import_scratch.transformSize)("width", width || height)
38
42
  };
39
43
  },
40
- inlineSize: (val, el) => (0, import_scratch.transformSizeRatio)("inlineSize", val, el),
41
- blockSize: (val, el) => (0, import_scratch.transformSizeRatio)("blockSize", val, el),
42
- minWidth: (val, el) => (0, import_scratch.transformSizeRatio)("minWidth", val, el),
43
- maxWidth: (val, el) => (0, import_scratch.transformSizeRatio)("maxWidth", val, el),
44
- widthRange: (val) => {
45
- if (!(0, import_utils.isString)(val)) return;
46
- const [minWidth, maxWidth] = val.split(" ");
44
+ inlineSize: ({ props }) => (0, import_scratch.transformSizeRatio)("inlineSize", props),
45
+ blockSize: ({ props }) => (0, import_scratch.transformSizeRatio)("blockSize", props),
46
+ minWidth: ({ props }) => (0, import_scratch.transformSizeRatio)("minWidth", props),
47
+ maxWidth: ({ props }) => (0, import_scratch.transformSizeRatio)("maxWidth", props),
48
+ widthRange: ({ props }) => {
49
+ if (!(0, import_utils.isString)(props.widthRange)) return;
50
+ const [minWidth, maxWidth] = props.widthRange.split(" ");
47
51
  return {
48
52
  ...(0, import_scratch.transformSize)("minWidth", minWidth),
49
53
  ...(0, import_scratch.transformSize)("maxWidth", maxWidth || minWidth)
50
54
  };
51
55
  },
52
- minHeight: (val, el) => (0, import_scratch.transformSizeRatio)("minHeight", val, el),
53
- maxHeight: (val, el) => (0, import_scratch.transformSizeRatio)("maxHeight", val, el),
54
- heightRange: (val) => {
55
- if (!(0, import_utils.isString)(val)) return;
56
- const [minHeight, maxHeight] = val.split(" ");
56
+ minHeight: ({ props }) => (0, import_scratch.transformSizeRatio)("minHeight", props),
57
+ maxHeight: ({ props }) => (0, import_scratch.transformSizeRatio)("maxHeight", props),
58
+ heightRange: ({ props }) => {
59
+ if (!(0, import_utils.isString)(props.heightRange)) return;
60
+ const [minHeight, maxHeight] = props.heightRange.split(" ");
57
61
  return {
58
62
  ...(0, import_scratch.transformSize)("minHeight", minHeight),
59
63
  ...(0, import_scratch.transformSize)("maxHeight", maxHeight || minHeight)
60
64
  };
61
65
  },
62
- size: (val) => {
63
- if (!(0, import_utils.isString)(val)) return;
64
- const [inlineSize, blockSize] = val.split(" ");
66
+ size: ({ props }) => {
67
+ if (!(0, import_utils.isString)(props.size)) return;
68
+ const [inlineSize, blockSize] = props.size.split(" ");
65
69
  return {
66
70
  ...(0, import_scratch.transformSizeRatio)("inlineSize", inlineSize),
67
71
  ...(0, import_scratch.transformSizeRatio)("blockSize", blockSize || inlineSize)
68
72
  };
69
73
  },
70
- minBlockSize: (val, el) => (0, import_scratch.transformSizeRatio)("minBlockSize", val, el),
71
- minInlineSize: (val, el) => (0, import_scratch.transformSizeRatio)("minInlineSize", val, el),
72
- maxBlockSize: (val, el) => (0, import_scratch.transformSizeRatio)("maxBlockSize", val, el),
73
- maxInlineSize: (val, el) => (0, import_scratch.transformSizeRatio)("maxInlineSize", val, el),
74
- minSize: (val) => {
75
- if (!(0, import_utils.isString)(val)) return;
76
- const [minInlineSize, minBlockSize] = val.split(" ");
74
+ minBlockSize: ({ props }) => (0, import_scratch.transformSizeRatio)("minBlockSize", props),
75
+ minInlineSize: ({ props }) => (0, import_scratch.transformSizeRatio)("minInlineSize", props),
76
+ maxBlockSize: ({ props }) => (0, import_scratch.transformSizeRatio)("maxBlockSize", props),
77
+ maxInlineSize: ({ props }) => (0, import_scratch.transformSizeRatio)("maxInlineSize", props),
78
+ minSize: ({ props }) => {
79
+ if (!(0, import_utils.isString)(props.minSize)) return;
80
+ const [minInlineSize, minBlockSize] = props.minSize.split(" ");
77
81
  return {
78
82
  ...(0, import_scratch.transformSize)("minInlineSize", minInlineSize),
79
83
  ...(0, import_scratch.transformSize)("minBlockSize", minBlockSize || minInlineSize)
80
84
  };
81
85
  },
82
- maxSize: (val) => {
83
- if (!(0, import_utils.isString)(val)) return;
84
- const [maxInlineSize, maxBlockSize] = val.split(" ");
86
+ maxSize: ({ props }) => {
87
+ if (!(0, import_utils.isString)(props.maxSize)) return;
88
+ const [maxInlineSize, maxBlockSize] = props.maxSize.split(" ");
85
89
  return {
86
90
  ...(0, import_scratch.transformSize)("maxInlineSize", maxInlineSize),
87
91
  ...(0, import_scratch.transformSize)("maxBlockSize", maxBlockSize || maxInlineSize)
88
92
  };
89
93
  },
90
- borderWidth: (val, el) => (0, import_scratch.transformSizeRatio)("borderWidth", val, el),
91
- padding: (val, el) => (0, import_scratch.transformSizeRatio)("padding", val, el),
92
- scrollPadding: (val, el) => (0, import_scratch.transformSizeRatio)("scrollPadding", val, el),
93
- paddingInline: (val) => {
94
- if (!(0, import_utils.isString)(val)) return;
95
- const [paddingInlineStart, paddingInlineEnd] = val.split(" ");
94
+ borderWidth: ({ props }) => (0, import_scratch.transformSizeRatio)("borderWidth", props),
95
+ padding: ({ props }) => (0, import_scratch.transformSizeRatio)("padding", props),
96
+ scrollPadding: ({ props }) => (0, import_scratch.transformSizeRatio)("scrollPadding", props),
97
+ paddingInline: ({ props }) => {
98
+ if (!(0, import_utils.isString)(props.paddingInline)) return;
99
+ const [paddingInlineStart, paddingInlineEnd] = props.paddingInline.split(" ");
96
100
  return {
97
101
  ...(0, import_scratch.transformSize)("paddingInlineStart", paddingInlineStart),
98
102
  ...(0, import_scratch.transformSize)("paddingInlineEnd", paddingInlineEnd || paddingInlineStart)
99
103
  };
100
104
  },
101
- paddingBlock: (val) => {
102
- if (!(0, import_utils.isString)(val)) return;
103
- const [paddingBlockStart, paddingBlockEnd] = val.split(" ");
105
+ paddingBlock: ({ props }) => {
106
+ if (!(0, import_utils.isString)(props.paddingBlock)) return;
107
+ const [paddingBlockStart, paddingBlockEnd] = props.paddingBlock.split(" ");
104
108
  return {
105
109
  ...(0, import_scratch.transformSize)("paddingBlockStart", paddingBlockStart),
106
110
  ...(0, import_scratch.transformSize)("paddingBlockEnd", paddingBlockEnd || paddingBlockStart)
107
111
  };
108
112
  },
109
- paddingTop: (val, el) => (0, import_scratch.transformSizeRatio)("paddingBlockStart", val, el),
110
- paddingBottom: (val, el) => (0, import_scratch.transformSizeRatio)("paddingBlockEnd", val, el),
111
- paddingLeft: (val, el) => (0, import_scratch.transformSizeRatio)("paddingInlineStart", val, el),
112
- paddingRight: (val, el) => (0, import_scratch.transformSizeRatio)("paddingInlineEnd", val, el),
113
- paddingBlockStart: (val, el) => (0, import_scratch.transformSizeRatio)("paddingBlockStart", val, el),
114
- paddingBlockEnd: (val, el) => (0, import_scratch.transformSizeRatio)("paddingBlockEnd", val, el),
115
- paddingInlineStart: (val, el) => (0, import_scratch.transformSizeRatio)("paddingInlineStart", val, el),
116
- paddingInlineEnd: (val, el) => (0, import_scratch.transformSizeRatio)("paddingInlineEnd", val, el),
117
- margin: (val, el) => (0, import_scratch.transformSizeRatio)("margin", val, el),
118
- marginInline: (val) => {
119
- if (!(0, import_utils.isString)(val)) return;
120
- const [marginInlineStart, marginInlineEnd] = val.split(" ");
113
+ paddingInlineStart: ({ props }) => (0, import_scratch.transformSizeRatio)("paddingInlineStart", props),
114
+ paddingInlineEnd: ({ props }) => (0, import_scratch.transformSizeRatio)("paddingInlineEnd", props),
115
+ paddingBlockStart: ({ props }) => (0, import_scratch.transformSizeRatio)("paddingBlockStart", props),
116
+ paddingBlockEnd: ({ props }) => (0, import_scratch.transformSizeRatio)("paddingBlockEnd", props),
117
+ margin: ({ props }) => (0, import_scratch.transformSizeRatio)("margin", props),
118
+ marginInline: ({ props }) => {
119
+ if (!(0, import_utils.isString)(props.marginInline)) return;
120
+ const [marginInlineStart, marginInlineEnd] = props.marginInline.split(" ");
121
121
  return {
122
122
  ...(0, import_scratch.transformSize)("marginInlineStart", marginInlineStart),
123
123
  ...(0, import_scratch.transformSize)("marginInlineEnd", marginInlineEnd || marginInlineStart)
124
124
  };
125
125
  },
126
- marginBlock: (val, el) => {
127
- if (!(0, import_utils.isString)(el.marginBlock)) return;
128
- const [marginBlockStart, marginBlockEnd] = el.marginBlock.split(" ");
126
+ marginBlock: ({ props }) => {
127
+ if (!(0, import_utils.isString)(props.marginBlock)) return;
128
+ const [marginBlockStart, marginBlockEnd] = props.marginBlock.split(" ");
129
129
  return {
130
130
  ...(0, import_scratch.transformSize)("marginBlockStart", marginBlockStart),
131
131
  ...(0, import_scratch.transformSize)("marginBlockEnd", marginBlockEnd || marginBlockStart)
132
132
  };
133
133
  },
134
- marginTop: (val, el) => (0, import_scratch.transformSizeRatio)("marginBlockStart", val, el),
135
- marginBottom: (val, el) => (0, import_scratch.transformSizeRatio)("marginBlockEnd", val, el),
136
- marginLeft: (val, el) => (0, import_scratch.transformSizeRatio)("marginInlineStart", val, el),
137
- marginRight: (val, el) => (0, import_scratch.transformSizeRatio)("marginInlineEnd", val, el),
138
- marginInlineStart: (val, el) => (0, import_scratch.transformSizeRatio)("marginInlineStart", val, el),
139
- marginInlineEnd: (val, el) => (0, import_scratch.transformSizeRatio)("marginInlineEnd", val, el),
140
- marginBlockStart: (val, el) => (0, import_scratch.transformSizeRatio)("marginBlockStart", val, el),
141
- marginBlockEnd: (val, el) => (0, import_scratch.transformSizeRatio)("marginBlockEnd", val, el),
142
- gap: (val) => ({
143
- gap: (0, import_scratch.transfromGap)(val)
134
+ marginInlineStart: ({ props }) => (0, import_scratch.transformSizeRatio)("marginInlineStart", props),
135
+ marginInlineEnd: ({ props }) => (0, import_scratch.transformSizeRatio)("marginInlineEnd", props),
136
+ marginBlockStart: ({ props }) => (0, import_scratch.transformSizeRatio)("marginBlockStart", props),
137
+ marginBlockEnd: ({ props }) => (0, import_scratch.transformSizeRatio)("marginBlockEnd", props),
138
+ gap: ({ props }) => ({
139
+ gap: (0, import_scratch.transfromGap)(props.gap)
144
140
  }),
145
- columnGap: (val, el) => (0, import_scratch.getSpacingBasedOnRatio)(el, "columnGap", val),
146
- rowGap: (val, el) => (0, import_scratch.getSpacingBasedOnRatio)(el, "rowGap", val),
147
- flexWrap: (val) => ({
141
+ columnGap: ({ props }) => (0, import_scratch.getSpacingBasedOnRatio)(props, "columnGap"),
142
+ rowGap: ({ props }) => (0, import_scratch.getSpacingBasedOnRatio)(props, "rowGap"),
143
+ flexWrap: ({ props }) => ({
148
144
  display: "flex",
149
- flexWrap: val
145
+ flexFlow: (props.flexFlow || "row").split(" ")[0] + " " + props.flexWrap
150
146
  }),
151
- flexFlow: (val, el) => {
152
- const reverse = el.reverse;
153
- if (!(0, import_utils.isString)(val)) return;
154
- let [direction, wrap] = (val || "row").split(" ");
155
- if (val.startsWith("x") || val === "row") direction = "row";
156
- if (val.startsWith("y") || val === "column") direction = "column";
147
+ flexFlow: ({ props }) => {
148
+ const { flexFlow, reverse } = props;
149
+ if (!(0, import_utils.isString)(flexFlow)) return;
150
+ let [direction, wrap] = (flexFlow || "row").split(" ");
151
+ if (flexFlow.startsWith("x") || flexFlow === "row") direction = "row";
152
+ if (flexFlow.startsWith("y") || flexFlow === "column") direction = "column";
157
153
  return {
158
154
  display: "flex",
159
155
  flexFlow: (direction || "") + (!direction.includes("-reverse") && reverse ? "-reverse" : "") + " " + (wrap || "")
160
156
  };
161
157
  },
162
- flexAlign: (val) => {
163
- if (!(0, import_utils.isString)(val)) return;
164
- const [alignItems, justifyContent] = val.split(" ");
158
+ flexAlign: ({ props }) => {
159
+ if (!(0, import_utils.isString)(props.flexAlign)) return;
160
+ const [alignItems, justifyContent] = props.flexAlign.split(" ");
165
161
  return {
166
162
  display: "flex",
167
163
  alignItems,
168
164
  justifyContent
169
165
  };
170
- },
171
- round: (val, el) => (0, import_scratch.transformBorderRadius)(val ?? el.borderRadius, el, "round"),
172
- borderRadius: (val, el) => (0, import_scratch.transformBorderRadius)(val ?? el.round, el, "borderRadius")
166
+ }
173
167
  };
@@ -23,14 +23,15 @@ __export(font_exports, {
23
23
  module.exports = __toCommonJS(font_exports);
24
24
  var import_scratch = require("@symbo.ls/scratch");
25
25
  const FONT_PROPS = {
26
- fontSize: (value) => {
27
- return (0, import_scratch.getFontSizeByKey)(value) || value;
26
+ fontSize: (el) => {
27
+ const { props } = el;
28
+ return props.fontSize ? (0, import_scratch.getFontSizeByKey)(props.fontSize) : null;
28
29
  },
29
- fontFamily: (value) => ({
30
- fontFamily: (0, import_scratch.getFontFamily)(value) || value
30
+ fontFamily: ({ props }) => ({
31
+ fontFamily: (0, import_scratch.getFontFamily)(props.fontFamily) || props.fontFamily
31
32
  }),
32
- fontWeight: (value) => ({
33
- fontWeight: value,
34
- fontVariationSettings: '"wght" ' + value
33
+ fontWeight: ({ props }) => ({
34
+ fontWeight: props.fontWeight,
35
+ fontVariationSettings: '"wght" ' + props.fontWeight
35
36
  })
36
37
  };
@@ -3,10 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
6
  var __copyProps = (to, from, except, desc) => {
11
7
  if (from && typeof from === "object" || typeof from === "function") {
12
8
  for (let key of __getOwnPropNames(from))
@@ -18,38 +14,11 @@ var __copyProps = (to, from, except, desc) => {
18
14
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
16
  var props_exports = {};
21
- __export(props_exports, {
22
- CSS_PROPS_REGISTRY: () => CSS_PROPS_REGISTRY,
23
- default: () => props_default
24
- });
25
17
  module.exports = __toCommonJS(props_exports);
26
- var import_animation = require("./animation.js");
27
- var import_block = require("./block.js");
28
- var import_font = require("./font.js");
29
- var import_misc = require("./misc.js");
30
- var import_position = require("./position.js");
31
- var import_theme = require("./theme.js");
32
- var import_timing = require("./timing.js");
33
- var import_flex = require("./flex.js");
34
- var import_grid = require("./grid.js");
35
- __reExport(props_exports, require("./animation.js"), module.exports);
36
- __reExport(props_exports, require("./block.js"), module.exports);
37
- __reExport(props_exports, require("./font.js"), module.exports);
38
- __reExport(props_exports, require("./misc.js"), module.exports);
39
- __reExport(props_exports, require("./position.js"), module.exports);
40
- __reExport(props_exports, require("./theme.js"), module.exports);
41
- __reExport(props_exports, require("./timing.js"), module.exports);
42
- __reExport(props_exports, require("./flex.js"), module.exports);
43
- __reExport(props_exports, require("./grid.js"), module.exports);
44
- const CSS_PROPS_REGISTRY = {
45
- ...import_animation.ANIMATION_PROPS,
46
- ...import_block.BLOCK_PROPS,
47
- ...import_font.FONT_PROPS,
48
- ...import_misc.MISC_PROPS,
49
- ...import_position.POSITION_PROPS,
50
- ...import_theme.THEME_PROPS,
51
- ...import_timing.TIMING_PROPS,
52
- ...import_flex.FLEX_PROPS,
53
- ...import_grid.GRID_PROPS
54
- };
55
- var props_default = CSS_PROPS_REGISTRY;
18
+ __reExport(props_exports, require("./animation"), module.exports);
19
+ __reExport(props_exports, require("./block"), module.exports);
20
+ __reExport(props_exports, require("./font"), module.exports);
21
+ __reExport(props_exports, require("./misc"), module.exports);
22
+ __reExport(props_exports, require("./position"), module.exports);
23
+ __reExport(props_exports, require("./theme"), module.exports);
24
+ __reExport(props_exports, require("./timing"), module.exports);
@@ -22,21 +22,15 @@ __export(misc_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(misc_exports);
24
24
  const MISC_PROPS = {
25
- overflow: (value) => ({
26
- overflow: value,
25
+ overflow: ({ props, deps }) => !deps.isUndefined(props.overflow) && {
26
+ overflow: props.overflow,
27
27
  scrollBehavior: "smooth"
28
- }),
29
- cursor: (value, el, s, ctx) => {
30
- if (!value) return;
31
- const asset = ctx.assets && ctx.assets[value];
32
- if (asset && asset.content) value = `url(${asset.content.src})`;
33
- else {
34
- const file = ctx.files && ctx.files[value];
35
- if (file && file.content) value = `url(${file.content.src})`;
36
- }
37
- return { cursor: value };
38
28
  },
39
- opacity: (value) => value != null ? { opacity: String(value) } : void 0,
40
- visibility: (value) => value != null ? { visibility: value } : void 0,
41
- pointerEvents: (value) => value != null ? { pointerEvents: value } : void 0
29
+ cursor: (el, s, ctx) => {
30
+ let val = el.props.cursor;
31
+ if (!val) return;
32
+ const file = ctx.files && ctx.files[val];
33
+ if (file && file.content) val = `url(${file.content.src})`;
34
+ return { cursor: val };
35
+ }
42
36
  };
@@ -23,26 +23,29 @@ __export(position_exports, {
23
23
  module.exports = __toCommonJS(position_exports);
24
24
  var import_scratch = require("@symbo.ls/scratch");
25
25
  const POSITION_PROPS = {
26
- inset: (val, el) => {
27
- if (el.call("isNumber", val)) return { inset: val };
28
- if (!el.call("isString", val)) return;
29
- return { inset: val.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k).join(" ") };
26
+ inset: ({ props, context }) => {
27
+ const { inset } = props;
28
+ if (context.utils.isNumber(inset)) return { inset };
29
+ if (!context.utils.isString(inset)) return;
30
+ return { inset: inset.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k).join(" ") };
30
31
  },
31
- left: (val) => (0, import_scratch.getSpacingByKey)(val, "left"),
32
- top: (val) => (0, import_scratch.getSpacingByKey)(val, "top"),
33
- right: (val) => (0, import_scratch.getSpacingByKey)(val, "right"),
34
- bottom: (val) => (0, import_scratch.getSpacingByKey)(val, "bottom"),
35
- verticalInset: (val) => {
36
- if (typeof val !== "string") return;
37
- const vi = val.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k);
32
+ left: ({ props }) => (0, import_scratch.getSpacingByKey)(props.left, "left"),
33
+ top: ({ props }) => (0, import_scratch.getSpacingByKey)(props.top, "top"),
34
+ right: ({ props }) => (0, import_scratch.getSpacingByKey)(props.right, "right"),
35
+ bottom: ({ props }) => (0, import_scratch.getSpacingByKey)(props.bottom, "bottom"),
36
+ verticalInset: ({ props }) => {
37
+ const { verticalInset } = props;
38
+ if (typeof verticalInset !== "string") return;
39
+ const vi = verticalInset.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k);
38
40
  return {
39
41
  top: vi[0],
40
42
  bottom: vi[1] || vi[0]
41
43
  };
42
44
  },
43
- horizontalInset: (val) => {
44
- if (typeof val !== "string") return;
45
- const vi = val.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k);
45
+ horizontalInset: ({ props }) => {
46
+ const { horizontalInset } = props;
47
+ if (typeof horizontalInset !== "string") return;
48
+ const vi = horizontalInset.split(" ").map((v) => (0, import_scratch.getSpacingByKey)(v, "k").k);
46
49
  return {
47
50
  left: vi[0],
48
51
  right: vi[1] || vi[0]