@symbo.ls/preview 2.0.7 → 2.6.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.
Files changed (216) hide show
  1. package/{src/pages/Export → .legacy}/_tools_old.js +7 -6
  2. package/.legacy/index copy.js +45 -0
  3. package/{src/pages/Spaces → .legacy}/preview.js +14 -14
  4. package/{src/pages/Spaces → .legacy}/style.js +0 -3
  5. package/.vscode/extensions.json +5 -0
  6. package/index.html +4 -14
  7. package/index.js +44 -0
  8. package/package.json +32 -32
  9. package/src/app.js +30 -68
  10. package/src/assets/dark.png +0 -0
  11. package/src/assets/mask1.png +0 -0
  12. package/src/assets/mask2.png +0 -0
  13. package/src/assets/shapes.png +0 -0
  14. package/src/assets/space.png +0 -0
  15. package/src/assets/type.png +0 -0
  16. package/src/components/Aside.js +101 -0
  17. package/src/components/Banner.js +58 -0
  18. package/src/components/ColorText.js +29 -0
  19. package/src/components/ColorsPalette.js +69 -0
  20. package/src/components/ColumnParagrphs.js +23 -0
  21. package/src/components/ContinueButton.js +14 -0
  22. package/src/components/DesignComponent.js +80 -0
  23. package/src/components/FontText.js +193 -0
  24. package/src/components/Header.js +50 -0
  25. package/src/components/HeaderHeading.js +23 -0
  26. package/src/components/IconsGroup.js +60 -0
  27. package/src/components/Page.js +135 -0
  28. package/src/components/ResponsivePreview.js +44 -0
  29. package/src/components/Route.js +1 -0
  30. package/src/components/ShapePreview.js +63 -0
  31. package/src/components/ShapeSet.js +85 -0
  32. package/src/components/SlidersWithResponsive.js +23 -0
  33. package/src/components/SpacingButton/actionButtons.js +41 -0
  34. package/src/components/SpacingButton/dropdown.js +114 -0
  35. package/src/components/SpacingButton/index.js +248 -0
  36. package/src/components/SpacingButton/props.js +45 -0
  37. package/src/components/SpacingPreview.js +154 -0
  38. package/src/components/SpacingTable.js +210 -0
  39. package/src/components/ThemeButtons.js +42 -0
  40. package/src/components/UploadImage.js +61 -0
  41. package/src/components/Widget.js +1 -0
  42. package/src/components/index.js +25 -0
  43. package/src/config/index.js +12 -31
  44. package/src/config/theme.js +1 -71
  45. package/src/pages/Account/__/index.js +241 -0
  46. package/src/pages/Account/{setUpProject.js → __/setUpProject.js} +10 -10
  47. package/src/pages/Account/index.js +17 -147
  48. package/src/pages/Color/globalThemes.js +30 -0
  49. package/src/pages/Color/index.js +7 -10
  50. package/src/pages/Color/palette.js +35 -0
  51. package/src/pages/Color/themes.js +23 -117
  52. package/src/pages/Components/grid.js +99 -0
  53. package/src/pages/Components/index.js +37 -0
  54. package/src/pages/Components/sidebar.js +28 -0
  55. package/src/pages/Components/style.js +16 -0
  56. package/src/pages/DesignSystem/Dashboard/banners.js +38 -0
  57. package/src/pages/DesignSystem/Dashboard/designElements.js +124 -0
  58. package/src/pages/DesignSystem/Dashboard/index.js +22 -0
  59. package/src/pages/DesignSystem/Dashboard/quickstart.js +86 -0
  60. package/src/pages/DesignSystem/Dashboard/state.js +118 -0
  61. package/src/pages/DesignSystem/Dashboard/summary.js +40 -0
  62. package/src/pages/DesignSystem/index.js +187 -0
  63. package/src/pages/Editor/index.js +7 -9
  64. package/src/pages/Editor/layers.js +14 -14
  65. package/src/pages/Editor/scene.js +7 -9
  66. package/src/pages/Editor/tools.js +22 -22
  67. package/src/pages/Export/const.js +3 -4
  68. package/src/pages/Export/description.js +58 -87
  69. package/src/pages/Export/gist.js +23 -0
  70. package/src/pages/Export/index.js +48 -39
  71. package/src/pages/Export/scene.js +98 -61
  72. package/src/pages/Export/state.js +11 -5
  73. package/src/pages/Export/tools.js +41 -86
  74. package/src/pages/Fonts/fontFaces.js +50 -0
  75. package/src/pages/Fonts/fontFamilies.js +47 -0
  76. package/src/pages/Fonts/index.js +15 -0
  77. package/src/pages/Fonts/state.js +5 -0
  78. package/src/pages/Icons/index.js +73 -69
  79. package/src/pages/Icons/style.js +0 -18
  80. package/src/pages/Init/ChooseEnvironment.js +104 -0
  81. package/src/pages/Init/CreateDocumentTheme.js +166 -0
  82. package/src/pages/Init/CreatePalette.js +72 -0
  83. package/src/pages/Init/FontText.js +23 -0
  84. package/src/pages/Init/Personalize/fields.js +109 -0
  85. package/src/pages/Init/Personalize/icon.js +42 -0
  86. package/src/pages/Init/Personalize/index.js +37 -0
  87. package/src/pages/Init/index.js +36 -0
  88. package/src/pages/Library/disabled.js +38 -0
  89. package/src/pages/Library/index.js +24 -47
  90. package/src/pages/MediaQuery/index.js +46 -0
  91. package/src/pages/MediaQuery/lists.js +285 -0
  92. package/src/pages/MediaQuery/state.js +150 -0
  93. package/src/pages/MediaQuery/typeScale.js +69 -0
  94. package/src/pages/Shapes/index.js +54 -204
  95. package/src/pages/Shapes/shapeSet.js +133 -0
  96. package/src/pages/Shapes/style.js +0 -28
  97. package/src/pages/Spaces/index.js +23 -47
  98. package/src/pages/Spaces/sequence.js +30 -1
  99. package/src/pages/Spaces/state.js +12 -14
  100. package/src/pages/State/index.js +86 -0
  101. package/src/pages/{ColorEditor → Theme}/friendTheme.js +3 -3
  102. package/src/pages/Theme/index.js +197 -0
  103. package/src/pages/{ColorEditor → Theme}/interactivity.js +6 -7
  104. package/src/pages/Theme/preview.js +153 -0
  105. package/src/pages/{ColorEditor → Theme}/style.js +1 -12
  106. package/src/pages/{ColorEditor → Theme}/themingTools.js +12 -12
  107. package/src/pages/Typography/collection.js +110 -0
  108. package/src/pages/Typography/documentStyles.js +125 -0
  109. package/src/pages/Typography/index.js +28 -36
  110. package/src/pages/Typography/rangeButtons.js +58 -0
  111. package/src/pages/Typography/shared.js +2 -3
  112. package/src/pages/Typography/state.js +9 -8
  113. package/src/pages/Typography/stylesHelpers.js +30 -0
  114. package/src/pages/Typography/typeScale.js +63 -82
  115. package/src/pages/index.js +15 -23
  116. package/src/style.js +15 -12
  117. package/svgSprite.config.js +2 -1
  118. package/README.md +0 -19
  119. package/app.webmanifest +0 -4
  120. package/netlify.toml +0 -19
  121. package/protect-pwd.js +0 -65
  122. package/src/animations.js +0 -71
  123. package/src/assets/dots.png +0 -0
  124. package/src/assets/dotsDark.png +0 -0
  125. package/src/data/Symbols.sketch +0 -0
  126. package/src/data/_Symbols.sketch/document.json +0 -1
  127. package/src/data/_Symbols.sketch/fonts/6c9956fc8970ec3d8268c3f286afe19d954fc40b +0 -0
  128. package/src/data/_Symbols.sketch/fonts/750e9b005158d57108ebbcf288e2582f078d6735 +0 -0
  129. package/src/data/_Symbols.sketch/fonts/86c45cb69ad4ba2a8e6d0b81f20964b33f4eca6c +0 -0
  130. package/src/data/_Symbols.sketch/fonts/f97cec7aed309ec77b4fd3005d1a3e0d86c2a7b9 +0 -0
  131. package/src/data/_Symbols.sketch/images/0427bc225ee7dc33db78252defd5b2e4cd5b7467.png +0 -0
  132. package/src/data/_Symbols.sketch/images/0c4846cdd2f11ffb23c9ce063380fc934f7a11ea.png +0 -0
  133. package/src/data/_Symbols.sketch/images/55d3f5e93869fbd70e8dfbca1ce3dfa0cc9f2dbe.png +0 -0
  134. package/src/data/_Symbols.sketch/images/67ae1583a9d77eec7106f5016f48b5594a02b3f6.png +0 -0
  135. package/src/data/_Symbols.sketch/images/7152b3ea22388d53052d0212995a1805527ea862.png +0 -0
  136. package/src/data/_Symbols.sketch/images/72f1896a8462385fd596bc35f240382ba15814fc.png +0 -0
  137. package/src/data/_Symbols.sketch/images/73e4245b1f867343001657193ff2318c9cf2ef53.png +0 -0
  138. package/src/data/_Symbols.sketch/images/7b89dae77676fb4cfd072e0830cff9c27afd11c6.png +0 -0
  139. package/src/data/_Symbols.sketch/images/811e2b516575d3b4e7709dfef6369bce7dae0a26.png +0 -0
  140. package/src/data/_Symbols.sketch/images/82d006789579f2ee1fa45c9116f7cd7dd1bcbe37.png +0 -0
  141. package/src/data/_Symbols.sketch/images/8a896270aa4da8e2401d0ea76e46dc9b9125e59a.png +0 -0
  142. package/src/data/_Symbols.sketch/images/966688c4a579283836f15ab69c8b76e11b236ff5.png +0 -0
  143. package/src/data/_Symbols.sketch/images/b903a498e1d438e8bb12de5422f732c717b79eff.png +0 -0
  144. package/src/data/_Symbols.sketch/images/b9f3cae81a855e21ae75185dcb6ae6551c5447f1.png +0 -0
  145. package/src/data/_Symbols.sketch/images/cd0f908410abf4cad7a4501539eb0711c41a182f.png +0 -0
  146. package/src/data/_Symbols.sketch/images/d54f15f130ba4f1d4ad56f03c01ac06fe0ab4f56.png +0 -0
  147. package/src/data/_Symbols.sketch/images/df5a20029363f95abc58b2c8972e1417d84c8aa7.png +0 -0
  148. package/src/data/_Symbols.sketch/images/e889546970c931244400c2f70412c39123029cb3.png +0 -0
  149. package/src/data/_Symbols.sketch/images/f420a7a2beb15bee5d2ecbba8f296c6d4b22dfa3.png +0 -0
  150. package/src/data/_Symbols.sketch/meta.json +0 -1
  151. package/src/data/_Symbols.sketch/pages/31D11772-FB33-42EC-A3CC-79F63922E04D.json +0 -1
  152. package/src/data/_Symbols.sketch/pages/35BD91AD-F0ED-4002-891D-F1B3250E88C1.json +0 -1
  153. package/src/data/_Symbols.sketch/pages/4831AF31-ECB8-4DA6-B4D0-C1095D42146C.json +0 -1
  154. package/src/data/_Symbols.sketch/pages/6FCC0155-B3F4-4792-892E-523D45315AFD.json +0 -1
  155. package/src/data/_Symbols.sketch/pages/7996D5DD-C5B2-4EE7-9DE8-2C05E2ACA9F3.json +0 -1
  156. package/src/data/_Symbols.sketch/pages/B314C0F3-0038-473F-A127-536AF28E5272.json +0 -1
  157. package/src/data/_Symbols.sketch/pages/B6798E64-F7E9-40F5-9BD0-88A548478438.json +0 -1
  158. package/src/data/_Symbols.sketch/pages/B9B28DF3-EDC2-4D5B-A412-12B3B2E7DE58.json +0 -1
  159. package/src/data/_Symbols.sketch/pages/CA6E47E4-DAF7-4D1D-8DDC-D5A60508D9A0.json +0 -1
  160. package/src/data/_Symbols.sketch/pages/D6F5EB10-9D31-47AC-9077-1CE8CB2C2448.json +0 -1
  161. package/src/data/_Symbols.sketch/previews/preview.png +0 -0
  162. package/src/data/_Symbols.sketch/user.json +0 -1
  163. package/src/data/categories.js +0 -44
  164. package/src/data/components/button-archived/index.js +0 -63
  165. package/src/data/components/button-archived/style.js +0 -5
  166. package/src/data/components/button-circle/index.js +0 -54
  167. package/src/data/components/button-contacts/index.js +0 -56
  168. package/src/data/components/button-contacts/style.js +0 -13
  169. package/src/data/components/button-download/index.js +0 -63
  170. package/src/data/components/button-pro/index.js +0 -98
  171. package/src/data/components/button-pro/style.js +0 -19
  172. package/src/data/components/button-theme-switcher/index.js +0 -104
  173. package/src/data/components/button-theme-switcher/style.js +0 -16
  174. package/src/data/components/button-user/index.js +0 -82
  175. package/src/data/components/button-user/style.js +0 -25
  176. package/src/data/components/datepicker/index.js +0 -40
  177. package/src/data/components/datepicker/style.js +0 -4
  178. package/src/data/components/dropdown-list/index.js +0 -56
  179. package/src/data/components/field/index.js +0 -40
  180. package/src/data/components/index.js +0 -34
  181. package/src/data/components/label/index.js +0 -40
  182. package/src/data/components/notification/index.js +0 -55
  183. package/src/data/components/notification/style.js +0 -20
  184. package/src/data/components/pills/index.js +0 -37
  185. package/src/data/components/tooltip/index.js +0 -38
  186. package/src/data/filters.js +0 -3
  187. package/src/data/index.js +0 -3
  188. package/src/data/library/button-circle/index.js +0 -52
  189. package/src/data/library/button-join/index.js +0 -61
  190. package/src/data/library/family-bundle/index.js +0 -99
  191. package/src/data/library/family-bundle/style.js +0 -27
  192. package/src/data/library/index.js +0 -15
  193. package/src/data/library/join-class/index.js +0 -45
  194. package/src/data/library/parent-mode/index.js +0 -69
  195. package/src/data/library/parent-mode/style.js +0 -25
  196. package/src/index.html +0 -57
  197. package/src/index.js +0 -7
  198. package/src/pages/Color/colors.js +0 -58
  199. package/src/pages/Color/documentThemes.js +0 -101
  200. package/src/pages/Color/style.js +0 -7
  201. package/src/pages/ColorEditor/colorTone.js +0 -163
  202. package/src/pages/ColorEditor/index.js +0 -178
  203. package/src/pages/Export/header.js +0 -37
  204. package/src/pages/Export/style.js +0 -28
  205. package/src/pages/Library/style.js +0 -43
  206. package/src/pages/PageProto.js +0 -26
  207. package/src/pages/Typography/docFonts.js +0 -128
  208. package/src/pages/Typography/docStyles.js +0 -97
  209. package/src/pages/Typography/style.js +0 -11
  210. package/src/protect.js +0 -114
  211. package/src/state.js +0 -3
  212. package/src/test.js +0 -30
  213. package/test/index.test.js +0 -5
  214. /package/{src/pages/Spaces → .legacy}/boxModel.js +0 -0
  215. /package/{src/data/favorites.js → .legacy/sequence.js} +0 -0
  216. /package/src/pages/{ColorEditor → Theme}/ntc.js +0 -0
@@ -1,116 +1,87 @@
1
1
  'use strict'
2
2
 
3
- import { Block, Text, Flex, APITable, CodePreview } from '@symbo.ls/all'
4
-
5
- import { styleArticle } from './style'
6
-
7
- export const description = {
8
- proto: Block,
9
- props: { padding: '0 0 B 0' },
10
- caption: {
11
- proto: [Text, Block],
12
- props: {
13
- text: 'Description',
3
+ // import showdown from 'showdown'
4
+ import { CommonField, Flex, PropertyList } from '@symbo.ls/components'
5
+
6
+ const description = {
7
+ extend: CommonField,
8
+ if: ({ state }) => state.description,
9
+ props: {
10
+ padding: '0 0 B 0',
11
+ caption: {
14
12
  size: 'Z',
15
- padding: '0 0 Y2 0'
13
+ padding: '0 0 Y2 0',
14
+ opacity: 0.5
15
+ },
16
+ p: {
17
+ margin: '0'
16
18
  }
17
19
  },
20
+ caption: {
21
+ text: 'Description'
22
+ },
18
23
  p: {
19
- proto: Text,
20
- props: {
21
- text: 'Kangoroo buttons are button compositions where the original button contain one or more child buttons.'
22
- },
23
- style: { margin: 0 }
24
+ text: ({ state }) => state.description
24
25
  }
25
26
  }
26
27
 
27
- export const readme = {}
28
-
29
- const ALL_PROPS = {
30
- // Shape
31
- shape: 'Name of the shape from the Shapes page',
32
- shapeDirection: 'if the shape is either `tooltip` or `tag`, this field sets the direction of pointing the shape',
33
- depth: 'The level of the shadow that adds depth to the element',
34
- round: 'Rounding the shape - also so called border-radius',
35
- theme: 'Name of the theme which is configured in the Color Themes page',
36
- color: 'Setting the specific text color matching with one from the Color Palette page',
37
- background: 'Setting the specific background color matching with one from the Color Palette page',
38
-
39
- // Block
40
- spacingRatio: 'Ratio of the spacing sequence',
41
- width: 'Width of the element',
42
- height: 'Height of the element',
43
- padding: 'Inner space of the element',
44
- margin: 'Outer space of the element',
45
- gap: 'Space between children inside the element',
46
-
47
- // Flex
48
- flexDirection: '',
49
- alignItems: '',
50
- justifyContent: '',
51
-
52
- // Text
53
- text: 'Text value in the element',
54
- size: 'Text size of the element',
55
-
56
- // Img
57
- src: 'Source path (eg Link) of the image',
58
- alt: 'Alternative text in case image does not load',
59
- title: 'Title when hovering the image',
60
-
61
- // Icon
62
- icon: 'Name of the icon from the Icons page',
63
-
64
- // TextDirection
65
- direction: 'Language direction of the component'
28
+ const readme = {
29
+ extend: CommonField,
30
+ if: ({ state }) => state.readme,
31
+ props: ({ state }) => ({
32
+ padding: '0 0 B 0',
33
+ caption: {
34
+ text: 'README.md',
35
+ size: 'Z',
36
+ opacity: 0.5,
37
+ padding: '0 0 Y2 0'
38
+ },
39
+ p: {
40
+ margin: '0'
41
+ }
42
+ }),
43
+ caption: {},
44
+ cnt: {
45
+ html: ({ state }) => {
46
+ // const converter = new showdown.Converter()
47
+ // return converter.makeHtml(state.readme)
48
+ }
49
+ }
66
50
  }
67
51
 
68
52
  export default {
69
53
  tag: 'article',
70
- style: styleArticle,
71
- proto: Block,
72
54
  props: { padding: 'B2 0' },
73
55
 
74
56
  description,
75
57
 
58
+ readme,
59
+
76
60
  usage: {
77
- proto: [Block, Flex],
61
+ extend: [Flex],
78
62
  props: { gap: 'C1' },
79
63
 
80
64
  table: {
81
- proto: APITable,
82
- style: { flex: 1 },
65
+ props: { flex: 1 },
66
+ extend: PropertyList,
67
+ if: ({ state }) => state.props,
83
68
 
84
- header: {},
85
- properties: {
86
- content: el => {
87
- const props = el.lookup('content').props.defaultProps
88
- const obj = {}
89
- Object.keys(props).map(prop => {
90
- const value = props[prop]
91
- const type = typeof value
92
- const formattedValue = `${JSON.stringify(value)}`
93
- const description = ALL_PROPS[prop]
94
- obj[`_${prop}`] = {
95
- props: { prop, type, formattedValue, description }
96
- }
97
- })
98
- return obj
99
- }
69
+ title: {},
70
+ list: {
71
+ $setStateCollection: ({ state }) => state.props
100
72
  }
101
73
  },
102
74
 
103
75
  code: {
104
- proto: CodePreview,
105
- h4: {},
106
- pre: {
107
- style: {
108
- width: `${270 / 16}em`
109
- },
110
- text: el => {
111
- const props = el.lookup('content').props
112
- return props.code
113
- }
76
+ extend: 'Code',
77
+ props: {
78
+ flex: '0 0 320px',
79
+ margin: '0'
80
+ },
81
+ if: ({ state }) => state.code,
82
+ title: {},
83
+ code: {
84
+ text: ({ state }) => state.code
114
85
  }
115
86
  }
116
87
  }
@@ -0,0 +1,23 @@
1
+ 'use strict'
2
+
3
+ export const fetchGist = (key, state) => {
4
+ window.fetch(`https://api.github.com/gists/${key}`, {
5
+ headers: {
6
+ Authorization: `token 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`
7
+ }
8
+ })
9
+ .then((response) => response.json())
10
+ .then((data) => {
11
+ const { description, files } = data
12
+ const component = files['component.js'].content
13
+ const readme = files['README.md'].content
14
+ const props = files['props.js'] // .content
15
+
16
+ state.update({
17
+ readme,
18
+ component,
19
+ description,
20
+ props
21
+ })
22
+ })
23
+ }
@@ -1,72 +1,81 @@
1
1
  'use strict'
2
2
 
3
- import style from './style'
3
+ import { router, lastLevel } from '@domql/router' // eslint-disable-line no-unused-vars
4
4
 
5
- import router from 'domql-preview/packages/router'
6
- import { Block, Footer, ResponsiveToolBar } from '@symbo.ls/all'
7
- import PageProto from '../PageProto'
5
+ import { Flex } from '@symbo.ls/components'
6
+ import { Page } from '../../components'
8
7
 
9
8
  import state from './state'
10
- import header from './header'
11
9
  import scene from './scene'
12
10
  import tools from './tools'
13
11
  import description from './description'
14
12
 
15
- export default {
16
- key: 'export',
17
- proto: Block,
13
+ import { fetchGist } from './gist'
14
+
15
+ import { COMPONENT_ROUTES } from './const'
18
16
 
19
- style,
17
+ const componentState = (context) => { // eslint-disable-line no-unused-vars
18
+ const arr = [...context.LIBRARY, ...context.COMPONENTS]
19
+ return arr.filter(v => {
20
+ const key = window.location.pathname.split('component/')[1]
21
+ return v.key === key
22
+ })
23
+ }
20
24
 
21
- props: { padding: '0 A 0 A' },
25
+ export const Export = {
26
+ key: 'export',
27
+ extend: Flex,
28
+
29
+ props: {
30
+ width: '100%',
31
+ flow: 'column',
32
+ padding: '0 Y2'
33
+ },
22
34
 
23
35
  state,
24
36
 
25
37
  on: {
26
- init: (el, s) => {
27
- const { LIBRARY } = el.parent.state
28
-
38
+ stateCreated: (element, state) => {
29
39
  const route = window.location.pathname
30
40
  const routes = route.slice(1).split('/')
41
+ const componentKey = routes[1]
42
+ const { COMPONENTS } = state.__system
31
43
 
32
- const ROUTES = {}
33
- const keys = Object.keys(LIBRARY)
34
- keys.map(v => (ROUTES[`/${LIBRARY[v].key}`] = LIBRARY[v]))
44
+ const libComponent = COMPONENT_ROUTES[`/${componentKey}`]
45
+ const liveComponent = COMPONENTS[componentKey]
35
46
 
36
- const content = ROUTES[`/${routes[1]}`]
37
- if (!content) return router(el.lookup('app'), '/components')
38
- el.props = content || {}
39
- if (content.defaultProps.theme) s.theme = content.defaultProps.theme
47
+ const content = libComponent || liveComponent
48
+
49
+ if (content) {
50
+ state.update({
51
+ live: !!liveComponent,
52
+ ...content
53
+ }, { preventUpdate: true })
54
+ }
55
+ if (componentKey.length === 32) { // this might be Gist
56
+ fetchGist(componentKey, state)
57
+ }
58
+
59
+ // if (!content) return router(el.__root, '/components')
40
60
  }
41
61
  },
42
62
 
43
63
  main: {
44
- proto: PageProto,
45
64
  style: { maxWidth: 'none' },
46
-
47
- header,
48
65
  scene
49
66
  },
50
67
 
51
- div: {
52
- proto: [PageProto],
53
-
54
- style: { flex: '1' },
68
+ cnt: {
69
+ extend: [Page],
55
70
 
56
- tools: {
57
- proto: Block,
58
- props: {
59
- padding: 'Z2 0 0 0',
60
- flexAlign: 'center space-between'
61
- },
62
-
63
- tools,
64
-
65
- responsive: { proto: ResponsiveToolBar }
71
+ props: {
72
+ padding: 'Z2 C1 A',
73
+ flex: '1'
66
74
  },
67
75
 
76
+ tools,
68
77
  description
69
- },
78
+ }
70
79
 
71
- footer: { proto: Footer }
80
+ // footer: { extend: Footer }
72
81
  }
@@ -1,55 +1,40 @@
1
1
  'use strict'
2
2
 
3
- import { Text, TYPOGRAPHY, returnSubThemeOrDefault, Scene } from '@symbo.ls/all'
3
+ import DOM from 'domql'
4
+ import { transformEmotionClass, transformEmotionStyle } from 'domql/packages/emotion'
5
+ import { createEmotion } from '@symbo.ls/create-emotion'
6
+ import { updateReset } from '@symbo.ls/init'
7
+ import { isString } from '@domql/utils'
4
8
 
5
- import { COMPONENT_ROUTES } from './const'
9
+ import { getActiveConfig, activateConfig } from '@symbo.ls/scratch'
10
+ import { init, Box, Scene } from '@symbo.ls/components'
6
11
 
7
- const BREAKPOINTS = {
8
- mobile: '375px',
9
- tabletPortrait: '728px',
10
- tabletLandscape: '1024px',
11
- small: '1440px',
12
- big: '1920px',
13
- unset: '100%'
14
- }
12
+ import * as components from '../../components'
13
+
14
+ const emCache = {}
15
15
 
16
16
  export default {
17
- proto: Scene,
18
-
19
- style: {
20
- background: 'rgba(255, 255, 255, .06)',
21
- maxWidth: '100%',
22
- marginLeft: 'auto',
23
- marginRight: 'auto',
24
- transitionDuration: '225ms',
25
- transitionEasing: 'cubic-bezier(.29,.67,.51,.97)',
26
- transitionProperty: 'max-width, background'
27
- },
17
+ extend: Scene,
28
18
 
29
- class: {
30
- s: (el, s) => ({
31
- maxWidth: BREAKPOINTS[s.previewSize]
32
- })
19
+ props: (el, s) => {
20
+ const CONFIG = getActiveConfig()
21
+ const { BREAKPOINTS } = CONFIG
22
+ const previewSize = BREAKPOINTS[s.previewSize]
23
+ return {
24
+ width: '100%',
25
+ maxWidth: previewSize ? previewSize + 'px' : '100%',
26
+ margin: '- auto'
27
+ }
33
28
  },
34
29
 
35
30
  scene: {
36
- style: {
37
- padding: '3em 0',
31
+ props: {
32
+ padding: 'B 0',
38
33
  maxHeight: '40em',
39
34
  minHeight: '65vh'
40
35
  },
41
36
 
42
- define: { routes: param => param },
43
- routes: COMPONENT_ROUTES,
44
-
45
37
  class: {
46
- a: {
47
- '> *': {
48
- transitionDuration: '225ms',
49
- transitionTimingFunction: 'cubic-bezier(.29,.67,.51,.97)',
50
- transitionProperty: 'transform'
51
- }
52
- },
53
38
  z: (el, s) => ({
54
39
  '> *': {
55
40
  transform: `scale(${parseFloat(s.zoomLevel, 2)})`
@@ -57,35 +42,87 @@ export default {
57
42
  })
58
43
  },
59
44
 
60
- content: (el, s) => {
61
- const props = el.lookup('content').props
62
- return {
63
- proto: [props.component, Text],
64
- props: (el, s) => {
65
- const { sequence } = TYPOGRAPHY
66
- const activeSet = Object.keys(sequence).reverse()[s.currentFontSizeIndex]
67
- const theme = returnSubThemeOrDefault(s.theme, s.sceneTheme)
68
-
69
- return {
70
- size: sequence[activeSet].key,
71
- spacingRatio: s.spacingRatio,
72
- theme
73
- }
74
- },
75
- class: {
76
- sceneTransition: {
77
- '&, & *': {
78
- transition: 'all 225ms cubic-bezier(.29,.67,.51,.97)'
45
+ content: {
46
+ props: {
47
+ transition: 'all, B, defaultBezier',
48
+ style: {
49
+ '*': { transition: 'all 255ms cubic-bezier(.29,.67,.51,.97)' }
50
+ }
51
+ },
52
+
53
+ comp: (el, s) => {
54
+ if (s.live) {
55
+ const SYSTEM = s.__system
56
+ const styleNode = document.createElement('head')
57
+ const emotion = createEmotion('client', styleNode)
58
+ emCache['client'] = emotion
59
+
60
+ const emotionStyle = transformEmotionStyle(emotion, true)
61
+ const emotionClass = transformEmotionClass(emotion, true)
62
+
63
+ const newDom = DOM.create({
64
+ tag: 'shadow',
65
+ state: s.state
66
+ }, el.parent.node, 'comp', {
67
+ extend: [Box],
68
+ define: { style: emotionStyle, class: emotionClass },
69
+ components,
70
+ context: { SYSTEM }
71
+ })
72
+
73
+ newDom.node.appendChild(styleNode)
74
+
75
+ init(SYSTEM, null, { emotion, initDOMQLDefine: false, newConfig: 'client' })
76
+ activateConfig('client')
77
+
78
+ newDom.set({
79
+ tag: 'fragment',
80
+ [s.key]: {
81
+ extend: isString(s.component) ? document.eval(s.component) : s.component,
82
+ props: { inheritSpacingRatio: true }
83
+ },
84
+ on: {
85
+ render: (el) => {
86
+ // const appKey = el.__root.state.appKey && el.__root.state.appKey.split('.')[0]
87
+ }
79
88
  }
89
+ })
90
+
91
+ activateConfig(0)
92
+ return newDom
93
+ }
94
+
95
+ return {
96
+ extend: {
97
+ extend: isString(s.component) ? document.eval(s.component) : s.component
98
+ },
99
+ props: { inheritSpacingRatio: true }
100
+ }
101
+ },
102
+
103
+ on: {
104
+ initUpdate: (el, s) => {
105
+ if (s.live) {
106
+ activateConfig('client')
107
+ updateReset({ emotion: emCache['client'] })
108
+ } else {
109
+ el.comp.setProps({
110
+ base: s.base,
111
+ fontSize: s.base + 'px',
112
+ spacingRatio: s.ratio,
113
+ direction: s.direction
114
+ }, { preventUpdate: true })
115
+ updateReset()
80
116
  }
117
+ activateConfig(0)
81
118
  }
82
119
  }
83
- },
120
+ }
121
+ },
84
122
 
85
- on: {
86
- render: (el, s) => {
87
- // el.__root.state.update({ activePage: el.props.title })
88
- }
123
+ on: {
124
+ update: (el, s) => {
125
+ el.__root.node.scrollTo({ top: 0, behavior: 'smooth' })
89
126
  }
90
127
  }
91
128
  }
@@ -1,7 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { SPACING } from '@symbo.ls/all'
4
- import { TYPOGRAPHY_SEQUENCE } from './const'
3
+ import { SPACING, TYPOGRAPHY } from '@symbo.ls/scratch'
5
4
 
6
5
  export default {
7
6
  descriptionTheme: 'dark',
@@ -9,7 +8,14 @@ export default {
9
8
  sceneTheme: 'dark',
10
9
  theme: '',
11
10
  zoomLevel: 1,
12
- sequence: TYPOGRAPHY_SEQUENCE,
13
- spacingRatio: SPACING.ratio,
14
- currentFontSizeIndex: 3
11
+ currentFontSizeIndex: 3,
12
+
13
+ base: TYPOGRAPHY.base,
14
+ ratio: SPACING.ratio,
15
+ range: [-1, +4],
16
+ scales: {},
17
+ sequence: {},
18
+ vars: {},
19
+ type: 'type-scale',
20
+ sampleText: 'Today is a big day for our tribe. The year ends.'
15
21
  }
@@ -1,97 +1,52 @@
1
1
  'use strict'
2
2
 
3
- import { isArray } from 'domql-preview/src/utils'
4
- import { Flex, Block, SEQUENCE, ThemeSwitcher, SliderToolItem } from '@symbo.ls/all'
3
+ import {
4
+ Flex,
5
+ SequenceSliders,
6
+ ClickableItem,
7
+ SquareButton
8
+ } from '@symbo.ls/components'
5
9
 
6
- export const closestNumber = (number, arr) => {
7
- return (isArray(arr) ? arr : Object.values(arr)).reduce((prev, curr) => {
8
- return (Math.abs(curr - number) < Math.abs(prev - number) ? curr : prev)
9
- })
10
- }
11
-
12
- export const FontSizeTool = {
13
- proto: SliderToolItem,
14
- props: (el, s) => ({
15
- type: 'fontSize',
16
- icon: 'fontSize',
10
+ export default {
11
+ props: {
12
+ padding: 'Z2 0 0',
13
+ flexAlign: 'center space-between'
14
+ },
17
15
 
18
- value: s.sequence[s.currentFontSizeIndex],
19
- min: s.sequence[0],
20
- max: s.sequence[Object.keys(s.sequence).length - 1],
16
+ tools: {
17
+ extend: Flex,
18
+ props: { gap: 'B1' },
19
+ // theme: { extend: ThemeSwitcher },
21
20
 
22
- minusClick: (ev, el, s) => {
23
- const { currentFontSizeIndex } = s
24
- const val = currentFontSizeIndex - 1
25
- if (val < 0) return
26
- // el.parent.range.node.value = val
27
- s.update({ currentFontSizeIndex: val })
28
- },
29
- input: (ev, el, s) => {
30
- const { sequence } = s
31
- const value = el.node.value
32
- const findMatch = closestNumber(value, s.sequence)
33
- const seq = isArray(sequence) ? sequence : Object.values(sequence)
34
- s.update({ currentFontSizeIndex: seq.indexOf(findMatch) })
35
- },
36
- plusClick: (ev, el, s) => {
37
- const { currentFontSizeIndex } = s
38
- const val = currentFontSizeIndex + 1
39
- if (val + 1 > Object.keys(s.sequence).length) return
40
- // el.parent.range.node.value = val
41
- s.update({ currentFontSizeIndex: currentFontSizeIndex + 1 })
21
+ sliders: {
22
+ extend: SequenceSliders,
23
+ childExtend: { title: null }
42
24
  }
43
- })
44
- }
45
-
46
- export const SpacingTool = {
47
- proto: SliderToolItem,
48
- if: (el) => el.lookup('content').props.defaultProps && el.lookup('content').props.defaultProps.spacingRatio,
49
- props: (el, s) => ({
50
- type: 'spacing',
51
- icon: 'spaces',
52
- step: '0.001',
53
-
54
- value: s.spacingRatio,
55
- min: SEQUENCE['minor-second'],
56
- max: SEQUENCE['double-octave'],
25
+ },
57
26
 
58
- minusClick: (ev, el, s) => {
59
- const { spacingRatio } = s
60
- const values = Object.values(SEQUENCE)
61
- const activeKey = values.indexOf(spacingRatio) // keys.find(key => SEQUENCE[key] === spacingRatio)
62
- s.update({ spacingRatio: values[activeKey - 1] })
27
+ responsive: {
28
+ extend: Flex,
29
+ props: { gap: 'A2' },
30
+
31
+ direction: {
32
+ extend: [ClickableItem, SquareButton],
33
+ props: {
34
+ icon: 'languageDirection'
35
+ },
36
+ on: {
37
+ click: (ev, el, s) => {
38
+ s.update({
39
+ direction: s.direction === 'rtl' ? 'ltr' : 'rtl'
40
+ })
41
+ }
42
+ }
63
43
  },
64
- input: (ev, el, s) => {
65
- const value = el.node.value
66
- const sequenceValues = Object.values(SEQUENCE)
67
- const findMatch = closestNumber(value, sequenceValues)
68
- s.update({ spacingRatio: findMatch })
44
+
45
+ VerticalLine: {
46
+ margin: 'auto 0',
47
+ height: 'A2'
69
48
  },
70
- plusClick: (ev, el, s) => {
71
- const { spacingRatio } = s
72
- const values = Object.values(SEQUENCE)
73
- const activeKey = values.indexOf(spacingRatio) // keys.find(key => SEQUENCE[key] === spacingRatio)
74
- s.update({ spacingRatio: values[activeKey + 1] })
75
- }
76
- })
77
- }
78
49
 
79
- export default {
80
- proto: [Flex, Block],
81
- props: { gap: 'B1' },
82
- childProto: {
83
- if: ({ props }) => props.value,
84
- style: {
85
- position: 'relative',
86
- zIndex: 999,
87
- '&:hover > section': {
88
- transform: 'translate3d(-50%,0,0)',
89
- opacity: 1,
90
- visibility: 'visible'
91
- }
92
- }
93
- },
94
- theme: { proto: ThemeSwitcher },
95
- fontSize: { proto: FontSizeTool },
96
- spacing: { proto: SpacingTool }
50
+ ResponsiveToolBar: {}
51
+ }
97
52
  }