@xanui/core 1.1.2 → 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 (131) hide show
  1. package/ServerStyleTags.js +3 -0
  2. package/ServerStyleTags.js.map +1 -0
  3. package/ServerStyleTags.mjs +3 -0
  4. package/ServerStyleTags.mjs.map +1 -0
  5. package/Tag/cssPropList.js +186 -0
  6. package/Tag/cssPropList.js.map +1 -0
  7. package/{src/Tag/cssPropList.ts → Tag/cssPropList.mjs} +2 -7
  8. package/Tag/cssPropList.mjs.map +1 -0
  9. package/Tag/index.js +6 -0
  10. package/Tag/index.js.map +1 -0
  11. package/Tag/index.mjs +6 -0
  12. package/Tag/index.mjs.map +1 -0
  13. package/Tag/useTagProps.js +21 -0
  14. package/Tag/useTagProps.js.map +1 -0
  15. package/Tag/useTagProps.mjs +21 -0
  16. package/Tag/useTagProps.mjs.map +1 -0
  17. package/Transition/index.js +93 -0
  18. package/Transition/index.js.map +1 -0
  19. package/Transition/index.mjs +93 -0
  20. package/Transition/index.mjs.map +1 -0
  21. package/Transition/variants.js +158 -0
  22. package/Transition/variants.js.map +1 -0
  23. package/{src/Transition/variants.ts → Transition/variants.mjs} +44 -64
  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 -0
  30. package/breakpoint/useBreakpoint.js.map +1 -0
  31. package/breakpoint/useBreakpoint.mjs +23 -0
  32. package/breakpoint/useBreakpoint.mjs.map +1 -0
  33. package/breakpoint/useBreakpointProps.js +42 -0
  34. package/breakpoint/useBreakpointProps.js.map +1 -0
  35. package/breakpoint/useBreakpointProps.mjs +42 -0
  36. package/breakpoint/useBreakpointProps.mjs.map +1 -0
  37. package/css/aliases.js +29 -0
  38. package/css/aliases.js.map +1 -0
  39. package/css/aliases.mjs +29 -0
  40. package/css/aliases.mjs.map +1 -0
  41. package/{src/css/getProps.ts → css/getProps.js} +15 -21
  42. package/css/getProps.js.map +1 -0
  43. package/css/getProps.mjs +32 -0
  44. package/css/getProps.mjs.map +1 -0
  45. package/{src/css/getValue.ts → css/getValue.js} +40 -65
  46. package/css/getValue.js.map +1 -0
  47. package/css/getValue.mjs +92 -0
  48. package/css/getValue.mjs.map +1 -0
  49. package/css/index.js +55 -0
  50. package/css/index.js.map +1 -0
  51. package/css/index.mjs +55 -0
  52. package/css/index.mjs.map +1 -0
  53. package/index.d.ts +629 -0
  54. package/index.js +1 -0
  55. package/index.js.map +1 -0
  56. package/index.mjs +1 -0
  57. package/index.mjs.map +1 -0
  58. package/isWindow.js +1 -0
  59. package/isWindow.js.map +1 -0
  60. package/isWindow.mjs +1 -0
  61. package/isWindow.mjs.map +1 -0
  62. package/package.json +50 -51
  63. package/theme/ThemeCssVars.js +5 -0
  64. package/theme/ThemeCssVars.js.map +1 -0
  65. package/theme/ThemeCssVars.mjs +5 -0
  66. package/theme/ThemeCssVars.mjs.map +1 -0
  67. package/theme/ThemeDefaultOptions.js +131 -0
  68. package/theme/ThemeDefaultOptions.js.map +1 -0
  69. package/{src/theme/ThemeDefaultOptions.ts → theme/ThemeDefaultOptions.mjs} +17 -32
  70. package/theme/ThemeDefaultOptions.mjs.map +1 -0
  71. package/theme/ThemeProvider.js +88 -0
  72. package/theme/ThemeProvider.js.map +1 -0
  73. package/theme/ThemeProvider.mjs +88 -0
  74. package/theme/ThemeProvider.mjs.map +1 -0
  75. package/theme/core.js +18 -0
  76. package/theme/core.js.map +1 -0
  77. package/theme/core.mjs +18 -0
  78. package/theme/core.mjs.map +1 -0
  79. package/theme/createColor.js +46 -0
  80. package/theme/createColor.js.map +1 -0
  81. package/theme/createColor.mjs +46 -0
  82. package/theme/createColor.mjs.map +1 -0
  83. package/theme/createTheme.js +21 -0
  84. package/theme/createTheme.js.map +1 -0
  85. package/theme/createTheme.mjs +21 -0
  86. package/theme/createTheme.mjs.map +1 -0
  87. package/theme/createThemeSwitcher.js +12 -0
  88. package/theme/createThemeSwitcher.js.map +1 -0
  89. package/theme/createThemeSwitcher.mjs +12 -0
  90. package/theme/createThemeSwitcher.mjs.map +1 -0
  91. package/theme/index.js +2 -0
  92. package/theme/index.js.map +1 -0
  93. package/theme/index.mjs +2 -0
  94. package/theme/index.mjs.map +1 -0
  95. package/useAnimation.js +25 -0
  96. package/useAnimation.js.map +1 -0
  97. package/{src/useAnimation.ts → useAnimation.mjs} +10 -25
  98. package/useAnimation.mjs.map +1 -0
  99. package/useColorTemplate.js +6 -0
  100. package/useColorTemplate.js.map +1 -0
  101. package/useColorTemplate.mjs +6 -0
  102. package/useColorTemplate.mjs.map +1 -0
  103. package/useInterface.js +8 -0
  104. package/useInterface.js.map +1 -0
  105. package/useInterface.mjs +8 -0
  106. package/useInterface.mjs.map +1 -0
  107. package/main.tsx +0 -97
  108. package/src/ServerStyleTags.tsx +0 -12
  109. package/src/Tag/index.tsx +0 -11
  110. package/src/Tag/types.ts +0 -183
  111. package/src/Tag/useTagProps.ts +0 -28
  112. package/src/Transition/index.tsx +0 -148
  113. package/src/breakpoint/index.tsx +0 -52
  114. package/src/breakpoint/useBreakpoint.ts +0 -31
  115. package/src/breakpoint/useBreakpointProps.ts +0 -57
  116. package/src/css/aliases.ts +0 -35
  117. package/src/css/index.ts +0 -78
  118. package/src/css/types.ts +0 -60
  119. package/src/index.ts +0 -34
  120. package/src/isWindow.ts +0 -3
  121. package/src/theme/ThemeCssVars.ts +0 -107
  122. package/src/theme/ThemeProvider.tsx +0 -140
  123. package/src/theme/core.ts +0 -21
  124. package/src/theme/createColor.ts +0 -53
  125. package/src/theme/createTheme.ts +0 -33
  126. package/src/theme/createThemeSwitcher.ts +0 -18
  127. package/src/theme/index.tsx +0 -17
  128. package/src/theme/types.ts +0 -181
  129. package/src/useColorTemplate.ts +0 -11
  130. package/src/useInterface.ts +0 -13
  131. package/tsconfig.json +0 -28
@@ -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,CAAC;IACpE,QA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,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 ADDED
@@ -0,0 +1,18 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,46 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createColor.js","sources":["../../src/theme/createColor.ts"],"sourcesContent":["import { ThemeOptions, ThemeColor } from \"./types\"\nimport { alpha } from \"../css\"\n\nconst createColor = (theme: ThemeOptions, name: keyof ThemeColor) => {\n let color = theme.colors[name]\n let { primary, secondary } = color as any\n let text = (color as any).text || theme.colors.text.primary\n let _alpha = alpha(primary, .1)\n\n const isBag = (a: any, b: any) => name === \"background\" ? a : b\n\n return {\n alpha: _alpha,\n template: {\n outline: {\n bgcolor: \"transparent\",\n color: isBag(text, primary),\n border: 1,\n borderColor: isBag(\"divider\", alpha(primary, .4)),\n hover: {\n color: isBag(text, primary),\n borderColor: isBag(\"divider\", alpha(primary, .8)),\n }\n },\n fill: {\n bgcolor: isBag(secondary, primary),\n color: text,\n hover: {\n bgcolor: isBag(alpha(secondary, .6), secondary),\n color: text,\n }\n },\n text: {\n bgcolor: \"transparent\",\n color: isBag(text, primary),\n hover: {\n bgcolor: isBag(alpha(secondary, .6), alpha(primary, .1)),\n color: isBag(text, primary),\n }\n },\n alpha: {\n bgcolor: isBag(alpha(secondary, .5), alpha(primary, .1)),\n color: isBag(text, primary),\n hover: {\n bgcolor: isBag(alpha(secondary, .8), alpha(primary, .15)),\n color: isBag(text, primary),\n }\n }\n }\n }\n}\n\nexport default createColor"],"names":["alpha"],"mappings":"kDAGA,MAAM,WAAW,GAAG,CAAC,KAAmB,EAAE,IAAsB,KAAI;IACjE,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AAC9B,IAAA,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAY;AACzC,IAAA,IAAI,IAAI,GAAI,KAAa,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;IAC3D,IAAI,MAAM,GAAGA,WAAK,CAAC,OAAO,EAAE,EAAE,CAAC;IAE/B,MAAM,KAAK,GAAG,CAAC,CAAM,EAAE,CAAM,KAAK,IAAI,KAAK,YAAY,GAAG,CAAC,GAAG,CAAC;IAE/D,OAAO;AACJ,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,QAAQ,EAAE;AACP,YAAA,OAAO,EAAE;AACN,gBAAA,OAAO,EAAE,aAAa;AACtB,gBAAA,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3B,gBAAA,MAAM,EAAE,CAAC;gBACT,WAAW,EAAE,KAAK,CAAC,SAAS,EAAEA,WAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACjD,gBAAA,KAAK,EAAE;AACJ,oBAAA,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO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=> {
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,GAAG,KAAY;AACzC,IAAA,IAAI,IAAI,GAAI,KAAa,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;IAC3D,IAAI,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;IAE/B,MAAM,KAAK,GAAG,CAAC,CAAM,EAAE,CAAM,KAAK,IAAI,KAAK,YAAY,GAAG,CAAC,GAAG,CAAC;IAE/D,OAAO;AACJ,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,QAAQ,EAAE;AACP,YAAA,OAAO,EAAE;AACN,gBAAA,OAAO,EAAE,aAAa;AACtB,gBAAA,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3B,gBAAA,MAAM,EAAE,CAAC;gBACT,WAAW,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACjD,gBAAA,KAAK,EAAE;AACJ,oBAAA,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO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emeDefaultOptions=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
@@ -0,0 +1 @@
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(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efaultOptions.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"}
@@ -0,0 +1,12 @@
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
@@ -0,0 +1 @@
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 ADDED
@@ -0,0 +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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,25 @@
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var index=require('./css/index.js'),React=require('react');const animationEases = {
2
+ easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
3
+ easeOut: "cubic-bezier(0.0, 0, 0.2, 1)",
4
+ easeIn: "cubic-bezier(0.4, 0, 1, 1)",
5
+ sharp: "cubic-bezier(0.4, 0, 0.6, 1)",
6
+ linear: "cubic-bezier(0, 0, 1, 1)",
7
+ easeBounceOut: "cubic-bezier(0.68, -0.55, 0.265, 1.55)"
8
+ };
9
+ const useAnimation = ({ from, to, delay, ease, duration }) => {
10
+ let _delay = delay || 0;
11
+ let _duration = duration || 600;
12
+ let _ease = ease || "easeBounceOut";
13
+ const id = "anim" + React.useId().replace(/:/g, "");
14
+ const anim = index.css({
15
+ animationName: id,
16
+ animationDelay: _delay + "ms",
17
+ animationDuration: _duration + "ms",
18
+ animationTimingFunction: animationEases[_ease] || animationEases.easeBounceOut,
19
+ [`@keyframes ${id}`]: {
20
+ from: from,
21
+ to: to
22
+ }
23
+ });
24
+ return anim.classname;
25
+ };exports.animationEases=animationEases;exports.default=useAnimation;//# sourceMappingURL=useAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimation.js","sources":["../src/useAnimation.ts"],"sourcesContent":["import { css } from './css'\nimport { useId } from 'react'\nimport { CSSProps } from './css/types'\n\nexport const animationEases = {\n easeInOut: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n easeOut: \"cubic-bezier(0.0, 0, 0.2, 1)\",\n easeIn: \"cubic-bezier(0.4, 0, 1, 1)\",\n sharp: \"cubic-bezier(0.4, 0, 0.6, 1)\",\n linear: \"cubic-bezier(0, 0, 1, 1)\",\n easeBounceOut: \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n}\n\nexport interface UseAnimationProps {\n delay?: number;\n duration?: number;\n from: CSSProps;\n to: CSSProps;\n ease?: keyof typeof animationEases;\n}\n\nconst useAnimation = ({ from, to, delay, ease, duration }: UseAnimationProps) => {\n let _delay = delay || 0;\n let _duration = duration || 600;\n let _ease = ease || \"easeBounceOut\"\n const id = \"anim\" + useId().replace(/:/g, \"\")\n const anim = css({\n animationName: id,\n animationDelay: _delay + \"ms\",\n animationDuration: _duration + \"ms\",\n animationTimingFunction: animationEases[_ease] || animationEases.easeBounceOut,\n [`@keyframes ${id}`]: {\n from: from as any,\n to: to as any\n }\n })\n return anim.classname\n}\n\nexport default useAnimation"],"names":["useId","css"],"mappings":"iIAIa,MAAA,cAAc,GAAG;AAC1B,IAAA,SAAS,EAAE,8BAA8B;AACzC,IAAA,OAAO,EAAE,8BAA8B;AACvC,IAAA,MAAM,EAAE,4BAA4B;AACpC,IAAA,KAAK,EAAE,8BAA8B;AACrC,IAAA,MAAM,EAAE,0BAA0B;AAClC,IAAA,aAAa,EAAE;;AAWnB,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAqB,KAAI;AAC5E,IAAA,IAAI,MAAM,GAAG,KAAK,IAAI,CAAC;AACvB,IAAA,IAAI,SAAS,GAAG,QAAQ,IAAI,GAAG;AAC/B,IAAA,IAAI,KAAK,GAAG,IAAI,IAAI,eAAe;AACnC,IAAA,MAAM,EAAE,GAAG,MAAM,GAAGA,WAAK,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;IAC7C,MAAM,IAAI,GAAGC,SAAG,CAAC;AACb,QAAA,aAAa,EAAE,EAAE;QACjB,cAAc,EAAE,MAAM,GAAG,IAAI;QAC7B,iBAAiB,EAAE,SAAS,GAAG,IAAI;QACnC,uBAAuB,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,aAAa;AAC9E,QAAA,CAAC,CAAc,WAAA,EAAA,EAAE,CAAE,CAAA,GAAG;AAClB,YAAA,IAAI,EAAE,IAAW;AACjB,YAAA,EAAE,EAAE;AACP;AACJ,KAAA,CAAC;IACF,OAAO,IAAI,CAAC,SAAS;AACzB"}
@@ -1,40 +1,25 @@
1
- import { css } from './css'
2
- import { useId } from 'react'
3
- import { CSSProps } from './css/types'
4
-
5
- export const animationEases = {
1
+ import {css}from'./css/index.mjs';import {useId}from'react';const animationEases = {
6
2
  easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
7
3
  easeOut: "cubic-bezier(0.0, 0, 0.2, 1)",
8
4
  easeIn: "cubic-bezier(0.4, 0, 1, 1)",
9
5
  sharp: "cubic-bezier(0.4, 0, 0.6, 1)",
10
6
  linear: "cubic-bezier(0, 0, 1, 1)",
11
7
  easeBounceOut: "cubic-bezier(0.68, -0.55, 0.265, 1.55)"
12
- }
13
-
14
- export interface UseAnimationProps {
15
- delay?: number;
16
- duration?: number;
17
- from: CSSProps;
18
- to: CSSProps;
19
- ease?: keyof typeof animationEases;
20
- }
21
-
22
- const useAnimation = ({ from, to, delay, ease, duration }: UseAnimationProps) => {
8
+ };
9
+ const useAnimation = ({ from, to, delay, ease, duration }) => {
23
10
  let _delay = delay || 0;
24
11
  let _duration = duration || 600;
25
- let _ease = ease || "easeBounceOut"
26
- const id = "anim" + useId().replace(/:/g, "")
12
+ let _ease = ease || "easeBounceOut";
13
+ const id = "anim" + useId().replace(/:/g, "");
27
14
  const anim = css({
28
15
  animationName: id,
29
16
  animationDelay: _delay + "ms",
30
17
  animationDuration: _duration + "ms",
31
18
  animationTimingFunction: animationEases[_ease] || animationEases.easeBounceOut,
32
19
  [`@keyframes ${id}`]: {
33
- from: from as any,
34
- to: to as any
20
+ from: from,
21
+ to: to
35
22
  }
36
- })
37
- return anim.classname
38
- }
39
-
40
- export default useAnimation
23
+ });
24
+ return anim.classname;
25
+ };export{animationEases,useAnimation as default};//# sourceMappingURL=useAnimation.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimation.mjs","sources":["../src/useAnimation.ts"],"sourcesContent":["import { css } from './css'\nimport { useId } from 'react'\nimport { CSSProps } from './css/types'\n\nexport const animationEases = {\n easeInOut: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n easeOut: \"cubic-bezier(0.0, 0, 0.2, 1)\",\n easeIn: \"cubic-bezier(0.4, 0, 1, 1)\",\n sharp: \"cubic-bezier(0.4, 0, 0.6, 1)\",\n linear: \"cubic-bezier(0, 0, 1, 1)\",\n easeBounceOut: \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n}\n\nexport interface UseAnimationProps {\n delay?: number;\n duration?: number;\n from: CSSProps;\n to: CSSProps;\n ease?: keyof typeof animationEases;\n}\n\nconst useAnimation = ({ from, to, delay, ease, duration }: UseAnimationProps) => {\n let _delay = delay || 0;\n let _duration = duration || 600;\n let _ease = ease || \"easeBounceOut\"\n const id = \"anim\" + useId().replace(/:/g, \"\")\n const anim = css({\n animationName: id,\n animationDelay: _delay + \"ms\",\n animationDuration: _duration + \"ms\",\n animationTimingFunction: animationEases[_ease] || animationEases.easeBounceOut,\n [`@keyframes ${id}`]: {\n from: from as any,\n to: to as any\n }\n })\n return anim.classname\n}\n\nexport default useAnimation"],"names":[],"mappings":"4DAIa,MAAA,cAAc,GAAG;AAC1B,IAAA,SAAS,EAAE,8BAA8B;AACzC,IAAA,OAAO,EAAE,8BAA8B;AACvC,IAAA,MAAM,EAAE,4BAA4B;AACpC,IAAA,KAAK,EAAE,8BAA8B;AACrC,IAAA,MAAM,EAAE,0BAA0B;AAClC,IAAA,aAAa,EAAE;;AAWnB,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAqB,KAAI;AAC5E,IAAA,IAAI,MAAM,GAAG,KAAK,IAAI,CAAC;AACvB,IAAA,IAAI,SAAS,GAAG,QAAQ,IAAI,GAAG;AAC/B,IAAA,IAAI,KAAK,GAAG,IAAI,IAAI,eAAe;AACnC,IAAA,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;IAC7C,MAAM,IAAI,GAAG,GAAG,CAAC;AACb,QAAA,aAAa,EAAE,EAAE;QACjB,cAAc,EAAE,MAAM,GAAG,IAAI;QAC7B,iBAAiB,EAAE,SAAS,GAAG,IAAI;QACnC,uBAAuB,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,aAAa;AAC9E,QAAA,CAAC,CAAc,WAAA,EAAA,EAAE,CAAE,CAAA,GAAG;AAClB,YAAA,IAAI,EAAE,IAAW;AACjB,YAAA,EAAE,EAAE;AACP;AACJ,KAAA,CAAC;IACF,OAAO,IAAI,CAAC,SAAS;AACzB"}
@@ -0,0 +1,6 @@
1
+ 'use strict';require('./theme/index.js');var core=require('./theme/core.js');const useColorTemplate = (color, type) => {
2
+ var _a;
3
+ const theme = core.useTheme();
4
+ let _color = color === 'default' ? "background" : color;
5
+ return (_a = theme.colors[_color]) === null || _a === void 0 ? void 0 : _a.template[type];
6
+ };module.exports=useColorTemplate;//# sourceMappingURL=useColorTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useColorTemplate.js","sources":["../src/useColorTemplate.ts"],"sourcesContent":["import { useTheme } from \"./theme\"\nexport type ColorTemplateColors = \"default\" | \"brand\" | \"accent\" | \"info\" | \"success\" | \"warning\" | \"danger\"\nexport type ColorTemplateType = \"fill\" | \"outline\" | \"text\" | \"alpha\"\n\nconst useColorTemplate = (color: ColorTemplateColors, type: ColorTemplateType) => {\n const theme: any = useTheme()\n let _color = color === 'default' ? \"background\" : color as any\n return theme.colors[_color]?.template[type]\n}\n\nexport default useColorTemplate"],"names":["useTheme"],"mappings":"6EAIA,MAAM,gBAAgB,GAAG,CAAC,KAA0B,EAAE,IAAuB,KAAI;;AAC7E,IAAA,MAAM,KAAK,GAAQA,aAAQ,EAAE;AAC7B,IAAA,IAAI,MAAM,GAAG,KAAK,KAAK,SAAS,GAAG,YAAY,GAAG,KAAY;AAC9D,IAAA,OAAO,CAAA,EAAA,GAAA,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,QAAQ,CAAC,IAAI,CAAC;AAC/C"}
@@ -0,0 +1,6 @@
1
+ import'./theme/index.mjs';import {useTheme}from'./theme/core.mjs';const useColorTemplate = (color, type) => {
2
+ var _a;
3
+ const theme = useTheme();
4
+ let _color = color === 'default' ? "background" : color;
5
+ return (_a = theme.colors[_color]) === null || _a === void 0 ? void 0 : _a.template[type];
6
+ };export{useColorTemplate as default};//# sourceMappingURL=useColorTemplate.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useColorTemplate.mjs","sources":["../src/useColorTemplate.ts"],"sourcesContent":["import { useTheme } from \"./theme\"\nexport type ColorTemplateColors = \"default\" | \"brand\" | \"accent\" | \"info\" | \"success\" | \"warning\" | \"danger\"\nexport type ColorTemplateType = \"fill\" | \"outline\" | \"text\" | \"alpha\"\n\nconst useColorTemplate = (color: ColorTemplateColors, type: ColorTemplateType) => {\n const theme: any = useTheme()\n let _color = color === 'default' ? \"background\" : color as any\n return theme.colors[_color]?.template[type]\n}\n\nexport default useColorTemplate"],"names":[],"mappings":"kEAIA,MAAM,gBAAgB,GAAG,CAAC,KAA0B,EAAE,IAAuB,KAAI;;AAC7E,IAAA,MAAM,KAAK,GAAQ,QAAQ,EAAE;AAC7B,IAAA,IAAI,MAAM,GAAG,KAAK,KAAK,SAAS,GAAG,YAAY,GAAG,KAAY;AAC9D,IAAA,OAAO,CAAA,EAAA,GAAA,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,QAAQ,CAAC,IAAI,CAAC;AAC/C"}
@@ -0,0 +1,8 @@
1
+ 'use strict';require('./theme/index.js');var core=require('./theme/core.js');const useInterface = (name, userPorps, defaultProps) => {
2
+ const theme = core.useTheme();
3
+ const _interface = theme.interfaces[name];
4
+ if (_interface) {
5
+ defaultProps = _interface(Object.assign(Object.assign({}, defaultProps), userPorps), theme);
6
+ }
7
+ return [Object.assign(Object.assign({}, defaultProps), userPorps), theme];
8
+ };module.exports=useInterface;//# sourceMappingURL=useInterface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInterface.js","sources":["../src/useInterface.ts"],"sourcesContent":["import { useTheme } from \"./theme\"\n\nconst useInterface = <P extends object>(name: string, userPorps: P, defaultProps: P) => {\n const theme = useTheme()\n const _interface = theme.interfaces[name]\n\n if (_interface) {\n defaultProps = _interface<P>({ ...defaultProps, ...userPorps }, theme)\n }\n return [{ ...defaultProps, ...userPorps }, theme]\n}\n\nexport default useInterface"],"names":["useTheme"],"mappings":"6EAEM,MAAA,YAAY,GAAG,CAAmB,IAAY,EAAE,SAAY,EAAE,YAAe,KAAI;AACnF,IAAA,MAAM,KAAK,GAAGA,aAAQ,EAAE;IACxB,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;AAEzC,IAAA,IAAI,UAAU,EAAE;QACZ,YAAY,GAAG,UAAU,CAAS,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,YAAY,GAAK,SAAS,CAAA,EAAI,KAAK,CAAC;AACzE;AACD,IAAA,OAAO,iCAAM,YAAY,CAAA,EAAK,SAAS,CAAI,EAAA,KAAK,CAAC;AACrD"}
@@ -0,0 +1,8 @@
1
+ import'./theme/index.mjs';import {useTheme}from'./theme/core.mjs';const useInterface = (name, userPorps, defaultProps) => {
2
+ const theme = useTheme();
3
+ const _interface = theme.interfaces[name];
4
+ if (_interface) {
5
+ defaultProps = _interface(Object.assign(Object.assign({}, defaultProps), userPorps), theme);
6
+ }
7
+ return [Object.assign(Object.assign({}, defaultProps), userPorps), theme];
8
+ };export{useInterface as default};//# sourceMappingURL=useInterface.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInterface.mjs","sources":["../src/useInterface.ts"],"sourcesContent":["import { useTheme } from \"./theme\"\n\nconst useInterface = <P extends object>(name: string, userPorps: P, defaultProps: P) => {\n const theme = useTheme()\n const _interface = theme.interfaces[name]\n\n if (_interface) {\n defaultProps = _interface<P>({ ...defaultProps, ...userPorps }, theme)\n }\n return [{ ...defaultProps, ...userPorps }, theme]\n}\n\nexport default useInterface"],"names":[],"mappings":"kEAEM,MAAA,YAAY,GAAG,CAAmB,IAAY,EAAE,SAAY,EAAE,YAAe,KAAI;AACnF,IAAA,MAAM,KAAK,GAAG,QAAQ,EAAE;IACxB,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;AAEzC,IAAA,IAAI,UAAU,EAAE;QACZ,YAAY,GAAG,UAAU,CAAS,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,YAAY,GAAK,SAAS,CAAA,EAAI,KAAK,CAAC;AACzE;AACD,IAAA,OAAO,iCAAM,YAAY,CAAA,EAAK,SAAS,CAAI,EAAA,KAAK,CAAC;AACrD"}