@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.
- package/AppRoot/{context.js → AppRootProvider.cjs} +1 -1
- package/AppRoot/AppRootProvider.cjs.map +1 -0
- package/AppRoot/{context.mjs → AppRootProvider.js} +1 -1
- package/AppRoot/AppRootProvider.js.map +1 -0
- 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 +43 -0
- package/AppRoot/index.cjs.map +1 -0
- package/AppRoot/index.d.ts +2 -2
- package/AppRoot/index.js +24 -106
- 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.cjs.map +1 -0
- package/Iframe/index.d.ts +1 -0
- 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 -13
- package/Tag/useTagProps.cjs.map +1 -0
- package/Tag/useTagProps.js +15 -14
- 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 +43 -0
- package/breakpoint/{BreakpointProvider.mjs.map → BreakpointProvider.cjs.map} +1 -1
- package/breakpoint/BreakpointProvider.js +13 -16
- 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.cjs.map +1 -0
- package/css/CSSCacheProvider.d.ts +7 -0
- package/css/CSSCacheProvider.js +29 -0
- package/css/CSSCacheProvider.js.map +1 -0
- 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} +18 -6
- package/hooks/useAnimation.cjs.map +1 -0
- package/hooks/useAnimation.js +12 -10
- 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 +66 -0
- package/hooks/usePortal.cjs.map +1 -0
- package/hooks/usePortal.js +24 -30
- package/hooks/usePortal.js.map +1 -1
- package/hooks/useTransition/{index.mjs → index.cjs} +29 -25
- package/hooks/useTransition/index.cjs.map +1 -0
- package/hooks/useTransition/index.js +26 -26
- 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.d.ts +3 -2
- package/index.js +25 -60
- package/index.js.map +1 -1
- package/package.json +5 -12
- 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.cjs +154 -0
- package/theme/ThemeProvider.cjs.map +1 -0
- package/theme/ThemeProvider.d.ts +3 -1
- package/theme/ThemeProvider.js +109 -41
- 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/Renderar.mjs +0 -51
- package/AppRoot/Renderar.mjs.map +0 -1
- package/AppRoot/context.js.map +0 -1
- package/AppRoot/context.mjs.map +0 -1
- package/AppRoot/index.mjs +0 -118
- 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/Iframe/index.mjs.map +0 -1
- 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/useBreakpoint.mjs +0 -22
- package/breakpoint/useBreakpointProps.mjs.map +0 -1
- package/css/aliases.mjs.map +0 -1
- package/css/index.mjs.map +0 -1
- package/hooks/useAnimation.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 -25
- package/index.mjs.map +0 -1
- package/theme/ThemeProvider.mjs +0 -44
- 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/AppRoot/{context.d.ts → AppRootProvider.d.ts} +0 -0
package/Transition/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Transition/index.tsx"],"sourcesContent":["\"use client\";\r\nimport React, { cloneElement, Children, useEffect, useState } from 'react';\r\nimport useTransition, { UseTransitionProps } from '../hooks/useTransition';\r\n\r\nexport type TransitionProps = UseTransitionProps & {\r\n children: React.ReactElement;\r\n}\r\n\r\nconst TransitionBase = ({ children, ...options }: TransitionProps) => {\r\n const { props, exited } = useTransition(options);\r\n if (exited) return null;\r\n const clone: any = Children.only(children);\r\n return cloneElement(clone, props);\r\n}\r\n\r\nfunction Transition({ children, ...options }: TransitionProps) {\r\n const [mounted, setMounted] = useState(false);\r\n\r\n useEffect(() => {\r\n setMounted(true);\r\n }, []);\r\n\r\n if (!mounted) return null;\r\n return <TransitionBase {...options} >{children}</TransitionBase>\r\n}\r\n\r\n\r\nexport default Transition"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Transition/index.tsx"],"sourcesContent":["\"use client\";\r\nimport React, { cloneElement, Children, useEffect, useState } from 'react';\r\nimport useTransition, { UseTransitionProps } from '../hooks/useTransition';\r\n\r\nexport type TransitionProps = UseTransitionProps & {\r\n children: React.ReactElement;\r\n}\r\n\r\nconst TransitionBase = ({ children, ...options }: TransitionProps) => {\r\n const { props, exited } = useTransition(options);\r\n if (exited) return null;\r\n const clone: any = Children.only(children);\r\n return cloneElement(clone, props);\r\n}\r\n\r\nfunction Transition({ children, ...options }: TransitionProps) {\r\n const [mounted, setMounted] = useState(false);\r\n\r\n useEffect(() => {\r\n setMounted(true);\r\n }, []);\r\n\r\n if (!mounted) return null;\r\n return <TransitionBase {...options} >{children}</TransitionBase>\r\n}\r\n\r\n\r\nexport default Transition"],"names":[],"mappings":";;;;;;AAQA;AAAwB;;AAEpB;AAAY;;AAEZ;AACJ;AAEA;AAAoB;;;;;AAOhB;AAAc;AACd;AACJ;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var index = require('../css/index.cjs');
|
|
7
|
+
|
|
8
|
+
const BreakpointCtx = React.createContext("xs");
|
|
9
|
+
/**
|
|
10
|
+
* SSR-safe breakpoint detection
|
|
11
|
+
*/
|
|
12
|
+
const getKey = () => {
|
|
13
|
+
if (typeof window === 'undefined') {
|
|
14
|
+
return "xl";
|
|
15
|
+
}
|
|
16
|
+
const width = window.innerWidth;
|
|
17
|
+
if (width < index.breakpoints.sm)
|
|
18
|
+
return "xs";
|
|
19
|
+
if (width < index.breakpoints.md)
|
|
20
|
+
return "sm";
|
|
21
|
+
if (width < index.breakpoints.lg)
|
|
22
|
+
return "md";
|
|
23
|
+
if (width < index.breakpoints.xl)
|
|
24
|
+
return "lg";
|
|
25
|
+
return "xl";
|
|
26
|
+
};
|
|
27
|
+
const BreakpointProvider = ({ children }) => {
|
|
28
|
+
const [current, setCurrent] = React.useState("xl");
|
|
29
|
+
const handler = React.useCallback(() => {
|
|
30
|
+
const newKey = getKey();
|
|
31
|
+
setCurrent(prev => (prev === newKey ? prev : newKey));
|
|
32
|
+
}, []);
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
window.addEventListener("resize", handler);
|
|
35
|
+
handler(); // detect on mount
|
|
36
|
+
return () => window.removeEventListener("resize", handler);
|
|
37
|
+
}, [handler]);
|
|
38
|
+
return (jsxRuntime.jsx(BreakpointCtx.Provider, { value: current, children: children }));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.BreakpointCtx = BreakpointCtx;
|
|
42
|
+
exports.BreakpointProvider = BreakpointProvider;
|
|
43
|
+
//# sourceMappingURL=BreakpointProvider.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreakpointProvider.
|
|
1
|
+
{"version":3,"file":"BreakpointProvider.cjs","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,11 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React__default, { useState, useCallback } from 'react';
|
|
4
|
+
import { breakpoints } from '../css/index.js';
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var index = require('../css/index.js');
|
|
7
|
-
|
|
8
|
-
const BreakpointCtx = React.createContext("xs");
|
|
6
|
+
const BreakpointCtx = React__default.createContext("xs");
|
|
9
7
|
/**
|
|
10
8
|
* SSR-safe breakpoint detection
|
|
11
9
|
*/
|
|
@@ -14,30 +12,29 @@ const getKey = () => {
|
|
|
14
12
|
return "xl";
|
|
15
13
|
}
|
|
16
14
|
const width = window.innerWidth;
|
|
17
|
-
if (width <
|
|
15
|
+
if (width < breakpoints.sm)
|
|
18
16
|
return "xs";
|
|
19
|
-
if (width <
|
|
17
|
+
if (width < breakpoints.md)
|
|
20
18
|
return "sm";
|
|
21
|
-
if (width <
|
|
19
|
+
if (width < breakpoints.lg)
|
|
22
20
|
return "md";
|
|
23
|
-
if (width <
|
|
21
|
+
if (width < breakpoints.xl)
|
|
24
22
|
return "lg";
|
|
25
23
|
return "xl";
|
|
26
24
|
};
|
|
27
25
|
const BreakpointProvider = ({ children }) => {
|
|
28
|
-
const [current, setCurrent] =
|
|
29
|
-
const handler =
|
|
26
|
+
const [current, setCurrent] = useState("xl");
|
|
27
|
+
const handler = useCallback(() => {
|
|
30
28
|
const newKey = getKey();
|
|
31
29
|
setCurrent(prev => (prev === newKey ? prev : newKey));
|
|
32
30
|
}, []);
|
|
33
|
-
|
|
31
|
+
React__default.useEffect(() => {
|
|
34
32
|
window.addEventListener("resize", handler);
|
|
35
33
|
handler(); // detect on mount
|
|
36
34
|
return () => window.removeEventListener("resize", handler);
|
|
37
35
|
}, [handler]);
|
|
38
|
-
return (
|
|
36
|
+
return (jsx(BreakpointCtx.Provider, { value: current, children: children }));
|
|
39
37
|
};
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
exports.BreakpointProvider = BreakpointProvider;
|
|
39
|
+
export { BreakpointCtx, BreakpointProvider };
|
|
43
40
|
//# sourceMappingURL=BreakpointProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreakpointProvider.js","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":"
|
|
1
|
+
{"version":3,"file":"BreakpointProvider.js","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;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var BreakpointProvider = require('./BreakpointProvider.cjs');
|
|
5
|
+
var index = require('../css/index.cjs');
|
|
6
|
+
|
|
7
|
+
const useBreakpoint = () => {
|
|
8
|
+
const value = React.useContext(BreakpointProvider.BreakpointCtx);
|
|
9
|
+
const getWidth = () => typeof window !== 'undefined' ? window.innerWidth : 99999;
|
|
10
|
+
const is = (key) => value === key;
|
|
11
|
+
const isUp = (key) => getWidth() >= index.breakpoints[key];
|
|
12
|
+
const isDown = (key) => getWidth() < index.breakpoints[key];
|
|
13
|
+
return {
|
|
14
|
+
value,
|
|
15
|
+
is,
|
|
16
|
+
isUp,
|
|
17
|
+
isDown,
|
|
18
|
+
isOrUp: (key) => is(key) || isUp(key),
|
|
19
|
+
isOrDown: (key) => is(key) || isDown(key)
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
module.exports = useBreakpoint;
|
|
24
|
+
//# sourceMappingURL=useBreakpoint.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpoint.
|
|
1
|
+
{"version":3,"file":"useBreakpoint.cjs","sources":["../../src/breakpoint/useBreakpoint.ts"],"sourcesContent":["import { useContext } from \"react\"\r\nimport { BreakpointCtx } from \"./BreakpointProvider\"\r\nimport { breakpoints } from \"../css\"\r\nimport { BreakpointKeys } from \"../css/types\"\r\n\r\nconst useBreakpoint = () => {\r\n const value = useContext(BreakpointCtx)\r\n const getWidth = () => typeof window !== 'undefined' ? window.innerWidth : 99999\r\n const is = (key: BreakpointKeys) => value === key\r\n const isUp = (key: BreakpointKeys) => getWidth() >= breakpoints[key]\r\n const isDown = (key: BreakpointKeys) => getWidth() < breakpoints[key]\r\n\r\n return {\r\n value,\r\n is,\r\n isUp,\r\n isDown,\r\n isOrUp: (key: BreakpointKeys) => is(key) || isUp(key),\r\n isOrDown: (key: BreakpointKeys) => is(key) || isDown(key)\r\n }\r\n}\r\n\r\nexport default useBreakpoint\r\n"],"names":["useContext","BreakpointCtx","breakpoints"],"mappings":";;;;;;AAKA,MAAM,aAAa,GAAG,MAAK;AACxB,IAAA,MAAM,KAAK,GAAGA,gBAAU,CAACC,gCAAa,CAAC;AACvC,IAAA,MAAM,QAAQ,GAAG,MAAM,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,CAAC,UAAU,GAAG,KAAK;IAChF,MAAM,EAAE,GAAG,CAAC,GAAmB,KAAK,KAAK,KAAK,GAAG;AACjD,IAAA,MAAM,IAAI,GAAG,CAAC,GAAmB,KAAK,QAAQ,EAAE,IAAIC,iBAAW,CAAC,GAAG,CAAC;AACpE,IAAA,MAAM,MAAM,GAAG,CAAC,GAAmB,KAAK,QAAQ,EAAE,GAAGA,iBAAW,CAAC,GAAG,CAAC;IAErE,OAAO;QACJ,KAAK;QACL,EAAE;QACF,IAAI;QACJ,MAAM;AACN,QAAA,MAAM,EAAE,CAAC,GAAmB,KAAK,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC;AACrD,QAAA,QAAQ,EAAE,CAAC,GAAmB,KAAK,EAAE,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG;KAC1D;AACJ;;;;"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var BreakpointProvider = require('./BreakpointProvider.js');
|
|
5
|
-
var index = require('../css/index.js');
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { BreakpointCtx } from './BreakpointProvider.js';
|
|
3
|
+
import { breakpoints } from '../css/index.js';
|
|
6
4
|
|
|
7
5
|
const useBreakpoint = () => {
|
|
8
|
-
const value =
|
|
6
|
+
const value = useContext(BreakpointCtx);
|
|
9
7
|
const getWidth = () => typeof window !== 'undefined' ? window.innerWidth : 99999;
|
|
10
8
|
const is = (key) => value === key;
|
|
11
|
-
const isUp = (key) => getWidth() >=
|
|
12
|
-
const isDown = (key) => getWidth() <
|
|
9
|
+
const isUp = (key) => getWidth() >= breakpoints[key];
|
|
10
|
+
const isDown = (key) => getWidth() < breakpoints[key];
|
|
13
11
|
return {
|
|
14
12
|
value,
|
|
15
13
|
is,
|
|
@@ -20,5 +18,5 @@ const useBreakpoint = () => {
|
|
|
20
18
|
};
|
|
21
19
|
};
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
export { useBreakpoint as default };
|
|
24
22
|
//# sourceMappingURL=useBreakpoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpoint.js","sources":["../../src/breakpoint/useBreakpoint.ts"],"sourcesContent":["import { useContext } from \"react\"\r\nimport { BreakpointCtx } from \"./BreakpointProvider\"\r\nimport { breakpoints } from \"../css\"\r\nimport { BreakpointKeys } from \"../css/types\"\r\n\r\nconst useBreakpoint = () => {\r\n const value = useContext(BreakpointCtx)\r\n const getWidth = () => typeof window !== 'undefined' ? window.innerWidth : 99999\r\n const is = (key: BreakpointKeys) => value === key\r\n const isUp = (key: BreakpointKeys) => getWidth() >= breakpoints[key]\r\n const isDown = (key: BreakpointKeys) => getWidth() < breakpoints[key]\r\n\r\n return {\r\n value,\r\n is,\r\n isUp,\r\n isDown,\r\n isOrUp: (key: BreakpointKeys) => is(key) || isUp(key),\r\n isOrDown: (key: BreakpointKeys) => is(key) || isDown(key)\r\n }\r\n}\r\n\r\nexport default useBreakpoint\r\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useBreakpoint.js","sources":["../../src/breakpoint/useBreakpoint.ts"],"sourcesContent":["import { useContext } from \"react\"\r\nimport { BreakpointCtx } from \"./BreakpointProvider\"\r\nimport { breakpoints } from \"../css\"\r\nimport { BreakpointKeys } from \"../css/types\"\r\n\r\nconst useBreakpoint = () => {\r\n const value = useContext(BreakpointCtx)\r\n const getWidth = () => typeof window !== 'undefined' ? window.innerWidth : 99999\r\n const is = (key: BreakpointKeys) => value === key\r\n const isUp = (key: BreakpointKeys) => getWidth() >= breakpoints[key]\r\n const isDown = (key: BreakpointKeys) => getWidth() < breakpoints[key]\r\n\r\n return {\r\n value,\r\n is,\r\n isUp,\r\n isDown,\r\n isOrUp: (key: BreakpointKeys) => is(key) || isUp(key),\r\n isOrDown: (key: BreakpointKeys) => is(key) || isDown(key)\r\n }\r\n}\r\n\r\nexport default useBreakpoint\r\n"],"names":[],"mappings":";;;;AAKA,MAAM,aAAa,GAAG,MAAK;AACxB,IAAA,MAAM,KAAK,GAAG,UAAU,CAAC,aAAa,CAAC;AACvC,IAAA,MAAM,QAAQ,GAAG,MAAM,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,CAAC,UAAU,GAAG,KAAK;IAChF,MAAM,EAAE,GAAG,CAAC,GAAmB,KAAK,KAAK,KAAK,GAAG;AACjD,IAAA,MAAM,IAAI,GAAG,CAAC,GAAmB,KAAK,QAAQ,EAAE,IAAI,WAAW,CAAC,GAAG,CAAC;AACpE,IAAA,MAAM,MAAM,GAAG,CAAC,GAAmB,KAAK,QAAQ,EAAE,GAAG,WAAW,CAAC,GAAG,CAAC;IAErE,OAAO;QACJ,KAAK;QACL,EAAE;QACF,IAAI;QACJ,MAAM;AACN,QAAA,MAAM,EAAE,CAAC,GAAmB,KAAK,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC;AACrD,QAAA,QAAQ,EAAE,CAAC,GAAmB,KAAK,EAAE,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG;KAC1D;AACJ;;;;"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var useBreakpoint = require('./useBreakpoint.cjs');
|
|
3
5
|
|
|
4
6
|
const useBreakpointProps = (props) => {
|
|
5
7
|
const bpoint = useBreakpoint();
|
|
6
8
|
const cachekey = JSON.stringify(props, (key, value) => {
|
|
7
9
|
return key === '_owner' || key === '_store' ? undefined : value;
|
|
8
10
|
}, 2);
|
|
9
|
-
const bprops = useMemo(() => {
|
|
11
|
+
const bprops = React.useMemo(() => {
|
|
10
12
|
let bprops = [];
|
|
11
13
|
let bkeys = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
12
14
|
for (let prop in props) {
|
|
13
15
|
let val = props[prop];
|
|
14
|
-
if (!isValidElement(val) && typeof val === 'object' && val !== null && Object.keys(val).some(k => bkeys.includes(k))) {
|
|
16
|
+
if (!React.isValidElement(val) && typeof val === 'object' && val !== null && Object.keys(val).some(k => bkeys.includes(k))) {
|
|
15
17
|
bprops.push(prop);
|
|
16
18
|
}
|
|
17
19
|
}
|
|
@@ -43,5 +45,5 @@ const useBreakpointProps = (props) => {
|
|
|
43
45
|
return Object.assign(Object.assign({}, props), _props);
|
|
44
46
|
};
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=useBreakpointProps.
|
|
48
|
+
module.exports = useBreakpointProps;
|
|
49
|
+
//# sourceMappingURL=useBreakpointProps.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBreakpointProps.cjs","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":["useMemo","isValidElement"],"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,GAAGA,aAAO,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,CAACC,oBAAc,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;AACnH,gBAAA,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;YACpB;QACH;AACA,QAAA,OAAO,MAAM;AAChB,IAAA,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAGd,IAAA,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK;AAErC,IAAA,MAAM,MAAM,GAAQ;AACjB,QAAA,EAAE,EAAE,EAAE;AACN,QAAA,EAAE,EAAE,EAAE;AACN,QAAA,EAAE,EAAE,EAAE;AACN,QAAA,EAAE,EAAE,EAAE;AACN,QAAA,EAAE,EAAE;KACN;AAED,IAAA,KAAK,IAAI,IAAI,IAAI,MAAM,EAAE;AACtB,QAAA,IAAI,GAAG,GAAI,KAAa,CAAC,IAAI,CAAC;AAC9B,QAAA,KAAK,IAAI,EAAE,IAAI,GAAG,EAAE;YACjB,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC;QAC7B;IACH;AAEA,IAAA,IAAI,MAAM,GAAG,MAAM,CAAC,EAAE,IAAI,EAAE;AAC5B,IAAA,KAAK,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;AACvC,QAAA,IAAI,MAAM,CAAC,MAAM,CAAC,GAAU,CAAC;YAAE;AAC/B,QAAA,IAAI,MAAM,CAAC,MAAM,CAAC,GAAU,CAAC,EAAE;YAC5B,MAAM,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAQ,MAAM,CAAA,EAAK,MAAM,CAAC,GAAG,CAAC,CAAE;QACzC;IACH;IAEA,OAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACM,KAAK,CAAA,EACL,MAAM,CAAA;AAEf;;;;"}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var useBreakpoint = require('./useBreakpoint.js');
|
|
1
|
+
import { useMemo, isValidElement } from 'react';
|
|
2
|
+
import useBreakpoint from './useBreakpoint.js';
|
|
5
3
|
|
|
6
4
|
const useBreakpointProps = (props) => {
|
|
7
5
|
const bpoint = useBreakpoint();
|
|
8
6
|
const cachekey = JSON.stringify(props, (key, value) => {
|
|
9
7
|
return key === '_owner' || key === '_store' ? undefined : value;
|
|
10
8
|
}, 2);
|
|
11
|
-
const bprops =
|
|
9
|
+
const bprops = useMemo(() => {
|
|
12
10
|
let bprops = [];
|
|
13
11
|
let bkeys = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
14
12
|
for (let prop in props) {
|
|
15
13
|
let val = props[prop];
|
|
16
|
-
if (!
|
|
14
|
+
if (!isValidElement(val) && typeof val === 'object' && val !== null && Object.keys(val).some(k => bkeys.includes(k))) {
|
|
17
15
|
bprops.push(prop);
|
|
18
16
|
}
|
|
19
17
|
}
|
|
@@ -45,5 +43,5 @@ const useBreakpointProps = (props) => {
|
|
|
45
43
|
return Object.assign(Object.assign({}, props), _props);
|
|
46
44
|
};
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
export { useBreakpointProps as default };
|
|
49
47
|
//# sourceMappingURL=useBreakpointProps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpointProps.js","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":[
|
|
1
|
+
{"version":3,"file":"useBreakpointProps.js","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,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;AACnH,gBAAA,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;YACpB;QACH;AACA,QAAA,OAAO,MAAM;AAChB,IAAA,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAGd,IAAA,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK;AAErC,IAAA,MAAM,MAAM,GAAQ;AACjB,QAAA,EAAE,EAAE,EAAE;AACN,QAAA,EAAE,EAAE,EAAE;AACN,QAAA,EAAE,EAAE,EAAE;AACN,QAAA,EAAE,EAAE,EAAE;AACN,QAAA,EAAE,EAAE;KACN;AAED,IAAA,KAAK,IAAI,IAAI,IAAI,MAAM,EAAE;AACtB,QAAA,IAAI,GAAG,GAAI,KAAa,CAAC,IAAI,CAAC;AAC9B,QAAA,KAAK,IAAI,EAAE,IAAI,GAAG,EAAE;YACjB,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC;QAC7B;IACH;AAEA,IAAA,IAAI,MAAM,GAAG,MAAM,CAAC,EAAE,IAAI,EAAE;AAC5B,IAAA,KAAK,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;AACvC,QAAA,IAAI,MAAM,CAAC,MAAM,CAAC,GAAU,CAAC;YAAE;AAC/B,QAAA,IAAI,MAAM,CAAC,MAAM,CAAC,GAAU,CAAC,EAAE;YAC5B,MAAM,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAQ,MAAM,CAAA,EAAK,MAAM,CAAC,GAAG,CAAC,CAAE;QACzC;IACH;IAEA,OAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACM,KAAK,CAAA,EACL,MAAM,CAAA;AAEf;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var oncss = require('oncss');
|
|
6
|
+
|
|
7
|
+
const CSSCacheContext = React.createContext(null);
|
|
8
|
+
const CSSCacheProvider = ({ cacheId, children }) => {
|
|
9
|
+
return (jsxRuntime.jsx(CSSCacheContext.Provider, { value: cacheId, children: children }));
|
|
10
|
+
};
|
|
11
|
+
const useCSSCacheId = () => {
|
|
12
|
+
return React.useContext(CSSCacheContext);
|
|
13
|
+
};
|
|
14
|
+
const useCSSCache = () => {
|
|
15
|
+
const cacheId = React.useContext(CSSCacheContext);
|
|
16
|
+
if (typeof window === 'undefined') {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const caches = oncss.ONCSS_CACHE.caches();
|
|
20
|
+
return {
|
|
21
|
+
cacheId,
|
|
22
|
+
cache: caches.get(cacheId)
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const getCSSCache = (cacheId) => {
|
|
26
|
+
const caches = oncss.ONCSS_CACHE.caches();
|
|
27
|
+
return caches.get(cacheId);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.CSSCacheProvider = CSSCacheProvider;
|
|
31
|
+
exports.getCSSCache = getCSSCache;
|
|
32
|
+
exports.useCSSCache = useCSSCache;
|
|
33
|
+
exports.useCSSCacheId = useCSSCacheId;
|
|
34
|
+
//# sourceMappingURL=CSSCacheProvider.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CSSCacheProvider.cjs","sources":["../../src/css/CSSCacheProvider.tsx"],"sourcesContent":["import React from \"react\";\r\nimport { ONCSS_CACHE } from 'oncss'\r\n\r\nconst CSSCacheContext = React.createContext<string | null>(null);\r\n\r\nexport const CSSCacheProvider: React.FC<{ cacheId: string | null; children: React.ReactNode }> = ({ cacheId, children }) => {\r\n return (\r\n <CSSCacheContext.Provider value={cacheId}>\r\n {children}\r\n </CSSCacheContext.Provider>\r\n );\r\n}\r\n\r\nexport const useCSSCacheId = () => {\r\n return React.useContext(CSSCacheContext) as string\r\n}\r\n\r\nexport const useCSSCache = () => {\r\n const cacheId = React.useContext(CSSCacheContext);\r\n if (typeof window === 'undefined') {\r\n return null as any;\r\n }\r\n const caches = ONCSS_CACHE.caches()\r\n\r\n return {\r\n cacheId,\r\n cache: caches.get(cacheId!)\r\n }\r\n}\r\n\r\nexport const getCSSCache = (cacheId: string) => {\r\n const caches = ONCSS_CACHE.caches()\r\n return caches.get(cacheId)\r\n}"],"names":["_jsx","ONCSS_CACHE"],"mappings":";;;;;;AAGA,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CAAgB,IAAI,CAAC;AAEzD,MAAM,gBAAgB,GAAoE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAI;AACxH,IAAA,QACGA,cAAA,CAAC,eAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EACpC,QAAQ,EAAA,CACe;AAEjC;AAEO,MAAM,aAAa,GAAG,MAAK;AAC/B,IAAA,OAAO,KAAK,CAAC,UAAU,CAAC,eAAe,CAAW;AACrD;AAEO,MAAM,WAAW,GAAG,MAAK;IAC7B,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC;AACjD,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAChC,QAAA,OAAO,IAAW;IACrB;AACA,IAAA,MAAM,MAAM,GAAGC,iBAAW,CAAC,MAAM,EAAE;IAEnC,OAAO;QACJ,OAAO;AACP,QAAA,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,OAAQ;KAC5B;AACJ;AAEO,MAAM,WAAW,GAAG,CAAC,OAAe,KAAI;AAC5C,IAAA,MAAM,MAAM,GAAGA,iBAAW,CAAC,MAAM,EAAE;AACnC,IAAA,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;AAC7B;;;;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as oncss from 'oncss';
|
|
2
|
+
|
|
3
|
+
declare const useCSSCacheId: () => string;
|
|
4
|
+
declare const useCSSCache: () => any;
|
|
5
|
+
declare const getCSSCache: (cacheId: string) => Map<string, oncss.CSSFactoryType> | undefined;
|
|
6
|
+
|
|
7
|
+
export { getCSSCache, useCSSCache, useCSSCacheId };
|
|
@@ -0,0 +1,29 @@
|
|
|
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.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CSSCacheProvider.js","sources":["../../src/css/CSSCacheProvider.tsx"],"sourcesContent":["import React from \"react\";\r\nimport { ONCSS_CACHE } from 'oncss'\r\n\r\nconst CSSCacheContext = React.createContext<string | null>(null);\r\n\r\nexport const CSSCacheProvider: React.FC<{ cacheId: string | null; children: React.ReactNode }> = ({ cacheId, children }) => {\r\n return (\r\n <CSSCacheContext.Provider value={cacheId}>\r\n {children}\r\n </CSSCacheContext.Provider>\r\n );\r\n}\r\n\r\nexport const useCSSCacheId = () => {\r\n return React.useContext(CSSCacheContext) as string\r\n}\r\n\r\nexport const useCSSCache = () => {\r\n const cacheId = React.useContext(CSSCacheContext);\r\n if (typeof window === 'undefined') {\r\n return null as any;\r\n }\r\n const caches = ONCSS_CACHE.caches()\r\n\r\n return {\r\n cacheId,\r\n cache: caches.get(cacheId!)\r\n }\r\n}\r\n\r\nexport const getCSSCache = (cacheId: string) => {\r\n const caches = ONCSS_CACHE.caches()\r\n return caches.get(cacheId)\r\n}"],"names":["React","_jsx"],"mappings":";;;;AAGA,MAAM,eAAe,GAAGA,cAAK,CAAC,aAAa,CAAgB,IAAI,CAAC;AAEzD,MAAM,gBAAgB,GAAoE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAI;AACxH,IAAA,QACGC,GAAA,CAAC,eAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EACpC,QAAQ,EAAA,CACe;AAEjC;AAEO,MAAM,aAAa,GAAG,MAAK;AAC/B,IAAA,OAAOD,cAAK,CAAC,UAAU,CAAC,eAAe,CAAW;AACrD;AAEO,MAAM,WAAW,GAAG,MAAK;IAC7B,MAAM,OAAO,GAAGA,cAAK,CAAC,UAAU,CAAC,eAAe,CAAC;AACjD,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAChC,QAAA,OAAO,IAAW;IACrB;AACA,IAAA,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE;IAEnC,OAAO;QACJ,OAAO;AACP,QAAA,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,OAAQ;KAC5B;AACJ;AAEO,MAAM,WAAW,GAAG,CAAC,OAAe,KAAI;AAC5C,IAAA,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE;AACnC,IAAA,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;AAC7B;;;;"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
const isStr = (v, or) => typeof v === 'string' ? v : or;
|
|
2
4
|
const aliases = {
|
|
3
5
|
bgcolor: (v) => ({ backgroundColor: v }),
|
|
@@ -28,5 +30,5 @@ const aliases = {
|
|
|
28
30
|
gap: (v) => ({ gap: isStr(v, 8 * v) }),
|
|
29
31
|
};
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
//# sourceMappingURL=aliases.
|
|
33
|
+
module.exports = aliases;
|
|
34
|
+
//# sourceMappingURL=aliases.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aliases.cjs","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,GAAG,EAAE;AAEjE,MAAM,OAAO,GAA2B;AACrC,IAAA,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,CAAA,IAAA,EAAO,CAAC,CAAA,CAAA,CAAG,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC;AAC1G,IAAA,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;AAC9B,IAAA,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;AACxC,IAAA,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;AAC5C,IAAA,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;A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,CAAC;AAC3F,IAAA,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;;"}
|
package/css/aliases.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
const isStr = (v, or) => typeof v === 'string' ? v : or;
|
|
4
2
|
const aliases = {
|
|
5
3
|
bgcolor: (v) => ({ backgroundColor: v }),
|
|
@@ -30,5 +28,5 @@ const aliases = {
|
|
|
30
28
|
gap: (v) => ({ gap: isStr(v, 8 * v) }),
|
|
31
29
|
};
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
export { aliases as default };
|
|
34
32
|
//# sourceMappingURL=aliases.js.map
|
package/css/aliases.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aliases.js","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":"
|
|
1
|
+
{"version":3,"file":"aliases.js","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,GAAG,EAAE;AAEjE,MAAM,OAAO,GAA2B;AACrC,IAAA,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,CAAA,IAAA,EAAO,CAAC,CAAA,CAAA,CAAG,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC;AAC1G,IAAA,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,UA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AAa,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;;;;;"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
const getProps = (prop, value, _css) => {
|
|
2
4
|
if (typeof value === 'string') {
|
|
3
5
|
const split = value.split("!");
|
|
@@ -50,5 +52,5 @@ const getProps = (prop, value, _css) => {
|
|
|
50
52
|
// }
|
|
51
53
|
};
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
//# sourceMappingURL=getProps.
|
|
55
|
+
module.exports = getProps;
|
|
56
|
+
//# sourceMappingURL=getProps.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProps.
|
|
1
|
+
{"version":3,"file":"getProps.cjs","sources":["../../src/css/getProps.ts"],"sourcesContent":["import { CSSProps } from \"./types\";\r\n\r\nconst getProps = (prop: string, value: string, _css: CSSProps) => {\r\n let important;\r\n if (typeof value === 'string') {\r\n const split = value.split(\"!\")\r\n important = split[1] ? \"!important\" : \"\"\r\n value = split[0]\r\n }\r\n\r\n if (prop === 'disabled') {\r\n if ((value as any) === true) {\r\n let c: any = {\r\n pointerEvents: \"none!important\",\r\n cursor: \"default!important\",\r\n userSelect: \"none!important\",\r\n opacity: \"0.5!important\",\r\n color: `text.primary!important`,\r\n borderColor: `divider.secondary!important`,\r\n }\r\n\r\n if ((_css as any).bgcolor && (_css as any).bgcolor !== 'transparent') {\r\n c.bgcolor = `divider.primary!important`\r\n }\r\n return c\r\n }\r\n return {}\r\n }\r\n\r\n\r\n if (prop === \"spacing\" && typeof value === \"number\") {\r\n const val = value * 8;\r\n const hasWidth = \"width\" in _css;\r\n const width = `calc(${hasWidth ? _css.width : \"100%\"} + ${val}px)`;\r\n return {\r\n marginLeft: `-${val}px`,\r\n marginTop: `-${val}px`,\r\n width: width,\r\n\r\n \"& > *\": {\r\n paddingLeft: `${val}px`,\r\n paddingTop: `${val}px`,\r\n },\r\n } as any;\r\n }\r\n\r\n\r\n\r\n // if (value && typeof value === \"number\" && [\"border\", \"borderRight\", \"borderLeft\", \"borderTop\", \"borderBottom\"].includes(prop as any)) {\r\n // const keys: any = Object.keys(_css)\r\n // let p: any = {\r\n // [`${prop}Width`]: value + 'px' + (important || \"\"),\r\n // }\r\n // // if (!keys.includes(`${prop}Color`)) {\r\n // // p[`${prop}Color`] = \"divider.primary\"\r\n // // }\r\n // if (!keys.includes(`${prop}Style`)) {\r\n // p[`${prop}Style`] = \"solid\"\r\n // }\r\n // return p\r\n // }\r\n}\r\n\r\nexport default getProps"],"names":[],"mappings":";;AAEA,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,IAAc,KAAI;AAE7D,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;AAC9B,QAAY,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,EAAE;AACxC,QAAA,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;IACpB;AAEA,IAAA,IAAI,IAAI,KAAK,UAAU,EAAE;AACrB,QAAA,IAAK,KAAa,KAAK,IAAI,EAAE;AACzB,YAAA,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
const split = value.split("!");
|
|
@@ -52,5 +50,5 @@ const getProps = (prop, value, _css) => {
|
|
|
52
50
|
// }
|
|
53
51
|
};
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
export { getProps as default };
|
|
56
54
|
//# sourceMappingURL=getProps.js.map
|
package/css/getProps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProps.js","sources":["../../src/css/getProps.ts"],"sourcesContent":["import { CSSProps } from \"./types\";\r\n\r\nconst getProps = (prop: string, value: string, _css: CSSProps) => {\r\n let important;\r\n if (typeof value === 'string') {\r\n const split = value.split(\"!\")\r\n important = split[1] ? \"!important\" : \"\"\r\n value = split[0]\r\n }\r\n\r\n if (prop === 'disabled') {\r\n if ((value as any) === true) {\r\n let c: any = {\r\n pointerEvents: \"none!important\",\r\n cursor: \"default!important\",\r\n userSelect: \"none!important\",\r\n opacity: \"0.5!important\",\r\n color: `text.primary!important`,\r\n borderColor: `divider.secondary!important`,\r\n }\r\n\r\n if ((_css as any).bgcolor && (_css as any).bgcolor !== 'transparent') {\r\n c.bgcolor = `divider.primary!important`\r\n }\r\n return c\r\n }\r\n return {}\r\n }\r\n\r\n\r\n if (prop === \"spacing\" && typeof value === \"number\") {\r\n const val = value * 8;\r\n const hasWidth = \"width\" in _css;\r\n const width = `calc(${hasWidth ? _css.width : \"100%\"} + ${val}px)`;\r\n return {\r\n marginLeft: `-${val}px`,\r\n marginTop: `-${val}px`,\r\n width: width,\r\n\r\n \"& > *\": {\r\n paddingLeft: `${val}px`,\r\n paddingTop: `${val}px`,\r\n },\r\n } as any;\r\n }\r\n\r\n\r\n\r\n // if (value && typeof value === \"number\" && [\"border\", \"borderRight\", \"borderLeft\", \"borderTop\", \"borderBottom\"].includes(prop as any)) {\r\n // const keys: any = Object.keys(_css)\r\n // let p: any = {\r\n // [`${prop}Width`]: value + 'px' + (important || \"\"),\r\n // }\r\n // // if (!keys.includes(`${prop}Color`)) {\r\n // // p[`${prop}Color`] = \"divider.primary\"\r\n // // }\r\n // if (!keys.includes(`${prop}Style`)) {\r\n // p[`${prop}Style`] = \"solid\"\r\n // }\r\n // return p\r\n // }\r\n}\r\n\r\nexport default getProps"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getProps.js","sources":["../../src/css/getProps.ts"],"sourcesContent":["import { CSSProps } from \"./types\";\r\n\r\nconst getProps = (prop: string, value: string, _css: CSSProps) => {\r\n let important;\r\n if (typeof value === 'string') {\r\n const split = value.split(\"!\")\r\n important = split[1] ? \"!important\" : \"\"\r\n value = split[0]\r\n }\r\n\r\n if (prop === 'disabled') {\r\n if ((value as any) === true) {\r\n let c: any = {\r\n pointerEvents: \"none!important\",\r\n cursor: \"default!important\",\r\n userSelect: \"none!important\",\r\n opacity: \"0.5!important\",\r\n color: `text.primary!important`,\r\n borderColor: `divider.secondary!important`,\r\n }\r\n\r\n if ((_css as any).bgcolor && (_css as any).bgcolor !== 'transparent') {\r\n c.bgcolor = `divider.primary!important`\r\n }\r\n return c\r\n }\r\n return {}\r\n }\r\n\r\n\r\n if (prop === \"spacing\" && typeof value === \"number\") {\r\n const val = value * 8;\r\n const hasWidth = \"width\" in _css;\r\n const width = `calc(${hasWidth ? _css.width : \"100%\"} + ${val}px)`;\r\n return {\r\n marginLeft: `-${val}px`,\r\n marginTop: `-${val}px`,\r\n width: width,\r\n\r\n \"& > *\": {\r\n paddingLeft: `${val}px`,\r\n paddingTop: `${val}px`,\r\n },\r\n } as any;\r\n }\r\n\r\n\r\n\r\n // if (value && typeof value === \"number\" && [\"border\", \"borderRight\", \"borderLeft\", \"borderTop\", \"borderBottom\"].includes(prop as any)) {\r\n // const keys: any = Object.keys(_css)\r\n // let p: any = {\r\n // [`${prop}Width`]: value + 'px' + (important || \"\"),\r\n // }\r\n // // if (!keys.includes(`${prop}Color`)) {\r\n // // p[`${prop}Color`] = \"divider.primary\"\r\n // // }\r\n // if (!keys.includes(`${prop}Style`)) {\r\n // p[`${prop}Style`] = \"solid\"\r\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AG,CAAA,EAAA,CAAI;YACvB,SAAS,EAAE,CAAA,CAAA,EAAI,GAAG,CAAA,EAAA,CAAI;AACtB,YAAA,KAAK,EAAE,KAAK;AAEZ,YAAA,OAAO,EAAE;gBACL,WAAW,EAAE,CAAA,EAAG,GAAG,CAAA,EAAA,CAAI;gBACvB,UAAU,EAAE,CAAA,EAAG,GAAG,CAAA,EAAA,CAAI;AACzB,aAAA;SACG;IACZ;;;;;;;;;;;;;;AAiBJ;;;;"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
const getColor = (color, hasText = true) => {
|
|
2
4
|
const i = {
|
|
3
5
|
[`${color}`]: `var(--color-${color}-primary)`,
|
|
@@ -96,5 +98,5 @@ const getValue = (prop, value, _css) => {
|
|
|
96
98
|
return withImportant(important, colors[value] || value);
|
|
97
99
|
};
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
//# sourceMappingURL=getValue.
|
|
101
|
+
module.exports = getValue;
|
|
102
|
+
//# sourceMappingURL=getValue.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getValue.
|
|
1
|
+
{"version":3,"file":"getValue.cjs","sources":["../../src/css/getValue.ts"],"sourcesContent":["import { CSSProps } from \"./types\"\r\n\r\nconst getColor = (color: string, hasText = true) => {\r\n const i = {\r\n [`${color}`]: `var(--color-${color}-primary)`,\r\n [`${color}.primary`]: `var(--color-${color}-primary)`,\r\n [`${color}.secondary`]: `var(--color-${color}-secondary)`,\r\n [`${color}.soft.primary`]: `var(--color-${color}-soft-primary)`,\r\n [`${color}.soft.secondary`]: `var(--color-${color}-soft-secondary)`,\r\n }\r\n if (hasText) {\r\n i[`${color}.text`] = `var(--color-${color}-text)`\r\n }\r\n\r\n return i\r\n}\r\n\r\nconst withImportant = (important: any, value: any) => important ? value + important : value\r\nconst colors: any = {\r\n ...getColor(\"background\", false),\r\n ...getColor(\"text\", false),\r\n ...getColor(\"divider\", false),\r\n ...getColor(\"brand\"),\r\n ...getColor(\"accent\"),\r\n ...getColor(\"info\"),\r\n ...getColor(\"success\"),\r\n ...getColor(\"warning\"),\r\n ...getColor(\"danger\"),\r\n}\r\n\r\nconst breakpoints: any = {\r\n \"xs\": \"var(--bp-xs)\",\r\n \"sm\": \"var(--bp-sm)\",\r\n \"md\": \"var(--bp-md)\",\r\n \"lg\": \"var(--bp-lg)\",\r\n \"xl\": \"var(--bp-xl)\"\r\n}\r\n\r\nlet fontsizes: any = {\r\n \"h1\": \"var(--fontsize-h1)\",\r\n \"h2\": \"var(--fontsize-h2)\",\r\n \"h3\": \"var(--fontsize-h3)\",\r\n \"h4\": \"var(--fontsize-h4)\",\r\n \"h5\": \"var(--fontsize-h5)\",\r\n \"h6\": \"var(--fontsize-h6)\",\r\n \"big\": \"var(--fontsize-big)\",\r\n \"text\": \"var(--fontsize-text)\",\r\n \"button\": \"var(--fontsize-button)\",\r\n \"small\": \"var(--fontsize-small)\"\r\n}\r\n\r\nlet lineHeights: any = {\r\n \"h1\": \"var(--lineheight-h1)\",\r\n \"h2\": \"var(--lineheight-h2)\",\r\n \"h3\": \"var(--lineheight-h3)\",\r\n \"h4\": \"var(--lineheight-h4)\",\r\n \"h5\": \"var(--lineheight-h5)\",\r\n \"h6\": \"var(--lineheight-h6)\",\r\n \"big\": \"var(--lineheight-big)\",\r\n \"text\": \"var(--lineheight-text)\",\r\n \"button\": \"var(--lineheight-button)\",\r\n \"small\": \"var(--lineheight-small)\"\r\n}\r\n\r\nlet fontWeights: any = {\r\n \"h1\": \"var(--fontweight-h1)\",\r\n \"h2\": \"var(--fontweight-h2)\",\r\n \"h3\": \"var(--fontweight-h3)\",\r\n \"h4\": \"var(--fontweight-h4)\",\r\n \"h5\": \"var(--fontweight-h5)\",\r\n \"h6\": \"var(--fontweight-h6)\",\r\n \"big\": \"var(--fontweight-big)\",\r\n \"text\": \"var(--fontweight-text)\",\r\n \"button\": \"var(--fontweight-button)\",\r\n \"small\": \"var(--fontweight-small)\"\r\n}\r\n\r\nlet font: any = {\r\n \"h1\": \"var(--font-h1)\",\r\n \"h2\": \"var(--font-h2)\",\r\n \"h3\": \"var(--font-h3)\",\r\n \"h4\": \"var(--font-h4)\",\r\n \"h5\": \"var(--font-h5)\",\r\n \"h6\": \"var(--font-h6)\",\r\n \"big\": \"var(--font-big)\",\r\n \"text\": \"var(--font-text)\",\r\n \"button\": \"var(--font-button)\",\r\n \"small\": \"var(--font-small)\"\r\n}\r\n\r\nconst getValue = (prop: any, value: string | number, _css: CSSProps): any => {\r\n let important;\r\n\r\n if (typeof value === 'string') {\r\n const split = value.split(\"!\")\r\n important = split[1] ? \"!important\" : \"\"\r\n value = split[0]\r\n }\r\n\r\n\r\n if (['width', 'maxWidth', 'minWidth', 'max-width', 'min-width'].includes(prop)) {\r\n return withImportant(important, breakpoints[value] || value)\r\n } else if (prop === 'font' && typeof value === \"string\" && ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'text', 'button', 'small'].includes(value)) {\r\n return withImportant(important, font[value] || value)\r\n } else if (['fontWeight', 'font-weight'].includes(prop) && typeof value === 'string' && ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'text', 'button', 'small'].includes(value)) {\r\n return withImportant(important, fontWeights[value] || value)\r\n } else if (['lineHeight', 'line-height'].includes(prop) && typeof value === 'string' && ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'text', 'button', 'small'].includes(value)) {\r\n return withImportant(important, lineHeights[value] || value)\r\n } else if (['fontSize', 'font-size'].includes(prop) && typeof value === 'string') {\r\n return withImportant(important, fontsizes[value] || value)\r\n } else if (typeof value === \"number\" && [\"shadow\", \"boxShadow\"].includes(prop)) {\r\n return withImportant(important, `var(--shadow-${value})`)\r\n }\r\n\r\n return withImportant(important, colors[value] || value)\r\n}\r\n\r\nexport default getValue"],"names":[],"mappings":";;AAEA,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,OAAO,GAAG,IAAI,KAAI;AAC/C,IAAA,MAA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AC;IAC7D;IAEA,OAAO,aAAa,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AAC3D;;;;"}
|
package/css/getValue.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
const getColor = (color, hasText = true) => {
|
|
4
2
|
const i = {
|
|
5
3
|
[`${color}`]: `var(--color-${color}-primary)`,
|
|
@@ -98,5 +96,5 @@ const getValue = (prop, value, _css) => {
|
|
|
98
96
|
return withImportant(important, colors[value] || value);
|
|
99
97
|
};
|
|
100
98
|
|
|
101
|
-
|
|
99
|
+
export { getValue as default };
|
|
102
100
|
//# sourceMappingURL=getValue.js.map
|