@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.
Files changed (200) hide show
  1. package/ServerStyleTags.js +3 -2
  2. package/ServerStyleTags.js.map +1 -7
  3. package/ServerStyleTags.mjs +3 -0
  4. package/ServerStyleTags.mjs.map +1 -0
  5. package/Tag/cssPropList.js +186 -2
  6. package/Tag/cssPropList.js.map +1 -7
  7. package/Tag/cssPropList.mjs +186 -0
  8. package/Tag/cssPropList.mjs.map +1 -0
  9. package/Tag/index.js +6 -2
  10. package/Tag/index.js.map +1 -7
  11. package/Tag/index.mjs +6 -0
  12. package/Tag/index.mjs.map +1 -0
  13. package/Tag/useTagProps.js +21 -2
  14. package/Tag/useTagProps.js.map +1 -7
  15. package/Tag/useTagProps.mjs +21 -0
  16. package/Tag/useTagProps.mjs.map +1 -0
  17. package/Transition/index.js +93 -2
  18. package/Transition/index.js.map +1 -7
  19. package/Transition/index.mjs +93 -0
  20. package/Transition/index.mjs.map +1 -0
  21. package/Transition/variants.js +158 -2
  22. package/Transition/variants.js.map +1 -7
  23. package/Transition/variants.mjs +158 -0
  24. package/Transition/variants.mjs.map +1 -0
  25. package/breakpoint/BreakpointProvider.js +43 -0
  26. package/breakpoint/BreakpointProvider.js.map +1 -0
  27. package/breakpoint/BreakpointProvider.mjs +43 -0
  28. package/breakpoint/BreakpointProvider.mjs.map +1 -0
  29. package/breakpoint/useBreakpoint.js +23 -2
  30. package/breakpoint/useBreakpoint.js.map +1 -7
  31. package/breakpoint/useBreakpoint.mjs +23 -0
  32. package/breakpoint/useBreakpoint.mjs.map +1 -0
  33. package/breakpoint/useBreakpointProps.js +42 -2
  34. package/breakpoint/useBreakpointProps.js.map +1 -7
  35. package/breakpoint/useBreakpointProps.mjs +42 -0
  36. package/breakpoint/useBreakpointProps.mjs.map +1 -0
  37. package/css/aliases.js +29 -2
  38. package/css/aliases.js.map +1 -7
  39. package/css/aliases.mjs +29 -0
  40. package/css/aliases.mjs.map +1 -0
  41. package/css/getProps.js +32 -2
  42. package/css/getProps.js.map +1 -7
  43. package/css/getProps.mjs +32 -0
  44. package/css/getProps.mjs.map +1 -0
  45. package/css/getValue.js +92 -2
  46. package/css/getValue.js.map +1 -7
  47. package/css/getValue.mjs +92 -0
  48. package/css/getValue.mjs.map +1 -0
  49. package/css/index.js +55 -2
  50. package/css/index.js.map +1 -7
  51. package/css/index.mjs +55 -0
  52. package/css/index.mjs.map +1 -0
  53. package/index.d.ts +629 -21
  54. package/index.js +1 -2
  55. package/index.js.map +1 -7
  56. package/index.mjs +1 -0
  57. package/index.mjs.map +1 -0
  58. package/isWindow.js +1 -2
  59. package/isWindow.js.map +1 -7
  60. package/isWindow.mjs +1 -0
  61. package/isWindow.mjs.map +1 -0
  62. package/package.json +29 -24
  63. package/theme/ThemeCssVars.js +5 -2
  64. package/theme/ThemeCssVars.js.map +1 -7
  65. package/theme/ThemeCssVars.mjs +5 -0
  66. package/theme/ThemeCssVars.mjs.map +1 -0
  67. package/theme/ThemeDefaultOptions.js +131 -2
  68. package/theme/ThemeDefaultOptions.js.map +1 -7
  69. package/theme/ThemeDefaultOptions.mjs +131 -0
  70. package/theme/ThemeDefaultOptions.mjs.map +1 -0
  71. package/theme/ThemeProvider.js +88 -2
  72. package/theme/ThemeProvider.js.map +1 -7
  73. package/theme/ThemeProvider.mjs +88 -0
  74. package/theme/ThemeProvider.mjs.map +1 -0
  75. package/theme/core.js +18 -2
  76. package/theme/core.js.map +1 -7
  77. package/theme/core.mjs +18 -0
  78. package/theme/core.mjs.map +1 -0
  79. package/theme/createColor.js +46 -2
  80. package/theme/createColor.js.map +1 -7
  81. package/theme/createColor.mjs +46 -0
  82. package/theme/createColor.mjs.map +1 -0
  83. package/theme/createTheme.js +21 -2
  84. package/theme/createTheme.js.map +1 -7
  85. package/theme/createTheme.mjs +21 -0
  86. package/theme/createTheme.mjs.map +1 -0
  87. package/theme/createThemeSwitcher.js +12 -2
  88. package/theme/createThemeSwitcher.js.map +1 -7
  89. package/theme/createThemeSwitcher.mjs +12 -0
  90. package/theme/createThemeSwitcher.mjs.map +1 -0
  91. package/theme/index.js +2 -2
  92. package/theme/index.js.map +1 -7
  93. package/theme/index.mjs +2 -0
  94. package/theme/index.mjs.map +1 -0
  95. package/useAnimation.js +25 -2
  96. package/useAnimation.js.map +1 -7
  97. package/useAnimation.mjs +25 -0
  98. package/useAnimation.mjs.map +1 -0
  99. package/useColorTemplate.js +6 -2
  100. package/useColorTemplate.js.map +1 -7
  101. package/useColorTemplate.mjs +6 -0
  102. package/useColorTemplate.mjs.map +1 -0
  103. package/useInterface.js +8 -2
  104. package/useInterface.js.map +1 -7
  105. package/useInterface.mjs +8 -0
  106. package/useInterface.mjs.map +1 -0
  107. package/ServerStyleTags.d.ts +0 -3
  108. package/Tag/cssPropList.d.ts +0 -2
  109. package/Tag/index.d.ts +0 -4
  110. package/Tag/types.d.ts +0 -179
  111. package/Tag/types.js +0 -1
  112. package/Tag/types.js.map +0 -7
  113. package/Tag/useTagProps.d.ts +0 -3
  114. package/Transition/index.d.ts +0 -31
  115. package/Transition/variants.d.ts +0 -131
  116. package/breakpoint/index.d.ts +0 -6
  117. package/breakpoint/index.js +0 -2
  118. package/breakpoint/index.js.map +0 -7
  119. package/breakpoint/useBreakpoint.d.ts +0 -10
  120. package/breakpoint/useBreakpointProps.d.ts +0 -6
  121. package/cjs/ServerStyleTags.js +0 -2
  122. package/cjs/ServerStyleTags.js.map +0 -7
  123. package/cjs/Tag/cssPropList.js +0 -2
  124. package/cjs/Tag/cssPropList.js.map +0 -7
  125. package/cjs/Tag/index.js +0 -2
  126. package/cjs/Tag/index.js.map +0 -7
  127. package/cjs/Tag/types.js +0 -2
  128. package/cjs/Tag/types.js.map +0 -7
  129. package/cjs/Tag/useTagProps.js +0 -2
  130. package/cjs/Tag/useTagProps.js.map +0 -7
  131. package/cjs/Transition/index.js +0 -2
  132. package/cjs/Transition/index.js.map +0 -7
  133. package/cjs/Transition/variants.js +0 -2
  134. package/cjs/Transition/variants.js.map +0 -7
  135. package/cjs/breakpoint/index.js +0 -2
  136. package/cjs/breakpoint/index.js.map +0 -7
  137. package/cjs/breakpoint/useBreakpoint.js +0 -2
  138. package/cjs/breakpoint/useBreakpoint.js.map +0 -7
  139. package/cjs/breakpoint/useBreakpointProps.js +0 -2
  140. package/cjs/breakpoint/useBreakpointProps.js.map +0 -7
  141. package/cjs/css/aliases.js +0 -2
  142. package/cjs/css/aliases.js.map +0 -7
  143. package/cjs/css/getProps.js +0 -2
  144. package/cjs/css/getProps.js.map +0 -7
  145. package/cjs/css/getValue.js +0 -2
  146. package/cjs/css/getValue.js.map +0 -7
  147. package/cjs/css/index.js +0 -2
  148. package/cjs/css/index.js.map +0 -7
  149. package/cjs/css/types.js +0 -2
  150. package/cjs/css/types.js.map +0 -7
  151. package/cjs/index.js +0 -2
  152. package/cjs/index.js.map +0 -7
  153. package/cjs/isWindow.js +0 -2
  154. package/cjs/isWindow.js.map +0 -7
  155. package/cjs/theme/ThemeCssVars.js +0 -2
  156. package/cjs/theme/ThemeCssVars.js.map +0 -7
  157. package/cjs/theme/ThemeDefaultOptions.js +0 -2
  158. package/cjs/theme/ThemeDefaultOptions.js.map +0 -7
  159. package/cjs/theme/ThemeProvider.js +0 -2
  160. package/cjs/theme/ThemeProvider.js.map +0 -7
  161. package/cjs/theme/core.js +0 -2
  162. package/cjs/theme/core.js.map +0 -7
  163. package/cjs/theme/createColor.js +0 -2
  164. package/cjs/theme/createColor.js.map +0 -7
  165. package/cjs/theme/createTheme.js +0 -2
  166. package/cjs/theme/createTheme.js.map +0 -7
  167. package/cjs/theme/createThemeSwitcher.js +0 -2
  168. package/cjs/theme/createThemeSwitcher.js.map +0 -7
  169. package/cjs/theme/index.js +0 -2
  170. package/cjs/theme/index.js.map +0 -7
  171. package/cjs/theme/types.js +0 -2
  172. package/cjs/theme/types.js.map +0 -7
  173. package/cjs/useAnimation.js +0 -2
  174. package/cjs/useAnimation.js.map +0 -7
  175. package/cjs/useColorTemplate.js +0 -2
  176. package/cjs/useColorTemplate.js.map +0 -7
  177. package/cjs/useInterface.js +0 -2
  178. package/cjs/useInterface.js.map +0 -7
  179. package/css/aliases.d.ts +0 -4
  180. package/css/getProps.d.ts +0 -3
  181. package/css/getValue.d.ts +0 -3
  182. package/css/index.d.ts +0 -15
  183. package/css/types.d.ts +0 -54
  184. package/css/types.js +0 -1
  185. package/css/types.js.map +0 -7
  186. package/isWindow.d.ts +0 -2
  187. package/theme/ThemeCssVars.d.ts +0 -3
  188. package/theme/ThemeDefaultOptions.d.ts +0 -68
  189. package/theme/ThemeProvider.d.ts +0 -11
  190. package/theme/core.d.ts +0 -7
  191. package/theme/createColor.d.ts +0 -41
  192. package/theme/createTheme.d.ts +0 -2
  193. package/theme/createThemeSwitcher.d.ts +0 -6
  194. package/theme/index.d.ts +0 -5
  195. package/theme/types.d.ts +0 -124
  196. package/theme/types.js +0 -1
  197. package/theme/types.js.map +0 -7
  198. package/useAnimation.d.ts +0 -18
  199. package/useColorTemplate.d.ts +0 -4
  200. package/useInterface.d.ts +0 -2
@@ -1,2 +1,88 @@
1
- import*as r from"react";import g from"../Tag";import{BreakpointProvider as d}from"../breakpoint";import{ThemeContex as y,ThemeFactory as c}from"./core";import f from"./ThemeCssVars";import{css as t}from"../css";const u=({children:l,theme:e,resetCss:a,scrollbarCss:n,isRootProvider:h,renderIsRoot:m,...p})=>{const o=c.get(e);if(!o)throw new Error(`Invalid theme name provided: ${e}`);return a??(a=!0),n??(n=!0),r.useMemo(()=>{if(Object.keys(o.globalStyle).length&&t({"@global":o.globalStyle}),t({"@global":{[`.xui-${e}-theme-root`]:f(o)}}),n&&typeof document<"u"){let s=10,i=o.colors.divider,b=o.colors.background.secondary;t({"@global":{"*":{scrollbarWidth:"thin",scrollbarColor:`${i} ${b}`},"::-webkit-scrollbar":{width:s,height:s},"::-webkit-scrollbar-thumb":{backgroundColor:i,borderRadius:"5px",border:"2px solid #f4f4f4"},"::-webkit-scrollbar-thumb:hover":{backgroundColor:i},"::-webkit-scrollbar-track":{backgroundColor:b,borderRadius:"5px"}}})}a&&t({"@global":{"*":{m:0,p:0,outline:"none",boxSizing:"border-box",verticalAlign:"baseline"},"html, body":{minHeight:"100%","-webkit-font-smoothing":"antialiased"},"img, picture, video, canvas, svg":{maxWidth:"100%",display:"block"},"input, button, textarea, select":{font:"inherit"},table:{borderCollapse:"collapse",borderSpacing:0},"ol, ul":{listStyle:"none"},a:{display:"inline-block"},"p, h1, h2, h3, h4, h5, h6":{overflowWrap:"break-word"}}})},[e]),r.createElement(y.Provider,{value:e},h?r.createElement(d,null,r.createElement(g,{minHeight:"100%",bgcolor:o.colors.background.primary,fontFamily:o.typography.fontFamily,fontSize:o.typography.text.fontSize,fontWeight:o.typography.text.fontWeight,lineHeight:o.typography.text.lineHeight,...p,baseClass:`${e}-theme-root`,direction:o.rtl?"rtl":"ltr"},l,m)):r.createElement(g,{minHeight:"100%",bgcolor:o.colors.background.primary,fontFamily:o.typography.fontFamily,fontSize:o.typography.text.fontSize,fontWeight:o.typography.text.fontWeight,lineHeight:o.typography.text.lineHeight,...p,baseClass:`${e}-theme-root`,direction:o.rtl?"rtl":"ltr"},l))};var z=u;export{z as default};
2
- //# sourceMappingURL=ThemeProvider.js.map
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,EAAM,WAAW,EAAE,QAClCT,EAAI,CACD,UAAWS,EAAM,WACpB,CAAC,EAGJT,EAAI,CACD,UAAW,CACR,CAAC,QAAQG,CAAK,aAAa,EAAGJ,EAAaU,CAAK,CACnD,CACH,CA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,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,EAAE;gBACR,CAAC,CAAA,KAAA,EAAQ,KAAK,CAAa,WAAA,CAAA,GAAG,YAAY,CAAC,KAAK;AAClD;AACH,SAAA,CAAC;AAEF,QAAA,IAAI,YAAY,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;YACl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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\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,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
- import r from"react";const s=new Map,c=r.createContext("light"),h=e=>s.get(e),x=()=>s.get(r.useContext(c)),p=(e,t)=>{e={...e},t={...t};for(const o in t){const n=t[o];typeof n=="object"&&!Array.isArray(n)&&!r.isValidElement(n)?e[o]=p(e[o],t[o]):e[o]=n}return e};export{c as ThemeContex,s as ThemeFactory,h as getTheme,p as mergeObject,x as useTheme};
2
- //# sourceMappingURL=core.js.map
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"}
@@ -1,2 +1,46 @@
1
- import{alpha as l}from"../css";const b=(a,c)=>{let n=a.colors[c],{primary:o,secondary:t}=n,e=n.text||a.colors.text.primary,p=l(o,.1);const r=(i,s)=>c==="background"?i:s;return{alpha:p,template:{outline:{bgcolor:"transparent",color:r(e,o),border:1,borderColor:r("divider",l(o,.4)),hover:{color:r(e,o),borderColor:r("divider",l(o,.8))}},fill:{bgcolor:r(t,o),color:e,hover:{bgcolor:r(l(t,.6),t),color:e}},text:{bgcolor:"transparent",color:r(e,o),hover:{bgcolor:r(l(t,.6),l(o,.1)),color:r(e,o)}},alpha:{bgcolor:r(l(t,.5),l(o,.1)),color:r(e,o),hover:{bgcolor:r(l(t,.8),l(o,.15)),color:r(e,o)}}}}};var y=b;export{y as default};
2
- //# sourceMappingURL=createColor.js.map
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
@@ -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,GAA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AE,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
@@ -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,CAAC,MAAM,CAAC,IAAI,CAAC;AAC9B,IAAA,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,G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E,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"}
@@ -1,2 +1,21 @@
1
- import s,{darkColorPallete as m}from"./ThemeDefaultOptions";import{mergeObject as n,ThemeFactory as t}from"./core";import r from"./createColor";import{breakpoints as c}from"../css";const u=(o,a,i)=>{if(t.has(o))throw new Error(`theme "${o}" already exists!`);{let e=n(s,{...i?m:{},...a,name:o,breakpoints:c});e=n(e,{colors:{background:r(e,"background"),brand:r(e,"brand"),accent:r(e,"accent"),info:r(e,"info"),success:r(e,"success"),warning:r(e,"warning"),danger:r(e,"danger")}}),t.set(o,e)}return t.get(o)};export{u as createTheme};
2
- //# sourceMappingURL=createTheme.js.map
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
@@ -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
- import{createBucket as s}from"react-state-bucket";import{getTheme as a}from"./core";const c=(t,r)=>{const m=s({name:t},{store:r});return()=>{const e=m();return{name:e.get("name"),theme:a(e.get("name")),change:n=>e.set("name",n)}}};var u=c;export{u as default};
2
- //# sourceMappingURL=createThemeSwitcher.js.map
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
- import{lightColorPallete as r,darkColorPallete as o}from"./ThemeDefaultOptions";import{createTheme as e}from"./createTheme";import m from"./ThemeProvider";import t from"./createThemeSwitcher";import{getTheme as i,useTheme as h}from"./core";e("light",{colors:r}),e("dark",{colors:o});export{m as ThemeProvider,t as createThemeSwitcher,i as getTheme,h as useTheme};
2
- //# sourceMappingURL=index.js.map
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
@@ -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"}
@@ -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"}