css-in-props 3.8.9 → 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 (55) hide show
  1. package/README.md +6 -22
  2. package/dist/cjs/{props/defaults.js → defaults.js} +2 -2
  3. package/dist/cjs/index.js +19 -2
  4. package/dist/cjs/package.json +4 -0
  5. package/dist/cjs/props/animation.js +16 -80
  6. package/dist/cjs/props/block.js +71 -89
  7. package/dist/cjs/props/font.js +8 -7
  8. package/dist/cjs/props/index.js +0 -32
  9. package/dist/cjs/props/misc.js +9 -8
  10. package/dist/cjs/props/position.js +17 -14
  11. package/dist/cjs/props/theme.js +73 -70
  12. package/dist/cjs/props/timing.js +11 -11
  13. package/dist/cjs/registry.js +39 -0
  14. package/dist/cjs/set.js +1 -1
  15. package/dist/cjs/transform.js +80 -0
  16. package/index.js +1 -0
  17. package/package.json +13 -15
  18. package/src/index.js +4 -4
  19. package/src/props/animation.js +28 -23
  20. package/src/props/block.js +49 -57
  21. package/src/props/flex.js +4 -5
  22. package/src/props/index.js +18 -19
  23. package/src/props/misc.js +10 -3
  24. package/src/props/theme.js +10 -7
  25. package/src/set.js +11 -4
  26. package/src/transform/executors.js +60 -52
  27. package/src/transform/index.js +2 -2
  28. package/src/transform/transformers.js +85 -23
  29. package/dist/cjs/_transform.js +0 -30
  30. package/dist/cjs/props/flex.js +0 -45
  31. package/dist/cjs/props/grid.js +0 -39
  32. package/dist/cjs/transform/executors.js +0 -124
  33. package/dist/cjs/transform/index.js +0 -19
  34. package/dist/cjs/transform/transformers.js +0 -107
  35. package/dist/esm/_transform.js +0 -10
  36. package/dist/esm/emotion.js +0 -9
  37. package/dist/esm/index.js +0 -4
  38. package/dist/esm/props/animation.js +0 -101
  39. package/dist/esm/props/block.js +0 -171
  40. package/dist/esm/props/defaults.js +0 -321
  41. package/dist/esm/props/flex.js +0 -25
  42. package/dist/esm/props/font.js +0 -16
  43. package/dist/esm/props/grid.js +0 -19
  44. package/dist/esm/props/index.js +0 -35
  45. package/dist/esm/props/misc.js +0 -15
  46. package/dist/esm/props/position.js +0 -31
  47. package/dist/esm/props/theme.js +0 -134
  48. package/dist/esm/props/timing.js +0 -26
  49. package/dist/esm/set.js +0 -9
  50. package/dist/esm/transform/executors.js +0 -104
  51. package/dist/esm/transform/index.js +0 -2
  52. package/dist/esm/transform/transformers.js +0 -87
  53. package/dist/iife/index.js +0 -1084
  54. package/src/_transform.js +0 -10
  55. package/src/emotion.js +0 -9
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # css-in-props
2
2
 
3
- CSS properties as component props for DOMQL elements. Transforms design-system-aware props into CSS classes via Emotion.
3
+ CSS properties as component props for DOMQL elements. Transforms design-system-aware props into CSS classes via the atomic CSS engine (`@symbo.ls/css`).
4
4
 
5
5
  ## What it does
6
6
 
7
7
  - Transforms component props (`theme`, `color`, `background`, `border`, `shadow`, etc.) into resolved CSS
8
8
  - Resolves design system tokens (colors, spacing, typography, themes) from `@symbo.ls/scratch`
9
9
  - Handles media queries (`@dark`, `@mobileS`, etc.) and pseudo selectors (`:hover`, `:focus`) as prop prefixes
10
- - Generates Emotion CSS classes for optimized rendering
10
+ - Generates atomic CSS classes for optimized rendering (one class per property-value pair)
11
11
 
12
12
  ## Theme prop
13
13
 
@@ -69,25 +69,9 @@ import { transformersByPrefix } from 'css-in-props'
69
69
 
70
70
  ## Interaction with the define system
71
71
 
72
- The `$` prefix is used both by css-in-props (`$isActive` case conditional) and by the define system (e.g. `$router`, and deprecated v2 handlers like `$propsCollection`, `$collection`). The propertization layer in `@domql/utils/props.js` uses `CSS_SELECTOR_PREFIXES` to decide which keys to move into `props`.
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
- **The `$` prefix requires special handling:**
75
-
76
- Keys starting with `$` that have a matching define handler (either `element.define[key]` or `context.define[key]`) must **stay at the element root** so that `throughInitialDefine` can process them. Only `$`-prefixed keys without define handlers should be moved into `props` for css-in-props processing. This matters for the built-in `$router` handler and for backwards compatibility with older v2 projects using deprecated collection handlers.
77
-
78
- ```javascript
79
- // In props.js — check define handlers BEFORE checking CSS_SELECTOR_PREFIXES
80
- const defineValue = this.define?.[key]
81
- const globalDefineValue = this.context?.define?.[key]
82
- if (isFunction(defineValue) || isFunction(globalDefineValue)) continue
83
-
84
- // Only then check the prefix
85
- if (CSS_SELECTOR_PREFIXES.has(firstChar)) {
86
- obj.props[key] = value // move to props for css-in-props
87
- }
88
- ```
89
-
90
- > **Lesson learned:** Without the define-awareness check, keys like `$propsCollection` were moved into `props` and became invisible to the define system, breaking collection-based rendering in projects like Rosi and BigBrother.
74
+ > In v3.14, properties go directly on the element (no `props:` wrapper). The CSS engine processes design token properties internally.
91
75
 
92
76
  ## Global Cases
93
77
 
@@ -110,8 +94,8 @@ export default { cases, /* ...other context */ }
110
94
 
111
95
  ### Resolution order
112
96
 
113
- - **`$` prefix**: Checks `context.cases[key]` first (call if function, check truthiness if value). Falls back to `element.props[key]`.
114
- - **`.` prefix**: Checks `element.props[key]` / `element.state[key]` / `element[key]` first. Falls back to `context.cases[key]`.
97
+ - **`$` prefix**: Checks `context.cases[key]` first (call if function, check truthiness if value). Falls back to `element[key]`.
98
+ - **`.` prefix**: Checks `element[key]` / `element.state[key]` first. Falls back to `context.cases[key]`.
115
99
  - **`!` prefix**: Same as `.` but inverted — applies when condition is falsy.
116
100
 
117
101
  ```javascript
@@ -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
+ ];
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
25
  __reExport(index_exports, require("./transform"), module.exports);
26
+ __reExport(index_exports, require("./set"), module.exports);
19
27
  __reExport(index_exports, require("./emotion"), module.exports);
20
- __reExport(index_exports, require("./props"), module.exports);
21
- __reExport(index_exports, require("./props/defaults"), 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
+ }
@@ -24,11 +24,6 @@ module.exports = __toCommonJS(animation_exports);
24
24
  var import_utils = require("@domql/utils");
25
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
27
  const applyAnimationProps = (animation, element) => {
33
28
  const { emotion: ctxEmotion } = element.context;
34
29
  const { keyframes } = ctxEmotion || import_emotion.emotion;
@@ -37,85 +32,26 @@ const applyAnimationProps = (animation, element) => {
37
32
  const record = ANIMATION[animation];
38
33
  return keyframes(record);
39
34
  };
40
- const parseAnimationShorthand = (val, el) => {
41
- const { ANIMATION } = el.context && el.context.designSystem || {};
42
- const tokens = val.split(/\s+/);
43
- let name = null;
44
- const durations = [];
45
- let timingFunction = null;
46
- let iterationCount = null;
47
- let direction = null;
48
- let fillMode = null;
49
- let playState = null;
50
- for (const token of tokens) {
51
- if (ANIMATION && ANIMATION[token]) {
52
- name = token;
53
- } else if (isDuration(token)) {
54
- durations.push(token);
55
- } else if (TIMING_FUNCTIONS.includes(token) || token.startsWith("cubic-bezier") || token.startsWith("steps(")) {
56
- timingFunction = token;
57
- } else if (token === "infinite" || /^\d+$/.test(token)) {
58
- iterationCount = token === "infinite" ? token : Number(token);
59
- } else if (DIRECTIONS.includes(token)) {
60
- direction = token;
61
- } else if (FILL_MODES.includes(token)) {
62
- fillMode = token;
63
- } else if (PLAY_STATES.includes(token)) {
64
- playState = token;
65
- } else if (!name) {
66
- name = token;
67
- }
68
- }
69
- return { name, durations, timingFunction, iterationCount, direction, fillMode, playState };
70
- };
71
35
  const ANIMATION_PROPS = {
72
- animation: (val, el) => {
73
- if ((0, import_utils.isString)(val) && val.includes(" ")) {
74
- const parsed = parseAnimationShorthand(val, el);
75
- return {
76
- animationName: applyAnimationProps(parsed.name || val, el),
77
- animationDuration: parsed.durations[0] || (0, import_scratch.getTimingByKey)(el.props.animationDuration || "A").timing,
78
- animationDelay: parsed.durations[1] || (0, import_scratch.getTimingByKey)(el.props.animationDelay || "0s").timing,
79
- animationTimingFunction: parsed.timingFunction || (0, import_scratch.getTimingFunction)(el.props.animationTimingFunction || "ease"),
80
- animationFillMode: parsed.fillMode || el.props.animationFillMode || "both",
81
- animationIterationCount: parsed.iterationCount != null ? parsed.iterationCount : el.props.animationIterationCount || 1,
82
- animationPlayState: parsed.playState || el.props.animationPlayState,
83
- animationDirection: parsed.direction || el.props.animationDirection
84
- };
85
- }
86
- return {
87
- animationName: applyAnimationProps(val, el),
88
- animationDuration: (0, import_scratch.getTimingByKey)(el.props.animationDuration || "A").timing,
89
- animationDelay: (0, import_scratch.getTimingByKey)(el.props.animationDelay || "0s").timing,
90
- animationTimingFunction: (0, import_scratch.getTimingFunction)(el.props.animationTimingFunction || "ease"),
91
- animationFillMode: el.props.animationFillMode || "both",
92
- animationIterationCount: el.props.animationIterationCount || 1,
93
- animationPlayState: el.props.animationPlayState,
94
- animationDirection: el.props.animationDirection
95
- };
96
- },
97
- animationName: (val, el) => ({
98
- animationName: applyAnimationProps(val, el)
99
- }),
100
- animationDuration: (val) => ({
101
- animationDuration: (0, import_scratch.getTimingByKey)(val).timing
102
- }),
103
- animationDelay: (val) => ({
104
- animationDelay: (0, import_scratch.getTimingByKey)(val).timing
105
- }),
106
- animationTimingFunction: (val) => ({
107
- 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
108
44
  }),
109
- animationIterationCount: (val) => ({
110
- animationIterationCount: val
45
+ animationName: (el) => ({
46
+ animationName: applyAnimationProps(el.props.animationName, el)
111
47
  }),
112
- animationFillMode: (val) => ({
113
- animationFillMode: val
48
+ animationDuration: ({ props, deps }) => ({
49
+ animationDuration: deps.getTimingByKey(props.animationDuration).timing
114
50
  }),
115
- animationPlayState: (val) => ({
116
- animationPlayState: val
51
+ animationDelay: ({ props, deps }) => ({
52
+ animationDelay: deps.getTimingByKey(props.animationDelay).timing
117
53
  }),
118
- animationDirection: (val) => ({
119
- animationDirection: val
54
+ animationTimingFunction: ({ props, deps }) => ({
55
+ animationTimingFunction: deps.getTimingFunction(props.animationTimingFunction)
120
56
  })
121
57
  };
@@ -24,116 +24,106 @@ module.exports = __toCommonJS(block_exports);
24
24
  var import_utils = require("@domql/utils");
25
25
  var import_scratch = require("@symbo.ls/scratch");
26
26
  const BLOCK_PROPS = {
27
- show: (val, el, s, ctx) => !!(ctx.utils.exec(val, el, s) === false) && {
27
+ show: (el, s, ctx) => !!(ctx.utils.exec(el.props.show, el, s) === false) && {
28
28
  display: "none !important"
29
29
  },
30
- hide: (val, el, s, ctx) => !!ctx.utils.exec(val, el, s) && {
30
+ hide: (el, s, ctx) => !!ctx.utils.exec(el.props.hide, el, s) && {
31
31
  display: "none !important"
32
32
  },
33
- height: (val, { props }) => (0, import_scratch.transformSizeRatio)("height", val, props),
34
- width: (val, { props }) => (0, import_scratch.transformSizeRatio)("width", val, props),
35
- boxSizing: (val) => !(0, import_utils.isUndefined)(val) ? { boxSizing: val } : { boxSizing: "border-box" },
36
- boxSize: (val) => {
37
- if (!(0, import_utils.isString)(val)) return;
38
- const [height, width] = val.split(" ");
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(" ");
39
39
  return {
40
40
  ...(0, import_scratch.transformSize)("height", height),
41
41
  ...(0, import_scratch.transformSize)("width", width || height)
42
42
  };
43
43
  },
44
- inlineSize: (val, { props }) => (0, import_scratch.transformSizeRatio)("inlineSize", val, props),
45
- blockSize: (val, { props }) => (0, import_scratch.transformSizeRatio)("blockSize", val, props),
46
- minWidth: (val, { props }) => (0, import_scratch.transformSizeRatio)("minWidth", val, props),
47
- maxWidth: (val, { props }) => (0, import_scratch.transformSizeRatio)("maxWidth", val, props),
48
- widthRange: (val) => {
49
- if (!(0, import_utils.isString)(val)) return;
50
- 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(" ");
51
51
  return {
52
52
  ...(0, import_scratch.transformSize)("minWidth", minWidth),
53
53
  ...(0, import_scratch.transformSize)("maxWidth", maxWidth || minWidth)
54
54
  };
55
55
  },
56
- minHeight: (val, { props }) => (0, import_scratch.transformSizeRatio)("minHeight", val, props),
57
- maxHeight: (val, { props }) => (0, import_scratch.transformSizeRatio)("maxHeight", val, props),
58
- heightRange: (val) => {
59
- if (!(0, import_utils.isString)(val)) return;
60
- 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(" ");
61
61
  return {
62
62
  ...(0, import_scratch.transformSize)("minHeight", minHeight),
63
63
  ...(0, import_scratch.transformSize)("maxHeight", maxHeight || minHeight)
64
64
  };
65
65
  },
66
- size: (val) => {
67
- if (!(0, import_utils.isString)(val)) return;
68
- const [inlineSize, blockSize] = val.split(" ");
66
+ size: ({ props }) => {
67
+ if (!(0, import_utils.isString)(props.size)) return;
68
+ const [inlineSize, blockSize] = props.size.split(" ");
69
69
  return {
70
70
  ...(0, import_scratch.transformSizeRatio)("inlineSize", inlineSize),
71
71
  ...(0, import_scratch.transformSizeRatio)("blockSize", blockSize || inlineSize)
72
72
  };
73
73
  },
74
- minBlockSize: (val, { props }) => (0, import_scratch.transformSizeRatio)("minBlockSize", val, props),
75
- minInlineSize: (val, { props }) => (0, import_scratch.transformSizeRatio)("minInlineSize", val, props),
76
- maxBlockSize: (val, { props }) => (0, import_scratch.transformSizeRatio)("maxBlockSize", val, props),
77
- maxInlineSize: (val, { props }) => (0, import_scratch.transformSizeRatio)("maxInlineSize", val, props),
78
- minSize: (val) => {
79
- if (!(0, import_utils.isString)(val)) return;
80
- 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(" ");
81
81
  return {
82
82
  ...(0, import_scratch.transformSize)("minInlineSize", minInlineSize),
83
83
  ...(0, import_scratch.transformSize)("minBlockSize", minBlockSize || minInlineSize)
84
84
  };
85
85
  },
86
- maxSize: (val) => {
87
- if (!(0, import_utils.isString)(val)) return;
88
- const [maxInlineSize, maxBlockSize] = val.split(" ");
86
+ maxSize: ({ props }) => {
87
+ if (!(0, import_utils.isString)(props.maxSize)) return;
88
+ const [maxInlineSize, maxBlockSize] = props.maxSize.split(" ");
89
89
  return {
90
90
  ...(0, import_scratch.transformSize)("maxInlineSize", maxInlineSize),
91
91
  ...(0, import_scratch.transformSize)("maxBlockSize", maxBlockSize || maxInlineSize)
92
92
  };
93
93
  },
94
- borderWidth: (val, { props }) => (0, import_scratch.transformSizeRatio)("borderWidth", val, props),
95
- padding: (val, { props }) => (0, import_scratch.transformSizeRatio)("padding", val, props),
96
- scrollPadding: (val, { props }) => (0, import_scratch.transformSizeRatio)("scrollPadding", val, props),
97
- paddingInline: (val) => {
98
- if (!(0, import_utils.isString)(val)) return;
99
- 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(" ");
100
100
  return {
101
101
  ...(0, import_scratch.transformSize)("paddingInlineStart", paddingInlineStart),
102
102
  ...(0, import_scratch.transformSize)("paddingInlineEnd", paddingInlineEnd || paddingInlineStart)
103
103
  };
104
104
  },
105
- paddingBlock: (val) => {
106
- if (!(0, import_utils.isString)(val)) return;
107
- const [paddingBlockStart, paddingBlockEnd] = val.split(" ");
105
+ paddingBlock: ({ props }) => {
106
+ if (!(0, import_utils.isString)(props.paddingBlock)) return;
107
+ const [paddingBlockStart, paddingBlockEnd] = props.paddingBlock.split(" ");
108
108
  return {
109
109
  ...(0, import_scratch.transformSize)("paddingBlockStart", paddingBlockStart),
110
110
  ...(0, import_scratch.transformSize)("paddingBlockEnd", paddingBlockEnd || paddingBlockStart)
111
111
  };
112
112
  },
113
- // Traditional directional padding
114
- paddingTop: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingBlockStart", val, props),
115
- paddingBottom: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingBlockEnd", val, props),
116
- paddingLeft: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingInlineStart", val, props),
117
- paddingRight: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingInlineEnd", val, props),
118
- // Logical properties (for reference)
119
- paddingBlockStart: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingBlockStart", val, props),
120
- // maps to top
121
- paddingBlockEnd: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingBlockEnd", val, props),
122
- // maps to bottom
123
- paddingInlineStart: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingInlineStart", val, props),
124
- // maps to left
125
- paddingInlineEnd: (val, { props }) => (0, import_scratch.transformSizeRatio)("paddingInlineEnd", val, props),
126
- // maps to right
127
- margin: (val, { props }) => (0, import_scratch.transformSizeRatio)("margin", val, props),
128
- marginInline: (val) => {
129
- if (!(0, import_utils.isString)(val)) return;
130
- 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(" ");
131
121
  return {
132
122
  ...(0, import_scratch.transformSize)("marginInlineStart", marginInlineStart),
133
123
  ...(0, import_scratch.transformSize)("marginInlineEnd", marginInlineEnd || marginInlineStart)
134
124
  };
135
125
  },
136
- marginBlock: (val, { props }) => {
126
+ marginBlock: ({ props }) => {
137
127
  if (!(0, import_utils.isString)(props.marginBlock)) return;
138
128
  const [marginBlockStart, marginBlockEnd] = props.marginBlock.split(" ");
139
129
  return {
@@ -141,45 +131,37 @@ const BLOCK_PROPS = {
141
131
  ...(0, import_scratch.transformSize)("marginBlockEnd", marginBlockEnd || marginBlockStart)
142
132
  };
143
133
  },
144
- // Traditional directional margin
145
- marginTop: (val, { props }) => (0, import_scratch.transformSizeRatio)("marginBlockStart", val, props),
146
- marginBottom: (val, { props }) => (0, import_scratch.transformSizeRatio)("marginBlockEnd", val, props),
147
- marginLeft: (val, { props }) => (0, import_scratch.transformSizeRatio)("marginInlineStart", val, props),
148
- marginRight: (val, { props }) => (0, import_scratch.transformSizeRatio)("marginInlineEnd", val, props),
149
- // Logical properties
150
- marginInlineStart: (val, { props }) => (0, import_scratch.transformSizeRatio)("marginInlineStart", val, props),
151
- marginInlineEnd: (val, { props }) => (0, import_scratch.transformSizeRatio)("marginInlineEnd", val, props),
152
- marginBlockStart: (val, { props }) => (0, import_scratch.transformSizeRatio)("marginBlockStart", val, props),
153
- marginBlockEnd: (val, { props }) => (0, import_scratch.transformSizeRatio)("marginBlockEnd", val, props),
154
- gap: (val) => ({
155
- 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)
156
140
  }),
157
- columnGap: (val, { props }) => (0, import_scratch.getSpacingBasedOnRatio)(props, "columnGap", val),
158
- rowGap: (val, { props }) => (0, import_scratch.getSpacingBasedOnRatio)(props, "rowGap", val),
159
- flexWrap: (val, { props }) => ({
141
+ columnGap: ({ props }) => (0, import_scratch.getSpacingBasedOnRatio)(props, "columnGap"),
142
+ rowGap: ({ props }) => (0, import_scratch.getSpacingBasedOnRatio)(props, "rowGap"),
143
+ flexWrap: ({ props }) => ({
160
144
  display: "flex",
161
- flexFlow: (val || "row").split(" ")[0] + " " + props.flexWrap
145
+ flexFlow: (props.flexFlow || "row").split(" ")[0] + " " + props.flexWrap
162
146
  }),
163
- flexFlow: (val, { props }) => {
164
- const { reverse } = props;
165
- if (!(0, import_utils.isString)(val)) return;
166
- let [direction, wrap] = (val || "row").split(" ");
167
- if (val.startsWith("x") || val === "row") direction = "row";
168
- 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";
169
153
  return {
170
154
  display: "flex",
171
155
  flexFlow: (direction || "") + (!direction.includes("-reverse") && reverse ? "-reverse" : "") + " " + (wrap || "")
172
156
  };
173
157
  },
174
- flexAlign: (val) => {
175
- if (!(0, import_utils.isString)(val)) return;
176
- const [alignItems, justifyContent] = val.split(" ");
158
+ flexAlign: ({ props }) => {
159
+ if (!(0, import_utils.isString)(props.flexAlign)) return;
160
+ const [alignItems, justifyContent] = props.flexAlign.split(" ");
177
161
  return {
178
162
  display: "flex",
179
163
  alignItems,
180
164
  justifyContent
181
165
  };
182
- },
183
- round: (val, { props }) => (0, import_scratch.transformBorderRadius)(val || props.borderRadius, props, "round"),
184
- borderRadius: (val, { props }) => (0, import_scratch.transformBorderRadius)(val || props.round, props, "borderRadius")
166
+ }
185
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,20 +14,7 @@ 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");
27
- var import_block = require("./block");
28
- var import_font = require("./font");
29
- var import_misc = require("./misc");
30
- var import_position = require("./position");
31
- var import_theme = require("./theme");
32
- var import_timing = require("./timing");
33
- var import_flex = require("./flex");
34
- var import_grid = require("./grid");
35
18
  __reExport(props_exports, require("./animation"), module.exports);
36
19
  __reExport(props_exports, require("./block"), module.exports);
37
20
  __reExport(props_exports, require("./font"), module.exports);
@@ -39,18 +22,3 @@ __reExport(props_exports, require("./misc"), module.exports);
39
22
  __reExport(props_exports, require("./position"), module.exports);
40
23
  __reExport(props_exports, require("./theme"), module.exports);
41
24
  __reExport(props_exports, require("./timing"), module.exports);
42
- __reExport(props_exports, require("./flex"), module.exports);
43
- __reExport(props_exports, require("./grid"), 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_misc.MISC_PROPS,
50
- ...import_position.POSITION_PROPS,
51
- ...import_theme.THEME_PROPS,
52
- ...import_timing.TIMING_PROPS,
53
- ...import_flex.FLEX_PROPS,
54
- ...import_grid.GRID_PROPS
55
- };
56
- var props_default = CSS_PROPS_REGISTRY;
@@ -22,14 +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 file = ctx.files && ctx.files[value];
32
- if (file && file.content) value = `url(${file.content.src})`;
33
- return { cursor: value };
28
+ },
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 };
34
35
  }
35
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]