@xanui/core 1.1.3 → 1.1.6
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 -1
- package/ServerStyleTags.js +3 -2
- package/ServerStyleTags.js.map +1 -7
- package/ServerStyleTags.mjs +3 -0
- package/ServerStyleTags.mjs.map +1 -0
- package/Tag/cssPropList.js +186 -2
- package/Tag/cssPropList.js.map +1 -7
- package/Tag/cssPropList.mjs +186 -0
- package/Tag/cssPropList.mjs.map +1 -0
- package/Tag/index.d.ts +4 -2
- package/Tag/index.js +6 -2
- package/Tag/index.js.map +1 -7
- package/Tag/index.mjs +6 -0
- package/Tag/index.mjs.map +1 -0
- package/Tag/types.d.ts +9 -7
- package/Tag/useTagProps.d.ts +4 -2
- package/Tag/useTagProps.js +21 -2
- package/Tag/useTagProps.js.map +1 -7
- package/Tag/useTagProps.mjs +21 -0
- package/Tag/useTagProps.mjs.map +1 -0
- package/Transition/index.d.ts +13 -10
- package/Transition/index.js +93 -2
- package/Transition/index.js.map +1 -7
- package/Transition/index.mjs +93 -0
- package/Transition/index.mjs.map +1 -0
- package/Transition/variants.d.ts +18 -15
- package/Transition/variants.js +158 -2
- package/Transition/variants.js.map +1 -7
- package/Transition/variants.mjs +158 -0
- package/Transition/variants.mjs.map +1 -0
- package/breakpoint/BreakpointProvider.js +43 -0
- package/breakpoint/BreakpointProvider.js.map +1 -0
- package/breakpoint/BreakpointProvider.mjs +43 -0
- package/breakpoint/BreakpointProvider.mjs.map +1 -0
- package/breakpoint/useBreakpoint.d.ts +4 -2
- package/breakpoint/useBreakpoint.js +23 -2
- package/breakpoint/useBreakpoint.js.map +1 -7
- package/breakpoint/useBreakpoint.mjs +23 -0
- package/breakpoint/useBreakpoint.mjs.map +1 -0
- package/breakpoint/useBreakpointProps.d.ts +6 -3
- package/breakpoint/useBreakpointProps.js +42 -2
- package/breakpoint/useBreakpointProps.js.map +1 -7
- package/breakpoint/useBreakpointProps.mjs +42 -0
- package/breakpoint/useBreakpointProps.mjs.map +1 -0
- package/css/aliases.js +29 -2
- package/css/aliases.js.map +1 -7
- package/css/aliases.mjs +29 -0
- package/css/aliases.mjs.map +1 -0
- package/css/getProps.d.ts +4 -2
- package/css/getProps.js +32 -2
- package/css/getProps.js.map +1 -7
- package/css/getProps.mjs +32 -0
- package/css/getProps.mjs.map +1 -0
- package/css/getValue.d.ts +4 -2
- package/css/getValue.js +92 -2
- package/css/getValue.js.map +1 -7
- package/css/getValue.mjs +92 -0
- package/css/getValue.mjs.map +1 -0
- package/css/index.d.ts +10 -9
- package/css/index.js +55 -2
- package/css/index.js.map +1 -7
- package/css/index.mjs +55 -0
- package/css/index.mjs.map +1 -0
- package/css/types.d.ts +12 -9
- package/index.d.ts +19 -21
- package/index.js +1 -2
- package/index.js.map +1 -7
- package/index.mjs +1 -0
- package/index.mjs.map +1 -0
- package/isWindow.d.ts +2 -1
- package/isWindow.js +1 -2
- package/isWindow.js.map +1 -7
- package/isWindow.mjs +1 -0
- package/isWindow.mjs.map +1 -0
- package/package.json +28 -24
- package/theme/ThemeCssVars.js +5 -2
- package/theme/ThemeCssVars.js.map +1 -7
- package/theme/ThemeCssVars.mjs +5 -0
- package/theme/ThemeCssVars.mjs.map +1 -0
- package/theme/ThemeDefaultOptions.js +131 -2
- package/theme/ThemeDefaultOptions.js.map +1 -7
- package/theme/ThemeDefaultOptions.mjs +131 -0
- package/theme/ThemeDefaultOptions.mjs.map +1 -0
- package/theme/ThemeProvider.d.ts +7 -4
- package/theme/ThemeProvider.js +88 -2
- package/theme/ThemeProvider.js.map +1 -7
- package/theme/ThemeProvider.mjs +88 -0
- package/theme/ThemeProvider.mjs.map +1 -0
- package/theme/core.d.ts +6 -7
- package/theme/core.js +18 -2
- package/theme/core.js.map +1 -7
- package/theme/core.mjs +18 -0
- package/theme/core.mjs.map +1 -0
- package/theme/createColor.js +46 -2
- package/theme/createColor.js.map +1 -7
- package/theme/createColor.mjs +46 -0
- package/theme/createColor.mjs.map +1 -0
- package/theme/createTheme.js +21 -2
- package/theme/createTheme.js.map +1 -7
- package/theme/createTheme.mjs +21 -0
- package/theme/createTheme.mjs.map +1 -0
- package/theme/createThemeSwitcher.d.ts +5 -2
- package/theme/createThemeSwitcher.js +12 -2
- package/theme/createThemeSwitcher.js.map +1 -7
- package/theme/createThemeSwitcher.mjs +12 -0
- package/theme/createThemeSwitcher.mjs.map +1 -0
- package/theme/index.js +2 -2
- package/theme/index.js.map +1 -7
- package/theme/index.mjs +2 -0
- package/theme/index.mjs.map +1 -0
- package/theme/types.d.ts +17 -14
- package/useAnimation.d.ts +7 -4
- package/useAnimation.js +25 -2
- package/useAnimation.js.map +1 -7
- package/useAnimation.mjs +25 -0
- package/useAnimation.mjs.map +1 -0
- package/useColorTemplate.d.ts +5 -3
- package/useColorTemplate.js +6 -2
- package/useColorTemplate.js.map +1 -7
- package/useColorTemplate.mjs +6 -0
- package/useColorTemplate.mjs.map +1 -0
- package/useInterface.d.ts +5 -2
- package/useInterface.js +8 -2
- package/useInterface.js.map +1 -7
- package/useInterface.mjs +8 -0
- package/useInterface.mjs.map +1 -0
- package/Tag/cssPropList.d.ts +0 -2
- package/Tag/types.js +0 -1
- package/Tag/types.js.map +0 -7
- package/breakpoint/index.d.ts +0 -6
- package/breakpoint/index.js +0 -2
- package/breakpoint/index.js.map +0 -7
- package/cjs/ServerStyleTags.js +0 -2
- package/cjs/ServerStyleTags.js.map +0 -7
- package/cjs/Tag/cssPropList.js +0 -2
- package/cjs/Tag/cssPropList.js.map +0 -7
- package/cjs/Tag/index.js +0 -2
- package/cjs/Tag/index.js.map +0 -7
- package/cjs/Tag/types.js +0 -2
- package/cjs/Tag/types.js.map +0 -7
- package/cjs/Tag/useTagProps.js +0 -2
- package/cjs/Tag/useTagProps.js.map +0 -7
- package/cjs/Transition/index.js +0 -2
- package/cjs/Transition/index.js.map +0 -7
- package/cjs/Transition/variants.js +0 -2
- package/cjs/Transition/variants.js.map +0 -7
- package/cjs/breakpoint/index.js +0 -2
- package/cjs/breakpoint/index.js.map +0 -7
- package/cjs/breakpoint/useBreakpoint.js +0 -2
- package/cjs/breakpoint/useBreakpoint.js.map +0 -7
- package/cjs/breakpoint/useBreakpointProps.js +0 -2
- package/cjs/breakpoint/useBreakpointProps.js.map +0 -7
- package/cjs/css/aliases.js +0 -2
- package/cjs/css/aliases.js.map +0 -7
- package/cjs/css/getProps.js +0 -2
- package/cjs/css/getProps.js.map +0 -7
- package/cjs/css/getValue.js +0 -2
- package/cjs/css/getValue.js.map +0 -7
- package/cjs/css/index.js +0 -2
- package/cjs/css/index.js.map +0 -7
- package/cjs/css/types.js +0 -2
- package/cjs/css/types.js.map +0 -7
- package/cjs/index.js +0 -2
- package/cjs/index.js.map +0 -7
- package/cjs/isWindow.js +0 -2
- package/cjs/isWindow.js.map +0 -7
- package/cjs/theme/ThemeCssVars.js +0 -2
- package/cjs/theme/ThemeCssVars.js.map +0 -7
- package/cjs/theme/ThemeDefaultOptions.js +0 -2
- package/cjs/theme/ThemeDefaultOptions.js.map +0 -7
- package/cjs/theme/ThemeProvider.js +0 -2
- package/cjs/theme/ThemeProvider.js.map +0 -7
- package/cjs/theme/core.js +0 -2
- package/cjs/theme/core.js.map +0 -7
- package/cjs/theme/createColor.js +0 -2
- package/cjs/theme/createColor.js.map +0 -7
- package/cjs/theme/createTheme.js +0 -2
- package/cjs/theme/createTheme.js.map +0 -7
- package/cjs/theme/createThemeSwitcher.js +0 -2
- package/cjs/theme/createThemeSwitcher.js.map +0 -7
- package/cjs/theme/index.js +0 -2
- package/cjs/theme/index.js.map +0 -7
- package/cjs/theme/types.js +0 -2
- package/cjs/theme/types.js.map +0 -7
- package/cjs/useAnimation.js +0 -2
- package/cjs/useAnimation.js.map +0 -7
- package/cjs/useColorTemplate.js +0 -2
- package/cjs/useColorTemplate.js.map +0 -7
- package/cjs/useInterface.js +0 -2
- package/cjs/useInterface.js.map +0 -7
- package/css/aliases.d.ts +0 -4
- package/css/types.js +0 -1
- package/css/types.js.map +0 -7
- package/theme/ThemeCssVars.d.ts +0 -3
- package/theme/ThemeDefaultOptions.d.ts +0 -68
- package/theme/createColor.d.ts +0 -41
- package/theme/createTheme.d.ts +0 -2
- package/theme/index.d.ts +0 -5
- package/theme/types.js +0 -1
- package/theme/types.js.map +0 -7
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
const lightColorPallete = {
|
|
2
|
+
text: {
|
|
3
|
+
primary: "#212B36",
|
|
4
|
+
secondary: "#637381",
|
|
5
|
+
},
|
|
6
|
+
background: {
|
|
7
|
+
primary: "#FFFFFF",
|
|
8
|
+
secondary: "#EDEFF7",
|
|
9
|
+
},
|
|
10
|
+
divider: "#DADCE0"
|
|
11
|
+
};
|
|
12
|
+
const darkColorPallete = {
|
|
13
|
+
text: {
|
|
14
|
+
primary: "#FFFFFF",
|
|
15
|
+
secondary: "#C4CDD5",
|
|
16
|
+
},
|
|
17
|
+
background: {
|
|
18
|
+
primary: "#272727",
|
|
19
|
+
secondary: "#1E1E1E",
|
|
20
|
+
},
|
|
21
|
+
divider: "#3D3D3D"
|
|
22
|
+
};
|
|
23
|
+
const ThemeColors = Object.assign(Object.assign({}, lightColorPallete), { brand: {
|
|
24
|
+
primary: "#3b82f6",
|
|
25
|
+
secondary: "#60a5fa",
|
|
26
|
+
text: "#FFFFFF"
|
|
27
|
+
}, accent: {
|
|
28
|
+
primary: "#14b8a6",
|
|
29
|
+
secondary: "#2dd4bf",
|
|
30
|
+
text: "#FFFFFF"
|
|
31
|
+
}, info: {
|
|
32
|
+
primary: "#0ea5e9",
|
|
33
|
+
secondary: "#60a5fa",
|
|
34
|
+
text: "#FFFFFF"
|
|
35
|
+
}, success: {
|
|
36
|
+
primary: "#22c55e",
|
|
37
|
+
secondary: "#4ade80",
|
|
38
|
+
text: "#FFFFFF"
|
|
39
|
+
}, warning: {
|
|
40
|
+
primary: "#f59e0b",
|
|
41
|
+
secondary: "#fbbf24",
|
|
42
|
+
text: "#FFFFFF"
|
|
43
|
+
}, danger: {
|
|
44
|
+
primary: "#ef4444",
|
|
45
|
+
secondary: "#f87171",
|
|
46
|
+
text: "#FFFFFF"
|
|
47
|
+
} });
|
|
48
|
+
const ThemeTypography = {
|
|
49
|
+
fontFamily: '"Inter",sans-serif,"Helvetica","Arial"',
|
|
50
|
+
h1: {
|
|
51
|
+
fontSize: 47.78,
|
|
52
|
+
lineHeight: 1.3,
|
|
53
|
+
fontWeight: 400,
|
|
54
|
+
},
|
|
55
|
+
h2: {
|
|
56
|
+
fontSize: 39.81,
|
|
57
|
+
lineHeight: 1.35,
|
|
58
|
+
fontWeight: 400,
|
|
59
|
+
},
|
|
60
|
+
h3: {
|
|
61
|
+
fontSize: 33.18,
|
|
62
|
+
lineHeight: 1.4,
|
|
63
|
+
fontWeight: 400,
|
|
64
|
+
},
|
|
65
|
+
h4: {
|
|
66
|
+
fontSize: 27.65,
|
|
67
|
+
lineHeight: 1.45,
|
|
68
|
+
fontWeight: 400,
|
|
69
|
+
},
|
|
70
|
+
h5: {
|
|
71
|
+
fontSize: 27.65,
|
|
72
|
+
lineHeight: 1.5,
|
|
73
|
+
fontWeight: 400,
|
|
74
|
+
},
|
|
75
|
+
h6: {
|
|
76
|
+
fontSize: 23.04,
|
|
77
|
+
lineHeight: 1.55,
|
|
78
|
+
fontWeight: 400,
|
|
79
|
+
},
|
|
80
|
+
text: {
|
|
81
|
+
fontSize: 16,
|
|
82
|
+
lineHeight: 1.6,
|
|
83
|
+
fontWeight: 400,
|
|
84
|
+
},
|
|
85
|
+
button: {
|
|
86
|
+
fontSize: 13.33,
|
|
87
|
+
lineHeight: 1.6,
|
|
88
|
+
fontWeight: 500,
|
|
89
|
+
},
|
|
90
|
+
small: {
|
|
91
|
+
fontSize: 12.33,
|
|
92
|
+
lineHeight: 1.6,
|
|
93
|
+
fontWeight: 400,
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const shadow = [
|
|
97
|
+
"none",
|
|
98
|
+
"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)",
|
|
99
|
+
"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)",
|
|
100
|
+
"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)",
|
|
101
|
+
"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)",
|
|
102
|
+
"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)",
|
|
103
|
+
"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)",
|
|
104
|
+
"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)",
|
|
105
|
+
"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)",
|
|
106
|
+
"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)",
|
|
107
|
+
"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)",
|
|
108
|
+
"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)",
|
|
109
|
+
"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)",
|
|
110
|
+
"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)",
|
|
111
|
+
"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)",
|
|
112
|
+
"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)",
|
|
113
|
+
"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)",
|
|
114
|
+
"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)",
|
|
115
|
+
"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)",
|
|
116
|
+
"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)",
|
|
117
|
+
"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)",
|
|
118
|
+
"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)",
|
|
119
|
+
"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)",
|
|
120
|
+
"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)",
|
|
121
|
+
"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)",
|
|
122
|
+
];
|
|
123
|
+
var defaultThemeOption = {
|
|
124
|
+
name: "light",
|
|
125
|
+
rtl: false,
|
|
126
|
+
shadow,
|
|
127
|
+
globalStyle: {},
|
|
128
|
+
colors: ThemeColors,
|
|
129
|
+
typography: ThemeTypography,
|
|
130
|
+
interfaces: {}
|
|
131
|
+
};export{ThemeColors,ThemeTypography,darkColorPallete,defaultThemeOption as default,lightColorPallete,shadow};//# sourceMappingURL=ThemeDefaultOptions.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeDefaultOptions.mjs","sources":["../../src/theme/ThemeDefaultOptions.ts"],"sourcesContent":["import { ThemeOptionInput, ThemeTypographyType } from './types'\n\nexport const lightColorPallete = {\n text: {\n primary: \"#212B36\",\n secondary: \"#637381\",\n },\n background: {\n primary: \"#FFFFFF\",\n secondary: \"#EDEFF7\",\n },\n divider: \"#DADCE0\"\n}\n\nexport const darkColorPallete = {\n text: {\n primary: \"#FFFFFF\",\n secondary: \"#C4CDD5\",\n },\n background: {\n primary: \"#272727\",\n secondary: \"#1E1E1E\",\n },\n divider: \"#3D3D3D\"\n}\n\nexport const ThemeColors = {\n ...lightColorPallete,\n brand: {\n primary: \"#3b82f6\",\n secondary: \"#60a5fa\",\n text: \"#FFFFFF\"\n },\n accent: {\n primary: \"#14b8a6\",\n secondary: \"#2dd4bf\",\n text: \"#FFFFFF\"\n },\n info: {\n primary: \"#0ea5e9\",\n secondary: \"#60a5fa\",\n text: \"#FFFFFF\"\n },\n success: {\n primary: \"#22c55e\",\n secondary: \"#4ade80\",\n text: \"#FFFFFF\"\n },\n warning: {\n primary: \"#f59e0b\",\n secondary: \"#fbbf24\",\n text: \"#FFFFFF\"\n },\n danger: {\n primary: \"#ef4444\",\n secondary: \"#f87171\",\n text: \"#FFFFFF\"\n },\n}\n\nexport const ThemeTypography: ThemeTypographyType = {\n fontFamily: '\"Inter\",sans-serif,\"Helvetica\",\"Arial\"',\n h1: {\n fontSize: 47.78,\n lineHeight: 1.3,\n fontWeight: 400,\n },\n h2: {\n fontSize: 39.81,\n lineHeight: 1.35,\n fontWeight: 400,\n },\n h3: {\n fontSize: 33.18,\n lineHeight: 1.4,\n fontWeight: 400,\n },\n h4: {\n fontSize: 27.65,\n lineHeight: 1.45,\n fontWeight: 400,\n },\n h5: {\n fontSize: 27.65,\n lineHeight: 1.5,\n fontWeight: 400,\n },\n h6: {\n fontSize: 23.04,\n lineHeight: 1.55,\n fontWeight: 400,\n },\n text: {\n fontSize: 16,\n lineHeight: 1.6,\n fontWeight: 400,\n },\n button: {\n fontSize: 13.33,\n lineHeight: 1.6,\n fontWeight: 500,\n },\n small: {\n fontSize: 12.33,\n lineHeight: 1.6,\n fontWeight: 400,\n }\n}\n\nexport const shadow = [\n \"none\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n \"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)\",\n]\n\nexport default {\n name: \"light\",\n rtl: false,\n shadow,\n globalStyle: {},\n colors: ThemeColors,\n typography: ThemeTypography,\n interfaces: {}\n} as ThemeOptionInput\n"],"names":[],"mappings":"AAEa,MAAA,iBAAiB,GAAG;AAC7B,IAAA,IAAI,EAAE;AACF,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,SAAS,EAAE,SAAS;AACvB,KAAA;AACD,IAAA,UAAU,EAAE;AACR,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,SAAS,EAAE,SAAS;AACvB,KAAA;AACD,IAAA,OAAO,EAAE;;AAGA,MAAA,gBAAgB,GAAG;AAC5B,IAAA,IAAI,EAAE;AACF,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,SAAS,EAAE,SAAS;AACvB,KAAA;AACD,IAAA,UAAU,EAAE;AACR,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,SAAS,EAAE,SAAS;AACvB,KAAA;AACD,IAAA,OAAO,EAAE;;AAGA,MAAA,WAAW,mCACjB,iBAAiB,CAAA,EAAA,EACpB,KAAK,EAAE;AACH,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,SAAS,EAAE,SAAS;AACpB,QAAA,IAAI,EAAE;AACT,KAAA,EACD,MAAM,EAAE;AACJ,QAAA,OAAO,EAAE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QAAQ,EAAE,KAAK;AACf,QAAA,UAAU,EAAE,IAAI;AAChB,QAAA,UAAU,EAAE,GAAG;AAClB,KAAA;AACD,IAAA,IAAI,EAAE;AACF,QAAA,QAAQ,EAAE,EAAE;AACZ,QAAA,UAAU,EAAE,GAAG;AACf,QAAA,UAAU,EAAE,GAAG;AAClB,KAAA;AACD,IAAA,MAAM,EAAE;AACJ,QAAA,QAAQ,EAAE,KAAK;AACf,QAAA,UAAU,EAAE,GAAG;AACf,QAAA,UAAU,EAAE,GAAG;AAClB,KAAA;AACD,IAAA,KAAK,EAAE;AACH,QAAA,QAAQ,EAAE,KAAK;AACf,QAAA,UAAU,EAAE,GAAG;AACf,QAAA,UAAU,EAAE,GAAG;AAClB;;AAGQ,MAAA,MAAM,GAAG;IAClB,MAAM;IACN,oGAAoG;IACpG,oGAAoG;IACpG,oGAAoG;IACpG,qGAAqG;IACrG,qGAAqG;IACrG,sGAAsG;IACtG,sGAAsG;IACtG,sGAAsG;IACtG,sGAAsG;IACtG,uGAAuG;IACvG,uGAAuG;IACvG,uGAAuG;IACvG,uGAAuG;IACvG,uGAAuG;IACvG,uGAAuG;IACvG,wGAAwG;IACxG,wGAAwG;IACxG,wGAAwG;IACxG,wGAAwG;IACxG,yGAAyG;IACzG,yGAAyG;IACzG,yGAAyG;IACzG,yGAAyG;IACzG,yGAAyG;;AAG7G,yBAAe;AACX,IAAA,IAAI,EAAE,OAAO;AACb,IAAA,GAAG,EAAE,KAAK;IACV,MAAM;AACN,IAAA,WAAW,EAAE,EAAE;AACf,IAAA,MAAM,EAAE,WAAW;AACnB,IAAA,UAAU,EAAE,eAAe;AAC3B,IAAA,UAAU,EAAE;CACK"}
|
package/theme/ThemeProvider.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { TagComponentType, TagProps } from
|
|
3
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TagComponentType, TagProps } from '../Tag/types.js';
|
|
3
|
+
|
|
4
|
+
type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {
|
|
4
5
|
theme: string;
|
|
5
6
|
resetCss?: boolean;
|
|
6
7
|
scrollbarCss?: boolean;
|
|
@@ -8,4 +9,6 @@ export type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T>
|
|
|
8
9
|
renderIsRoot?: React.ReactElement;
|
|
9
10
|
};
|
|
10
11
|
declare const ThemeProvider: ({ children, theme, resetCss, scrollbarCss, isRootProvider, renderIsRoot, ...props }: ThemeProviderProps) => React.JSX.Element;
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
export { ThemeProvider as default };
|
|
14
|
+
export type { ThemeProviderProps };
|
package/theme/ThemeProvider.js
CHANGED
|
@@ -1,2 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';var tslib=require('tslib'),React=require('react'),index$1=require('../Tag/index.js'),BreakpointProvider=require('../breakpoint/BreakpointProvider.js'),index=require('../css/index.js'),core=require('./core.js'),ThemeCssVars=require('./ThemeCssVars.js');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var React__namespace=/*#__PURE__*/_interopNamespaceDefault(React);const ThemeProvider = (_a) => {
|
|
2
|
+
var { children, theme, resetCss, scrollbarCss, isRootProvider, renderIsRoot } = _a, props = tslib.__rest(_a, ["children", "theme", "resetCss", "scrollbarCss", "isRootProvider", "renderIsRoot"]);
|
|
3
|
+
const THEME = core.ThemeFactory.get(theme);
|
|
4
|
+
if (!THEME)
|
|
5
|
+
throw new Error(`Invalid theme name provided: ${theme}`);
|
|
6
|
+
resetCss !== null && resetCss !== void 0 ? resetCss : (resetCss = true);
|
|
7
|
+
scrollbarCss !== null && scrollbarCss !== void 0 ? scrollbarCss : (scrollbarCss = true);
|
|
8
|
+
React__namespace.useMemo(() => {
|
|
9
|
+
if (!!Object.keys(THEME.globalStyle).length) {
|
|
10
|
+
index.css({
|
|
11
|
+
"@global": THEME.globalStyle
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
index.css({
|
|
15
|
+
"@global": {
|
|
16
|
+
[`.xui-${theme}-theme-root`]: ThemeCssVars(THEME)
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
if (scrollbarCss && typeof document !== 'undefined') {
|
|
20
|
+
let thumbSize = 10;
|
|
21
|
+
let thumbColor = THEME.colors.divider;
|
|
22
|
+
let trackColor = THEME.colors.background.secondary;
|
|
23
|
+
index.css({
|
|
24
|
+
"@global": {
|
|
25
|
+
"*": {
|
|
26
|
+
scrollbarWidth: "thin",
|
|
27
|
+
scrollbarColor: `${thumbColor} ${trackColor}`,
|
|
28
|
+
},
|
|
29
|
+
"::-webkit-scrollbar": {
|
|
30
|
+
width: thumbSize,
|
|
31
|
+
height: thumbSize,
|
|
32
|
+
},
|
|
33
|
+
"::-webkit-scrollbar-thumb": {
|
|
34
|
+
backgroundColor: thumbColor,
|
|
35
|
+
borderRadius: "5px",
|
|
36
|
+
border: "2px solid #f4f4f4",
|
|
37
|
+
},
|
|
38
|
+
"::-webkit-scrollbar-thumb:hover": {
|
|
39
|
+
backgroundColor: thumbColor,
|
|
40
|
+
},
|
|
41
|
+
"::-webkit-scrollbar-track": {
|
|
42
|
+
backgroundColor: trackColor,
|
|
43
|
+
borderRadius: "5px",
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
resetCss && index.css({
|
|
49
|
+
"@global": {
|
|
50
|
+
"*": {
|
|
51
|
+
m: 0,
|
|
52
|
+
p: 0,
|
|
53
|
+
outline: "none",
|
|
54
|
+
boxSizing: "border-box",
|
|
55
|
+
verticalAlign: "baseline",
|
|
56
|
+
},
|
|
57
|
+
"html, body": {
|
|
58
|
+
minHeight: "100%",
|
|
59
|
+
"-webkit-font-smoothing": "antialiased"
|
|
60
|
+
},
|
|
61
|
+
"img, picture, video, canvas, svg": {
|
|
62
|
+
maxWidth: "100%",
|
|
63
|
+
display: "block"
|
|
64
|
+
},
|
|
65
|
+
"input, button, textarea, select": {
|
|
66
|
+
font: "inherit"
|
|
67
|
+
},
|
|
68
|
+
"table": {
|
|
69
|
+
borderCollapse: "collapse",
|
|
70
|
+
borderSpacing: 0
|
|
71
|
+
},
|
|
72
|
+
"ol, ul": {
|
|
73
|
+
listStyle: "none"
|
|
74
|
+
},
|
|
75
|
+
"a": {
|
|
76
|
+
display: "inline-block"
|
|
77
|
+
},
|
|
78
|
+
"p, h1, h2, h3, h4, h5, h6": {
|
|
79
|
+
overflowWrap: "break-word",
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}, [theme]);
|
|
84
|
+
return (React__namespace.createElement(core.ThemeContex.Provider, { value: theme }, isRootProvider ? React__namespace.createElement(BreakpointProvider.BreakpointProvider, null,
|
|
85
|
+
React__namespace.createElement(index$1, Object.assign({ minHeight: "100%", bgcolor: THEME.colors.background.primary, fontFamily: THEME.typography.fontFamily, fontSize: THEME.typography.text.fontSize, fontWeight: THEME.typography.text.fontWeight, lineHeight: THEME.typography.text.lineHeight }, props, { baseClass: `${theme}-theme-root`, direction: THEME.rtl ? "rtl" : "ltr" }),
|
|
86
|
+
children,
|
|
87
|
+
renderIsRoot)) : React__namespace.createElement(index$1, Object.assign({ minHeight: "100%", bgcolor: THEME.colors.background.primary, fontFamily: THEME.typography.fontFamily, fontSize: THEME.typography.text.fontSize, fontWeight: THEME.typography.text.fontWeight, lineHeight: THEME.typography.text.lineHeight }, props, { baseClass: `${theme}-theme-root`, direction: THEME.rtl ? "rtl" : "ltr" }), children)));
|
|
88
|
+
};module.exports=ThemeProvider;//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/theme/ThemeProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from \"react\"\nimport { ThemeOptions } from \"./types\"\nimport Tag from \"../Tag\"\nimport { TagComponentType, TagProps } from \"../Tag/types\"\nimport { BreakpointProvider } from \"../breakpoint\"\nimport { ThemeContex, ThemeFactory } from \"./core\"\nimport ThemeCssVars from \"./ThemeCssVars\"\nimport { css } from \"../css\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n resetCss?: boolean;\n scrollbarCss?: boolean;\n isRootProvider?: boolean;\n renderIsRoot?: React.ReactElement;\n}\n\nconst ThemeProvider = ({ children, theme, resetCss, scrollbarCss, isRootProvider, renderIsRoot, ...props }: ThemeProviderProps) => {\n const THEME = ThemeFactory.get(theme) as ThemeOptions\n if (!THEME) throw new Error(`Invalid theme name provided: ${theme}`)\n resetCss ??= true\n scrollbarCss ??= true\n\n React.useMemo(() => {\n if (!!Object.keys(THEME.globalStyle).length) {\n css({\n \"@global\": THEME.globalStyle\n })\n }\n\n css({\n \"@global\": {\n [`.xui-${theme}-theme-root`]: ThemeCssVars(THEME)\n }\n })\n\n if (scrollbarCss && typeof document !== 'undefined') {\n let thumbSize = 10\n let thumbColor = THEME.colors.divider\n let trackColor = THEME.colors.background.secondary\n css({\n \"@global\": {\n \"*\": {\n scrollbarWidth: \"thin\",\n scrollbarColor: `${thumbColor} ${trackColor}`,\n },\n \"::-webkit-scrollbar\": {\n width: thumbSize,\n height: thumbSize,\n },\n \"::-webkit-scrollbar-thumb\": {\n backgroundColor: thumbColor,\n borderRadius: \"5px\",\n border: \"2px solid #f4f4f4\",\n },\n \"::-webkit-scrollbar-thumb:hover\": {\n backgroundColor: thumbColor,\n },\n \"::-webkit-scrollbar-track\": {\n backgroundColor: trackColor,\n borderRadius: \"5px\",\n },\n }\n })\n }\n\n resetCss && css({\n \"@global\": {\n \"*\": {\n m: 0,\n p: 0,\n outline: \"none\",\n boxSizing: \"border-box\",\n verticalAlign: \"baseline\",\n },\n \"html, body\": {\n minHeight: \"100%\",\n \"-webkit-font-smoothing\": \"antialiased\"\n } as any,\n \"img, picture, video, canvas, svg\": {\n maxWidth: \"100%\",\n display: \"block\"\n },\n \"input, button, textarea, select\": {\n font: \"inherit\"\n },\n \"table\": {\n borderCollapse: \"collapse\",\n borderSpacing: 0\n },\n \"ol, ul\": {\n listStyle: \"none\"\n },\n \"a\": {\n display: \"inline-block\"\n },\n \"p, h1, h2, h3, h4, h5, h6\": {\n overflowWrap: \"break-word\",\n }\n }\n })\n }, [theme])\n\n return (\n <ThemeContex.Provider value={theme}>\n {\n isRootProvider ? <BreakpointProvider>\n <Tag\n minHeight=\"100%\"\n bgcolor={THEME.colors.background.primary}\n fontFamily={THEME.typography.fontFamily}\n fontSize={THEME.typography.text.fontSize}\n fontWeight={THEME.typography.text.fontWeight}\n lineHeight={THEME.typography.text.lineHeight}\n {...props}\n baseClass={`${theme}-theme-root`}\n direction={THEME.rtl ? \"rtl\" : \"ltr\"}\n >\n {children}\n {renderIsRoot}\n </Tag>\n </BreakpointProvider> : <Tag\n minHeight=\"100%\"\n bgcolor={THEME.colors.background.primary}\n fontFamily={THEME.typography.fontFamily}\n fontSize={THEME.typography.text.fontSize}\n fontWeight={THEME.typography.text.fontWeight}\n lineHeight={THEME.typography.text.lineHeight}\n {...props}\n baseClass={`${theme}-theme-root`}\n direction={THEME.rtl ? \"rtl\" : \"ltr\"}\n >\n {children}\n </Tag>\n }\n </ThemeContex.Provider>\n )\n}\n\nexport default ThemeProvider"],
|
|
5
|
-
"mappings": "AAAA,UAAYA,MAAW,QAEvB,OAAOC,MAAS,SAEhB,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,eAAAC,EAAa,gBAAAC,MAAoB,SAC1C,OAAOC,MAAkB,iBACzB,OAAS,OAAAC,MAAW,SAUpB,MAAMC,EAAgB,CAAC,CAAE,SAAAC,EAAU,MAAAC,EAAO,SAAAC,EAAU,aAAAC,EAAc,eAAA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AAOM,GAEvBG,EAAiBZ,EAAA,cAACE,EAAA,KACfF,EAAA,cAACC,EAAA,CACE,UAAU,OACV,QAASc,EAAM,OAAO,WAAW,QACjC,WAAYA,EAAM,WAAW,WAC7B,SAAUA,EAAM,WAAW,KAAK,SAChC,WAAYA,EAAM,WAAW,KAAK,WAClC,WAAYA,EAAM,WAAW,KAAK,WACjC,GAAGD,EACJ,UAAW,GAAGL,CAAK,cACnB,UAAWM,EAAM,IAAM,MAAQ,OAE9BP,EACAK,CACJ,CACH,EAAwBb,EAAA,cAACC,EAAA,CACtB,UAAU,OACV,QAASc,EAAM,OAAO,WAAW,QACjC,WAAYA,EAAM,WAAW,WAC7B,SAAUA,EAAM,WAAW,KAAK,SAChC,WAAYA,EAAM,WAAW,KAAK,WAClC,WAAYA,EAAM,WAAW,KAAK,WACjC,GAAGD,EACJ,UAAW,GAAGL,CAAK,cACnB,UAAWM,EAAM,IAAM,MAAQ,OAE9BP,CACJ,CAEN,CAEN,EAEA,IAAOW,EAAQZ",
|
|
6
|
-
"names": ["React", "Tag", "BreakpointProvider", "ThemeContex", "ThemeFactory", "ThemeCssVars", "css", "ThemeProvider", "children", "theme", "resetCss", "scrollbarCss", "isRootProvider", "renderIsRoot", "props", "THEME", "thumbSize", "thumbColor", "trackColor", "ThemeProvider_default"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { ThemeOptions } from \"./types\"\nimport Tag from \"../Tag\"\nimport { TagComponentType, TagProps } from \"../Tag/types\"\nimport { BreakpointProvider } from \"../breakpoint\"\nimport { ThemeContex, ThemeFactory } from \"./core\"\nimport ThemeCssVars from \"./ThemeCssVars\"\nimport { css } from \"../css\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n resetCss?: boolean;\n scrollbarCss?: boolean;\n isRootProvider?: boolean;\n renderIsRoot?: React.ReactElement;\n}\n\nconst ThemeProvider = ({ children, theme, resetCss, scrollbarCss, isRootProvider, renderIsRoot, ...props }: ThemeProviderProps) => {\n const THEME = ThemeFactory.get(theme) as ThemeOptions\n if (!THEME) throw new Error(`Invalid theme name provided: ${theme}`)\n resetCss ??= true\n scrollbarCss ??= true\n\n React.useMemo(() => {\n if (!!Object.keys(THEME.globalStyle).length) {\n css({\n \"@global\": THEME.globalStyle\n })\n }\n\n css({\n \"@global\": {\n [`.xui-${theme}-theme-root`]: ThemeCssVars(THEME)\n }\n })\n\n if (scrollbarCss && typeof document !== 'undefined') {\n let thumbSize = 10\n let thumbColor = THEME.colors.divider\n let trackColor = THEME.colors.background.secondary\n css({\n \"@global\": {\n \"*\": {\n scrollbarWidth: \"thin\",\n scrollbarColor: `${thumbColor} ${trackColor}`,\n },\n \"::-webkit-scrollbar\": {\n width: thumbSize,\n height: thumbSize,\n },\n \"::-webkit-scrollbar-thumb\": {\n backgroundColor: thumbColor,\n borderRadius: \"5px\",\n border: \"2px solid #f4f4f4\",\n },\n \"::-webkit-scrollbar-thumb:hover\": {\n backgroundColor: thumbColor,\n },\n \"::-webkit-scrollbar-track\": {\n backgroundColor: trackColor,\n borderRadius: \"5px\",\n },\n }\n })\n }\n\n resetCss && css({\n \"@global\": {\n \"*\": {\n m: 0,\n p: 0,\n outline: \"none\",\n boxSizing: \"border-box\",\n verticalAlign: \"baseline\",\n },\n \"html, body\": {\n minHeight: \"100%\",\n \"-webkit-font-smoothing\": \"antialiased\"\n } as any,\n \"img, picture, video, canvas, svg\": {\n maxWidth: \"100%\",\n display: \"block\"\n },\n \"input, button, textarea, select\": {\n font: \"inherit\"\n },\n \"table\": {\n borderCollapse: \"collapse\",\n borderSpacing: 0\n },\n \"ol, ul\": {\n listStyle: \"none\"\n },\n \"a\": {\n display: \"inline-block\"\n },\n \"p, h1, h2, h3, h4, h5, h6\": {\n overflowWrap: \"break-word\",\n }\n }\n })\n }, [theme])\n\n return (\n <ThemeContex.Provider value={theme}>\n {\n isRootProvider ? <BreakpointProvider>\n <Tag\n minHeight=\"100%\"\n bgcolor={THEME.colors.background.primary}\n fontFamily={THEME.typography.fontFamily}\n fontSize={THEME.typography.text.fontSize}\n fontWeight={THEME.typography.text.fontWeight}\n lineHeight={THEME.typography.text.lineHeight}\n {...props}\n baseClass={`${theme}-theme-root`}\n direction={THEME.rtl ? \"rtl\" : \"ltr\"}\n >\n {children}\n {renderIsRoot}\n </Tag>\n </BreakpointProvider> : <Tag\n minHeight=\"100%\"\n bgcolor={THEME.colors.background.primary}\n fontFamily={THEME.typography.fontFamily}\n fontSize={THEME.typography.text.fontSize}\n fontWeight={THEME.typography.text.fontWeight}\n lineHeight={THEME.typography.text.lineHeight}\n {...props}\n baseClass={`${theme}-theme-root`}\n direction={THEME.rtl ? \"rtl\" : \"ltr\"}\n >\n {children}\n </Tag>\n }\n </ThemeContex.Provider>\n )\n}\n\nexport default ThemeProvider"],"names":["__rest","ThemeFactory","React","css","ThemeContex","BreakpointProvider","Tag"],"mappings":"ymBAiBA,MAAM,aAAa,GAAG,CAAC,EAAuG,KAAI;AAA3G,IAAA,IAAA,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAgC,GAAA,EAAA,EAA3B,KAAK,GAAAA,YAAA,CAAA,EAAA,EAAjF,mFAAmF,CAAF;IACrG,MAAM,KAAK,GAAGC,iBAAY,CAAC,GAAG,CAAC,KAAK,CAAiB;AACrD,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,CAAA,CAAE,CAAC;IACpE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,MAAA,GAAA,QAAQ,IAAR,QAAQ,GAAK,IAAI,CAAA;IACjB,YAAY,KAAA,IAAA,IAAZ,YAAY,KAAZ,MAAA,GAAA,YAAY,IAAZ,YAAY,GAAK,IAAI,CAAA;AAErB,IAAAC,gBAAK,CAAC,OA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,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAC5C,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,IACxC,KAAK,EAAA,EACT,SAAS,EAAE,GAAG,KAAK,CAAA,WAAA,CAAa,EAChC,SAAS,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,GAAG,KAAK,EAAA,CAAA;YAEnC,QAAQ;AACR,YAAA,YAAY,CACV,CACY,GAAGJ,gBAAA,CAAA,aAAA,CAACI,OAAG,EACzB,MAAA,CAAA,MAAA,CAAA,EAAA,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,EACxC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,UAAU,EACvC,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EACxC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAC5C,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,IACxC,KAAK,EAAA,EACT,SAAS,EAAE,CAAA,EAAG,KAAK,CAAA,WAAA,CAAa,EAChC,SAAS,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,GAAG,KAAK,EAAA,CAAA,EAEnC,QAAQ,CACN,CAEW;AAE7B"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {__rest}from'tslib';import*as React from'react';import Tag from'../Tag/index.mjs';import {BreakpointProvider}from'../breakpoint/BreakpointProvider.mjs';import {css}from'../css/index.mjs';import {ThemeFactory,ThemeContex}from'./core.mjs';import ThemeCssVars from'./ThemeCssVars.mjs';const ThemeProvider = (_a) => {
|
|
2
|
+
var { children, theme, resetCss, scrollbarCss, isRootProvider, renderIsRoot } = _a, props = __rest(_a, ["children", "theme", "resetCss", "scrollbarCss", "isRootProvider", "renderIsRoot"]);
|
|
3
|
+
const THEME = ThemeFactory.get(theme);
|
|
4
|
+
if (!THEME)
|
|
5
|
+
throw new Error(`Invalid theme name provided: ${theme}`);
|
|
6
|
+
resetCss !== null && resetCss !== void 0 ? resetCss : (resetCss = true);
|
|
7
|
+
scrollbarCss !== null && scrollbarCss !== void 0 ? scrollbarCss : (scrollbarCss = true);
|
|
8
|
+
React.useMemo(() => {
|
|
9
|
+
if (!!Object.keys(THEME.globalStyle).length) {
|
|
10
|
+
css({
|
|
11
|
+
"@global": THEME.globalStyle
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
css({
|
|
15
|
+
"@global": {
|
|
16
|
+
[`.xui-${theme}-theme-root`]: ThemeCssVars(THEME)
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
if (scrollbarCss && typeof document !== 'undefined') {
|
|
20
|
+
let thumbSize = 10;
|
|
21
|
+
let thumbColor = THEME.colors.divider;
|
|
22
|
+
let trackColor = THEME.colors.background.secondary;
|
|
23
|
+
css({
|
|
24
|
+
"@global": {
|
|
25
|
+
"*": {
|
|
26
|
+
scrollbarWidth: "thin",
|
|
27
|
+
scrollbarColor: `${thumbColor} ${trackColor}`,
|
|
28
|
+
},
|
|
29
|
+
"::-webkit-scrollbar": {
|
|
30
|
+
width: thumbSize,
|
|
31
|
+
height: thumbSize,
|
|
32
|
+
},
|
|
33
|
+
"::-webkit-scrollbar-thumb": {
|
|
34
|
+
backgroundColor: thumbColor,
|
|
35
|
+
borderRadius: "5px",
|
|
36
|
+
border: "2px solid #f4f4f4",
|
|
37
|
+
},
|
|
38
|
+
"::-webkit-scrollbar-thumb:hover": {
|
|
39
|
+
backgroundColor: thumbColor,
|
|
40
|
+
},
|
|
41
|
+
"::-webkit-scrollbar-track": {
|
|
42
|
+
backgroundColor: trackColor,
|
|
43
|
+
borderRadius: "5px",
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
resetCss && css({
|
|
49
|
+
"@global": {
|
|
50
|
+
"*": {
|
|
51
|
+
m: 0,
|
|
52
|
+
p: 0,
|
|
53
|
+
outline: "none",
|
|
54
|
+
boxSizing: "border-box",
|
|
55
|
+
verticalAlign: "baseline",
|
|
56
|
+
},
|
|
57
|
+
"html, body": {
|
|
58
|
+
minHeight: "100%",
|
|
59
|
+
"-webkit-font-smoothing": "antialiased"
|
|
60
|
+
},
|
|
61
|
+
"img, picture, video, canvas, svg": {
|
|
62
|
+
maxWidth: "100%",
|
|
63
|
+
display: "block"
|
|
64
|
+
},
|
|
65
|
+
"input, button, textarea, select": {
|
|
66
|
+
font: "inherit"
|
|
67
|
+
},
|
|
68
|
+
"table": {
|
|
69
|
+
borderCollapse: "collapse",
|
|
70
|
+
borderSpacing: 0
|
|
71
|
+
},
|
|
72
|
+
"ol, ul": {
|
|
73
|
+
listStyle: "none"
|
|
74
|
+
},
|
|
75
|
+
"a": {
|
|
76
|
+
display: "inline-block"
|
|
77
|
+
},
|
|
78
|
+
"p, h1, h2, h3, h4, h5, h6": {
|
|
79
|
+
overflowWrap: "break-word",
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}, [theme]);
|
|
84
|
+
return (React.createElement(ThemeContex.Provider, { value: theme }, isRootProvider ? React.createElement(BreakpointProvider, null,
|
|
85
|
+
React.createElement(Tag, Object.assign({ minHeight: "100%", bgcolor: THEME.colors.background.primary, fontFamily: THEME.typography.fontFamily, fontSize: THEME.typography.text.fontSize, fontWeight: THEME.typography.text.fontWeight, lineHeight: THEME.typography.text.lineHeight }, props, { baseClass: `${theme}-theme-root`, direction: THEME.rtl ? "rtl" : "ltr" }),
|
|
86
|
+
children,
|
|
87
|
+
renderIsRoot)) : React.createElement(Tag, Object.assign({ minHeight: "100%", bgcolor: THEME.colors.background.primary, fontFamily: THEME.typography.fontFamily, fontSize: THEME.typography.text.fontSize, fontWeight: THEME.typography.text.fontWeight, lineHeight: THEME.typography.text.lineHeight }, props, { baseClass: `${theme}-theme-root`, direction: THEME.rtl ? "rtl" : "ltr" }), children)));
|
|
88
|
+
};export{ThemeProvider as default};//# sourceMappingURL=ThemeProvider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.mjs","sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { ThemeOptions } from \"./types\"\nimport Tag from \"../Tag\"\nimport { TagComponentType, TagProps } from \"../Tag/types\"\nimport { BreakpointProvider } from \"../breakpoint\"\nimport { ThemeContex, ThemeFactory } from \"./core\"\nimport ThemeCssVars from \"./ThemeCssVars\"\nimport { css } from \"../css\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n resetCss?: boolean;\n scrollbarCss?: boolean;\n isRootProvider?: boolean;\n renderIsRoot?: React.ReactElement;\n}\n\nconst ThemeProvider = ({ children, theme, resetCss, scrollbarCss, isRootProvider, renderIsRoot, ...props }: ThemeProviderProps) => {\n const THEME = ThemeFactory.get(theme) as ThemeOptions\n if (!THEME) throw new Error(`Invalid theme name provided: ${theme}`)\n resetCss ??= true\n scrollbarCss ??= true\n\n React.useMemo(() => {\n if (!!Object.keys(THEME.globalStyle).length) {\n css({\n \"@global\": THEME.globalStyle\n })\n }\n\n css({\n \"@global\": {\n [`.xui-${theme}-theme-root`]: ThemeCssVars(THEME)\n }\n })\n\n if (scrollbarCss && typeof document !== 'undefined') {\n let thumbSize = 10\n let thumbColor = THEME.colors.divider\n let trackColor = THEME.colors.background.secondary\n css({\n \"@global\": {\n \"*\": {\n scrollbarWidth: \"thin\",\n scrollbarColor: `${thumbColor} ${trackColor}`,\n },\n \"::-webkit-scrollbar\": {\n width: thumbSize,\n height: thumbSize,\n },\n \"::-webkit-scrollbar-thumb\": {\n backgroundColor: thumbColor,\n borderRadius: \"5px\",\n border: \"2px solid #f4f4f4\",\n },\n \"::-webkit-scrollbar-thumb:hover\": {\n backgroundColor: thumbColor,\n },\n \"::-webkit-scrollbar-track\": {\n backgroundColor: trackColor,\n borderRadius: \"5px\",\n },\n }\n })\n }\n\n resetCss && css({\n \"@global\": {\n \"*\": {\n m: 0,\n p: 0,\n outline: \"none\",\n boxSizing: \"border-box\",\n verticalAlign: \"baseline\",\n },\n \"html, body\": {\n minHeight: \"100%\",\n \"-webkit-font-smoothing\": \"antialiased\"\n } as any,\n \"img, picture, video, canvas, svg\": {\n maxWidth: \"100%\",\n display: \"block\"\n },\n \"input, button, textarea, select\": {\n font: \"inherit\"\n },\n \"table\": {\n borderCollapse: \"collapse\",\n borderSpacing: 0\n },\n \"ol, ul\": {\n listStyle: \"none\"\n },\n \"a\": {\n display: \"inline-block\"\n },\n \"p, h1, h2, h3, h4, h5, h6\": {\n overflowWrap: \"break-word\",\n }\n }\n })\n }, [theme])\n\n return (\n <ThemeContex.Provider value={theme}>\n {\n isRootProvider ? <BreakpointProvider>\n <Tag\n minHeight=\"100%\"\n bgcolor={THEME.colors.background.primary}\n fontFamily={THEME.typography.fontFamily}\n fontSize={THEME.typography.text.fontSize}\n fontWeight={THEME.typography.text.fontWeight}\n lineHeight={THEME.typography.text.lineHeight}\n {...props}\n baseClass={`${theme}-theme-root`}\n direction={THEME.rtl ? \"rtl\" : \"ltr\"}\n >\n {children}\n {renderIsRoot}\n </Tag>\n </BreakpointProvider> : <Tag\n minHeight=\"100%\"\n bgcolor={THEME.colors.background.primary}\n fontFamily={THEME.typography.fontFamily}\n fontSize={THEME.typography.text.fontSize}\n fontWeight={THEME.typography.text.fontWeight}\n lineHeight={THEME.typography.text.lineHeight}\n {...props}\n baseClass={`${theme}-theme-root`}\n direction={THEME.rtl ? \"rtl\" : \"ltr\"}\n >\n {children}\n </Tag>\n }\n </ThemeContex.Provider>\n )\n}\n\nexport default ThemeProvider"],"names":[],"mappings":"iSAiBA,MAAM,aAAa,GAAG,CAAC,EAAuG,KAAI;AAA3G,IAAA,IAAA,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,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KAAK,GAAG,KAAK,EAAA,CAAA,EAEnC,QAAQ,CACN,CAEW;AAE7B"}
|
package/theme/core.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export declare const mergeObject: (a: ObjectType, b: ObjectType) => ObjectType;
|
|
1
|
+
import { ThemeOptions } from './types.js';
|
|
2
|
+
|
|
3
|
+
declare const getTheme: (theme: string) => ThemeOptions | undefined;
|
|
4
|
+
declare const useTheme: () => ThemeOptions;
|
|
5
|
+
|
|
6
|
+
export { getTheme, useTheme };
|
package/theme/core.js
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var React=require('react');const ThemeFactory = new Map();
|
|
2
|
+
const ThemeContex = React.createContext("light");
|
|
3
|
+
const getTheme = (theme) => ThemeFactory.get(theme);
|
|
4
|
+
const useTheme = () => ThemeFactory.get(React.useContext(ThemeContex));
|
|
5
|
+
const mergeObject = (a, b) => {
|
|
6
|
+
a = Object.assign({}, a);
|
|
7
|
+
b = Object.assign({}, b);
|
|
8
|
+
for (const key in b) {
|
|
9
|
+
const v = b[key];
|
|
10
|
+
if (typeof v === 'object' && !Array.isArray(v) && !React.isValidElement(v)) {
|
|
11
|
+
a[key] = mergeObject(a[key], b[key]);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
a[key] = v;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};exports.ThemeContex=ThemeContex;exports.ThemeFactory=ThemeFactory;exports.getTheme=getTheme;exports.mergeObject=mergeObject;exports.useTheme=useTheme;//# sourceMappingURL=core.js.map
|
package/theme/core.js.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/theme/core.ts"],
|
|
4
|
-
"sourcesContent": ["import React from \"react\"\nimport { ObjectType, ThemeOptions } from \"./types\"\n\nexport const ThemeFactory = new Map<string, ThemeOptions>()\nexport const ThemeContex = React.createContext(\"light\")\nexport const getTheme = (theme: string) => ThemeFactory.get(theme)\nexport const useTheme = (): ThemeOptions => ThemeFactory.get(React.useContext(ThemeContex)) as any\n\nexport const mergeObject = (a: ObjectType, b: ObjectType) => {\n a = { ...a }\n b = { ...b }\n for (const key in b) {\n const v = (b as any)[key]\n if (typeof v === 'object' && !Array.isArray(v) && !React.isValidElement(v)) {\n a[key] = mergeObject(a[key], b[key])\n } else {\n a[key] = v\n }\n }\n return a\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAOA,MAAW,QAGX,MAAMC,EAAe,IAAI,IACnBC,EAAcF,EAAM,cAAc,OAAO,EACzCG,EAAYC,GAAkBH,EAAa,IAAIG,CAAK,EACpDC,EAAW,IAAoBJ,EAAa,IAAID,EAAM,WAAWE,CAAW,CAAC,EAE7EI,EAAc,CAACC,EAAeC,IAAkB,CAC1DD,EAAI,CAAE,GAAGA,CAAE,EACXC,EAAI,CAAE,GAAGA,CAAE,EACX,UAAWC,KAAOD,EAAG,CAClB,MAAME,EAAKF,EAAUC,CAAG,EACpB,OAAOC,GAAM,UAAY,CAAC,MAAM,QAAQA,CAAC,GAAK,CAACV,EAAM,eAAeU,CAAC,EACtEH,EAAEE,CAAG,EAAIH,EAAYC,EAAEE,CAAG,EAAGD,EAAEC,CAAG,CAAC,EAEnCF,EAAEE,CAAG,EAAIC,CAEf,CACA,OAAOH,CACV",
|
|
6
|
-
"names": ["React", "ThemeFactory", "ThemeContex", "getTheme", "theme", "useTheme", "mergeObject", "a", "b", "key", "v"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"core.js","sources":["../../src/theme/core.ts"],"sourcesContent":["import React from \"react\"\nimport { ObjectType, ThemeOptions } from \"./types\"\n\nexport const ThemeFactory = new Map<string, ThemeOptions>()\nexport const ThemeContex = React.createContext(\"light\")\nexport const getTheme = (theme: string) => ThemeFactory.get(theme)\nexport const useTheme = (): ThemeOptions => ThemeFactory.get(React.useContext(ThemeContex)) as any\n\nexport const mergeObject = (a: ObjectType, b: ObjectType) => {\n a = { ...a }\n b = { ...b }\n for (const key in b) {\n const v = (b as any)[key]\n if (typeof v === 'object' && !Array.isArray(v) && !React.isValidElement(v)) {\n a[key] = mergeObject(a[key], b[key])\n } else {\n a[key] = v\n }\n }\n return a\n}\n"],"names":[],"mappings":"iGAGa,MAAA,YAAY,GAAG,IAAI,GAAG;AACtB,MAAA,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO;AAC/C,MAAM,QAAQ,GAAG,CAAC,KAAa,KAAK,YAAY,CAAC,GAAG,CAAC,KAAK;AACpD,MAAA,QAAQ,GAAG,MAAoB,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;MAE7E,WAAW,GAAG,CAAC,CAAa,EAAE,CAAa,KAAI;IACzD,CAAC,GAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAQ,CAAC,CAAE;IACZ,CAAC,GAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAQ,CAAC,CAAE;AACZ,IAAA,KAAK,MAAM,GAAG,IAAI,CAAC,EAAE;AAClB,QAAA,MAAM,CAAC,GAAI,CAAS,CAAC,GAAG,CAAC;QACzB,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;AACzE,YAAA,CAAC,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;AACtC;AAAM,aAAA;AACJ,YAAA,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;AACZ;AACH;AACD,IAAA,OAAO,CAAC;AACX"}
|
package/theme/core.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React__default from'react';const ThemeFactory = new Map();
|
|
2
|
+
const ThemeContex = React__default.createContext("light");
|
|
3
|
+
const getTheme = (theme) => ThemeFactory.get(theme);
|
|
4
|
+
const useTheme = () => ThemeFactory.get(React__default.useContext(ThemeContex));
|
|
5
|
+
const mergeObject = (a, b) => {
|
|
6
|
+
a = Object.assign({}, a);
|
|
7
|
+
b = Object.assign({}, b);
|
|
8
|
+
for (const key in b) {
|
|
9
|
+
const v = b[key];
|
|
10
|
+
if (typeof v === 'object' && !Array.isArray(v) && !React__default.isValidElement(v)) {
|
|
11
|
+
a[key] = mergeObject(a[key], b[key]);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
a[key] = v;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};export{ThemeContex,ThemeFactory,getTheme,mergeObject,useTheme};//# sourceMappingURL=core.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.mjs","sources":["../../src/theme/core.ts"],"sourcesContent":["import React from \"react\"\nimport { ObjectType, ThemeOptions } from \"./types\"\n\nexport const ThemeFactory = new Map<string, ThemeOptions>()\nexport const ThemeContex = React.createContext(\"light\")\nexport const getTheme = (theme: string) => ThemeFactory.get(theme)\nexport const useTheme = (): ThemeOptions => ThemeFactory.get(React.useContext(ThemeContex)) as any\n\nexport const mergeObject = (a: ObjectType, b: ObjectType) => {\n a = { ...a }\n b = { ...b }\n for (const key in b) {\n const v = (b as any)[key]\n if (typeof v === 'object' && !Array.isArray(v) && !React.isValidElement(v)) {\n a[key] = mergeObject(a[key], b[key])\n } else {\n a[key] = v\n }\n }\n return a\n}\n"],"names":["React"],"mappings":"kCAGa,MAAA,YAAY,GAAG,IAAI,GAAG;AACtB,MAAA,WAAW,GAAGA,cAAK,CAAC,aAAa,CAAC,OAAO;AAC/C,MAAM,QAAQ,GAAG,CAAC,KAAa,KAAK,YAAY,CAAC,GAAG,CAAC,KAAK;AACpD,MAAA,QAAQ,GAAG,MAAoB,YAAY,CAAC,GAAG,CAACA,cAAK,CAAC,UAAU,CAAC,WAAW,CAAC;MAE7E,WAAW,GAAG,CAAC,CAAa,EAAE,CAAa,KAAI;IACzD,CAAC,GAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAQ,CAAC,CAAE;IACZ,CAAC,GAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAQ,CAAC,CAAE;AACZ,IAAA,KAAK,MAAM,GAAG,IAAI,CAAC,EAAE;AAClB,QAAA,MAAM,CAAC,GAAI,CAAS,CAAC,GAAG,CAAC;QACzB,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAACA,cAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;AACzE,YAAA,CAAC,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;AACtC;AAAM,aAAA;AACJ,YAAA,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;AACZ;AACH;AACD,IAAA,OAAO,CAAC;AACX"}
|
package/theme/createColor.js
CHANGED
|
@@ -1,2 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';var index=require('../css/index.js');const createColor = (theme, name) => {
|
|
2
|
+
let color = theme.colors[name];
|
|
3
|
+
let { primary, secondary } = color;
|
|
4
|
+
let text = color.text || theme.colors.text.primary;
|
|
5
|
+
let _alpha = index.alpha(primary, .1);
|
|
6
|
+
const isBag = (a, b) => name === "background" ? a : b;
|
|
7
|
+
return {
|
|
8
|
+
alpha: _alpha,
|
|
9
|
+
template: {
|
|
10
|
+
outline: {
|
|
11
|
+
bgcolor: "transparent",
|
|
12
|
+
color: isBag(text, primary),
|
|
13
|
+
border: 1,
|
|
14
|
+
borderColor: isBag("divider", index.alpha(primary, .4)),
|
|
15
|
+
hover: {
|
|
16
|
+
color: isBag(text, primary),
|
|
17
|
+
borderColor: isBag("divider", index.alpha(primary, .8)),
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
fill: {
|
|
21
|
+
bgcolor: isBag(secondary, primary),
|
|
22
|
+
color: text,
|
|
23
|
+
hover: {
|
|
24
|
+
bgcolor: isBag(index.alpha(secondary, .6), secondary),
|
|
25
|
+
color: text,
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
text: {
|
|
29
|
+
bgcolor: "transparent",
|
|
30
|
+
color: isBag(text, primary),
|
|
31
|
+
hover: {
|
|
32
|
+
bgcolor: isBag(index.alpha(secondary, .6), index.alpha(primary, .1)),
|
|
33
|
+
color: isBag(text, primary),
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
alpha: {
|
|
37
|
+
bgcolor: isBag(index.alpha(secondary, .5), index.alpha(primary, .1)),
|
|
38
|
+
color: isBag(text, primary),
|
|
39
|
+
hover: {
|
|
40
|
+
bgcolor: isBag(index.alpha(secondary, .8), index.alpha(primary, .15)),
|
|
41
|
+
color: isBag(text, primary),
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};module.exports=createColor;//# sourceMappingURL=createColor.js.map
|
package/theme/createColor.js.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/theme/createColor.ts"],
|
|
4
|
-
"sourcesContent": ["import { ThemeOptions, ThemeColor } from \"./types\"\nimport { alpha } from \"../css\"\n\nconst createColor = (theme: ThemeOptions, name: keyof ThemeColor) => {\n let color = theme.colors[name]\n let { primary, secondary } = color as any\n let text = (color as any).text || theme.colors.text.primary\n let _alpha = alpha(primary, .1)\n\n const isBag = (a: any, b: any) => name === \"background\" ? a : b\n\n return {\n alpha: _alpha,\n template: {\n outline: {\n bgcolor: \"transparent\",\n color: isBag(text, primary),\n border: 1,\n borderColor: isBag(\"divider\", alpha(primary, .4)),\n hover: {\n color: isBag(text, primary),\n borderColor: isBag(\"divider\", alpha(primary, .8)),\n }\n },\n fill: {\n bgcolor: isBag(secondary, primary),\n color: text,\n hover: {\n bgcolor: isBag(alpha(secondary, .6), secondary),\n color: text,\n }\n },\n text: {\n bgcolor: \"transparent\",\n color: isBag(text, primary),\n hover: {\n bgcolor: isBag(alpha(secondary, .6), alpha(primary, .1)),\n color: isBag(text, primary),\n }\n },\n alpha: {\n bgcolor: isBag(alpha(secondary, .5), alpha(primary, .1)),\n color: isBag(text, primary),\n hover: {\n bgcolor: isBag(alpha(secondary, .8), alpha(primary, .15)),\n color: isBag(text, primary),\n }\n }\n }\n }\n}\n\nexport default createColor"],
|
|
5
|
-
"mappings": "AACA,OAAS,SAAAA,MAAa,SAEtB,MAAMC,EAAc,CAACC,EAAqBC,IAA2B,CAClE,IAAIC,EAAQF,EAAM,OAAOC,CAAI,EACzB,CAAE,QAAAE,EAAS,UAAAC,CAAU,EAAIF,EACzBG,EAAQH,EAAc,MAAQF,EAAM,OAAO,KAAK,QAChDM,EAASR,EAAMK,EAAS,EAAE,EAE9B,MAAMI,EAAQ,CAACC,EAAQC,IAAWR,IAAS,aAAeO,EAAIC,EAE9D,MAAO,CACJ,MAAOH,EACP,SAAU,CACP,QAAS,CACN,QAAS,cACT,MAAOC,EAAMF,EAAMF,CAAO,EAC1B,OAAQ,EACR,YAAaI,EAAM,UAAWT,EAAMK,EAAS,EAAE,CAAC,EAChD,MAAO,CACJ,MAAOI,EAAMF,EAAMF,CAAO,EAC1B,YAAaI,EAAM,UAAWT,EAAMK,EAAS,EAAE,CAAC,CACnD,CACH,EACA,KAAM,CACH,QAASI,EAAMH,EAAWD,CAAO,EACjC,MAAOE,EACP,MAAO,CACJ,QAASE,EAAMT,EAAMM,EAAW,EAAE,EAAGA,CAAS,EAC9C,MAAOC,CACV,CACH,EACA,KAAM,CACH,QAAS,cACT,MAAOE,EAAMF,EAAMF,CAAO,EAC1B,MAAO,CACJ,QAASI,EAAMT,EAAMM,EAAW,EAAE,EAAGN,EAAMK,EAAS,EAAE,CAAC,EACvD,MAAOI,EAAMF,EAAMF,CAAO,CAC7B,CACH,EACA,MAAO,CACJ,QAASI,EAAMT,EAAMM,EAAW,EAAE,EAAGN,EAAMK,EAAS,EAAE,CAAC,EACvD,MAAOI,EAAMF,EAAMF,CAAO,EAC1B,MAAO,CACJ,QAASI,EAAMT,EAAMM,EAAW,EAAE,EAAGN,EAAMK,EAAS,GAAG,CAAC,EACxD,MAAOI,EAAMF,EAAMF,CAAO,CAC7B,CACH,CACH,CACH,CACH,EAEA,IAAOO,EAAQX",
|
|
6
|
-
"names": ["alpha", "createColor", "theme", "name", "color", "primary", "secondary", "text", "_alpha", "isBag", "a", "b", "createColor_default"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"createColor.js","sources":["../../src/theme/createColor.ts"],"sourcesContent":["import { ThemeOptions, ThemeColor } from \"./types\"\nimport { alpha } from \"../css\"\n\nconst createColor = (theme: ThemeOptions, name: keyof ThemeColor) => {\n let color = theme.colors[name]\n let { primary, secondary } = color as any\n let text = (color as any).text || theme.colors.text.primary\n let _alpha = alpha(primary, .1)\n\n const isBag = (a: any, b: any) => name === \"background\" ? a : b\n\n return {\n alpha: _alpha,\n template: {\n outline: {\n bgcolor: \"transparent\",\n color: isBag(text, primary),\n border: 1,\n borderColor: isBag(\"divider\", alpha(primary, .4)),\n hover: {\n color: isBag(text, primary),\n borderColor: isBag(\"divider\", alpha(primary, .8)),\n }\n },\n fill: {\n bgcolor: isBag(secondary, primary),\n color: text,\n hover: {\n bgcolor: isBag(alpha(secondary, .6), secondary),\n color: text,\n }\n },\n text: {\n bgcolor: \"transparent\",\n color: isBag(text, primary),\n hover: {\n bgcolor: isBag(alpha(secondary, .6), alpha(primary, .1)),\n color: isBag(text, primary),\n }\n },\n alpha: {\n bgcolor: isBag(alpha(secondary, .5), alpha(primary, .1)),\n color: isBag(text, primary),\n hover: {\n bgcolor: isBag(alpha(secondary, .8), alpha(primary, .15)),\n color: isBag(text, primary),\n }\n }\n }\n }\n}\n\nexport default createColor"],"names":["alpha"],"mappings":"kDAGA,MAAM,WAAW,GAAG,CAAC,KAAmB,EAAE,IAAsB,KAAI;IACjE,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AAC9B,IAAA,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAY;AACzC,IAAA,IAAI,IAAI,GAAI,KAAa,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;IAC3D,IAAI,MAAM,GAAGA,WAAK,CAAC,OAAO,EAAE,EAAE,CAAC;IAE/B,MAAM,KAAK,GAAG,CAAC,CAAM,EAAE,CAAM,KAAK,IAAI,KAAK,YAAY,GAAG,CAAC,GAAG,CAAC;IAE/D,OAAO;AACJ,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,QAAQ,EAAE;AACP,YAAA,OAAO,EAAE;AACN,gBAAA,OAAO,EAAE,aAAa;AACtB,gBAAA,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3B,gBAAA,MAAM,EAAE,CAAC;gBACT,WAAW,EAAE,KAAK,CAAC,SAAS,EAAEA,WAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACjD,gBAAA,KAAK,EAAE;AACJ,oBAAA,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;oBAC3B,WAAW,EAAE,KAAK,CAAC,SAAS,EAAEA,WAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACnD;AACH,aAAA;AACD,YAAA,IAAI,EAAE;AACH,gBAAA,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC;AAClC,gBAAA,KAAK,EAAE,IAAI;AACX,gBAAA,KAAK,EAAE;oBACJ,OAAO,EAAE,KAAK,CAACA,WAAK,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,SAAS,CAAC;AAC/C,oBAAA,KAAK,EAAE,IAAI;AACb;AACH,aAAA;AACD,YAAA,IAAI,EAAE;AACH,gBAAA,OAAO,EAAE,aAAa;AACtB,gBAAA,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3B,gBAAA,KAAK,EAAE;AACJ,oBAAA,OAAO,EAAE,KAAK,CAACA,WAAK,CAAC,SAAS,EAAE,EAAE,CAAC,EAAEA,WAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACxD,oBAAA,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;AAC7B;AACH,aAAA;AACD,YAAA,KAAK,EAAE;AACJ,gBAAA,OAAO,EAAE,KAAK,CAACA,WAAK,CAAC,SAAS,EAAE,EAAE,CAAC,EAAEA,WAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACxD,gBAAA,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3B,gBAAA,KAAK,EAAE;AACJ,oBAAA,OAAO,EAAE,KAAK,CAACA,WAAK,CAAC,SAAS,EAAE,EAAE,CAAC,EAAEA,WAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACzD,oBAAA,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;AAC7B;AACH;AACH;KACH;AACJ"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {alpha}from'../css/index.mjs';const createColor = (theme, name) => {
|
|
2
|
+
let color = theme.colors[name];
|
|
3
|
+
let { primary, secondary } = color;
|
|
4
|
+
let text = color.text || theme.colors.text.primary;
|
|
5
|
+
let _alpha = alpha(primary, .1);
|
|
6
|
+
const isBag = (a, b) => name === "background" ? a : b;
|
|
7
|
+
return {
|
|
8
|
+
alpha: _alpha,
|
|
9
|
+
template: {
|
|
10
|
+
outline: {
|
|
11
|
+
bgcolor: "transparent",
|
|
12
|
+
color: isBag(text, primary),
|
|
13
|
+
border: 1,
|
|
14
|
+
borderColor: isBag("divider", alpha(primary, .4)),
|
|
15
|
+
hover: {
|
|
16
|
+
color: isBag(text, primary),
|
|
17
|
+
borderColor: isBag("divider", alpha(primary, .8)),
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
fill: {
|
|
21
|
+
bgcolor: isBag(secondary, primary),
|
|
22
|
+
color: text,
|
|
23
|
+
hover: {
|
|
24
|
+
bgcolor: isBag(alpha(secondary, .6), secondary),
|
|
25
|
+
color: text,
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
text: {
|
|
29
|
+
bgcolor: "transparent",
|
|
30
|
+
color: isBag(text, primary),
|
|
31
|
+
hover: {
|
|
32
|
+
bgcolor: isBag(alpha(secondary, .6), alpha(primary, .1)),
|
|
33
|
+
color: isBag(text, primary),
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
alpha: {
|
|
37
|
+
bgcolor: isBag(alpha(secondary, .5), alpha(primary, .1)),
|
|
38
|
+
color: isBag(text, primary),
|
|
39
|
+
hover: {
|
|
40
|
+
bgcolor: isBag(alpha(secondary, .8), alpha(primary, .15)),
|
|
41
|
+
color: isBag(text, primary),
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};export{createColor as default};//# sourceMappingURL=createColor.mjs.map
|