@xanui/core 1.1.2 → 1.1.3
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/ServerStyleTags.d.ts +3 -0
- package/ServerStyleTags.js +2 -0
- package/ServerStyleTags.js.map +7 -0
- package/Tag/cssPropList.d.ts +2 -0
- package/Tag/cssPropList.js +2 -0
- package/Tag/cssPropList.js.map +7 -0
- package/Tag/index.d.ts +4 -0
- package/Tag/index.js +2 -0
- package/Tag/index.js.map +7 -0
- package/{src/Tag/types.ts → Tag/types.d.ts} +9 -13
- package/Tag/types.js +1 -0
- package/Tag/types.js.map +7 -0
- package/Tag/useTagProps.d.ts +3 -0
- package/Tag/useTagProps.js +2 -0
- package/Tag/useTagProps.js.map +7 -0
- package/Transition/index.d.ts +31 -0
- package/Transition/index.js +2 -0
- package/Transition/index.js.map +7 -0
- package/Transition/variants.d.ts +131 -0
- package/Transition/variants.js +2 -0
- package/Transition/variants.js.map +7 -0
- package/breakpoint/index.d.ts +6 -0
- package/breakpoint/index.js +2 -0
- package/breakpoint/index.js.map +7 -0
- package/breakpoint/useBreakpoint.d.ts +10 -0
- package/breakpoint/useBreakpoint.js +2 -0
- package/breakpoint/useBreakpoint.js.map +7 -0
- package/breakpoint/useBreakpointProps.d.ts +6 -0
- package/breakpoint/useBreakpointProps.js +2 -0
- package/breakpoint/useBreakpointProps.js.map +7 -0
- package/cjs/ServerStyleTags.js +2 -0
- package/cjs/ServerStyleTags.js.map +7 -0
- package/cjs/Tag/cssPropList.js +2 -0
- package/cjs/Tag/cssPropList.js.map +7 -0
- package/cjs/Tag/index.js +2 -0
- package/cjs/Tag/index.js.map +7 -0
- package/cjs/Tag/types.js +2 -0
- package/cjs/Tag/types.js.map +7 -0
- package/cjs/Tag/useTagProps.js +2 -0
- package/cjs/Tag/useTagProps.js.map +7 -0
- package/cjs/Transition/index.js +2 -0
- package/cjs/Transition/index.js.map +7 -0
- package/cjs/Transition/variants.js +2 -0
- package/cjs/Transition/variants.js.map +7 -0
- package/cjs/breakpoint/index.js +2 -0
- package/cjs/breakpoint/index.js.map +7 -0
- package/cjs/breakpoint/useBreakpoint.js +2 -0
- package/cjs/breakpoint/useBreakpoint.js.map +7 -0
- package/cjs/breakpoint/useBreakpointProps.js +2 -0
- package/cjs/breakpoint/useBreakpointProps.js.map +7 -0
- package/cjs/css/aliases.js +2 -0
- package/cjs/css/aliases.js.map +7 -0
- package/cjs/css/getProps.js +2 -0
- package/cjs/css/getProps.js.map +7 -0
- package/cjs/css/getValue.js +2 -0
- package/cjs/css/getValue.js.map +7 -0
- package/cjs/css/index.js +2 -0
- package/cjs/css/index.js.map +7 -0
- package/cjs/css/types.js +2 -0
- package/cjs/css/types.js.map +7 -0
- package/cjs/index.js +2 -0
- package/cjs/index.js.map +7 -0
- package/cjs/isWindow.js +2 -0
- package/cjs/isWindow.js.map +7 -0
- package/cjs/theme/ThemeCssVars.js +2 -0
- package/cjs/theme/ThemeCssVars.js.map +7 -0
- package/cjs/theme/ThemeDefaultOptions.js +2 -0
- package/cjs/theme/ThemeDefaultOptions.js.map +7 -0
- package/cjs/theme/ThemeProvider.js +2 -0
- package/cjs/theme/ThemeProvider.js.map +7 -0
- package/cjs/theme/core.js +2 -0
- package/cjs/theme/core.js.map +7 -0
- package/cjs/theme/createColor.js +2 -0
- package/cjs/theme/createColor.js.map +7 -0
- package/cjs/theme/createTheme.js +2 -0
- package/cjs/theme/createTheme.js.map +7 -0
- package/cjs/theme/createThemeSwitcher.js +2 -0
- package/cjs/theme/createThemeSwitcher.js.map +7 -0
- package/cjs/theme/index.js +2 -0
- package/cjs/theme/index.js.map +7 -0
- package/cjs/theme/types.js +2 -0
- package/cjs/theme/types.js.map +7 -0
- package/cjs/useAnimation.js +2 -0
- package/cjs/useAnimation.js.map +7 -0
- package/cjs/useColorTemplate.js +2 -0
- package/cjs/useColorTemplate.js.map +7 -0
- package/cjs/useInterface.js +2 -0
- package/cjs/useInterface.js.map +7 -0
- package/css/aliases.d.ts +4 -0
- package/css/aliases.js +2 -0
- package/css/aliases.js.map +7 -0
- package/css/getProps.d.ts +3 -0
- package/css/getProps.js +2 -0
- package/css/getProps.js.map +7 -0
- package/css/getValue.d.ts +3 -0
- package/css/getValue.js +2 -0
- package/css/getValue.js.map +7 -0
- package/css/index.d.ts +15 -0
- package/css/index.js +2 -0
- package/css/index.js.map +7 -0
- package/{src/css/types.ts → css/types.d.ts} +16 -22
- package/css/types.js +1 -0
- package/css/types.js.map +7 -0
- package/index.d.ts +21 -0
- package/index.js +2 -0
- package/index.js.map +7 -0
- package/isWindow.d.ts +2 -0
- package/isWindow.js +2 -0
- package/isWindow.js.map +7 -0
- package/package.json +43 -49
- package/theme/ThemeCssVars.d.ts +3 -0
- package/theme/ThemeCssVars.js +2 -0
- package/theme/ThemeCssVars.js.map +7 -0
- package/theme/ThemeDefaultOptions.d.ts +68 -0
- package/theme/ThemeDefaultOptions.js +2 -0
- package/theme/ThemeDefaultOptions.js.map +7 -0
- package/theme/ThemeProvider.d.ts +11 -0
- package/theme/ThemeProvider.js +2 -0
- package/theme/ThemeProvider.js.map +7 -0
- package/theme/core.d.ts +7 -0
- package/theme/core.js +2 -0
- package/theme/core.js.map +7 -0
- package/theme/createColor.d.ts +41 -0
- package/theme/createColor.js +2 -0
- package/theme/createColor.js.map +7 -0
- package/theme/createTheme.d.ts +2 -0
- package/theme/createTheme.js +2 -0
- package/theme/createTheme.js.map +7 -0
- package/theme/createThemeSwitcher.d.ts +6 -0
- package/theme/createThemeSwitcher.js +2 -0
- package/theme/createThemeSwitcher.js.map +7 -0
- package/theme/index.d.ts +5 -0
- package/theme/index.js +2 -0
- package/theme/index.js.map +7 -0
- package/{src/theme/types.ts → theme/types.d.ts} +46 -103
- package/theme/types.js +1 -0
- package/theme/types.js.map +7 -0
- package/useAnimation.d.ts +18 -0
- package/useAnimation.js +2 -0
- package/useAnimation.js.map +7 -0
- package/useColorTemplate.d.ts +4 -0
- package/useColorTemplate.js +2 -0
- package/useColorTemplate.js.map +7 -0
- package/useInterface.d.ts +2 -0
- package/useInterface.js +2 -0
- package/useInterface.js.map +7 -0
- package/main.tsx +0 -97
- package/src/ServerStyleTags.tsx +0 -12
- package/src/Tag/cssPropList.ts +0 -191
- package/src/Tag/index.tsx +0 -11
- package/src/Tag/useTagProps.ts +0 -28
- package/src/Transition/index.tsx +0 -148
- package/src/Transition/variants.ts +0 -178
- package/src/breakpoint/index.tsx +0 -52
- package/src/breakpoint/useBreakpoint.ts +0 -31
- package/src/breakpoint/useBreakpointProps.ts +0 -57
- package/src/css/aliases.ts +0 -35
- package/src/css/getProps.ts +0 -38
- package/src/css/getValue.ts +0 -117
- package/src/css/index.ts +0 -78
- package/src/index.ts +0 -34
- package/src/isWindow.ts +0 -3
- package/src/theme/ThemeCssVars.ts +0 -107
- package/src/theme/ThemeDefaultOptions.ts +0 -146
- package/src/theme/ThemeProvider.tsx +0 -140
- package/src/theme/core.ts +0 -21
- package/src/theme/createColor.ts +0 -53
- package/src/theme/createTheme.ts +0 -33
- package/src/theme/createThemeSwitcher.ts +0 -18
- package/src/theme/index.tsx +0 -17
- package/src/useAnimation.ts +0 -40
- package/src/useColorTemplate.ts +0 -11
- package/src/useInterface.ts +0 -13
- package/tsconfig.json +0 -28
package/src/css/aliases.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { OptionAliases } from 'oncss'
|
|
2
|
-
import { Aliases } from './types'
|
|
3
|
-
|
|
4
|
-
const isStr = (v: any, or: any) => typeof v === 'string' ? v : or
|
|
5
|
-
|
|
6
|
-
const aliases: OptionAliases<Aliases> = {
|
|
7
|
-
bgcolor: (v) => ({ backgroundColor: v }),
|
|
8
|
-
bgimage: (v) => ({ backgroundImage: `url(${v})`, backgroundSize: "cover", backgroundRepeat: "no-repeat" }),
|
|
9
|
-
bg: (v) => ({ background: v }),
|
|
10
|
-
p: (v) => ({ padding: isStr(v, 8 * v) }),
|
|
11
|
-
pt: (v) => ({ paddingTop: isStr(v, 8 * v) }),
|
|
12
|
-
pr: (v) => ({ paddingRight: isStr(v, 8 * v) }),
|
|
13
|
-
pb: (v) => ({ paddingBottom: isStr(v, 8 * v) }),
|
|
14
|
-
pl: (v) => ({ paddingLeft: isStr(v, 8 * v) }),
|
|
15
|
-
px: (v) => ({ paddingLeft: isStr(v, 8 * v), paddingRight: isStr(v, 8 * v) }),
|
|
16
|
-
py: (v) => ({ paddingTop: isStr(v, 8 * v), paddingBottom: isStr(v, 8 * v) }),
|
|
17
|
-
m: (v) => ({ margin: isStr(v, 8 * v) }),
|
|
18
|
-
mt: (v) => ({ marginTop: isStr(v, 8 * v) }),
|
|
19
|
-
mr: (v) => ({ marginRight: isStr(v, 8 * v) }),
|
|
20
|
-
mb: (v) => ({ marginBottom: isStr(v, 8 * v) }),
|
|
21
|
-
ml: (v) => ({ marginLeft: isStr(v, 8 * v) }),
|
|
22
|
-
mx: (v) => ({ marginLeft: isStr(v, 8 * v), marginRight: isStr(v, 8 * v) }),
|
|
23
|
-
my: (v) => ({ marginTop: isStr(v, 8 * v), marginBottom: isStr(v, 8 * v) }),
|
|
24
|
-
radius: (v) => ({ borderRadius: isStr(v, 8 * v) }),
|
|
25
|
-
borderRadius: (v) => ({ borderRadius: isStr(v, 8 * v) }),
|
|
26
|
-
shadow: (v) => ({ boxShadow: v }),
|
|
27
|
-
flexBox: (v) => (v ? { display: "flex" } : {}),
|
|
28
|
-
flexRow: (v) => (v ? { flexDirection: "row" } : {}),
|
|
29
|
-
flexColumn: (v) => (v ? { flexDirection: "column" } : {}),
|
|
30
|
-
flexWraped: (v) => (v ? { flexWrap: "wrap" } : {}),
|
|
31
|
-
direction: (v) => (v === 'row' || v === 'column' ? { flexDirection: v } : { direction: v }),
|
|
32
|
-
gap: (v) => ({ gap: isStr(v, 8 * v) }),
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default aliases
|
package/src/css/getProps.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { CSSProps } from "./types";
|
|
2
|
-
|
|
3
|
-
const getProps = (prop: string, value: string, _css: CSSProps) => {
|
|
4
|
-
let important;
|
|
5
|
-
if (typeof value === 'string') {
|
|
6
|
-
const split = value.split("!")
|
|
7
|
-
important = split[1] ? "!important" : ""
|
|
8
|
-
value = split[0]
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (prop === 'disabled') {
|
|
12
|
-
if ((value as any) === true) {
|
|
13
|
-
return {
|
|
14
|
-
pointerEvents: "none!important",
|
|
15
|
-
cursor: "default!important",
|
|
16
|
-
userSelect: "none!important",
|
|
17
|
-
opacity: ".8!important"
|
|
18
|
-
} as any
|
|
19
|
-
}
|
|
20
|
-
return {}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (value && typeof value === "number" && ["border", "borderRight", "borderLeft", "borderTop", "borderBottom"].includes(prop as any)) {
|
|
24
|
-
const keys: any = Object.keys(_css)
|
|
25
|
-
let p: any = {
|
|
26
|
-
[`${prop}Width`]: value + 'px' + (important || ""),
|
|
27
|
-
}
|
|
28
|
-
if (!keys.includes(`${prop}Color`)) {
|
|
29
|
-
p[`${prop}Color`] = "divider"
|
|
30
|
-
}
|
|
31
|
-
if (!keys.includes(`${prop}Style`)) {
|
|
32
|
-
p[`${prop}Style`] = "solid"
|
|
33
|
-
}
|
|
34
|
-
return p
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default getProps
|
package/src/css/getValue.ts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { CSSProps } from "./types"
|
|
2
|
-
|
|
3
|
-
const getColor = (color: string) => {
|
|
4
|
-
return {
|
|
5
|
-
[`${color}`]: `var(--color-${color}-primary)`,
|
|
6
|
-
[`${color}.primary`]: `var(--color-${color}-primary)`,
|
|
7
|
-
[`${color}.secondary`]: `var(--color-${color}-secondary)`,
|
|
8
|
-
[`${color}.text`]: `var(--color-${color}-text)`,
|
|
9
|
-
[`${color}.alpha`]: `var(--color-${color}-alpha)`
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const withImportant = (important: any, value: any) => important ? value + important : value
|
|
14
|
-
const colors: any = {
|
|
15
|
-
"text": `var(--color-text-primary)`,
|
|
16
|
-
"text.primary": `var(--color-text-primary)`,
|
|
17
|
-
"text.secondary": `var(--color-text-secondary)`,
|
|
18
|
-
|
|
19
|
-
"background": `var(--color-background-primary)`,
|
|
20
|
-
"background.primary": `var(--color-background-primary)`,
|
|
21
|
-
"background.secondary": `var(--color-background-secondary)`,
|
|
22
|
-
"background.alpha": `var(--color-background-alpha)`,
|
|
23
|
-
"divider": `var(--color-divider)`,
|
|
24
|
-
|
|
25
|
-
...getColor("brand"),
|
|
26
|
-
...getColor("accent"),
|
|
27
|
-
...getColor("info"),
|
|
28
|
-
...getColor("success"),
|
|
29
|
-
...getColor("warning"),
|
|
30
|
-
...getColor("danger"),
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const breakpoints: any = {
|
|
34
|
-
"xs": "var(--bp-xs)",
|
|
35
|
-
"sm": "var(--bp-sm)",
|
|
36
|
-
"md": "var(--bp-md)",
|
|
37
|
-
"lg": "var(--bp-lg)",
|
|
38
|
-
"xl": "var(--bp-xl)"
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let fontsizes: any = {
|
|
42
|
-
"h1": "var(--fontsize-h1)",
|
|
43
|
-
"h2": "var(--fontsize-h2)",
|
|
44
|
-
"h3": "var(--fontsize-h3)",
|
|
45
|
-
"h4": "var(--fontsize-h4)",
|
|
46
|
-
"h5": "var(--fontsize-h5)",
|
|
47
|
-
"h6": "var(--fontsize-h6)",
|
|
48
|
-
"text": "var(--fontsize-text)",
|
|
49
|
-
"button": "var(--fontsize-button)",
|
|
50
|
-
"small": "var(--fontsize-small)"
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let lineHeights: any = {
|
|
54
|
-
"h1": "var(--lineheight-h1)",
|
|
55
|
-
"h2": "var(--lineheight-h2)",
|
|
56
|
-
"h3": "var(--lineheight-h3)",
|
|
57
|
-
"h4": "var(--lineheight-h4)",
|
|
58
|
-
"h5": "var(--lineheight-h5)",
|
|
59
|
-
"h6": "var(--lineheight-h6)",
|
|
60
|
-
"text": "var(--lineheight-text)",
|
|
61
|
-
"button": "var(--lineheight-button)",
|
|
62
|
-
"small": "var(--lineheight-small)"
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
let fontWeights: any = {
|
|
66
|
-
"h1": "var(--fontweight-h1)",
|
|
67
|
-
"h2": "var(--fontweight-h2)",
|
|
68
|
-
"h3": "var(--fontweight-h3)",
|
|
69
|
-
"h4": "var(--fontweight-h4)",
|
|
70
|
-
"h5": "var(--fontweight-h5)",
|
|
71
|
-
"h6": "var(--fontweight-h6)",
|
|
72
|
-
"text": "var(--fontweight-text)",
|
|
73
|
-
"button": "var(--fontweight-button)",
|
|
74
|
-
"small": "var(--fontweight-small)"
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
let font: any = {
|
|
78
|
-
"h1": "var(--font-h1)",
|
|
79
|
-
"h2": "var(--font-h2)",
|
|
80
|
-
"h3": "var(--font-h3)",
|
|
81
|
-
"h4": "var(--font-h4)",
|
|
82
|
-
"h5": "var(--font-h5)",
|
|
83
|
-
"h6": "var(--font-h6)",
|
|
84
|
-
"text": "var(--font-text)",
|
|
85
|
-
"button": "var(--font-button)",
|
|
86
|
-
"small": "var(--font-small)"
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const getValue = (prop: any, value: string | number, _css: CSSProps): any => {
|
|
90
|
-
let important;
|
|
91
|
-
|
|
92
|
-
if (typeof value === 'string') {
|
|
93
|
-
const split = value.split("!")
|
|
94
|
-
important = split[1] ? "!important" : ""
|
|
95
|
-
value = split[0]
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (['width', 'maxWidth', 'minWidth', 'max-width', 'min-width'].includes(prop)) {
|
|
99
|
-
return withImportant(important, breakpoints[value] || value)
|
|
100
|
-
} else if (['fontFamily', 'font-family'].includes(prop) && value === 'default') {
|
|
101
|
-
return withImportant(important, "var(--font-family)")
|
|
102
|
-
} if (prop === 'font' && typeof value === "string" && ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'text', 'button', 'small'].includes(value)) {
|
|
103
|
-
return withImportant(important, font[value] || value)
|
|
104
|
-
} if (['fontWeight', 'font-weight'].includes(prop) && typeof value === 'string' && ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'text', 'button', 'small'].includes(value)) {
|
|
105
|
-
return withImportant(important, fontWeights[value] || value)
|
|
106
|
-
} else if (['lineHeight', 'line-height'].includes(prop) && typeof value === 'string' && ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'text', 'button', 'small'].includes(value)) {
|
|
107
|
-
return withImportant(important, lineHeights[value] || value)
|
|
108
|
-
} else if (['fontSize', 'font-size'].includes(prop) && typeof value === 'string') {
|
|
109
|
-
return withImportant(important, fontsizes[value] || value)
|
|
110
|
-
} else if (typeof value === "number" && ["shadow", "boxShadow"].includes(prop)) {
|
|
111
|
-
return withImportant(important, `var(--shadow-${value})`)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return withImportant(important, colors[value] || value)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export default getValue
|
package/src/css/index.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import getValue from "./getValue"
|
|
2
|
-
import getProps from "./getProps"
|
|
3
|
-
import aliases from "./aliases"
|
|
4
|
-
import { Aliases, BreakpointKeys, CSSOptionProps, CSSProps } from './types'
|
|
5
|
-
import { css as _css } from "oncss"
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
getValue,
|
|
9
|
-
getProps
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const breakpoints = {
|
|
13
|
-
xs: 0,
|
|
14
|
-
sm: 600,
|
|
15
|
-
md: 900,
|
|
16
|
-
lg: 1200,
|
|
17
|
-
xl: 1536
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const css = (props: CSSProps, options?: CSSOptionProps) => {
|
|
21
|
-
const cssOptions: CSSOptionProps = {
|
|
22
|
-
...options,
|
|
23
|
-
breakpoints,
|
|
24
|
-
aliases,
|
|
25
|
-
getValue: (p: any, v: any, _c: any, dept) => {
|
|
26
|
-
if (options?.getValue) {
|
|
27
|
-
let _val = options?.getValue(p, v, _c, dept)
|
|
28
|
-
if (_val) return _val
|
|
29
|
-
}
|
|
30
|
-
return getValue(p, v, _c)
|
|
31
|
-
},
|
|
32
|
-
getProps: (p: any, v: any, _c: any, dept) => {
|
|
33
|
-
if (options?.getProps) {
|
|
34
|
-
let _p = options?.getProps(p, v, _c, dept)
|
|
35
|
-
if (_p) return _p
|
|
36
|
-
}
|
|
37
|
-
return getProps(p, v, _c)
|
|
38
|
-
},
|
|
39
|
-
}
|
|
40
|
-
return _css<Aliases, BreakpointKeys>(props, cssOptions)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const adjustColor = (hex: string, factor: number) => {
|
|
44
|
-
|
|
45
|
-
hex = hex.replace(/^#/, '')
|
|
46
|
-
|
|
47
|
-
let r = parseInt(hex.slice(0, 2), 16)
|
|
48
|
-
let g = parseInt(hex.slice(2, 4), 16)
|
|
49
|
-
let b = parseInt(hex.slice(4, 6), 16)
|
|
50
|
-
|
|
51
|
-
r = Math.floor(r * factor)
|
|
52
|
-
g = Math.floor(g * factor)
|
|
53
|
-
b = Math.floor(b * factor)
|
|
54
|
-
|
|
55
|
-
r = Math.min(255, Math.max(0, r))
|
|
56
|
-
g = Math.min(255, Math.max(0, g))
|
|
57
|
-
b = Math.min(255, Math.max(0, b))
|
|
58
|
-
|
|
59
|
-
return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export const adjustTextContrast = (color: string) => {
|
|
63
|
-
color = color.replace(/^#/, '')
|
|
64
|
-
const r = parseInt(color.slice(0, 2), 16);
|
|
65
|
-
const g = parseInt(color.slice(2, 4), 16);
|
|
66
|
-
const b = parseInt(color.slice(4, 6), 16);
|
|
67
|
-
|
|
68
|
-
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
69
|
-
return luminance > 0.5 ? '#111111' : '#FFFFFF';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export const alpha = (color: string, opacity = 1) => {
|
|
73
|
-
if (typeof opacity !== 'number') return color
|
|
74
|
-
let _opacity = opacity * 100
|
|
75
|
-
if (!color.startsWith("#")) throw new Error(`color must be hex`)
|
|
76
|
-
return (color + (`0${Math.round((255 / 100) * _opacity).toString(16)}`.slice(-2))).toUpperCase();
|
|
77
|
-
};
|
|
78
|
-
|
package/src/index.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import Tag from './Tag'
|
|
2
|
-
import useTagProps from './Tag/useTagProps'
|
|
3
|
-
import useAnimation from './useAnimation'
|
|
4
|
-
import useColorTemplate from './useColorTemplate'
|
|
5
|
-
import useBreakpoint from './breakpoint/useBreakpoint'
|
|
6
|
-
import useBreakpointProps from './breakpoint/useBreakpointProps'
|
|
7
|
-
import ServerStyleTags from './ServerStyleTags'
|
|
8
|
-
import isWindow from './isWindow'
|
|
9
|
-
import useInterface from './useInterface'
|
|
10
|
-
import Transition from './Transition'
|
|
11
|
-
|
|
12
|
-
export * from './css'
|
|
13
|
-
export * from "./theme"
|
|
14
|
-
export * from './css/types'
|
|
15
|
-
export * from './Tag/types'
|
|
16
|
-
export * from './theme/types'
|
|
17
|
-
export * from './useColorTemplate'
|
|
18
|
-
export * from './useAnimation'
|
|
19
|
-
export type * from './Transition'
|
|
20
|
-
export type * from './Tag/types'
|
|
21
|
-
export type { useBreakpointPropsType } from './breakpoint/useBreakpointProps'
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
Tag,
|
|
25
|
-
useTagProps,
|
|
26
|
-
useAnimation,
|
|
27
|
-
Transition,
|
|
28
|
-
useColorTemplate,
|
|
29
|
-
ServerStyleTags,
|
|
30
|
-
useBreakpoint,
|
|
31
|
-
useBreakpointProps,
|
|
32
|
-
isWindow,
|
|
33
|
-
useInterface
|
|
34
|
-
}
|
package/src/isWindow.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { ThemeOptions } from "./types";
|
|
2
|
-
|
|
3
|
-
const ThemeCssVars = (theme: ThemeOptions) => {
|
|
4
|
-
|
|
5
|
-
const shadows: any = {}
|
|
6
|
-
theme.shadow.forEach((s, i) => shadows[`--shadow-${i}`] = s)
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
"--bp-xs": theme.breakpoints.xs,
|
|
10
|
-
"--bp-sm": theme.breakpoints.sm,
|
|
11
|
-
"--bp-md": theme.breakpoints.md,
|
|
12
|
-
"--bp-lg": theme.breakpoints.lg,
|
|
13
|
-
"--bp-xl": theme.breakpoints.xl,
|
|
14
|
-
|
|
15
|
-
"--font-family": theme.typography.fontFamily,
|
|
16
|
-
"--font-h1": `${theme.typography.h1.fontWeight} ${theme.typography.h1.fontSize}px/${theme.typography.h1.lineHeight} ${theme.typography.fontFamily}`,
|
|
17
|
-
"--font-h2": `${theme.typography.h2.fontWeight} ${theme.typography.h2.fontSize}px/${theme.typography.h2.lineHeight} ${theme.typography.fontFamily}`,
|
|
18
|
-
"--font-h3": `${theme.typography.h3.fontWeight} ${theme.typography.h3.fontSize}px/${theme.typography.h3.lineHeight} ${theme.typography.fontFamily}`,
|
|
19
|
-
"--font-h4": `${theme.typography.h4.fontWeight} ${theme.typography.h4.fontSize}px/${theme.typography.h4.lineHeight} ${theme.typography.fontFamily}`,
|
|
20
|
-
"--font-h5": `${theme.typography.h5.fontWeight} ${theme.typography.h5.fontSize}px/${theme.typography.h5.lineHeight} ${theme.typography.fontFamily}`,
|
|
21
|
-
"--font-h6": `${theme.typography.h6.fontWeight} ${theme.typography.h6.fontSize}px/${theme.typography.h6.lineHeight} ${theme.typography.fontFamily}`,
|
|
22
|
-
"--font-text": `${theme.typography.text.fontWeight} ${theme.typography.text.fontSize}px/${theme.typography.text.lineHeight} ${theme.typography.fontFamily}`,
|
|
23
|
-
"--font-button": `${theme.typography.button.fontWeight} ${theme.typography.button.fontSize}px/${theme.typography.button.lineHeight} ${theme.typography.fontFamily}`,
|
|
24
|
-
"--font-small": `${theme.typography.small.fontWeight} ${theme.typography.small.fontSize}px/${theme.typography.small.lineHeight} ${theme.typography.fontFamily}`,
|
|
25
|
-
|
|
26
|
-
"--fontsize-h1": `${theme.typography.h1.fontSize}px`,
|
|
27
|
-
"--fontsize-h2": `${theme.typography.h2.fontSize}px`,
|
|
28
|
-
"--fontsize-h3": `${theme.typography.h3.fontSize}px`,
|
|
29
|
-
"--fontsize-h4": `${theme.typography.h4.fontSize}px`,
|
|
30
|
-
"--fontsize-h5": `${theme.typography.h5.fontSize}px`,
|
|
31
|
-
"--fontsize-h6": `${theme.typography.h6.fontSize}px`,
|
|
32
|
-
"--fontsize-text": `${theme.typography.text.fontSize}px`,
|
|
33
|
-
"--fontsize-button": `${theme.typography.button.fontSize}px`,
|
|
34
|
-
"--fontsize-small": `${theme.typography.small.fontSize}px`,
|
|
35
|
-
|
|
36
|
-
"--fontweight-h1": theme.typography.h1.fontWeight + "",
|
|
37
|
-
"--fontweight-h2": theme.typography.h2.fontWeight + "",
|
|
38
|
-
"--fontweight-h3": theme.typography.h3.fontWeight + "",
|
|
39
|
-
"--fontweight-h4": theme.typography.h4.fontWeight + "",
|
|
40
|
-
"--fontweight-h5": theme.typography.h5.fontWeight + "",
|
|
41
|
-
"--fontweight-h6": theme.typography.h6.fontWeight + "",
|
|
42
|
-
"--fontweight-text": theme.typography.text.fontWeight + "",
|
|
43
|
-
"--fontweight-button": theme.typography.button.fontWeight + "",
|
|
44
|
-
"--fontweight-small": theme.typography.small.fontWeight + "",
|
|
45
|
-
|
|
46
|
-
"--lineheight-h1": theme.typography.h1.lineHeight + "",
|
|
47
|
-
"--lineheight-h2": theme.typography.h2.lineHeight + "",
|
|
48
|
-
"--lineheight-h3": theme.typography.h3.lineHeight + "",
|
|
49
|
-
"--lineheight-h4": theme.typography.h4.lineHeight + "",
|
|
50
|
-
"--lineheight-h5": theme.typography.h5.lineHeight + "",
|
|
51
|
-
"--lineheight-h6": theme.typography.h6.lineHeight + "",
|
|
52
|
-
"--lineheight-text": theme.typography.text.lineHeight + "",
|
|
53
|
-
"--lineheight-button": theme.typography.button.lineHeight + "",
|
|
54
|
-
"--lineheight-small": theme.typography.small.lineHeight + "",
|
|
55
|
-
|
|
56
|
-
"--color-text": theme.colors.text.primary,
|
|
57
|
-
"--color-text-primary": theme.colors.text.primary,
|
|
58
|
-
"--color-text-secondary": theme.colors.text.secondary,
|
|
59
|
-
|
|
60
|
-
"--color-background": theme.colors.background.primary,
|
|
61
|
-
"--color-background-primary": theme.colors.background.primary,
|
|
62
|
-
"--color-background-secondary": theme.colors.background.secondary,
|
|
63
|
-
"--color-background-alpha": theme.colors.background.alpha,
|
|
64
|
-
|
|
65
|
-
"--color-divider": theme.colors.divider,
|
|
66
|
-
|
|
67
|
-
"--color-brand": theme.colors.brand.primary,
|
|
68
|
-
"--color-brand-primary": theme.colors.brand.primary,
|
|
69
|
-
"--color-brand-secondary": theme.colors.brand.secondary,
|
|
70
|
-
"--color-brand-alpha": theme.colors.brand.alpha,
|
|
71
|
-
"--color-brand-text": theme.colors.brand.text,
|
|
72
|
-
|
|
73
|
-
"--color-accent": theme.colors.accent.primary,
|
|
74
|
-
"--color-accent-primary": theme.colors.accent.primary,
|
|
75
|
-
"--color-accent-secondary": theme.colors.accent.secondary,
|
|
76
|
-
"--color-accent-alpha": theme.colors.accent.alpha,
|
|
77
|
-
"--color-accent-text": theme.colors.accent.text,
|
|
78
|
-
|
|
79
|
-
"--color-info": theme.colors.info.primary,
|
|
80
|
-
"--color-info-primary": theme.colors.info.primary,
|
|
81
|
-
"--color-info-secondary": theme.colors.info.secondary,
|
|
82
|
-
"--color-info-alpha": theme.colors.info.alpha,
|
|
83
|
-
"--color-info-text": theme.colors.info.text,
|
|
84
|
-
|
|
85
|
-
"--color-success": theme.colors.success.primary,
|
|
86
|
-
"--color-success-primary": theme.colors.success.primary,
|
|
87
|
-
"--color-success-secondary": theme.colors.success.secondary,
|
|
88
|
-
"--color-success-alpha": theme.colors.success.alpha,
|
|
89
|
-
"--color-success-text": theme.colors.success.text,
|
|
90
|
-
|
|
91
|
-
"--color-warning": theme.colors.warning.primary,
|
|
92
|
-
"--color-warning-primary": theme.colors.warning.primary,
|
|
93
|
-
"--color-warning-secondary": theme.colors.warning.secondary,
|
|
94
|
-
"--color-warning-alpha": theme.colors.warning.alpha,
|
|
95
|
-
"--color-warning-text": theme.colors.warning.text,
|
|
96
|
-
|
|
97
|
-
"--color-danger": theme.colors.danger.primary,
|
|
98
|
-
"--color-danger-primary": theme.colors.danger.primary,
|
|
99
|
-
"--color-danger-secondary": theme.colors.danger.secondary,
|
|
100
|
-
"--color-danger-alpha": theme.colors.danger.alpha,
|
|
101
|
-
"--color-danger-text": theme.colors.danger.text,
|
|
102
|
-
...shadows,
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
export default ThemeCssVars
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { ThemeOptionInput, ThemeTypographyType } from './types'
|
|
2
|
-
|
|
3
|
-
export const lightColorPallete = {
|
|
4
|
-
text: {
|
|
5
|
-
primary: "#212B36",
|
|
6
|
-
secondary: "#637381",
|
|
7
|
-
},
|
|
8
|
-
background: {
|
|
9
|
-
primary: "#FFFFFF",
|
|
10
|
-
secondary: "#EDEFF7",
|
|
11
|
-
},
|
|
12
|
-
divider: "#DADCE0"
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const darkColorPallete = {
|
|
16
|
-
text: {
|
|
17
|
-
primary: "#FFFFFF",
|
|
18
|
-
secondary: "#C4CDD5",
|
|
19
|
-
},
|
|
20
|
-
background: {
|
|
21
|
-
primary: "#272727",
|
|
22
|
-
secondary: "#1E1E1E",
|
|
23
|
-
},
|
|
24
|
-
divider: "#3D3D3D"
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const ThemeColors = {
|
|
28
|
-
...lightColorPallete,
|
|
29
|
-
brand: {
|
|
30
|
-
primary: "#3b82f6",
|
|
31
|
-
secondary: "#60a5fa",
|
|
32
|
-
text: "#FFFFFF"
|
|
33
|
-
},
|
|
34
|
-
accent: {
|
|
35
|
-
primary: "#14b8a6",
|
|
36
|
-
secondary: "#2dd4bf",
|
|
37
|
-
text: "#FFFFFF"
|
|
38
|
-
},
|
|
39
|
-
info: {
|
|
40
|
-
primary: "#0ea5e9",
|
|
41
|
-
secondary: "#60a5fa",
|
|
42
|
-
text: "#FFFFFF"
|
|
43
|
-
},
|
|
44
|
-
success: {
|
|
45
|
-
primary: "#22c55e",
|
|
46
|
-
secondary: "#4ade80",
|
|
47
|
-
text: "#FFFFFF"
|
|
48
|
-
},
|
|
49
|
-
warning: {
|
|
50
|
-
primary: "#f59e0b",
|
|
51
|
-
secondary: "#fbbf24",
|
|
52
|
-
text: "#FFFFFF"
|
|
53
|
-
},
|
|
54
|
-
danger: {
|
|
55
|
-
primary: "#ef4444",
|
|
56
|
-
secondary: "#f87171",
|
|
57
|
-
text: "#FFFFFF"
|
|
58
|
-
},
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export const ThemeTypography: ThemeTypographyType = {
|
|
62
|
-
fontFamily: '"Inter",sans-serif,"Helvetica","Arial"',
|
|
63
|
-
h1: {
|
|
64
|
-
fontSize: 47.78,
|
|
65
|
-
lineHeight: 1.3,
|
|
66
|
-
fontWeight: 400,
|
|
67
|
-
},
|
|
68
|
-
h2: {
|
|
69
|
-
fontSize: 39.81,
|
|
70
|
-
lineHeight: 1.35,
|
|
71
|
-
fontWeight: 400,
|
|
72
|
-
},
|
|
73
|
-
h3: {
|
|
74
|
-
fontSize: 33.18,
|
|
75
|
-
lineHeight: 1.4,
|
|
76
|
-
fontWeight: 400,
|
|
77
|
-
},
|
|
78
|
-
h4: {
|
|
79
|
-
fontSize: 27.65,
|
|
80
|
-
lineHeight: 1.45,
|
|
81
|
-
fontWeight: 400,
|
|
82
|
-
},
|
|
83
|
-
h5: {
|
|
84
|
-
fontSize: 27.65,
|
|
85
|
-
lineHeight: 1.5,
|
|
86
|
-
fontWeight: 400,
|
|
87
|
-
},
|
|
88
|
-
h6: {
|
|
89
|
-
fontSize: 23.04,
|
|
90
|
-
lineHeight: 1.55,
|
|
91
|
-
fontWeight: 400,
|
|
92
|
-
},
|
|
93
|
-
text: {
|
|
94
|
-
fontSize: 16,
|
|
95
|
-
lineHeight: 1.6,
|
|
96
|
-
fontWeight: 400,
|
|
97
|
-
},
|
|
98
|
-
button: {
|
|
99
|
-
fontSize: 13.33,
|
|
100
|
-
lineHeight: 1.6,
|
|
101
|
-
fontWeight: 500,
|
|
102
|
-
},
|
|
103
|
-
small: {
|
|
104
|
-
fontSize: 12.33,
|
|
105
|
-
lineHeight: 1.6,
|
|
106
|
-
fontWeight: 400,
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export const shadow = [
|
|
111
|
-
"none",
|
|
112
|
-
"0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12)",
|
|
113
|
-
"0px 3px 1px -2px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 1px 5px 0px rgba(0,0,0,0.12)",
|
|
114
|
-
"0px 3px 3px -2px rgba(0,0,0,0.2),0px 3px 4px 0px rgba(0,0,0,0.14),0px 1px 8px 0px rgba(0,0,0,0.12)",
|
|
115
|
-
"0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)",
|
|
116
|
-
"0px 3px 5px -1px rgba(0,0,0,0.2),0px 5px 8px 0px rgba(0,0,0,0.14),0px 1px 14px 0px rgba(0,0,0,0.12)",
|
|
117
|
-
"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)",
|
|
118
|
-
"0px 4px 5px -2px rgba(0,0,0,0.2),0px 7px 10px 1px rgba(0,0,0,0.14),0px 2px 16px 1px rgba(0,0,0,0.12)",
|
|
119
|
-
"0px 5px 5px -3px rgba(0,0,0,0.2),0px 8px 10px 1px rgba(0,0,0,0.14),0px 3px 14px 2px rgba(0,0,0,0.12)",
|
|
120
|
-
"0px 5px 6px -3px rgba(0,0,0,0.2),0px 9px 12px 1px rgba(0,0,0,0.14),0px 3px 16px 2px rgba(0,0,0,0.12)",
|
|
121
|
-
"0px 6px 6px -3px rgba(0,0,0,0.2),0px 10px 14px 1px rgba(0,0,0,0.14),0px 4px 18px 3px rgba(0,0,0,0.12)",
|
|
122
|
-
"0px 6px 7px -4px rgba(0,0,0,0.2),0px 11px 15px 1px rgba(0,0,0,0.14),0px 4px 20px 3px rgba(0,0,0,0.12)",
|
|
123
|
-
"0px 7px 8px -4px rgba(0,0,0,0.2),0px 12px 17px 2px rgba(0,0,0,0.14),0px 5px 22px 4px rgba(0,0,0,0.12)",
|
|
124
|
-
"0px 7px 8px -4px rgba(0,0,0,0.2),0px 13px 19px 2px rgba(0,0,0,0.14),0px 5px 24px 4px rgba(0,0,0,0.12)",
|
|
125
|
-
"0px 7px 9px -4px rgba(0,0,0,0.2),0px 14px 21px 2px rgba(0,0,0,0.14),0px 5px 26px 4px rgba(0,0,0,0.12)",
|
|
126
|
-
"0px 8px 9px -5px rgba(0,0,0,0.2),0px 15px 22px 2px rgba(0,0,0,0.14),0px 6px 28px 5px rgba(0,0,0,0.12)",
|
|
127
|
-
"0px 8px 10px -5px rgba(0,0,0,0.2),0px 16px 24px 2px rgba(0,0,0,0.14),0px 6px 30px 5px rgba(0,0,0,0.12)",
|
|
128
|
-
"0px 8px 11px -5px rgba(0,0,0,0.2),0px 17px 26px 2px rgba(0,0,0,0.14),0px 6px 32px 5px rgba(0,0,0,0.12)",
|
|
129
|
-
"0px 9px 11px -5px rgba(0,0,0,0.2),0px 18px 28px 2px rgba(0,0,0,0.14),0px 7px 34px 6px rgba(0,0,0,0.12)",
|
|
130
|
-
"0px 9px 12px -6px rgba(0,0,0,0.2),0px 19px 29px 2px rgba(0,0,0,0.14),0px 7px 36px 6px rgba(0,0,0,0.12)",
|
|
131
|
-
"0px 10px 13px -6px rgba(0,0,0,0.2),0px 20px 31px 3px rgba(0,0,0,0.14),0px 8px 38px 7px rgba(0,0,0,0.12)",
|
|
132
|
-
"0px 10px 13px -6px rgba(0,0,0,0.2),0px 21px 33px 3px rgba(0,0,0,0.14),0px 8px 40px 7px rgba(0,0,0,0.12)",
|
|
133
|
-
"0px 10px 14px -6px rgba(0,0,0,0.2),0px 22px 35px 3px rgba(0,0,0,0.14),0px 8px 42px 7px rgba(0,0,0,0.12)",
|
|
134
|
-
"0px 11px 14px -7px rgba(0,0,0,0.2),0px 23px 36px 3px rgba(0,0,0,0.14),0px 9px 44px 8px rgba(0,0,0,0.12)",
|
|
135
|
-
"0px 11px 15px -7px rgba(0,0,0,0.2),0px 24px 38px 3px rgba(0,0,0,0.14),0px 9px 46px 8px rgba(0,0,0,0.12)",
|
|
136
|
-
]
|
|
137
|
-
|
|
138
|
-
export default {
|
|
139
|
-
name: "light",
|
|
140
|
-
rtl: false,
|
|
141
|
-
shadow,
|
|
142
|
-
globalStyle: {},
|
|
143
|
-
colors: ThemeColors,
|
|
144
|
-
typography: ThemeTypography,
|
|
145
|
-
interfaces: {}
|
|
146
|
-
} as ThemeOptionInput
|