@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,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Grid, ColorSwitcher, CommonField, SelectTool, ButtonSet, ClickableItem } from '@symbo.ls/all'
3
+ import { Grid, ColorSwitcher, CommonField, SelectField, ButtonSet, ClickableItem } from '@symbo.ls/components'
4
4
 
5
5
 
6
6
  ColorSwitcher.props = (el, s) => {
@@ -14,7 +14,7 @@ ColorSwitcher.props = (el, s) => {
14
14
  }
15
15
 
16
16
  export const themingTools = {
17
- proto: Grid,
17
+ extend: Grid,
18
18
  style: {
19
19
  width: 'fit-content'
20
20
  },
@@ -23,8 +23,8 @@ export const themingTools = {
23
23
  columnGap: 'C',
24
24
  rowGap: 'C'
25
25
  },
26
- childProto: {
27
- proto: CommonField,
26
+ childExtend: {
27
+ extend: CommonField,
28
28
  props: { padding: 0 },
29
29
  caption: { text: el => el.parent.props.caption },
30
30
  element: {}
@@ -33,7 +33,7 @@ export const themingTools = {
33
33
  props: { caption: 'Background color' },
34
34
  caption: {},
35
35
  element: {
36
- proto: ColorSwitcher,
36
+ extend: ColorSwitcher,
37
37
  props: { type: 'background' },
38
38
 
39
39
  title: {},
@@ -46,7 +46,7 @@ export const themingTools = {
46
46
  props: { caption: 'Text color' },
47
47
  caption: {},
48
48
  element: {
49
- proto: ColorSwitcher,
49
+ extend: ColorSwitcher,
50
50
  props: { type: 'color' },
51
51
 
52
52
  title: {},
@@ -59,7 +59,7 @@ export const themingTools = {
59
59
  props: { caption: 'Border color' },
60
60
  caption: {},
61
61
  element: {
62
- proto: ColorSwitcher,
62
+ extend: ColorSwitcher,
63
63
  props: { type: 'border' },
64
64
 
65
65
  title: {},
@@ -72,7 +72,7 @@ export const themingTools = {
72
72
  props: { caption: 'Use as' },
73
73
  caption: {},
74
74
  element: {
75
- proto: SelectTool,
75
+ extend: SelectField,
76
76
  title: { props: { text: 'Background color' } },
77
77
  buttons: { ...[{ props: { icon: 'arrowAngleMirroringVertical', theme: 'transparent' } }] }
78
78
  }
@@ -82,8 +82,8 @@ export const themingTools = {
82
82
  props: { caption: 'Border' },
83
83
  caption: {},
84
84
  element: {
85
- proto: ButtonSet,
86
- childProto: { proto: [ClickableItem] },
85
+ extend: ButtonSet,
86
+ childExtend: { extend: [ClickableItem] },
87
87
  props: { gap: 'Z' },
88
88
  ...[
89
89
  { props: { icon: 'colorsColored' } },
@@ -98,8 +98,8 @@ export const themingTools = {
98
98
  props: { caption: 'Shadow' },
99
99
  caption: {},
100
100
  element: {
101
- proto: ButtonSet,
102
- childProto: { proto: [ClickableItem] },
101
+ extend: ButtonSet,
102
+ childExtend: { extend: [ClickableItem] },
103
103
  ...[{ props: { icon: 'plus' } }]
104
104
  }
105
105
  }
@@ -0,0 +1,110 @@
1
+ 'use strict'
2
+
3
+ import {
4
+ findHeadingLetter,
5
+ getFontFamily
6
+ } from '@symbo.ls/scratch'
7
+ import { HTML_TAGS } from '@domql/tags'
8
+
9
+ const propertyDefaults = {
10
+ fontSize: 'A',
11
+ fontWeight: '400',
12
+ lineHeight: '1.4',
13
+ letterSpacing: '0',
14
+ italic: '0',
15
+ letterWidth: '0'
16
+ }
17
+
18
+ const iconMap = {
19
+ font: 'fontFace',
20
+ fontWeight: 'fontVariable',
21
+ lineHeight: 'textLineHeight',
22
+ letterSpacing: 'textLetterSpacing',
23
+ italic: 'fontStyleItalic',
24
+ letterWidth: 'textLetterWidth'
25
+ }
26
+
27
+ const getTypeProp = (key, prop, library, defaultValue) => {
28
+ const { TYPOGRAPHY } = library
29
+ const { styles } = TYPOGRAPHY
30
+ if (!styles[key]) styles[key] = {}
31
+ return styles[key][prop] ||
32
+ styles[prop] ||
33
+ TYPOGRAPHY[prop] ||
34
+ defaultValue ||
35
+ propertyDefaults[prop]
36
+ }
37
+
38
+ const getTypeStyle = (key, library) => ({
39
+ font: getFontFamily(key, library.FONT_FAMILY)[0],
40
+ fontSize: getTypeProp(key, 'fontSize', library),
41
+ fontWeight: getTypeProp(key, 'fontWeight', library),
42
+ lineHeight: getTypeProp(key, 'lineHeight', library),
43
+ letterSpacing: getTypeProp(key, 'letterSpacing', library),
44
+ italic: getTypeProp(key, 'italic', library),
45
+ letterWidth: getTypeProp(key, 'letterWidth', library)
46
+ })
47
+
48
+ const isHeading = v => v.length === 2 && v[0] === 'h'
49
+ const isTag = v => HTML_TAGS.root.indexOf(v) > -1 || HTML_TAGS.body.indexOf(v) > -1
50
+ const isHelper = v => v.slice(0, 1) === '.'
51
+
52
+ const getCollectionFromArray = (arr, s) => {
53
+ const { __system } = s
54
+ const { TYPOGRAPHY } = __system
55
+ const { styles } = TYPOGRAPHY
56
+ return arr.map((v, k) => {
57
+ const result = getTypeStyle(v, __system)
58
+ return {
59
+ key: v,
60
+ value: {
61
+ ...result,
62
+ ...styles[v]
63
+ },
64
+ labels: Object.keys(result)
65
+ .filter(key => key !== 'fontSize' && result[key] && result[key] !== '0')
66
+ .map(key => ({
67
+ icon: iconMap[key],
68
+ text: result[key]
69
+ })
70
+ ),
71
+ sequenceValue: s.sequence[
72
+ isHeading(v) ? findHeadingLetter(s.h1Matches, k) : result.fontSize
73
+ ]
74
+ }
75
+ })
76
+ }
77
+
78
+ export const headingsCollection = (el, s) => {
79
+ el.removeContent()
80
+ const HEADINGS = new Array(6).fill(null).map((_, i) => 'h' + (i + 1))
81
+ return getCollectionFromArray(HEADINGS, s)
82
+ }
83
+
84
+ export const tagsCollection = (el, s) => {
85
+ const { __system } = s
86
+ const { TYPOGRAPHY } = __system
87
+ const { styles } = TYPOGRAPHY
88
+ if (!styles.body) styles.body = {}
89
+ el.removeContent()
90
+
91
+ const TAGS = Object.keys(styles)
92
+ .filter(v => {
93
+ return isTag(v) && !isHeading(v) && !isHelper(v)
94
+ })
95
+
96
+ return getCollectionFromArray(TAGS, s)
97
+ }
98
+
99
+ export const helpersCollection = (el, s) => {
100
+ const { __system } = s
101
+ const { TYPOGRAPHY } = __system
102
+ const { styles } = TYPOGRAPHY
103
+
104
+ const HELPERS = Object.keys(styles)
105
+ .filter(v => v.slice(0, 1) === '.')
106
+
107
+ el.removeContent()
108
+
109
+ return getCollectionFromArray(HELPERS, s)
110
+ }
@@ -0,0 +1,125 @@
1
+ 'use strict'
2
+
3
+ import {
4
+ DocumentStylesSequence,
5
+ Flex,
6
+ SelectField,
7
+ HTMLTagTypeObject
8
+ } from '@symbo.ls/components'
9
+
10
+ import { headingsCollection, tagsCollection } from './collection'
11
+
12
+ export default {
13
+ SectionHeader: {
14
+ title: 'Document Styles',
15
+ p: 'Document styling and theming provides global themes of the entire app, imagine it as a :root styling'
16
+ },
17
+
18
+ styles: {
19
+ extend: Flex,
20
+
21
+ props: {
22
+ flow: 'column',
23
+ gap: 'C',
24
+ align: 'flex-start flex-start',
25
+ header: {
26
+ width: '100%',
27
+ align: 'center space-between'
28
+ },
29
+ headings: {
30
+ width: '100%'
31
+ },
32
+ doc: {
33
+ width: '100%'
34
+ }
35
+ },
36
+
37
+ headings: {
38
+ extend: DocumentStylesSequence,
39
+ $setStateCollection: headingsCollection
40
+ },
41
+
42
+ doc: {
43
+ extend: DocumentStylesSequence,
44
+ $setStateCollection: tagsCollection
45
+ },
46
+
47
+ footer: {}
48
+ },
49
+
50
+ fields: {
51
+ extend: Flex,
52
+ props: {
53
+ gap: 'A',
54
+ margin: '0 0 0 E2+B',
55
+ align: 'center flex-start'
56
+ },
57
+
58
+ tags: {
59
+ extend: Flex,
60
+ props: { gap: 'A' },
61
+ childExtend: HTMLTagTypeObject,
62
+
63
+ p: {
64
+ props: {
65
+ title: {
66
+ text: '<p>'
67
+ }
68
+ }
69
+ },
70
+ code: {
71
+ props: {
72
+ title: {
73
+ text: '<code>'
74
+ }
75
+ }
76
+ },
77
+ pre: {
78
+ props: {
79
+ title: {
80
+ text: '<pre>'
81
+ }
82
+ }
83
+ }
84
+ },
85
+
86
+ VerticalLine: {
87
+ height: 'B',
88
+ margin: '0 Z1'
89
+ },
90
+
91
+ IconButton: {
92
+ theme: 'quinary',
93
+ position: 'relative',
94
+ icon: 'plus'
95
+ },
96
+
97
+ addsomething: {
98
+ extend: SelectField,
99
+ props: {
100
+ position: 'relative',
101
+ title: {
102
+ text: 'Choose element'
103
+ }
104
+ },
105
+ title: {},
106
+ buttons: [{
107
+ props: { icon: 'plus' }
108
+ }, {
109
+ props: { icon: 'arrowAngleMirroringVertical' }
110
+ }]
111
+ }
112
+ },
113
+
114
+ on: {
115
+ init: (el, s) => {
116
+ if (!s.__system) return
117
+ const { __system } = s
118
+ const { TYPOGRAPHY } = __system
119
+ const { styles } = TYPOGRAPHY
120
+ if (styles) {
121
+ s.update({ styles }, { preventUpdate: true })
122
+ } else TYPOGRAPHY.styles = {}
123
+ }
124
+ }
125
+ }
@@ -1,52 +1,44 @@
1
1
  'use strict'
2
2
 
3
- import PageProto from '../PageProto'
4
-
5
- import { Link, TabHeader } from '@symbo.ls/all'
6
-
7
- import style from './style'
8
3
  import state from './state'
9
4
 
10
- import documentFonts from './docFonts'
11
- import documentStyle from './docStyles'
12
5
  import typeScale from './typeScale'
6
+ import documentStyles from './documentStyles'
7
+ import stylesHelpers from './stylesHelpers'
8
+ import { mapSequence, sortSequence } from '@symbo.ls/components'
13
9
 
14
- export default {
15
- proto: PageProto,
10
+ export const Typography = {
11
+ state,
16
12
 
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
- }
13
+ SectionHeader: {
14
+ margin: '0 0 C',
15
+ title: 'Typography',
16
+ p: 'A general configuration of type properties on the document.'
23
17
  },
24
18
 
25
- define: { routes: param => param },
19
+ SlidersWithResponsive: {},
26
20
 
27
- style,
28
- state,
21
+ line: { extend: 'Line' },
29
22
 
30
- routes: {
31
- 'document-fonts': documentFonts,
32
- 'type-scale': typeScale,
33
- 'document-styles': documentStyle
34
- },
23
+ documentStyles,
24
+ line1: { extend: 'Line' },
25
+
26
+ stylesHelpers,
27
+ line2: { extend: 'Line' },
35
28
 
36
- header: {
37
- proto: TabHeader,
38
- style: {
39
- paddingLeft: '2em'
29
+ typeScale,
30
+
31
+ on: {
32
+ init: (el, s) => {
33
+ if (!s.__system.TYPOGRAPHY) {
34
+ s.systemUpdate({
35
+ TYPOGRAPHY: { base: s.base, ratio: s.ratio }
36
+ })
37
+ }
38
+ mapSequence(s, sortSequence)
40
39
  },
41
- tabs: {
42
- childProto: { proto: [Link] },
43
- 'document-fonts': { props: { text: 'Document Fonts' } },
44
- 'type-scale': { props: { text: 'Type Scale' } },
45
- 'document-styles': { props: { text: 'Document Styles' } }
40
+ stateUpdated: (el, s, changes) => {
41
+ s.systemUpdate({ TYPOGRAPHY: changes })
46
42
  }
47
- },
48
-
49
- page: {
50
- content: (el, s) => ({ proto: el.parent.routes[s.activeTab] })
51
43
  }
52
44
  }
@@ -0,0 +1,58 @@
1
+ 'use strict'
2
+
3
+ import { IncDecButtons } from '@symbo.ls/components'
4
+
5
+ export const range0Buttons = {
6
+ extend: IncDecButtons,
7
+
8
+ ...[{
9
+ on: {
10
+ click: (ev, el) => {
11
+ const { state } = el
12
+ const { range } = state
13
+ if (range[0] < 0) {
14
+ ++range[0]
15
+ state.update()
16
+ }
17
+ }
18
+ }
19
+ }, {
20
+ on: {
21
+ click: (ev, el) => {
22
+ const { state } = el
23
+ const { range } = state
24
+ if (range[0] - 1 > -6) {
25
+ --range[0]
26
+ state.update()
27
+ }
28
+ }
29
+ }
30
+ }]
31
+ }
32
+
33
+ export const range1Buttons = {
34
+ extend: IncDecButtons,
35
+ ...[{
36
+ on: {
37
+ click: (ev, el) => {
38
+ const { state } = el
39
+ const { range } = state
40
+ if (range[1] - 1 > 5) {
41
+ --range[1]
42
+ state.update()
43
+ }
44
+ }
45
+ }
46
+ }, {
47
+ on: {
48
+ click: (ev, el) => {
49
+ const { state } = el
50
+ const { range } = state
51
+ if (range[1] + 1 < 21) {
52
+ ++range[1]
53
+ state.update()
54
+ }
55
+ }
56
+ }
57
+ }]
58
+ }
@@ -1,10 +1,9 @@
1
1
  'use strict'
2
2
 
3
- import { SectionHeader } from '@symbo.ls/all'
3
+ import { SectionHeader } from '@symbo.ls/components'
4
4
 
5
5
  export const TypeSection = {
6
6
  header: {
7
- proto: SectionHeader,
8
- heading: { caption: null }
7
+ extend: SectionHeader
9
8
  }
10
9
  }
@@ -1,15 +1,16 @@
1
1
  'use strict'
2
2
 
3
- export default {
4
- base: 14,
3
+ export default ({ parent }) => ({
4
+ base: 16,
5
5
  ratio: 1.125,
6
- scales: {},
7
- range: [-3, +10],
6
+ range: [-3, +8],
8
7
  h1Matches: +6,
8
+ scales: {},
9
9
  sequence: {},
10
- type: 'font-size',
10
+ vars: {},
11
+ // subSequence: true,
12
+ type: 'demo-font-size',
11
13
 
12
14
  sampleText: 'Today is a big day for our tribe. The year ends.',
13
- activePage: 'typography',
14
- activeTab: 'documentFonts'
15
- }
15
+ activeTab: ''
16
+ })
@@ -0,0 +1,30 @@
1
+ 'use strict'
2
+
3
+ import {
4
+ Grid,
5
+ SectionHeader,
6
+ TypeHelperObject
7
+ } from '@symbo.ls/components'
8
+ import { helpersCollection } from './collection'
9
+
10
+ export default {
11
+ header: {
12
+ extend: SectionHeader,
13
+ state: {
14
+ title: 'Helpers',
15
+ p: 'Document styling and theming provides global themes of the entire app, imagine it as a <body> styling',
16
+ nav: [{
17
+ href: '/typography/add-style',
18
+ icon: 'plus'
19
+ }]
20
+ }
21
+ },
22
+
23
+ content: {
24
+ extend: Grid,
25
+ props: { columns: 'repeat(3, 1fr)' },
26
+
27
+ childExtend: TypeHelperObject,
28
+ $setStateCollection: helpersCollection
29
+ }
30
+ }
@@ -1,104 +1,85 @@
1
1
  'use strict'
2
2
 
3
- import { styleTypeScale } from './style'
4
-
5
3
  import {
6
- Flex, Block, Text, Grid,
7
- SequenceGraph,
8
- SliderToolWithCaption,
9
- StaticSpacing,
10
- PreviewSettings,
11
- ScalesSequence,
12
- CommonField
13
- } from '@symbo.ls/all'
4
+ TypeScaleSequence,
5
+ TestText,
6
+ Flex,
7
+ Grid,
8
+ mapSequence,
9
+ sortSequence
10
+ } from '@symbo.ls/components'
14
11
 
15
- import { TypeSection } from './shared'
12
+ import { range0Buttons, range1Buttons } from './rangeButtons'
16
13
 
17
- const ScalingTools = {
18
- proto: Flex,
14
+ export default {
15
+ extend: Grid,
19
16
 
20
17
  props: {
21
- flow: 'column',
22
- gap: 'A2'
23
- },
18
+ gap: 'D',
19
+ templateColumns: 'var(--spacing-F2) 1fr',
20
+
21
+ sidebar: {
22
+ padding: 'B 0 0',
23
+ widthRange: 'F2',
24
+ position: 'sticky',
25
+ top: 'E'
26
+ },
24
27
 
25
- fontSize: {
26
- proto: [SliderToolWithCaption],
27
- caption: { text: 'Base size' },
28
- element: {
29
- style: {
30
- maxWidth: `${232 / 16}em`
31
- }
32
- }
33
- },
28
+ content: {
29
+ overflow: 'hidden',
30
+ flex: '1',
31
+ flow: 'column',
32
+ gap: 'C',
34
33
 
35
- sequence: {
36
- proto: CommonField,
37
- caption: { text: 'Sequence ratio' },
38
- element: {
39
- proto: StaticSpacing,
40
- spacings: {
41
- childProto: {
42
- on: {
43
- click: (ev, el, s) => s.update({ ratio: el.value.text })
44
- }
45
- }
34
+ header: {
35
+ align: 'flex-end space-between',
36
+ padding: '0 0 0 C',
37
+ gap: 'C1'
38
+ },
39
+
40
+ footer: {
41
+ padding: '0 0 0 C'
46
42
  }
47
43
  }
48
- }
49
- }
44
+ },
50
45
 
51
- export default {
52
- style: styleTypeScale,
53
- proto: TypeSection,
46
+ sidebar: {
47
+ SectionHeader: {
48
+ title: 'TypeScale',
49
+ p: 'Generate text sequence by a base size and ratio'
50
+ },
54
51
 
55
- header: {
56
- heading: {
57
- p: { props: { text: 'Generate text sequence by a base size and ratio' } }
52
+ SequenceSliders: {
53
+ flow: 'column'
58
54
  },
59
- nav: {
60
- add: { props: { icon: 'plus' } }
55
+
56
+ Paragraph: {
57
+ margin: '0',
58
+ fontSize: 'Z2',
59
+ padding: 'B2 0',
60
+ text: `Base size and ratio sequentially generate set by multiplying each next calculated unit by the ratio.`
61
61
  }
62
62
  },
63
63
 
64
- wrapper: {
65
- textTest: '',
66
- fonts: '',
67
-
68
- cnt: {
69
- proto: [Block, Grid],
70
-
71
- props: {
72
- gap: 'D',
73
- columns: '16em auto'
74
- },
75
-
76
- aside: ScalingTools,
64
+ content: {
65
+ extend: Flex,
77
66
 
78
- wrapper: {
79
- settings: {
80
- proto: PreviewSettings,
81
- props: { margin: '0 0 B' }
82
- },
83
-
84
- fonts: ScalesSequence
85
- },
67
+ header: {
68
+ extend: Flex,
69
+ range0Buttons,
70
+ TestText
71
+ },
86
72
 
87
- sequenceSet: {
88
- proto: CommonField,
89
- props: { margin: 'C2 0' },
90
- caption: {
91
- proto: [Block, Text],
92
- props: {
93
- text: 'Sizing generated by this setting',
94
- padding: '0 0 A 0'
95
- }
96
- },
97
- element: {
98
- proto: [SequenceGraph, Block, Text],
99
- style: { '> span': { display: 'none' } }
100
- }
73
+ sequence: {
74
+ extend: TypeScaleSequence,
75
+ $setStateCollection: (el) => {
76
+ const { state } = el
77
+ state.sequence = {}
78
+ el.removeContent()
79
+ return mapSequence(state, sortSequence)
101
80
  }
102
- }
81
+ },
82
+
83
+ footer: { range1Buttons }
103
84
  }
104
85
  }