Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.

SymbolsProvide for React #19

Open
wants to merge 951 commits into
base: feature/symbols-provider
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
951 commits
Select commit Hold shift + click to select a range
fca3978
0.7.35
nikoloza Oct 22, 2022
15a3202
added socket
nikoloza Oct 23, 2022
292f5f6
0.15.41
nikoloza Oct 23, 2022
bf252de
fixed state case props
nikoloza Oct 25, 2022
3dd2c3f
0.15.42
nikoloza Oct 25, 2022
04cd9c2
cleanuo
nikoloza Oct 25, 2022
564ff4e
1.1.9
nikoloza Oct 25, 2022
cc49e95
multicreation
nikoloza Oct 25, 2022
3dd0935
0.7.36
nikoloza Oct 25, 2022
f4993e7
fixed button flex align
nikoloza Oct 26, 2022
88784a9
0.15.43
nikoloza Oct 26, 2022
291460f
fixed dropdown
nikoloza Oct 27, 2022
3b95c04
0.15.44
nikoloza Oct 27, 2022
ed63394
added form iframe
nikoloza Oct 28, 2022
7182571
0.15.45
nikoloza Oct 28, 2022
f5b4f71
fixed interactives
nikoloza Oct 29, 2022
146fdf1
0.15.46
nikoloza Oct 29, 2022
969ae8d
fixed tooltip
nikoloza Oct 30, 2022
2111c0b
0.15.47
nikoloza Oct 30, 2022
64509b1
tooltip
nikoloza Oct 30, 2022
c661589
0.15.48
nikoloza Oct 30, 2022
c46279c
added domql utils
nikoloza Oct 30, 2022
586169d
0.7.37
nikoloza Oct 30, 2022
5c871a8
added focusable to input
nikoloza Oct 30, 2022
845d8ca
0.15.49
nikoloza Oct 30, 2022
dbdc94a
User props updates
nikoloza Oct 30, 2022
6725e7d
0.15.50
nikoloza Oct 30, 2022
2944db3
fixed build
nikoloza Oct 31, 2022
b3e99a8
0.9.9
nikoloza Oct 31, 2022
eadfb22
added peerDeps
nikoloza Oct 31, 2022
72b88cb
0.9.10
nikoloza Oct 31, 2022
d90fc1d
0.7.38
nikoloza Nov 1, 2022
1de680f
2.5.5
nikoloza Nov 1, 2022
2ff4026
2.6.0
nikoloza Nov 1, 2022
1458dc8
updated main
nikoloza Nov 1, 2022
494f3be
login screens
nikoloza Nov 1, 2022
d03af6d
2.6.1
nikoloza Nov 1, 2022
8b1b3da
removed logs, added input attrs
nikoloza Nov 1, 2022
c404a6a
2.6.1
nikoloza Nov 1, 2022
c1c0974
fixed gap
nikoloza Nov 2, 2022
1a1fb99
2.6.1
nikoloza Nov 2, 2022
50c24cb
Merge branch 'main' of github.com:symbo-ls/symbols
nikoloza Nov 2, 2022
13a0fd6
2.6.2
nikoloza Nov 2, 2022
c54b147
2.6.3
nikoloza Nov 2, 2022
b29b6b5
new merge from platform
nikoloza Nov 2, 2022
c451196
new merge from platform
nikoloza Nov 2, 2022
3463173
new merge from platform
nikoloza Nov 2, 2022
5b7857f
2.6.1
nikoloza Nov 2, 2022
9d84690
2.6.1
nikoloza Nov 2, 2022
f8478dc
2.6.1
nikoloza Nov 2, 2022
0941ae3
2.6.2
nikoloza Nov 2, 2022
1000496
version bump
nikoloza Nov 2, 2022
50ba20d
version bump
nikoloza Nov 2, 2022
9205260
version bump
nikoloza Nov 2, 2022
5076b81
version bump
nikoloza Nov 2, 2022
16faa38
version bump
nikoloza Nov 2, 2022
0f7aff5
2.6.4
nikoloza Nov 2, 2022
e41fe0d
2.6.4
nikoloza Nov 2, 2022
0dc7fd2
2.6.4
nikoloza Nov 2, 2022
8e91b32
2.6.4
nikoloza Nov 2, 2022
7a4dbaf
2.6.4
nikoloza Nov 2, 2022
a918f86
__system update
nikoloza Nov 2, 2022
23c673d
2.6.5
nikoloza Nov 2, 2022
3f3f1a4
__system errors fixed
nikoloza Nov 2, 2022
44233bd
2.6.6
nikoloza Nov 2, 2022
ec208f5
no argument for init
nikoloza Nov 2, 2022
cc93ad8
2.6.5
nikoloza Nov 2, 2022
9bf4cb2
2.6.5
nikoloza Nov 2, 2022
7a532a8
2.6.5
nikoloza Nov 2, 2022
4dbd305
2.6.5
nikoloza Nov 2, 2022
e68087c
2.6.7
nikoloza Nov 2, 2022
9a1ed84
new initialization configs
nikoloza Nov 3, 2022
b91de5a
new initialization configs
nikoloza Nov 3, 2022
4e6e7b0
new initialization configs
nikoloza Nov 3, 2022
99b055f
2.6.6
nikoloza Nov 3, 2022
087f247
2.6.6
nikoloza Nov 3, 2022
15c0f1e
2.6.7
nikoloza Nov 3, 2022
e0279e5
2.6.8
nikoloza Nov 3, 2022
56be332
2.6.9
nikoloza Nov 3, 2022
f7a9144
2.6.10
nikoloza Nov 3, 2022
612aaee
2.6.7
nikoloza Nov 3, 2022
11f73a6
2.6.6
nikoloza Nov 3, 2022
c30f757
2.6.6
nikoloza Nov 3, 2022
572bfcc
2.6.8
nikoloza Nov 3, 2022
3ab5420
updated deps
nikoloza Nov 3, 2022
f16034b
0.9.11
nikoloza Nov 3, 2022
2489d1f
2.6.7
nikoloza Nov 3, 2022
9205959
temp disabled css-in-props
nikoloza Nov 3, 2022
c076e02
2.6.8
nikoloza Nov 3, 2022
605b5d5
gap fix
nikoloza Nov 3, 2022
7206187
2.6.9
nikoloza Nov 3, 2022
1d08e92
2.6.7
nikoloza Nov 11, 2022
3009189
2.6.8
nikoloza Nov 11, 2022
f1a4e21
passing option args
nikoloza Nov 13, 2022
86d8bfa
2.6.9
nikoloza Nov 13, 2022
f69a85b
diffing vars and reset
nikoloza Nov 13, 2022
df1dadf
2.6.9
nikoloza Nov 13, 2022
1da44a8
added new colors and themes
nikoloza Nov 13, 2022
e51ab60
2.6.8
nikoloza Nov 13, 2022
63a81d2
cleaning init
nikoloza Nov 13, 2022
6d858b4
2.6.10
nikoloza Nov 13, 2022
bfe64cc
theming updates fixed
nikoloza Nov 13, 2022
21e152e
2.6.10
nikoloza Nov 13, 2022
b80f1c0
added optional id attr
nikoloza Nov 13, 2022
23f595d
2.6.10
nikoloza Nov 13, 2022
a7e0be1
added textarea
nikoloza Nov 15, 2022
3bc9737
2.6.11
nikoloza Nov 15, 2022
3d59b19
2.6.11
nikoloza Nov 15, 2022
bbaadb3
Merge branch 'main' of github.com:symbo-ls/smbls
nikoloza Nov 15, 2022
e4864ab
added grid props
nikoloza Nov 15, 2022
dc4b3c6
2.6.11
nikoloza Nov 15, 2022
a26c9ab
2.6.12
nikoloza Nov 15, 2022
97e3e3a
2.6.12
nikoloza Nov 15, 2022
5d78d3e
cleanup
nikoloza Nov 15, 2022
e5c30ed
2.6.9
nikoloza Nov 15, 2022
bd88b17
2.6.9
nikoloza Nov 15, 2022
204202e
Merge branch 'main' of github.com:symbo-ls/config-default
nikoloza Nov 15, 2022
9b1e9b8
2.6.11
nikoloza Nov 16, 2022
5755bf3
2.6.10
nikoloza Nov 16, 2022
2b5c0da
2.6.11
nikoloza Nov 16, 2022
1a4d206
2.6.13
nikoloza Nov 16, 2022
db5523a
2.6.13
nikoloza Nov 16, 2022
2cbbad4
2.7.0
nikoloza Nov 16, 2022
86fc5d3
2.7.2
nikoloza Nov 16, 2022
1f08afa
2.7.5
nikoloza Nov 16, 2022
0941af4
2.7.5
nikoloza Nov 16, 2022
7cf27b6
2.7.5
nikoloza Nov 16, 2022
2d8b235
2.7.5
nikoloza Nov 16, 2022
ce2f491
2.7.5
nikoloza Nov 16, 2022
8b73002
added grid options
nikoloza Nov 17, 2022
4c3f2d6
2.7.6
nikoloza Nov 17, 2022
4b491c4
input props fix
nikoloza Nov 17, 2022
1d6e2c3
2.7.7
nikoloza Nov 17, 2022
4e30f0e
collection to smbls
nikoloza Nov 26, 2022
6d83f37
collection to smbls
nikoloza Nov 26, 2022
60ee744
2.7.8
nikoloza Nov 26, 2022
de11fd0
2.7.9
nikoloza Nov 27, 2022
f0eb4c5
2.7.10
nikoloza Nov 27, 2022
857a424
new preview
nikoloza Dec 15, 2022
eec6d60
2.7.6
nikoloza Dec 15, 2022
fe45d97
link array fix
nikoloza Dec 19, 2022
d75475a
2.7.11
nikoloza Dec 19, 2022
1be080d
export registry as registry
Nikaoto Jan 6, 2023
d4190ea
0.10.0
Nikaoto Jan 6, 2023
cbc25dc
range and user fix
nikoloza Jan 10, 2023
a5c4800
2.7.12
nikoloza Jan 10, 2023
c161b2a
update emotion to version 11.10.5
Nikaoto Jan 12, 2023
21160cd
0.10.1
Nikaoto Jan 12, 2023
1fddd40
yarn add @emotion/css
Nikaoto Jan 12, 2023
d2babaa
0.10.2
Nikaoto Jan 12, 2023
7655a43
added css-in-props
nikoloza Jan 18, 2023
236c8c3
Merge branch 'css-in-props' into feature/v2
nikoloza Jan 18, 2023
a8ecfe2
added css-in-props
nikoloza Jan 18, 2023
e5bc44f
moved uikit in separate packages
nikoloza Jan 18, 2023
189bb96
added cli
nikoloza Jan 18, 2023
c03b749
added cli
nikoloza Jan 18, 2023
85d6112
Merge branch 'cli' into feature/v2
nikoloza Jan 18, 2023
c9babce
added scratch
nikoloza Jan 18, 2023
ac0b789
added scratch
nikoloza Jan 18, 2023
6669827
Merge branch 'scratch' into feature/v2
nikoloza Jan 18, 2023
34290cf
added init
nikoloza Jan 18, 2023
11719b4
Merge branch 'init' into feature/v2
nikoloza Jan 18, 2023
8fe3142
added config-default
nikoloza Jan 18, 2023
0ad2ff4
Merge branch 'config-default' into feature/v2
nikoloza Jan 18, 2023
23530b9
added client sync
nikoloza Jan 18, 2023
3a1228e
add packages, and uikit
nikoloza Jan 18, 2023
3fabc29
cleanup
nikoloza Jan 18, 2023
c68eb91
added box readme
nikoloza Jan 18, 2023
7c649b0
entry files
nikoloza Jan 18, 2023
63144b3
rmved smbols, cleanup
nikoloza Jan 18, 2023
aa83062
fixed lerna pkges
nikoloza Jan 18, 2023
9ea91a9
cleanup
nikoloza Jan 18, 2023
0945f57
Update README.md
nikoloza Jan 18, 2023
0783be8
cleanup
nikoloza Jan 21, 2023
34cbfae
fixed emotion import
nikoloza Jan 22, 2023
990c32e
2.7.13
nikoloza Jan 22, 2023
56a3e02
prepach
nikoloza Jan 30, 2023
699af19
2.7.14-0
nikoloza Jan 30, 2023
c27d1c1
2.7.14
nikoloza Jan 31, 2023
9fba72c
changed pkg name
nikoloza Jan 31, 2023
8295f12
2.7.15
nikoloza Jan 31, 2023
fec7fe5
fixed animaiton export
nikoloza Jan 31, 2023
ca9cd0b
2.7.16
nikoloza Jan 31, 2023
03532e2
fixed pkgs
nikoloza Jan 31, 2023
2794ca5
2.7.16
nikoloza Jan 31, 2023
e102161
2.7.17
nikoloza Jan 31, 2023
5e71381
removed private: false
nikoloza Jan 31, 2023
b349c17
fixed SVG
nikoloza Jan 31, 2023
eaddc34
2.7.18
nikoloza Jan 31, 2023
74c6be0
polish packages
nikoloza Feb 1, 2023
bcab8a0
restructured
nikoloza Feb 2, 2023
e67ecb7
fixed pkgs
nikoloza Feb 2, 2023
0f15b2e
v1.1.1
nikoloza Feb 2, 2023
769d39a
v1.2.0
nikoloza Feb 2, 2023
59f4f35
fixing pkgs
nikoloza Feb 2, 2023
50dff1b
v1.2.1
nikoloza Feb 2, 2023
8d0658a
fixing pkgs
nikoloza Feb 2, 2023
5471601
v1.2.2
nikoloza Feb 2, 2023
7b65c5c
fixing avatar component
nikoloza Feb 2, 2023
86470da
v1.2.3
nikoloza Feb 2, 2023
a66393c
added collection
nikoloza Feb 2, 2023
a689b4a
v1.2.4
nikoloza Feb 2, 2023
8f97205
v1.2.5
nikoloza Feb 2, 2023
4668f75
fixed some dependencies
nikoloza Feb 2, 2023
00afcd5
v1.2.6
nikoloza Feb 2, 2023
cf6202a
Merge branch 'main' into feature/v2
nikoloza Feb 2, 2023
231c73b
Merge pull request #31 from symbo-ls/feature/v2
nikoloza Feb 2, 2023
39db46e
package clean
nikoloza Feb 2, 2023
597e4b7
v1.2.7
nikoloza Feb 2, 2023
68b7667
fixed avatar imports
nikoloza Feb 2, 2023
eac1f54
v1.2.8
nikoloza Feb 2, 2023
fbdc7d0
fixed linting errors
nikoloza Feb 2, 2023
fdcbbb3
fixed linting errors
nikoloza Feb 2, 2023
d593291
v1.2.9
nikoloza Feb 2, 2023
6737a1b
cleanup
nikoloza Feb 2, 2023
08a437f
removed unnssr peerdeps
nikoloza Feb 2, 2023
28f5cda
v1.2.10
nikoloza Feb 2, 2023
62486dd
updated uikit version
nikoloza Feb 3, 2023
42d8e1d
fixed avatar
nikoloza Feb 3, 2023
904eea8
v1.2.11
nikoloza Feb 3, 2023
daf8dc5
updated pkg
nikoloza Feb 5, 2023
f4abd30
v1.2.12
nikoloza Feb 5, 2023
8fda2aa
v1.2.13
nikoloza Feb 7, 2023
29a0e20
change components name
nikoloza Feb 8, 2023
bd3632a
change components name
nikoloza Feb 8, 2023
8334735
svg updates
nikoloza Feb 13, 2023
9103c49
v1.2.14
nikoloza Feb 13, 2023
7e1c82a
fixed atoms dependenct
nikoloza Feb 13, 2023
9bf0563
v1.2.15
nikoloza Feb 13, 2023
593380b
updated all dependencies
nikoloza Feb 13, 2023
d438e16
cleaning dependencies
nikoloza Feb 13, 2023
bc1518b
v1.2.16
nikoloza Feb 13, 2023
7f09257
added eslint script
nikoloza Feb 13, 2023
99b30c2
new lock
nikoloza Feb 13, 2023
4129a36
v1.2.17
nikoloza Feb 13, 2023
ae2b16e
removed logs
nikoloza Feb 13, 2023
cb2fba3
removed logs
nikoloza Feb 13, 2023
69b9a68
v1.2.18
nikoloza Feb 13, 2023
9b18860
cleaning
nikoloza Feb 13, 2023
e4a8395
v1.2.19
nikoloza Feb 13, 2023
e61bbeb
import init inside
nikoloza Feb 15, 2023
b63f1fe
v1.2.20
nikoloza Feb 15, 2023
4b2a5ca
added packages support
nikoloza Feb 15, 2023
87c6ab2
v1.2.21
nikoloza Feb 16, 2023
08b4ab9
v1.2.22
nikoloza Feb 16, 2023
d7348d7
cleanup collections
nikoloza Feb 16, 2023
ca14e14
v1.2.23
nikoloza Feb 16, 2023
279019e
fixed react-box
nikoloza Feb 19, 2023
ae83b5d
v1.2.24
nikoloza Feb 19, 2023
a3c42f1
Update README.md
nikoloza Feb 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
"presets": [
["@babel/preset-env"]
]
}
3 changes: 0 additions & 3 deletions .babelrc.json

This file was deleted.

7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,3 @@ node_modules
.parcel-cache
dist
*.DS_Store

.DS_Store

yarn.lock
.DS_Store

# packages/react
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

36 changes: 5 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,12 @@
# Symbols

UI Library in composition of [Scratch](https://github.com/symbo.ls/scratch) and [DOMQL](https://github.com/symbo.ls/domql) or [React](https://github.com/symbo-ls/smbls/tree/main/packages/all/react.js)
This repository is merged into https://github.com/symbo-ls/smbls

Check out the [documentation page](https://docs.symbols.app/).

[![npm version](https://badge.fury.io/js/smbls.svg)](https://badge.fury.io/js/smbls)

### UI Components

Library consists with packages. Components can be invoked individually.
---


### Setup
UI Library in composition of [Scratch](https://github.com/symbo.ls/scratch) and [DOMQL](https://github.com/symbo.ls/domql)

1. Installation
```
yarn add 'smbls'
```

2. Import the component from Symbols
```
import { Box } from 'smbls'
```

3. Use it inside your DOMQL code
### DOMQL
```javascript
const Header = {
extends: Box,
// ...Other Properties
}
```
Check out the [documentation page](https://docs.symbols.app/).

### React
```javascript
<Box {...props} />
```
[![npm version](https://badge.fury.io/js/smbls.svg)](https://badge.fury.io/js/smbls)
52 changes: 52 additions & 0 deletions components/Atoms/Animation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
'use strict'

import { getTimingByKey, getTimingFunction } from '@symbo.ls/scratch'
import { isObject } from '@domql/utils'
import { emotion } from '@symbo.ls/create-emotion'
const { keyframes } = emotion

const applyAnimationProps = (animation, element) => {
if (isObject(animation)) return { animationName: keyframes(animation) }
const { ANIMATION } = element.context && element.context.system
const record = ANIMATION[animation]
return keyframes(record)
}

export const Animation = {
class: {
animation: (el) => el.props.animation && {
animationName: applyAnimationProps(el.props.animation, el),
animationDuration: getTimingByKey(el.props.animationDuration || 'A').timing,
animationDelay: getTimingByKey(el.props.animationDelay || '0s').timing,
animationTimingFunction: getTimingFunction(el.props.animationTimingFunction || 'ease'),
animationFillMode: el.props.animationFillMode || 'both',
animationPlayState: el.props.animationPlayState,
animationDirection: el.props.animationDirection
},
animationName: (el) => el.props.animationName && {
animationName: applyAnimationProps(el.props.animationName, el)
},

animationDuration: ({ props }) => props.animationDuration && ({
animationDuration: getTimingByKey(props.animationDuration).timing
}),
animationDelay: ({ props }) => props.animationDelay && ({
animationDelay: getTimingByKey(props.animationDelay).timing
}),
animationTimingFunction: ({ props }) => props.animationTimingFunction && ({
animationTimingFunction: getTimingFunction(props.animationTimingFunction)
}),
animationFillMode: ({ props }) => props.animationFillMode && ({
animationFillMode: props.animationFillMode
}),
animationPlayState: ({ props }) => props.animationPlayState && ({
animationPlayState: props.animationPlayState
}),
animationIterationCount: ({ props }) => props.animationIterationCount && ({
animationIterationCount: props.animationIterationCount || 1
}),
animationDirection: ({ props }) => props.animationDirection && ({
animationDirection: props.animationDirection
})
}
}
151 changes: 151 additions & 0 deletions components/Atoms/Block.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
'use strict'

import { getSpacingBasedOnRatio, getSpacingByKey, isString } from '@symbo.ls/scratch'

const transfromGap = gap => isString(gap) && ({
gap: gap.split(' ').map(v => getSpacingByKey(v, 'gap').gap).join(' ')
})

export const Block = {
class: {
boxSizing: ({ props }) => props.boxSizing ? ({ boxSizing: props.boxSizing }) : {
boxSizing: 'border-box'
},

display: ({ props }) => props.display && ({ display: props.display }),

hide: ({ props }) => props.hide && ({ display: 'none' }),

width: ({ props }) => props.width && getSpacingBasedOnRatio(props, 'width'),
height: ({ props }) => props.height && getSpacingBasedOnRatio(props, 'height'),
boxSize: ({ props }) => {
if (typeof props.boxSize !== 'string') return
const [height, width] = props.boxSize.split(' ')
return {
...getSpacingByKey(height, 'height'),
...getSpacingByKey(width || height, 'width')
}
},

maxWidth: ({ props }) => props.maxWidth && getSpacingBasedOnRatio(props, 'maxWidth'),
minWidth: ({ props }) => props.minWidth && getSpacingBasedOnRatio(props, 'minWidth'),
widthRange: ({ props }) => {
if (typeof props.widthRange !== 'string') return
const [minWidth, maxWidth] = props.widthRange.split(' ')
return {
...getSpacingByKey(minWidth, 'minWidth'),
...getSpacingByKey(maxWidth || minWidth, 'maxWidth')
}
},

maxHeight: ({ props }) => props.maxHeight && getSpacingBasedOnRatio(props, 'maxHeight'),
minHeight: ({ props }) => props.minHeight && getSpacingBasedOnRatio(props, 'minHeight'),
heightRange: ({ props }) => {
if (typeof props.heightRange !== 'string') return
const [minHeight, maxHeight] = props.heightRange.split(' ')
return {
...getSpacingByKey(minHeight, 'minHeight'),
...getSpacingByKey(maxHeight || minHeight, 'maxHeight')
}
},

direction: ({ props }) => props.direction && ({ direction: props.direction }),

aspectRatio: ({ props }) => props.aspectRatio && ({ aspectRatio: props.aspectRatio }),

borderWidth: ({ props }) => props.borderWidth ? getSpacingBasedOnRatio(props, 'borderWidth') : null,

padding: ({ props }) => props.padding ? getSpacingBasedOnRatio(props, 'padding') : null,
paddingInline: ({ props }) => {
if (typeof props.paddingInline !== 'string') return
const [paddingInlineStart, paddingInlineEnd] = props.paddingInline.split(' ')
return {
...getSpacingByKey(paddingInlineStart, 'paddingInlineStart'),
...getSpacingByKey(paddingInlineEnd || paddingInlineStart, 'paddingInlineEnd')
}
},
paddingBlock: ({ props }) => {
if (typeof props.paddingBlock !== 'string') return
const [paddingBlockStart, paddingBlockEnd] = props.paddingBlock.split(' ')
return {
...getSpacingByKey(paddingBlockStart, 'paddingBlockStart'),
...getSpacingByKey(paddingBlockEnd || paddingBlockStart, 'paddingBlockEnd')
}
},
paddingInlineStart: ({ props }) => props.paddingInlineStart ? getSpacingBasedOnRatio(props, 'paddingInlineStart') : null,
paddingInlineEnd: ({ props }) => props.paddingInlineEnd ? getSpacingBasedOnRatio(props, 'paddingInlineEnd') : null,
paddingBlockStart: ({ props }) => props.paddingBlockStart ? getSpacingBasedOnRatio(props, 'paddingBlockStart') : null,
paddingBlockEnd: ({ props }) => props.paddingBlockEnd ? getSpacingBasedOnRatio(props, 'paddingBlockEnd') : null,

margin: ({ props }) => props.margin ? getSpacingBasedOnRatio(props, 'margin') : null,
marginInline: ({ props }) => {
if (typeof props.marginInline !== 'string') return
const [marginInlineStart, marginInlineEnd] = props.marginInline.split(' ')
return {
...getSpacingByKey(marginInlineStart, 'marginInlineStart'),
...getSpacingByKey(marginInlineEnd || marginInlineStart, 'marginInlineEnd')
}
},
marginBlock: ({ props }) => {
if (typeof props.marginBlock !== 'string') return
const [marginBlockStart, marginBlockEnd] = props.marginBlock.split(' ')
return {
...getSpacingByKey(marginBlockStart, 'marginBlockStart'),
...getSpacingByKey(marginBlockEnd || marginBlockStart, 'marginBlockEnd')
}
},
marginInlineStart: ({ props }) => props.marginInlineStart ? getSpacingBasedOnRatio(props, 'marginInlineStart') : null,
marginInlineEnd: ({ props }) => props.marginInlineEnd ? getSpacingBasedOnRatio(props, 'marginInlineEnd') : null,
marginBlockStart: ({ props }) => props.marginBlockStart ? getSpacingBasedOnRatio(props, 'marginBlockStart') : null,
marginBlockEnd: ({ props }) => props.marginBlockEnd ? getSpacingBasedOnRatio(props, 'marginBlockEnd') : null,

gap: ({ props }) => props.gap ? transfromGap(props.gap) : null,
gridArea: ({ props }) => props.gridArea && ({ gridArea: props.gridArea }),

flex: ({ props }) => props.flex && ({ flex: props.flex }),
flexDirection: ({ props }) => props.flexDirection && ({ flexDirection: props.flexDirection }),
alignItems: ({ props }) => props.alignItems && ({ alignItems: props.alignItems }),
alignContent: ({ props }) => props.alignContent && ({ alignContent: props.alignContent }),
justifyContent: ({ props }) => props.justifyContent && ({ justifyContent: props.justifyContent }),
justifyItems: ({ props }) => props.justifyItems && ({ justifyItems: props.justifyItems }),
alignSelf: ({ props }) => props.alignSelf && ({ alignSelf: props.alignSelf }),
order: ({ props }) => props.order && ({ order: props.order }),

flexWrap: ({ props }) => props.flexWrap && ({
display: 'flex',
flexFlow: props.flexWrap
}),
flexFlow: ({ props }) => props.flexFlow && ({
display: 'flex',
flexFlow: props.flexFlow
}),
flexAlign: ({ props }) => {
if (typeof props.flexAlign !== 'string') return
const [alignItems, justifyContent] = props.flexAlign.split(' ')
return {
display: 'flex',
alignItems: alignItems,
justifyContent: justifyContent
}
},

gridColumn: ({ props }) => props.gridColumn && ({ gridColumn: props.gridColumn }),
gridColumnStart: ({ props }) => props.columnStart ? ({ gridColumnStart: props.columnStart }) : null,
gridRow: ({ props }) => props.gridRow && ({ gridRow: props.gridRow }),
gridRowStart: ({ props }) => props.rowStart ? ({ gridRowStart: props.rowStart }) : null,

size: ({ props }) => {
if (typeof props.heightRange !== 'string') return
const [minHeight, maxHeight] = props.heightRange.split(' ')
return {
...getSpacingByKey(minHeight, 'minHeight'),
...getSpacingByKey(maxHeight || minHeight, 'maxHeight')
}
},

columns: ({ props }) => props.columns && ({ columns: props.columns })
}
}

export const Span = { tag: 'span' }
// export const Article = { tag: 'article' }
82 changes: 82 additions & 0 deletions components/Atoms/Collection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
'use strict'

import { isNot, isArray, isObject, isObjectLike, diff, deepClone } from '@domql/utils'

export const Collection = {
define: {
$setCollection: (param, el, state) => {
if (!param) return

let data = isArray(param) ? param : []

if (isObject(param)) {
for (const obj in param) { data.push(param[obj]) }
}

data = data.map(item => !isObjectLike(item) ? {
props: { value: item }
} : item)

if (data.length) {
const t = setTimeout(() => {
el.set({ tag: 'fragment', ...data }, { preventDefineUpdate: '$setCollection' })
clearTimeout(t)
})
}

return data
},

$setStateCollection: (param, el, state) => {
if (!param) return
if (param.parse) param = param.parse()
if (isNot(param)('array', 'object')) return

if (el.key === 'cnt') {
if (el.__ref.__stateCollectionCache) {
const d = diff(param, el.__ref.__stateCollectionCache) // eslint-disable-line
} else {
el.__ref.__stateCollectionCache = deepClone(param)
}
}

const obj = { tag: 'fragment' }

for (const key in param) {
const value = param[key]
obj[key] = { state: isObjectLike(value) ? value : { value } }
}

const set = () => {
el.set(obj, { preventDefineUpdate: '$setStateCollection' })
}

if (el.props.lazyLoad) {
window.requestAnimationFrame(set)
} else set()

return obj
},

$setPropsCollection: (param, el, state) => {
if (!param) return
if (isNot(param)('array', 'object')) return

const obj = { tag: 'fragment' }
for (const key in param) {
const value = param[key]
obj[key] = { props: isObjectLike(value) ? value : { value } }
}

const set = () => {
el.set(obj, { preventDefineUpdate: '$setStateCollection' })
}

if (el.props.lazyLoad) {
window.requestAnimationFrame(set)
} else set()

return obj
}
}
}
17 changes: 17 additions & 0 deletions components/Atoms/Flex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict'

export const Flex = {
props: {
display: 'flex'
},

class: {
flow: ({ props }) => props.flow && ({ flexFlow: props.flow }),
wrap: ({ props }) => props.wrap && ({ flexWrap: props.wrap }),
align: ({ props }) => {
if (typeof props.align !== 'string') return
const [alignItems, justifyContent] = props.align.split(' ')
return { alignItems, justifyContent }
}
}
}
11 changes: 11 additions & 0 deletions components/Atoms/Form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict'

export const Form = {
tag: 'form',
props: {},
attr: {
action: ({ props }) => props.action,
method: ({ props }) => props.method,
enctype: ({ props }) => props.enctype
}
}
Loading