@symbo.ls/preview 0.0.26 → 0.0.28

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { CATEGORIES } from '../categories'
4
4
 
5
- import { DatePicker } from '@symbo.ls/components'
5
+ import { DatePicker } from 'smbls'
6
6
 
7
7
  import style from './style'
8
8
 
@@ -20,6 +20,13 @@ const component = {
20
20
  style: {
21
21
  backdropFilter: 'blur(3px)',
22
22
  }
23
+ },
24
+ aside: {
25
+ cnt: {
26
+ $setStateCollection: () => {
27
+ return new Array(30).fill(undefined).map((_, i) => (2022 - i)).reverse()
28
+ }
29
+ }
23
30
  }
24
31
  }
25
32
 
package/.symbols/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  'use strict'
2
2
 
3
+ import { deepMerge } from '@domql/utils'
4
+
3
5
  import circleButton from './button-circle'
4
6
  import buttonContacts from './button-contacts'
5
7
  import buttonDownload from './button-download'
@@ -15,9 +17,57 @@ import field from './field'
15
17
  import tooltip from './tooltip'
16
18
  import pills from './pills'
17
19
 
18
- import * as smbls from '@symbo.ls/components/src/Fields'
20
+ import * as smbls from '@symbo.ls/components/src/allImports'
19
21
 
20
- export const LIBRARY = [
22
+ const define = {
23
+ default: {
24
+ settings: {
25
+ gridOptions: { colspan: 3, rowspan: 2 }
26
+ }
27
+ },
28
+ AccessibilityCheck: {
29
+ settings: {
30
+ gridOptions: { colspan: 8, rowspan: 2 }
31
+ }
32
+ },
33
+ Upload: {
34
+ settings: {
35
+ gridOptions: { colspan: 5, rowspan: 2 }
36
+ }
37
+ },
38
+ DeviceButtonSet: {
39
+ settings: {
40
+ gridOptions: { colspan: 6, rowspan: 2 }
41
+ }
42
+ },
43
+ SearchHeader: {
44
+ settings: {
45
+ gridOptions: { colspan: 6, rowspan: 2 }
46
+ }
47
+ },
48
+ CodePreview: {
49
+ settings: {
50
+ gridOptions: { colspan: 4, rowspan: 4 }
51
+ }
52
+ },
53
+ StateDesignElement: {
54
+ settings: {
55
+ gridOptions: { colspan: 3, rowspan: 2 }
56
+ }
57
+ }
58
+ }
59
+
60
+ export const LIBRARY = Object.keys(smbls).map(key => {
61
+ const component = smbls[key]
62
+ const base = define[key] || define.default
63
+ return deepMerge({
64
+ key,
65
+ component: { extend: component },
66
+ code: 'private',
67
+ }, base)
68
+ })
69
+
70
+ export const COMPONENTS = [
21
71
  circleButton,
22
72
  buttonDownload,
23
73
  buttonPro,
@@ -33,15 +83,3 @@ export const LIBRARY = [
33
83
  tooltip,
34
84
  pills
35
85
  ]
36
-
37
- export const COMPONENTS = Object.keys(smbls).map(key => {
38
- const component = smbls[key]
39
- return {
40
- key,
41
- component: { extend: component },
42
- code: JSON.stringify(component, null, 2),
43
- settings: {
44
- gridOptions: { colspan: 3, rowspan: 2 }
45
- }
46
- }
47
- })
@@ -43,3 +43,17 @@ export default {
43
43
  interactivity: [],
44
44
  dataTypes: []
45
45
  }
46
+
47
+ // {
48
+ // "key": "notification",
49
+ // "title": "Symbols notification",
50
+ // "description": ,
51
+ // "category": ,
52
+ // "component": ,
53
+ // "code": ,
54
+ // "defaultState": ,
55
+ // "props": ,
56
+ // "settings": ,
57
+ // "interactivity": [],
58
+ // "dataTypes": []
59
+ // }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@symbo.ls/preview",
3
3
  "description": "",
4
4
  "author": "",
5
- "version": "0.0.26",
5
+ "version": "0.0.28",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
@@ -24,13 +24,15 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@domql/router": "latest",
27
+ "@domql/tags": "^2.2.1",
27
28
  "@symbo.ls/components": "latest",
28
29
  "@symbo.ls/config": "latest",
29
30
  "@symbo.ls/icons": "latest",
30
31
  "@symbo.ls/init": "latest",
31
32
  "@symbo.ls/scratch": "latest",
32
33
  "@symbo.ls/utils": "latest",
33
- "domql": "^1.5.7"
34
+ "domql": "^1.5.7",
35
+ "showdown": "^2.1.0"
34
36
  },
35
37
  "devDependencies": {
36
38
  "@babel/core": "^7.11.5",
@@ -1,33 +1,62 @@
1
1
  'use strict'
2
2
 
3
- import { Flex, PropertyList } from '@symbo.ls/components'
3
+ import showdown from 'showdown'
4
+ import { CommonField, Flex, PropertyList } from '@symbo.ls/components'
4
5
 
5
- import { styleArticle } from './style'
6
-
7
- export const description = {
8
- props: { padding: '0 0 B 0' },
9
- caption: {
10
- props: {
11
- text: 'Description',
6
+ const description = {
7
+ extend: CommonField,
8
+ if: ({ state }) => state.description,
9
+ props: {
10
+ padding: '0 0 B 0',
11
+ caption: {
12
12
  size: 'Z',
13
- padding: '0 0 Y2 0'
13
+ padding: '0 0 Y2 0',
14
+ opacity: 0.5
15
+ },
16
+ p: {
17
+ margin: '0'
14
18
  }
15
19
  },
20
+ caption: {
21
+ text: 'Description'
22
+ },
16
23
  p: {
17
- props: {
18
- text: 'Kangoroo buttons are button compositions where the original button contain one or more child buttons.'
24
+ text: ({ state }) => state.description
25
+ }
26
+ }
27
+
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'
19
38
  },
20
- style: { margin: 0 }
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
+ }
21
49
  }
22
50
  }
23
51
 
24
52
  export default {
25
53
  tag: 'article',
26
- style: styleArticle,
27
54
  props: { padding: 'B2 0' },
28
55
 
29
56
  description,
30
57
 
58
+ readme,
59
+
31
60
  usage: {
32
61
  extend: [Flex],
33
62
  props: { gap: 'C1' },
@@ -0,0 +1,24 @@
1
+ 'use strict'
2
+
3
+ export const fetchGist = (key, state) => {
4
+ console.log(state)
5
+ window.fetch(`https://api.github.com/gists/${key}`, {
6
+ headers: {
7
+ Authorization: `token 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`
8
+ }
9
+ })
10
+ .then((response) => response.json())
11
+ .then((data) => {
12
+ const { description, files } = data
13
+ const component = files['component.js'].content
14
+ const readme = files['README.md'].content
15
+ const props = files['props.js'] // .content
16
+
17
+ state.update({
18
+ readme,
19
+ component,
20
+ description,
21
+ props
22
+ })
23
+ })
24
+ }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { router, lastLevel } from '@domql/router' // eslint-disable-line no-unused-vars
4
4
 
5
- import { ResponsiveToolBar, Flex } from '@symbo.ls/components'
5
+ import { Flex } from '@symbo.ls/components'
6
6
  import { PageExtend } from '../PageExtend'
7
7
 
8
8
  import state from './state'
@@ -10,9 +10,11 @@ import scene from './scene'
10
10
  import tools from './tools'
11
11
  import description from './description'
12
12
 
13
+ import { fetchGist } from './gist'
14
+
13
15
  import { COMPONENT_ROUTES } from './const'
14
16
 
15
- const componentState = (context) => {
17
+ const componentState = (context) => { // eslint-disable-line no-unused-vars
16
18
  const arr = [...context.LIBRARY, ...context.COMPONENTS]
17
19
  return arr.filter(v => {
18
20
  const key = window.location.pathname.split('component/')[1]
@@ -30,18 +32,26 @@ export const Export = {
30
32
  padding: '0 Y2'
31
33
  },
32
34
 
33
- state: ({ context }) => ({
34
- ...componentState(context)[0],
35
- ...state
36
- }),
35
+ state,
37
36
 
38
37
  on: {
39
- init: (el, s) => {
38
+ stateCreated: (element, state) => {
40
39
  const route = window.location.pathname
41
40
  const routes = route.slice(1).split('/')
41
+ const componentKey = routes[1]
42
+
43
+ const content = COMPONENT_ROUTES[`/${componentKey}`]
44
+
45
+ if (content) {
46
+ state.update({
47
+ ...content
48
+ }, { preventUpdate: true })
49
+ }
50
+ if (componentKey.length === 32) { // this might be Gist
51
+ fetchGist(componentKey, state)
52
+ }
42
53
 
43
- const content = COMPONENT_ROUTES[`/${routes[1]}`]
44
- if (!content) return router(el.__root, '/components')
54
+ // if (!content) return router(el.__root, '/components')
45
55
  }
46
56
  },
47
57
 
@@ -66,7 +76,7 @@ export const Export = {
66
76
 
67
77
  tools,
68
78
 
69
- responsive: { extend: ResponsiveToolBar }
79
+ ResponsiveToolBar: {}
70
80
  },
71
81
 
72
82
  description
@@ -1,5 +1,6 @@
1
1
  'use strict'
2
2
 
3
+ import { isString } from '@domql/utils'
3
4
  import { BREAKPOINTS } from '@symbo.ls/scratch'
4
5
  import { Scene } from '@symbo.ls/components'
5
6
  import { updateReset } from '@symbo.ls/init'
@@ -38,8 +39,9 @@ export default {
38
39
  '*': { transition: 'all 255ms cubic-bezier(.29,.67,.51,.97)' }
39
40
  }
40
41
  },
42
+
41
43
  comp: (el, s) => ({
42
- extend: [s.component],
44
+ extend: isString(s.component) ? document.eval(s.component) : s.component,
43
45
  props: { inheritSpacingRatio: true }
44
46
  }),
45
47
 
@@ -1,8 +1,13 @@
1
1
  'use strict'
2
2
 
3
- import { ClickableItem, Grid, Pseudo, WiderButton } from '@symbo.ls/components'
4
-
5
- import { mapSequence, sortSequence } from '@symbo.ls/utils'
3
+ import {
4
+ ClickableItem,
5
+ Grid,
6
+ Pseudo,
7
+ WiderButton,
8
+ mapSequence,
9
+ sortSequence
10
+ } from '@symbo.ls/components'
6
11
 
7
12
  const Buttons = {
8
13
  childExtend: {
@@ -16,11 +16,6 @@ import { friendTheme } from './friendTheme'
16
16
 
17
17
  import style, { styleLabel } from './style'
18
18
 
19
- // import ntc from './ntc'
20
-
21
- // const returnColor = element => element.lookup('ColorEditor').state.color
22
- // const setBackground = (element, opacity = 1) => `background: ${opacify(returnColor(element), opacity)}`
23
-
24
19
  const nameTheTheme = {
25
20
  tag: 'label',
26
21
  style: styleLabel,
@@ -11,6 +11,9 @@ import {
11
11
  } from '@symbo.ls/components'
12
12
  import stylesHelpers from './stylesHelpers'
13
13
 
14
+ import { HTML_TAGS } from '@domql/tags'
15
+ console.log(HTML_TAGS)
16
+
14
17
  export default {
15
18
  header: {
16
19
  extend: SectionHeader,
@@ -30,6 +33,12 @@ export default {
30
33
  header: {
31
34
  width: '100%',
32
35
  align: 'center space-between'
36
+ },
37
+ headings: {
38
+ width: '100%'
39
+ },
40
+ doc: {
41
+ width: '100%'
33
42
  }
34
43
  },
35
44
 
@@ -41,6 +50,7 @@ export default {
41
50
 
42
51
  headings: {
43
52
  extend: DocumentStylesSequence,
53
+
44
54
  $setStateCollection: (el) => {
45
55
  const { state, context } = el // eslint-disable-line no-unused-vars
46
56
  const { TYPOGRAPHY, FONT_FAMILY } = context.SYSTEM
@@ -13,7 +13,7 @@ export default {
13
13
  title: 'Helpers',
14
14
  p: 'Document styling and theming provides global themes of the entire app, imagine it as a <body> styling',
15
15
  nav: [{
16
- href: '/typography/document-style',
16
+ href: '/typography/add-style',
17
17
  icon: 'plus'
18
18
  }]
19
19
  }
@@ -2,26 +2,26 @@
2
2
 
3
3
  import {
4
4
  TypeScaleSequence,
5
- Grid,
6
5
  TestText,
7
- Flex
6
+ Flex,
7
+ mapSequence,
8
+ sortSequence
8
9
  } from '@symbo.ls/components'
9
10
 
10
- import { mapSequence, sortSequence } from '@symbo.ls/utils'
11
11
  import { range0Buttons, range1Buttons } from './rangeButtons'
12
12
 
13
13
  export default {
14
- extend: Grid,
14
+ extend: Flex,
15
15
 
16
16
  props: {
17
17
  gap: 'D',
18
- columns: '16em auto',
19
18
  align: 'flex-start flex-start',
20
19
 
21
20
  sidebar: {
22
21
  padding: 'B 0 0',
22
+ width: 'F2',
23
23
  position: 'sticky',
24
- top: 'E2'
24
+ top: 'E'
25
25
  },
26
26
 
27
27
  content: {
@@ -1,21 +0,0 @@
1
- 'use strict'
2
-
3
- export const styleArticle = {
4
- caption: {
5
- // textTransform: 'capitalize',
6
- opacity: '.35'
7
- },
8
-
9
- p: {
10
- maxWidth: `${470 / 14}em`,
11
- opacity: '.75',
12
- lineHeight: '20px'
13
- },
14
-
15
- code: {
16
- overflow: 'hidden'
17
- }
18
- }
19
-
20
- export const styleHeader = {
21
- }