@xanui/core 1.2.43 → 1.2.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AppRoot/AppRootProvider.cjs +20 -0
- package/AppRoot/AppRootProvider.cjs.map +1 -0
- package/AppRoot/AppRootProvider.js +7 -10
- package/AppRoot/AppRootProvider.js.map +1 -1
- package/AppRoot/Renderar.cjs +89 -0
- package/AppRoot/Renderar.cjs.map +1 -0
- package/AppRoot/Renderar.d.ts +1 -0
- package/AppRoot/Renderar.js +52 -20
- package/AppRoot/Renderar.js.map +1 -1
- package/AppRoot/index.cjs +45 -0
- package/AppRoot/index.cjs.map +1 -0
- package/AppRoot/index.js +25 -24
- package/AppRoot/index.js.map +1 -1
- package/Document/index.cjs +21 -0
- package/Document/index.cjs.map +1 -0
- package/Document/index.d.ts +7 -1
- package/Document/index.js +8 -11
- package/Document/index.js.map +1 -1
- package/Iframe/index.cjs +45 -0
- package/Iframe/{index.mjs.map → index.cjs.map} +1 -1
- package/Iframe/index.js +23 -25
- package/Iframe/index.js.map +1 -1
- package/Tag/ServerStyleTag.cjs +13 -0
- package/Tag/{ServerStyleTag.mjs.map → ServerStyleTag.cjs.map} +1 -1
- package/Tag/ServerStyleTag.js +3 -5
- package/Tag/ServerStyleTag.js.map +1 -1
- package/Tag/{cssPropList.mjs → cssPropList.cjs} +4 -2
- package/Tag/cssPropList.cjs.map +1 -0
- package/Tag/cssPropList.js +1 -3
- package/Tag/cssPropList.js.map +1 -1
- package/Tag/index.cjs +40 -0
- package/Tag/{index.mjs.map → index.cjs.map} +1 -1
- package/Tag/index.js +10 -31
- package/Tag/index.js.map +1 -1
- package/Tag/{useTagProps.mjs → useTagProps.cjs} +18 -16
- package/Tag/useTagProps.cjs.map +1 -0
- package/Tag/useTagProps.js +15 -17
- package/Tag/useTagProps.js.map +1 -1
- package/Transition/index.cjs +29 -0
- package/Transition/{index.mjs.map → index.cjs.map} +1 -1
- package/Transition/index.js +13 -15
- package/Transition/index.js.map +1 -1
- package/breakpoint/BreakpointProvider.cjs +49 -0
- package/breakpoint/BreakpointProvider.cjs.map +1 -0
- package/breakpoint/BreakpointProvider.js +27 -24
- package/breakpoint/BreakpointProvider.js.map +1 -1
- package/breakpoint/useBreakpoint.cjs +24 -0
- package/breakpoint/{useBreakpoint.mjs.map → useBreakpoint.cjs.map} +1 -1
- package/breakpoint/useBreakpoint.js +7 -9
- package/breakpoint/useBreakpoint.js.map +1 -1
- package/breakpoint/{useBreakpointProps.mjs → useBreakpointProps.cjs} +8 -6
- package/breakpoint/useBreakpointProps.cjs.map +1 -0
- package/breakpoint/useBreakpointProps.js +5 -7
- package/breakpoint/useBreakpointProps.js.map +1 -1
- package/css/CSSCacheProvider.cjs +34 -0
- package/css/{CSSCacheProvider.mjs.map → CSSCacheProvider.cjs.map} +1 -1
- package/css/CSSCacheProvider.js +10 -15
- package/css/CSSCacheProvider.js.map +1 -1
- package/css/{aliases.mjs → aliases.cjs} +4 -2
- package/css/aliases.cjs.map +1 -0
- package/css/aliases.js +1 -3
- package/css/aliases.js.map +1 -1
- package/css/{getProps.mjs → getProps.cjs} +4 -2
- package/css/{getProps.mjs.map → getProps.cjs.map} +1 -1
- package/css/getProps.js +1 -3
- package/css/getProps.js.map +1 -1
- package/css/{getValue.mjs → getValue.cjs} +4 -2
- package/css/{getValue.mjs.map → getValue.cjs.map} +1 -1
- package/css/getValue.js +1 -3
- package/css/getValue.js.map +1 -1
- package/css/{index.mjs → index.cjs} +15 -7
- package/css/index.cjs.map +1 -0
- package/css/index.js +6 -14
- package/css/index.js.map +1 -1
- package/hooks/{useAnimation.mjs → useAnimation.cjs} +16 -11
- package/hooks/{useAnimation.mjs.map → useAnimation.cjs.map} +1 -1
- package/hooks/useAnimation.js +10 -15
- package/hooks/useAnimation.js.map +1 -1
- package/hooks/{useColorTemplate.mjs → useColorTemplate.cjs} +4 -2
- package/hooks/{useColorTemplate.mjs.map → useColorTemplate.cjs.map} +1 -1
- package/hooks/useColorTemplate.js +1 -3
- package/hooks/useColorTemplate.js.map +1 -1
- package/hooks/useInterface.cjs +19 -0
- package/hooks/useInterface.cjs.map +1 -0
- package/hooks/useInterface.js +7 -9
- package/hooks/useInterface.js.map +1 -1
- package/hooks/{useMergeRefs.mjs → useMergeRefs.cjs} +6 -4
- package/hooks/{useMergeRefs.mjs.map → useMergeRefs.cjs.map} +1 -1
- package/hooks/useMergeRefs.js +3 -5
- package/hooks/useMergeRefs.js.map +1 -1
- package/hooks/usePortal.cjs +69 -0
- package/hooks/usePortal.cjs.map +1 -0
- package/hooks/usePortal.js +29 -32
- package/hooks/usePortal.js.map +1 -1
- package/hooks/useTransition/{index.mjs → index.cjs} +29 -27
- package/hooks/useTransition/index.cjs.map +1 -0
- package/hooks/useTransition/index.js +26 -28
- package/hooks/useTransition/index.js.map +1 -1
- package/hooks/useTransition/{variants.mjs → variants.cjs} +17 -2
- package/hooks/useTransition/{variants.mjs.map → variants.cjs.map} +1 -1
- package/hooks/useTransition/variants.js +1 -16
- package/hooks/useTransition/variants.js.map +1 -1
- package/index.cjs +64 -0
- package/index.cjs.map +1 -0
- package/index.js +25 -63
- package/index.js.map +1 -1
- package/package.json +4 -11
- package/theme/{ThemeCssVars.mjs → ThemeCssVars.cjs} +4 -2
- package/theme/{ThemeCssVars.mjs.map → ThemeCssVars.cjs.map} +1 -1
- package/theme/ThemeCssVars.js +1 -3
- package/theme/ThemeCssVars.js.map +1 -1
- package/theme/{ThemeDefaultOptions.mjs → ThemeDefaultOptions.cjs} +11 -5
- package/theme/{ThemeDefaultOptions.mjs.map → ThemeDefaultOptions.cjs.map} +1 -1
- package/theme/ThemeDefaultOptions.js +4 -10
- package/theme/ThemeDefaultOptions.js.map +1 -1
- package/theme/{ThemeProvider.mjs → ThemeProvider.cjs} +52 -31
- package/theme/ThemeProvider.cjs.map +1 -0
- package/theme/ThemeProvider.js +30 -51
- package/theme/ThemeProvider.js.map +1 -1
- package/theme/{core.mjs → core.cjs} +12 -6
- package/theme/core.cjs.map +1 -0
- package/theme/core.js +5 -11
- package/theme/core.js.map +1 -1
- package/theme/createTheme.cjs +27 -0
- package/theme/{createTheme.mjs.map → createTheme.cjs.map} +1 -1
- package/theme/createTheme.js +10 -12
- package/theme/createTheme.js.map +1 -1
- package/theme/{createThemeSwitcher.mjs → createThemeSwitcher.cjs} +8 -6
- package/theme/{createThemeSwitcher.mjs.map → createThemeSwitcher.cjs.map} +1 -1
- package/theme/createThemeSwitcher.js +5 -7
- package/theme/createThemeSwitcher.js.map +1 -1
- package/theme/index.cjs +15 -0
- package/theme/{index.mjs.map → index.cjs.map} +1 -1
- package/theme/index.js +6 -11
- package/theme/index.js.map +1 -1
- package/AppRoot/AppRootProvider.mjs +0 -17
- package/AppRoot/AppRootProvider.mjs.map +0 -1
- package/AppRoot/Renderar.mjs +0 -51
- package/AppRoot/Renderar.mjs.map +0 -1
- package/AppRoot/index.mjs +0 -40
- package/AppRoot/index.mjs.map +0 -1
- package/Document/index.mjs +0 -18
- package/Document/index.mjs.map +0 -1
- package/Iframe/index.mjs +0 -43
- package/Tag/ServerStyleTag.mjs +0 -11
- package/Tag/cssPropList.mjs.map +0 -1
- package/Tag/index.mjs +0 -19
- package/Tag/useTagProps.mjs.map +0 -1
- package/Transition/index.mjs +0 -27
- package/breakpoint/BreakpointProvider.mjs +0 -40
- package/breakpoint/BreakpointProvider.mjs.map +0 -1
- package/breakpoint/useBreakpoint.mjs +0 -22
- package/breakpoint/useBreakpointProps.mjs.map +0 -1
- package/css/CSSCacheProvider.mjs +0 -29
- package/css/aliases.mjs.map +0 -1
- package/css/index.mjs.map +0 -1
- package/hooks/useInterface.mjs +0 -17
- package/hooks/useInterface.mjs.map +0 -1
- package/hooks/usePortal.mjs +0 -68
- package/hooks/usePortal.mjs.map +0 -1
- package/hooks/useTransition/index.mjs.map +0 -1
- package/index.mjs +0 -26
- package/index.mjs.map +0 -1
- package/theme/ThemeProvider.mjs.map +0 -1
- package/theme/core.mjs.map +0 -1
- package/theme/createTheme.mjs +0 -25
- package/theme/index.mjs +0 -10
package/theme/index.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
12
|
-
exports.useTheme = core.useTheme;
|
|
13
|
-
exports.ThemeProvider = ThemeProvider;
|
|
14
|
-
exports.themeRootClass = themeRootClass;
|
|
9
|
+
export { themeRootClass };
|
|
15
10
|
//# sourceMappingURL=index.js.map
|
package/theme/index.js.map
CHANGED
|
@@ -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":"
|
|
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,17 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React__default from 'react';
|
|
3
|
-
|
|
4
|
-
const AppRootContext = React__default.createContext(null);
|
|
5
|
-
const AppRootProvider = ({ element, children }) => {
|
|
6
|
-
return (jsx(AppRootContext.Provider, { value: element, children: children }));
|
|
7
|
-
};
|
|
8
|
-
const useAppRootElement = () => {
|
|
9
|
-
const context = React__default.useContext(AppRootContext);
|
|
10
|
-
if (typeof window === 'undefined') {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
return context;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { AppRootProvider, useAppRootElement };
|
|
17
|
-
//# sourceMappingURL=AppRootProvider.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AppRootProvider.mjs","sources":["../../src/AppRoot/AppRootProvider.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;;;;"}
|
package/AppRoot/Renderar.mjs
DELETED
|
@@ -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
|
package/AppRoot/Renderar.mjs.map
DELETED
|
@@ -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;;;;"}
|
package/AppRoot/index.mjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __rest } from 'tslib';
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
import React__default, { useId, useRef, useEffect } from 'react';
|
|
5
|
-
import '../theme/core.mjs';
|
|
6
|
-
import '../css/getValue.mjs';
|
|
7
|
-
import 'oncss';
|
|
8
|
-
import ThemeProvider from '../theme/ThemeProvider.mjs';
|
|
9
|
-
import 'react-state-bucket';
|
|
10
|
-
import { BreakpointProvider } from '../breakpoint/BreakpointProvider.mjs';
|
|
11
|
-
import { RenderRenderar } from './Renderar.mjs';
|
|
12
|
-
import { DocumentProvider } from '../Document/index.mjs';
|
|
13
|
-
import { AppRootProvider } from './AppRootProvider.mjs';
|
|
14
|
-
import useMergeRefs from '../hooks/useMergeRefs.mjs';
|
|
15
|
-
import { CSSCacheProvider } from '../css/CSSCacheProvider.mjs';
|
|
16
|
-
|
|
17
|
-
const AppRoot = React__default.forwardRef((_a, ref) => {
|
|
18
|
-
var { children, noScrollbarCss, CSSCacheId, theme, document: _document } = _a, props = __rest(_a, ["children", "noScrollbarCss", "CSSCacheId", "theme", "document"]);
|
|
19
|
-
noScrollbarCss !== null && noScrollbarCss !== void 0 ? noScrollbarCss : (noScrollbarCss = false);
|
|
20
|
-
_document !== null && _document !== void 0 ? _document : (_document = document);
|
|
21
|
-
const csscacheId = useId();
|
|
22
|
-
CSSCacheId !== null && CSSCacheId !== void 0 ? CSSCacheId : (CSSCacheId = csscacheId);
|
|
23
|
-
const [visibility, setVisibility] = React__default.useState("hidden");
|
|
24
|
-
const rootRef = useRef(null);
|
|
25
|
-
const mergeRef = useMergeRefs(rootRef, ref);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
setVisibility("visible");
|
|
28
|
-
// move oncss style tags to head
|
|
29
|
-
if (typeof _document === 'undefined')
|
|
30
|
-
return;
|
|
31
|
-
const styles = Array.from(_document.querySelectorAll('body style[data-oncss]'));
|
|
32
|
-
styles.forEach((style) => {
|
|
33
|
-
_document.head.appendChild(style);
|
|
34
|
-
});
|
|
35
|
-
}, []);
|
|
36
|
-
return (jsx(DocumentProvider, { document: _document, children: jsx(CSSCacheProvider, { cacheId: CSSCacheId, children: jsx(AppRootProvider, { element: rootRef.current, children: jsx(ThemeProvider, Object.assign({ ref: mergeRef, theme: theme }, props, { isRoot: true, sx: Object.assign(Object.assign({}, props.sx), (visibility === "hidden" ? { visibility: "hidden" } : {})), children: jsxs(BreakpointProvider, { children: [children, jsx(RenderRenderar, {})] }) })) }) }) }));
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export { AppRoot as default };
|
|
40
|
-
//# sourceMappingURL=index.mjs.map
|
package/AppRoot/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\"use client\";\r\nimport React, { useEffect, useId, useRef } from 'react';\r\nimport { TagComponentType } from '../Tag/types';\r\nimport { ThemeProvider, ThemeProviderProps } from '../theme';\r\nimport { BreakpointProvider } from '../breakpoint';\r\nimport { RenderRenderar } from './Renderar';\r\nimport { DocumentProvider } from '../Document';\r\nimport { AppRootProvider } from './AppRootProvider';\r\nimport useMergeRefs from '../hooks/useMergeRefs';\r\nimport { CSSCacheProvider } from '../css/CSSCacheProvider';\r\n\r\nexport type AppRootProps<T extends TagComponentType = \"div\"> = ThemeProviderProps<T> & {\r\n noScrollbarCss?: boolean;\r\n document?: Document;\r\n CSSCacheId?: string;\r\n}\r\n\r\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, noScrollbarCss, CSSCacheId, theme, document: _document, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\r\n noScrollbarCss ??= false\r\n _document ??= document\r\n const csscacheId = useId()\r\n CSSCacheId ??= csscacheId\r\n\r\n const [visibility, setVisibility] = React.useState<string>(\"hidden\");\r\n const rootRef = useRef(null)\r\n const mergeRef = useMergeRefs(rootRef, ref)\r\n\r\n useEffect(() => {\r\n setVisibility(\"visible\");\r\n\r\n // move oncss style tags to head\r\n if (typeof _document === 'undefined') return;\r\n const styles = Array.from(_document.querySelectorAll('body style[data-oncss]'));\r\n styles.forEach((style) => {\r\n _document.head.appendChild(style);\r\n });\r\n }, [])\r\n\r\n return (\r\n <DocumentProvider document={_document}>\r\n <CSSCacheProvider cacheId={CSSCacheId}>\r\n <AppRootProvider element={rootRef.current}>\r\n <ThemeProvider\r\n ref={mergeRef}\r\n theme={theme}\r\n {...props}\r\n isRoot\r\n sx={{\r\n ...props.sx,\r\n ...(visibility === \"hidden\" ? { visibility: \"hidden\" } : {})\r\n }}\r\n >\r\n <BreakpointProvider>\r\n {children}\r\n <RenderRenderar />\r\n </BreakpointProvider>\r\n </ThemeProvider>\r\n </AppRootProvider>\r\n </CSSCacheProvider>\r\n </DocumentProvider>\r\n )\r\n})\r\n\r\nexport default AppRoot\r\n\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAiBA;AAAsE;;;AAGnE;;AAGA;AACA;;;;;;;AAQG;AACA;AACG;AACH;;AAGH;AAuBH;;"}
|
package/Document/index.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import React__default from 'react';
|
|
4
|
-
|
|
5
|
-
const DocumentContext = React__default.createContext(null);
|
|
6
|
-
const DocumentProvider = ({ document, children }) => {
|
|
7
|
-
return (jsx(DocumentContext.Provider, { value: document, children: children }));
|
|
8
|
-
};
|
|
9
|
-
const useDocument = () => {
|
|
10
|
-
const context = React__default.useContext(DocumentContext);
|
|
11
|
-
if (typeof window === 'undefined') {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
return context || document;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { DocumentProvider, useDocument };
|
|
18
|
-
//# sourceMappingURL=index.mjs.map
|
package/Document/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/Document/index.tsx"],"sourcesContent":["'use client'\r\nimport React from \"react\";\r\n\r\nconst DocumentContext = React.createContext<Document | null>(null);\r\n\r\nexport const DocumentProvider: React.FC<{ document: Document; children: React.ReactNode }> = ({ document, children }) => {\r\n return (\r\n <DocumentContext.Provider value={document}>\r\n {children}\r\n </DocumentContext.Provider>\r\n );\r\n}\r\n\r\nexport const useDocument = (): Document => {\r\n const context = React.useContext(DocumentContext);\r\n if (typeof window === 'undefined') {\r\n return null as any;\r\n }\r\n return context || document;\r\n}"],"names":[],"mappings":";;;;AAGA;AAEO;AACJ;AAKH;AAEO;;AAEJ;AACG;;;AAGN;;"}
|
package/Iframe/index.mjs
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __rest } from 'tslib';
|
|
3
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
4
|
-
import React__default, { createContext, useState, useRef, useEffect } from 'react';
|
|
5
|
-
import { useTheme } from '../theme/core.mjs';
|
|
6
|
-
import '../css/getValue.mjs';
|
|
7
|
-
import 'oncss';
|
|
8
|
-
import '../theme/ThemeProvider.mjs';
|
|
9
|
-
import 'react-state-bucket';
|
|
10
|
-
import Tag from '../Tag/index.mjs';
|
|
11
|
-
import { createPortal } from 'react-dom';
|
|
12
|
-
import AppRoot from '../AppRoot/index.mjs';
|
|
13
|
-
import useMergeRefs from '../hooks/useMergeRefs.mjs';
|
|
14
|
-
|
|
15
|
-
const IframeContext = createContext({
|
|
16
|
-
document: null,
|
|
17
|
-
window: null,
|
|
18
|
-
});
|
|
19
|
-
const Iframe = (_a, ref) => {
|
|
20
|
-
var { children, sxr, theme, CSSCacheId } = _a, props = __rest(_a, ["children", "sxr", "theme", "CSSCacheId"]);
|
|
21
|
-
const [doc, setDoc] = useState(null);
|
|
22
|
-
const iframeRef = useRef(null);
|
|
23
|
-
const _ref = useMergeRefs(iframeRef, ref);
|
|
24
|
-
const parentTheme = useTheme();
|
|
25
|
-
theme !== null && theme !== void 0 ? theme : (theme = parentTheme.name);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (!iframeRef.current)
|
|
28
|
-
return;
|
|
29
|
-
const iframe = iframeRef.current;
|
|
30
|
-
const onLoad = () => setDoc(iframe.contentDocument);
|
|
31
|
-
iframe.addEventListener("load", onLoad);
|
|
32
|
-
return () => iframe.removeEventListener("load", onLoad);
|
|
33
|
-
}, []);
|
|
34
|
-
return (jsxs(Fragment, { children: [jsx(Tag, Object.assign({}, props, { component: "iframe", sxr: Object.assign({ border: 'none', width: "100%", height: "100%", p: 0, m: 0 }, sxr), ref: _ref, srcDoc: "<!DOCTYPE html><html><head></head><body></body></html>" })), doc &&
|
|
35
|
-
createPortal(jsx(IframeContext.Provider, { value: {
|
|
36
|
-
document: doc,
|
|
37
|
-
window: doc.defaultView,
|
|
38
|
-
}, children: jsx(AppRoot, { theme: theme, document: doc, CSSCacheId: CSSCacheId, children: children }) }), doc.body)] }));
|
|
39
|
-
};
|
|
40
|
-
var index = React__default.forwardRef(Iframe);
|
|
41
|
-
|
|
42
|
-
export { index as default };
|
|
43
|
-
//# sourceMappingURL=index.mjs.map
|
package/Tag/ServerStyleTag.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
const ServerStyleTag = ({ factory }) => {
|
|
4
|
-
if (typeof window === 'undefined') {
|
|
5
|
-
return jsx("style", { dangerouslySetInnerHTML: { __html: factory.css }, precedence: factory.classname, href: factory.classname });
|
|
6
|
-
}
|
|
7
|
-
return null;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { ServerStyleTag as default };
|
|
11
|
-
//# sourceMappingURL=ServerStyleTag.mjs.map
|
package/Tag/cssPropList.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cssPropList.mjs","sources":["../../src/Tag/cssPropList.ts"],"sourcesContent":["\r\nconst CSS_PROP_LIST: any = {\r\n typography: 1,\r\n bgcolor: 1,\r\n bgimage: 1,\r\n bg: 1,\r\n p: 1,\r\n pt: 1,\r\n pr: 1,\r\n pb: 1,\r\n pl: 1,\r\n px: 1,\r\n py: 1,\r\n m: 1,\r\n mt: 1,\r\n mr: 1,\r\n mb: 1,\r\n ml: 1,\r\n mx: 1,\r\n my: 1,\r\n radius: 1,\r\n shadow: 1,\r\n flexBox: 1,\r\n flexRow: 1,\r\n flexColumn: 1,\r\n flexWraped: 1,\r\n disabled: 1,\r\n spacing: 1,\r\n\r\n gradient: 1,\r\n\r\n // CSS Props\r\n alignContent: 1,\r\n alignItems: 1,\r\n alignSelf: 1,\r\n animation: 1,\r\n animationComposition: 1,\r\n animationDelay: 1,\r\n animationDirection: 1,\r\n animationDuration: 1,\r\n animationFillMode: 1,\r\n animationIterationCount: 1,\r\n animationName: 1,\r\n animationTimingFunction: 1,\r\n backdropFilter: 1,\r\n background: 1,\r\n backgroundAttachment: 1,\r\n backgroundColor: 1,\r\n backgroundImage: 1,\r\n backgroundOrigin: 1,\r\n backgroundPosition: 1,\r\n backgroundRepeat: 1,\r\n backgroundSize: 1,\r\n border: 1,\r\n borderBottom: 1,\r\n borderBottomColor: 1,\r\n borderBottomStyle: 1,\r\n borderBottomWidth: 1,\r\n borderColor: 1,\r\n borderImage: 1,\r\n borderLeft: 1,\r\n borderLeftColor: 1,\r\n borderLeftStyle: 1,\r\n borderLeftWidth: 1,\r\n borderRadius: 1,\r\n borderRight: 1,\r\n borderRightColor: 1,\r\n borderRightStyle: 1,\r\n borderRightWidth: 1,\r\n borderStyle: 1,\r\n borderTop: 1,\r\n borderTopColor: 1,\r\n borderTopLeftRadius: 1,\r\n borderTopRightRadius: 1,\r\n borderTopStyle: 1,\r\n borderTopWidth: 1,\r\n borderWidth: 1,\r\n bottom: 1,\r\n boxShadow: 1,\r\n boxSizing: 1,\r\n cursor: 1,\r\n color: 1,\r\n display: 1,\r\n direction: 1,\r\n filter: 1,\r\n flex: 1,\r\n flexBasis: 1,\r\n flexDirection: 1,\r\n flexFlow: 1,\r\n flexGrow: 1,\r\n flexShrink: 1,\r\n flexWrap: 1,\r\n float: 1,\r\n fontFamily: 1,\r\n fontSize: 1,\r\n fontStyle: 1,\r\n fontWeight: 1,\r\n font: 1,\r\n gap: 1,\r\n grid: 1,\r\n gridArea: 1,\r\n gridAutoColumns: 1,\r\n gridAutoFlow: 1,\r\n gridAutoRows: 1,\r\n gridColumn: 1,\r\n gridColumnEnd: 1,\r\n gridColumnGap: 1,\r\n gridColumnStart: 1,\r\n gridGap: 1,\r\n gridRow: 1,\r\n gridRowEnd: 1,\r\n gridRowGap: 1,\r\n gridRowStart: 1,\r\n gridTemplate: 1,\r\n gridTemplateAreas: 1,\r\n gridTemplateColumns: 1,\r\n gridTemplateRows: 1,\r\n height: 1,\r\n justifyContent: 1,\r\n justifyItems: 1,\r\n justifySelf: 1,\r\n left: 1,\r\n letterSpacing: 1,\r\n lineBreak: 1,\r\n lineHeight: 1,\r\n listStyle: 1,\r\n margin: 1,\r\n marginBlock: 1,\r\n marginBlockEnd: 1,\r\n marginBlockStart: 1,\r\n marginBottom: 1,\r\n marginInline: 1,\r\n marginInlineEnd: 1,\r\n marginInlineStart: 1,\r\n marginLeft: 1,\r\n marginRight: 1,\r\n marginTop: 1,\r\n maxHeight: 1,\r\n maxWidth: 1,\r\n minHeight: 1,\r\n minWidth: 1,\r\n objectFit: 1,\r\n objectPosition: 1,\r\n opacity: 1,\r\n order: 1,\r\n outline: 1,\r\n overflow: 1,\r\n overflowX: 1,\r\n overflowY: 1,\r\n padding: 1,\r\n paddingBlock: 1,\r\n paddingBlockEnd: 1,\r\n paddingBlockStart: 1,\r\n paddingBottom: 1,\r\n paddingInline: 1,\r\n paddingInlineEnd: 1,\r\n paddingInlineStart: 1,\r\n paddingLeft: 1,\r\n paddingRight: 1,\r\n paddingTop: 1,\r\n perspective: 1,\r\n perspectiveOrigin: 1,\r\n pointerEvents: 1,\r\n position: 1,\r\n resize: 1,\r\n right: 1,\r\n textAlign: 1,\r\n textDecoration: 1,\r\n textShadow: 1,\r\n textTransform: 1,\r\n top: 1,\r\n transform: 1,\r\n transformOrigin: 1,\r\n transformStyle: 1,\r\n transition: 1,\r\n transitionDelay: 1,\r\n transitionDuration: 1,\r\n transitionProperty: 1,\r\n transitionTimingFunction: 1,\r\n userSelect: 1,\r\n verticalAlign: 1,\r\n visibility: 1,\r\n whiteSpace: 1,\r\n width: 1,\r\n wordBreak: 1,\r\n wordSpacing: 1,\r\n wordWrap: 1,\r\n zIndex: 1,\r\n}\r\n\r\nexport default CSS_PROP_LIST"],"names":[],"mappings":"AACA,MAAM,aAAa,GAAQ;AACvB,IAAA,UAAU,EAAE,CAAC;AACb,IAAA,OAAO,EAAE,CAAC;AACV,IAAA,OAAO,EAAE,CAAC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EAAE,CAAC;AAClB,IAAA,cAAc,EAAE,CAAC;AACjB,IAAA,UAAU,EAAE,CAAC;AACb,IAAA,eAAe,EAAE,CAAC;AAClB,IAAA,kBAAkB,EAAE,CAAC;AACrB,IAAA,kBAAkB,EAAE,CAAC;AACrB,IAAA,wBAAwB,EAAE,CAAC;AAC3B,IAAA,UAAU,EAAE,CAAC;AACb,IAAA,aAAa,EAAE,CAAC;AAChB,IAAA,UAAU,EAAE,CAAC;AACb,IAAA,UAAU,EAAE,CAAC;AACb,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,WAAW,EAAE,CAAC;AACd,IAAA,QAAQ,EAAE,CAAC;AACX,IAAA,MAAM,EAAE,CAAC;;;;;"}
|
package/Tag/index.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { __rest } from 'tslib';
|
|
2
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import useTagProps from './useTagProps.mjs';
|
|
5
|
-
import ServerStyleTag from './ServerStyleTag.mjs';
|
|
6
|
-
|
|
7
|
-
const Tag = React.forwardRef((_a, ref) => {
|
|
8
|
-
var { component, children } = _a, rest = __rest(_a, ["component", "children"]);
|
|
9
|
-
const { props, style } = useTagProps(rest);
|
|
10
|
-
props.ref = ref;
|
|
11
|
-
const ele = React.createElement(component || "div", props, children);
|
|
12
|
-
if (typeof window === 'undefined') {
|
|
13
|
-
return (jsxs(Fragment, { children: [jsx(ServerStyleTag, { factory: style }), ele] }));
|
|
14
|
-
}
|
|
15
|
-
return ele;
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export { Tag as default };
|
|
19
|
-
//# sourceMappingURL=index.mjs.map
|
package/Tag/useTagProps.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTagProps.mjs","sources":["../../src/Tag/useTagProps.ts"],"sourcesContent":["import { TagComponentType, TagProps, TagPropsRoot } from './types';\r\nimport cssPropList from './cssPropList';\r\nimport { css } from '../css';\r\nimport { classNames } from 'pretty-class';\r\nimport { CSSFactoryType } from 'oncss';\r\nimport { useMemo } from 'react';\r\nimport { useDocument } from '../Document';\r\nimport { useCSSCacheId } from '../css/CSSCacheProvider';\r\n\r\nexport type useTagPropsReturn<T extends TagComponentType = \"div\"> = {\r\n props: TagProps<T>,\r\n style: CSSFactoryType\r\n}\r\n\r\nconst useTagProps = <T extends TagComponentType = \"div\">(props: TagPropsRoot<T>): useTagPropsReturn<T> => {\r\n const cachekey = JSON.stringify(props, (key, value) => {\r\n return key === '_owner' || key === '_store' ? undefined : value;\r\n }, 2);\r\n\r\n const doc = useDocument();\r\n const cacheId = useCSSCacheId()\r\n\r\n const parsed = useMemo(() => {\r\n let _props: any = {}\r\n let _css: any = {}\r\n\r\n if (props.hover && Object.keys(props.hover).length > 0) {\r\n _css['&:hover'] = {\r\n ...props.hover\r\n }\r\n }\r\n\r\n for (let key in props) {\r\n const keys = [\"sx\", \"sxr\", \"style\", \"hover\", \"className\", \"classNames\", \"baseClass\"];\r\n if (keys.includes(key)) {\r\n continue;\r\n }\r\n let val = (props as any)[key];\r\n if (!cssPropList[key]) {\r\n _props[key] = val\r\n } else {\r\n _css[key] = val\r\n }\r\n }\r\n\r\n const styles = css({ ...props.sxr, ..._css, ...props.sx, ...props.style }, {\r\n injectStyle: typeof doc !== 'undefined',\r\n container: doc,\r\n cacheId\r\n })\r\n\r\n return {\r\n props: _props,\r\n styles,\r\n className: classNames(\r\n props.baseClass ? \"xui-\" + props.baseClass : undefined,\r\n props.classNames,\r\n props.className,\r\n styles.classname\r\n )\r\n }\r\n }, [cachekey])\r\n\r\n const _props: any = {};\r\n for (let prop in parsed.props) {\r\n _props[prop] = (props as any)[prop]\r\n }\r\n _props.className = parsed.className;\r\n\r\n return { props: _props, style: parsed.styles };\r\n}\r\n\r\n\r\nexport default useTagProps"],"names":["cssPropList"],"mappings":";;;;;;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AA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAM,KAAK,CAAC,GAAG,CAAA,EAAK,IAAI,CAAA,EAAK,KAAK,CAAC,EAAE,GAAK,KAAK,CAAC,KAAK,CAAA,EAAI;AACxE,YAAA,WAAW,EAAE,OAAO,GAAG,KAAK,WAAW;AACvC,YAAA,SAAS,EAAE,GAAG;YACd;AACF,SAAA,CAAC;QAEF,OAAO;AACJ,YAAA,KAAK,EAAE,MAAM;YACb,MAAM;AACN,YAAA,SAAS,EAAE,UAAU,CAClB,KAAK,CAAC,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC,SAAS,GAAG,SAAS,EACtD,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,SAAS,EACf,MAAM,CAAC,SAAS;SAErB;AACJ,IAAA,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAEd,MAAM,MAAM,GAAQ,EAAE;AACtB,IAAA,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE;QAC5B,MAAM,CAAC,IAAI,CAAC,GAAI,KAAa,CAAC,IAAI,CAAC;IACtC;AACA,IAAA,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS;IAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;AACjD;;;;"}
|
package/Transition/index.mjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __rest } from 'tslib';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
import { useState, useEffect, Children, cloneElement } from 'react';
|
|
5
|
-
import useTransition from '../hooks/useTransition/index.mjs';
|
|
6
|
-
|
|
7
|
-
const TransitionBase = (_a) => {
|
|
8
|
-
var { children } = _a, options = __rest(_a, ["children"]);
|
|
9
|
-
const { props, exited } = useTransition(options);
|
|
10
|
-
if (exited)
|
|
11
|
-
return null;
|
|
12
|
-
const clone = Children.only(children);
|
|
13
|
-
return cloneElement(clone, props);
|
|
14
|
-
};
|
|
15
|
-
function Transition(_a) {
|
|
16
|
-
var { children } = _a, options = __rest(_a, ["children"]);
|
|
17
|
-
const [mounted, setMounted] = useState(false);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
setMounted(true);
|
|
20
|
-
}, []);
|
|
21
|
-
if (!mounted)
|
|
22
|
-
return null;
|
|
23
|
-
return jsx(TransitionBase, Object.assign({}, options, { children: children }));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { Transition as default };
|
|
27
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import React__default, { useState, useCallback } from 'react';
|
|
4
|
-
import { breakpoints } from '../css/index.mjs';
|
|
5
|
-
|
|
6
|
-
const BreakpointCtx = React__default.createContext("xs");
|
|
7
|
-
/**
|
|
8
|
-
* SSR-safe breakpoint detection
|
|
9
|
-
*/
|
|
10
|
-
const getKey = () => {
|
|
11
|
-
if (typeof window === 'undefined') {
|
|
12
|
-
return "xl";
|
|
13
|
-
}
|
|
14
|
-
const width = window.innerWidth;
|
|
15
|
-
if (width < breakpoints.sm)
|
|
16
|
-
return "xs";
|
|
17
|
-
if (width < breakpoints.md)
|
|
18
|
-
return "sm";
|
|
19
|
-
if (width < breakpoints.lg)
|
|
20
|
-
return "md";
|
|
21
|
-
if (width < breakpoints.xl)
|
|
22
|
-
return "lg";
|
|
23
|
-
return "xl";
|
|
24
|
-
};
|
|
25
|
-
const BreakpointProvider = ({ children }) => {
|
|
26
|
-
const [current, setCurrent] = useState("xl");
|
|
27
|
-
const handler = useCallback(() => {
|
|
28
|
-
const newKey = getKey();
|
|
29
|
-
setCurrent(prev => (prev === newKey ? prev : newKey));
|
|
30
|
-
}, []);
|
|
31
|
-
React__default.useEffect(() => {
|
|
32
|
-
window.addEventListener("resize", handler);
|
|
33
|
-
handler(); // detect on mount
|
|
34
|
-
return () => window.removeEventListener("resize", handler);
|
|
35
|
-
}, [handler]);
|
|
36
|
-
return (jsx(BreakpointCtx.Provider, { value: current, children: children }));
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export { BreakpointCtx, BreakpointProvider };
|
|
40
|
-
//# sourceMappingURL=BreakpointProvider.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BreakpointProvider.mjs","sources":["../../src/breakpoint/BreakpointProvider.tsx"],"sourcesContent":["\"use client\";\r\nimport React, { ReactNode, useState, useCallback } from \"react\";\r\nimport { breakpoints } from \"../css\";\r\nimport { BreakpointKeys } from \"../css/types\";\r\n\r\nexport const BreakpointCtx = React.createContext<BreakpointKeys>(\"xs\");\r\n\r\n/**\r\n * SSR-safe breakpoint detection\r\n */\r\nconst getKey = (): BreakpointKeys => {\r\n if (typeof window === 'undefined') {\r\n return \"xl\";\r\n }\r\n\r\n const width = window.innerWidth;\r\n\r\n if (width < breakpoints.sm) return \"xs\";\r\n if (width < breakpoints.md) return \"sm\";\r\n if (width < breakpoints.lg) return \"md\";\r\n if (width < breakpoints.xl) return \"lg\";\r\n return \"xl\";\r\n};\r\n\r\nexport const BreakpointProvider = ({ children }: { children?: ReactNode }) => {\r\n const [current, setCurrent] = useState<BreakpointKeys>(\"xl\");\r\n\r\n const handler = useCallback(() => {\r\n const newKey = getKey();\r\n setCurrent(prev => (prev === newKey ? prev : newKey));\r\n }, []);\r\n\r\n React.useEffect(() => {\r\n window.addEventListener(\"resize\", handler);\r\n handler(); // detect on mount\r\n return () => window.removeEventListener(\"resize\", handler);\r\n }, [handler]);\r\n\r\n return (\r\n <BreakpointCtx.Provider value={current}>\r\n {children}\r\n </BreakpointCtx.Provider>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;AAKO;AAEP;;AAEG;AACH;AACI;AACI;;AAGJ;AAEA;AAA4B;AAC5B;AAA4B;AAC5B;AAA4B;AAC5B;AAA4B;AAC5B;AACJ;;;AAKI;AACI;AACA;;AAGJ;AACI;;;AAGJ;AAEA;AAKJ;;"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { BreakpointCtx } from './BreakpointProvider.mjs';
|
|
3
|
-
import { breakpoints } from '../css/index.mjs';
|
|
4
|
-
|
|
5
|
-
const useBreakpoint = () => {
|
|
6
|
-
const value = useContext(BreakpointCtx);
|
|
7
|
-
const getWidth = () => typeof window !== 'undefined' ? window.innerWidth : 99999;
|
|
8
|
-
const is = (key) => value === key;
|
|
9
|
-
const isUp = (key) => getWidth() >= breakpoints[key];
|
|
10
|
-
const isDown = (key) => getWidth() < breakpoints[key];
|
|
11
|
-
return {
|
|
12
|
-
value,
|
|
13
|
-
is,
|
|
14
|
-
isUp,
|
|
15
|
-
isDown,
|
|
16
|
-
isOrUp: (key) => is(key) || isUp(key),
|
|
17
|
-
isOrDown: (key) => is(key) || isDown(key)
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export { useBreakpoint as default };
|
|
22
|
-
//# sourceMappingURL=useBreakpoint.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpointProps.mjs","sources":["../../src/breakpoint/useBreakpointProps.ts"],"sourcesContent":["import { isValidElement, useMemo } from \"react\"\r\nimport useBreakpoint from \"./useBreakpoint\"\r\nimport { BreakpointKeys } from \"../css/types\"\r\n\r\nexport type useBreakpointPropsType<P> = P | {\r\n [key in BreakpointKeys]?: P\r\n}\r\n\r\nconst useBreakpointProps = <P extends object>(props: useBreakpointPropsType<P>): useBreakpointPropsType<P> => {\r\n const bpoint = useBreakpoint()\r\n const cachekey = JSON.stringify(props, (key, value) => {\r\n return key === '_owner' || key === '_store' ? undefined : value;\r\n }, 2);\r\n\r\n const bprops = useMemo(() => {\r\n let bprops: any = []\r\n let bkeys = ['xs', 'sm', 'md', 'lg', 'xl']\r\n\r\n for (let prop in props) {\r\n let val = (props as any)[prop]\r\n if (!isValidElement(val) && typeof val === 'object' && val !== null && Object.keys(val).some(k => bkeys.includes(k))) {\r\n bprops.push(prop)\r\n }\r\n }\r\n return bprops\r\n }, [cachekey]);\r\n\r\n\r\n if (bprops.length === 0) return props;\r\n\r\n const format: any = {\r\n xs: {},\r\n sm: {},\r\n md: {},\r\n lg: {},\r\n xl: {}\r\n }\r\n\r\n for (let prop of bprops) {\r\n let val = (props as any)[prop]\r\n for (let bp in val) {\r\n format[bp][prop] = val[bp]\r\n }\r\n }\r\n\r\n let _props = format.xs || {};\r\n for (let key of ['sm', 'md', 'lg', 'xl']) {\r\n if (bpoint.isDown(key as any)) break;\r\n if (bpoint.isOrUp(key as any)) {\r\n _props = { ..._props, ...format[key] };\r\n }\r\n }\r\n\r\n return {\r\n ...props,\r\n ..._props\r\n };\r\n}\r\n\r\n\r\n\r\nexport default useBreakpointProps"],"names":[],"mappings":";;;AAQA,MAAM,kBAAkB,GAAG,CAAmB,KAAgC,KAA+B;AAC1G,IAAA,MAAM,MAAM,GAAG,aAAa,EAAE;AAC9B,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,KAAK,KAAI;AACnD,QAAA,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,QAAQ,GAAG,SAAS,GAAG,KAAK;IAClE,CAAC,EAAE,CAAC,CAAC;AAEL,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAK;QACzB,IAAI,MAAM,GAAQ,EAAE;AACpB,QAAA,IAAI,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;AAE1C,QAAA,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE;AACrB,YAAA,IAAI,GAAG,GAAI,KAAa,CAAC,IAAI,CAAC;AAC9B,YAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,OA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MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACM,KAAK,CAAA,EACL,MAAM,CAAA;AAEf;;;;"}
|
package/css/CSSCacheProvider.mjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React__default from 'react';
|
|
3
|
-
import { ONCSS_CACHE } from 'oncss';
|
|
4
|
-
|
|
5
|
-
const CSSCacheContext = React__default.createContext(null);
|
|
6
|
-
const CSSCacheProvider = ({ cacheId, children }) => {
|
|
7
|
-
return (jsx(CSSCacheContext.Provider, { value: cacheId, children: children }));
|
|
8
|
-
};
|
|
9
|
-
const useCSSCacheId = () => {
|
|
10
|
-
return React__default.useContext(CSSCacheContext);
|
|
11
|
-
};
|
|
12
|
-
const useCSSCache = () => {
|
|
13
|
-
const cacheId = React__default.useContext(CSSCacheContext);
|
|
14
|
-
if (typeof window === 'undefined') {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
const caches = ONCSS_CACHE.caches();
|
|
18
|
-
return {
|
|
19
|
-
cacheId,
|
|
20
|
-
cache: caches.get(cacheId)
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
const getCSSCache = (cacheId) => {
|
|
24
|
-
const caches = ONCSS_CACHE.caches();
|
|
25
|
-
return caches.get(cacheId);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export { CSSCacheProvider, getCSSCache, useCSSCache, useCSSCacheId };
|
|
29
|
-
//# sourceMappingURL=CSSCacheProvider.mjs.map
|
package/css/aliases.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aliases.mjs","sources":["../../src/css/aliases.ts"],"sourcesContent":["import { OptionAliases } from 'oncss'\r\nimport { Aliases } from './types'\r\n\r\nconst isStr = (v: any, or: any) => typeof v === 'string' ? v : or\r\n\r\nconst aliases: OptionAliases<Aliases> = {\r\n bgcolor: (v) => ({ backgroundColor: v }),\r\n bgimage: (v) => ({ backgroundImage: `url(${v})`, backgroundSize: \"cover\", backgroundRepeat: \"no-repeat\" }),\r\n bg: (v) => ({ background: v }),\r\n p: (v) => ({ padding: isStr(v, 8 * v) }),\r\n pt: (v) => ({ paddingTop: isStr(v, 8 * v) }),\r\n pr: (v) => ({ paddingRight: isStr(v, 8 * v) }),\r\n pb: (v) => ({ paddingBottom: isStr(v, 8 * v) }),\r\n pl: (v) => ({ paddingLeft: isStr(v, 8 * v) }),\r\n px: (v) => ({ paddingLeft: isStr(v, 8 * v), paddingRight: isStr(v, 8 * v) }),\r\n py: (v) => ({ paddingTop: isStr(v, 8 * v), paddingBottom: isStr(v, 8 * v) }),\r\n m: (v) => ({ margin: isStr(v, 8 * v) }),\r\n mt: (v) => ({ marginTop: isStr(v, 8 * v) }),\r\n mr: (v) => ({ marginRight: isStr(v, 8 * v) }),\r\n mb: (v) => ({ marginBottom: isStr(v, 8 * v) }),\r\n ml: (v) => ({ marginLeft: isStr(v, 8 * v) }),\r\n mx: (v) => ({ marginLeft: isStr(v, 8 * v), marginRight: isStr(v, 8 * v) }),\r\n my: (v) => ({ marginTop: isStr(v, 8 * v), marginBottom: isStr(v, 8 * v) }),\r\n radius: (v) => ({ borderRadius: isStr(v, 8 * v) }),\r\n borderRadius: (v) => ({ borderRadius: isStr(v, 8 * v) }),\r\n shadow: (v) => ({ boxShadow: v }),\r\n flexBox: (v) => (v ? { display: \"flex\" } : {}),\r\n flexRow: (v) => (v ? { flexDirection: \"row\" } : {}),\r\n flexColumn: (v) => (v ? { flexDirection: \"column\" } : {}),\r\n flexWraped: (v) => (v ? { flexWrap: \"wrap\" } : {}),\r\n direction: (v) => (v === 'row' || v === 'column' ? { flexDirection: v } : { direction: v }),\r\n gap: (v) => ({ gap: isStr(v, 8 * v) }),\r\n};\r\n\r\nexport default aliases"],"names":[],"mappings":"AAGA,MAAM,KAAK,GAAG,CAAC,CAAM,EAAE,EAAO,KAAK,OAAO,CAAC,KAAK,QAAQ,GAAG,CAAC,GA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AC,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;AACxD,IAAA,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACjC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IACnD,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;IACzD,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAClD,IAAA,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,QAAQ,GAAG,EAAE,aAAa,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;AAC3F,IAAA,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;;"}
|
package/css/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/css/index.ts"],"sourcesContent":["import getValue from \"./getValue\"\r\nimport getProps from \"./getProps\"\r\nimport aliases from \"./aliases\"\r\nimport { Aliases, BreakpointKeys, CSSOptionProps, CSSProps } from './types'\r\nimport { css as _css } from \"oncss\"\r\n\r\nexport {\r\n getValue,\r\n getProps\r\n}\r\n\r\nexport const breakpoints = {\r\n xs: 0,\r\n sm: 600,\r\n md: 900,\r\n lg: 1200,\r\n xl: 1536\r\n}\r\n\r\nexport const css = (props: CSSProps, options?: CSSOptionProps) => {\r\n const cssOptions: CSSOptionProps = {\r\n ...options,\r\n breakpoints,\r\n aliases,\r\n getValue: (p: any, v: any, _c: any, dept) => {\r\n if (options?.getValue) {\r\n let _val = options?.getValue(p, v, _c, dept)\r\n if (_val) return _val\r\n }\r\n return getValue(p, v, _c)\r\n },\r\n getProps: (p: any, v: any, _c: any, dept) => {\r\n if (options?.getProps) {\r\n let _p = options?.getProps(p, v, _c, dept)\r\n if (_p) return _p\r\n }\r\n return getProps(p, v, _c)\r\n },\r\n }\r\n return _css<Aliases, BreakpointKeys>(props, cssOptions)\r\n}\r\n\r\nexport const adjustColor = (hex: string, factor: number) => {\r\n\r\n hex = hex.replace(/^#/, '')\r\n\r\n let r = parseInt(hex.slice(0, 2), 16)\r\n let g = parseInt(hex.slice(2, 4), 16)\r\n let b = parseInt(hex.slice(4, 6), 16)\r\n\r\n r = Math.floor(r * factor)\r\n g = Math.floor(g * factor)\r\n b = Math.floor(b * factor)\r\n\r\n r = Math.min(255, Math.max(0, r))\r\n g = Math.min(255, Math.max(0, g))\r\n b = Math.min(255, Math.max(0, b))\r\n\r\n return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;\r\n}\r\n\r\nexport const adjustTextContrast = (color: string) => {\r\n color = color.replace(/^#/, '')\r\n const r = parseInt(color.slice(0, 2), 16);\r\n const g = parseInt(color.slice(2, 4), 16);\r\n const b = parseInt(color.slice(4, 6), 16);\r\n\r\n const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;\r\n return luminance > 0.5 ? '#111111' : '#FFFFFF';\r\n}\r\n\r\nexport const alpha = (color: string, opacity = 1) => {\r\n if (typeof opacity !== 'number') return color\r\n let _opacity = opacity * 100\r\n if (!color.startsWith(\"#\")) throw new Error(`color must be hex`)\r\n return (color + (`0${Math.round((255 / 100) * _opacity).toString(16)}`.slice(-2))).toUpperCase();\r\n};\r\n\r\n"],"names":["_css"],"m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AAE,CAAC,CAAC,EAAE,WAAW,EAAE;AACpG;;;;"}
|
package/hooks/useInterface.mjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { useTheme } from '../theme/core.mjs';
|
|
2
|
-
import '../css/getValue.mjs';
|
|
3
|
-
import 'oncss';
|
|
4
|
-
import '../theme/ThemeProvider.mjs';
|
|
5
|
-
import 'react-state-bucket';
|
|
6
|
-
|
|
7
|
-
const useInterface = (name, userPorps, defaultProps) => {
|
|
8
|
-
const theme = useTheme();
|
|
9
|
-
let _props = Object.assign(Object.assign({}, defaultProps), userPorps);
|
|
10
|
-
if (name in theme.interfaces) {
|
|
11
|
-
return theme.interfaces[name](_props, theme);
|
|
12
|
-
}
|
|
13
|
-
return [_props, theme];
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { useInterface as default };
|
|
17
|
-
//# sourceMappingURL=useInterface.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInterface.mjs","sources":["../../src/hooks/useInterface.ts"],"sourcesContent":["import { useTheme } from \"../theme\"\r\n\r\nconst useInterface = <P extends object>(name: string, userPorps: P, defaultProps: P) => {\r\n const theme = useTheme()\r\n let _props = { ...defaultProps, ...userPorps } as P\r\n if (name in theme.interfaces) {\r\n return theme.interfaces[name](_props, theme)\r\n }\r\n return [_props, theme]\r\n}\r\n\r\nexport default useInterface"],"names":[],"mappings":";;;;;;AAEA,MAAM,YAAY,GAAG,CAAmB,IAAY,EAAE,SAAY,EAAE,YAAe,KAAI;AACnF,IAAA,MAAM,KAAK,GAAG,QAAQ,EAAE;AACxB,IAAA,IAAI,MAAM,GAAG,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,YAAY,CAAA,EAAK,SAAS,CAAO;AACnD,IAAA,IAAI,IAAI,IAAI,KAAK,CAAC,UAAU,EAAE;QAC1B,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC;IAChD;AACA,IAAA,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC;AAC1B;;;;"}
|
package/hooks/usePortal.mjs
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import React__default, { useMemo, useEffect } from 'react';
|
|
4
|
-
import { createRoot } from 'react-dom/client';
|
|
5
|
-
import { useTheme } from '../theme/core.mjs';
|
|
6
|
-
import '../css/getValue.mjs';
|
|
7
|
-
import 'oncss';
|
|
8
|
-
import ThemeProvider from '../theme/ThemeProvider.mjs';
|
|
9
|
-
import 'react-state-bucket';
|
|
10
|
-
import { useAppRootElement } from '../AppRoot/AppRootProvider.mjs';
|
|
11
|
-
|
|
12
|
-
function usePortal(children, options) {
|
|
13
|
-
options = options || {};
|
|
14
|
-
if (options.autoMount === undefined) {
|
|
15
|
-
options.autoMount = true;
|
|
16
|
-
}
|
|
17
|
-
const [mounted, setMounted] = React__default.useState(options.autoMount);
|
|
18
|
-
const theme = useTheme();
|
|
19
|
-
const appRoot = useAppRootElement();
|
|
20
|
-
const { el, root } = useMemo(() => {
|
|
21
|
-
const el = document.createElement("div");
|
|
22
|
-
const root = createRoot(el);
|
|
23
|
-
return { el, root };
|
|
24
|
-
}, [options.autoMount]);
|
|
25
|
-
const container = () => {
|
|
26
|
-
const container = (options === null || options === void 0 ? void 0 : options.container) || appRoot;
|
|
27
|
-
if (!container)
|
|
28
|
-
throw new Error(`Container not found for portal. Please ensure that AppRoot is present in the application tree.`);
|
|
29
|
-
return container;
|
|
30
|
-
};
|
|
31
|
-
const mount = () => {
|
|
32
|
-
const cont = container();
|
|
33
|
-
if (!cont.contains(el)) {
|
|
34
|
-
cont.appendChild(el);
|
|
35
|
-
}
|
|
36
|
-
root.render(jsx(ThemeProvider, { theme: theme.name, children: children }));
|
|
37
|
-
};
|
|
38
|
-
const unmount = () => {
|
|
39
|
-
root.render(null);
|
|
40
|
-
el.remove();
|
|
41
|
-
};
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
if (mounted) {
|
|
44
|
-
mount();
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
unmount();
|
|
48
|
-
}
|
|
49
|
-
}, [mounted]);
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
if (mounted) {
|
|
52
|
-
mount();
|
|
53
|
-
}
|
|
54
|
-
}, [children]);
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
return () => {
|
|
57
|
-
unmount();
|
|
58
|
-
};
|
|
59
|
-
}, []);
|
|
60
|
-
return {
|
|
61
|
-
isMount: () => mounted,
|
|
62
|
-
mount: () => setMounted(true),
|
|
63
|
-
unmount: () => setMounted(false)
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export { usePortal as default };
|
|
68
|
-
//# sourceMappingURL=usePortal.mjs.map
|
package/hooks/usePortal.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePortal.mjs","sources":["../../src/hooks/usePortal.tsx"],"sourcesContent":["\"use client\";\r\nimport React, { useEffect, useMemo } from \"react\";\r\nimport { createRoot } from \"react-dom/client\";\r\nimport { ThemeProvider, useTheme } from \"../theme\";\r\nimport { useAppRootElement } from \"../AppRoot/AppRootProvider\";\r\n\r\nexport type UsePortalOptions = {\r\n container?: HTMLElement;\r\n autoMount?: boolean;\r\n}\r\n\r\nfunction usePortal(children: React.ReactNode, options?: UsePortalOptions) {\r\n options = options || {};\r\n if (options.autoMount === undefined) {\r\n options.autoMount = true;\r\n }\r\n const [mounted, setMounted] = React.useState(options.autoMount);\r\n const theme = useTheme();\r\n const appRoot = useAppRootElement();\r\n const { el, root } = useMemo(() => {\r\n const el = document.createElement(\"div\");\r\n const root = createRoot(el);\r\n return { el, root };\r\n }, [options.autoMount]);\r\n\r\n const container = () => {\r\n const container = options?.container || appRoot\r\n if (!container) throw new Error(`Container not found for portal. Please ensure that AppRoot is present in the application tree.`);\r\n return container;\r\n }\r\n\r\n const mount = () => {\r\n const cont = container();\r\n if (!cont.contains(el)) {\r\n cont.appendChild(el);\r\n }\r\n root.render(<ThemeProvider theme={theme.name}>{children}</ThemeProvider>)\r\n }\r\n\r\n const unmount = () => {\r\n root.render(null)\r\n el.remove();\r\n }\r\n\r\n\r\n useEffect(() => {\r\n if (mounted) {\r\n mount()\r\n } else {\r\n unmount()\r\n }\r\n }, [mounted]);\r\n\r\n useEffect(() => {\r\n if (mounted) {\r\n mount()\r\n }\r\n }, [children]);\r\n\r\n useEffect(() => {\r\n return () => {\r\n unmount()\r\n };\r\n }, []);\r\n\r\n return {\r\n isMount: () => mounted,\r\n mount: () => setMounted(true),\r\n unmount: () => setMounted(false)\r\n }\r\n}\r\n\r\n\r\nexport default usePortal;"],"names":[],"mappings":";;;;;;;;;;;AAWA;AACG;AACA;AACG;;AAEH;AACA;AACA;;;AAGG;AACA;AACH;;AAGG;AACA;AAAgB;AAChB;AACH;;AAGG;;AAEG;;AAEH;AACH;;AAGG;;AAEH;;;AAKM;;;AAEA;;AAEN;;;AAIM;;AAEN;;AAGG;AACG;AACH;;;AAIA;AACA;AACA;;AAEN;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/hooks/useTransition/index.ts"],"sourcesContent":["\"use client\";\r\nimport { useState, useEffect, useId } from 'react';\r\nimport { animationEases } from '../useAnimation';\r\nimport { css } from '../../css';\r\nimport { formatCSSProp } from 'oncss';\r\nimport { CSSProps } from '../../css/types';\r\nimport * as variants from './variants'\r\nimport { useDocument } from '../../Document';\r\nimport { useCSSCacheId } from '../../css/CSSCacheProvider';\r\n\r\nexport type UseTransitionVariantTypes = keyof typeof variants\r\nexport type UseTransitionState = \"open\" | \"opened\" | \"close\" | \"closed\"\r\n\r\nexport type UseTransitionVariant = (rect: DOMRect) => ({ from: CSSProps, to: CSSProps })\r\n\r\nexport type UseTransitionProps = {\r\n open: boolean;\r\n variant: UseTransitionVariant | UseTransitionVariantTypes;\r\n ease?: string;\r\n easing?: keyof typeof animationEases;\r\n duration?: number;\r\n delay?: number;\r\n disableInitialTransition?: boolean;\r\n exitOnUnmount?: boolean;\r\n onOpen?: () => void;\r\n onOpened?: () => void;\r\n onClose?: () => void;\r\n onClosed?: () => void;\r\n onState?: (state: UseTransitionState) => void;\r\n}\r\n\r\n\r\nconst style = (obj = {}, doc: Document, cacheId: string) => {\r\n return css(obj, { selector: \"#\", container: doc, cacheId }).classname;\r\n}\r\n\r\nconst getVariant = (rect: DOMRect | null, variant: UseTransitionProps['variant']) => {\r\n let fn = typeof variant === 'string' ? variants[variant] : variant\r\n if (!fn) throw new Error(`Transition variant \"${variant}\" not found.`)\r\n return fn(rect as DOMRect);\r\n}\r\n\r\nconst useTransition = ({ open, ...props }: UseTransitionProps) => {\r\n let {\r\n disableInitialTransition = false,\r\n variant = \"fade\",\r\n duration = 400,\r\n delay,\r\n ease,\r\n easing,\r\n exitOnUnmount = false,\r\n onOpen,\r\n onOpened,\r\n onClose,\r\n onClosed,\r\n onState\r\n } = props\r\n const doc = useDocument();\r\n const cacheId = useCSSCacheId()\r\n let _ease = ease || (animationEases as any)[easing as any] || animationEases.bounce\r\n const id = \"xui-transition-\" + useId()\r\n const [state, setState] = useState({\r\n initial: false,\r\n classname: style({ visibility: \"hidden\" }, doc, cacheId),\r\n variant: variant,\r\n rect: null as DOMRect | null,\r\n stage: open ? \"open\" : \"closed\",\r\n unmounted: false,\r\n })\r\n\r\n const getEle = () => doc.querySelector(`[data-transition=\"${id}\"]`) as HTMLElement;\r\n const getBoundary = () => state.rect || getEle()?.getBoundingClientRect() || new DOMRect(0, 0, 0, 0);\r\n\r\n useEffect(() => {\r\n if (exitOnUnmount && state.stage === 'closed') {\r\n if (!open) {\r\n setState(s => ({\r\n ...s,\r\n initial: false,\r\n classname: \"\",\r\n unmounted: true,\r\n variant: variant,\r\n }))\r\n } else {\r\n setState(s => ({\r\n ...s,\r\n variant: variant,\r\n classname: style({ visibility: \"hidden\" }, doc, cacheId),\r\n stage: \"open\",\r\n }))\r\n }\r\n }\r\n }, [open, state.stage, exitOnUnmount, variant])\r\n\r\n // initial effect\r\n useEffect(() => {\r\n const ele = getEle()\r\n if (!ele) return\r\n if (exitOnUnmount && state.stage === 'closed') return\r\n\r\n const rect = getBoundary();\r\n let { from } = getVariant(rect, state.variant)\r\n if (open && !state.initial) {\r\n setState(s => ({\r\n ...s,\r\n classname: (!disableInitialTransition || state.unmounted) ? style(from, doc, cacheId) : \"\",\r\n initial: true,\r\n rect: rect,\r\n }))\r\n let stimer: any = null\r\n let etimer: any = null\r\n ele.ontransitionstart = () => {\r\n clearTimeout(stimer)\r\n stimer = setTimeout(() => {\r\n const isOpen = ele.getAttribute('data-transition-state') === 'open';\r\n (onOpen && isOpen) && onOpen();\r\n (onClose && !isOpen) && onClose()\r\n onState && onState(isOpen ? \"open\" : \"close\")\r\n setState(s => ({\r\n ...s,\r\n stage: isOpen ? \"open\" : \"close\"\r\n }))\r\n }, 1)\r\n }\r\n\r\n ele.ontransitionend = () => {\r\n clearTimeout(etimer)\r\n etimer = setTimeout(() => {\r\n const isOpen = ele.getAttribute('data-transition-state') === 'open';\r\n (onOpened && isOpen) && onOpened();\r\n (onClosed && !isOpen) && onClosed();\r\n onState && onState(isOpen ? \"opened\" : \"closed\")\r\n setState(s => ({\r\n ...s,\r\n stage: isOpen ? \"opened\" : \"closed\"\r\n }))\r\n }, 1)\r\n }\r\n } else if (!state.initial) {\r\n setState(s => ({\r\n ...s,\r\n classname: style(from, doc, cacheId),\r\n rect: rect,\r\n }))\r\n }\r\n }, [open, state.initial, state.stage, exitOnUnmount])\r\n\r\n\r\n useEffect(() => {\r\n if (state.initial) {\r\n let _variant = state.variant !== variant ? variant : state.variant\r\n const { from, to } = getVariant(state.rect, _variant)\r\n let _css: CSSProps = open ? to : from\r\n let trans = ` ${duration}ms ${_ease} ${delay || 0}ms`\r\n let _ = {\r\n ..._css,\r\n transition: Object.keys(_css || {}).map(k => formatCSSProp(k)).join(trans + \", \") + trans,\r\n }\r\n setState(s => ({\r\n ...s,\r\n classname: style(_, doc, cacheId),\r\n variant: _variant\r\n }))\r\n }\r\n }, [open, state.initial, variant])\r\n\r\n return {\r\n exited: exitOnUnmount && state.stage === 'closed',\r\n props: {\r\n 'id': state.classname,\r\n 'data-transition': id,\r\n 'data-transition-state': open ? 'open' : 'close',\r\n }\r\n }\r\n}\r\n\r\n\r\nexport default useTransition"],"names":[],"mappings":";;;;;;;;;;AAgCA;AACG;AACH;AAEA;AACG;AACA;AAAS;AACT;AACH;AAEA;AAAuB;AACpB;AAcA;AACA;AACA;AACA;AACA;AACG;AACA;AACA;AACA;;AAEA;AACF;AAED;AACA;;;;;;;AAaS;;;AAQT;;;AAIG;AACA;;AACA;;AAEA;AACA;AACA;AACG;;;AAQA;;AAEG;;AAEG;;AAEA;;;AAMN;AAEA;;AAEG;;AAEG;;AAEA;;;AAMN;;AACI;;;AAOV;;AAIG;AACG;AACA;;;AAGA;;;;;AAaH;AACA;;AAEG;;AAEF;;AAEP;;"}
|
package/index.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export { default as Tag } from './Tag/index.mjs';
|
|
2
|
-
export { default as useTagProps } from './Tag/useTagProps.mjs';
|
|
3
|
-
export { animationEases, default as useAnimation } from './hooks/useAnimation.mjs';
|
|
4
|
-
export { default as useColorTemplate } from './hooks/useColorTemplate.mjs';
|
|
5
|
-
export { default as useBreakpoint } from './breakpoint/useBreakpoint.mjs';
|
|
6
|
-
export { default as useBreakpointProps } from './breakpoint/useBreakpointProps.mjs';
|
|
7
|
-
export { default as useInterface } from './hooks/useInterface.mjs';
|
|
8
|
-
export { default as useTransition } from './hooks/useTransition/index.mjs';
|
|
9
|
-
export { default as useMergeRefs } from './hooks/useMergeRefs.mjs';
|
|
10
|
-
export { default as Transition } from './Transition/index.mjs';
|
|
11
|
-
export { default as AppRoot } from './AppRoot/index.mjs';
|
|
12
|
-
export { default as usePortal } from './hooks/usePortal.mjs';
|
|
13
|
-
export { Renderar } from './AppRoot/Renderar.mjs';
|
|
14
|
-
export { useDocument } from './Document/index.mjs';
|
|
15
|
-
export { useAppRootElement } from './AppRoot/AppRootProvider.mjs';
|
|
16
|
-
export { getCSSCache, useCSSCache, useCSSCacheId } from './css/CSSCacheProvider.mjs';
|
|
17
|
-
export { default as Iframe } from './Iframe/index.mjs';
|
|
18
|
-
export { adjustColor, adjustTextContrast, alpha, breakpoints, css } from './css/index.mjs';
|
|
19
|
-
export { themeRootClass } from './theme/index.mjs';
|
|
20
|
-
export { default as getValue } from './css/getValue.mjs';
|
|
21
|
-
export { default as getProps } from './css/getProps.mjs';
|
|
22
|
-
export { default as ThemeProvider } from './theme/ThemeProvider.mjs';
|
|
23
|
-
export { default as createThemeSwitcher } from './theme/createThemeSwitcher.mjs';
|
|
24
|
-
export { createTheme } from './theme/createTheme.mjs';
|
|
25
|
-
export { getTheme, useTheme } from './theme/core.mjs';
|
|
26
|
-
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|