@xanui/core 1.2.55 → 1.2.56
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.map +1 -1
- package/AppRoot/AppRootProvider.js.map +1 -1
- package/AppRoot/Renderar.cjs.map +1 -1
- package/AppRoot/Renderar.js.map +1 -1
- package/AppRoot/index.cjs.map +1 -1
- package/AppRoot/index.js.map +1 -1
- package/Document/index.cjs.map +1 -1
- package/Document/index.js.map +1 -1
- package/Iframe/index.cjs.map +1 -1
- package/Iframe/index.js.map +1 -1
- package/Portal/index.cjs +36 -0
- package/Portal/index.cjs.map +1 -0
- package/Portal/index.d.ts +15 -0
- package/Portal/index.js +34 -0
- package/Portal/index.js.map +1 -0
- package/Tag/ServerStyleTag.cjs.map +1 -1
- package/Tag/ServerStyleTag.js.map +1 -1
- package/Tag/cssPropList.cjs.map +1 -1
- package/Tag/cssPropList.js.map +1 -1
- package/Tag/index.cjs.map +1 -1
- package/Tag/index.js.map +1 -1
- package/Tag/useTagProps.cjs.map +1 -1
- package/Tag/useTagProps.js.map +1 -1
- package/Transition/index.cjs.map +1 -1
- package/Transition/index.js.map +1 -1
- package/breakpoint/BreakpointProvider.cjs +19 -15
- package/breakpoint/BreakpointProvider.cjs.map +1 -1
- package/breakpoint/BreakpointProvider.js +19 -15
- package/breakpoint/BreakpointProvider.js.map +1 -1
- package/breakpoint/useBreakpoint.cjs +12 -8
- package/breakpoint/useBreakpoint.cjs.map +1 -1
- package/breakpoint/useBreakpoint.d.ts +7 -5
- package/breakpoint/useBreakpoint.js +12 -8
- package/breakpoint/useBreakpoint.js.map +1 -1
- package/breakpoint/useBreakpointProps.cjs.map +1 -1
- package/breakpoint/useBreakpointProps.js.map +1 -1
- package/css/CSSCacheProvider.cjs.map +1 -1
- package/css/CSSCacheProvider.js.map +1 -1
- package/css/aliases.cjs.map +1 -1
- package/css/aliases.js.map +1 -1
- package/css/getProps.cjs.map +1 -1
- package/css/getProps.js.map +1 -1
- package/css/getValue.cjs.map +1 -1
- package/css/getValue.js.map +1 -1
- package/css/index.cjs +4 -4
- package/css/index.cjs.map +1 -1
- package/css/index.js +4 -4
- package/css/index.js.map +1 -1
- package/hooks/useAnimation.cjs.map +1 -1
- package/hooks/useAnimation.js.map +1 -1
- package/hooks/useColorTemplate.cjs.map +1 -1
- package/hooks/useColorTemplate.js.map +1 -1
- package/hooks/useInterface.cjs.map +1 -1
- package/hooks/useInterface.js.map +1 -1
- package/hooks/useMergeRefs.cjs.map +1 -1
- package/hooks/useMergeRefs.js.map +1 -1
- package/hooks/useTransition/index.cjs.map +1 -1
- package/hooks/useTransition/index.js.map +1 -1
- package/hooks/useTransition/variants.cjs.map +1 -1
- package/hooks/useTransition/variants.js.map +1 -1
- package/index.cjs +16 -16
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/readme.md +109 -109
- package/theme/ThemeCssVars.cjs.map +1 -1
- package/theme/ThemeCssVars.js.map +1 -1
- package/theme/ThemeDefaultOptions.cjs.map +1 -1
- package/theme/ThemeDefaultOptions.js.map +1 -1
- package/theme/ThemeProvider.cjs.map +1 -1
- package/theme/ThemeProvider.js.map +1 -1
- package/theme/core.cjs.map +1 -1
- package/theme/core.js.map +1 -1
- package/theme/createTheme.cjs.map +1 -1
- package/theme/createTheme.js.map +1 -1
- package/theme/createThemeSwitcher.cjs.map +1 -1
- package/theme/createThemeSwitcher.js.map +1 -1
- package/theme/index.cjs.map +1 -1
- package/theme/index.js.map +1 -1
- package/hooks/usePortal.cjs +0 -69
- package/hooks/usePortal.cjs.map +0 -1
- package/hooks/usePortal.d.ts +0 -14
- package/hooks/usePortal.js +0 -67
- package/hooks/usePortal.js.map +0 -1
package/hooks/usePortal.js
DELETED
|
@@ -1,67 +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.js';
|
|
6
|
-
import '../css/getValue.js';
|
|
7
|
-
import 'oncss';
|
|
8
|
-
import '../theme/ThemeProvider.js';
|
|
9
|
-
import 'react-state-bucket';
|
|
10
|
-
import { useAppRootElement } from '../AppRoot/AppRootProvider.js';
|
|
11
|
-
import { useDocument } from '../Document/index.js';
|
|
12
|
-
import AppRoot from '../AppRoot/index.js';
|
|
13
|
-
import { useCSSCacheId } from '../css/CSSCacheProvider.js';
|
|
14
|
-
|
|
15
|
-
function usePortal(children, options) {
|
|
16
|
-
options = options || {};
|
|
17
|
-
if (options.autoMount === undefined) {
|
|
18
|
-
options.autoMount = true;
|
|
19
|
-
}
|
|
20
|
-
const [mounted, setMounted] = React__default.useState(options.autoMount);
|
|
21
|
-
const theme = useTheme();
|
|
22
|
-
const doc = useDocument();
|
|
23
|
-
const appRoot = useAppRootElement();
|
|
24
|
-
const cacheId = useCSSCacheId();
|
|
25
|
-
const { el, root } = useMemo(() => {
|
|
26
|
-
const el = doc === null || doc === void 0 ? void 0 : doc.document.createElement("div");
|
|
27
|
-
const root = createRoot(el);
|
|
28
|
-
return { el, root };
|
|
29
|
-
}, [options.autoMount]);
|
|
30
|
-
const container = () => {
|
|
31
|
-
const container = (options === null || options === void 0 ? void 0 : options.container) || appRoot;
|
|
32
|
-
if (!container)
|
|
33
|
-
throw new Error(`Container not found for portal. Please ensure that AppRoot is present in the application tree.`);
|
|
34
|
-
return container;
|
|
35
|
-
};
|
|
36
|
-
const mount = () => {
|
|
37
|
-
const cont = container();
|
|
38
|
-
if (!cont.contains(el)) {
|
|
39
|
-
cont.appendChild(el);
|
|
40
|
-
}
|
|
41
|
-
root.render(jsx(AppRoot, { disableRenderar: true, theme: theme.name, CSSCacheId: cacheId, document: doc === null || doc === void 0 ? void 0 : doc.document, children: children }));
|
|
42
|
-
};
|
|
43
|
-
const unmount = () => {
|
|
44
|
-
root.render(null);
|
|
45
|
-
el === null || el === void 0 ? void 0 : el.remove();
|
|
46
|
-
};
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
(mounted && appRoot) ? mount() : unmount();
|
|
49
|
-
}, [mounted, appRoot]);
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
if (mounted && appRoot)
|
|
52
|
-
mount();
|
|
53
|
-
}, [children, appRoot]);
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
return () => {
|
|
56
|
-
unmount();
|
|
57
|
-
};
|
|
58
|
-
}, []);
|
|
59
|
-
return {
|
|
60
|
-
isMount: () => mounted,
|
|
61
|
-
mount: () => setMounted(true),
|
|
62
|
-
unmount: () => setMounted(false)
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { usePortal as default };
|
|
67
|
-
//# sourceMappingURL=usePortal.js.map
|
package/hooks/usePortal.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePortal.js","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\nimport { useDocument } from \"../Document\";\r\nimport AppRoot from \"../AppRoot\";\r\nimport { useCSSCacheId } from \"../css/CSSCacheProvider\";\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 doc = useDocument()\r\n const appRoot = useAppRootElement();\r\n const cacheId = useCSSCacheId()\r\n\r\n const { el, root } = useMemo(() => {\r\n const el = doc?.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(<AppRoot disableRenderar theme={theme.name} CSSCacheId={cacheId} document={doc?.document}>{children}</AppRoot>)\r\n }\r\n\r\n const unmount = () => {\r\n root.render(null)\r\n el?.remove();\r\n }\r\n\r\n useEffect(() => {\r\n (mounted && appRoot) ? mount() : unmount()\r\n }, [mounted, appRoot]);\r\n\r\n useEffect(() => {\r\n if (mounted && appRoot) mount()\r\n }, [children, appRoot]);\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":";;;;;;;;;;;;;;AAcA;AACG;AACA;AACG;;AAEH;AACA;AACA;AACA;AACA;;AAGG;AACA;AACA;AACH;;AAGG;AACA;AAAgB;AAChB;AACH;;AAGG;;AAEG;;AAEH;AACH;;AAGG;AACA;AACH;;AAGG;AACH;;;AAG2B;AAC3B;;AAGG;AACG;AACH;;;AAIA;AACA;AACA;;AAEN;;"}
|