@symbo.ls/preview 0.0.69 → 0.0.70
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/package.json +1 -1
- package/src/pages/Spaces/index.js +2 -1
- package/src/pages/Typography/documentStyles.js +47 -45
- package/src/sync.js +1 -0
- package/user_data/4it.js +6 -2
package/package.json
CHANGED
|
@@ -37,35 +37,39 @@ export default {
|
|
|
37
37
|
headings: {
|
|
38
38
|
extend: DocumentStylesSequence,
|
|
39
39
|
|
|
40
|
-
$setStateCollection: (el) => {
|
|
41
|
-
const {
|
|
42
|
-
const { TYPOGRAPHY, FONT_FAMILY } =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const font = family.arr[0]
|
|
50
|
-
|
|
40
|
+
$setStateCollection: (el, s) => {
|
|
41
|
+
const { __system } = s
|
|
42
|
+
const { TYPOGRAPHY, FONT_FAMILY } = __system
|
|
43
|
+
let { styles } = TYPOGRAPHY
|
|
44
|
+
if (!styles) styles = TYPOGRAPHY.styles = {}
|
|
45
|
+
|
|
46
|
+
const familyValue = getFontFamily('def', FONT_FAMILY)
|
|
47
|
+
const { lineHeight, fontWeight } = TYPOGRAPHY
|
|
48
|
+
const font = familyValue[0]
|
|
51
49
|
const HEADINGS = new Array(6).fill(null).map((_, i) => 'h' + (i + 1))
|
|
52
50
|
|
|
51
|
+
el.removeContent()
|
|
52
|
+
const calcProp = (key, prop, defaultValue) => {
|
|
53
|
+
if (!styles[key]) styles[key] = {}
|
|
54
|
+
return styles[key][prop] || styles[prop] || defaultValue
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
return HEADINGS.map((v, k) => ({
|
|
54
58
|
key: v,
|
|
55
59
|
value: {
|
|
56
60
|
font,
|
|
57
|
-
fontFamily: familyValue,
|
|
58
|
-
fontWeight:
|
|
59
|
-
lineHeight,
|
|
60
|
-
...styles[v]
|
|
61
|
+
fontFamily: calcProp(v, 'fontFamily', familyValue),
|
|
62
|
+
fontWeight: calcProp(v, 'fontWeight', fontWeight),
|
|
63
|
+
lineHeight: calcProp(v, 'lineHeight', lineHeight),
|
|
64
|
+
...(styles ? styles[v] : {})
|
|
61
65
|
},
|
|
62
66
|
labels: [
|
|
63
67
|
{ icon: 'fontFace', text: font },
|
|
64
68
|
{ icon: 'fontVariable', text: 900 - (k * 100) },
|
|
65
69
|
{ icon: 'textLineHeight', text: lineHeight }
|
|
66
70
|
],
|
|
67
|
-
sequenceValue:
|
|
68
|
-
findHeadingLetter(
|
|
71
|
+
sequenceValue: s.sequence[
|
|
72
|
+
findHeadingLetter(s.h1Matches, k)
|
|
69
73
|
]
|
|
70
74
|
}))
|
|
71
75
|
}
|
|
@@ -73,52 +77,52 @@ export default {
|
|
|
73
77
|
|
|
74
78
|
doc: {
|
|
75
79
|
extend: DocumentStylesSequence,
|
|
76
|
-
$setStateCollection: (el) => {
|
|
77
|
-
const {
|
|
78
|
-
const {
|
|
79
|
-
|
|
80
|
+
$setStateCollection: (el, s) => {
|
|
81
|
+
const { __system } = s
|
|
82
|
+
const { FONT_FAMILY, TYPOGRAPHY } = __system
|
|
83
|
+
const { styles, lineHeight, fontWeight } = TYPOGRAPHY
|
|
84
|
+
if (!styles.body) styles.body = {}
|
|
80
85
|
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
const font = family.arr[0]
|
|
84
|
-
const { fontWeight, lineHeight } = DOCUMENT
|
|
86
|
+
const familyValue = getFontFamily('def', FONT_FAMILY)
|
|
87
|
+
const font = familyValue[0]
|
|
85
88
|
|
|
89
|
+
el.removeContent()
|
|
86
90
|
return [{
|
|
87
91
|
key: 'body',
|
|
88
92
|
value: {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
fontFamily: styles ? styles['body'].fontFamily || styles.fontFamily : familyValue,
|
|
94
|
+
fontWeight: styles ? styles['body'].fontWeight || styles.fontWeight : fontWeight,
|
|
95
|
+
lineHeight: styles ? styles['body'].lineHeight || styles.lineHeight : lineHeight,
|
|
96
|
+
...(styles ? styles['body'] : {})
|
|
93
97
|
},
|
|
94
98
|
labels: [
|
|
95
99
|
{ icon: 'fontFace', text: font },
|
|
96
100
|
{ icon: 'fontVariable', text: fontWeight || 400 },
|
|
97
101
|
{ icon: 'textLineHeight', text: lineHeight }
|
|
98
102
|
],
|
|
99
|
-
sequenceValue:
|
|
103
|
+
sequenceValue: s.sequence['A']
|
|
100
104
|
}]
|
|
101
105
|
}
|
|
102
106
|
},
|
|
103
107
|
|
|
104
108
|
helpers: {
|
|
105
|
-
$setStateCollection: (el) => {
|
|
109
|
+
$setStateCollection: (el, s) => {
|
|
106
110
|
const { state, context } = el // eslint-disable-line no-unused-vars
|
|
107
|
-
const {
|
|
108
|
-
const {
|
|
109
|
-
|
|
111
|
+
const { __system } = s
|
|
112
|
+
const { TYPOGRAPHY, FONT_FAMILY } = __system
|
|
113
|
+
const { styles, lineHeight, fontWeight } = TYPOGRAPHY
|
|
110
114
|
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
const lineHeight = TYPOGRAPHY.lineHeight
|
|
114
|
-
const font = family.arr[0]
|
|
115
|
+
const familyValue = getFontFamily('def', FONT_FAMILY)
|
|
116
|
+
const font = familyValue[0]
|
|
115
117
|
|
|
118
|
+
el.removeContent()
|
|
119
|
+
if (!styles) return
|
|
116
120
|
return Object.keys(styles).filter(v => v.slice(0, 1) === '.').map((v, k) => ({
|
|
117
121
|
key: v,
|
|
118
122
|
value: {
|
|
119
123
|
font,
|
|
120
124
|
fontFamily: familyValue,
|
|
121
|
-
fontWeight:
|
|
125
|
+
fontWeight: styles[v].fontWeight || fontWeight,
|
|
122
126
|
lineHeight,
|
|
123
127
|
...styles[v]
|
|
124
128
|
},
|
|
@@ -214,14 +218,12 @@ export default {
|
|
|
214
218
|
on: {
|
|
215
219
|
init: (el, s) => {
|
|
216
220
|
if (!s.__system) return
|
|
217
|
-
const {
|
|
218
|
-
const { TYPOGRAPHY } =
|
|
221
|
+
const { __system } = s
|
|
222
|
+
const { TYPOGRAPHY } = __system
|
|
219
223
|
const { styles } = TYPOGRAPHY
|
|
220
224
|
if (styles) {
|
|
221
|
-
s.update({
|
|
222
|
-
|
|
223
|
-
}, { preventUpdate: true })
|
|
224
|
-
}
|
|
225
|
+
s.update({ styles }, { preventUpdate: true })
|
|
226
|
+
} else TYPOGRAPHY.styles = {}
|
|
225
227
|
}
|
|
226
228
|
}
|
|
227
229
|
}
|
package/src/sync.js
CHANGED
package/user_data/4it.js
CHANGED
|
@@ -118,13 +118,17 @@ export const FONT = {
|
|
|
118
118
|
}, {
|
|
119
119
|
url: S3_BUCKET + AvenirHeavy,
|
|
120
120
|
fontWeight: 900
|
|
121
|
-
}]
|
|
121
|
+
}],
|
|
122
|
+
AvenirVariable: {
|
|
123
|
+
url: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/2729/AvenirNext_Variable.ttf',
|
|
124
|
+
isVariable: true
|
|
125
|
+
}
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
export const FONT_FAMILY = {
|
|
125
129
|
Default: {
|
|
126
130
|
isDefault: true,
|
|
127
|
-
value: ['"Avenir"'],
|
|
131
|
+
value: ['"AvenirVariable"', '"Avenir"'],
|
|
128
132
|
type: 'serif'
|
|
129
133
|
}
|
|
130
134
|
}
|