@xanui/core 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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.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/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.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.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.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.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.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.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.js +55 -2
- package/css/index.js.map +1 -7
- package/css/index.mjs +55 -0
- package/css/index.mjs.map +1 -0
- package/index.d.ts +629 -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.js +1 -2
- package/isWindow.js.map +1 -7
- package/isWindow.mjs +1 -0
- package/isWindow.mjs.map +1 -0
- package/package.json +29 -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.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.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.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/useAnimation.js +25 -2
- package/useAnimation.js.map +1 -7
- package/useAnimation.mjs +25 -0
- package/useAnimation.mjs.map +1 -0
- package/useColorTemplate.js +6 -2
- package/useColorTemplate.js.map +1 -7
- package/useColorTemplate.mjs +6 -0
- package/useColorTemplate.mjs.map +1 -0
- package/useInterface.js +8 -2
- package/useInterface.js.map +1 -7
- package/useInterface.mjs +8 -0
- package/useInterface.mjs.map +1 -0
- package/ServerStyleTags.d.ts +0 -3
- package/Tag/cssPropList.d.ts +0 -2
- package/Tag/index.d.ts +0 -4
- package/Tag/types.d.ts +0 -179
- package/Tag/types.js +0 -1
- package/Tag/types.js.map +0 -7
- package/Tag/useTagProps.d.ts +0 -3
- package/Transition/index.d.ts +0 -31
- package/Transition/variants.d.ts +0 -131
- package/breakpoint/index.d.ts +0 -6
- package/breakpoint/index.js +0 -2
- package/breakpoint/index.js.map +0 -7
- package/breakpoint/useBreakpoint.d.ts +0 -10
- package/breakpoint/useBreakpointProps.d.ts +0 -6
- 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/getProps.d.ts +0 -3
- package/css/getValue.d.ts +0 -3
- package/css/index.d.ts +0 -15
- package/css/types.d.ts +0 -54
- package/css/types.js +0 -1
- package/css/types.js.map +0 -7
- package/isWindow.d.ts +0 -2
- package/theme/ThemeCssVars.d.ts +0 -3
- package/theme/ThemeDefaultOptions.d.ts +0 -68
- package/theme/ThemeProvider.d.ts +0 -11
- package/theme/core.d.ts +0 -7
- package/theme/createColor.d.ts +0 -41
- package/theme/createTheme.d.ts +0 -2
- package/theme/createThemeSwitcher.d.ts +0 -6
- package/theme/index.d.ts +0 -5
- package/theme/types.d.ts +0 -124
- package/theme/types.js +0 -1
- package/theme/types.js.map +0 -7
- package/useAnimation.d.ts +0 -18
- package/useColorTemplate.d.ts +0 -4
- package/useInterface.d.ts +0 -2
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,eAAAC,EAAgB,aAAAC,EAAc,GAAGC,CAAM,IAA0B,CAChI,MAAMC,EAAQX,EAAa,IAAIK,CAAK,EACpC,GAAI,CAACM,EAAO,MAAM,IAAI,MAAM,gCAAgCN,CAAK,EAAE,EACnE,OAAAC,MAAa,IACbC,MAAiB,IAEjBX,EAAM,QAAQ,IAAM,CAajB,GAZM,OAAO,KAAKe,E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AAGD,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,OAAO,CAAC,MAAK;AAChB,QAAA,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE;AAC1C,YAAAC,SAAG,CAAC;gBACD,SAAS,EAAE,KAAK,CAAC;AACnB,aAAA,CAAC;AACJ;AAED,QAAAA,SAAG,CAAC;AACD,YAAA,SAAS,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G,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,EAAgC,GAAA,EAAA,EAA3B,KAAK,GAAA,MAAA,CAAA,EAAA,EAAjF,mFAAmF,CAAF;IACrG,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,CAAiB;AACrD,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,CAAA,CAAE,C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AA,CAAA,EACD,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,GAAG,KAAK,CAAA,WAAA,CAAa,EAChC,SAAS,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,GAAG,KAAK,EAAA,CAAA;YAEnC,QAAQ;AACR,YAAA,YAAY,CACV,CACY,GAAG,KAAA,CAAA,aAAA,CAAC,GAAG,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"}
|
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,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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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createColor.mjs","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":[],"mappings":"qCAGA,MAAM,WAAW,GAAG,CAAC,KAAmB,EAAE,IAAsB,KAAI;IACjE,IAAI,KAAK,GAAG,KAAK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AAA,KAAK,EAAE;AACJ,oBAAA,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,KAAK,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,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,KAAK,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,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACzD,oBAAA,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;AAC7B;AACH;AACH;KACH;AACJ"}
|
package/theme/createTheme.js
CHANGED
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var ThemeDefaultOptions=require('./ThemeDefaultOptions.js'),core=require('./core.js'),createColor=require('./createColor.js'),index=require('../css/index.js');const createTheme = (name, options, darkMode) => {
|
|
2
|
+
if (!core.ThemeFactory.has(name)) {
|
|
3
|
+
let theme = core.mergeObject(ThemeDefaultOptions.default, Object.assign(Object.assign(Object.assign({}, ({})), options), { name, breakpoints: index.breakpoints }));
|
|
4
|
+
theme = core.mergeObject(theme, {
|
|
5
|
+
colors: {
|
|
6
|
+
background: createColor(theme, "background"),
|
|
7
|
+
brand: createColor(theme, "brand"),
|
|
8
|
+
accent: createColor(theme, "accent"),
|
|
9
|
+
info: createColor(theme, "info"),
|
|
10
|
+
success: createColor(theme, "success"),
|
|
11
|
+
warning: createColor(theme, "warning"),
|
|
12
|
+
danger: createColor(theme, "danger")
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
core.ThemeFactory.set(name, theme);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
throw new Error(`theme "${name}" already exists!`);
|
|
19
|
+
}
|
|
20
|
+
return core.ThemeFactory.get(name);
|
|
21
|
+
};exports.createTheme=createTheme;//# sourceMappingURL=createTheme.js.map
|
package/theme/createTheme.js.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/theme/createTheme.ts"],
|
|
4
|
-
"sourcesContent": ["import { ThemeOptions, ThemeOptionInput } from \"./types\"\nimport defaultThemeOption, { darkColorPallete } from './ThemeDefaultOptions'\nimport { mergeObject, ThemeFactory } from \"./core\"\nimport createColor from \"./createColor\"\nimport { breakpoints } from \"../css\"\n\nexport const createTheme = (name: string, options: ThemeOptionInput, darkMode?: boolean): ThemeOptions => {\n if (!ThemeFactory.has(name)) {\n let theme: any = mergeObject(defaultThemeOption, {\n ...(darkMode ? darkColorPallete : {}),\n ...options,\n name,\n breakpoints: breakpoints\n })\n\n theme = mergeObject(theme, {\n colors: {\n background: createColor(theme, \"background\"),\n brand: createColor(theme, \"brand\"),\n accent: createColor(theme, \"accent\"),\n info: createColor(theme, \"info\"),\n success: createColor(theme, \"success\"),\n warning: createColor(theme, \"warning\"),\n danger: createColor(theme, \"danger\")\n }\n })\n ThemeFactory.set(name, theme)\n } else {\n throw new Error(`theme \"${name}\" already exists!`);\n }\n\n return ThemeFactory.get(name) as ThemeOptions\n}\n"],
|
|
5
|
-
"mappings": "AACA,OAAOA,GAAsB,oBAAAC,MAAwB,wBACrD,OAAS,eAAAC,EAAa,gBAAAC,MAAoB,SAC1C,OAAOC,MAAiB,gBACxB,OAAS,eAAAC,MAAmB,SAErB,MAAMC,EAAc,CAACC,EAAcC,EAA2BC,IAAqC,CACvG,GAAKN,EAAa,IAAII,CAAI,EAqBvB,MAAM,IAAI,MAAM,UAAUA,CAAI,mBAAmB,EArBvB,CAC1B,IAAIG,EAAaR,EAAYF,EAAoB,CAC9C,GAAIS,EAAWR,EAAmB,CAAC,EACnC,GAAGO,EACH,KAAAD,EACA,YAAaF,CAChB,CAAC,EAEDK,EAAQR,EAAYQ,EAAO,CACxB,OAAQ,CACL,WAAYN,EAAYM,EAAO,YAAY,EAC3C,MAAON,EAAYM,EAAO,OAAO,EACjC,OAAQN,EAAYM,EAAO,QAAQ,EACnC,KAAMN,EAAYM,EAAO,MAAM,EAC/B,QAASN,EAAYM,EAAO,SAAS,EACrC,QAASN,EAAYM,EAAO,SAAS,EACrC,OAAQN,EAAYM,EAAO,QAAQ,CACtC,CACH,CAAC,EACDP,EAAa,IAAII,EAAMG,CAAK,CAC/B,CAIA,OAAOP,EAAa,IAAII,CAAI,CAC/B",
|
|
6
|
-
"names": ["defaultThemeOption", "darkColorPallete", "mergeObject", "ThemeFactory", "createColor", "breakpoints", "createTheme", "name", "options", "darkMode", "theme"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"createTheme.js","sources":["../../src/theme/createTheme.ts"],"sourcesContent":["import { ThemeOptions, ThemeOptionInput } from \"./types\"\nimport defaultThemeOption, { darkColorPallete } from './ThemeDefaultOptions'\nimport { mergeObject, ThemeFactory } from \"./core\"\nimport createColor from \"./createColor\"\nimport { breakpoints } from \"../css\"\n\nexport const createTheme = (name: string, options: ThemeOptionInput, darkMode?: boolean): ThemeOptions => {\n if (!ThemeFactory.has(name)) {\n let theme: any = mergeObject(defaultThemeOption, {\n ...(darkMode ? darkColorPallete : {}),\n ...options,\n name,\n breakpoints: breakpoints\n })\n\n theme = mergeObject(theme, {\n colors: {\n background: createColor(theme, \"background\"),\n brand: createColor(theme, \"brand\"),\n accent: createColor(theme, \"accent\"),\n info: createColor(theme, \"info\"),\n success: createColor(theme, \"success\"),\n warning: createColor(theme, \"warning\"),\n danger: createColor(theme, \"danger\")\n }\n })\n ThemeFactory.set(name, theme)\n } else {\n throw new Error(`theme \"${name}\" already exists!`);\n }\n\n return ThemeFactory.get(name) as ThemeOptions\n}\n"],"names":["ThemeFactory","mergeObject","defaultThemeOption","breakpoints"],"mappings":"qOAMa,MAAA,WAAW,GAAG,CAAC,IAAY,EAAE,OAAyB,EAAE,QAAkB,KAAkB;AACtG,IAAA,IAAI,CAACA,iBAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAC1B,IAAI,KAAK,GAAQC,gBAAW,CAACC,2BAAkB,EACzC,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,GAA+B,EAAE,EAAC,EAClC,OAAO,CAAA,EAAA,EACV,IAAI,EACJ,WAAW,EAAEC,iBAAW,EAAA,CAAA,CACzB;AAEF,QAAA,KAAK,GAAGF,gBAAW,CAAC,KAAK,EAAE;AACxB,YAAA,MAAM,EAAE;AACL,gBAAA,UAAU,EAAE,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC;AAC5C,gBAAA,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC;AAClC,gBAAA,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;AACpC,gBAAA,IAAI,EAAE,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC;AAChC,gBAAA,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC;AACtC,gBAAA,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC;AACtC,gBAAA,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,QAAQ;AACrC;AACH,SAAA,CAAC;AACF,QAAAD,iBAAY,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;AAC/B;AAAM,SAAA;AACJ,QAAA,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,CAAA,iBAAA,CAAmB,CAAC;AACpD;AAED,IAAA,OAAOA,iBAAY,CAAC,GAAG,CAAC,IAAI,CAAiB;AAChD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import defaultThemeOption from'./ThemeDefaultOptions.mjs';import {ThemeFactory,mergeObject}from'./core.mjs';import createColor from'./createColor.mjs';import {breakpoints}from'../css/index.mjs';const createTheme = (name, options, darkMode) => {
|
|
2
|
+
if (!ThemeFactory.has(name)) {
|
|
3
|
+
let theme = mergeObject(defaultThemeOption, Object.assign(Object.assign(Object.assign({}, ({})), options), { name, breakpoints: breakpoints }));
|
|
4
|
+
theme = mergeObject(theme, {
|
|
5
|
+
colors: {
|
|
6
|
+
background: createColor(theme, "background"),
|
|
7
|
+
brand: createColor(theme, "brand"),
|
|
8
|
+
accent: createColor(theme, "accent"),
|
|
9
|
+
info: createColor(theme, "info"),
|
|
10
|
+
success: createColor(theme, "success"),
|
|
11
|
+
warning: createColor(theme, "warning"),
|
|
12
|
+
danger: createColor(theme, "danger")
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
ThemeFactory.set(name, theme);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
throw new Error(`theme "${name}" already exists!`);
|
|
19
|
+
}
|
|
20
|
+
return ThemeFactory.get(name);
|
|
21
|
+
};export{createTheme};//# sourceMappingURL=createTheme.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTheme.mjs","sources":["../../src/theme/createTheme.ts"],"sourcesContent":["import { ThemeOptions, ThemeOptionInput } from \"./types\"\nimport defaultThemeOption, { darkColorPallete } from './ThemeDefaultOptions'\nimport { mergeObject, ThemeFactory } from \"./core\"\nimport createColor from \"./createColor\"\nimport { breakpoints } from \"../css\"\n\nexport const createTheme = (name: string, options: ThemeOptionInput, darkMode?: boolean): ThemeOptions => {\n if (!ThemeFactory.has(name)) {\n let theme: any = mergeObject(defaultThemeOption, {\n ...(darkMode ? darkColorPallete : {}),\n ...options,\n name,\n breakpoints: breakpoints\n })\n\n theme = mergeObject(theme, {\n colors: {\n background: createColor(theme, \"background\"),\n brand: createColor(theme, \"brand\"),\n accent: createColor(theme, \"accent\"),\n info: createColor(theme, \"info\"),\n success: createColor(theme, \"success\"),\n warning: createColor(theme, \"warning\"),\n danger: createColor(theme, \"danger\")\n }\n })\n ThemeFactory.set(name, theme)\n } else {\n throw new Error(`theme \"${name}\" already exists!`);\n }\n\n return ThemeFactory.get(name) as ThemeOptions\n}\n"],"names":[],"mappings":"kMAMa,MAAA,WAAW,GAAG,CAAC,IAAY,EAAE,OAAyB,EAAE,QAAkB,KAAkB;AACtG,IAAA,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAC1B,IAAI,KAAK,GAAQ,WAAW,CAAC,kBAAkB,EACzC,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,GAA+B,EAAE,EAAC,EAClC,OAAO,CAAA,EAAA,EACV,IAAI,EACJ,WAAW,EAAE,WAAW,EAAA,CAAA,CACzB;AAEF,QAAA,KAAK,GAAG,WAAW,CAAC,KAAK,EAAE;AACxB,YAAA,MAAM,EAAE;AACL,gBAAA,UAAU,EAAE,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC;AAC5C,gBAAA,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC;AAClC,gBAAA,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;AACpC,gBAAA,IAAI,EAAE,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC;AAChC,gBAAA,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC;AACtC,gBAAA,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC;AACtC,gBAAA,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,QAAQ;AACrC;AACH,SAAA,CAAC;AACF,QAAA,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;AAC/B;AAAM,SAAA;AACJ,QAAA,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,CAAA,iBAAA,CAAmB,CAAC;AACpD;AAED,IAAA,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,CAAiB;AAChD"}
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';var reactStateBucket=require('react-state-bucket'),core=require('./core.js');const createThemeSwitcher = (defaultTheme, store) => {
|
|
2
|
+
const useThemeState = reactStateBucket.createBucket({ name: defaultTheme }, { store });
|
|
3
|
+
const useThemeSwitcher = () => {
|
|
4
|
+
const state = useThemeState();
|
|
5
|
+
return {
|
|
6
|
+
name: state.get("name"),
|
|
7
|
+
theme: core.getTheme(state.get("name")),
|
|
8
|
+
change: (theme) => state.set("name", theme)
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
return useThemeSwitcher;
|
|
12
|
+
};module.exports=createThemeSwitcher;//# sourceMappingURL=createThemeSwitcher.js.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/theme/createThemeSwitcher.ts"],
|
|
4
|
-
"sourcesContent": ["import { createBucket } from \"react-state-bucket\"\nimport { getTheme } from \"./core\"\n\nconst createThemeSwitcher = (defaultTheme: string, store?: \"session\" | \"local\") => {\n const useThemeState = createBucket({ name: defaultTheme }, { store })\n const useThemeSwitcher = () => {\n const state = useThemeState()\n return {\n name: state.get(\"name\"),\n theme: getTheme(state.get(\"name\")),\n change: (theme: string) => state.set(\"name\", theme)\n }\n }\n return useThemeSwitcher\n}\n\n\nexport default createThemeSwitcher"],
|
|
5
|
-
"mappings": "AAAA,OAAS,gBAAAA,MAAoB,qBAC7B,OAAS,YAAAC,MAAgB,SAEzB,MAAMC,EAAsB,CAACC,EAAsBC,IAAgC,CAChF,MAAMC,EAAgBL,EAAa,CAAE,KAAMG,CAAa,EAAG,CAAE,MAAAC,CAAM,CAAC,EASpE,MARyB,IAAM,CAC5B,MAAME,EAAQD,EAAc,EAC5B,MAAO,CACJ,KAAMC,EAAM,IAAI,MAAM,EACtB,MAAOL,EAASK,EAAM,IAAI,MAAM,CAAC,EACjC,OAASC,GAAkBD,EAAM,IAAI,OAAQC,CAAK,CACrD,CACH,CAEH,EAGA,IAAOC,EAAQN",
|
|
6
|
-
"names": ["createBucket", "getTheme", "createThemeSwitcher", "defaultTheme", "store", "useThemeState", "state", "theme", "createThemeSwitcher_default"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"createThemeSwitcher.js","sources":["../../src/theme/createThemeSwitcher.ts"],"sourcesContent":["import { createBucket } from \"react-state-bucket\"\nimport { getTheme } from \"./core\"\n\nconst createThemeSwitcher = (defaultTheme: string, store?: \"session\" | \"local\") => {\n const useThemeState = createBucket({ name: defaultTheme }, { store })\n const useThemeSwitcher = () => {\n const state = useThemeState()\n return {\n name: state.get(\"name\"),\n theme: getTheme(state.get(\"name\")),\n change: (theme: string) => state.set(\"name\", theme)\n }\n }\n return useThemeSwitcher\n}\n\n\nexport default createThemeSwitcher"],"names":["createBucket","getTheme"],"mappings":"0FAGA,MAAM,mBAAmB,GAAG,CAAC,YAAoB,EAAE,KAA2B,KAAI;AAC/E,IAAA,MAAM,aAAa,GAAGA,6BAAY,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IACrE,MAAM,gBAAgB,GAAG,MAAK;AAC3B,QAAA,MAAM,KAAK,GAAG,aAAa,EAAE;QAC7B,OAAO;AACJ,YAAA,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;YACvB,KAAK,EAAEC,aAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAClC,YAAA,MAAM,EAAE,CAAC,KAAa,KAAK,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK;SACpD;AACJ,KAAC;AACD,IAAA,OAAO,gBAAgB;AAC1B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {createBucket}from'react-state-bucket';import {getTheme}from'./core.mjs';const createThemeSwitcher = (defaultTheme, store) => {
|
|
2
|
+
const useThemeState = createBucket({ name: defaultTheme }, { store });
|
|
3
|
+
const useThemeSwitcher = () => {
|
|
4
|
+
const state = useThemeState();
|
|
5
|
+
return {
|
|
6
|
+
name: state.get("name"),
|
|
7
|
+
theme: getTheme(state.get("name")),
|
|
8
|
+
change: (theme) => state.set("name", theme)
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
return useThemeSwitcher;
|
|
12
|
+
};export{createThemeSwitcher as default};//# sourceMappingURL=createThemeSwitcher.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createThemeSwitcher.mjs","sources":["../../src/theme/createThemeSwitcher.ts"],"sourcesContent":["import { createBucket } from \"react-state-bucket\"\nimport { getTheme } from \"./core\"\n\nconst createThemeSwitcher = (defaultTheme: string, store?: \"session\" | \"local\") => {\n const useThemeState = createBucket({ name: defaultTheme }, { store })\n const useThemeSwitcher = () => {\n const state = useThemeState()\n return {\n name: state.get(\"name\"),\n theme: getTheme(state.get(\"name\")),\n change: (theme: string) => state.set(\"name\", theme)\n }\n }\n return useThemeSwitcher\n}\n\n\nexport default createThemeSwitcher"],"names":[],"mappings":"gFAGA,MAAM,mBAAmB,GAAG,CAAC,YAAoB,EAAE,KAA2B,KAAI;AAC/E,IAAA,MAAM,aAAa,GAAG,YAAY,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IACrE,MAAM,gBAAgB,GAAG,MAAK;AAC3B,QAAA,MAAM,KAAK,GAAG,aAAa,EAAE;QAC7B,OAAO;AACJ,YAAA,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;YACvB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAClC,YAAA,MAAM,EAAE,CAAC,KAAa,KAAK,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK;SACpD;AACJ,KAAC;AACD,IAAA,OAAO,gBAAgB;AAC1B"}
|
package/theme/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var ThemeDefaultOptions=require('./ThemeDefaultOptions.js'),createTheme=require('./createTheme.js');require('tslib'),require('react'),require('../Tag/index.js'),require('../breakpoint/BreakpointProvider.js'),require('../css/getValue.js'),require('oncss');var core=require('./core.js');require('react-state-bucket');createTheme.createTheme("light", { colors: ThemeDefaultOptions.lightColorPallete });
|
|
2
|
+
createTheme.createTheme("dark", { colors: ThemeDefaultOptions.darkColorPallete });exports.getTheme=core.getTheme;exports.useTheme=core.useTheme;//# sourceMappingURL=index.js.map
|
package/theme/index.js.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/theme/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { lightColorPallete, darkColorPallete } from './ThemeDefaultOptions'\nimport { createTheme } from \"./createTheme\"\nimport ThemeProvider from './ThemeProvider'\nimport createThemeSwitcher from './createThemeSwitcher'\nimport { getTheme, useTheme } from './core'\nexport type { ThemeProviderProps } from './ThemeProvider'\n\nexport {\n ThemeProvider,\n createThemeSwitcher,\n getTheme,\n useTheme\n}\n\ncreateTheme(\"light\", { colors: lightColorPallete })\ncreateTheme(\"dark\", { colors: darkColorPallete })\n\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,qBAAAA,EAAmB,oBAAAC,MAAwB,wBACpD,OAAS,eAAAC,MAAmB,gBAC5B,OAAOC,MAAmB,kBAC1B,OAAOC,MAAyB,wBAChC,OAAS,YAAAC,EAAU,YAAAC,MAAgB,SAUnCJ,EAAY,QAAS,CAAE,OAAQF,CAAkB,CAAC,EAClDE,EAAY,OAAQ,CAAE,OAAQD,CAAiB,CAAC",
|
|
6
|
-
"names": ["lightColorPallete", "darkColorPallete", "createTheme", "ThemeProvider", "createThemeSwitcher", "getTheme", "useTheme"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/theme/index.tsx"],"sourcesContent":["import { lightColorPallete, darkColorPallete } from './ThemeDefaultOptions'\nimport { createTheme } from \"./createTheme\"\nimport ThemeProvider from './ThemeProvider'\nimport createThemeSwitcher from './createThemeSwitcher'\nimport { getTheme, useTheme } from './core'\nexport type { ThemeProviderProps } from './ThemeProvider'\n\nexport {\n ThemeProvider,\n createThemeSwitcher,\n getTheme,\n useTheme\n}\n\ncreateTheme(\"light\", { colors: lightColorPallete })\ncreateTheme(\"dark\", { colors: darkColorPallete })\n\n"],"names":["createTheme","lightColorPallete","darkColorPallete"],"mappings":"iYAcAA,uBAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAEC,qCAAiB,EAAE,CAAC;AACnDD,uBAAW,CAAC,MAAM,EAAE,EAAE,MAAM,EAAEE,oCAAgB,EAAE,CAAC"}
|
package/theme/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {lightColorPallete,darkColorPallete}from'./ThemeDefaultOptions.mjs';import {createTheme}from'./createTheme.mjs';import'tslib';import'react';import'../Tag/index.mjs';import'../breakpoint/BreakpointProvider.mjs';import'../css/getValue.mjs';import'oncss';export{getTheme,useTheme}from'./core.mjs';import'react-state-bucket';createTheme("light", { colors: lightColorPallete });
|
|
2
|
+
createTheme("dark", { colors: darkColorPallete });//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/theme/index.tsx"],"sourcesContent":["import { lightColorPallete, darkColorPallete } from './ThemeDefaultOptions'\nimport { createTheme } from \"./createTheme\"\nimport ThemeProvider from './ThemeProvider'\nimport createThemeSwitcher from './createThemeSwitcher'\nimport { getTheme, useTheme } from './core'\nexport type { ThemeProviderProps } from './ThemeProvider'\n\nexport {\n ThemeProvider,\n createThemeSwitcher,\n getTheme,\n useTheme\n}\n\ncreateTheme(\"light\", { colors: lightColorPallete })\ncreateTheme(\"dark\", { colors: darkColorPallete })\n\n"],"names":[],"mappings":"wUAcA,WAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;AACnD,WAAW,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC"}
|