@symbo.ls/atoms 2.34.29 → 2.34.30

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 (3) hide show
  1. package/Box.js +728 -460
  2. package/Text.js +93 -41
  3. package/package.json +6 -6
package/Text.js CHANGED
@@ -6,15 +6,22 @@ import { getFontSizeByKey, getFontFamily } from '@symbo.ls/scratch'
6
6
  const props = {
7
7
  fontSize: (el) => {
8
8
  const { props, deps } = el
9
- return props.fontSize ? deps.getFontSizeByKey(props.fontSize) : null
9
+ const val = deps.exec.call(el, props.fontSize)
10
+ return val ? deps.getFontSizeByKey(val) : null
10
11
  },
11
- fontFamily: ({ props, deps }) => ({
12
- fontFamily: deps.getFontFamily(props.fontFamily) || props.fontFamily
13
- }),
14
- fontWeight: ({ props }) => ({
15
- fontWeight: props.fontWeight,
16
- fontVariationSettings: '"wght" ' + props.fontWeight
17
- })
12
+ fontFamily: (element) => {
13
+ const { props, deps } = element
14
+ const val = deps.exec.call(element, props.fontFamily)
15
+ return { fontFamily: deps.getFontFamily(val) || val }
16
+ },
17
+ fontWeight: (element) => {
18
+ const { props, deps } = element
19
+ const val = deps.exec.call(element, props.fontWeight)
20
+ return {
21
+ fontWeight: val,
22
+ fontVariationSettings: '"wght" ' + val
23
+ }
24
+ }
18
25
  }
19
26
 
20
27
  export const Text = {
@@ -28,39 +35,84 @@ export const Text = {
28
35
  },
29
36
 
30
37
  class: {
31
- font: ({ props }) => !isUndefined(props.font) && { font: props.font },
32
- lineHeight: ({ props }) =>
33
- !isUndefined(props.lineHeight) && { lineHeight: props.lineHeight },
34
- textDecoration: ({ props }) =>
35
- !isUndefined(props.textDecoration) && {
36
- textDecoration: props.textDecoration
37
- },
38
- textTransform: ({ props }) =>
39
- !isUndefined(props.textTransform) && {
40
- textTransform: props.textTransform
41
- },
42
- wordBreak: ({ props }) =>
43
- !isUndefined(props.wordBreak) && { wordBreak: props.wordBreak },
44
- whiteSpace: ({ props }) =>
45
- !isUndefined(props.whiteSpace) && { whiteSpace: props.whiteSpace },
46
- wordWrap: ({ props }) =>
47
- !isUndefined(props.wordWrap) && { wordWrap: props.wordWrap },
48
- letterSpacing: ({ props }) =>
49
- !isUndefined(props.letterSpacing) && {
50
- letterSpacing: props.letterSpacing
51
- },
52
- textOverflow: ({ props }) =>
53
- !isUndefined(props.textOverflow) && { textOverflow: props.textOverflow },
54
- textAlign: ({ props }) =>
55
- !isUndefined(props.textAlign) && { textAlign: props.textAlign },
56
- writingMode: ({ props }) =>
57
- !isUndefined(props.writingMode) && { writingMode: props.writingMode },
58
- textOrientation: ({ props }) =>
59
- !isUndefined(props.textOrientation) && {
60
- textOrientation: props.textOrientation
61
- },
62
- textIndent: ({ props }) =>
63
- !isUndefined(props.textIndent) && { textIndent: props.textIndent },
38
+ font: (element) => {
39
+ const { props, deps } = element
40
+ const val = deps.exec.call(element, props.font)
41
+ if (isUndefined(val)) return
42
+ return { font: val }
43
+ },
44
+ lineHeight: (element) => {
45
+ const { props, deps } = element
46
+ const val = deps.exec.call(element, props.lineHeight)
47
+ if (isUndefined(val)) return
48
+ return { lineHeight: val }
49
+ },
50
+ textDecoration: (element) => {
51
+ const { props, deps } = element
52
+ const val = deps.exec.call(element, props.textDecoration)
53
+ if (isUndefined(val)) return
54
+ return { textDecoration: val }
55
+ },
56
+ textTransform: (element) => {
57
+ const { props, deps } = element
58
+ const val = deps.exec.call(element, props.textTransform)
59
+ if (isUndefined(val)) return
60
+ return { textTransform: val }
61
+ },
62
+ wordBreak: (element) => {
63
+ const { props, deps } = element
64
+ const val = deps.exec.call(element, props.wordBreak)
65
+ if (isUndefined(val)) return
66
+ return { wordBreak: val }
67
+ },
68
+ whiteSpace: (element) => {
69
+ const { props, deps } = element
70
+ const val = deps.exec.call(element, props.whiteSpace)
71
+ if (isUndefined(val)) return
72
+ return { whiteSpace: val }
73
+ },
74
+ wordWrap: (element) => {
75
+ const { props, deps } = element
76
+ const val = deps.exec.call(element, props.wordWrap)
77
+ if (isUndefined(val)) return
78
+ return { wordWrap: val }
79
+ },
80
+ letterSpacing: (element) => {
81
+ const { props, deps } = element
82
+ const val = deps.exec.call(element, props.letterSpacing)
83
+ if (isUndefined(val)) return
84
+ return { letterSpacing: val }
85
+ },
86
+ textOverflow: (element) => {
87
+ const { props, deps } = element
88
+ const val = deps.exec.call(element, props.textOverflow)
89
+ if (isUndefined(val)) return
90
+ return { textOverflow: val }
91
+ },
92
+ textAlign: (element) => {
93
+ const { props, deps } = element
94
+ const val = deps.exec.call(element, props.textAlign)
95
+ if (isUndefined(val)) return
96
+ return { textAlign: val }
97
+ },
98
+ writingMode: (element) => {
99
+ const { props, deps } = element
100
+ const val = deps.exec.call(element, props.writingMode)
101
+ if (isUndefined(val)) return
102
+ return { writingMode: val }
103
+ },
104
+ textOrientation: (element) => {
105
+ const { props, deps } = element
106
+ const val = deps.exec.call(element, props.textOrientation)
107
+ if (isUndefined(val)) return
108
+ return { textOrientation: val }
109
+ },
110
+ textIndent: (element) => {
111
+ const { props, deps } = element
112
+ const val = deps.exec.call(element, props.textIndent)
113
+ if (isUndefined(val)) return
114
+ return { textIndent: val }
115
+ },
64
116
  ...props
65
117
  }
66
118
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@symbo.ls/atoms",
3
- "version": "2.34.29",
3
+ "version": "2.34.30",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "90cb8b61065249122ff356c3ea6eb56191c49bfa",
6
+ "gitHead": "e8c2af04ccfbe5521b5a2d5473b6e5236954edba",
7
7
  "dependencies": {
8
- "@domql/state": "^2.34.29",
9
- "@domql/utils": "^2.34.29",
10
- "@symbo.ls/emotion": "^2.34.29",
11
- "@symbo.ls/scratch": "^2.34.29"
8
+ "@domql/state": "^2.34.30",
9
+ "@domql/utils": "^2.34.30",
10
+ "@symbo.ls/emotion": "^2.34.30",
11
+ "@symbo.ls/scratch": "^2.34.30"
12
12
  },
13
13
  "source": "src/index.js",
14
14
  "devDependencies": {