@zuzjs/ui 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui.js +20 -6
- package/package.json +3 -2
- package/src/comps/box.tsx +0 -24
- package/src/comps/button.tsx +0 -23
- package/src/comps/crumb.tsx +0 -9
- package/src/comps/form.tsx +0 -58
- package/src/comps/heading.tsx +0 -25
- package/src/comps/icon.tsx +0 -24
- package/src/comps/input.tsx +0 -24
- package/src/comps/select.tsx +0 -23
- package/src/comps/spinner.tsx +0 -24
- package/src/comps/stylesheet.tsx +0 -5
- package/src/context/AppContext.tsx +0 -3
- package/src/context/AppProvider.tsx +0 -69
- package/src/context/createSlice.tsx +0 -16
- package/src/context/index.tsx +0 -5
- package/src/core/css.ts +0 -1
- package/src/core/index.tsx +0 -241
- package/src/core/styles.ts +0 -379
- package/src/hooks/index.tsx +0 -2
- package/src/hooks/useDispatch.tsx +0 -37
- package/src/hooks/useStore.tsx +0 -25
- package/src/hooks.tsx +0 -8
- package/src/scss/mixins.scss +0 -3
- package/src/scss/props.scss +0 -92
- package/src/scss/styles.scss +0 -103
- package/src/ui.tsx +0 -13
package/dist/ui.js
CHANGED
|
@@ -4,6 +4,7 @@ import Cookies from 'js-cookie';
|
|
|
4
4
|
import axios from 'axios';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
import { forwardRef } from 'react';
|
|
7
|
+
import Link from 'next/link';
|
|
7
8
|
import Children from 'react-children-utilities';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
10
|
|
|
@@ -582,6 +583,24 @@ const Heading = forwardRef((props, ref) => {
|
|
|
582
583
|
return jsx(HeadingTag, Object.assign({ className: _styles }, cleanProps(props), { children: props.html ? jsx("span", { dangerouslySetInnerHTML: { __html: props.html } }) : props.children }));
|
|
583
584
|
});
|
|
584
585
|
|
|
586
|
+
const Icon = forwardRef((props, ref) => {
|
|
587
|
+
const _styles = withStyle(Object.assign(Object.assign({}, props), { as: `icon-${props.as}`, size: props.size || 16 }));
|
|
588
|
+
return jsx("span", Object.assign({ ref: props.ref || ref, className: _styles }, cleanProps(props), { children: props.html ? jsx("span", { dangerouslySetInnerHTML: { __html: props.html } }) : props.children }));
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
function Crumb({ items, size }) {
|
|
592
|
+
const list = [];
|
|
593
|
+
{
|
|
594
|
+
items.map((n, i) => {
|
|
595
|
+
const h = jsx(Heading, { flex: true, size: size || 24, children: n.label }, `hc-${i}-${n.label.replace(/\s/g, '-')}`);
|
|
596
|
+
list.push(n.href ? jsx(Link, { href: n.href, className: `tdn tdnh`, children: h }, `crumb-${i}-${n.label.replace(/\s/g, '-')}`) : h);
|
|
597
|
+
if (i < items.length - 1)
|
|
598
|
+
list.push(jsx(Icon, { as: `chevron_right`, size: size || 24 }, `chev-${i}-${n.label.replace(/\s/g, '-')}`));
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
return (jsx(Box, { flex: true, aic: true, gap: 15, children: list }));
|
|
602
|
+
}
|
|
603
|
+
|
|
585
604
|
const Input = forwardRef((props, ref) => {
|
|
586
605
|
let Tag = props.tag || 'input';
|
|
587
606
|
const El = Tag;
|
|
@@ -639,11 +658,6 @@ const Form = (props) => {
|
|
|
639
658
|
}, children: jsx(Box, Object.assign({}, _props, { children: props.children })) });
|
|
640
659
|
};
|
|
641
660
|
|
|
642
|
-
const Icon = forwardRef((props, ref) => {
|
|
643
|
-
const _styles = withStyle(Object.assign(Object.assign({}, props), { as: `icon-${props.as}`, size: props.size || 16 }));
|
|
644
|
-
return jsx("span", Object.assign({ ref: props.ref || ref, className: _styles }, cleanProps(props), { children: props.html ? jsx("span", { dangerouslySetInnerHTML: { __html: props.html } }) : props.children }));
|
|
645
|
-
});
|
|
646
|
-
|
|
647
661
|
const Spinner = (props) => {
|
|
648
662
|
const { size, w, h, color, radius, anim } = props;
|
|
649
663
|
return jsx(Box, { w: size || 50, rel: true, zIndex: `1`, userSelect: `none`, h: size || 50, as: `zuz-spinner`, anim: (anim || 2).toString(), flex: true, aic: true, jcc: true, children: jsx(Box, { as: `zuz-loader`, r: radius || 4, w: w || 30, h: h || 6, bg: color || `#111` }) });
|
|
@@ -662,4 +676,4 @@ const Select = forwardRef((props, ref) => {
|
|
|
662
676
|
return jsx("select", Object.assign({ className: _styles }, cleanProps(props), { onChange: e => { props.onChange && props.onChange(e); }, children: props.options && props.options.map(o => jsx("option", { value: o.value, children: o.label }, `${props.id || props.as || props.name}-option-${o.value}`)) }));
|
|
663
677
|
});
|
|
664
678
|
|
|
665
|
-
export { Box, Button, Form, Heading, Icon, Input, Select, Spinner, Stylesheet, buildCSS, buildFormData, cleanProps, formatBytes, formatSeconds, getCookie, getStylesheet, isEmail, makeCSSValue, removeCookie, setCookie, uuid, withRest, withStyle };
|
|
679
|
+
export { Box, Button, Crumb, Form, Heading, Icon, Input, Select, Spinner, Stylesheet, buildCSS, buildFormData, cleanProps, formatBytes, formatSeconds, getCookie, getStylesheet, isEmail, makeCSSValue, removeCookie, setCookie, uuid, withRest, withStyle };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuzjs/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"rollup-plugin-scss": "^4.0.0",
|
|
41
41
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
42
42
|
"rollup-plugin-uglify": "^6.0.4",
|
|
43
|
-
"sass": "^1.69.5"
|
|
43
|
+
"sass": "^1.69.5",
|
|
44
|
+
"next": "14.0.4"
|
|
44
45
|
}
|
|
45
46
|
}
|
package/src/comps/box.tsx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
forwardRef
|
|
3
|
-
} from "react";
|
|
4
|
-
import {
|
|
5
|
-
cleanProps,
|
|
6
|
-
withStyle,
|
|
7
|
-
getStylesheet
|
|
8
|
-
} from "../core";
|
|
9
|
-
|
|
10
|
-
const Box = forwardRef(( props: { [ key: string ] : any }, ref) => {
|
|
11
|
-
|
|
12
|
-
const _styles = withStyle(props)
|
|
13
|
-
|
|
14
|
-
return <div
|
|
15
|
-
ref={props.ref || ref}
|
|
16
|
-
className={_styles}
|
|
17
|
-
{ ...cleanProps(props) }>
|
|
18
|
-
{props.html ? <span dangerouslySetInnerHTML={{ __html: props.html }} /> : props.children}
|
|
19
|
-
{/* {getStylesheet().join("")} */}
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export default Box
|
package/src/comps/button.tsx
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LegacyRef,
|
|
3
|
-
forwardRef
|
|
4
|
-
} from "react";
|
|
5
|
-
import {
|
|
6
|
-
cleanProps,
|
|
7
|
-
withStyle
|
|
8
|
-
} from "../core";
|
|
9
|
-
|
|
10
|
-
const Button = forwardRef(( props: { [ key: string ] : any }, ref : LegacyRef<HTMLButtonElement>) => {
|
|
11
|
-
|
|
12
|
-
const _styles = withStyle(props)
|
|
13
|
-
|
|
14
|
-
return <button
|
|
15
|
-
ref={props.ref || ref}
|
|
16
|
-
className={_styles}
|
|
17
|
-
{ ...cleanProps(props) }>
|
|
18
|
-
{props.html ? <span dangerouslySetInnerHTML={{ __html: props.html }} /> : props.children}
|
|
19
|
-
</button>
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export default Button
|
package/src/comps/crumb.tsx
DELETED
package/src/comps/form.tsx
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import Box from './box'
|
|
2
|
-
import { buildFormData, isEmail } from '../core'
|
|
3
|
-
// import { useEffect, useState } from 'react'
|
|
4
|
-
import Children from 'react-children-utilities'
|
|
5
|
-
|
|
6
|
-
const Form = (props: any) => {
|
|
7
|
-
|
|
8
|
-
const _props = { ...props }
|
|
9
|
-
delete _props['children']
|
|
10
|
-
const formName = `form-${props.name}`
|
|
11
|
-
const fields = []
|
|
12
|
-
|
|
13
|
-
const validateForm = () => {
|
|
14
|
-
const _data = buildFormData(document.querySelector(`form[name="${formName}"]`))
|
|
15
|
-
const data = []
|
|
16
|
-
_data.map(f => {
|
|
17
|
-
const id = Object.keys(f)[0]
|
|
18
|
-
const field = fields.find(x => x.name == id)
|
|
19
|
-
if(field){
|
|
20
|
-
const value = decodeURIComponent(f[id])
|
|
21
|
-
let valid = 'should' in field ? field.value != "" : true
|
|
22
|
-
if('should' in field){
|
|
23
|
-
switch(field.should){
|
|
24
|
-
case "email":
|
|
25
|
-
valid = isEmail(value)
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
data.push({ name: field.name, value: value, valid: valid })
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
if(props.onSubmit){
|
|
33
|
-
props.onSubmit({ validation: !data.find(x => x.valid == false), data: data })
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
Children.deepMap(props.children, c => {
|
|
38
|
-
if(c['props'].name && !fields.find(x => x.name == c['props'].name)){
|
|
39
|
-
let xyz = { name: c['props'].name, touched: false }
|
|
40
|
-
if('should' in c['props']){
|
|
41
|
-
xyz['should'] = c['props'].should
|
|
42
|
-
}
|
|
43
|
-
fields.push(xyz)
|
|
44
|
-
}
|
|
45
|
-
return null
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
return <form name={formName} method={props.method || undefined} onSubmit={e => {
|
|
49
|
-
e.preventDefault(); e.stopPropagation();
|
|
50
|
-
validateForm()
|
|
51
|
-
}} >
|
|
52
|
-
<Box {..._props}>
|
|
53
|
-
{props.children}
|
|
54
|
-
</Box>
|
|
55
|
-
</form>
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export default Form
|
package/src/comps/heading.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LegacyRef,
|
|
3
|
-
forwardRef
|
|
4
|
-
} from "react";
|
|
5
|
-
import {
|
|
6
|
-
cleanProps,
|
|
7
|
-
withStyle
|
|
8
|
-
} from "../core";
|
|
9
|
-
|
|
10
|
-
const Heading = forwardRef(( props: { [ key: string ] : any }, ref : LegacyRef<HTMLHeadingElement>) => {
|
|
11
|
-
|
|
12
|
-
const _styles = withStyle(props)
|
|
13
|
-
|
|
14
|
-
const Tag : string = `h${props.h || 1}`;
|
|
15
|
-
const HeadingTag = Tag as `h1` | `h2` | `h3` | `h4` | `h5` | `h6`
|
|
16
|
-
|
|
17
|
-
return <HeadingTag
|
|
18
|
-
className={_styles}
|
|
19
|
-
{ ...cleanProps(props) }>
|
|
20
|
-
{props.html ? <span dangerouslySetInnerHTML={{ __html: props.html }} /> : props.children}
|
|
21
|
-
</HeadingTag>
|
|
22
|
-
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export default Heading
|
package/src/comps/icon.tsx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
forwardRef
|
|
3
|
-
} from "react";
|
|
4
|
-
import {
|
|
5
|
-
cleanProps,
|
|
6
|
-
withStyle,
|
|
7
|
-
getStylesheet
|
|
8
|
-
} from "../core";
|
|
9
|
-
|
|
10
|
-
const Icon = forwardRef(( props: { [ key: string ] : any }, ref) => {
|
|
11
|
-
|
|
12
|
-
const _styles = withStyle({ ...props, as: `icon-${props.as}`, size: props.size || 16 })
|
|
13
|
-
|
|
14
|
-
return <span
|
|
15
|
-
ref={props.ref || ref}
|
|
16
|
-
className={_styles}
|
|
17
|
-
{ ...cleanProps(props) }>
|
|
18
|
-
{props.html ? <span dangerouslySetInnerHTML={{ __html: props.html }} /> : props.children}
|
|
19
|
-
{/* {getStylesheet().join("")} */}
|
|
20
|
-
</span>
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export default Icon
|
package/src/comps/input.tsx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Ref,
|
|
3
|
-
forwardRef
|
|
4
|
-
} from "react";
|
|
5
|
-
import {
|
|
6
|
-
cleanProps,
|
|
7
|
-
withStyle
|
|
8
|
-
} from "../core";
|
|
9
|
-
|
|
10
|
-
const Input = forwardRef(( props: { [ key: string ] : any }, ref : Ref<HTMLTextAreaElement|HTMLInputElement>) => {
|
|
11
|
-
|
|
12
|
-
let Tag : string = props.tag || 'input';
|
|
13
|
-
const El = Tag as `textarea` | `input`
|
|
14
|
-
const _styles = withStyle(props)
|
|
15
|
-
|
|
16
|
-
return <El
|
|
17
|
-
className={_styles}
|
|
18
|
-
onChange={e => { props.onChange && props.onChange(e) }}
|
|
19
|
-
{ ...cleanProps(props) }
|
|
20
|
-
/>
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
export default Input
|
package/src/comps/select.tsx
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Ref,
|
|
3
|
-
forwardRef
|
|
4
|
-
} from "react";
|
|
5
|
-
import {
|
|
6
|
-
cleanProps,
|
|
7
|
-
withStyle
|
|
8
|
-
} from "../core";
|
|
9
|
-
|
|
10
|
-
const Select = forwardRef(( props: { [ key: string ] : any }, ref : Ref<HTMLTextAreaElement|HTMLInputElement>) => {
|
|
11
|
-
|
|
12
|
-
const _styles = withStyle(props)
|
|
13
|
-
|
|
14
|
-
return <select
|
|
15
|
-
className={_styles}
|
|
16
|
-
{ ...cleanProps(props) }
|
|
17
|
-
onChange={e => { props.onChange && props.onChange(e) }}>
|
|
18
|
-
{props.options && props.options.map(o => <option key={`${props.id || props.as || props.name}-option-${o.value}`} value={o.value}>{o.label}</option>)}
|
|
19
|
-
</select>
|
|
20
|
-
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export default Select
|
package/src/comps/spinner.tsx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Box from './box'
|
|
3
|
-
import PropTypes from 'prop-types'
|
|
4
|
-
|
|
5
|
-
const Spinner = (props : any) => {
|
|
6
|
-
|
|
7
|
-
const { size, w, h, color, radius, anim } = props
|
|
8
|
-
|
|
9
|
-
return <Box w={size || 50} rel zIndex={`1`} userSelect={`none`} h={size || 50} as={`zuz-spinner`} anim={(anim || 2).toString()} flex aic jcc>
|
|
10
|
-
<Box as={`zuz-loader`} r={radius || 4} w={w || 30} h={h || 6} bg={color || `#111`} />
|
|
11
|
-
</Box>
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
Spinner.propTypes = {
|
|
16
|
-
size: PropTypes.number,
|
|
17
|
-
w: PropTypes.number,
|
|
18
|
-
h: PropTypes.number,
|
|
19
|
-
radius: PropTypes.number,
|
|
20
|
-
color: PropTypes.string,
|
|
21
|
-
anim: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default Spinner;
|
package/src/comps/stylesheet.tsx
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useCallback,
|
|
3
|
-
useEffect,
|
|
4
|
-
useMemo,
|
|
5
|
-
useReducer
|
|
6
|
-
} from 'react'
|
|
7
|
-
import AppContext from './AppContext'
|
|
8
|
-
|
|
9
|
-
let isMounted = true;
|
|
10
|
-
export const STORE_KEY = `__zuzjs`
|
|
11
|
-
export const STORE_FORM_KEY = `${STORE_KEY}forms`
|
|
12
|
-
export const STORE_DEFAUTLS = [`${STORE_KEY}base`, `${STORE_KEY}forms`]
|
|
13
|
-
|
|
14
|
-
const defaultState = {
|
|
15
|
-
[`${STORE_KEY}base`] : {
|
|
16
|
-
debug: true,
|
|
17
|
-
loading: false,
|
|
18
|
-
_tmp: Math.random()
|
|
19
|
-
},
|
|
20
|
-
[STORE_FORM_KEY] : {
|
|
21
|
-
forms: {}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const rootReducer = (state, action ) => ({
|
|
26
|
-
...state,
|
|
27
|
-
...action.payload
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
const AppProvider = ({
|
|
31
|
-
children,
|
|
32
|
-
initialState = {}
|
|
33
|
-
}) => {
|
|
34
|
-
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
isMounted = true;
|
|
37
|
-
return () => {
|
|
38
|
-
isMounted = false;
|
|
39
|
-
}
|
|
40
|
-
}, [])
|
|
41
|
-
|
|
42
|
-
const rootState = useMemo(() => ({
|
|
43
|
-
...defaultState,
|
|
44
|
-
...initialState
|
|
45
|
-
}), [initialState])
|
|
46
|
-
|
|
47
|
-
const [state, _dispatch] = useReducer(rootReducer, rootState);
|
|
48
|
-
|
|
49
|
-
const dispatch = useCallback((args) => {
|
|
50
|
-
if (isMounted) {
|
|
51
|
-
_dispatch({ ...args });
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
[_dispatch],
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const providedValue = useMemo(
|
|
58
|
-
() => ({
|
|
59
|
-
...state,
|
|
60
|
-
dispatch
|
|
61
|
-
}),
|
|
62
|
-
[state]
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
return <AppContext.Provider value={providedValue}>{children}</AppContext.Provider>
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export default AppProvider
|
package/src/context/index.tsx
DELETED
package/src/core/css.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default {}
|
package/src/core/index.tsx
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import Hashids from "hashids"
|
|
2
|
-
import { nanoid } from "nanoid"
|
|
3
|
-
import StyleCache from './css'
|
|
4
|
-
import Cookies from 'js-cookie'
|
|
5
|
-
import axios from 'axios'
|
|
6
|
-
import {
|
|
7
|
-
cssColors,
|
|
8
|
-
cssProps, cssPropsDirect, cssPropsIgnore, cssPropsVals
|
|
9
|
-
} from "./styles"
|
|
10
|
-
|
|
11
|
-
const _Hashids = new Hashids('', 4)
|
|
12
|
-
const _Alphabets = "#abcdefghijklmnopqrstuvwxyz0123456789"
|
|
13
|
-
|
|
14
|
-
export const setCookie = (key : string, value : any, expiry? : number, host? : string) => Cookies.set(key, value, { expires: expiry || 7, domain: host || window.location.host })
|
|
15
|
-
|
|
16
|
-
export const getCookie = (key : string) => key == `` ? Cookies.get() : Cookies.get(key) || null;
|
|
17
|
-
|
|
18
|
-
export const removeCookie = (key : string) => Cookies.remove(key)
|
|
19
|
-
|
|
20
|
-
export const uuid = (len=11) => nanoid(len)
|
|
21
|
-
|
|
22
|
-
export const makeCSSValue = (k: any, v: any, o: any) => {
|
|
23
|
-
let ignore = cssPropsIgnore.indexOf(o) == -1
|
|
24
|
-
if(k in cssPropsDirect && ignore == true){
|
|
25
|
-
return cssPropsDirect[k].indexOf(`__VALUE__`) > - 1 ?
|
|
26
|
-
cssPropsDirect[k].replaceAll(`__VALUE__`, `${v}${"number" == typeof v ? `px` : ``}`)
|
|
27
|
-
: cssPropsDirect[k];
|
|
28
|
-
}
|
|
29
|
-
let unit = "number" == typeof v && ignore ? `px` : ``;
|
|
30
|
-
if(cssColors.indexOf(v) > -1){
|
|
31
|
-
v = `var(--colors-${v.replaceAll(`.`, `-`)})`;
|
|
32
|
-
unit = ``;
|
|
33
|
-
}else if(v in cssPropsVals){
|
|
34
|
-
v = cssPropsVals[v];
|
|
35
|
-
}
|
|
36
|
-
return `${k}:${v}${unit};`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const cleanProps = (props: {}, del=true) : {} => {
|
|
40
|
-
const ignore = [`as`, `hover`, `bref`, `tag`,`onSubmit`,`method`,`should`,`options`,`required`]
|
|
41
|
-
let items = { ...props }
|
|
42
|
-
Object.keys(props).map(k => {
|
|
43
|
-
if(k in cssProps || ignore.indexOf(k) > -1){
|
|
44
|
-
if(del)
|
|
45
|
-
delete items[k]
|
|
46
|
-
else
|
|
47
|
-
items[k] = undefined
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
return items
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export const buildCSS = (k : any, v : any) => {
|
|
54
|
-
if(k in cssProps){
|
|
55
|
-
return makeCSSValue(cssProps[k], v, k)
|
|
56
|
-
}
|
|
57
|
-
return ``
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const _withStyle = (props, pseudo=``) : string => {
|
|
61
|
-
if(!props) return ``
|
|
62
|
-
let cx = [props.className || props.as || ``]
|
|
63
|
-
const propRegexp = /\#|px|\(|\)|-|\s/g
|
|
64
|
-
Object.keys(props).map(k => {
|
|
65
|
-
if(k != 'children' && k in cssProps){
|
|
66
|
-
const _css = buildCSS(k, props[k]).toString().replace(/;|:|\s/g, "")
|
|
67
|
-
let _indices = 0
|
|
68
|
-
for(let i = 0; i < _css.length; i++){ _indices += _Alphabets.indexOf(_css.charAt(i)) }
|
|
69
|
-
let _cp = k.substring(0, 1);
|
|
70
|
-
if(cssProps[k].indexOf("-") > -1){
|
|
71
|
-
_cp = "";
|
|
72
|
-
cssProps[k].split("-").map(c => _cp += c.substring(0, 1))
|
|
73
|
-
}
|
|
74
|
-
if(props[k].toString().indexOf("-") > -1){
|
|
75
|
-
props[k].toString().split("-").map(c => _cp += c.substring(0, 1))
|
|
76
|
-
}
|
|
77
|
-
const _id = `${_cp}${_Hashids.encode(cssProps[k].length + _indices + (isNaN(parseInt(props[k])) ? 0 : parseInt(props[k])))}`
|
|
78
|
-
// const _id = `${_cp}${cssProps[k]}-${props[k]}`
|
|
79
|
-
cx.push(_id)
|
|
80
|
-
StyleCache[_id + pseudo] = buildCSS(k, props[k])
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
return cx.join(" ").trim()
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export const withStyle = ( props ) : string => {
|
|
87
|
-
const style = [_withStyle(props)]
|
|
88
|
-
if("hover" in props){
|
|
89
|
-
style.push(_withStyle(props.hover, `:hover`))
|
|
90
|
-
}
|
|
91
|
-
if("before" in props){
|
|
92
|
-
style.push(_withStyle(props.hover, `:before`))
|
|
93
|
-
}
|
|
94
|
-
if("after" in props){
|
|
95
|
-
style.push(_withStyle(props.hover, `:after`))
|
|
96
|
-
}
|
|
97
|
-
return style.join(style.length > 1 ? " " : "")
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export const getStylesheet = () => Object.keys(StyleCache).map(ck => StyleCache[ck] != "" ? `.${ck}{${StyleCache[ck]}}` : `__`).filter(x => x != `__`)
|
|
101
|
-
|
|
102
|
-
export const isEmail = (e : string) => {
|
|
103
|
-
let reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/ ;
|
|
104
|
-
return reg.test(e);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export const buildFormData = form => {
|
|
108
|
-
if (!form || form.nodeName !== "FORM") {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
var i, j, q = [];
|
|
112
|
-
for (i = form.elements.length - 1; i >= 0; i = i - 1) {
|
|
113
|
-
if (form.elements[i].name === "") {
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
switch (form.elements[i].nodeName) {
|
|
117
|
-
case 'INPUT':
|
|
118
|
-
switch (form.elements[i].type) {
|
|
119
|
-
case 'text':
|
|
120
|
-
case 'hidden':
|
|
121
|
-
case 'password':
|
|
122
|
-
case 'button':
|
|
123
|
-
case 'reset':
|
|
124
|
-
case 'submit':
|
|
125
|
-
q.push({ [form.elements[i].name] : encodeURIComponent(form.elements[i].value) });
|
|
126
|
-
break;
|
|
127
|
-
case 'checkbox':
|
|
128
|
-
case 'radio':
|
|
129
|
-
if (form.elements[i].checked) {
|
|
130
|
-
q.push({ [form.elements[i].name] : encodeURIComponent(form.elements[i].value) });
|
|
131
|
-
}
|
|
132
|
-
break;
|
|
133
|
-
case 'file':
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
break;
|
|
137
|
-
case 'TEXTAREA':
|
|
138
|
-
q.push({ [form.elements[i].name] : encodeURIComponent(form.elements[i].value) });
|
|
139
|
-
break;
|
|
140
|
-
case 'SELECT':
|
|
141
|
-
switch (form.elements[i].type) {
|
|
142
|
-
case 'select-one':
|
|
143
|
-
q.push({ [form.elements[i].name] : encodeURIComponent(form.elements[i].value) });
|
|
144
|
-
break;
|
|
145
|
-
case 'select-multiple':
|
|
146
|
-
for (j = form.elements[i].options.length - 1; j >= 0; j = j - 1) {
|
|
147
|
-
if (form.elements[i].options[j].selected) {
|
|
148
|
-
q.push({ [form.elements[i].name] : encodeURIComponent(form.elements[i].options[j].value) });
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
break;
|
|
154
|
-
case 'BUTTON':
|
|
155
|
-
switch (form.elements[i].type) {
|
|
156
|
-
case 'reset':
|
|
157
|
-
case 'submit':
|
|
158
|
-
case 'button':
|
|
159
|
-
q.push({ [form.elements[i].name] : encodeURIComponent(form.elements[i].value) });
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return q //return q.join("&");
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export const withRest = async (uri : string, data : object, timeout : number = 60, fd : object = null, progress? : Function, bearer : string = `__ha`) => {
|
|
169
|
-
var Bearer = getCookie(bearer) || `${uuid(8)}^${uuid(8)}`;
|
|
170
|
-
var isWindow = typeof window !== 'undefined'
|
|
171
|
-
var cancelToken = null
|
|
172
|
-
if(isWindow){
|
|
173
|
-
window['__grabToken'] = axios.CancelToken.source();
|
|
174
|
-
cancelToken = window['__grabToken'].token
|
|
175
|
-
}
|
|
176
|
-
if(fd){
|
|
177
|
-
return new Promise((resolve, reject) => {
|
|
178
|
-
axios({
|
|
179
|
-
method: "post",
|
|
180
|
-
url: uri,
|
|
181
|
-
data: buildFormData(data),
|
|
182
|
-
timeout: 1000 * timeout,
|
|
183
|
-
cancelToken: cancelToken,
|
|
184
|
-
headers: {
|
|
185
|
-
'Content-Type': 'multipart/form-data',
|
|
186
|
-
'Authorization': `Bearer ${Bearer}`
|
|
187
|
-
},
|
|
188
|
-
onUploadProgress: ev => {
|
|
189
|
-
//TODO: Add progress
|
|
190
|
-
}
|
|
191
|
-
})
|
|
192
|
-
.then(resp => {
|
|
193
|
-
if(resp.data && "kind" in resp.data){
|
|
194
|
-
resolve(resp.data)
|
|
195
|
-
}else{
|
|
196
|
-
reject(resp.data)
|
|
197
|
-
}
|
|
198
|
-
})
|
|
199
|
-
.catch(err => reject(err));
|
|
200
|
-
})
|
|
201
|
-
}
|
|
202
|
-
return new Promise((resolve, reject) => {
|
|
203
|
-
axios.post(
|
|
204
|
-
uri,
|
|
205
|
-
{
|
|
206
|
-
...Cookies.get(),
|
|
207
|
-
...data,
|
|
208
|
-
__poken: new Date().getTime() / 1000
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
timeout: 1000 * timeout,
|
|
212
|
-
headers: {
|
|
213
|
-
'Content-Type': 'application/json',
|
|
214
|
-
'Authorization': `Bearer ${Bearer}`
|
|
215
|
-
},
|
|
216
|
-
cancelToken: cancelToken
|
|
217
|
-
}
|
|
218
|
-
)
|
|
219
|
-
.then(resp => {
|
|
220
|
-
if(resp.data && "kind" in resp.data){
|
|
221
|
-
resolve(resp.data)
|
|
222
|
-
}else{
|
|
223
|
-
reject(resp.data)
|
|
224
|
-
}
|
|
225
|
-
})
|
|
226
|
-
.catch(err => reject(err));
|
|
227
|
-
})
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
export const formatBytes = bytes => {
|
|
231
|
-
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
|
232
|
-
if (bytes == 0) return '0 Byte';
|
|
233
|
-
var i = Math.floor(Math.log(bytes) / Math.log(1024)),
|
|
234
|
-
nx = bytes / Math.pow(1024, i);
|
|
235
|
-
return nx.toFixed(2) + ' ' + sizes[i];
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
export const formatSeconds = (n: number): string => {
|
|
239
|
-
let d = new Date(n * 1000).toISOString().slice(11, 19)
|
|
240
|
-
return d.indexOf("00:") > -1 ? d.replace("00:", "") : d
|
|
241
|
-
}
|
package/src/core/styles.ts
DELETED
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
const cssProps : { [key: string] : any } = {
|
|
2
|
-
"ac": "align-content",
|
|
3
|
-
"alignContent": "align-content",
|
|
4
|
-
|
|
5
|
-
"aic": "aic",
|
|
6
|
-
"ais": "ais",
|
|
7
|
-
"aie": "aie",
|
|
8
|
-
"nous": "nous",
|
|
9
|
-
"nope": "nope",
|
|
10
|
-
"ai": "align-items",
|
|
11
|
-
"alignItems": "align-items",
|
|
12
|
-
|
|
13
|
-
"ass": "ass",
|
|
14
|
-
"asc": "asc",
|
|
15
|
-
"ase": "ase",
|
|
16
|
-
"alignSelf": "align-self",
|
|
17
|
-
"all": "all",
|
|
18
|
-
"animation": "animation",
|
|
19
|
-
"animationDelay": "animation-delay",
|
|
20
|
-
"animationDirection": "animation-direction",
|
|
21
|
-
"animationDuration": "animation-duration",
|
|
22
|
-
"animationFillMode": "animation-fill-mode",
|
|
23
|
-
"animationIterationCount": "animation-iteration-count",
|
|
24
|
-
"animationName": "animation-name",
|
|
25
|
-
"animationPlayState": "animation-play-state",
|
|
26
|
-
"animationTimingFunction": "animation-timing-function",
|
|
27
|
-
"backfaceVisibility": "backface-visibility",
|
|
28
|
-
"backgroundAttachment": "background-attachment",
|
|
29
|
-
"backgroundBlendMode": "background-blend-mode",
|
|
30
|
-
"backgroundClip": "background-clip",
|
|
31
|
-
|
|
32
|
-
"bg": "background",
|
|
33
|
-
"background": "background",
|
|
34
|
-
"bgc": "background-color",
|
|
35
|
-
"bgColor": "background-color",
|
|
36
|
-
"backgroundColor": "background-color",
|
|
37
|
-
|
|
38
|
-
"backgroundImage": "background-image",
|
|
39
|
-
"backgroundOrigin": "background-origin",
|
|
40
|
-
"backgroundPosition": "background-position",
|
|
41
|
-
"backgroundRepeat": "background-repeat",
|
|
42
|
-
"backgroundSize": "background-size",
|
|
43
|
-
"border": "border",
|
|
44
|
-
"borderBottom": "border-bottom",
|
|
45
|
-
"borderBottomColor": "border-bottom-color",
|
|
46
|
-
"borderBottomStyle": "border-bottom-style",
|
|
47
|
-
"borderBottomWidth": "border-bottom-width",
|
|
48
|
-
"borderCollapse": "border-collapse",
|
|
49
|
-
"borderColor": "border-color",
|
|
50
|
-
"borderImage": "border-image",
|
|
51
|
-
"borderImageOutset": "border-image-outset",
|
|
52
|
-
"borderImageRepeat": "border-image-repeat",
|
|
53
|
-
"borderImageSlice": "border-image-slice",
|
|
54
|
-
"borderImageSource": "border-image-source",
|
|
55
|
-
"borderImageWidth": "border-image-width",
|
|
56
|
-
"borderLeft": "border-left",
|
|
57
|
-
"borderLeftColor": "border-left-color",
|
|
58
|
-
"borderLeftStyle": "border-left-style",
|
|
59
|
-
"borderLeftWidth": "border-left-width",
|
|
60
|
-
|
|
61
|
-
//Radius
|
|
62
|
-
"r": "border-radius",
|
|
63
|
-
"br": "border-radius",
|
|
64
|
-
"borderRadius": "border-radius",
|
|
65
|
-
"brtl": "border-top-left-radius",
|
|
66
|
-
"borderTopLeftRadius": "border-top-left-radius",
|
|
67
|
-
"brtr": "border-top-right-radius",
|
|
68
|
-
"borderTopRightRadius": "border-top-right-radius",
|
|
69
|
-
"brbl": "border-bottom-left-radius",
|
|
70
|
-
"borderBottomLeftRadius": "border-bottom-left-radius",
|
|
71
|
-
"brbr": "border-bottom-right-radius",
|
|
72
|
-
"borderBottomRightRadius": "border-bottom-right-radius",
|
|
73
|
-
|
|
74
|
-
"borderRight": "border-right",
|
|
75
|
-
"borderRightColor": "border-right-color",
|
|
76
|
-
"borderRightStyle": "border-right-style",
|
|
77
|
-
"borderRightWidth": "border-right-width",
|
|
78
|
-
"borderSpacing": "border-spacing",
|
|
79
|
-
"borderStyle": "border-style",
|
|
80
|
-
"borderTop": "border-top",
|
|
81
|
-
"borderTopColor": "border-top-color",
|
|
82
|
-
|
|
83
|
-
"borderTopStyle": "border-top-style",
|
|
84
|
-
"borderTopWidth": "border-top-width",
|
|
85
|
-
"borderWidth": "border-width",
|
|
86
|
-
"bottom": "bottom",
|
|
87
|
-
"boxDecorationBreak": "box-decoration-break",
|
|
88
|
-
"boxShadow": "box-shadow",
|
|
89
|
-
"boxSizing": "box-sizing",
|
|
90
|
-
"captionSide": "caption-side",
|
|
91
|
-
"caretColor": "caret-color",
|
|
92
|
-
"@charset": "@charset",
|
|
93
|
-
"clear": "clear",
|
|
94
|
-
"clip": "clip",
|
|
95
|
-
"clipPath": "clip-path",
|
|
96
|
-
"color": "color",
|
|
97
|
-
"columnCount": "column-count",
|
|
98
|
-
"columnFill": "column-fill",
|
|
99
|
-
"columnGap": "column-gap",
|
|
100
|
-
"colGap": "column-gap",
|
|
101
|
-
"columnRule": "column-rule",
|
|
102
|
-
"columnRuleColor": "column-rule-color",
|
|
103
|
-
"columnRuleStyle": "column-rule-style",
|
|
104
|
-
"columnRuleWidth": "column-rule-width",
|
|
105
|
-
"columnSpan": "column-span",
|
|
106
|
-
"columnWidth": "column-width",
|
|
107
|
-
"colW": "column-width",
|
|
108
|
-
"columns": "columns",
|
|
109
|
-
"content": "content",
|
|
110
|
-
"counterIncrement": "counter-increment",
|
|
111
|
-
"counterReset": "counter-reset",
|
|
112
|
-
"cursor": "cursor",
|
|
113
|
-
"pointer": "pointer",
|
|
114
|
-
"direction": "direction",
|
|
115
|
-
"display": "display",
|
|
116
|
-
"emptyCells": "empty-cells",
|
|
117
|
-
"filter": "filter",
|
|
118
|
-
"flex": "flex",
|
|
119
|
-
"flexBasis": "flex-basis",
|
|
120
|
-
"dir": "flex-direction",
|
|
121
|
-
"flexDirection": "flex-direction",
|
|
122
|
-
"flexFlow": "flex-flow",
|
|
123
|
-
"flexGrow": "flex-grow",
|
|
124
|
-
"flexShrink": "flex-shrink",
|
|
125
|
-
"flexWrap": "flex-wrap",
|
|
126
|
-
"float": "float",
|
|
127
|
-
"font": "font",
|
|
128
|
-
"fontFamily": "font-family",
|
|
129
|
-
"fontKerning": "font-kerning",
|
|
130
|
-
"size": "font-size",
|
|
131
|
-
"fontSize": "font-size",
|
|
132
|
-
"fontSizeAdjust": "font-size-adjust",
|
|
133
|
-
"fontStretch": "font-stretch",
|
|
134
|
-
"fontStyle": "font-style",
|
|
135
|
-
"fontVariant": "font-variant",
|
|
136
|
-
"bold": "bold",
|
|
137
|
-
"b900": "b900",
|
|
138
|
-
"b800": "b800",
|
|
139
|
-
"b700": "b700",
|
|
140
|
-
"fontWeight": "font-weight",
|
|
141
|
-
"gap" : "gap",
|
|
142
|
-
"grid": "grid",
|
|
143
|
-
"gridArea": "grid-area",
|
|
144
|
-
"gridAutoColumns": "grid-auto-columns",
|
|
145
|
-
"gridAutoFlow": "grid-auto-flow",
|
|
146
|
-
"gridAutoRows": "grid-auto-rows",
|
|
147
|
-
"gridColumn": "grid-column",
|
|
148
|
-
"gridColumnEnd": "grid-column-end",
|
|
149
|
-
"gridColumnGap": "grid-column-gap",
|
|
150
|
-
"gridColumnStart": "grid-column-start",
|
|
151
|
-
"gridGap": "grid-gap",
|
|
152
|
-
"gridRow": "grid-row",
|
|
153
|
-
"gridRowEnd": "grid-row-end",
|
|
154
|
-
"gridRowGap": "grid-row-gap",
|
|
155
|
-
"gridRowStart": "grid-row-start",
|
|
156
|
-
"gridTemplate": "grid-template",
|
|
157
|
-
"gridTemplateAreas": "grid-template-areas",
|
|
158
|
-
"gridTemplateColumns": "grid-template-columns",
|
|
159
|
-
"gridTemplateRows": "grid-template-rows",
|
|
160
|
-
"hangingPunctuation": "hanging-punctuation",
|
|
161
|
-
"hyphens": "hyphens",
|
|
162
|
-
"isolation": "isolation",
|
|
163
|
-
"jcc": "jcc",
|
|
164
|
-
"jcs": "jcs",
|
|
165
|
-
"jce": "jce",
|
|
166
|
-
"jc": "justify-content",
|
|
167
|
-
"justifyContent": "justify-content",
|
|
168
|
-
"left": "left",
|
|
169
|
-
"letterSpacing": "letter-spacing",
|
|
170
|
-
"lineHeight": "line-height",
|
|
171
|
-
"listStyle": "list-style",
|
|
172
|
-
"listStyleImage": "list-style-image",
|
|
173
|
-
"listStylePosition": "list-style-position",
|
|
174
|
-
"listStyleType": "list-style-type",
|
|
175
|
-
"aspectRatio": "aspect-ratio",
|
|
176
|
-
//Margin
|
|
177
|
-
"m": "margin",
|
|
178
|
-
"margin": "margin",
|
|
179
|
-
"mb": "margin-bottom",
|
|
180
|
-
"marginBottom": "margin-bottom",
|
|
181
|
-
"ml": "margin-left",
|
|
182
|
-
"marginLeft": "margin-left",
|
|
183
|
-
"mr": "margin-right",
|
|
184
|
-
"marginRight": "margin-right",
|
|
185
|
-
"mt": "margin-top",
|
|
186
|
-
"marginTop": "margin-top",
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
//Height
|
|
190
|
-
"h": "height",
|
|
191
|
-
"height": "height",
|
|
192
|
-
"minH": "min-height",
|
|
193
|
-
"minHeight": "min-height",
|
|
194
|
-
"maxH": "max-height",
|
|
195
|
-
"maxHeight": "max-height",
|
|
196
|
-
|
|
197
|
-
//Width
|
|
198
|
-
"w": "width",
|
|
199
|
-
"width": "width",
|
|
200
|
-
"minW": "min-width",
|
|
201
|
-
"minWidth": "min-width",
|
|
202
|
-
"maxW": "max-width",
|
|
203
|
-
"maxWidth": "max-width",
|
|
204
|
-
|
|
205
|
-
"mixBlendMode": "mix-blend-mode",
|
|
206
|
-
"objectFit": "object-fit",
|
|
207
|
-
"objectPosition": "object-position",
|
|
208
|
-
"opacity": "opacity",
|
|
209
|
-
"order": "order",
|
|
210
|
-
"outline": "outline",
|
|
211
|
-
"outlineColor": "outline-color",
|
|
212
|
-
"outlineOffset": "outline-offset",
|
|
213
|
-
"outlineStyle": "outline-style",
|
|
214
|
-
"outlineWidth": "outline-width",
|
|
215
|
-
"overflow": "overflow",
|
|
216
|
-
"overflowX": "overflow-x",
|
|
217
|
-
"overflowY": "overflow-y",
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
"p": "padding",
|
|
221
|
-
"padding": "padding",
|
|
222
|
-
"pb": "padding-bottom",
|
|
223
|
-
"paddingBottom": "padding-bottom",
|
|
224
|
-
"pl": "padding-left",
|
|
225
|
-
"paddingLeft": "padding-left",
|
|
226
|
-
"pr": "padding-right",
|
|
227
|
-
"paddingRight": "padding-right",
|
|
228
|
-
"pt": "padding-top",
|
|
229
|
-
"paddingTop": "padding-top",
|
|
230
|
-
|
|
231
|
-
"pageBreakAfter": "page-break-after",
|
|
232
|
-
"pageBreakBefore": "page-break-before",
|
|
233
|
-
"pageBreakInside": "page-break-inside",
|
|
234
|
-
"perspective": "perspective",
|
|
235
|
-
"perspectiveOrigin": "perspective-origin",
|
|
236
|
-
"pointerEvents": "pointer-events",
|
|
237
|
-
|
|
238
|
-
"rel":"rel",
|
|
239
|
-
"abs":"abs",
|
|
240
|
-
"fixed":"fixed",
|
|
241
|
-
"sticky":"sticky",
|
|
242
|
-
"pos": "position",
|
|
243
|
-
"position": "position",
|
|
244
|
-
|
|
245
|
-
"quotes": "quotes",
|
|
246
|
-
"resize": "resize",
|
|
247
|
-
"right": "right",
|
|
248
|
-
"scrollBehavior": "scroll-behavior",
|
|
249
|
-
"tabSize": "tab-size",
|
|
250
|
-
"tableLayout": "table-layout",
|
|
251
|
-
|
|
252
|
-
"align" : "text-align",
|
|
253
|
-
"textAlign": "text-align",
|
|
254
|
-
"textAlignLast": "text-align-last",
|
|
255
|
-
|
|
256
|
-
"tdh": "tdh", //text-decoration: underline on hover
|
|
257
|
-
"td": "text-decoration",
|
|
258
|
-
"textDecoration": "text-decoration",
|
|
259
|
-
"textDecorationColor": "text-decoration-color",
|
|
260
|
-
"textDecorationLine": "text-decoration-line",
|
|
261
|
-
"textDecorationStyle": "text-decoration-style",
|
|
262
|
-
"textIndent": "text-indent",
|
|
263
|
-
"textJustify": "text-justify",
|
|
264
|
-
"textOverflow": "text-overflow",
|
|
265
|
-
"textShadow": "text-shadow",
|
|
266
|
-
"textTransform": "text-transform",
|
|
267
|
-
"top": "top",
|
|
268
|
-
|
|
269
|
-
"transform": "transform",
|
|
270
|
-
"transform(2D)": "transform(2D)",
|
|
271
|
-
"transformOrigin(twoValue syntax)": "transform-origin(two-value syntax)",
|
|
272
|
-
"transformStyle": "transform-style",
|
|
273
|
-
"transition": "transition",
|
|
274
|
-
"transitionDelay": "transition-delay",
|
|
275
|
-
"transitionDuration": "transition-duration",
|
|
276
|
-
"transitionProperty": "transition-property",
|
|
277
|
-
"transitionTimingFunction": "transition-timing-function",
|
|
278
|
-
"unicodeBidi": "unicode-bidi",
|
|
279
|
-
"userSelect": "user-select",
|
|
280
|
-
"verticalAlign": "vertical-align",
|
|
281
|
-
"visibility": "visibility",
|
|
282
|
-
"weight" : "flex",
|
|
283
|
-
"whiteSpace": "white-space",
|
|
284
|
-
"ws": "white-space",
|
|
285
|
-
"wordBreak": "word-break",
|
|
286
|
-
"wordSpacing": "word-spacing",
|
|
287
|
-
"wrap": "wrap",
|
|
288
|
-
"textWrap": "textWrap",
|
|
289
|
-
"wordWrap": "word-wrap",
|
|
290
|
-
"writingMode": "writing-mode",
|
|
291
|
-
"zIndex": "z-index",
|
|
292
|
-
"backdropFilter": "backdrop-filter",
|
|
293
|
-
"bgFilter": "backdrop-filter",
|
|
294
|
-
|
|
295
|
-
//Custom
|
|
296
|
-
"anim" : "anim",
|
|
297
|
-
"fill" : "fill",
|
|
298
|
-
"abc" : "abc",
|
|
299
|
-
"fb" : "fb",
|
|
300
|
-
"ph" : "ph",
|
|
301
|
-
"pv" : "pv",
|
|
302
|
-
"mv" : "mv",
|
|
303
|
-
"mh" : "mh"
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
const cssPropsVals : { [key: string] : any } = {
|
|
307
|
-
//Colors
|
|
308
|
-
"primary" : 'var(--primary-color)',
|
|
309
|
-
"c" : "center",
|
|
310
|
-
//Flex Directions
|
|
311
|
-
"cols" : "column",
|
|
312
|
-
"colsr" : "column-reverse",
|
|
313
|
-
"rows" : "row",
|
|
314
|
-
"rowsr" : "row-reverse",
|
|
315
|
-
//Positions
|
|
316
|
-
"rel" : "relative",
|
|
317
|
-
"abs" : "absolute",
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
const cssPropsDirect : { [key : string] : any } = {
|
|
321
|
-
'rel' : 'position: relative;',
|
|
322
|
-
'fixed' : 'position: fixed;',
|
|
323
|
-
'abs' : 'position: absolute;',
|
|
324
|
-
'sticky' : 'position: sticky;',
|
|
325
|
-
'flex' : 'display: flex;',
|
|
326
|
-
'fwrap' : 'flex-wrap: wrap;',
|
|
327
|
-
'aic' : 'align-items: center;',
|
|
328
|
-
'ais' : 'align-items: flex-start;',
|
|
329
|
-
'aie' : 'align-items: flex-end;',
|
|
330
|
-
'ass' : 'align-self: flex-start;',
|
|
331
|
-
'asc' : 'align-self: center;',
|
|
332
|
-
'ase' : 'align-self: flex-end;',
|
|
333
|
-
'jcc' : 'justify-content: center;',
|
|
334
|
-
'jcs' : 'justify-content: flex-start;',
|
|
335
|
-
'jce' : 'justify-content: flex-end;',
|
|
336
|
-
'grid' : 'display: grid;',
|
|
337
|
-
'fill' : 'top: 0px;left: 0px;right: 0px;bottom: 0px;',
|
|
338
|
-
'abc' : 'top: 50%;left: 50%;transform: translate(-50%, -50%);',
|
|
339
|
-
'block' : 'display: block;',
|
|
340
|
-
'bold' : "font-weight: bold;",
|
|
341
|
-
'b900' : "font-weight: 900;",
|
|
342
|
-
'b800' : "font-weight: 800;",
|
|
343
|
-
'b700' : "font-weight: 700;",
|
|
344
|
-
'wrap' : "word-wrap: break-word;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;max-width: 99%;",
|
|
345
|
-
'textWrap' : "word-wrap: break-word;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;max-width: 99%;",
|
|
346
|
-
'pointer' : "cursor: pointer;",
|
|
347
|
-
'fb' : 'font-family: var(--primary-font-bold);',
|
|
348
|
-
'ph' : 'padding-left: __VALUE__;padding-right: __VALUE__;',
|
|
349
|
-
'pv' : 'padding-bottom: __VALUE__;padding-top: __VALUE__;',
|
|
350
|
-
'mv' : 'margin-bottom: __VALUE__;margin-top: __VALUE__;',
|
|
351
|
-
'mh' : 'margin-left: __VALUE__;margin-right: __VALUE__;',
|
|
352
|
-
'anim' : 'transition:all __VALUE__s linear 0s;',
|
|
353
|
-
'nous' : 'user-select: none;',
|
|
354
|
-
'nope' : 'pointer-events: none;',
|
|
355
|
-
'tdn' : 'text-decoration: none;',
|
|
356
|
-
'aspectRatio' : 'aspect-ratio: __VALUE__;'
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
const cssPropsIgnore : string[] = [
|
|
360
|
-
'weight', `opacity`
|
|
361
|
-
]
|
|
362
|
-
|
|
363
|
-
const _cssColors : string[] = [ `white`, `black`, `gray`, `red`, `orange`, `yellow`, `green`, `teal`, `blue`, `cyan`, `purple`, `pink`, `linkedin`, `facebook`, `messenger`, `whatsapp`, `twitter`, `telegram` ]
|
|
364
|
-
const _cssColorsRange : string[] = [ `50`, `100`, `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900` ]
|
|
365
|
-
let cssColors : string[] = []
|
|
366
|
-
|
|
367
|
-
if(cssColors.length == 0){
|
|
368
|
-
_cssColors.map(c => {
|
|
369
|
-
_cssColorsRange.map(r => cssColors.push(`${c}.${r}`));
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
export {
|
|
374
|
-
cssPropsDirect,
|
|
375
|
-
cssProps,
|
|
376
|
-
cssPropsVals,
|
|
377
|
-
cssPropsIgnore,
|
|
378
|
-
cssColors
|
|
379
|
-
}
|
package/src/hooks/index.tsx
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react'
|
|
2
|
-
import AppContext from '../context'
|
|
3
|
-
|
|
4
|
-
const useDispatch = (key? : string) => {
|
|
5
|
-
|
|
6
|
-
const state = useContext(AppContext)
|
|
7
|
-
const dispatch = state['dispatch'];
|
|
8
|
-
|
|
9
|
-
const prepareState = (prevState, nextState) => {
|
|
10
|
-
const nextKeys = Object.keys(nextState)
|
|
11
|
-
nextKeys.map(k => {
|
|
12
|
-
if(prevState[k] !== nextState[k]){
|
|
13
|
-
prevState[k] = nextState[k]
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return {
|
|
17
|
-
...prevState,
|
|
18
|
-
...nextState
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if(key){
|
|
23
|
-
return (payload = {}) => {
|
|
24
|
-
|
|
25
|
-
dispatch({
|
|
26
|
-
action: key,
|
|
27
|
-
payload: {
|
|
28
|
-
[key] : prepareState(state[key], payload)
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return dispatch;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export default useDispatch
|
package/src/hooks/useStore.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react'
|
|
2
|
-
import AppContext from '../context'
|
|
3
|
-
import { STORE_KEY } from '../context/AppProvider'
|
|
4
|
-
|
|
5
|
-
const useStore = (callback? : any, withFilter = true) => {
|
|
6
|
-
|
|
7
|
-
let _state = useContext(AppContext)
|
|
8
|
-
let state = withFilter ? {} : _state
|
|
9
|
-
|
|
10
|
-
if(withFilter){
|
|
11
|
-
const filters = ['defaultState', 'theme', 'dispatch', `${STORE_KEY}base`,`${STORE_KEY}forms`]
|
|
12
|
-
Object.keys(_state).map(k => {
|
|
13
|
-
if(filters.indexOf(k) == -1){
|
|
14
|
-
state[k] = _state[k]
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if("function" == typeof callback){
|
|
20
|
-
return callback(state)
|
|
21
|
-
}
|
|
22
|
-
return state
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default useStore
|
package/src/hooks.tsx
DELETED
package/src/scss/mixins.scss
DELETED
package/src/scss/props.scss
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
*, *:before, *:after{
|
|
2
|
-
-moz-box-sizing: border-box;
|
|
3
|
-
-webkit-box-sizing: border-box;
|
|
4
|
-
box-sizing: border-box;
|
|
5
|
-
}
|
|
6
|
-
*, html, body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, label, fieldset, input, p, blockquote, th, td{margin: 0;padding: 0;}
|
|
7
|
-
table{border-collapse: collapse; border-spacing: 0;}
|
|
8
|
-
fieldset, img {border: 0}
|
|
9
|
-
address, caption, cite, code, dfn, em, strong, th, var {font-style: normal; font-weight: normal}
|
|
10
|
-
ol, ul, li{list-style: none;}
|
|
11
|
-
caption, th{text-align: left;}
|
|
12
|
-
h1, h2, h3, h4, h5, h6{font-size: 100%; font-weight: normal;}
|
|
13
|
-
div, img, button, input, textarea, select{outline: none}
|
|
14
|
-
strong{font-weight: bold}
|
|
15
|
-
em{font-style: italic;}
|
|
16
|
-
a img{border: none;}
|
|
17
|
-
|
|
18
|
-
button{cursor: pointer;}
|
|
19
|
-
.grid{ display: grid; }
|
|
20
|
-
.fixed{
|
|
21
|
-
position: fixed;
|
|
22
|
-
&.fill{
|
|
23
|
-
top: 0px;
|
|
24
|
-
left: 0px;
|
|
25
|
-
right: 0px;
|
|
26
|
-
bottom: 0px;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
.rel{ position: relative; }
|
|
30
|
-
.abs{
|
|
31
|
-
position: absolute;
|
|
32
|
-
&.abc{
|
|
33
|
-
top: 50%;
|
|
34
|
-
left: 50%;
|
|
35
|
-
transform: translate(-50%, -50%);
|
|
36
|
-
}
|
|
37
|
-
&.fill{
|
|
38
|
-
top: 0px;
|
|
39
|
-
left: 0px;
|
|
40
|
-
right: 0px;
|
|
41
|
-
bottom: 0px;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.sticky{ position: sticky; }
|
|
46
|
-
.block{display: block;}
|
|
47
|
-
.iblock{display: inline-block;}
|
|
48
|
-
.tdnh, .tdn{ text-decoration: none; }
|
|
49
|
-
.tdnh:hover, .tdh:hover{ text-decoration: underline; }
|
|
50
|
-
|
|
51
|
-
.flex{
|
|
52
|
-
display: flex;
|
|
53
|
-
&.ass{align-self: flex-start;}
|
|
54
|
-
&.asc{align-self: center;}
|
|
55
|
-
&.ase{align-self: flex-end;}
|
|
56
|
-
&.ais{align-items: flex-start;}
|
|
57
|
-
&.aic{align-items: center;}
|
|
58
|
-
&.aie{align-items: flex-end;}
|
|
59
|
-
&.jcs{justify-content: flex-start;}
|
|
60
|
-
&.jcc{justify-content: center;}
|
|
61
|
-
&.jce{justify-content: flex-end;}
|
|
62
|
-
&.col{flex-direction: column;}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/*
|
|
66
|
-
COLORS
|
|
67
|
-
It will generate .cfff { color: #fff; } from 'fff'
|
|
68
|
-
*/
|
|
69
|
-
$colors: 'fff','111','222','333','444','555','666','777','888','999';
|
|
70
|
-
@each $n in $colors{
|
|
71
|
-
.c#{$n} { color: unquote("#"+#{$n}); }
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/*
|
|
75
|
-
FONT SIZES
|
|
76
|
-
It will generate .s10 { font-size: 12px; } from '12'
|
|
77
|
-
*/
|
|
78
|
-
@for $i from 10 through 72 {
|
|
79
|
-
@if $i % 2 == 0 {
|
|
80
|
-
.s#{$i} { font-size: #{$i}px; }
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/*
|
|
85
|
-
BoldSize
|
|
86
|
-
It will generate .b400 { font-weight: 400; } from '400'
|
|
87
|
-
*/
|
|
88
|
-
$bsizes: 100,200,300,400,500,600,700,800,900;
|
|
89
|
-
.bold{ font-weight: bold; }
|
|
90
|
-
@each $n in $bsizes{
|
|
91
|
-
.b#{$n} { font-weight: #{$n}; }
|
|
92
|
-
}
|
package/src/scss/styles.scss
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
@import './mixins.scss';
|
|
2
|
-
@import './props.scss';
|
|
3
|
-
|
|
4
|
-
@keyframes rotate-loop {
|
|
5
|
-
from {
|
|
6
|
-
-ms-transform: rotate(0deg);
|
|
7
|
-
-moz-transform: rotate(0deg);
|
|
8
|
-
-webkit-transform: rotate(0deg);
|
|
9
|
-
-o-transform: rotate(0deg);
|
|
10
|
-
transform: rotate(0deg);
|
|
11
|
-
}
|
|
12
|
-
to {
|
|
13
|
-
-ms-transform: rotate(360deg);
|
|
14
|
-
-moz-transform: rotate(360deg);
|
|
15
|
-
-webkit-transform: rotate(360deg);
|
|
16
|
-
-o-transform: rotate(360deg);
|
|
17
|
-
transform: rotate(360deg);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.zuz-spinner{
|
|
22
|
-
.zuz-loader{
|
|
23
|
-
animation: rotate-loop 0.5s linear infinite;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.button{
|
|
28
|
-
border: 0px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.zuz-checkbox{
|
|
32
|
-
opacity: 0; // hides checkbox
|
|
33
|
-
position: absolute;
|
|
34
|
-
& + label {
|
|
35
|
-
position: relative;
|
|
36
|
-
display: inline-block;
|
|
37
|
-
user-select: none;
|
|
38
|
-
transition: .4s ease;
|
|
39
|
-
height: 26px;
|
|
40
|
-
width: 44px;
|
|
41
|
-
border-radius: 60px;
|
|
42
|
-
background: #eee;
|
|
43
|
-
&:before {
|
|
44
|
-
content: "";
|
|
45
|
-
position: absolute;
|
|
46
|
-
display: block;
|
|
47
|
-
transition: .2s cubic-bezier(.24, 0, .5, 1);
|
|
48
|
-
height: 26px;
|
|
49
|
-
width: 44px;
|
|
50
|
-
top: 0;
|
|
51
|
-
left: 0;
|
|
52
|
-
border-radius: 30px;
|
|
53
|
-
}
|
|
54
|
-
&:after {
|
|
55
|
-
content: "";
|
|
56
|
-
position: absolute;
|
|
57
|
-
display: block;
|
|
58
|
-
transition: .35s cubic-bezier(.54, 1.60, .5, 1);
|
|
59
|
-
background: #fff;
|
|
60
|
-
height: 22px;
|
|
61
|
-
width: 22px;
|
|
62
|
-
top: 2px;
|
|
63
|
-
left: 2px;
|
|
64
|
-
border-radius: 60px;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
&:checked {
|
|
68
|
-
& + label:before {
|
|
69
|
-
background: green; // Active Color
|
|
70
|
-
transition: width .2s cubic-bezier(0, 0, 0, .1);
|
|
71
|
-
}
|
|
72
|
-
& + label:after {
|
|
73
|
-
left: 20px;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.zuz-contextmenu{
|
|
79
|
-
width: 220px;
|
|
80
|
-
border-radius: 5px;
|
|
81
|
-
padding: 4px;
|
|
82
|
-
background: rgba(34,34,34,0.5);
|
|
83
|
-
border: 1px rgba(255,255,255,0.25) solid;
|
|
84
|
-
box-shadow: 0px 1px 3px rgba(0, 0, 0, .45);
|
|
85
|
-
backdrop-filter: blur(20px);
|
|
86
|
-
button{
|
|
87
|
-
border: 0px;
|
|
88
|
-
text-align: left;
|
|
89
|
-
padding: 4px 6px;
|
|
90
|
-
background: rgba(0, 0, 0, 0);
|
|
91
|
-
cursor: pointer;
|
|
92
|
-
color: #fff;
|
|
93
|
-
border-radius: 4px;
|
|
94
|
-
&:hover{
|
|
95
|
-
background: #5183ff;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
.line{
|
|
99
|
-
height: 1px;
|
|
100
|
-
background: rgba(255,255,255,0.25);
|
|
101
|
-
margin: 4px 6px;
|
|
102
|
-
}
|
|
103
|
-
}
|
package/src/ui.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import './scss/styles.scss'
|
|
2
|
-
|
|
3
|
-
export * from "./core"
|
|
4
|
-
|
|
5
|
-
export { default as Stylesheet } from "./comps/stylesheet"
|
|
6
|
-
export { default as Box } from "./comps/box"
|
|
7
|
-
export { default as Heading } from "./comps/heading"
|
|
8
|
-
export { default as Input } from "./comps/input"
|
|
9
|
-
export { default as Button } from "./comps/button"
|
|
10
|
-
export { default as Form } from "./comps/form"
|
|
11
|
-
export { default as Icon } from "./comps/icon"
|
|
12
|
-
export { default as Spinner } from "./comps/spinner"
|
|
13
|
-
export { default as Select } from "./comps/select"
|