@xanui/core 1.2.42 → 1.2.44

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 (174) hide show
  1. package/AppRoot/{context.js → AppRootProvider.cjs} +1 -1
  2. package/AppRoot/AppRootProvider.cjs.map +1 -0
  3. package/AppRoot/{context.mjs → AppRootProvider.js} +1 -1
  4. package/AppRoot/AppRootProvider.js.map +1 -0
  5. package/AppRoot/Renderar.cjs +89 -0
  6. package/AppRoot/Renderar.cjs.map +1 -0
  7. package/AppRoot/Renderar.d.ts +1 -0
  8. package/AppRoot/Renderar.js +52 -20
  9. package/AppRoot/Renderar.js.map +1 -1
  10. package/AppRoot/index.cjs +43 -0
  11. package/AppRoot/index.cjs.map +1 -0
  12. package/AppRoot/index.d.ts +2 -2
  13. package/AppRoot/index.js +24 -106
  14. package/AppRoot/index.js.map +1 -1
  15. package/Document/index.cjs +21 -0
  16. package/Document/index.cjs.map +1 -0
  17. package/Document/index.d.ts +7 -1
  18. package/Document/index.js +8 -11
  19. package/Document/index.js.map +1 -1
  20. package/Iframe/index.cjs +45 -0
  21. package/Iframe/index.cjs.map +1 -0
  22. package/Iframe/index.d.ts +1 -0
  23. package/Iframe/index.js +23 -25
  24. package/Iframe/index.js.map +1 -1
  25. package/Tag/ServerStyleTag.cjs +13 -0
  26. package/Tag/{ServerStyleTag.mjs.map → ServerStyleTag.cjs.map} +1 -1
  27. package/Tag/ServerStyleTag.js +3 -5
  28. package/Tag/ServerStyleTag.js.map +1 -1
  29. package/Tag/{cssPropList.mjs → cssPropList.cjs} +4 -2
  30. package/Tag/cssPropList.cjs.map +1 -0
  31. package/Tag/cssPropList.js +1 -3
  32. package/Tag/cssPropList.js.map +1 -1
  33. package/Tag/index.cjs +40 -0
  34. package/Tag/{index.mjs.map → index.cjs.map} +1 -1
  35. package/Tag/index.js +10 -31
  36. package/Tag/index.js.map +1 -1
  37. package/Tag/{useTagProps.mjs → useTagProps.cjs} +18 -13
  38. package/Tag/useTagProps.cjs.map +1 -0
  39. package/Tag/useTagProps.js +15 -14
  40. package/Tag/useTagProps.js.map +1 -1
  41. package/Transition/index.cjs +29 -0
  42. package/Transition/{index.mjs.map → index.cjs.map} +1 -1
  43. package/Transition/index.js +13 -15
  44. package/Transition/index.js.map +1 -1
  45. package/breakpoint/BreakpointProvider.cjs +43 -0
  46. package/breakpoint/{BreakpointProvider.mjs.map → BreakpointProvider.cjs.map} +1 -1
  47. package/breakpoint/BreakpointProvider.js +13 -16
  48. package/breakpoint/BreakpointProvider.js.map +1 -1
  49. package/breakpoint/useBreakpoint.cjs +24 -0
  50. package/breakpoint/{useBreakpoint.mjs.map → useBreakpoint.cjs.map} +1 -1
  51. package/breakpoint/useBreakpoint.js +7 -9
  52. package/breakpoint/useBreakpoint.js.map +1 -1
  53. package/breakpoint/{useBreakpointProps.mjs → useBreakpointProps.cjs} +8 -6
  54. package/breakpoint/useBreakpointProps.cjs.map +1 -0
  55. package/breakpoint/useBreakpointProps.js +5 -7
  56. package/breakpoint/useBreakpointProps.js.map +1 -1
  57. package/css/CSSCacheProvider.cjs +34 -0
  58. package/css/CSSCacheProvider.cjs.map +1 -0
  59. package/css/CSSCacheProvider.d.ts +7 -0
  60. package/css/CSSCacheProvider.js +29 -0
  61. package/css/CSSCacheProvider.js.map +1 -0
  62. package/css/{aliases.mjs → aliases.cjs} +4 -2
  63. package/css/aliases.cjs.map +1 -0
  64. package/css/aliases.js +1 -3
  65. package/css/aliases.js.map +1 -1
  66. package/css/{getProps.mjs → getProps.cjs} +4 -2
  67. package/css/{getProps.mjs.map → getProps.cjs.map} +1 -1
  68. package/css/getProps.js +1 -3
  69. package/css/getProps.js.map +1 -1
  70. package/css/{getValue.mjs → getValue.cjs} +4 -2
  71. package/css/{getValue.mjs.map → getValue.cjs.map} +1 -1
  72. package/css/getValue.js +1 -3
  73. package/css/getValue.js.map +1 -1
  74. package/css/{index.mjs → index.cjs} +15 -7
  75. package/css/index.cjs.map +1 -0
  76. package/css/index.js +6 -14
  77. package/css/index.js.map +1 -1
  78. package/hooks/{useAnimation.mjs → useAnimation.cjs} +18 -6
  79. package/hooks/useAnimation.cjs.map +1 -0
  80. package/hooks/useAnimation.js +12 -10
  81. package/hooks/useAnimation.js.map +1 -1
  82. package/hooks/{useColorTemplate.mjs → useColorTemplate.cjs} +4 -2
  83. package/hooks/{useColorTemplate.mjs.map → useColorTemplate.cjs.map} +1 -1
  84. package/hooks/useColorTemplate.js +1 -3
  85. package/hooks/useColorTemplate.js.map +1 -1
  86. package/hooks/useInterface.cjs +19 -0
  87. package/hooks/useInterface.cjs.map +1 -0
  88. package/hooks/useInterface.js +7 -9
  89. package/hooks/useInterface.js.map +1 -1
  90. package/hooks/{useMergeRefs.mjs → useMergeRefs.cjs} +6 -4
  91. package/hooks/{useMergeRefs.mjs.map → useMergeRefs.cjs.map} +1 -1
  92. package/hooks/useMergeRefs.js +3 -5
  93. package/hooks/useMergeRefs.js.map +1 -1
  94. package/hooks/usePortal.cjs +66 -0
  95. package/hooks/usePortal.cjs.map +1 -0
  96. package/hooks/usePortal.js +24 -30
  97. package/hooks/usePortal.js.map +1 -1
  98. package/hooks/useTransition/{index.mjs → index.cjs} +29 -25
  99. package/hooks/useTransition/index.cjs.map +1 -0
  100. package/hooks/useTransition/index.js +26 -26
  101. package/hooks/useTransition/index.js.map +1 -1
  102. package/hooks/useTransition/{variants.mjs → variants.cjs} +17 -2
  103. package/hooks/useTransition/{variants.mjs.map → variants.cjs.map} +1 -1
  104. package/hooks/useTransition/variants.js +1 -16
  105. package/hooks/useTransition/variants.js.map +1 -1
  106. package/index.cjs +64 -0
  107. package/index.cjs.map +1 -0
  108. package/index.d.ts +3 -2
  109. package/index.js +25 -60
  110. package/index.js.map +1 -1
  111. package/package.json +5 -12
  112. package/theme/{ThemeCssVars.mjs → ThemeCssVars.cjs} +4 -2
  113. package/theme/{ThemeCssVars.mjs.map → ThemeCssVars.cjs.map} +1 -1
  114. package/theme/ThemeCssVars.js +1 -3
  115. package/theme/ThemeCssVars.js.map +1 -1
  116. package/theme/{ThemeDefaultOptions.mjs → ThemeDefaultOptions.cjs} +11 -5
  117. package/theme/{ThemeDefaultOptions.mjs.map → ThemeDefaultOptions.cjs.map} +1 -1
  118. package/theme/ThemeDefaultOptions.js +4 -10
  119. package/theme/ThemeDefaultOptions.js.map +1 -1
  120. package/theme/ThemeProvider.cjs +154 -0
  121. package/theme/ThemeProvider.cjs.map +1 -0
  122. package/theme/ThemeProvider.d.ts +3 -1
  123. package/theme/ThemeProvider.js +109 -41
  124. package/theme/ThemeProvider.js.map +1 -1
  125. package/theme/{core.mjs → core.cjs} +12 -6
  126. package/theme/core.cjs.map +1 -0
  127. package/theme/core.js +5 -11
  128. package/theme/core.js.map +1 -1
  129. package/theme/createTheme.cjs +27 -0
  130. package/theme/{createTheme.mjs.map → createTheme.cjs.map} +1 -1
  131. package/theme/createTheme.js +10 -12
  132. package/theme/createTheme.js.map +1 -1
  133. package/theme/{createThemeSwitcher.mjs → createThemeSwitcher.cjs} +8 -6
  134. package/theme/{createThemeSwitcher.mjs.map → createThemeSwitcher.cjs.map} +1 -1
  135. package/theme/createThemeSwitcher.js +5 -7
  136. package/theme/createThemeSwitcher.js.map +1 -1
  137. package/theme/index.cjs +15 -0
  138. package/theme/{index.mjs.map → index.cjs.map} +1 -1
  139. package/theme/index.js +6 -11
  140. package/theme/index.js.map +1 -1
  141. package/AppRoot/Renderar.mjs +0 -51
  142. package/AppRoot/Renderar.mjs.map +0 -1
  143. package/AppRoot/context.js.map +0 -1
  144. package/AppRoot/context.mjs.map +0 -1
  145. package/AppRoot/index.mjs +0 -118
  146. package/AppRoot/index.mjs.map +0 -1
  147. package/Document/index.mjs +0 -18
  148. package/Document/index.mjs.map +0 -1
  149. package/Iframe/index.mjs +0 -43
  150. package/Iframe/index.mjs.map +0 -1
  151. package/Tag/ServerStyleTag.mjs +0 -11
  152. package/Tag/cssPropList.mjs.map +0 -1
  153. package/Tag/index.mjs +0 -19
  154. package/Tag/useTagProps.mjs.map +0 -1
  155. package/Transition/index.mjs +0 -27
  156. package/breakpoint/BreakpointProvider.mjs +0 -40
  157. package/breakpoint/useBreakpoint.mjs +0 -22
  158. package/breakpoint/useBreakpointProps.mjs.map +0 -1
  159. package/css/aliases.mjs.map +0 -1
  160. package/css/index.mjs.map +0 -1
  161. package/hooks/useAnimation.mjs.map +0 -1
  162. package/hooks/useInterface.mjs +0 -17
  163. package/hooks/useInterface.mjs.map +0 -1
  164. package/hooks/usePortal.mjs +0 -68
  165. package/hooks/usePortal.mjs.map +0 -1
  166. package/hooks/useTransition/index.mjs.map +0 -1
  167. package/index.mjs +0 -25
  168. package/index.mjs.map +0 -1
  169. package/theme/ThemeProvider.mjs +0 -44
  170. package/theme/ThemeProvider.mjs.map +0 -1
  171. package/theme/core.mjs.map +0 -1
  172. package/theme/createTheme.mjs +0 -25
  173. package/theme/index.mjs +0 -10
  174. /package/AppRoot/{context.d.ts → AppRootProvider.d.ts} +0 -0
@@ -1,65 +1,133 @@
1
1
  "use client";
2
- 'use strict';
2
+ import { __rest } from 'tslib';
3
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
+ import * as React from 'react';
5
+ import Tag from '../Tag/index.js';
6
+ import { ThemeFactory, ThemeContex } from './core.js';
7
+ import ThemeCssVars from './ThemeCssVars.js';
8
+ import { css } from '../css/index.js';
9
+ import { createDefaultThemes } from './ThemeDefaultOptions.js';
10
+ import ServerStyleTag from '../Tag/ServerStyleTag.js';
11
+ import { useDocument } from '../Document/index.js';
12
+ import { themeRootClass } from './index.js';
13
+ import { useCSSCacheId } from '../css/CSSCacheProvider.js';
3
14
 
4
- var tslib = require('tslib');
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var React = require('react');
7
- var index$2 = require('../Tag/index.js');
8
- var core = require('./core.js');
9
- var ThemeCssVars = require('./ThemeCssVars.js');
10
- var index$1 = require('../css/index.js');
11
- var ThemeDefaultOptions = require('./ThemeDefaultOptions.js');
12
- var ServerStyleTag = require('../Tag/ServerStyleTag.js');
13
- var index = require('../Document/index.js');
14
-
15
- function _interopNamespaceDefault(e) {
16
- var n = Object.create(null);
17
- if (e) {
18
- Object.keys(e).forEach(function (k) {
19
- if (k !== 'default') {
20
- var d = Object.getOwnPropertyDescriptor(e, k);
21
- Object.defineProperty(n, k, d.get ? d : {
22
- enumerable: true,
23
- get: function () { return e[k]; }
24
- });
25
- }
26
- });
27
- }
28
- n.default = e;
29
- return Object.freeze(n);
30
- }
31
-
32
- var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
33
-
34
- ThemeDefaultOptions.createDefaultThemes();
15
+ createDefaultThemes();
35
16
  const ThemeProvider = (_a) => {
36
- var { children, theme } = _a, props = tslib.__rest(_a, ["children", "theme"]);
37
- let THEME = core.ThemeFactory.get(theme);
17
+ var { children, theme, isRoot, noScrollbarCss } = _a, props = __rest(_a, ["children", "theme", "isRoot", "noScrollbarCss"]);
18
+ let THEME = ThemeFactory.get(theme);
38
19
  if (!THEME) {
39
20
  console.error(`ThemeProvider: The theme '${theme}' is not defined. Please make sure to use a valid theme name.`);
40
- THEME = core.ThemeFactory.get("light");
21
+ THEME = ThemeFactory.get("light");
41
22
  }
42
- const doc = index.useDocument();
43
- const globalStyle = React__namespace.useMemo(() => {
23
+ const doc = useDocument().document;
24
+ const cacheId = useCSSCacheId();
25
+ const themeGlobalStyle = React.useMemo(() => {
44
26
  const root_cls = `.xui-${theme}-theme-root`;
45
27
  let gkeys = Object.keys(THEME.globalStyle || {});
46
28
  let gstyles = {};
47
29
  gkeys.forEach((key) => {
48
30
  gstyles[`${root_cls} ${key}`] = THEME.globalStyle[key];
49
31
  });
50
- return index$1.css({
32
+ return css({
51
33
  "@global": Object.assign(Object.assign({}, gstyles), { [root_cls]: ThemeCssVars(THEME) })
52
34
  }, {
53
35
  injectStyle: typeof window !== 'undefined',
54
36
  container: doc,
37
+ cacheId
38
+ });
39
+ }, [theme, doc]);
40
+ const resetCss = React.useMemo(() => {
41
+ if (!isRoot)
42
+ return;
43
+ return css({
44
+ "@global": {
45
+ "*": {
46
+ m: 0,
47
+ p: 0,
48
+ outline: "none",
49
+ boxSizing: "border-box",
50
+ verticalAlign: "baseline",
51
+ },
52
+ "html, body": {
53
+ minHeight: "100%",
54
+ "-webkit-font-smoothing": "antialiased",
55
+ "-moz-osx-font-smoothing": "grayscale",
56
+ },
57
+ "img, picture, video, canvas, svg": {
58
+ maxWidth: "100%",
59
+ display: "block"
60
+ },
61
+ "input, button, textarea, select": {
62
+ font: "inherit"
63
+ },
64
+ "table": {
65
+ borderCollapse: "collapse",
66
+ borderSpacing: 0,
67
+ },
68
+ "ol, ul": {
69
+ listStyle: "none",
70
+ padding: 0,
71
+ margin: 0,
72
+ },
73
+ "a": {
74
+ display: "inline-block",
75
+ color: "inherit",
76
+ textDecoration: "none",
77
+ cursor: "pointer",
78
+ "&:hover": {
79
+ textDecoration: "underline"
80
+ }
81
+ },
82
+ "p, h1, h2, h3, h4, h5, h6": {
83
+ overflowWrap: "break-word",
84
+ },
85
+ }
86
+ }, {
87
+ injectStyle: typeof window !== 'undefined',
88
+ container: doc,
89
+ cacheId
90
+ });
91
+ }, []);
92
+ const scrollbarCss = React.useMemo(() => {
93
+ if (noScrollbarCss)
94
+ return;
95
+ const cls = (cls) => `${themeRootClass(theme)} ${cls}`;
96
+ let thumbSize = 6;
97
+ let thumbColor = "var(--color-text-secondary)";
98
+ let trackColor = "transparent";
99
+ return css({
100
+ "@global": {
101
+ [cls('*::-webkit-scrollbar')]: {
102
+ width: thumbSize,
103
+ height: thumbSize,
104
+ },
105
+ [cls("*::-webkit-scrollbar-thumb")]: {
106
+ backgroundColor: thumbColor,
107
+ borderRadius: "6px",
108
+ opacity: 0.6,
109
+ },
110
+ [cls("*::-webkit-scrollbar-thumb:hover")]: {
111
+ backgroundColor: thumbColor,
112
+ opacity: 0.0,
113
+ },
114
+ [cls("*::-webkit-scrollbar-track")]: {
115
+ backgroundColor: trackColor,
116
+ borderRadius: "6px",
117
+ },
118
+ }
119
+ }, {
120
+ injectStyle: typeof window !== 'undefined',
121
+ container: doc,
122
+ cacheId
55
123
  });
56
- }, [theme]);
57
- return (jsxRuntime.jsxs(core.ThemeContex.Provider, { value: theme, children: [jsxRuntime.jsx(ServerStyleTag, { factory: globalStyle }), jsxRuntime.jsx(index$2, Object.assign({ minHeight: "100%", bgcolor: "background.primary", color: "text.primary", fontSize: "text", fontWeight: "text", lineHeight: "text", fontFamily: `system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif` }, props, { sxr: {
124
+ }, [noScrollbarCss, theme]);
125
+ return (jsxs(ThemeContex.Provider, { value: theme, children: [isRoot && jsxs(Fragment, { children: [jsx(ServerStyleTag, { factory: resetCss }), !noScrollbarCss && jsx(ServerStyleTag, { factory: scrollbarCss })] }), jsx(ServerStyleTag, { factory: themeGlobalStyle }), jsx(Tag, Object.assign({ minHeight: "100%", bgcolor: "background.primary", color: "text.primary", fontSize: "text", fontWeight: "text", lineHeight: "text", fontFamily: `system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif` }, props, { sxr: {
58
126
  "& a": {
59
127
  color: "brand.primary",
60
128
  },
61
129
  }, baseClass: `${theme}-theme-root`, direction: THEME.rtl ? "rtl" : "ltr", children: children }))] }));
62
130
  };
63
131
 
64
- module.exports = ThemeProvider;
132
+ export { ThemeProvider as default };
65
133
  //# sourceMappingURL=ThemeProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.js","sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["\"use client\";\r\nimport * as React from \"react\"\r\nimport { ThemeOptions } from \"./types\"\r\nimport Tag from \"../Tag\"\r\nimport { TagComponentType, TagProps } from \"../Tag/types\"\r\nimport { ThemeContex, ThemeFactory } from \"./core\"\r\nimport ThemeCssVars from \"./ThemeCssVars\"\r\nimport { css } from \"../css\"\r\nimport { createDefaultThemes } from \"./ThemeDefaultOptions\"\r\nimport ServerStyleTag from \"../Tag/ServerStyleTag\"\r\nimport { useDocument } from \"../Document\";\r\n\r\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\r\n theme: string;\r\n}\r\n\r\ncreateDefaultThemes()\r\n\r\nconst ThemeProvider = <T extends TagComponentType = 'div'>({ children, theme, ...props }: ThemeProviderProps<T>) => {\r\n let THEME = ThemeFactory.get(theme) as ThemeOptions\r\n if (!THEME) {\r\n console.error(`ThemeProvider: The theme '${theme}' is not defined. Please make sure to use a valid theme name.`)\r\n THEME = ThemeFactory.get(\"light\") as ThemeOptions\r\n }\r\n const doc = useDocument();\r\n\r\n const globalStyle: any = React.useMemo(() => {\r\n const root_cls = `.xui-${theme}-theme-root`\r\n let gkeys = Object.keys(THEME.globalStyle || {})\r\n let gstyles: any = {}\r\n gkeys.forEach((key) => {\r\n gstyles[`${root_cls} ${key}`] = THEME.globalStyle[key as any]\r\n })\r\n\r\n return css({\r\n \"@global\": {\r\n ...gstyles,\r\n [root_cls]: ThemeCssVars(THEME)\r\n }\r\n }, {\r\n injectStyle: typeof window !== 'undefined',\r\n container: doc,\r\n })\r\n }, [theme])\r\n\r\n return (\r\n <ThemeContex.Provider value={theme}>\r\n <ServerStyleTag factory={globalStyle} />\r\n <Tag\r\n minHeight=\"100%\"\r\n bgcolor=\"background.primary\"\r\n color=\"text.primary\"\r\n fontSize=\"text\"\r\n fontWeight=\"text\"\r\n lineHeight=\"text\"\r\n fontFamily={`system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif`}\r\n {...props}\r\n sxr={{\r\n \"& a\": {\r\n color: \"brand.primary\",\r\n },\r\n }}\r\n baseClass={`${theme}-theme-root`}\r\n direction={THEME.rtl ? \"rtl\" : \"ltr\"}\r\n >\r\n {children}\r\n </Tag>\r\n </ThemeContex.Provider>\r\n )\r\n}\r\n\r\nexport default ThemeProvider"],"names":["createDefaultThemes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBAA;AAEA;;;;AAGM;AACA;;AAEH;AAEA;AACG;AACA;;AAEA;AACG;AACH;AAEA;;;AAMG;AACA;AACF;AACJ;;AAeY;AACG;AACF;;AAShB;;"}
1
+ {"version":3,"file":"ThemeProvider.js","sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["\"use client\";\r\nimport * as React from \"react\"\r\nimport { ThemeOptions } from \"./types\"\r\nimport Tag from \"../Tag\"\r\nimport { TagComponentType, TagProps } from \"../Tag/types\"\r\nimport { ThemeContex, ThemeFactory } from \"./core\"\r\nimport ThemeCssVars from \"./ThemeCssVars\"\r\nimport { css } from \"../css\"\r\nimport { createDefaultThemes } from \"./ThemeDefaultOptions\"\r\nimport ServerStyleTag from \"../Tag/ServerStyleTag\"\r\nimport { useDocument } from \"../Document\";\r\nimport { themeRootClass } from \".\";\r\nimport { useCSSCacheId } from \"../css/CSSCacheProvider\";\r\n\r\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\r\n theme: string;\r\n isRoot?: boolean;\r\n noScrollbarCss?: boolean;\r\n}\r\n\r\ncreateDefaultThemes()\r\n\r\nconst ThemeProvider = <T extends TagComponentType = 'div'>({ children, theme, isRoot, noScrollbarCss, ...props }: ThemeProviderProps<T>) => {\r\n let THEME = ThemeFactory.get(theme) as ThemeOptions\r\n if (!THEME) {\r\n console.error(`ThemeProvider: The theme '${theme}' is not defined. Please make sure to use a valid theme name.`)\r\n THEME = ThemeFactory.get(\"light\") as ThemeOptions\r\n }\r\n const doc = useDocument().document;\r\n const cacheId = useCSSCacheId()\r\n\r\n const themeGlobalStyle: any = React.useMemo(() => {\r\n const root_cls = `.xui-${theme}-theme-root`\r\n let gkeys = Object.keys(THEME.globalStyle || {})\r\n let gstyles: any = {}\r\n gkeys.forEach((key) => {\r\n gstyles[`${root_cls} ${key}`] = THEME.globalStyle[key as any]\r\n })\r\n\r\n return css({\r\n \"@global\": {\r\n ...gstyles,\r\n [root_cls]: ThemeCssVars(THEME)\r\n }\r\n }, {\r\n injectStyle: typeof window !== 'undefined',\r\n container: doc,\r\n cacheId\r\n })\r\n }, [theme, doc])\r\n\r\n const resetCss = React.useMemo(() => {\r\n if (!isRoot) return\r\n return css({\r\n \"@global\": {\r\n \"*\": {\r\n m: 0,\r\n p: 0,\r\n outline: \"none\",\r\n boxSizing: \"border-box\",\r\n verticalAlign: \"baseline\",\r\n },\r\n \"html, body\": {\r\n minHeight: \"100%\",\r\n \"-webkit-font-smoothing\": \"antialiased\",\r\n \"-moz-osx-font-smoothing\": \"grayscale\",\r\n } as any,\r\n \"img, picture, video, canvas, svg\": {\r\n maxWidth: \"100%\",\r\n display: \"block\"\r\n },\r\n \"input, button, textarea, select\": {\r\n font: \"inherit\"\r\n },\r\n \"table\": {\r\n borderCollapse: \"collapse\",\r\n borderSpacing: 0,\r\n },\r\n \"ol, ul\": {\r\n listStyle: \"none\",\r\n padding: 0,\r\n margin: 0,\r\n },\r\n \"a\": {\r\n display: \"inline-block\",\r\n color: \"inherit\",\r\n textDecoration: \"none\",\r\n cursor: \"pointer\",\r\n \"&:hover\": {\r\n textDecoration: \"underline\"\r\n }\r\n },\r\n \"p, h1, h2, h3, h4, h5, h6\": {\r\n overflowWrap: \"break-word\",\r\n },\r\n }\r\n }, {\r\n injectStyle: typeof window !== 'undefined',\r\n container: doc,\r\n cacheId\r\n })\r\n }, [])\r\n\r\n const scrollbarCss: any = React.useMemo(() => {\r\n if (noScrollbarCss) return;\r\n const cls = (cls: string) => `${themeRootClass(theme)} ${cls}`\r\n let thumbSize = 6\r\n let thumbColor = \"var(--color-text-secondary)\"\r\n let trackColor = \"transparent\"\r\n\r\n return css({\r\n \"@global\": {\r\n [cls('*::-webkit-scrollbar')]: {\r\n width: thumbSize,\r\n height: thumbSize,\r\n },\r\n [cls(\"*::-webkit-scrollbar-thumb\")]: {\r\n backgroundColor: thumbColor,\r\n borderRadius: \"6px\",\r\n opacity: 0.6,\r\n },\r\n [cls(\"*::-webkit-scrollbar-thumb:hover\")]: {\r\n backgroundColor: thumbColor,\r\n opacity: 0.0,\r\n },\r\n [cls(\"*::-webkit-scrollbar-track\")]: {\r\n backgroundColor: trackColor,\r\n borderRadius: \"6px\",\r\n },\r\n }\r\n }, {\r\n injectStyle: typeof window !== 'undefined',\r\n container: doc,\r\n cacheId\r\n }) as any\r\n }, [noScrollbarCss, theme])\r\n\r\n return (\r\n <ThemeContex.Provider value={theme}>\r\n {\r\n isRoot && <>\r\n <ServerStyleTag factory={resetCss as any} />\r\n {\r\n !noScrollbarCss && <ServerStyleTag factory={scrollbarCss} />\r\n }\r\n </>\r\n }\r\n <ServerStyleTag factory={themeGlobalStyle} />\r\n <Tag\r\n minHeight=\"100%\"\r\n bgcolor=\"background.primary\"\r\n color=\"text.primary\"\r\n fontSize=\"text\"\r\n fontWeight=\"text\"\r\n lineHeight=\"text\"\r\n fontFamily={`system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif`}\r\n {...props}\r\n sxr={{\r\n \"& a\": {\r\n color: \"brand.primary\",\r\n },\r\n }}\r\n baseClass={`${theme}-theme-root`}\r\n direction={THEME.rtl ? \"rtl\" : \"ltr\"}\r\n >\r\n {children}\r\n </Tag>\r\n </ThemeContex.Provider>\r\n )\r\n}\r\n\r\nexport default ThemeProvider"],"names":[],"mappings":";;;;;;;;;;;;;;AAoBA;AAEA;AAA2D;;;AAGrD;AACA;;AAEH;AACA;AAEA;AACG;AACA;;AAEA;AACG;AACH;AAEA;;;AAMG;AACA;;AAEF;AACJ;AAEA;AACG;;AACA;AACG;AACG;AACG;AACA;AACA;AACA;AACA;AACF;AACD;AACG;AACA;AACA;AACK;AACR;AACG;AACA;AACF;AACD;AACG;AACF;AACD;AACG;AACA;AACF;AACD;AACG;AACA;AACA;AACF;AACD;AACG;AACA;AACA;AACA;AACA;AACG;AACF;AACH;AACD;AACG;AACF;AACH;;AAED;AACA;;AAEF;;AAGJ;AACG;;AACA;;;;AAKA;AACG;AACG;AACG;AACA;AACF;AACD;AACG;AACA;AACA;AACF;AACD;AACG;AACA;AACF;AACD;AACG;AACA;AACF;AACH;;AAED;AACA;;AAEF;AACJ;AAEA;AAqBY;AACG;AACF;;AAShB;;"}
@@ -1,10 +1,12 @@
1
- import React__default from 'react';
1
+ 'use strict';
2
+
3
+ var React = require('react');
2
4
 
3
5
  const ThemeFactory = new Map();
4
- const ThemeContex = React__default.createContext("light");
6
+ const ThemeContex = React.createContext("light");
5
7
  const getTheme = (theme) => ThemeFactory.get(theme);
6
8
  const useTheme = () => {
7
- const theme = ThemeFactory.get(React__default.useContext(ThemeContex));
9
+ const theme = ThemeFactory.get(React.useContext(ThemeContex));
8
10
  if (!theme) {
9
11
  console.error("Theme not found, returning light theme as fallback");
10
12
  return ThemeFactory.get("light");
@@ -16,7 +18,7 @@ const mergeObject = (a, b) => {
16
18
  b = Object.assign({}, b);
17
19
  for (const key in b) {
18
20
  const v = b[key];
19
- if (typeof v === 'object' && !Array.isArray(v) && !React__default.isValidElement(v)) {
21
+ if (typeof v === 'object' && !Array.isArray(v) && !React.isValidElement(v)) {
20
22
  a[key] = mergeObject(a[key], b[key]);
21
23
  }
22
24
  else {
@@ -26,5 +28,9 @@ const mergeObject = (a, b) => {
26
28
  return a;
27
29
  };
28
30
 
29
- export { ThemeContex, ThemeFactory, getTheme, mergeObject, useTheme };
30
- //# sourceMappingURL=core.mjs.map
31
+ exports.ThemeContex = ThemeContex;
32
+ exports.ThemeFactory = ThemeFactory;
33
+ exports.getTheme = getTheme;
34
+ exports.mergeObject = mergeObject;
35
+ exports.useTheme = useTheme;
36
+ //# sourceMappingURL=core.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.cjs","sources":["../../src/theme/core.ts"],"sourcesContent":["import React from \"react\"\r\nimport { ObjectType, ThemeOptions } from \"./types\"\r\n\r\nexport const ThemeFactory = new Map<string, ThemeOptions>()\r\nexport const ThemeContex = React.createContext(\"light\")\r\nexport const getTheme = (theme: string) => ThemeFactory.get(theme)\r\nexport const useTheme = (): ThemeOptions => {\r\n const theme = ThemeFactory.get(React.useContext(ThemeContex)) as any\r\n if (!theme) {\r\n console.error(\"Theme not found, returning light theme as fallback\")\r\n return ThemeFactory.get(\"light\") as any\r\n }\r\n return theme\r\n}\r\n\r\nexport const mergeObject = (a: ObjectType, b: ObjectType) => {\r\n a = { ...a }\r\n b = { ...b }\r\n for (const key in b) {\r\n const v = (b as any)[key]\r\n if (typeof v === 'object' && !Array.isArray(v) && !React.isValidElement(v)) {\r\n a[key] = mergeObject(a[key], b[key])\r\n } else {\r\n a[key] = v\r\n }\r\n }\r\n return a\r\n}\r\n"],"names":[],"mappings":";;;;AAGO,MAAM,YAAY,GAAG,IAAI,GAAG;AAC5B,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO;AAC/C,MAAM,QAAQ,GAAG,CAAC,KAAa,KAAK,YAAY,CAAC,GAAG,CAAC,KAAK;AAC1D,MAAM,QAAQ,GAAG,MAAmB;AACxC,IAAA,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAQ;IACpE,IAAI,CAAC,KAAK,EAAE;AACT,QAAA,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC;AACnE,QAAA,OAAO,YAAY,CAAC,GAAG,CAAC,OAAO,CAAQ;IAC1C;AACA,IAAA,OAAO,KAAK;AACf;MAEa,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;QACvC;aAAO;AACJ,YAAA,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;QACb;IACH;AACA,IAAA,OAAO,CAAC;AACX;;;;;;;;"}
package/theme/core.js CHANGED
@@ -1,12 +1,10 @@
1
- 'use strict';
2
-
3
- var React = require('react');
1
+ import React__default from 'react';
4
2
 
5
3
  const ThemeFactory = new Map();
6
- const ThemeContex = React.createContext("light");
4
+ const ThemeContex = React__default.createContext("light");
7
5
  const getTheme = (theme) => ThemeFactory.get(theme);
8
6
  const useTheme = () => {
9
- const theme = ThemeFactory.get(React.useContext(ThemeContex));
7
+ const theme = ThemeFactory.get(React__default.useContext(ThemeContex));
10
8
  if (!theme) {
11
9
  console.error("Theme not found, returning light theme as fallback");
12
10
  return ThemeFactory.get("light");
@@ -18,7 +16,7 @@ const mergeObject = (a, b) => {
18
16
  b = Object.assign({}, b);
19
17
  for (const key in b) {
20
18
  const v = b[key];
21
- if (typeof v === 'object' && !Array.isArray(v) && !React.isValidElement(v)) {
19
+ if (typeof v === 'object' && !Array.isArray(v) && !React__default.isValidElement(v)) {
22
20
  a[key] = mergeObject(a[key], b[key]);
23
21
  }
24
22
  else {
@@ -28,9 +26,5 @@ const mergeObject = (a, b) => {
28
26
  return a;
29
27
  };
30
28
 
31
- exports.ThemeContex = ThemeContex;
32
- exports.ThemeFactory = ThemeFactory;
33
- exports.getTheme = getTheme;
34
- exports.mergeObject = mergeObject;
35
- exports.useTheme = useTheme;
29
+ export { ThemeContex, ThemeFactory, getTheme, mergeObject, useTheme };
36
30
  //# sourceMappingURL=core.js.map
package/theme/core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sources":["../../src/theme/core.ts"],"sourcesContent":["import React from \"react\"\r\nimport { ObjectType, ThemeOptions } from \"./types\"\r\n\r\nexport const ThemeFactory = new Map<string, ThemeOptions>()\r\nexport const ThemeContex = React.createContext(\"light\")\r\nexport const getTheme = (theme: string) => ThemeFactory.get(theme)\r\nexport const useTheme = (): ThemeOptions => {\r\n const theme = ThemeFactory.get(React.useContext(ThemeContex)) as any\r\n if (!theme) {\r\n console.error(\"Theme not found, returning light theme as fallback\")\r\n return ThemeFactory.get(\"light\") as any\r\n }\r\n return theme\r\n}\r\n\r\nexport const mergeObject = (a: ObjectType, b: ObjectType) => {\r\n a = { ...a }\r\n b = { ...b }\r\n for (const key in b) {\r\n const v = (b as any)[key]\r\n if (typeof v === 'object' && !Array.isArray(v) && !React.isValidElement(v)) {\r\n a[key] = mergeObject(a[key], b[key])\r\n } else {\r\n a[key] = v\r\n }\r\n }\r\n return a\r\n}\r\n"],"names":[],"mappings":";;;;AAGO,MAAM,YAAY,GAAG,IAAI,GAAG;AAC5B,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO;AAC/C,MAAM,QAAQ,GAAG,CAAC,KAAa,KAAK,YAAY,CAAC,GAAG,CAAC,KAAK;AAC1D,MAAM,QAAQ,GAAG,MAAmB;AACxC,IAAA,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAQ;IACpE,IAAI,CAAC,KAAK,EAAE;AACT,QAAA,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC;AACnE,QAAA,OAAO,YAAY,CAAC,GAAG,CAAC,OAAO,CAAQ;IAC1C;AACA,IAAA,OAAO,KAAK;AACf;MAEa,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;QACvC;aAAO;AACJ,YAAA,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;QACb;IACH;AACA,IAAA,OAAO,CAAC;AACX;;;;;;;;"}
1
+ {"version":3,"file":"core.js","sources":["../../src/theme/core.ts"],"sourcesContent":["import React from \"react\"\r\nimport { ObjectType, ThemeOptions } from \"./types\"\r\n\r\nexport const ThemeFactory = new Map<string, ThemeOptions>()\r\nexport const ThemeContex = React.createContext(\"light\")\r\nexport const getTheme = (theme: string) => ThemeFactory.get(theme)\r\nexport const useTheme = (): ThemeOptions => {\r\n const theme = ThemeFactory.get(React.useContext(ThemeContex)) as any\r\n if (!theme) {\r\n console.error(\"Theme not found, returning light theme as fallback\")\r\n return ThemeFactory.get(\"light\") as any\r\n }\r\n return theme\r\n}\r\n\r\nexport const mergeObject = (a: ObjectType, b: ObjectType) => {\r\n a = { ...a }\r\n b = { ...b }\r\n for (const key in b) {\r\n const v = (b as any)[key]\r\n if (typeof v === 'object' && !Array.isArray(v) && !React.isValidElement(v)) {\r\n a[key] = mergeObject(a[key], b[key])\r\n } else {\r\n a[key] = v\r\n }\r\n }\r\n return a\r\n}\r\n"],"names":["React"],"mappings":";;AAGO,MAAM,YAAY,GAAG,IAAI,GAAG;AAC5B,MAAM,WAAW,GAAGA,cAAK,CAAC,aAAa,CAAC,OAAO;AAC/C,MAAM,QAAQ,GAAG,CAAC,KAAa,KAAK,YAAY,CAAC,GAAG,CAAC,KAAK;AAC1D,MAAM,QAAQ,GAAG,MAAmB;AACxC,IAAA,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAACA,cAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAQ;IACpE,IAAI,CAAC,KAAK,EAAE;AACT,QAAA,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC;AACnE,QAAA,OAAO,YAAY,CAAC,GAAG,CAAC,OAAO,CAAQ;IAC1C;AACA,IAAA,OAAO,KAAK;AACf;MAEa,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;QACvC;aAAO;AACJ,YAAA,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;QACb;IACH;AACA,IAAA,OAAO,CAAC;AACX;;;;"}
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var core = require('./core.cjs');
4
+ var index = require('../css/index.cjs');
5
+ var ThemeDefaultOptions = require('./ThemeDefaultOptions.cjs');
6
+
7
+ const createTheme = (name, options) => {
8
+ if (core.ThemeFactory.has(name)) {
9
+ console.error(`createTheme: The theme '${name}' is already defined. Please choose a different name for the theme.`);
10
+ return core.ThemeFactory.get(name);
11
+ }
12
+ let theme = core.mergeObject(ThemeDefaultOptions.lightThemeOptions, Object.assign(Object.assign({}, options), { name, breakpoints: index.breakpoints }));
13
+ // add alpha colors
14
+ for (let color in theme.colors) {
15
+ const c = theme.colors[color];
16
+ const is_common = color === 'divider' || color === 'background' || color === 'text';
17
+ c.soft = {
18
+ primary: is_common ? index.alpha(c.primary, 0.60) : index.alpha(c.primary, 0.08),
19
+ secondary: is_common ? index.alpha(c.primary, 0.90) : index.alpha(c.primary, 0.12)
20
+ };
21
+ }
22
+ core.ThemeFactory.set(name, theme);
23
+ return theme;
24
+ };
25
+
26
+ exports.createTheme = createTheme;
27
+ //# sourceMappingURL=createTheme.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"createTheme.mjs","sources":["../../src/theme/createTheme.ts"],"sourcesContent":["import { ThemeOptions, ThemeOptionInput, ThemeOptionsColor } from \"./types\"\r\nimport { mergeObject, ThemeFactory } from \"./core\"\r\nimport { alpha, breakpoints } from \"../css\"\r\nimport { lightThemeOptions } from \"./ThemeDefaultOptions\"\r\n\r\nexport const createTheme = (name: string, options: ThemeOptionInput): ThemeOptions => {\r\n if (ThemeFactory.has(name)) {\r\n console.error(`createTheme: The theme '${name}' is already defined. Please choose a different name for the theme.`)\r\n return ThemeFactory.get(name) as ThemeOptions\r\n }\r\n\r\n let theme: any = mergeObject(lightThemeOptions, {\r\n ...options,\r\n name,\r\n breakpoints: breakpoints\r\n })\r\n\r\n // add alpha colors\r\n for (let color in theme.colors) {\r\n const c = theme.colors[color] as ThemeOptionsColor\r\n const is_common = color === 'divider' || color === 'background' || color === 'text'\r\n c.soft = {\r\n primary: is_common ? alpha(c.primary, 0.60) : alpha(c.primary, 0.08),\r\n secondary: is_common ? alpha(c.primary, 0.90) : alpha(c.primary, 0.12)\r\n }\r\n }\r\n\r\n ThemeFactory.set(name, theme)\r\n\r\n return theme as ThemeOptions\r\n}\r\n"],"names":[],"mappings":";;;;MAKa,WAAW,GAAG,CAAC,IAAY,EAAE,OAAyB,KAAkB;AAClF,IAAA,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AACzB,QAAA,OAAO,CAAC,KAAK,CAAC,2BAA2B,IAAI,CAAA,mEAAA,CAAqE,CAAC;AACnH,QAAA,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,CAAiB;IAChD;AAEA,IAAA,IAAI,KAAK,GAAQ,WAAW,CAAC,iBAAiB,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACxC,OAAO,CAAA,EAAA,EACV,IAAI,EACJ,WAAW,EAAE,WAAW,IACzB;;AAGF,IAAA,KAAK,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE;QAC7B,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAsB;AAClD,QAAA,MAAM,SAAS,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,MAAM;QACnF,CAAC,CAAC,IAAI,GAAG;YACN,OAAO,EAAE,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC;YACpE,SAAS,EAAE,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI;SACvE;IACJ;AAEA,IAAA,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;AAE7B,IAAA,OAAO,KAAqB;AAC/B;;;;"}
1
+ {"version":3,"file":"createTheme.cjs","sources":["../../src/theme/createTheme.ts"],"sourcesContent":["import { ThemeOptions, ThemeOptionInput, ThemeOptionsColor } from \"./types\"\r\nimport { mergeObject, ThemeFactory } from \"./core\"\r\nimport { alpha, breakpoints } from \"../css\"\r\nimport { lightThemeOptions } from \"./ThemeDefaultOptions\"\r\n\r\nexport const createTheme = (name: string, options: ThemeOptionInput): ThemeOptions => {\r\n if (ThemeFactory.has(name)) {\r\n console.error(`createTheme: The theme '${name}' is already defined. Please choose a different name for the theme.`)\r\n return ThemeFactory.get(name) as ThemeOptions\r\n }\r\n\r\n let theme: any = mergeObject(lightThemeOptions, {\r\n ...options,\r\n name,\r\n breakpoints: breakpoints\r\n })\r\n\r\n // add alpha colors\r\n for (let color in theme.colors) {\r\n const c = theme.colors[color] as ThemeOptionsColor\r\n const is_common = color === 'divider' || color === 'background' || color === 'text'\r\n c.soft = {\r\n primary: is_common ? alpha(c.primary, 0.60) : alpha(c.primary, 0.08),\r\n secondary: is_common ? alpha(c.primary, 0.90) : alpha(c.primary, 0.12)\r\n }\r\n }\r\n\r\n ThemeFactory.set(name, theme)\r\n\r\n return theme as ThemeOptions\r\n}\r\n"],"names":["ThemeFactory","mergeObject","lightThemeOptions","breakpoints","alpha"],"mappings":";;;;;;MAKa,WAAW,GAAG,CAAC,IAAY,EAAE,OAAyB,KAAkB;AAClF,IAAA,IAAIA,iBAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AACzB,QAAA,OAAO,CAAC,KAAK,CAAC,2BAA2B,IAAI,CAAA,mEAAA,CAAqE,CAAC;AACnH,QAAA,OAAOA,iBAAY,CAAC,GAAG,CAAC,IAAI,CAAiB;IAChD;AAEA,IAAA,IAAI,KAAK,GAAQC,gBAAW,CAACC,qCAAiB,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACxC,OAAO,CAAA,EAAA,EACV,IAAI,EACJ,WAAW,EAAEC,iBAAW,IACzB;;AAGF,IAAA,KAAK,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE;QAC7B,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAsB;AAClD,QAAA,MAAM,SAAS,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,MAAM;QACnF,CAAC,CAAC,IAAI,GAAG;YACN,OAAO,EAAE,SAAS,GAAGC,WAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAGA,WAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC;YACpE,SAAS,EAAE,SAAS,GAAGA,WAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAGA,WAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI;SACvE;IACJ;AAEA,IAAAJ,iBAAY,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;AAE7B,IAAA,OAAO,KAAqB;AAC/B;;;;"}
@@ -1,27 +1,25 @@
1
- 'use strict';
2
-
3
- var core = require('./core.js');
4
- var index = require('../css/index.js');
5
- var ThemeDefaultOptions = require('./ThemeDefaultOptions.js');
1
+ import { ThemeFactory, mergeObject } from './core.js';
2
+ import { breakpoints, alpha } from '../css/index.js';
3
+ import { lightThemeOptions } from './ThemeDefaultOptions.js';
6
4
 
7
5
  const createTheme = (name, options) => {
8
- if (core.ThemeFactory.has(name)) {
6
+ if (ThemeFactory.has(name)) {
9
7
  console.error(`createTheme: The theme '${name}' is already defined. Please choose a different name for the theme.`);
10
- return core.ThemeFactory.get(name);
8
+ return ThemeFactory.get(name);
11
9
  }
12
- let theme = core.mergeObject(ThemeDefaultOptions.lightThemeOptions, Object.assign(Object.assign({}, options), { name, breakpoints: index.breakpoints }));
10
+ let theme = mergeObject(lightThemeOptions, Object.assign(Object.assign({}, options), { name, breakpoints: breakpoints }));
13
11
  // add alpha colors
14
12
  for (let color in theme.colors) {
15
13
  const c = theme.colors[color];
16
14
  const is_common = color === 'divider' || color === 'background' || color === 'text';
17
15
  c.soft = {
18
- primary: is_common ? index.alpha(c.primary, 0.60) : index.alpha(c.primary, 0.08),
19
- secondary: is_common ? index.alpha(c.primary, 0.90) : index.alpha(c.primary, 0.12)
16
+ primary: is_common ? alpha(c.primary, 0.60) : alpha(c.primary, 0.08),
17
+ secondary: is_common ? alpha(c.primary, 0.90) : alpha(c.primary, 0.12)
20
18
  };
21
19
  }
22
- core.ThemeFactory.set(name, theme);
20
+ ThemeFactory.set(name, theme);
23
21
  return theme;
24
22
  };
25
23
 
26
- exports.createTheme = createTheme;
24
+ export { createTheme };
27
25
  //# sourceMappingURL=createTheme.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createTheme.js","sources":["../../src/theme/createTheme.ts"],"sourcesContent":["import { ThemeOptions, ThemeOptionInput, ThemeOptionsColor } from \"./types\"\r\nimport { mergeObject, ThemeFactory } from \"./core\"\r\nimport { alpha, breakpoints } from \"../css\"\r\nimport { lightThemeOptions } from \"./ThemeDefaultOptions\"\r\n\r\nexport const createTheme = (name: string, options: ThemeOptionInput): ThemeOptions => {\r\n if (ThemeFactory.has(name)) {\r\n console.error(`createTheme: The theme '${name}' is already defined. Please choose a different name for the theme.`)\r\n return ThemeFactory.get(name) as ThemeOptions\r\n }\r\n\r\n let theme: any = mergeObject(lightThemeOptions, {\r\n ...options,\r\n name,\r\n breakpoints: breakpoints\r\n })\r\n\r\n // add alpha colors\r\n for (let color in theme.colors) {\r\n const c = theme.colors[color] as ThemeOptionsColor\r\n const is_common = color === 'divider' || color === 'background' || color === 'text'\r\n c.soft = {\r\n primary: is_common ? alpha(c.primary, 0.60) : alpha(c.primary, 0.08),\r\n secondary: is_common ? alpha(c.primary, 0.90) : alpha(c.primary, 0.12)\r\n }\r\n }\r\n\r\n ThemeFactory.set(name, theme)\r\n\r\n return theme as ThemeOptions\r\n}\r\n"],"names":["ThemeFactory","mergeObject","lightThemeOptions","breakpoints","alpha"],"mappings":";;;;;;MAKa,WAAW,GAAG,CAAC,IAAY,EAAE,OAAyB,KAAkB;AAClF,IAAA,IAAIA,iBAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AACzB,QAAA,OAAO,CAAC,KAAK,CAAC,2BAA2B,IAAI,CAAA,mEAAA,CAAqE,CAAC;AACnH,QAAA,OAAOA,iBAAY,CAAC,GAAG,CAAC,IAAI,CAAiB;IAChD;AAEA,IAAA,IAAI,KAAK,GAAQC,gBAAW,CAACC,qCAAiB,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACxC,OAAO,CAAA,EAAA,EACV,IAAI,EACJ,WAAW,EAAEC,iBAAW,IACzB;;AAGF,IAAA,KAAK,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE;QAC7B,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAsB;AAClD,QAAA,MAAM,SAAS,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,MAAM;QACnF,CAAC,CAAC,IAAI,GAAG;YACN,OAAO,EAAE,SAAS,GAAGC,WAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAGA,WAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC;YACpE,SAAS,EAAE,SAAS,GAAGA,WAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAGA,WAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI;SACvE;IACJ;AAEA,IAAAJ,iBAAY,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;AAE7B,IAAA,OAAO,KAAqB;AAC/B;;;;"}
1
+ {"version":3,"file":"createTheme.js","sources":["../../src/theme/createTheme.ts"],"sourcesContent":["import { ThemeOptions, ThemeOptionInput, ThemeOptionsColor } from \"./types\"\r\nimport { mergeObject, ThemeFactory } from \"./core\"\r\nimport { alpha, breakpoints } from \"../css\"\r\nimport { lightThemeOptions } from \"./ThemeDefaultOptions\"\r\n\r\nexport const createTheme = (name: string, options: ThemeOptionInput): ThemeOptions => {\r\n if (ThemeFactory.has(name)) {\r\n console.error(`createTheme: The theme '${name}' is already defined. Please choose a different name for the theme.`)\r\n return ThemeFactory.get(name) as ThemeOptions\r\n }\r\n\r\n let theme: any = mergeObject(lightThemeOptions, {\r\n ...options,\r\n name,\r\n breakpoints: breakpoints\r\n })\r\n\r\n // add alpha colors\r\n for (let color in theme.colors) {\r\n const c = theme.colors[color] as ThemeOptionsColor\r\n const is_common = color === 'divider' || color === 'background' || color === 'text'\r\n c.soft = {\r\n primary: is_common ? alpha(c.primary, 0.60) : alpha(c.primary, 0.08),\r\n secondary: is_common ? alpha(c.primary, 0.90) : alpha(c.primary, 0.12)\r\n }\r\n }\r\n\r\n ThemeFactory.set(name, theme)\r\n\r\n return theme as ThemeOptions\r\n}\r\n"],"names":[],"mappings":";;;;MAKa,WAAW,GAAG,CAAC,IAAY,EAAE,OAAyB,KAAkB;AAClF,IAAA,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AACzB,QAAA,OAAO,CAAC,KAAK,CAAC,2BAA2B,IAAI,CAAA,mEAAA,CAAqE,CAAC;AACnH,QAAA,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,CAAiB;IAChD;AAEA,IAAA,IAAI,KAAK,GAAQ,WAAW,CAAC,iBAAiB,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACxC,OAAO,CAAA,EAAA,EACV,IAAI,EACJ,WAAW,EAAE,WAAW,IACzB;;AAGF,IAAA,KAAK,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE;QAC7B,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAsB;AAClD,QAAA,MAAM,SAAS,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,MAAM;QACnF,CAAC,CAAC,IAAI,GAAG;YACN,OAAO,EAAE,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC;YACpE,SAAS,EAAE,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI;SACvE;IACJ;AAEA,IAAA,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;AAE7B,IAAA,OAAO,KAAqB;AAC/B;;;;"}
@@ -1,9 +1,11 @@
1
1
  "use client";
2
- import { createBucket, xv } from 'react-state-bucket';
3
- import { getTheme } from './core.mjs';
2
+ 'use strict';
3
+
4
+ var reactStateBucket = require('react-state-bucket');
5
+ var core = require('./core.cjs');
4
6
 
5
7
  const createThemeSwitcher = (defaultTheme, option) => {
6
- const useThemeBucket = createBucket({ name: xv.string().default(defaultTheme) }, {
8
+ const useThemeBucket = reactStateBucket.createBucket({ name: reactStateBucket.xv.string().default(defaultTheme) }, {
7
9
  store: (option === null || option === void 0 ? void 0 : option.store) || "memory",
8
10
  onChange: (_key, value) => {
9
11
  (option === null || option === void 0 ? void 0 : option.onChange) && (option === null || option === void 0 ? void 0 : option.onChange(value));
@@ -13,12 +15,12 @@ const createThemeSwitcher = (defaultTheme, option) => {
13
15
  const bucket = useThemeBucket();
14
16
  return {
15
17
  name: bucket.state.name,
16
- theme: getTheme(bucket.state.name),
18
+ theme: core.getTheme(bucket.state.name),
17
19
  change: (theme) => bucket.set('name', theme)
18
20
  };
19
21
  };
20
22
  return useThemeSwitcher;
21
23
  };
22
24
 
23
- export { createThemeSwitcher as default };
24
- //# sourceMappingURL=createThemeSwitcher.mjs.map
25
+ module.exports = createThemeSwitcher;
26
+ //# sourceMappingURL=createThemeSwitcher.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"createThemeSwitcher.mjs","sources":["../../src/theme/createThemeSwitcher.ts"],"sourcesContent":["\"use client\";\r\nimport { createBucket, xv } from \"react-state-bucket\"\r\nimport { getTheme } from \"./core\"\r\nimport { BucketOptions } from \"react-state-bucket\"\r\n\r\nexport type ThemeSwitcherOption = {\r\n store?: BucketOptions['store'],\r\n onChange?: (theme: string) => void\r\n}\r\n\r\nconst createThemeSwitcher = (defaultTheme: string, option?: ThemeSwitcherOption) => {\r\n\r\n const useThemeBucket = createBucket({ name: xv.string().default(defaultTheme) }, {\r\n store: option?.store || \"memory\",\r\n onChange: (_key, value) => {\r\n option?.onChange && option?.onChange(value)\r\n }\r\n })\r\n\r\n const useThemeSwitcher = () => {\r\n const bucket = useThemeBucket()\r\n return {\r\n name: bucket.state.name,\r\n theme: getTheme(bucket.state.name),\r\n change: (theme: string) => bucket.set('name', theme)\r\n }\r\n }\r\n return useThemeSwitcher\r\n}\r\n\r\nexport default createThemeSwitcher"],"names":[],"mappings":";;;;AAUA;AAEG;;AAEG;AACG;;AAEL;;AAGE;;AAEG;;AAEA;;AAEN;AACA;AACH;;"}
1
+ {"version":3,"file":"createThemeSwitcher.cjs","sources":["../../src/theme/createThemeSwitcher.ts"],"sourcesContent":["\"use client\";\r\nimport { createBucket, xv } from \"react-state-bucket\"\r\nimport { getTheme } from \"./core\"\r\nimport { BucketOptions } from \"react-state-bucket\"\r\n\r\nexport type ThemeSwitcherOption = {\r\n store?: BucketOptions['store'],\r\n onChange?: (theme: string) => void\r\n}\r\n\r\nconst createThemeSwitcher = (defaultTheme: string, option?: ThemeSwitcherOption) => {\r\n\r\n const useThemeBucket = createBucket({ name: xv.string().default(defaultTheme) }, {\r\n store: option?.store || \"memory\",\r\n onChange: (_key, value) => {\r\n option?.onChange && option?.onChange(value)\r\n }\r\n })\r\n\r\n const useThemeSwitcher = () => {\r\n const bucket = useThemeBucket()\r\n return {\r\n name: bucket.state.name,\r\n theme: getTheme(bucket.state.name),\r\n change: (theme: string) => bucket.set('name', theme)\r\n }\r\n }\r\n return useThemeSwitcher\r\n}\r\n\r\nexport default createThemeSwitcher"],"names":[],"mappings":";;;;;;AAUA;AAEG;;AAEG;AACG;;AAEL;;AAGE;;AAEG;;AAEA;;AAEN;AACA;AACH;;"}
@@ -1,11 +1,9 @@
1
1
  "use client";
2
- 'use strict';
3
-
4
- var reactStateBucket = require('react-state-bucket');
5
- var core = require('./core.js');
2
+ import { createBucket, xv } from 'react-state-bucket';
3
+ import { getTheme } from './core.js';
6
4
 
7
5
  const createThemeSwitcher = (defaultTheme, option) => {
8
- const useThemeBucket = reactStateBucket.createBucket({ name: reactStateBucket.xv.string().default(defaultTheme) }, {
6
+ const useThemeBucket = createBucket({ name: xv.string().default(defaultTheme) }, {
9
7
  store: (option === null || option === void 0 ? void 0 : option.store) || "memory",
10
8
  onChange: (_key, value) => {
11
9
  (option === null || option === void 0 ? void 0 : option.onChange) && (option === null || option === void 0 ? void 0 : option.onChange(value));
@@ -15,12 +13,12 @@ const createThemeSwitcher = (defaultTheme, option) => {
15
13
  const bucket = useThemeBucket();
16
14
  return {
17
15
  name: bucket.state.name,
18
- theme: core.getTheme(bucket.state.name),
16
+ theme: getTheme(bucket.state.name),
19
17
  change: (theme) => bucket.set('name', theme)
20
18
  };
21
19
  };
22
20
  return useThemeSwitcher;
23
21
  };
24
22
 
25
- module.exports = createThemeSwitcher;
23
+ export { createThemeSwitcher as default };
26
24
  //# sourceMappingURL=createThemeSwitcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createThemeSwitcher.js","sources":["../../src/theme/createThemeSwitcher.ts"],"sourcesContent":["\"use client\";\r\nimport { createBucket, xv } from \"react-state-bucket\"\r\nimport { getTheme } from \"./core\"\r\nimport { BucketOptions } from \"react-state-bucket\"\r\n\r\nexport type ThemeSwitcherOption = {\r\n store?: BucketOptions['store'],\r\n onChange?: (theme: string) => void\r\n}\r\n\r\nconst createThemeSwitcher = (defaultTheme: string, option?: ThemeSwitcherOption) => {\r\n\r\n const useThemeBucket = createBucket({ name: xv.string().default(defaultTheme) }, {\r\n store: option?.store || \"memory\",\r\n onChange: (_key, value) => {\r\n option?.onChange && option?.onChange(value)\r\n }\r\n })\r\n\r\n const useThemeSwitcher = () => {\r\n const bucket = useThemeBucket()\r\n return {\r\n name: bucket.state.name,\r\n theme: getTheme(bucket.state.name),\r\n change: (theme: string) => bucket.set('name', theme)\r\n }\r\n }\r\n return useThemeSwitcher\r\n}\r\n\r\nexport default createThemeSwitcher"],"names":[],"mappings":";;;;;;AAUA;AAEG;;AAEG;AACG;;AAEL;;AAGE;;AAEG;;AAEA;;AAEN;AACA;AACH;;"}
1
+ {"version":3,"file":"createThemeSwitcher.js","sources":["../../src/theme/createThemeSwitcher.ts"],"sourcesContent":["\"use client\";\r\nimport { createBucket, xv } from \"react-state-bucket\"\r\nimport { getTheme } from \"./core\"\r\nimport { BucketOptions } from \"react-state-bucket\"\r\n\r\nexport type ThemeSwitcherOption = {\r\n store?: BucketOptions['store'],\r\n onChange?: (theme: string) => void\r\n}\r\n\r\nconst createThemeSwitcher = (defaultTheme: string, option?: ThemeSwitcherOption) => {\r\n\r\n const useThemeBucket = createBucket({ name: xv.string().default(defaultTheme) }, {\r\n store: option?.store || \"memory\",\r\n onChange: (_key, value) => {\r\n option?.onChange && option?.onChange(value)\r\n }\r\n })\r\n\r\n const useThemeSwitcher = () => {\r\n const bucket = useThemeBucket()\r\n return {\r\n name: bucket.state.name,\r\n theme: getTheme(bucket.state.name),\r\n change: (theme: string) => bucket.set('name', theme)\r\n }\r\n }\r\n return useThemeSwitcher\r\n}\r\n\r\nexport default createThemeSwitcher"],"names":[],"mappings":";;;;AAUA;AAEG;;AAEG;AACG;;AAEL;;AAGE;;AAEG;;AAEA;;AAEN;AACA;AACH;;"}
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var core = require('./core.cjs');
4
+ require('../css/getValue.cjs');
5
+ require('oncss');
6
+ var ThemeProvider = require('./ThemeProvider.cjs');
7
+ require('react-state-bucket');
8
+
9
+ const themeRootClass = (theme) => `.xui-${theme}-theme-root`;
10
+
11
+ exports.getTheme = core.getTheme;
12
+ exports.useTheme = core.useTheme;
13
+ exports.ThemeProvider = ThemeProvider;
14
+ exports.themeRootClass = themeRootClass;
15
+ //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/theme/index.tsx"],"sourcesContent":["import { createTheme } from \"./createTheme\"\r\nimport ThemeProvider from './ThemeProvider'\r\nimport createThemeSwitcher from './createThemeSwitcher'\r\nimport { getTheme, useTheme } from './core'\r\nexport type { ThemeProviderProps } from './ThemeProvider'\r\nexport type { ThemeSwitcherOption } from './createThemeSwitcher'\r\n\r\nexport const themeRootClass = (theme: string) => `.xui-${theme}-theme-root`\r\n\r\nexport {\r\n ThemeProvider,\r\n createThemeSwitcher,\r\n createTheme,\r\n getTheme,\r\n useTheme\r\n}\r\n\r\n"],"names":[],"mappings":";;;;;;AAOO,MAAM,cAAc,GAAG,CAAC,KAAa,KAAK,CAAA,KAAA,EAAQ,KAAK,CAAA,WAAA;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/theme/index.tsx"],"sourcesContent":["import { createTheme } from \"./createTheme\"\r\nimport ThemeProvider from './ThemeProvider'\r\nimport createThemeSwitcher from './createThemeSwitcher'\r\nimport { getTheme, useTheme } from './core'\r\nexport type { ThemeProviderProps } from './ThemeProvider'\r\nexport type { ThemeSwitcherOption } from './createThemeSwitcher'\r\n\r\nexport const themeRootClass = (theme: string) => `.xui-${theme}-theme-root`\r\n\r\nexport {\r\n ThemeProvider,\r\n createThemeSwitcher,\r\n createTheme,\r\n getTheme,\r\n useTheme\r\n}\r\n\r\n"],"names":[],"mappings":";;;;;;;;AAOO,MAAM,cAAc,GAAG,CAAC,KAAa,KAAK,CAAA,KAAA,EAAQ,KAAK,CAAA,WAAA;;;;;;;"}
package/theme/index.js CHANGED
@@ -1,15 +1,10 @@
1
- 'use strict';
2
-
3
- var core = require('./core.js');
4
- require('../css/getValue.js');
5
- require('oncss');
6
- var ThemeProvider = require('./ThemeProvider.js');
7
- require('react-state-bucket');
1
+ export { getTheme, useTheme } from './core.js';
2
+ import '../css/getValue.js';
3
+ import 'oncss';
4
+ export { default as ThemeProvider } from './ThemeProvider.js';
5
+ import 'react-state-bucket';
8
6
 
9
7
  const themeRootClass = (theme) => `.xui-${theme}-theme-root`;
10
8
 
11
- exports.getTheme = core.getTheme;
12
- exports.useTheme = core.useTheme;
13
- exports.ThemeProvider = ThemeProvider;
14
- exports.themeRootClass = themeRootClass;
9
+ export { themeRootClass };
15
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/theme/index.tsx"],"sourcesContent":["import { createTheme } from \"./createTheme\"\r\nimport ThemeProvider from './ThemeProvider'\r\nimport createThemeSwitcher from './createThemeSwitcher'\r\nimport { getTheme, useTheme } from './core'\r\nexport type { ThemeProviderProps } from './ThemeProvider'\r\nexport type { ThemeSwitcherOption } from './createThemeSwitcher'\r\n\r\nexport const themeRootClass = (theme: string) => `.xui-${theme}-theme-root`\r\n\r\nexport {\r\n ThemeProvider,\r\n createThemeSwitcher,\r\n createTheme,\r\n getTheme,\r\n useTheme\r\n}\r\n\r\n"],"names":[],"mappings":";;;;;;;;AAOO,MAAM,cAAc,GAAG,CAAC,KAAa,KAAK,CAAA,KAAA,EAAQ,KAAK,CAAA,WAAA;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/theme/index.tsx"],"sourcesContent":["import { createTheme } from \"./createTheme\"\r\nimport ThemeProvider from './ThemeProvider'\r\nimport createThemeSwitcher from './createThemeSwitcher'\r\nimport { getTheme, useTheme } from './core'\r\nexport type { ThemeProviderProps } from './ThemeProvider'\r\nexport type { ThemeSwitcherOption } from './createThemeSwitcher'\r\n\r\nexport const themeRootClass = (theme: string) => `.xui-${theme}-theme-root`\r\n\r\nexport {\r\n ThemeProvider,\r\n createThemeSwitcher,\r\n createTheme,\r\n getTheme,\r\n useTheme\r\n}\r\n\r\n"],"names":[],"mappings":";;;;;;AAOO,MAAM,cAAc,GAAG,CAAC,KAAa,KAAK,CAAA,KAAA,EAAQ,KAAK,CAAA,WAAA;;;;"}
@@ -1,51 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import React__default from 'react';
3
-
4
- const Components = [];
5
- let dispatch = null;
6
- class Renderar {
7
- static render(component, props) {
8
- Components.push({ component, props });
9
- if (dispatch) {
10
- dispatch();
11
- }
12
- return {
13
- unrender: () => {
14
- this.unrender(component);
15
- },
16
- updateProps: (newProps) => {
17
- this.updateProps(component, newProps);
18
- }
19
- };
20
- }
21
- static unrender(component) {
22
- const index = Components.findIndex((c) => c.component === component);
23
- if (index > -1) {
24
- Components.splice(index, 1);
25
- if (dispatch)
26
- dispatch();
27
- }
28
- }
29
- static updateProps(component, props) {
30
- const storedComponent = Components.find((c) => c.component === component);
31
- if (storedComponent) {
32
- storedComponent.props = Object.assign(Object.assign({}, storedComponent.props), props);
33
- }
34
- if (dispatch)
35
- dispatch();
36
- }
37
- }
38
- const RenderRenderar = () => {
39
- const [, setState] = React__default.useState(0);
40
- if (!dispatch) {
41
- dispatch = () => {
42
- setState((prev) => prev + 1);
43
- };
44
- }
45
- return Components.map(({ component: Component, props }, index) => {
46
- return jsx(Component, Object.assign({}, props), index);
47
- });
48
- };
49
-
50
- export { RenderRenderar, Renderar };
51
- //# sourceMappingURL=Renderar.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Renderar.mjs","sources":["../../src/AppRoot/Renderar.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\r\n\r\ntype StoredComponent = {\r\n component: React.FunctionComponent<any>;\r\n props: any;\r\n};\r\n\r\nconst Components: StoredComponent[] = [];\r\nlet dispatch: (() => void) | null = null;\r\n\r\nexport class Renderar {\r\n static render(component: React.FunctionComponent, props?: any) {\r\n Components.push({ component, props });\r\n\r\n if (dispatch) {\r\n dispatch();\r\n }\r\n\r\n return {\r\n unrender: () => {\r\n this.unrender(component);\r\n },\r\n updateProps: (newProps: any) => {\r\n this.updateProps(component, newProps);\r\n }\r\n };\r\n }\r\n\r\n static unrender(component: React.FunctionComponent) {\r\n const index = Components.findIndex((c) => c.component === component);\r\n if (index > -1) {\r\n Components.splice(index, 1);\r\n if (dispatch) dispatch();\r\n }\r\n }\r\n\r\n static updateProps(component: React.FunctionComponent, props: any) {\r\n const storedComponent = Components.find((c) => c.component === component);\r\n if (storedComponent) {\r\n storedComponent.props = { ...storedComponent.props, ...props };\r\n }\r\n if (dispatch) dispatch();\r\n }\r\n}\r\n\r\nexport const RenderRenderar = () => {\r\n const [, setState] = React.useState(0);\r\n\r\n if (!dispatch) {\r\n dispatch = () => {\r\n setState((prev) => prev + 1);\r\n };\r\n }\r\n\r\n return Components.map(({ component: Component, props }, index): ReactElement => {\r\n return <Component key={index} {...props} />;\r\n });\r\n};\r\n"],"names":["React","_jsx"],"mappings":";;;AAOA,MAAM,UAAU,GAAsB,EAAE;AACxC,IAAI,QAAQ,GAAwB,IAAI;MAE3B,QAAQ,CAAA;AAClB,IAAA,OAAO,MAAM,CAAC,SAAkC,EAAE,KAAW,EAAA;QAC1D,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QAErC,IAAI,QAAQ,EAAE;AACX,YAAA,QAAQ,EAAE;QACb;QAEA,OAAO;YACJ,QAAQ,EAAE,MAAK;AACZ,gBAAA,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;YAC3B,CAAC;AACD,YAAA,WAAW,EAAE,CAAC,QAAa,KAAI;AAC5B,gBAAA,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC;YACxC;SACF;IACJ;IAEA,OAAO,QAAQ,CAAC,SAAkC,EAAA;AAC/C,QAAA,MAAM,KAAK,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC;AACpE,QAAA,IAAI,KAAK,GAAG,EAAE,EAAE;AACb,YAAA,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;AAC3B,YAAA,IAAI,QAAQ;AAAE,gBAAA,QAAQ,EAAE;QAC3B;IACH;AAEA,IAAA,OAAO,WAAW,CAAC,SAAkC,EAAE,KAAU,EAAA;AAC9D,QAAA,MAAM,eAAe,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC;QACzE,IAAI,eAAe,EAAE;YAClB,eAAe,CAAC,KAAK,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAQ,eAAe,CAAC,KAAK,CAAA,EAAK,KAAK,CAAE;QACjE;AACA,QAAA,IAAI,QAAQ;AAAE,YAAA,QAAQ,EAAE;IAC3B;AACF;AAEM,MAAM,cAAc,GAAG,MAAK;IAChC,MAAM,GAAG,QAAQ,CAAC,GAAGA,cAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEtC,IAAI,CAAC,QAAQ,EAAE;QACZ,QAAQ,GAAG,MAAK;YACb,QAAQ,CAAC,CAAC,IAAI,KAAK,IAAI,GAAG,CAAC,CAAC;AAC/B,QAAA,CAAC;IACJ;AAEA,IAAA,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,KAAkB;AAC5E,QAAA,OAAOC,IAAC,SAAS,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAiB,KAAK,CAAA,EAAhB,KAAK,CAAe;AAC9C,IAAA,CAAC,CAAC;AACL;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.js","sources":["../../src/AppRoot/context.tsx"],"sourcesContent":["import React from \"react\";\r\n\r\nconst AppRootContext = React.createContext<HTMLElement | null>(null);\r\n\r\nexport const AppRootProvider: React.FC<{ element: HTMLElement | null; children: React.ReactNode }> = ({ element, children }) => {\r\n return (\r\n <AppRootContext.Provider value={element}>\r\n {children}\r\n </AppRootContext.Provider>\r\n );\r\n}\r\n\r\nexport const useAppRootElement = (): HTMLElement => {\r\n const context = React.useContext(AppRootContext);\r\n if (typeof window === 'undefined') {\r\n return null as any;\r\n }\r\n return context as HTMLElement\r\n}\r\n"],"names":["_jsx"],"mappings":";;;;;AAEA,MAAM,cAAc,GAAG,KAAK,CAAC,aAAa,CAAqB,IAAI,CAAC;AAE7D,MAAM,eAAe,GAAyE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAI;AAC5H,IAAA,QACGA,cAAA,CAAC,cAAc,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EACnC,QAAQ,EAAA,CACc;AAEhC;AAEO,MAAM,iBAAiB,GAAG,MAAkB;IAChD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC;AAChD,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAChC,QAAA,OAAO,IAAW;IACrB;AACA,IAAA,OAAO,OAAsB;AAChC;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.mjs","sources":["../../src/AppRoot/context.tsx"],"sourcesContent":["import React from \"react\";\r\n\r\nconst AppRootContext = React.createContext<HTMLElement | null>(null);\r\n\r\nexport const AppRootProvider: React.FC<{ element: HTMLElement | null; children: React.ReactNode }> = ({ element, children }) => {\r\n return (\r\n <AppRootContext.Provider value={element}>\r\n {children}\r\n </AppRootContext.Provider>\r\n );\r\n}\r\n\r\nexport const useAppRootElement = (): HTMLElement => {\r\n const context = React.useContext(AppRootContext);\r\n if (typeof window === 'undefined') {\r\n return null as any;\r\n }\r\n return context as HTMLElement\r\n}\r\n"],"names":["React","_jsx"],"mappings":";;;AAEA,MAAM,cAAc,GAAGA,cAAK,CAAC,aAAa,CAAqB,IAAI,CAAC;AAE7D,MAAM,eAAe,GAAyE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAI;AAC5H,IAAA,QACGC,GAAA,CAAC,cAAc,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EACnC,QAAQ,EAAA,CACc;AAEhC;AAEO,MAAM,iBAAiB,GAAG,MAAkB;IAChD,MAAM,OAAO,GAAGD,cAAK,CAAC,UAAU,CAAC,cAAc,CAAC;AAChD,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAChC,QAAA,OAAO,IAAW;IACrB;AACA,IAAA,OAAO,OAAsB;AAChC;;;;"}