@xanui/core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ServerStyleTags.d.ts +3 -0
- package/ServerStyleTags.js +17 -0
- package/ServerStyleTags.js.map +7 -0
- package/Tag/cssPropList.d.ts +2 -0
- package/Tag/cssPropList.js +190 -0
- package/Tag/cssPropList.js.map +7 -0
- package/Tag/index.d.ts +6 -0
- package/Tag/index.js +12 -0
- package/Tag/index.js.map +7 -0
- package/Tag/types.d.ts +179 -0
- package/Tag/types.js +1 -0
- package/Tag/types.js.map +7 -0
- package/Tag/useTagProps.d.ts +3 -0
- package/Tag/useTagProps.js +27 -0
- package/Tag/useTagProps.js.map +7 -0
- package/Transition/index.d.ts +31 -0
- package/Transition/index.js +101 -0
- package/Transition/index.js.map +7 -0
- package/Transition/variants.d.ts +131 -0
- package/Transition/variants.js +175 -0
- package/Transition/variants.js.map +7 -0
- package/breakpoint/index.d.ts +6 -0
- package/breakpoint/index.js +46 -0
- package/breakpoint/index.js.map +7 -0
- package/breakpoint/useBreakpoint.d.ts +10 -0
- package/breakpoint/useBreakpoint.js +32 -0
- package/breakpoint/useBreakpoint.js.map +7 -0
- package/breakpoint/useBreakpointProps.d.ts +6 -0
- package/breakpoint/useBreakpointProps.js +48 -0
- package/breakpoint/useBreakpointProps.js.map +7 -0
- package/css/aliases.d.ts +4 -0
- package/css/aliases.js +34 -0
- package/css/aliases.js.map +7 -0
- package/css/getProps.d.ts +3 -0
- package/css/getProps.js +37 -0
- package/css/getProps.js.map +7 -0
- package/css/getValue.d.ts +3 -0
- package/css/getValue.js +108 -0
- package/css/getValue.js.map +7 -0
- package/css/index.d.ts +15 -0
- package/css/index.js +70 -0
- package/css/index.js.map +7 -0
- package/css/types.d.ts +54 -0
- package/css/types.js +1 -0
- package/css/types.js.map +7 -0
- package/index.d.ts +21 -0
- package/index.js +30 -0
- package/index.js.map +7 -0
- package/isWindow.d.ts +2 -0
- package/isWindow.js +6 -0
- package/isWindow.js.map +7 -0
- package/package.json +28 -0
- package/readme.md +0 -0
- package/theme/ThemeCssVars.d.ts +3 -0
- package/theme/ThemeCssVars.js +92 -0
- package/theme/ThemeCssVars.js.map +7 -0
- package/theme/ThemeDefaultOptions.d.ts +68 -0
- package/theme/ThemeDefaultOptions.js +148 -0
- package/theme/ThemeDefaultOptions.js.map +7 -0
- package/theme/ThemeProvider.d.ts +10 -0
- package/theme/ThemeProvider.js +120 -0
- package/theme/ThemeProvider.js.map +7 -0
- package/theme/core.d.ts +7 -0
- package/theme/core.js +26 -0
- package/theme/core.js.map +7 -0
- package/theme/createColor.d.ts +41 -0
- package/theme/createColor.js +52 -0
- package/theme/createColor.js.map +7 -0
- package/theme/createTheme.d.ts +2 -0
- package/theme/createTheme.js +33 -0
- package/theme/createTheme.js.map +7 -0
- package/theme/createThemeSwitcher.d.ts +6 -0
- package/theme/createThemeSwitcher.js +19 -0
- package/theme/createThemeSwitcher.js.map +7 -0
- package/theme/index.d.ts +4 -0
- package/theme/index.js +14 -0
- package/theme/index.js.map +7 -0
- package/theme/types.d.ts +124 -0
- package/theme/types.js +1 -0
- package/theme/types.js.map +7 -0
- package/useAnimation.d.ts +18 -0
- package/useAnimation.js +33 -0
- package/useAnimation.js.map +7 -0
- package/useColorTemplate.d.ts +4 -0
- package/useColorTemplate.js +11 -0
- package/useColorTemplate.js.map +7 -0
- package/useInterface.d.ts +2 -0
- package/useInterface.js +14 -0
- package/useInterface.js.map +7 -0
package/theme/types.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { BreakpointKeys, GlobalCSS } from "../css/types";
|
|
2
|
+
export type ObjectType = {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
};
|
|
5
|
+
export type ThemeColorItem = {
|
|
6
|
+
primary: string;
|
|
7
|
+
secondary: string;
|
|
8
|
+
text: string;
|
|
9
|
+
alpha: string;
|
|
10
|
+
template: {
|
|
11
|
+
outline: {
|
|
12
|
+
bgcolor: string;
|
|
13
|
+
color: string;
|
|
14
|
+
border: number;
|
|
15
|
+
borderColor: string;
|
|
16
|
+
hover: {
|
|
17
|
+
bgcolor: string;
|
|
18
|
+
color: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
fill: {
|
|
22
|
+
bgcolor: string;
|
|
23
|
+
color: string;
|
|
24
|
+
hover: {
|
|
25
|
+
bgcolor: string;
|
|
26
|
+
color: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
text: {
|
|
30
|
+
bgcolor: string;
|
|
31
|
+
color: string;
|
|
32
|
+
hover: {
|
|
33
|
+
bgcolor: string;
|
|
34
|
+
color: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
alpha: {
|
|
38
|
+
bgcolor: string;
|
|
39
|
+
color: string;
|
|
40
|
+
hover: {
|
|
41
|
+
bgcolor: string;
|
|
42
|
+
color: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export type ThemeTypographyItem = {
|
|
48
|
+
fontSize: number;
|
|
49
|
+
lineHeight: number;
|
|
50
|
+
fontWeight: number;
|
|
51
|
+
};
|
|
52
|
+
export type ThemeColor = {
|
|
53
|
+
background: Omit<ThemeColorItem, "text">;
|
|
54
|
+
text: Omit<ThemeColorItem, "text" | "alpha" | "template">;
|
|
55
|
+
divider: string;
|
|
56
|
+
brand: ThemeColorItem;
|
|
57
|
+
accent: ThemeColorItem;
|
|
58
|
+
success: ThemeColorItem;
|
|
59
|
+
info: ThemeColorItem;
|
|
60
|
+
warning: ThemeColorItem;
|
|
61
|
+
danger: ThemeColorItem;
|
|
62
|
+
};
|
|
63
|
+
export type ThemeTypographyType = {
|
|
64
|
+
fontFamily: string;
|
|
65
|
+
h1: ThemeTypographyItem;
|
|
66
|
+
h2: ThemeTypographyItem;
|
|
67
|
+
h3: ThemeTypographyItem;
|
|
68
|
+
h4: ThemeTypographyItem;
|
|
69
|
+
h5: ThemeTypographyItem;
|
|
70
|
+
h6: ThemeTypographyItem;
|
|
71
|
+
text: ThemeTypographyItem;
|
|
72
|
+
button: ThemeTypographyItem;
|
|
73
|
+
small: ThemeTypographyItem;
|
|
74
|
+
};
|
|
75
|
+
export interface ThemeOptions {
|
|
76
|
+
name: string;
|
|
77
|
+
rtl: boolean;
|
|
78
|
+
globalStyle: GlobalCSS;
|
|
79
|
+
breakpoints: {
|
|
80
|
+
[key in BreakpointKeys]: number;
|
|
81
|
+
};
|
|
82
|
+
shadow: string[];
|
|
83
|
+
interfaces: {
|
|
84
|
+
[name: string]: <P extends object>(defaultProps: P, theme: ThemeOptions) => P;
|
|
85
|
+
};
|
|
86
|
+
colors: ThemeColor;
|
|
87
|
+
typography: ThemeTypographyType;
|
|
88
|
+
}
|
|
89
|
+
export type ThemeColorItemInput = Partial<Omit<ThemeColorItem, "alpha">>;
|
|
90
|
+
export type ThemeTypographyItemInput = Partial<ThemeTypographyItem>;
|
|
91
|
+
export type ThemeColorInput = {
|
|
92
|
+
background?: Omit<ThemeColorItemInput, "text">;
|
|
93
|
+
text?: Omit<ThemeColorItemInput, "text">;
|
|
94
|
+
divider?: string;
|
|
95
|
+
brand?: ThemeColorItemInput;
|
|
96
|
+
accent?: ThemeColorItemInput;
|
|
97
|
+
success?: ThemeColorItemInput;
|
|
98
|
+
info?: ThemeColorItemInput;
|
|
99
|
+
warning?: ThemeColorItemInput;
|
|
100
|
+
danger?: ThemeColorItemInput;
|
|
101
|
+
};
|
|
102
|
+
export type ThemeTypographyInputType = {
|
|
103
|
+
fontFamily?: string;
|
|
104
|
+
h1?: ThemeTypographyItemInput;
|
|
105
|
+
h2?: ThemeTypographyItemInput;
|
|
106
|
+
h3?: ThemeTypographyItemInput;
|
|
107
|
+
h4?: ThemeTypographyItemInput;
|
|
108
|
+
h5?: ThemeTypographyItemInput;
|
|
109
|
+
h6?: ThemeTypographyItemInput;
|
|
110
|
+
text?: ThemeTypographyItemInput;
|
|
111
|
+
button?: ThemeTypographyItemInput;
|
|
112
|
+
small?: ThemeTypographyItemInput;
|
|
113
|
+
};
|
|
114
|
+
export interface ThemeOptionInput {
|
|
115
|
+
rtl?: boolean;
|
|
116
|
+
globalStyle?: GlobalCSS;
|
|
117
|
+
interfaces?: {
|
|
118
|
+
[name: string]: <P extends object>(defaultProps: P, theme: ThemeOptions) => P;
|
|
119
|
+
};
|
|
120
|
+
colors?: ThemeColorInput;
|
|
121
|
+
typography?: ThemeTypographyInputType;
|
|
122
|
+
}
|
|
123
|
+
export type TypographyRefTypes = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "text" | "button" | "small";
|
|
124
|
+
export type ColorsRefTypes = "text" | "text.primary" | "text.secondary" | "background" | "background.primary" | "background.secondary" | "background.alpha" | "brand" | "brand.primary" | "brand.secondary" | "brand.alpha" | "brand.text" | "accent" | "accent.primary" | "accent.secondary" | "accent.alpha" | "accent.text" | "info" | "info.primary" | "info.secondary" | "info.alpha" | "info.text" | "success" | "success.primary" | "success.secondary" | "success.alpha" | "success.text" | "warning" | "warning.primary" | "warning.secondary" | "warning.alpha" | "warning.text" | "danger" | "danger.primary" | "danger.secondary" | "danger.alpha" | "danger.text";
|
package/theme/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CSSProps } from './css/types';
|
|
2
|
+
export declare const animationEases: {
|
|
3
|
+
easeInOut: string;
|
|
4
|
+
easeOut: string;
|
|
5
|
+
easeIn: string;
|
|
6
|
+
sharp: string;
|
|
7
|
+
linear: string;
|
|
8
|
+
easeBounceOut: string;
|
|
9
|
+
};
|
|
10
|
+
export interface UseAnimationProps {
|
|
11
|
+
delay?: number;
|
|
12
|
+
duration?: number;
|
|
13
|
+
from: CSSProps;
|
|
14
|
+
to: CSSProps;
|
|
15
|
+
ease?: keyof typeof animationEases;
|
|
16
|
+
}
|
|
17
|
+
declare const useAnimation: ({ from, to, delay, ease, duration }: UseAnimationProps) => string;
|
|
18
|
+
export default useAnimation;
|
package/useAnimation.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { css } from "./css";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
const animationEases = {
|
|
4
|
+
easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
5
|
+
easeOut: "cubic-bezier(0.0, 0, 0.2, 1)",
|
|
6
|
+
easeIn: "cubic-bezier(0.4, 0, 1, 1)",
|
|
7
|
+
sharp: "cubic-bezier(0.4, 0, 0.6, 1)",
|
|
8
|
+
linear: "cubic-bezier(0, 0, 1, 1)",
|
|
9
|
+
easeBounceOut: "cubic-bezier(0.68, -0.55, 0.265, 1.55)"
|
|
10
|
+
};
|
|
11
|
+
const useAnimation = ({ from, to, delay, ease, duration }) => {
|
|
12
|
+
let _delay = delay || 0;
|
|
13
|
+
let _duration = duration || 600;
|
|
14
|
+
let _ease = ease || "easeBounceOut";
|
|
15
|
+
const id = "anim" + useId().replaceAll(":", "");
|
|
16
|
+
const anim = css({
|
|
17
|
+
animationName: id,
|
|
18
|
+
animationDelay: _delay + "ms",
|
|
19
|
+
animationDuration: _duration + "ms",
|
|
20
|
+
animationTimingFunction: animationEases[_ease] || animationEases.easeBounceOut,
|
|
21
|
+
[`@keyframes ${id}`]: {
|
|
22
|
+
from,
|
|
23
|
+
to
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return anim.classname;
|
|
27
|
+
};
|
|
28
|
+
var useAnimation_default = useAnimation;
|
|
29
|
+
export {
|
|
30
|
+
animationEases,
|
|
31
|
+
useAnimation_default as default
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=useAnimation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/useAnimation.ts"],
|
|
4
|
+
"sourcesContent": ["import { css } from './css'\nimport { useId } from 'react'\nimport { CSSProps } from './css/types'\n\nexport const animationEases = {\n easeInOut: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n easeOut: \"cubic-bezier(0.0, 0, 0.2, 1)\",\n easeIn: \"cubic-bezier(0.4, 0, 1, 1)\",\n sharp: \"cubic-bezier(0.4, 0, 0.6, 1)\",\n linear: \"cubic-bezier(0, 0, 1, 1)\",\n easeBounceOut: \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n}\n\nexport interface UseAnimationProps {\n delay?: number;\n duration?: number;\n from: CSSProps;\n to: CSSProps;\n ease?: keyof typeof animationEases;\n}\n\nconst useAnimation = ({ from, to, delay, ease, duration }: UseAnimationProps) => {\n let _delay = delay || 0;\n let _duration = duration || 600;\n let _ease = ease || \"easeBounceOut\"\n const id = \"anim\" + useId().replaceAll(\":\", \"\")\n const anim = css({\n animationName: id,\n animationDelay: _delay + \"ms\",\n animationDuration: _duration + \"ms\",\n animationTimingFunction: animationEases[_ease] || animationEases.easeBounceOut,\n [`@keyframes ${id}`]: {\n from: from as any,\n to: to as any\n }\n })\n return anim.classname\n}\n\nexport default useAnimation"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AACpB,SAAS,aAAa;AAGf,MAAM,iBAAiB;AAAA,EAC1B,WAAW;AAAA,EACX,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,eAAe;AACnB;AAUA,MAAM,eAAe,CAAC,EAAE,MAAM,IAAI,OAAO,MAAM,SAAS,MAAyB;AAC7E,MAAI,SAAS,SAAS;AACtB,MAAI,YAAY,YAAY;AAC5B,MAAI,QAAQ,QAAQ;AACpB,QAAM,KAAK,SAAS,MAAM,EAAE,WAAW,KAAK,EAAE;AAC9C,QAAM,OAAO,IAAI;AAAA,IACb,eAAe;AAAA,IACf,gBAAgB,SAAS;AAAA,IACzB,mBAAmB,YAAY;AAAA,IAC/B,yBAAyB,eAAe,KAAK,KAAK,eAAe;AAAA,IACjE,CAAC,cAAc,EAAE,EAAE,GAAG;AAAA,MAClB;AAAA,MACA;AAAA,IACJ;AAAA,EACJ,CAAC;AACD,SAAO,KAAK;AAChB;AAEA,IAAO,uBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type ColorTemplateColors = "default" | "brand" | "accent" | "info" | "success" | "warning" | "danger";
|
|
2
|
+
export type ColorTemplateType = "fill" | "outline" | "text" | "alpha";
|
|
3
|
+
declare const useColorTemplate: (color: ColorTemplateColors, type: ColorTemplateType) => any;
|
|
4
|
+
export default useColorTemplate;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useTheme } from "./theme";
|
|
2
|
+
const useColorTemplate = (color, type) => {
|
|
3
|
+
const theme = useTheme();
|
|
4
|
+
let _color = color === "default" ? "background" : color;
|
|
5
|
+
return theme.colors[_color]?.template[type];
|
|
6
|
+
};
|
|
7
|
+
var useColorTemplate_default = useColorTemplate;
|
|
8
|
+
export {
|
|
9
|
+
useColorTemplate_default as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useColorTemplate.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/useColorTemplate.ts"],
|
|
4
|
+
"sourcesContent": ["import { useTheme } from \"./theme\"\nexport type ColorTemplateColors = \"default\" | \"brand\" | \"accent\" | \"info\" | \"success\" | \"warning\" | \"danger\"\nexport type ColorTemplateType = \"fill\" | \"outline\" | \"text\" | \"alpha\"\n\nconst useColorTemplate = (color: ColorTemplateColors, type: ColorTemplateType) => {\n const theme: any = useTheme()\n let _color = color === 'default' ? \"background\" : color as any\n return theme.colors[_color]?.template[type]\n}\n\nexport default useColorTemplate"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gBAAgB;AAIzB,MAAM,mBAAmB,CAAC,OAA4B,SAA4B;AAC9E,QAAM,QAAa,SAAS;AAC5B,MAAI,SAAS,UAAU,YAAY,eAAe;AAClD,SAAO,MAAM,OAAO,MAAM,GAAG,SAAS,IAAI;AAC9C;AAEA,IAAO,2BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/useInterface.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useTheme } from "./theme";
|
|
2
|
+
const useInterface = (name, userPorps, defaultProps) => {
|
|
3
|
+
const theme = useTheme();
|
|
4
|
+
const _interface = theme.interfaces[name];
|
|
5
|
+
if (_interface) {
|
|
6
|
+
defaultProps = _interface({ ...defaultProps, ...userPorps }, theme);
|
|
7
|
+
}
|
|
8
|
+
return [{ ...defaultProps, ...userPorps }, theme];
|
|
9
|
+
};
|
|
10
|
+
var useInterface_default = useInterface;
|
|
11
|
+
export {
|
|
12
|
+
useInterface_default as default
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useInterface.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/useInterface.ts"],
|
|
4
|
+
"sourcesContent": ["import { useTheme } from \"./theme\"\n\nconst useInterface = <P extends object>(name: string, userPorps: P, defaultProps: P) => {\n const theme = useTheme()\n const _interface = theme.interfaces[name]\n\n if (_interface) {\n defaultProps = _interface<P>({ ...defaultProps, ...userPorps }, theme)\n }\n return [{ ...defaultProps, ...userPorps }, theme]\n}\n\nexport default useInterface"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gBAAgB;AAEzB,MAAM,eAAe,CAAmB,MAAc,WAAc,iBAAoB;AACpF,QAAM,QAAQ,SAAS;AACvB,QAAM,aAAa,MAAM,WAAW,IAAI;AAExC,MAAI,YAAY;AACZ,mBAAe,WAAc,EAAE,GAAG,cAAc,GAAG,UAAU,GAAG,KAAK;AAAA,EACzE;AACA,SAAO,CAAC,EAAE,GAAG,cAAc,GAAG,UAAU,GAAG,KAAK;AACpD;AAEA,IAAO,uBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|