@symbo.ls/preview 0.0.9
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/.babelrc.js +5 -0
- package/.coveralls.yml +1 -0
- package/.eslintignore +1 -0
- package/.eslintrc.js +15 -0
- package/.prettierrc +4 -0
- package/.symbols/button-archived/index.js +63 -0
- package/.symbols/button-archived/style.js +5 -0
- package/.symbols/button-circle/index.js +62 -0
- package/.symbols/button-contacts/index.js +48 -0
- package/.symbols/button-contacts/style.js +13 -0
- package/.symbols/button-download/index.js +59 -0
- package/.symbols/button-pro/index.js +98 -0
- package/.symbols/button-pro/style.js +19 -0
- package/.symbols/button-theme-switcher/index.js +104 -0
- package/.symbols/button-theme-switcher/style.js +16 -0
- package/.symbols/button-user/index.js +82 -0
- package/.symbols/button-user/style.js +25 -0
- package/.symbols/categories.js +44 -0
- package/.symbols/datepicker/index.js +40 -0
- package/.symbols/datepicker/style.js +4 -0
- package/.symbols/dropdown-list/index.js +56 -0
- package/.symbols/field/index.js +40 -0
- package/.symbols/index.js +33 -0
- package/.symbols/label/index.js +40 -0
- package/.symbols/notification/index.js +49 -0
- package/.symbols/notification/style.js +5 -0
- package/.symbols/pills/index.js +37 -0
- package/.symbols/tooltip/index.js +38 -0
- package/.vscode/settings.json +3 -0
- package/README.md +19 -0
- package/app.webmanifest +4 -0
- package/index.html +22 -0
- package/package.json +48 -0
- package/protect-pwd.js +65 -0
- package/src/animations.js +71 -0
- package/src/app.js +79 -0
- package/src/assets/dots.png +0 -0
- package/src/assets/dotsDark.png +0 -0
- package/src/assets/fonts/FiraGO/FiraGO-Bold.woff2 +0 -0
- package/src/assets/fonts/FiraGO/FiraGO-Light.woff2 +0 -0
- package/src/assets/fonts/FiraGO/FiraGO-Medium.woff2 +0 -0
- package/src/assets/fonts/FiraGO/FiraGO-Regular.woff2 +0 -0
- package/src/assets/fonts/europa-bold-webfont.woff2 +0 -0
- package/src/assets/fonts/europa-bolditalic-webfont.woff2 +0 -0
- package/src/assets/fonts/europa-light-webfont.woff2 +0 -0
- package/src/assets/fonts/europa-lightitalic-webfont.woff2 +0 -0
- package/src/assets/fonts/europa-regular-webfont.woff2 +0 -0
- package/src/assets/fonts/europa-regularitalic-webfont.woff2 +0 -0
- package/src/assets/ovalCircle.svg +9 -0
- package/src/components/Header.js +21 -0
- package/src/components/index.js +3 -0
- package/src/config/color.js +8 -0
- package/src/config/font.js +0 -0
- package/src/config/index.js +19 -0
- package/src/config/theme.js +85 -0
- package/src/dev.html +19 -0
- package/src/index.js +33 -0
- package/src/pages/Account/index.js +241 -0
- package/src/pages/Account/setUpProject.js +142 -0
- package/src/pages/Color/colors.js +58 -0
- package/src/pages/Color/documentThemes.js +101 -0
- package/src/pages/Color/index.js +20 -0
- package/src/pages/Color/style.js +7 -0
- package/src/pages/Color/themes.js +131 -0
- package/src/pages/ColorEditor/colorTone.js +163 -0
- package/src/pages/ColorEditor/friendTheme.js +30 -0
- package/src/pages/ColorEditor/index.js +178 -0
- package/src/pages/ColorEditor/interactivity.js +116 -0
- package/src/pages/ColorEditor/ntc.js +1689 -0
- package/src/pages/ColorEditor/style.js +49 -0
- package/src/pages/ColorEditor/themingTools.js +107 -0
- package/src/pages/Components/grid.js +94 -0
- package/src/pages/Components/index.js +40 -0
- package/src/pages/Components/sidebar.js +23 -0
- package/src/pages/Components/style.js +16 -0
- package/src/pages/DesignSystem/index.js +106 -0
- package/src/pages/DesignSystem/style.js +1 -0
- package/src/pages/Editor/index.js +46 -0
- package/src/pages/Editor/layers.js +126 -0
- package/src/pages/Editor/scene.js +97 -0
- package/src/pages/Editor/style.js +13 -0
- package/src/pages/Editor/tools.js +360 -0
- package/src/pages/Export/_tools_old.js +49 -0
- package/src/pages/Export/const.js +18 -0
- package/src/pages/Export/description.js +56 -0
- package/src/pages/Export/index.js +74 -0
- package/src/pages/Export/scene.js +62 -0
- package/src/pages/Export/state.js +21 -0
- package/src/pages/Export/style.js +21 -0
- package/src/pages/Export/tools.js +14 -0
- package/src/pages/Icons/index.js +72 -0
- package/src/pages/Icons/style.js +1 -0
- package/src/pages/Library/index.js +32 -0
- package/src/pages/Library/style.js +36 -0
- package/src/pages/PageExtend.js +12 -0
- package/src/pages/Shapes/index.js +161 -0
- package/src/pages/Shapes/style.js +28 -0
- package/src/pages/Spaces/boxModel.js +3 -0
- package/src/pages/Spaces/index.js +58 -0
- package/src/pages/Spaces/preview.js +133 -0
- package/src/pages/Spaces/sequence.js +3 -0
- package/src/pages/Spaces/state.js +18 -0
- package/src/pages/Spaces/style.js +30 -0
- package/src/pages/Typography/docFonts.js +128 -0
- package/src/pages/Typography/docStyles.js +97 -0
- package/src/pages/Typography/index.js +52 -0
- package/src/pages/Typography/shared.js +10 -0
- package/src/pages/Typography/state.js +15 -0
- package/src/pages/Typography/style.js +11 -0
- package/src/pages/Typography/typeScale.js +104 -0
- package/src/pages/index.js +13 -0
- package/src/protect.js +114 -0
- package/src/state.js +7 -0
- package/src/style.js +7 -0
- package/src/test.js +30 -0
- package/svgSprite.config.js +7 -0
- package/test/index.test.js +5 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { Block, Grid, FontObject, Link, SectionHeader, FontFamilyObject } from '@symbo.ls/components'
|
|
4
|
+
import { TypeSection } from './shared'
|
|
5
|
+
|
|
6
|
+
const mapFonts = (el, s) => {
|
|
7
|
+
if (!el.__root.state.CONFIG) return
|
|
8
|
+
const { FONT } = el.__root.state.CONFIG
|
|
9
|
+
|
|
10
|
+
const fontKeys = Object.keys(FONT)
|
|
11
|
+
|
|
12
|
+
return fontKeys.map(v => {
|
|
13
|
+
const font = FONT[v]
|
|
14
|
+
const weights = Object.keys(font)
|
|
15
|
+
const weightsLength = weights.length
|
|
16
|
+
const fontWeightCaption = weights[0] === 'variable' ? 'variable' : `${weightsLength} style${weightsLength > 1 ? 's' : ''}`
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
props: {
|
|
20
|
+
href: `/typography/document-fonts/font-settings/${v}`,
|
|
21
|
+
fontTitle: v
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
caption: {},
|
|
25
|
+
p: {},
|
|
26
|
+
description: [
|
|
27
|
+
{ props: { icon: 'variableFont', text: fontWeightCaption } }
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const line = {
|
|
34
|
+
extend: Block,
|
|
35
|
+
props: {
|
|
36
|
+
margin: 'D 0'
|
|
37
|
+
},
|
|
38
|
+
style: {
|
|
39
|
+
height: '.2px',
|
|
40
|
+
background: 'rgba(255, 255, 255, .1)',
|
|
41
|
+
marginLeft: '-100%',
|
|
42
|
+
marginRight: '-100%'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const fontFamilies = {
|
|
47
|
+
extend: Block,
|
|
48
|
+
props: { padding: '0 0 E 0' },
|
|
49
|
+
header: {
|
|
50
|
+
extend: SectionHeader,
|
|
51
|
+
heading: {
|
|
52
|
+
caption: { props: { text: 'Font Families' } },
|
|
53
|
+
p: { props: { text: 'Setup a set and fallback fonts as font FAMILIES' } }
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
content: {
|
|
57
|
+
extend: Grid,
|
|
58
|
+
props: {
|
|
59
|
+
flexAlign: 'center space-between',
|
|
60
|
+
columns: 'repeat(3, 1fr)',
|
|
61
|
+
gap: 'Z'
|
|
62
|
+
},
|
|
63
|
+
childExtend: {
|
|
64
|
+
extend: [FontFamilyObject, Link],
|
|
65
|
+
props: { href: '/typography/document-fonts/font-family' },
|
|
66
|
+
style: { textDecoration: 'none' }
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
content: el => {
|
|
70
|
+
if (!el.__root.state.CONFIG) return
|
|
71
|
+
const { FONT_FAMILY } = el.__root.state.CONFIG
|
|
72
|
+
|
|
73
|
+
const FAMILIES = Object.keys(FONT_FAMILY).map(v => {
|
|
74
|
+
const val = FONT_FAMILY[v]
|
|
75
|
+
if (v === 'default') return null
|
|
76
|
+
return {
|
|
77
|
+
caption: { props: { text: v } },
|
|
78
|
+
p: { props: { text: val.value } }
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
tag: 'fragment',
|
|
84
|
+
...FAMILIES
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default {
|
|
91
|
+
extend: TypeSection,
|
|
92
|
+
header: {
|
|
93
|
+
extend: Block,
|
|
94
|
+
heading: {
|
|
95
|
+
p: { props: { text: 'Document @font-face, default and backup fonts' } }
|
|
96
|
+
},
|
|
97
|
+
nav: {
|
|
98
|
+
add: {
|
|
99
|
+
extend: Link,
|
|
100
|
+
props: {
|
|
101
|
+
icon: 'plus',
|
|
102
|
+
href: '/typography/document-fonts/upload-font'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
wrapper: {
|
|
109
|
+
fonts: {
|
|
110
|
+
extend: Grid,
|
|
111
|
+
props: {
|
|
112
|
+
columns: 'repeat(2, 1fr)',
|
|
113
|
+
gap: 'A'
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
childExtend: FontObject,
|
|
117
|
+
|
|
118
|
+
content: (el, s) => {
|
|
119
|
+
return {
|
|
120
|
+
tag: 'fragment',
|
|
121
|
+
...mapFonts(el, s)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
line,
|
|
126
|
+
fontFamilies
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Icon, Link,
|
|
5
|
+
TypeHelpers,
|
|
6
|
+
DocumentStylesSequence
|
|
7
|
+
} from '@symbo.ls/components'
|
|
8
|
+
import { TypeSection } from './shared'
|
|
9
|
+
|
|
10
|
+
import { interactivityButton } from '../ColorEditor'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
extend: TypeSection,
|
|
14
|
+
|
|
15
|
+
header: {
|
|
16
|
+
heading: {
|
|
17
|
+
p: { props: { text: 'Document styling and theming provides global themes of the entire app, imagine it as a :root styling' } }
|
|
18
|
+
},
|
|
19
|
+
nav: {
|
|
20
|
+
add: {
|
|
21
|
+
extend: Link,
|
|
22
|
+
props: {
|
|
23
|
+
href: '/typography/document-styles/html-tags',
|
|
24
|
+
icon: 'plus'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
wrapper: {
|
|
31
|
+
bodyTags: {
|
|
32
|
+
|
|
33
|
+
cnt: {
|
|
34
|
+
style: { flex: 1 },
|
|
35
|
+
|
|
36
|
+
fonts: DocumentStylesSequence,
|
|
37
|
+
|
|
38
|
+
interactivities: {
|
|
39
|
+
style: {
|
|
40
|
+
paddingLeft: '8em',
|
|
41
|
+
display: 'flex',
|
|
42
|
+
gap: '1em',
|
|
43
|
+
marginTop: '1em'
|
|
44
|
+
},
|
|
45
|
+
childExtend: {
|
|
46
|
+
extend: interactivityButton,
|
|
47
|
+
style: {
|
|
48
|
+
display: 'flex',
|
|
49
|
+
justifyContent: 'space-Between',
|
|
50
|
+
svg: { color: 'rgba(255, 255, 255, .35)' }
|
|
51
|
+
},
|
|
52
|
+
props: {
|
|
53
|
+
icon: 'plus'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
...[{
|
|
57
|
+
style: { width: '145px' },
|
|
58
|
+
props: { text: '<p>' }
|
|
59
|
+
}, {
|
|
60
|
+
style: { width: '145px' },
|
|
61
|
+
props: { text: '<code>' }
|
|
62
|
+
}, {
|
|
63
|
+
style: { width: '145px' },
|
|
64
|
+
props: { text: '<pre>' }
|
|
65
|
+
}, {
|
|
66
|
+
props: {
|
|
67
|
+
padding: 'Z',
|
|
68
|
+
text: ''
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
style: {
|
|
72
|
+
position: 'relative',
|
|
73
|
+
width: '207px'
|
|
74
|
+
},
|
|
75
|
+
props: {
|
|
76
|
+
text: 'Choose element'
|
|
77
|
+
},
|
|
78
|
+
icon2: {
|
|
79
|
+
extend: Icon,
|
|
80
|
+
props: { icon: 'arrowAngleDown' },
|
|
81
|
+
style: {
|
|
82
|
+
paddingRight: `${12.5 / 16}em`,
|
|
83
|
+
marginRight: `${12.5 / 16}em`,
|
|
84
|
+
borderRight: '1px solid rgba(255, 255, 255, .1)',
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
right: `${25 / 16}em`,
|
|
87
|
+
height: '80%'
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
TypeHelpers
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import PageExtend from '../PageExtend'
|
|
4
|
+
|
|
5
|
+
import { Link, TabHeader } from '@symbo.ls/components'
|
|
6
|
+
|
|
7
|
+
import style from './style'
|
|
8
|
+
import state from './state'
|
|
9
|
+
|
|
10
|
+
import documentFonts from './docFonts'
|
|
11
|
+
import documentStyle from './docStyles'
|
|
12
|
+
import typeScale from './typeScale'
|
|
13
|
+
|
|
14
|
+
export const Typography = {
|
|
15
|
+
extend: PageExtend,
|
|
16
|
+
|
|
17
|
+
on: {
|
|
18
|
+
init: (el, s) => {
|
|
19
|
+
const route = window.location.pathname
|
|
20
|
+
const routes = route.slice(1).split('/')
|
|
21
|
+
s.activeTab = routes[1] || state.activeTab
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
define: { routes: param => param },
|
|
26
|
+
|
|
27
|
+
style,
|
|
28
|
+
state,
|
|
29
|
+
|
|
30
|
+
routes: {
|
|
31
|
+
'document-fonts': documentFonts,
|
|
32
|
+
'type-scale': typeScale,
|
|
33
|
+
'document-styles': documentStyle
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
header: {
|
|
37
|
+
extend: TabHeader,
|
|
38
|
+
style: {
|
|
39
|
+
paddingLeft: '2em'
|
|
40
|
+
},
|
|
41
|
+
tabs: {
|
|
42
|
+
childExtend: { extend: [Link] },
|
|
43
|
+
'document-fonts': { props: { text: 'Document Fonts' } },
|
|
44
|
+
'type-scale': { props: { text: 'Type Scale' } },
|
|
45
|
+
'document-styles': { props: { text: 'Document Styles' } }
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
page: {
|
|
50
|
+
content: (el, s) => ({ extend: el.parent.routes[s.activeTab] })
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
base: 14,
|
|
5
|
+
ratio: 1.125,
|
|
6
|
+
scales: {},
|
|
7
|
+
range: [-3, +10],
|
|
8
|
+
h1Matches: +6,
|
|
9
|
+
sequence: {},
|
|
10
|
+
type: 'font-size',
|
|
11
|
+
|
|
12
|
+
sampleText: 'Today is a big day for our tribe. The year ends.',
|
|
13
|
+
activePage: 'typography',
|
|
14
|
+
activeTab: 'documentFonts'
|
|
15
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { styleTypeScale } from './style'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Flex, Block, Text, Grid,
|
|
7
|
+
SequenceGraph,
|
|
8
|
+
SliderToolWithCaption,
|
|
9
|
+
StaticSpacing,
|
|
10
|
+
PreviewSettings,
|
|
11
|
+
ScalesSequence,
|
|
12
|
+
CommonField
|
|
13
|
+
} from '@symbo.ls/components'
|
|
14
|
+
|
|
15
|
+
import { TypeSection } from './shared'
|
|
16
|
+
|
|
17
|
+
const ScalingTools = {
|
|
18
|
+
extend: Flex,
|
|
19
|
+
|
|
20
|
+
props: {
|
|
21
|
+
flow: 'column',
|
|
22
|
+
gap: 'A2'
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
fontSize: {
|
|
26
|
+
extend: [SliderToolWithCaption],
|
|
27
|
+
caption: { text: 'Base size' },
|
|
28
|
+
element: {
|
|
29
|
+
style: {
|
|
30
|
+
maxWidth: `${232 / 16}em`
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
sequence: {
|
|
36
|
+
extend: CommonField,
|
|
37
|
+
caption: { text: 'Sequence ratio' },
|
|
38
|
+
element: {
|
|
39
|
+
extend: StaticSpacing,
|
|
40
|
+
spacings: {
|
|
41
|
+
childExtend: {
|
|
42
|
+
on: {
|
|
43
|
+
click: (ev, el, s) => s.update({ ratio: el.value.text })
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default {
|
|
52
|
+
style: styleTypeScale,
|
|
53
|
+
extend: TypeSection,
|
|
54
|
+
|
|
55
|
+
header: {
|
|
56
|
+
heading: {
|
|
57
|
+
p: { props: { text: 'Generate text sequence by a base size and ratio' } }
|
|
58
|
+
},
|
|
59
|
+
nav: {
|
|
60
|
+
add: { props: { icon: 'plus' } }
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
wrapper: {
|
|
65
|
+
textTest: '',
|
|
66
|
+
fonts: '',
|
|
67
|
+
|
|
68
|
+
cnt: {
|
|
69
|
+
extend: [Block, Grid],
|
|
70
|
+
|
|
71
|
+
props: {
|
|
72
|
+
gap: 'D',
|
|
73
|
+
columns: '16em auto'
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
aside: ScalingTools,
|
|
77
|
+
|
|
78
|
+
wrapper: {
|
|
79
|
+
settings: {
|
|
80
|
+
extend: PreviewSettings,
|
|
81
|
+
props: { margin: '0 0 B' }
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
fonts: ScalesSequence
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
sequenceSet: {
|
|
88
|
+
extend: CommonField,
|
|
89
|
+
props: { margin: 'C2 0' },
|
|
90
|
+
caption: {
|
|
91
|
+
extend: [Block, Text],
|
|
92
|
+
props: {
|
|
93
|
+
text: 'Sizing generated by this setting',
|
|
94
|
+
padding: '0 0 A 0'
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
element: {
|
|
98
|
+
extend: [SequenceGraph, Block, Text],
|
|
99
|
+
style: { '> span': { display: 'none' } }
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export * from './PageExtend'
|
|
4
|
+
export * from './Components'
|
|
5
|
+
export * from './Export'
|
|
6
|
+
export * from './Icons'
|
|
7
|
+
export * from './Library'
|
|
8
|
+
export * from './Color'
|
|
9
|
+
export * from './ColorEditor'
|
|
10
|
+
export * from './Shapes'
|
|
11
|
+
export * from './Spaces'
|
|
12
|
+
export * from './Typography'
|
|
13
|
+
export * from './DesignSystem'
|
package/src/protect.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import './config'
|
|
4
|
+
import DOM from 'domql'
|
|
5
|
+
|
|
6
|
+
import { auth, configureClient, login } from '@symbo.ls/auth'
|
|
7
|
+
// import { fetchAuth, READ_WAITLIST_USER, READ_COMPANY } from '@symbo.ls/fetch'
|
|
8
|
+
import { getCookie, setCookie } from 'domql/packages/cookie'
|
|
9
|
+
|
|
10
|
+
import Loader from '@symbo.ls/loader'
|
|
11
|
+
import App from './app'
|
|
12
|
+
|
|
13
|
+
import { Box } from '@symbo.ls/components'
|
|
14
|
+
import { animateOnLoad } from './animations'
|
|
15
|
+
|
|
16
|
+
const protect = {
|
|
17
|
+
extend: [Box, Loader],
|
|
18
|
+
class: {
|
|
19
|
+
animation: (el, s) => animateOnLoad(true)
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
position: 'fixed !important',
|
|
23
|
+
left: '0',
|
|
24
|
+
top: '0',
|
|
25
|
+
boxSize: '100% 100%'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
DOM.create(protect)
|
|
30
|
+
|
|
31
|
+
// const callApi = async (state, err, callback) => {
|
|
32
|
+
// try {
|
|
33
|
+
// // const queryCompany = READ_COMPANY()
|
|
34
|
+
// // const waitlistQuery = READ_WAITLIST_USER(state.userData.email)
|
|
35
|
+
// // fetchAuth(state.token, queryCompany, (rdata) => {
|
|
36
|
+
// // const { data } = rdata
|
|
37
|
+
// // if (data.companies) {
|
|
38
|
+
// // state.companyData = data && data.companies
|
|
39
|
+
// // } else {
|
|
40
|
+
// // fetchAuth(state.token, waitlistQuery, (rdata) => {
|
|
41
|
+
// // state.waitlistData = rdata.data
|
|
42
|
+
// // })
|
|
43
|
+
// // }
|
|
44
|
+
// // setCookie('hash', '1', 3)
|
|
45
|
+
// // })
|
|
46
|
+
// setCookie('hash', '1', 3)
|
|
47
|
+
// callback(state)
|
|
48
|
+
// } catch (e) {
|
|
49
|
+
// // Display errors in the console
|
|
50
|
+
// err(e)
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
53
|
+
|
|
54
|
+
const updateState = async (isAuthenticated) => {
|
|
55
|
+
App.state = {
|
|
56
|
+
token: await auth.auth0.getTokenSilently(),
|
|
57
|
+
userData: await auth.auth0.getUser(),
|
|
58
|
+
isAuthenticated
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
setCookie('hash', '1', 3)
|
|
62
|
+
|
|
63
|
+
// const STATE_JSON = state.companyData.state_json
|
|
64
|
+
// const RECEIVED_CONFIG = STATE_JSON ? JSON.parse(STATE_JSON) : {}
|
|
65
|
+
// state.companyState = RECEIVED_CONFIG
|
|
66
|
+
|
|
67
|
+
protect.remove()
|
|
68
|
+
DOM.create(App)
|
|
69
|
+
|
|
70
|
+
// callApi(App.state,
|
|
71
|
+
// e => {
|
|
72
|
+
// window.alert('Something went wrong, please contact support at: support@symbols.app')
|
|
73
|
+
// console.log(e)
|
|
74
|
+
// },
|
|
75
|
+
// state => {
|
|
76
|
+
// const STATE_JSON = state.companyData.state_json
|
|
77
|
+
// const RECEIVED_CONFIG = STATE_JSON ? JSON.parse(STATE_JSON) : {}
|
|
78
|
+
// state.companyState = RECEIVED_CONFIG
|
|
79
|
+
|
|
80
|
+
// protect.remove()
|
|
81
|
+
// DOM.create(App)
|
|
82
|
+
// }
|
|
83
|
+
// )
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
window.onload = async () => {
|
|
87
|
+
const hash = getCookie('hash')
|
|
88
|
+
if (hash) {
|
|
89
|
+
protect.remove()
|
|
90
|
+
DOM.create(App)
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
await configureClient()
|
|
95
|
+
|
|
96
|
+
const isAuthenticated = await auth.auth0.isAuthenticated()
|
|
97
|
+
console.log('isAuthenticated', isAuthenticated)
|
|
98
|
+
if (!isAuthenticated) {
|
|
99
|
+
login()
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
updateState(true)
|
|
103
|
+
|
|
104
|
+
if (isAuthenticated) return
|
|
105
|
+
|
|
106
|
+
const query = window.location.search
|
|
107
|
+
if (query.includes('code=') && query.includes('state=')) {
|
|
108
|
+
await auth.auth0.handleRedirectCallback()
|
|
109
|
+
|
|
110
|
+
updateState(isAuthenticated)
|
|
111
|
+
|
|
112
|
+
window.history.replaceState({}, document.title, '/')
|
|
113
|
+
}
|
|
114
|
+
}
|
package/src/state.js
ADDED
package/src/style.js
ADDED
package/src/test.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import DOM from 'domql'
|
|
4
|
+
import { Button } from '@symbo.ls/components'
|
|
5
|
+
|
|
6
|
+
import './config'
|
|
7
|
+
import './define'
|
|
8
|
+
|
|
9
|
+
document.body.style.padding = '25%'
|
|
10
|
+
document.body.style.color = 'white'
|
|
11
|
+
document.body.style.backgroundColor = 'black'
|
|
12
|
+
|
|
13
|
+
let button = {
|
|
14
|
+
extend: Button,
|
|
15
|
+
theme: 'six',
|
|
16
|
+
text: 'move'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let app = {
|
|
20
|
+
childExtend: {
|
|
21
|
+
childExtend: { extend: button },
|
|
22
|
+
// a: {},
|
|
23
|
+
b: {
|
|
24
|
+
icon: 'right'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
a: {}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
DOM.create(app)
|