@symbo.ls/default-config 3.8.9 → 3.14.0
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/README.md +4 -1
- package/blank/font.js +1 -1
- package/blank/index.js +8 -8
- package/components/Atoms/Block.js +29 -0
- package/components/Atoms/Box.js +37 -0
- package/components/Atoms/Form.js +5 -0
- package/components/Atoms/Grid.js +37 -0
- package/components/Atoms/Hgroup.js +57 -0
- package/components/Atoms/Iframe.js +8 -0
- package/components/Atoms/Img.js +9 -0
- package/components/Atoms/InteractiveComponent.js +65 -0
- package/components/Atoms/Picture.js +34 -0
- package/components/Atoms/Shape/index.js +3 -0
- package/components/Atoms/Shape.js +249 -0
- package/components/Atoms/Svg.js +45 -0
- package/components/Atoms/Text.js +43 -0
- package/components/Atoms/Theme.js +20 -0
- package/components/Atoms/Video.js +11 -0
- package/components/Avatar.js +10 -0
- package/components/Button.js +72 -0
- package/components/Dialog.js +69 -0
- package/components/Dropdown.js +153 -0
- package/components/Icon/index.js +236 -0
- package/components/Icon/style.js +8 -0
- package/components/Input/Checkbox.js +54 -0
- package/components/Input/Input.js +37 -0
- package/components/Input/NumberInput.js +25 -0
- package/components/Input/Radio.js +31 -0
- package/components/Input/Textarea.js +47 -0
- package/components/Input/Toggle.js +36 -0
- package/components/Link.js +166 -0
- package/components/Notification.js +43 -0
- package/components/Range.js +106 -0
- package/components/Select.js +33 -0
- package/components/Tooltip/index.js +128 -0
- package/components/Tooltip/style.js +12 -0
- package/components/index.js +36 -0
- package/default/font.js +1 -1
- package/default/index.js +2 -2
- package/designSystem/color.js +70 -0
- package/designSystem/font.js +21 -0
- package/designSystem/icons.js +69 -0
- package/designSystem/index.js +45 -0
- package/designSystem/media.js +31 -0
- package/designSystem/spacing.js +6 -0
- package/designSystem/theme.js +247 -0
- package/designSystem/timing.js +8 -0
- package/designSystem/typography.js +9 -0
- package/index.js +15 -0
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
# Default Config
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Default design system configuration for Symbols v4. Provides baseline color, typography, spacing, media query, and theme definitions used when no custom config is supplied. The atomic CSS engine (`@symbo.ls/css`) and `@symbo.ls/scratch` consume this config to generate design tokens.
|
|
4
|
+
|
|
5
|
+
Check out the [docs page](http://symbols.app/developersintro#configuration) to learn more.
|
package/blank/font.js
CHANGED
package/blank/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { color, gradient } from './color'
|
|
4
|
-
import { theme } from './theme'
|
|
5
|
-
import { typography } from './typography'
|
|
6
|
-
import { spacing } from './spacing'
|
|
7
|
-
import { font,
|
|
8
|
-
import { media } from './media'
|
|
9
|
-
import { timing } from './timing'
|
|
3
|
+
import { color, gradient } from './color.js'
|
|
4
|
+
import { theme } from './theme.js'
|
|
5
|
+
import { typography } from './typography.js'
|
|
6
|
+
import { spacing } from './spacing.js'
|
|
7
|
+
import { font, fontFamily } from './font.js'
|
|
8
|
+
import { media } from './media.js'
|
|
9
|
+
import { timing } from './timing.js'
|
|
10
10
|
|
|
11
11
|
export const DEFAULT_CONFIG = {
|
|
12
12
|
version: '0.0.1',
|
|
@@ -16,7 +16,7 @@ export const DEFAULT_CONFIG = {
|
|
|
16
16
|
typography,
|
|
17
17
|
spacing,
|
|
18
18
|
font,
|
|
19
|
-
|
|
19
|
+
fontFamily,
|
|
20
20
|
timing,
|
|
21
21
|
media,
|
|
22
22
|
reset: {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export const Block = {
|
|
4
|
+
display: 'block'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const Inline = {
|
|
8
|
+
display: 'inline'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Flex = {
|
|
12
|
+
display: 'flex'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const InlineFlex = {
|
|
16
|
+
display: 'inline-flex'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Grid = {
|
|
20
|
+
display: 'grid'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const InlineGrid = {
|
|
24
|
+
display: 'inline-grid'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Gutter = {
|
|
28
|
+
boxSize: 'C1'
|
|
29
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { useCssInProps } from 'css-in-props'
|
|
4
|
+
|
|
5
|
+
// Main class assignment handler
|
|
6
|
+
const onBeforeClassAssign = (element) => {
|
|
7
|
+
if (!element.context) return
|
|
8
|
+
const { props, __ref: ref } = element
|
|
9
|
+
const result = useCssInProps(props, element, { unpack: false })
|
|
10
|
+
ref.__class = result
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Box = {
|
|
14
|
+
extends: [
|
|
15
|
+
'Shape',
|
|
16
|
+
'Theme'
|
|
17
|
+
],
|
|
18
|
+
|
|
19
|
+
boxSizing: 'border-box',
|
|
20
|
+
|
|
21
|
+
onBeforeClassAssign
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const Hr = {
|
|
25
|
+
tag: 'hr',
|
|
26
|
+
margin: 'C1 0'
|
|
27
|
+
}
|
|
28
|
+
export const Br = { tag: 'br' }
|
|
29
|
+
export const Li = { tag: 'li' }
|
|
30
|
+
export const Ul = {
|
|
31
|
+
tag: 'ul',
|
|
32
|
+
childExtends: { extends: 'Li' }
|
|
33
|
+
}
|
|
34
|
+
export const Ol = {
|
|
35
|
+
tag: 'ol',
|
|
36
|
+
childExtends: { extends: 'Li' }
|
|
37
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export const Grid = {
|
|
4
|
+
display: 'grid',
|
|
5
|
+
|
|
6
|
+
class: {
|
|
7
|
+
area: (el) => (el.area ? { gridArea: el.area } : null),
|
|
8
|
+
template: (el) =>
|
|
9
|
+
el.template ? { gridTemplate: el.template } : null,
|
|
10
|
+
templateAreas: (el) =>
|
|
11
|
+
el.templateAreas ? { gridTemplateAreas: el.templateAreas } : null,
|
|
12
|
+
|
|
13
|
+
column: (el) => (el.column ? { gridColumn: el.column } : null),
|
|
14
|
+
columns: (el) =>
|
|
15
|
+
el.columns ? { gridTemplateColumns: el.columns } : null,
|
|
16
|
+
templateColumns: (el) =>
|
|
17
|
+
el.templateColumns
|
|
18
|
+
? { gridTemplateColumns: el.templateColumns }
|
|
19
|
+
: null,
|
|
20
|
+
autoColumns: (el) =>
|
|
21
|
+
el.autoColumns ? { gridAutoColumns: el.autoColumns } : null,
|
|
22
|
+
columnStart: (el) =>
|
|
23
|
+
el.columnStart ? { gridColumnStart: el.columnStart } : null,
|
|
24
|
+
|
|
25
|
+
row: (el) => (el.row ? { gridRow: el.row } : null),
|
|
26
|
+
rows: (el) => (el.rows ? { gridTemplateRows: el.rows } : null),
|
|
27
|
+
templateRows: (el) =>
|
|
28
|
+
el.templateRows ? { gridTemplateRows: el.templateRows } : null,
|
|
29
|
+
autoRows: (el) =>
|
|
30
|
+
el.autoRows ? { gridAutoRows: el.autoRows } : null,
|
|
31
|
+
rowStart: (el) =>
|
|
32
|
+
el.rowStart ? { gridRowStart: el.rowStart } : null,
|
|
33
|
+
|
|
34
|
+
autoFlow: (el) =>
|
|
35
|
+
el.autoFlow ? { gridAutoFlow: el.autoFlow } : null
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export const Hgroup = {
|
|
4
|
+
display: 'flex',
|
|
5
|
+
tag: 'hgroup',
|
|
6
|
+
|
|
7
|
+
flow: 'y',
|
|
8
|
+
gap: 'Y2',
|
|
9
|
+
|
|
10
|
+
H: {
|
|
11
|
+
color: 'title',
|
|
12
|
+
tag: 'h3',
|
|
13
|
+
lineHeight: '1em',
|
|
14
|
+
margin: '0'
|
|
15
|
+
},
|
|
16
|
+
P: {
|
|
17
|
+
margin: '0',
|
|
18
|
+
color: 'paragraph'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const HgroupRows = {
|
|
23
|
+
extends: 'Hgroup',
|
|
24
|
+
|
|
25
|
+
H: {
|
|
26
|
+
display: 'flex',
|
|
27
|
+
color: 'title',
|
|
28
|
+
align: 'center space-between'
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
P: {
|
|
32
|
+
color: 'paragraph',
|
|
33
|
+
align: 'center space-between'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const HgroupButton = {
|
|
38
|
+
extends: 'HgroupRows',
|
|
39
|
+
|
|
40
|
+
H: {
|
|
41
|
+
justifyContent: 'space-between',
|
|
42
|
+
|
|
43
|
+
Span: {},
|
|
44
|
+
|
|
45
|
+
Button: {
|
|
46
|
+
background: 'transparent',
|
|
47
|
+
color: 'currentColor',
|
|
48
|
+
padding: '0',
|
|
49
|
+
Icon: {
|
|
50
|
+
name: 'x',
|
|
51
|
+
fontSize: 'C'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
P: {}
|
|
57
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const style = {
|
|
4
|
+
appearance: 'none',
|
|
5
|
+
cursor: 'pointer',
|
|
6
|
+
fontFamily: 'inherit'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Hoverable = {
|
|
10
|
+
transition: 'C defaultBezier',
|
|
11
|
+
transitionProperty: 'opacity, transform',
|
|
12
|
+
opacity: 0.85,
|
|
13
|
+
|
|
14
|
+
':hover': {
|
|
15
|
+
opacity: 0.9,
|
|
16
|
+
transform: 'scale(1.015)'
|
|
17
|
+
},
|
|
18
|
+
':active': {
|
|
19
|
+
opacity: 1,
|
|
20
|
+
transform: 'scale(1.015)'
|
|
21
|
+
},
|
|
22
|
+
'.active': {
|
|
23
|
+
opacity: 1,
|
|
24
|
+
transform: 'scale(1.015)',
|
|
25
|
+
|
|
26
|
+
':hover': { opacity: 1 }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const Clickable = {
|
|
31
|
+
extends: 'Hoverable',
|
|
32
|
+
':active': {
|
|
33
|
+
opacity: 1,
|
|
34
|
+
transform: 'scale(1.015)'
|
|
35
|
+
},
|
|
36
|
+
'.active': {
|
|
37
|
+
opacity: 1
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const Focusable = {
|
|
42
|
+
border: 'none',
|
|
43
|
+
outline: 'solid 0 blue.3',
|
|
44
|
+
':focus-visible': {
|
|
45
|
+
opacity: 1,
|
|
46
|
+
outline: 'solid X blue.3'
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
attr: {
|
|
50
|
+
tabIndex: (el) => el.tabIndex
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const FocusableComponent = {
|
|
55
|
+
extends: 'Focusable',
|
|
56
|
+
tag: 'button',
|
|
57
|
+
fontSize: 'A',
|
|
58
|
+
type: 'button',
|
|
59
|
+
border: 'none',
|
|
60
|
+
textDecoration: 'none',
|
|
61
|
+
lineHeight: '1',
|
|
62
|
+
whiteSpace: 'nowrap',
|
|
63
|
+
fontFamily: 'inherit',
|
|
64
|
+
style
|
|
65
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { getSystemGlobalTheme } from './Theme.js'
|
|
4
|
+
|
|
5
|
+
export const Picture = {
|
|
6
|
+
deps: { getSystemGlobalTheme },
|
|
7
|
+
tag: 'picture',
|
|
8
|
+
|
|
9
|
+
childExtends: {
|
|
10
|
+
deps: { getSystemGlobalTheme },
|
|
11
|
+
tag: 'source',
|
|
12
|
+
attr: {
|
|
13
|
+
media: (element) => {
|
|
14
|
+
const { key, context, deps } = element
|
|
15
|
+
const { media } = context.designSystem
|
|
16
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
17
|
+
const mediaName = (element.media || key).slice(1)
|
|
18
|
+
|
|
19
|
+
if (mediaName === globalTheme) return '(min-width: 0px)'
|
|
20
|
+
else if (mediaName === 'dark' || mediaName === 'light')
|
|
21
|
+
return '(max-width: 0px)'
|
|
22
|
+
|
|
23
|
+
return media[mediaName]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
Img: {
|
|
29
|
+
width: 'inherit',
|
|
30
|
+
ignoreChildExtends: true,
|
|
31
|
+
height: 'inherit',
|
|
32
|
+
src: (element, state) => element.parent?.src || state.src
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { exec } from '@symbo.ls/utils'
|
|
4
|
+
import { getActiveConfig, getColor, getSpacingBasedOnRatio, getMediaColor } from '@symbo.ls/scratch' // eslint-disable-line no-unused-vars
|
|
5
|
+
import { TIMING_PROPS } from 'css-in-props/src/props'
|
|
6
|
+
|
|
7
|
+
const CONFIG = getActiveConfig()
|
|
8
|
+
|
|
9
|
+
export const depth = {
|
|
10
|
+
4: {
|
|
11
|
+
boxShadow: `rgba(0,0,0,.10) 0 2${CONFIG.unit.default} 4${CONFIG.unit.default}`
|
|
12
|
+
},
|
|
13
|
+
6: {
|
|
14
|
+
boxShadow: `rgba(0,0,0,.10) 0 3${CONFIG.unit.default} 6${CONFIG.unit.default}`
|
|
15
|
+
},
|
|
16
|
+
10: {
|
|
17
|
+
boxShadow: `rgba(0,0,0,.10) 0 4${CONFIG.unit.default} 10${CONFIG.unit.default}`
|
|
18
|
+
},
|
|
19
|
+
16: {
|
|
20
|
+
boxShadow: `rgba(0,0,0,.10) 0 8${CONFIG.unit.default} 16${CONFIG.unit.default}`
|
|
21
|
+
},
|
|
22
|
+
26: {
|
|
23
|
+
boxShadow: `rgba(0,0,0,.10) 0 14${CONFIG.unit.default} 26${CONFIG.unit.default}`
|
|
24
|
+
},
|
|
25
|
+
42: {
|
|
26
|
+
boxShadow: `rgba(0,0,0,.10) 0 20${CONFIG.unit.default} 42${CONFIG.unit.default}`
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const getComputedBackgroundColor = (el) => {
|
|
31
|
+
return (
|
|
32
|
+
getColor(el.shapeDirectionColor) ||
|
|
33
|
+
getColor(el.borderColor) ||
|
|
34
|
+
getColor(el.backgroundColor) ||
|
|
35
|
+
getColor(el.background)
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const inheritTransition = (el) => {
|
|
40
|
+
const result = TIMING_PROPS.transition(el.transition, el)
|
|
41
|
+
return result && result.transition
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const SHAPES = {
|
|
45
|
+
rectangle: {},
|
|
46
|
+
circle: { borderRadius: '100%' },
|
|
47
|
+
bubble: {},
|
|
48
|
+
tv: {
|
|
49
|
+
borderRadius: '1.15em/2.5em'
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
tooltip: (el) => ({
|
|
53
|
+
position: el.position || 'relative',
|
|
54
|
+
'&:before': {
|
|
55
|
+
content: '""',
|
|
56
|
+
display: 'block',
|
|
57
|
+
width: '0px',
|
|
58
|
+
height: '0px',
|
|
59
|
+
border: '.35em solid',
|
|
60
|
+
borderColor: getComputedBackgroundColor(el),
|
|
61
|
+
transition: inheritTransition(el),
|
|
62
|
+
transitionProperty: 'border-color',
|
|
63
|
+
position: 'absolute',
|
|
64
|
+
borderRadius: '.15em'
|
|
65
|
+
}
|
|
66
|
+
}),
|
|
67
|
+
|
|
68
|
+
tooltipDirection: {
|
|
69
|
+
top: {
|
|
70
|
+
'&:before': {
|
|
71
|
+
top: '0',
|
|
72
|
+
left: '50%',
|
|
73
|
+
transform: 'translate(-50%, -50%) rotate(45deg)'
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
right: {
|
|
77
|
+
'&:before': {
|
|
78
|
+
top: '50%',
|
|
79
|
+
right: '0',
|
|
80
|
+
transform: 'translate(50%, -50%) rotate(45deg)'
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
bottom: {
|
|
84
|
+
'&:before': {
|
|
85
|
+
bottom: '0',
|
|
86
|
+
left: '50%',
|
|
87
|
+
transform: 'translate(-50%, 50%) rotate(45deg)'
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
left: {
|
|
91
|
+
'&:before': {
|
|
92
|
+
top: '50%',
|
|
93
|
+
left: '0',
|
|
94
|
+
transform: 'translate(-50%, -50%) rotate(45deg)'
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
tag: (el) => ({
|
|
100
|
+
position: 'relative',
|
|
101
|
+
'&:before': {
|
|
102
|
+
content: '""',
|
|
103
|
+
display: 'block',
|
|
104
|
+
background: getComputedBackgroundColor(el),
|
|
105
|
+
transition: inheritTransition(el),
|
|
106
|
+
transitionProperty: 'background',
|
|
107
|
+
borderRadius: '.25em',
|
|
108
|
+
position: 'absolute',
|
|
109
|
+
zIndex: '-1',
|
|
110
|
+
aspectRatio: '1/1',
|
|
111
|
+
top: '50%',
|
|
112
|
+
transformOrigin: '50% 50%',
|
|
113
|
+
height: '73%'
|
|
114
|
+
}
|
|
115
|
+
}),
|
|
116
|
+
|
|
117
|
+
tagDirection: {
|
|
118
|
+
top: {
|
|
119
|
+
'&:before': {
|
|
120
|
+
bottom: '100%',
|
|
121
|
+
left: '50%',
|
|
122
|
+
transform: 'translate(-50%, 50%) rotate(45deg)'
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
right: {
|
|
126
|
+
'&:before': {
|
|
127
|
+
top: '50%',
|
|
128
|
+
left: '100%',
|
|
129
|
+
transform: 'translate(-50%, -50%) rotate(45deg)'
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
bottom: {
|
|
133
|
+
'&:before': {
|
|
134
|
+
top: '100%',
|
|
135
|
+
left: '50%',
|
|
136
|
+
transform: 'translate(-50%, -50%) rotate(45deg)'
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
left: {
|
|
140
|
+
'&:before': {
|
|
141
|
+
top: '50%',
|
|
142
|
+
right: '100%',
|
|
143
|
+
transform: 'translate(50%, -50%) rotate(45deg)'
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
hexagon: (el) => ({
|
|
149
|
+
position: 'relative',
|
|
150
|
+
'&:before, &:after': {
|
|
151
|
+
content: '""',
|
|
152
|
+
display: 'block',
|
|
153
|
+
position: 'absolute',
|
|
154
|
+
zIndex: '-1',
|
|
155
|
+
borderRadius: '.25em',
|
|
156
|
+
aspectRatio: '1/1',
|
|
157
|
+
top: '50%',
|
|
158
|
+
transformOrigin: '50% 50%',
|
|
159
|
+
height: '73%',
|
|
160
|
+
background: getComputedBackgroundColor(el),
|
|
161
|
+
transition: inheritTransition(el),
|
|
162
|
+
transitionProperty: 'background'
|
|
163
|
+
},
|
|
164
|
+
'&:before': {
|
|
165
|
+
left: '0',
|
|
166
|
+
transform: 'translate3d(-50%, -50%, 1px) rotate(45deg)'
|
|
167
|
+
},
|
|
168
|
+
'&:after': {
|
|
169
|
+
left: '100%',
|
|
170
|
+
transform: 'translate3d(-50%, -50%, 1px) rotate(45deg)'
|
|
171
|
+
}
|
|
172
|
+
}),
|
|
173
|
+
|
|
174
|
+
chevron: (el) => ({
|
|
175
|
+
position: 'relative',
|
|
176
|
+
'&:before, &:after': {
|
|
177
|
+
content: '""',
|
|
178
|
+
display: 'block',
|
|
179
|
+
position: 'absolute',
|
|
180
|
+
zIndex: '-1',
|
|
181
|
+
aspectRatio: '1/1',
|
|
182
|
+
top: '50%',
|
|
183
|
+
transformOrigin: '50% 50%',
|
|
184
|
+
transition: inheritTransition(el),
|
|
185
|
+
transitionProperty: 'background'
|
|
186
|
+
},
|
|
187
|
+
'&:before': {
|
|
188
|
+
background: `linear-gradient(225deg, ${getComputedBackgroundColor(el)} 25%, transparent 25%), linear-gradient(315deg, ${getComputedBackgroundColor(el)} 25%, transparent 25%)`
|
|
189
|
+
},
|
|
190
|
+
'&:after': {
|
|
191
|
+
background: getComputedBackgroundColor(el),
|
|
192
|
+
borderRadius: '.25em'
|
|
193
|
+
}
|
|
194
|
+
}),
|
|
195
|
+
|
|
196
|
+
chevronDirection: {
|
|
197
|
+
left: {
|
|
198
|
+
'&:before': {
|
|
199
|
+
height: '100%',
|
|
200
|
+
left: '100%',
|
|
201
|
+
transform: 'translate3d(-1%, -50%, 1px) scale(-1, 1)'
|
|
202
|
+
},
|
|
203
|
+
'&:after': {
|
|
204
|
+
height: '73%',
|
|
205
|
+
left: '0',
|
|
206
|
+
transform: 'translate3d(-50%, -50%, 1px) rotate(45deg)'
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
right: {
|
|
210
|
+
'&:before': {
|
|
211
|
+
height: '100%',
|
|
212
|
+
left: '0',
|
|
213
|
+
transform: 'translate3d(-99%, -50%, 1px)'
|
|
214
|
+
},
|
|
215
|
+
'&:after': {
|
|
216
|
+
height: '73%',
|
|
217
|
+
left: '100%',
|
|
218
|
+
transform: 'translate3d(-50%, -50%, 1px) rotate(45deg)'
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export const Shape = {
|
|
225
|
+
deps: { exec, getSpacingBasedOnRatio, getMediaColor },
|
|
226
|
+
|
|
227
|
+
classlist: {
|
|
228
|
+
shape: (el) => {
|
|
229
|
+
return el.deps.exec(SHAPES[el.shape], el)
|
|
230
|
+
},
|
|
231
|
+
shapeDirection: (el) => {
|
|
232
|
+
if (!el.shape || !el.shapeDirection) return
|
|
233
|
+
const shapeDir = SHAPES[el.shape + 'Direction']
|
|
234
|
+
return el.shape && shapeDir ? shapeDir[el.shapeDirection || 'left'] : null
|
|
235
|
+
},
|
|
236
|
+
shapeDirectionColor: (el) => {
|
|
237
|
+
const borderColor = {
|
|
238
|
+
borderColor: el.deps.getMediaColor(el.background || el.backgroundColor)
|
|
239
|
+
}
|
|
240
|
+
return el.shapeDirection ? borderColor : null
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export const Circle = {
|
|
246
|
+
round: '100%'
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export default Shape
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// create SVG symbol
|
|
4
|
+
export const Svg = {
|
|
5
|
+
tag: 'svg',
|
|
6
|
+
attr: {
|
|
7
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
|
8
|
+
'xmlns:xlink': 'http://www.w3.org/1999/xlink'
|
|
9
|
+
},
|
|
10
|
+
html: (el) => {
|
|
11
|
+
const { context } = el
|
|
12
|
+
if (el.semanticIcons) return
|
|
13
|
+
if (el.html && typeof el.html !== 'function') return el.call('exec', el.html, el)
|
|
14
|
+
|
|
15
|
+
const { designSystem, utils } = context
|
|
16
|
+
const SVG = designSystem && designSystem.svg
|
|
17
|
+
const useSvgSprite = el.spriteId || (designSystem && designSystem.useSvgSprite)
|
|
18
|
+
|
|
19
|
+
const src = el.call('exec', el.src, el)
|
|
20
|
+
if (!useSvgSprite && src) return src
|
|
21
|
+
|
|
22
|
+
const useSVGSymbol = icon => `<use xlink:href="#${icon}" />`
|
|
23
|
+
|
|
24
|
+
const spriteId = el.spriteId
|
|
25
|
+
if (spriteId) return useSVGSymbol(spriteId)
|
|
26
|
+
|
|
27
|
+
if (SVG && SVG[src]) return useSVGSymbol(src)
|
|
28
|
+
|
|
29
|
+
const symbolId = Symbol.for(src)
|
|
30
|
+
let SVGKey = SVG[symbolId]
|
|
31
|
+
if (SVGKey && SVG[SVGKey]) return useSVGSymbol(SVGKey)
|
|
32
|
+
|
|
33
|
+
SVGKey = SVG[symbolId] = Math.random()
|
|
34
|
+
if (src) {
|
|
35
|
+
utils.init({
|
|
36
|
+
svg: { [SVGKey]: src }
|
|
37
|
+
}, {
|
|
38
|
+
document: context.document,
|
|
39
|
+
emotion: context.emotion
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return useSVGSymbol(SVGKey)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export const Text = {}
|
|
4
|
+
|
|
5
|
+
export const H1 = { tag: 'h1' }
|
|
6
|
+
export const H2 = { tag: 'h2' }
|
|
7
|
+
export const H3 = { tag: 'h3' }
|
|
8
|
+
export const H4 = { tag: 'h4' }
|
|
9
|
+
export const H5 = { tag: 'h5' }
|
|
10
|
+
export const H6 = { tag: 'h6' }
|
|
11
|
+
export const P = { tag: 'p' }
|
|
12
|
+
export const Caption = { tag: 'caption' }
|
|
13
|
+
export const Strong = {
|
|
14
|
+
tag: 'strong',
|
|
15
|
+
fontWeight: '700'
|
|
16
|
+
}
|
|
17
|
+
export const U = { tag: 'u' }
|
|
18
|
+
export const Underline = { tag: 'u' }
|
|
19
|
+
export const Italic = { tag: 'i' }
|
|
20
|
+
|
|
21
|
+
export const Title = {}
|
|
22
|
+
|
|
23
|
+
export const Headline = {
|
|
24
|
+
tag: 'h6',
|
|
25
|
+
fontSize: 'B',
|
|
26
|
+
fontWeight: 500
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const Subhead = {
|
|
30
|
+
tag: 'span',
|
|
31
|
+
fontSize: 'Z1'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Footnote = {
|
|
35
|
+
tag: 'span',
|
|
36
|
+
fontSize: 'Z'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const B = { tag: 'b' }
|
|
40
|
+
|
|
41
|
+
export const I = { tag: 'i' }
|
|
42
|
+
|
|
43
|
+
export const Data = { tag: 'data' }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { depth } from './Shape.js'
|
|
4
|
+
import { isUndefined } from '@symbo.ls/utils'
|
|
5
|
+
|
|
6
|
+
export const getSystemGlobalTheme = ({ context, state }) => {
|
|
7
|
+
const rootState = state && state.root
|
|
8
|
+
const theme = (rootState && rootState.globalTheme) || (context.designSystem && context.designSystem.globalTheme)
|
|
9
|
+
return theme === 'auto' ? null : theme
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const Theme = {
|
|
13
|
+
deps: {
|
|
14
|
+
depth
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
classlist: {
|
|
18
|
+
depth: (el) => !isUndefined(el.depth) && el.deps.depth[el.depth]
|
|
19
|
+
}
|
|
20
|
+
}
|