@xanui/core 1.1.15 → 1.1.17
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/index.d.ts +11 -0
- package/AppRoot/index.js +62 -0
- package/AppRoot/index.js.map +1 -0
- package/AppRoot/index.mjs +62 -0
- package/AppRoot/index.mjs.map +1 -0
- package/Tag/index.js +12 -3
- package/Tag/index.js.map +1 -1
- package/Tag/index.mjs +12 -3
- package/Tag/index.mjs.map +1 -1
- package/Tag/useTagProps.d.ts +7 -1
- package/Tag/useTagProps.js +4 -3
- package/Tag/useTagProps.js.map +1 -1
- package/Tag/useTagProps.mjs +4 -3
- package/Tag/useTagProps.mjs.map +1 -1
- package/Transition/index.d.ts +1 -1
- package/Transition/index.js +1 -1
- package/Transition/index.js.map +1 -1
- package/Transition/index.mjs +1 -1
- package/Transition/index.mjs.map +1 -1
- package/breakpoint/BreakpointProvider.js +1 -3
- package/breakpoint/BreakpointProvider.js.map +1 -1
- package/breakpoint/BreakpointProvider.mjs +1 -3
- package/breakpoint/BreakpointProvider.mjs.map +1 -1
- package/{useAnimation.d.ts → hooks/useAnimation.d.ts} +1 -1
- package/{useAnimation.js → hooks/useAnimation.js} +1 -1
- package/hooks/useAnimation.js.map +1 -0
- package/{useAnimation.mjs → hooks/useAnimation.mjs} +1 -1
- package/hooks/useAnimation.mjs.map +1 -0
- package/{useColorTemplate.js → hooks/useColorTemplate.js} +1 -1
- package/hooks/useColorTemplate.js.map +1 -0
- package/{useColorTemplate.mjs → hooks/useColorTemplate.mjs} +1 -1
- package/hooks/useColorTemplate.mjs.map +1 -0
- package/{useInterface.d.ts → hooks/useInterface.d.ts} +1 -1
- package/{useInterface.js → hooks/useInterface.js} +1 -1
- package/hooks/useInterface.js.map +1 -0
- package/{useInterface.mjs → hooks/useInterface.mjs} +1 -1
- package/hooks/useInterface.mjs.map +1 -0
- package/hooks/usePortal.d.ts +9 -0
- package/hooks/usePortal.js +56 -0
- package/hooks/usePortal.js.map +1 -0
- package/hooks/usePortal.mjs +56 -0
- package/hooks/usePortal.mjs.map +1 -0
- package/{useScrollbar.js → hooks/useScrollbar.js} +1 -1
- package/hooks/useScrollbar.js.map +1 -0
- package/{useScrollbar.mjs → hooks/useScrollbar.mjs} +1 -1
- package/hooks/useScrollbar.mjs.map +1 -0
- package/index.d.ts +11 -8
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/isWindow.d.ts +1 -1
- package/isWindow.js +1 -1
- package/isWindow.js.map +1 -1
- package/isWindow.mjs +1 -1
- package/isWindow.mjs.map +1 -1
- package/package.json +2 -2
- package/theme/ThemeProvider.d.ts +1 -4
- package/theme/ThemeProvider.js +3 -45
- package/theme/ThemeProvider.js.map +1 -1
- package/theme/ThemeProvider.mjs +3 -45
- package/theme/ThemeProvider.mjs.map +1 -1
- package/theme/index.d.ts +3 -0
- package/theme/index.js +1 -0
- package/theme/index.js.map +1 -0
- package/theme/index.mjs +1 -0
- package/theme/index.mjs.map +1 -0
- package/useAnimation.js.map +0 -1
- package/useAnimation.mjs.map +0 -1
- package/useColorTemplate.js.map +0 -1
- package/useColorTemplate.mjs.map +0 -1
- package/useInterface.js.map +0 -1
- package/useInterface.mjs.map +0 -1
- package/useScrollbar.js.map +0 -1
- package/useScrollbar.mjs.map +0 -1
- /package/{useColorTemplate.d.ts → hooks/useColorTemplate.d.ts} +0 -0
- /package/{useScrollbar.d.ts → hooks/useScrollbar.d.ts} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { TagComponentType } from '../Tag/types.js';
|
|
3
|
+
import { ThemeProviderProps } from '../theme/ThemeProvider.js';
|
|
4
|
+
|
|
5
|
+
type AppRootProps<T extends TagComponentType = "div"> = ThemeProviderProps<T> & {
|
|
6
|
+
noScrollbarCss?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const AppRoot: React__default.ForwardRefExoticComponent<Omit<AppRootProps<TagComponentType>, "ref"> & React__default.RefAttributes<any>>;
|
|
9
|
+
|
|
10
|
+
export { AppRoot as default };
|
|
11
|
+
export type { AppRootProps };
|
package/AppRoot/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var tslib=require('tslib'),jsxRuntime=require('react/jsx-runtime'),React=require('react'),index$1=require('../theme/index.js'),BreakpointProvider=require('../breakpoint/BreakpointProvider.js'),index=require('../css/index.js'),useScrollbar=require('../hooks/useScrollbar.js'),ThemeDefaultOptions=require('../theme/ThemeDefaultOptions.js'),createTheme=require('../theme/createTheme.js'),ThemeProvider=require('../theme/ThemeProvider.js');createTheme.createTheme("light", { colors: ThemeDefaultOptions.lightColorPallete });
|
|
2
|
+
createTheme.createTheme("dark", { colors: ThemeDefaultOptions.darkColorPallete });
|
|
3
|
+
const AppRoot = React.forwardRef((_a, ref) => {
|
|
4
|
+
var { children, noScrollbarCss, theme } = _a, props = tslib.__rest(_a, ["children", "noScrollbarCss", "theme"]);
|
|
5
|
+
noScrollbarCss !== null && noScrollbarCss !== void 0 ? noScrollbarCss : (noScrollbarCss = false);
|
|
6
|
+
React.useMemo(() => {
|
|
7
|
+
if (noScrollbarCss)
|
|
8
|
+
return;
|
|
9
|
+
useScrollbar.default({
|
|
10
|
+
themeName: theme,
|
|
11
|
+
root_cls: index$1.themeRootClass(theme)
|
|
12
|
+
});
|
|
13
|
+
}, [noScrollbarCss, theme]);
|
|
14
|
+
React.useMemo(() => {
|
|
15
|
+
index.css({
|
|
16
|
+
"@global": {
|
|
17
|
+
"*": {
|
|
18
|
+
m: 0,
|
|
19
|
+
p: 0,
|
|
20
|
+
outline: "none",
|
|
21
|
+
boxSizing: "border-box",
|
|
22
|
+
verticalAlign: "baseline",
|
|
23
|
+
},
|
|
24
|
+
"html, body": {
|
|
25
|
+
minHeight: "100%",
|
|
26
|
+
"-webkit-font-smoothing": "antialiased"
|
|
27
|
+
},
|
|
28
|
+
"img, picture, video, canvas, svg": {
|
|
29
|
+
maxWidth: "100%",
|
|
30
|
+
display: "block"
|
|
31
|
+
},
|
|
32
|
+
"input, button, textarea, select": {
|
|
33
|
+
font: "inherit"
|
|
34
|
+
},
|
|
35
|
+
"table": {
|
|
36
|
+
borderCollapse: "collapse",
|
|
37
|
+
borderSpacing: 0
|
|
38
|
+
},
|
|
39
|
+
"ol, ul": {
|
|
40
|
+
listStyle: "none"
|
|
41
|
+
},
|
|
42
|
+
"a": {
|
|
43
|
+
display: "inline-block"
|
|
44
|
+
},
|
|
45
|
+
"p, h1, h2, h3, h4, h5, h6": {
|
|
46
|
+
overflowWrap: "break-word",
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}, []);
|
|
51
|
+
React.useEffect(() => {
|
|
52
|
+
// move oncss style tags to head
|
|
53
|
+
if (typeof window === 'undefined')
|
|
54
|
+
return;
|
|
55
|
+
const head = document.getElementsByTagName('head')[0];
|
|
56
|
+
const styles = Array.from(document.querySelectorAll('body style[data-oncss]'));
|
|
57
|
+
styles.forEach((style) => {
|
|
58
|
+
head.appendChild(style);
|
|
59
|
+
});
|
|
60
|
+
}, []);
|
|
61
|
+
return (jsxRuntime.jsx(ThemeProvider.default, Object.assign({ ref: ref, theme: theme }, props, { classNames: [`xui-app-root`], children: jsxRuntime.jsx(BreakpointProvider.BreakpointProvider, { children: children }) })));
|
|
62
|
+
});exports.default=AppRoot;//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\nimport React, { useEffect, useMemo } from 'react';\nimport { TagComponentType } from '../Tag/types';\nimport { createTheme, ThemeProvider, ThemeProviderProps, themeRootClass } from '../theme';\nimport { BreakpointProvider } from '../breakpoint';\nimport useScrollbar from '../hooks/useScrollbar';\nimport { css } from '../css';\nimport { darkColorPallete, lightColorPallete } from '../theme/ThemeDefaultOptions';\n\ncreateTheme(\"light\", { colors: lightColorPallete })\ncreateTheme(\"dark\", { colors: darkColorPallete })\n\nexport type AppRootProps<T extends TagComponentType = \"div\"> = ThemeProviderProps<T> & {\n noScrollbarCss?: boolean;\n}\n\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, noScrollbarCss, theme, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\n noScrollbarCss ??= false\n\n useMemo(() => {\n if (noScrollbarCss) return;\n useScrollbar({\n themeName: theme,\n root_cls: themeRootClass(theme)\n })\n }, [noScrollbarCss, theme])\n\n useMemo(() => {\n css({\n \"@global\": {\n \"*\": {\n m: 0,\n p: 0,\n outline: \"none\",\n boxSizing: \"border-box\",\n verticalAlign: \"baseline\",\n },\n \"html, body\": {\n minHeight: \"100%\",\n \"-webkit-font-smoothing\": \"antialiased\"\n } as any,\n \"img, picture, video, canvas, svg\": {\n maxWidth: \"100%\",\n display: \"block\"\n },\n \"input, button, textarea, select\": {\n font: \"inherit\"\n },\n \"table\": {\n borderCollapse: \"collapse\",\n borderSpacing: 0\n },\n \"ol, ul\": {\n listStyle: \"none\"\n },\n \"a\": {\n display: \"inline-block\"\n },\n \"p, h1, h2, h3, h4, h5, h6\": {\n overflowWrap: \"break-word\",\n }\n }\n })\n }, [])\n\n useEffect(() => {\n // move oncss style tags to head\n if (typeof window === 'undefined') return;\n const head = document.getElementsByTagName('head')[0];\n const styles = Array.from(document.querySelectorAll('body style[data-oncss]'));\n styles.forEach((style) => {\n head.appendChild(style);\n });\n }, [])\n\n return (\n <ThemeProvider\n ref={ref}\n theme={theme}\n {...props}\n classNames={[`xui-app-root`]}\n >\n <BreakpointProvider>\n {children}\n </BreakpointProvider>\n </ThemeProvider>\n )\n})\n\nexport default AppRoot\n\n"],"names":["createTheme","lightColorPallete","darkColorPallete","__rest","useMemo","useScrollbar","themeRootClass","css","useEffect","_jsx","ThemeProvider","BreakpointProvider"],"mappings":"0fASAA,uBAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAEC,qCAAiB,EAA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AAE;AACjB,iBAAA;AACD,gBAAA,QAAQ,EAAE;AACP,oBAAA,SAAS,EAAE;AACb,iBAAA;AACD,gBAAA,GAAG,EAAE;AACF,oBAAA,OAAO,EAAE;AACX,iBAAA;AACD,gBAAA,2BAA2B,EAAE;AAC1B,oBAAA,YAAY,EAAE,YAAY;AAC5B;AACH;AACH,SAAA,CAAC;IACL,CAAC,EAAE,EAAE,CAAC;IAENC,eAAS,CAAC,MAAK;;QAEZ,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE;QACnC,MAAM,IAAI,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACrD,QAAA,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;AAC9E,QAAA,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,KAAI;AACtB,YAAA,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC1B,QAAA,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC;IAEN,QACGC,cAAA,CAACC,qBAAa,EAAA,MAAA,CAAA,MAAA,CAAA,EACX,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EAAA,EACR,KAAK,EAAA,EACT,UAAU,EAAE,CAAC,CAAA,YAAA,CAAc,CAAC,EAAA,QAAA,EAE5BD,cAAA,CAACE,qCAAkB,EAAA,EAAA,QAAA,EACf,QAAQ,EAAA,CACS,EAAA,CAAA,CACR;AAEtB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {__rest}from'tslib';import {jsx}from'react/jsx-runtime';import React__default,{useMemo,useEffect}from'react';import {themeRootClass}from'../theme/index.mjs';import {BreakpointProvider}from'../breakpoint/BreakpointProvider.mjs';import {css}from'../css/index.mjs';import useScrollbar from'../hooks/useScrollbar.mjs';import {lightColorPallete,darkColorPallete}from'../theme/ThemeDefaultOptions.mjs';import {createTheme}from'../theme/createTheme.mjs';import ThemeProvider from'../theme/ThemeProvider.mjs';createTheme("light", { colors: lightColorPallete });
|
|
2
|
+
createTheme("dark", { colors: darkColorPallete });
|
|
3
|
+
const AppRoot = React__default.forwardRef((_a, ref) => {
|
|
4
|
+
var { children, noScrollbarCss, theme } = _a, props = __rest(_a, ["children", "noScrollbarCss", "theme"]);
|
|
5
|
+
noScrollbarCss !== null && noScrollbarCss !== void 0 ? noScrollbarCss : (noScrollbarCss = false);
|
|
6
|
+
useMemo(() => {
|
|
7
|
+
if (noScrollbarCss)
|
|
8
|
+
return;
|
|
9
|
+
useScrollbar({
|
|
10
|
+
themeName: theme,
|
|
11
|
+
root_cls: themeRootClass(theme)
|
|
12
|
+
});
|
|
13
|
+
}, [noScrollbarCss, theme]);
|
|
14
|
+
useMemo(() => {
|
|
15
|
+
css({
|
|
16
|
+
"@global": {
|
|
17
|
+
"*": {
|
|
18
|
+
m: 0,
|
|
19
|
+
p: 0,
|
|
20
|
+
outline: "none",
|
|
21
|
+
boxSizing: "border-box",
|
|
22
|
+
verticalAlign: "baseline",
|
|
23
|
+
},
|
|
24
|
+
"html, body": {
|
|
25
|
+
minHeight: "100%",
|
|
26
|
+
"-webkit-font-smoothing": "antialiased"
|
|
27
|
+
},
|
|
28
|
+
"img, picture, video, canvas, svg": {
|
|
29
|
+
maxWidth: "100%",
|
|
30
|
+
display: "block"
|
|
31
|
+
},
|
|
32
|
+
"input, button, textarea, select": {
|
|
33
|
+
font: "inherit"
|
|
34
|
+
},
|
|
35
|
+
"table": {
|
|
36
|
+
borderCollapse: "collapse",
|
|
37
|
+
borderSpacing: 0
|
|
38
|
+
},
|
|
39
|
+
"ol, ul": {
|
|
40
|
+
listStyle: "none"
|
|
41
|
+
},
|
|
42
|
+
"a": {
|
|
43
|
+
display: "inline-block"
|
|
44
|
+
},
|
|
45
|
+
"p, h1, h2, h3, h4, h5, h6": {
|
|
46
|
+
overflowWrap: "break-word",
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}, []);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
// move oncss style tags to head
|
|
53
|
+
if (typeof window === 'undefined')
|
|
54
|
+
return;
|
|
55
|
+
const head = document.getElementsByTagName('head')[0];
|
|
56
|
+
const styles = Array.from(document.querySelectorAll('body style[data-oncss]'));
|
|
57
|
+
styles.forEach((style) => {
|
|
58
|
+
head.appendChild(style);
|
|
59
|
+
});
|
|
60
|
+
}, []);
|
|
61
|
+
return (jsx(ThemeProvider, Object.assign({ ref: ref, theme: theme }, props, { classNames: [`xui-app-root`], children: jsx(BreakpointProvider, { children: children }) })));
|
|
62
|
+
});export{AppRoot as default};//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\nimport React, { useEffect, useMemo } from 'react';\nimport { TagComponentType } from '../Tag/types';\nimport { createTheme, ThemeProvider, ThemeProviderProps, themeRootClass } from '../theme';\nimport { BreakpointProvider } from '../breakpoint';\nimport useScrollbar from '../hooks/useScrollbar';\nimport { css } from '../css';\nimport { darkColorPallete, lightColorPallete } from '../theme/ThemeDefaultOptions';\n\ncreateTheme(\"light\", { colors: lightColorPallete })\ncreateTheme(\"dark\", { colors: darkColorPallete })\n\nexport type AppRootProps<T extends TagComponentType = \"div\"> = ThemeProviderProps<T> & {\n noScrollbarCss?: boolean;\n}\n\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, noScrollbarCss, theme, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\n noScrollbarCss ??= false\n\n useMemo(() => {\n if (noScrollbarCss) return;\n useScrollbar({\n themeName: theme,\n root_cls: themeRootClass(theme)\n })\n }, [noScrollbarCss, theme])\n\n useMemo(() => {\n css({\n \"@global\": {\n \"*\": {\n m: 0,\n p: 0,\n outline: \"none\",\n boxSizing: \"border-box\",\n verticalAlign: \"baseline\",\n },\n \"html, body\": {\n minHeight: \"100%\",\n \"-webkit-font-smoothing\": \"antialiased\"\n } as any,\n \"img, picture, video, canvas, svg\": {\n maxWidth: \"100%\",\n display: \"block\"\n },\n \"input, button, textarea, select\": {\n font: \"inherit\"\n },\n \"table\": {\n borderCollapse: \"collapse\",\n borderSpacing: 0\n },\n \"ol, ul\": {\n listStyle: \"none\"\n },\n \"a\": {\n display: \"inline-block\"\n },\n \"p, h1, h2, h3, h4, h5, h6\": {\n overflowWrap: \"break-word\",\n }\n }\n })\n }, [])\n\n useEffect(() => {\n // move oncss style tags to head\n if (typeof window === 'undefined') return;\n const head = document.getElementsByTagName('head')[0];\n const styles = Array.from(document.querySelectorAll('body style[data-oncss]'));\n styles.forEach((style) => {\n head.appendChild(style);\n });\n }, [])\n\n return (\n <ThemeProvider\n ref={ref}\n theme={theme}\n {...props}\n classNames={[`xui-app-root`]}\n >\n <BreakpointProvider>\n {children}\n </BreakpointProvider>\n </ThemeProvider>\n )\n})\n\nexport default AppRoot\n\n"],"names":["React","_jsx"],"mappings":"4fASA,WAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;AACnD,WAAW,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;AAMjD,MAAM,OAAO,GAAGA,cAAK,CAAC,UAAU,CAAC,CAAqC,EAA8D,EAAE,GAAmB,KAAI;QAAvF,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,OAA6B,EAAxB,KAAK,GAAA,MAAA,CAAA,EAAA,EAA3C,CAAA,UAAA,EAAA,gBAAA,EAAA,OAAA,CAA6C,CAAF;IAC9G,cAAc,KAAA,IAAA,IAAd,cAAc,KAAA,MAAA,GAAd,cAAc,IAAd,cAAc,GAAK,KAAK,CAAA;IAExB,OAAO,CAAC,MAAK;AACV,QAAA,IAAI,cAAc;YAAE;AACpB,QAAA,YAAY,CAAC;AACV,YAAA,SAAS,EAAE,KAAK;AAChB,YAAA,QAAQ,EAAE,cAAc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AAC,KAAK,KAAI;AACtB,YAAA,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC1B,QAAA,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC;IAEN,QACGC,GAAA,CAAC,aAAa,EAAA,MAAA,CAAA,MAAA,CAAA,EACX,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EAAA,EACR,KAAK,EAAA,EACT,UAAU,EAAE,CAAC,CAAA,YAAA,CAAc,CAAC,EAAA,QAAA,EAE5BA,GAAA,CAAC,kBAAkB,EAAA,EAAA,QAAA,EACf,QAAQ,EAAA,CACS,EAAA,CAAA,CACR;AAEtB,CAAC"}
|
package/Tag/index.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var tslib=require('tslib'),React=require('react'),useTagProps=require('./useTagProps.js');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var React__namespace=/*#__PURE__*/_interopNamespaceDefault(React);const Tag = React__namespace.forwardRef((_a, ref) => {
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var tslib=require('tslib'),React=require('react'),useTagProps=require('./useTagProps.js'),isWindow=require('../isWindow.js');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var React__namespace=/*#__PURE__*/_interopNamespaceDefault(React);const Tag = React__namespace.forwardRef((_a, ref) => {
|
|
2
2
|
var { component, children } = _a, rest = tslib.__rest(_a, ["component", "children"]);
|
|
3
|
-
const props = useTagProps.default(rest);
|
|
3
|
+
const { props, style } = useTagProps.default(rest);
|
|
4
4
|
props.ref = ref;
|
|
5
|
-
|
|
5
|
+
const ele = React__namespace.createElement(component || "div", props, children);
|
|
6
|
+
if (!isWindow.default()) {
|
|
7
|
+
const isCache = style.cache;
|
|
8
|
+
const styletag = React__namespace.createElement("style", {
|
|
9
|
+
dangerouslySetInnerHTML: { __html: style.css },
|
|
10
|
+
'data-oncss': style.classname
|
|
11
|
+
});
|
|
12
|
+
return React__namespace.createElement(React__namespace.Fragment, null, [isCache ? null : styletag, ele]);
|
|
13
|
+
}
|
|
14
|
+
return ele;
|
|
6
15
|
});exports.default=Tag;//# sourceMappingURL=index.js.map
|
package/Tag/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Tag/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { TagComponentType, TagPropsRoot } from './types';\nimport useTagProps from './useTagProps';\n\nconst Tag = React.forwardRef(<T extends TagComponentType = 'div'>({ component, children, ...rest }: TagPropsRoot<T>, ref: React.Ref<any>) => {\n const props: any = useTagProps(rest)\n props.ref = ref\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Tag/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { TagComponentType, TagPropsRoot } from './types';\nimport useTagProps from './useTagProps';\nimport isWindow from '../isWindow';\n\nconst Tag = React.forwardRef(<T extends TagComponentType = 'div'>({ component, children, ...rest }: TagPropsRoot<T>, ref: React.Ref<any>) => {\n const { props, style }: any = useTagProps(rest)\n props.ref = ref\n const ele = React.createElement(component || \"div\", props, children)\n if (!isWindow()) {\n const isCache = style.cache\n const styletag = React.createElement(\"style\", {\n dangerouslySetInnerHTML: { __html: style.css },\n 'data-oncss': style.classname\n })\n return React.createElement(React.Fragment, null, [isCache ? null : styletag, ele])\n }\n return ele\n})\n\nexport default Tag"],"names":["React","__rest","useTagProps","isWindow"],"mappings":"miBAKA,MAAM,GAAG,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAqC,EAAiD,EAAE,GAAmB,KAAI;QAA1E,EAAE,SAAS,EAAE,QAAQ,EAAA,GAAA,EAA4B,EAAvB,IAAI,GAAAC,YAAA,CAAA,EAAA,EAA9B,yBAAgC,CAAF;IAC5F,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAQC,mBAAW,CAAC,IAAI,CAAC;AAC/C,IAAA,KAAK,CAAC,GAAG,GAAG,GAAG;AACf,IAAA,MAAM,GAAG,GAAGF,gBAAK,CAAC,aAAa,CAAC,SAAS,IAAI,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC;AACpE,IAAA,IAAI,CAACG,gBAAQ,EAAE,EAAE;AACb,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK;AAC3B,QAAA,MAAM,QAAQ,GAAGH,gBAAK,CAAC,aAAa,CAAC,OAAO,EAAE;AAC1C,YAAA,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE;YAC9C,YAAY,EAAE,KAAK,CAAC;AACvB,SAAA,CAAC;QACF,OAAOA,gBAAK,CAAC,aAAa,CAACA,gBAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,OAAO,GAAG,IAAI,GAAG,QAAQ,EAAE,GAAG,CAAC,CAAC;IACtF;AACA,IAAA,OAAO,GAAG;AACd,CAAC"}
|
package/Tag/index.mjs
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import {__rest}from'tslib';import*as React from'react';import useTagProps from'./useTagProps.mjs';const Tag = React.forwardRef((_a, ref) => {
|
|
1
|
+
import {__rest}from'tslib';import*as React from'react';import useTagProps from'./useTagProps.mjs';import isWindow from'../isWindow.mjs';const Tag = React.forwardRef((_a, ref) => {
|
|
2
2
|
var { component, children } = _a, rest = __rest(_a, ["component", "children"]);
|
|
3
|
-
const props = useTagProps(rest);
|
|
3
|
+
const { props, style } = useTagProps(rest);
|
|
4
4
|
props.ref = ref;
|
|
5
|
-
|
|
5
|
+
const ele = React.createElement(component || "div", props, children);
|
|
6
|
+
if (!isWindow()) {
|
|
7
|
+
const isCache = style.cache;
|
|
8
|
+
const styletag = React.createElement("style", {
|
|
9
|
+
dangerouslySetInnerHTML: { __html: style.css },
|
|
10
|
+
'data-oncss': style.classname
|
|
11
|
+
});
|
|
12
|
+
return React.createElement(React.Fragment, null, [isCache ? null : styletag, ele]);
|
|
13
|
+
}
|
|
14
|
+
return ele;
|
|
6
15
|
});export{Tag as default};//# sourceMappingURL=index.mjs.map
|
package/Tag/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/Tag/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { TagComponentType, TagPropsRoot } from './types';\nimport useTagProps from './useTagProps';\n\nconst Tag = React.forwardRef(<T extends TagComponentType = 'div'>({ component, children, ...rest }: TagPropsRoot<T>, ref: React.Ref<any>) => {\n const props: any = useTagProps(rest)\n props.ref = ref\n
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/Tag/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { TagComponentType, TagPropsRoot } from './types';\nimport useTagProps from './useTagProps';\nimport isWindow from '../isWindow';\n\nconst Tag = React.forwardRef(<T extends TagComponentType = 'div'>({ component, children, ...rest }: TagPropsRoot<T>, ref: React.Ref<any>) => {\n const { props, style }: any = useTagProps(rest)\n props.ref = ref\n const ele = React.createElement(component || \"div\", props, children)\n if (!isWindow()) {\n const isCache = style.cache\n const styletag = React.createElement(\"style\", {\n dangerouslySetInnerHTML: { __html: style.css },\n 'data-oncss': style.classname\n })\n return React.createElement(React.Fragment, null, [isCache ? null : styletag, ele])\n }\n return ele\n})\n\nexport default Tag"],"names":[],"mappings":"wIAKA,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAAiD,EAAE,GAAmB,KAAI;QAA1E,EAAE,SAAS,EAAE,QAAQ,EAAA,GAAA,EAA4B,EAAvB,IAAI,GAAA,MAAA,CAAA,EAAA,EAA9B,yBAAgC,CAAF;IAC5F,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAQ,WAAW,CAAC,IAAI,CAAC;AAC/C,IAAA,KAAK,CAAC,GAAG,GAAG,GAAG;AACf,IAAA,MAAM,GAAG,GAAG,KAAK,CAAC,aAAa,CAAC,SAAS,IAAI,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC;AACpE,IAAA,IAAI,CAAC,QAAQ,EAAE,EAAE;AACb,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK;AAC3B,QAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE;AAC1C,YAAA,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE;YAC9C,YAAY,EAAE,KAAK,CAAC;AACvB,SAAA,CAAC;QACF,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,OAAO,GAAG,IAAI,GAAG,QAAQ,EAAE,GAAG,CAAC,CAAC;IACtF;AACA,IAAA,OAAO,GAAG;AACd,CAAC"}
|
package/Tag/useTagProps.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { TagComponentType, TagPropsRoot, TagProps } from './types.js';
|
|
2
|
+
import { CSSFactoryType } from 'oncss';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
type useTagPropsReturn<T extends TagComponentType = "div"> = {
|
|
5
|
+
props: TagProps<T>;
|
|
6
|
+
style: CSSFactoryType;
|
|
7
|
+
};
|
|
8
|
+
declare const useTagProps: <T extends TagComponentType = "div">({ sxr, sx, baseClass, classNames: clses, hover, ...props }: TagPropsRoot<T>) => useTagPropsReturn<T>;
|
|
4
9
|
|
|
5
10
|
export { useTagProps as default };
|
|
11
|
+
export type { useTagPropsReturn };
|
package/Tag/useTagProps.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var tslib=require('tslib'),cssPropList=require('./cssPropList.js'),index=require('../css/index.js'),prettyClass=require('pretty-class');const useTagProps = (_a) => {
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var tslib=require('tslib'),cssPropList=require('./cssPropList.js'),index=require('../css/index.js'),prettyClass=require('pretty-class'),isWindow=require('../isWindow.js');const useTagProps = (_a) => {
|
|
2
2
|
var { sxr, sx, baseClass, classNames: clses, hover } = _a, props = tslib.__rest(_a, ["sxr", "sx", "baseClass", "classNames", "hover"]);
|
|
3
3
|
let _css = Object.assign(Object.assign(Object.assign({}, sxr), sx), props);
|
|
4
4
|
if (hover)
|
|
5
5
|
_css['&:hover'] = hover;
|
|
6
6
|
const style = index.css(_css, {
|
|
7
|
-
skipProps: (prop, _val, dept) => dept === 1 && !cssPropList.default[prop]
|
|
7
|
+
skipProps: (prop, _val, dept) => dept === 1 && !cssPropList.default[prop],
|
|
8
|
+
injectStyle: isWindow.default(),
|
|
8
9
|
});
|
|
9
10
|
let skipProps = style.skiped[style.classname] || [];
|
|
10
11
|
const _props = {};
|
|
@@ -17,5 +18,5 @@
|
|
|
17
18
|
props.className,
|
|
18
19
|
...(clses || []),
|
|
19
20
|
]);
|
|
20
|
-
return _props;
|
|
21
|
+
return { props: _props, style };
|
|
21
22
|
};exports.default=useTagProps;//# sourceMappingURL=useTagProps.js.map
|
package/Tag/useTagProps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTagProps.js","sources":["../../src/Tag/useTagProps.ts"],"sourcesContent":["import { TagComponentType, TagProps, TagPropsRoot } from './types';\nimport cssPropList from './cssPropList';\nimport { css } from '../css';\nimport { classNames } from 'pretty-class';\n\nconst useTagProps = <T extends TagComponentType = \"div\">({ sxr, sx, baseClass, classNames: clses, hover, ...props }: TagPropsRoot<T>):
|
|
1
|
+
{"version":3,"file":"useTagProps.js","sources":["../../src/Tag/useTagProps.ts"],"sourcesContent":["import { TagComponentType, TagProps, TagPropsRoot } from './types';\nimport cssPropList from './cssPropList';\nimport { css } from '../css';\nimport { classNames } from 'pretty-class';\nimport { CSSFactoryType } from 'oncss';\nimport isWindow from '../isWindow';\n\nexport type useTagPropsReturn<T extends TagComponentType = \"div\"> = {\n props: TagProps<T>,\n style: CSSFactoryType\n}\n\nconst useTagProps = <T extends TagComponentType = \"div\">({ sxr, sx, baseClass, classNames: clses, hover, ...props }: TagPropsRoot<T>): useTagPropsReturn<T> => {\n let _css: any = { ...sxr, ...sx, ...props }\n if (hover) _css['&:hover'] = hover\n const style = css(_css, {\n skipProps: (prop, _val, dept): any => dept === 1 && !cssPropList[prop],\n injectStyle: isWindow(),\n })\n\n let skipProps = style.skiped[style.classname as any] || []\n const _props: any = {};\n for (let prop of skipProps) {\n _props[prop] = (props as any)[prop]\n }\n _props.className = classNames([\n baseClass ? \"xui-\" + baseClass : \"\",\n style.classname,\n props.className,\n ...(clses as any || []),\n ])\n return { props: _props, style };\n}\n\n\nexport default useTagProps"],"names":["__rest","css","cssPropList","isWindow","classNames"],"mappings":"iPAYA,MAAM,WAAW,GAAG,CAAqC,EAA2E,KAA0B;AAArG,IAAA,IAAA,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAA,GAAA,EAA6B,EAAxB,KAAK,GAAAA,YAAA,CAAA,EAAA,EAAxD,iDAA0D,CAAF;IAC9G,IAAI,IAAI,iDAAa,GAAG,CAAA,EAAK,EAAE,CAAA,EAAK,KAAK,CAAE;AAC3C,IAAA,IAAI,KAAK;AAAE,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK;AAClC,IAAA,MAAM,KAAK,GAAGC,SAAG,CAAC,IAAI,EAAE;AACrB,QAAA,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,KAAU,IAAI,KAAK,CAAC,IAAI,CAACC,mBAAW,CAAC,IAAI,CAAC;QACtE,WAAW,EAAEC,gBAAQ,EAAE;AACzB,KAAA,CAAC;AAEF,IAAA,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAgB,CAAC,IAAI,EAAE;IAC1D,MAAM,MAAM,GAAQ,EAAE;AACtB,IAAA,KAAK,IAAI,IAAI,IAAI,SAAS,EAAE;QACzB,MAAM,CAAC,IAAI,CAAC,GAAI,KAAa,CAAC,IAAI,CAAC;IACtC;AACA,IAAA,MAAM,CAAC,SAAS,GAAGC,sBAAU,CAAC;QAC3B,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,EAAE;AACnC,QAAA,KAAK,CAAC,SAAS;AACf,QAAA,KAAK,CAAC,SAAS;AACf,QAAA,IAAI,KAAY,IAAI,EAAE,CAAC;AACzB,KAAA,CAAC;AACF,IAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;AAClC"}
|
package/Tag/useTagProps.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {__rest}from'tslib';import CSS_PROP_LIST from'./cssPropList.mjs';import {css}from'../css/index.mjs';import {classNames}from'pretty-class';const useTagProps = (_a) => {
|
|
1
|
+
import {__rest}from'tslib';import CSS_PROP_LIST from'./cssPropList.mjs';import {css}from'../css/index.mjs';import {classNames}from'pretty-class';import isWindow from'../isWindow.mjs';const useTagProps = (_a) => {
|
|
2
2
|
var { sxr, sx, baseClass, classNames: clses, hover } = _a, props = __rest(_a, ["sxr", "sx", "baseClass", "classNames", "hover"]);
|
|
3
3
|
let _css = Object.assign(Object.assign(Object.assign({}, sxr), sx), props);
|
|
4
4
|
if (hover)
|
|
5
5
|
_css['&:hover'] = hover;
|
|
6
6
|
const style = css(_css, {
|
|
7
|
-
skipProps: (prop, _val, dept) => dept === 1 && !CSS_PROP_LIST[prop]
|
|
7
|
+
skipProps: (prop, _val, dept) => dept === 1 && !CSS_PROP_LIST[prop],
|
|
8
|
+
injectStyle: isWindow(),
|
|
8
9
|
});
|
|
9
10
|
let skipProps = style.skiped[style.classname] || [];
|
|
10
11
|
const _props = {};
|
|
@@ -17,5 +18,5 @@ import {__rest}from'tslib';import CSS_PROP_LIST from'./cssPropList.mjs';import {
|
|
|
17
18
|
props.className,
|
|
18
19
|
...(clses || []),
|
|
19
20
|
]);
|
|
20
|
-
return _props;
|
|
21
|
+
return { props: _props, style };
|
|
21
22
|
};export{useTagProps as default};//# sourceMappingURL=useTagProps.mjs.map
|
package/Tag/useTagProps.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTagProps.mjs","sources":["../../src/Tag/useTagProps.ts"],"sourcesContent":["import { TagComponentType, TagProps, TagPropsRoot } from './types';\nimport cssPropList from './cssPropList';\nimport { css } from '../css';\nimport { classNames } from 'pretty-class';\n\nconst useTagProps = <T extends TagComponentType = \"div\">({ sxr, sx, baseClass, classNames: clses, hover, ...props }: TagPropsRoot<T>):
|
|
1
|
+
{"version":3,"file":"useTagProps.mjs","sources":["../../src/Tag/useTagProps.ts"],"sourcesContent":["import { TagComponentType, TagProps, TagPropsRoot } from './types';\nimport cssPropList from './cssPropList';\nimport { css } from '../css';\nimport { classNames } from 'pretty-class';\nimport { CSSFactoryType } from 'oncss';\nimport isWindow from '../isWindow';\n\nexport type useTagPropsReturn<T extends TagComponentType = \"div\"> = {\n props: TagProps<T>,\n style: CSSFactoryType\n}\n\nconst useTagProps = <T extends TagComponentType = \"div\">({ sxr, sx, baseClass, classNames: clses, hover, ...props }: TagPropsRoot<T>): useTagPropsReturn<T> => {\n let _css: any = { ...sxr, ...sx, ...props }\n if (hover) _css['&:hover'] = hover\n const style = css(_css, {\n skipProps: (prop, _val, dept): any => dept === 1 && !cssPropList[prop],\n injectStyle: isWindow(),\n })\n\n let skipProps = style.skiped[style.classname as any] || []\n const _props: any = {};\n for (let prop of skipProps) {\n _props[prop] = (props as any)[prop]\n }\n _props.className = classNames([\n baseClass ? \"xui-\" + baseClass : \"\",\n style.classname,\n props.className,\n ...(clses as any || []),\n ])\n return { props: _props, style };\n}\n\n\nexport default useTagProps"],"names":["cssPropList"],"mappings":"uLAYA,MAAM,WAAW,GAAG,CAAqC,EAA2E,KAA0B;AAArG,IAAA,IAAA,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAA,GAAA,EAA6B,EAAxB,KAAK,GAAA,MAAA,CAAA,EAAA,EAAxD,iDAA0D,CAAF;IAC9G,IAAI,IAAI,iDAAa,GAAG,CAAA,EAAK,EAAE,CAAA,EAAK,KAAK,CAAE;AAC3C,IAAA,IAAI,KAAK;AAAE,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK;AAClC,IAAA,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,EAAE;AACrB,QAAA,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,KAAU,IAAI,KAAK,CAAC,IAAI,CAACA,aAAW,CAAC,IAAI,CAAC;QACtE,WAAW,EAAE,QAAQ,EAAE;AACzB,KAAA,CAAC;AAEF,IAAA,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAgB,CAAC,IAAI,EAAE;IAC1D,MAAM,MAAM,GAAQ,EAAE;AACtB,IAAA,KAAK,IAAI,IAAI,IAAI,SAAS,EAAE;QACzB,MAAM,CAAC,IAAI,CAAC,GAAI,KAAa,CAAC,IAAI,CAAC;IACtC;AACA,IAAA,MAAM,CAAC,SAAS,GAAG,UAAU,CAAC;QAC3B,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,EAAE;AACnC,QAAA,KAAK,CAAC,SAAS;AACf,QAAA,KAAK,CAAC,SAAS;AACf,QAAA,IAAI,KAAY,IAAI,EAAE,CAAC;AACzB,KAAA,CAAC;AACF,IAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;AAClC"}
|
package/Transition/index.d.ts
CHANGED
package/Transition/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var tslib=require('tslib'),jsxRuntime=require('react/jsx-runtime'),React=require('react'),index$1=require('../Tag/index.js'),useAnimation=require('../useAnimation.js'),index=require('../css/index.js'),oncss=require('oncss'),variants=require('./variants.js');const Transition = (_a) => {
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var tslib=require('tslib'),jsxRuntime=require('react/jsx-runtime'),React=require('react'),index$1=require('../Tag/index.js'),useAnimation=require('../hooks/useAnimation.js'),index=require('../css/index.js'),oncss=require('oncss'),variants=require('./variants.js');const Transition = (_a) => {
|
|
2
2
|
var { children, open } = _a, props = tslib.__rest(_a, ["children", "open"]);
|
|
3
3
|
let { disableInitialTransition, variant, duration, delay, ease, easing, onOpen, onOpened, onClose, onClosed, onState } = props;
|
|
4
4
|
let _ease = ease || useAnimation.animationEases[easing] || useAnimation.animationEases.easeBounceOut;
|
package/Transition/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Transition/index.tsx"],"sourcesContent":["import React, { ReactElement, cloneElement, Children, useState, useEffect, useId } from 'react';\nimport Tag from '../Tag';\nimport { animationEases } from '../useAnimation';\nimport { css } from '../css';\nimport { formatCSSProp } from 'oncss';\nimport { CSSProps } from '../css/types';\nimport * as variants from './variants'\nexport type TransitionVariantTypes = keyof typeof variants\n\nexport type TransitionElementProps = {\n height: number;\n width: number;\n rect: DOMRect | null\n}\n\nexport type TransitionState = \"open\" | \"opened\" | \"close\" | \"closed\"\n\nexport type TransitionProps = {\n children: ReactElement;\n open: boolean;\n variant: {\n from: CSSProps;\n to: CSSProps;\n } | TransitionVariantTypes;\n ease?: string;\n easing?: keyof typeof animationEases;\n duration?: number;\n delay?: number;\n disableInitialTransition?: boolean;\n onOpen?: () => void;\n onOpened?: () => void;\n onClose?: () => void;\n onClosed?: () => void;\n onState?: (state: TransitionState) => void;\n}\n\nconst Transition = ({ children, open, ...props }: TransitionProps) => {\n let { disableInitialTransition, variant, duration, delay, ease, easing, onOpen, onOpened, onClose, onClosed, onState } = props as TransitionProps\n let _ease = ease || (animationEases as any)[easing as any] || animationEases.easeBounceOut\n disableInitialTransition ??= false\n duration ??= 400\n variant ??= \"fade\"\n\n const id = useId().replace(/:/g, \"\")\n const [rendered, setRendered] = useState(false)\n const [initial, setInitial] = useState(false)\n const [transitionState, setTransitionState] = useState<TransitionState>(open ? (disableInitialTransition ? \"opened\" : \"open\") : \"closed\")\n const [element, setElement] = useState<TransitionElementProps>({\n height: 0,\n width: 0,\n rect: null\n });\n\n if (typeof variant === 'string') {\n variant = (variants as any)[variant](element)\n }\n\n let from = (variant as any).from\n let to = (variant as any).to\n\n const [_css, setCss] = useState(open ? to : from)\n\n useEffect(() => {\n const ele: HTMLElement = document.querySelector(`.trans-${id}`) as any\n if (ele) {\n setRendered(true)\n setElement({\n height: ele.clientHeight,\n width: ele.clientWidth,\n rect: ele.getBoundingClientRect()\n })\n if (!disableInitialTransition && open) {\n setCss(from)\n }\n }\n }, [])\n\n useEffect(() => {\n const ele: HTMLElement = document.querySelector(`.trans-${id}`) as any\n if (rendered && ele) {\n let stimer: any = null\n let etimer: any = null\n ele.ontransitionstart = () => {\n clearTimeout(stimer)\n stimer = setTimeout(() => {\n const isOpen = Array.from(ele.classList).includes(\"trans-open\");\n (onOpen && isOpen) && onOpen();\n (onClose && !isOpen) && onClose()\n onState && onState(isOpen ? \"open\" : \"close\")\n setTransitionState(isOpen ? \"open\" : \"close\")\n }, 1)\n }\n ele.ontransitionend = () => {\n clearTimeout(etimer)\n etimer = setTimeout(() => {\n const isOpen = Array.from(ele.classList).includes(\"trans-open\");\n (onOpened && isOpen) && onOpened();\n (onClosed && !isOpen) && onClosed();\n onState && onState(isOpen ? \"opened\" : \"closed\")\n setTransitionState(isOpen ? \"opened\" : \"closed\")\n }, 1)\n }\n }\n }, [rendered])\n\n useEffect(() => {\n if (rendered) {\n if (!initial) {\n setInitial(true)\n setTimeout(() => {\n setCss(open ? to : from)\n }, 50);\n } else {\n setCss(open ? to : from)\n }\n }\n }, [rendered, open, JSON.stringify(from), JSON.stringify(to)])\n\n let _: any = {}\n if (rendered) {\n let trans = ` ${duration}ms ${_ease} ${delay || 0}ms`\n _ = {\n ..._css,\n transition: Object.keys(_css || {}).map(k => formatCSSProp(k)).join(trans + \", \") + trans,\n }\n }\n\n const cls = css(_)\n if (!children || Array.isArray(children)) throw new Error(\"Invalid children in Transition\")\n const first: any = Children.toArray(children).shift();\n let classname = `${cls.classname} trans-${id} trans-${(open ? \"open\" : \"close\")} trans-state-${transitionState}`\n const child = cloneElement(first, { classNames: [classname] })\n if (rendered) return child\n if (!rendered && disableInitialTransition && open) return child\n\n return (\n <Tag\n height={0}\n overflow=\"hidden\"\n >\n {child}\n </Tag>\n )\n}\n\n\nexport default Transition"],"names":["__rest","animationEases","useId","useState","useEffect","formatCSSProp","css","Children","cloneElement","_jsx","Tag"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Transition/index.tsx"],"sourcesContent":["import React, { ReactElement, cloneElement, Children, useState, useEffect, useId } from 'react';\nimport Tag from '../Tag';\nimport { animationEases } from '../hooks/useAnimation';\nimport { css } from '../css';\nimport { formatCSSProp } from 'oncss';\nimport { CSSProps } from '../css/types';\nimport * as variants from './variants'\nexport type TransitionVariantTypes = keyof typeof variants\n\nexport type TransitionElementProps = {\n height: number;\n width: number;\n rect: DOMRect | null\n}\n\nexport type TransitionState = \"open\" | \"opened\" | \"close\" | \"closed\"\n\nexport type TransitionProps = {\n children: ReactElement;\n open: boolean;\n variant: {\n from: CSSProps;\n to: CSSProps;\n } | TransitionVariantTypes;\n ease?: string;\n easing?: keyof typeof animationEases;\n duration?: number;\n delay?: number;\n disableInitialTransition?: boolean;\n onOpen?: () => void;\n onOpened?: () => void;\n onClose?: () => void;\n onClosed?: () => void;\n onState?: (state: TransitionState) => void;\n}\n\nconst Transition = ({ children, open, ...props }: TransitionProps) => {\n let { disableInitialTransition, variant, duration, delay, ease, easing, onOpen, onOpened, onClose, onClosed, onState } = props as TransitionProps\n let _ease = ease || (animationEases as any)[easing as any] || animationEases.easeBounceOut\n disableInitialTransition ??= false\n duration ??= 400\n variant ??= \"fade\"\n\n const id = useId().replace(/:/g, \"\")\n const [rendered, setRendered] = useState(false)\n const [initial, setInitial] = useState(false)\n const [transitionState, setTransitionState] = useState<TransitionState>(open ? (disableInitialTransition ? \"opened\" : \"open\") : \"closed\")\n const [element, setElement] = useState<TransitionElementProps>({\n height: 0,\n width: 0,\n rect: null\n });\n\n if (typeof variant === 'string') {\n variant = (variants as any)[variant](element)\n }\n\n let from = (variant as any).from\n let to = (variant as any).to\n\n const [_css, setCss] = useState(open ? to : from)\n\n useEffect(() => {\n const ele: HTMLElement = document.querySelector(`.trans-${id}`) as any\n if (ele) {\n setRendered(true)\n setElement({\n height: ele.clientHeight,\n width: ele.clientWidth,\n rect: ele.getBoundingClientRect()\n })\n if (!disableInitialTransition && open) {\n setCss(from)\n }\n }\n }, [])\n\n useEffect(() => {\n const ele: HTMLElement = document.querySelector(`.trans-${id}`) as any\n if (rendered && ele) {\n let stimer: any = null\n let etimer: any = null\n ele.ontransitionstart = () => {\n clearTimeout(stimer)\n stimer = setTimeout(() => {\n const isOpen = Array.from(ele.classList).includes(\"trans-open\");\n (onOpen && isOpen) && onOpen();\n (onClose && !isOpen) && onClose()\n onState && onState(isOpen ? \"open\" : \"close\")\n setTransitionState(isOpen ? \"open\" : \"close\")\n }, 1)\n }\n ele.ontransitionend = () => {\n clearTimeout(etimer)\n etimer = setTimeout(() => {\n const isOpen = Array.from(ele.classList).includes(\"trans-open\");\n (onOpened && isOpen) && onOpened();\n (onClosed && !isOpen) && onClosed();\n onState && onState(isOpen ? \"opened\" : \"closed\")\n setTransitionState(isOpen ? \"opened\" : \"closed\")\n }, 1)\n }\n }\n }, [rendered])\n\n useEffect(() => {\n if (rendered) {\n if (!initial) {\n setInitial(true)\n setTimeout(() => {\n setCss(open ? to : from)\n }, 50);\n } else {\n setCss(open ? to : from)\n }\n }\n }, [rendered, open, JSON.stringify(from), JSON.stringify(to)])\n\n let _: any = {}\n if (rendered) {\n let trans = ` ${duration}ms ${_ease} ${delay || 0}ms`\n _ = {\n ..._css,\n transition: Object.keys(_css || {}).map(k => formatCSSProp(k)).join(trans + \", \") + trans,\n }\n }\n\n const cls = css(_)\n if (!children || Array.isArray(children)) throw new Error(\"Invalid children in Transition\")\n const first: any = Children.toArray(children).shift();\n let classname = `${cls.classname} trans-${id} trans-${(open ? \"open\" : \"close\")} trans-state-${transitionState}`\n const child = cloneElement(first, { classNames: [classname] })\n if (rendered) return child\n if (!rendered && disableInitialTransition && open) return child\n\n return (\n <Tag\n height={0}\n overflow=\"hidden\"\n >\n {child}\n </Tag>\n )\n}\n\n\nexport default Transition"],"names":["__rest","animationEases","useId","useState","useEffect","formatCSSProp","css","Children","cloneElement","_jsx","Tag"],"mappings":"8UAoCA,MAAM,UAAU,GAAG,CAAC,EAA6C,KAAI;QAAjD,EAAE,QAAQ,EAAE,IAAI,EAAA,GAAA,EAA6B,EAAxB,KAAK,GAAAA,YAAA,CAAA,EAAA,EAA1B,oBAA4B,CAAF;IAC1C,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAwB;AACjJ,IAAA,IAAI,KAAK,GAAG,IAAI,IAAKC,2BAAsB,CAAC,MAAa,CAAC,IAAIA,2BAAc,CAAC,aAAa;IAC1F,wBAAwB,KAAA,IAAA,IAAxB,wBAAwB,KAAA,MAAA,GAAxB,wBAAwB,IAAxB,wBAAwB,GAAK,KAAK,CAAA;IAClC,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAA,MAAA,GAAR,QAAQ,IAAR,QAAQ,GAAK,GAAG,CAAA;IAChB,OAAO,KAAA,I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I,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC;IAC3F,MAAM,KAAK,GAAQC,cAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE;IACrD,IAAI,SAAS,GAAG,CAAA,EAAG,GAAG,CAAC,SAAS,CAAA,OAAA,EAAU,EAAE,CAAA,OAAA,GAAW,IAAI,GAAG,MAAM,GAAG,OAAO,EAAC,aAAA,EAAgB,eAAe,CAAA,CAAE;AAChH,IAAA,MAAM,KAAK,GAAGC,kBAAY,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;AAC9D,IAAA,IAAI,QAAQ;AAAE,QAAA,OAAO,KAAK;AAC1B,IAAA,IAAI,CAAC,QAAQ,IAAI,wBAAwB,IAAI,IAAI;AAAE,QAAA,OAAO,KAAK;AAE/D,IAAA,QACIC,cAAA,CAACC,eAAG,EAAA,EACA,MAAM,EAAE,CAAC,EACT,QAAQ,EAAC,QAAQ,EAAA,QAAA,EAEhB,KAAK,EAAA,CACJ;AAEd"}
|
package/Transition/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {__rest}from'tslib';import {jsx}from'react/jsx-runtime';import {useId,useState,useEffect,Children,cloneElement}from'react';import Tag from'../Tag/index.mjs';import {animationEases}from'../useAnimation.mjs';import {css}from'../css/index.mjs';import {formatCSSProp}from'oncss';import*as variants from'./variants.mjs';const Transition = (_a) => {
|
|
1
|
+
import {__rest}from'tslib';import {jsx}from'react/jsx-runtime';import {useId,useState,useEffect,Children,cloneElement}from'react';import Tag from'../Tag/index.mjs';import {animationEases}from'../hooks/useAnimation.mjs';import {css}from'../css/index.mjs';import {formatCSSProp}from'oncss';import*as variants from'./variants.mjs';const Transition = (_a) => {
|
|
2
2
|
var { children, open } = _a, props = __rest(_a, ["children", "open"]);
|
|
3
3
|
let { disableInitialTransition, variant, duration, delay, ease, easing, onOpen, onOpened, onClose, onClosed, onState } = props;
|
|
4
4
|
let _ease = ease || animationEases[easing] || animationEases.easeBounceOut;
|
package/Transition/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/Transition/index.tsx"],"sourcesContent":["import React, { ReactElement, cloneElement, Children, useState, useEffect, useId } from 'react';\nimport Tag from '../Tag';\nimport { animationEases } from '../useAnimation';\nimport { css } from '../css';\nimport { formatCSSProp } from 'oncss';\nimport { CSSProps } from '../css/types';\nimport * as variants from './variants'\nexport type TransitionVariantTypes = keyof typeof variants\n\nexport type TransitionElementProps = {\n height: number;\n width: number;\n rect: DOMRect | null\n}\n\nexport type TransitionState = \"open\" | \"opened\" | \"close\" | \"closed\"\n\nexport type TransitionProps = {\n children: ReactElement;\n open: boolean;\n variant: {\n from: CSSProps;\n to: CSSProps;\n } | TransitionVariantTypes;\n ease?: string;\n easing?: keyof typeof animationEases;\n duration?: number;\n delay?: number;\n disableInitialTransition?: boolean;\n onOpen?: () => void;\n onOpened?: () => void;\n onClose?: () => void;\n onClosed?: () => void;\n onState?: (state: TransitionState) => void;\n}\n\nconst Transition = ({ children, open, ...props }: TransitionProps) => {\n let { disableInitialTransition, variant, duration, delay, ease, easing, onOpen, onOpened, onClose, onClosed, onState } = props as TransitionProps\n let _ease = ease || (animationEases as any)[easing as any] || animationEases.easeBounceOut\n disableInitialTransition ??= false\n duration ??= 400\n variant ??= \"fade\"\n\n const id = useId().replace(/:/g, \"\")\n const [rendered, setRendered] = useState(false)\n const [initial, setInitial] = useState(false)\n const [transitionState, setTransitionState] = useState<TransitionState>(open ? (disableInitialTransition ? \"opened\" : \"open\") : \"closed\")\n const [element, setElement] = useState<TransitionElementProps>({\n height: 0,\n width: 0,\n rect: null\n });\n\n if (typeof variant === 'string') {\n variant = (variants as any)[variant](element)\n }\n\n let from = (variant as any).from\n let to = (variant as any).to\n\n const [_css, setCss] = useState(open ? to : from)\n\n useEffect(() => {\n const ele: HTMLElement = document.querySelector(`.trans-${id}`) as any\n if (ele) {\n setRendered(true)\n setElement({\n height: ele.clientHeight,\n width: ele.clientWidth,\n rect: ele.getBoundingClientRect()\n })\n if (!disableInitialTransition && open) {\n setCss(from)\n }\n }\n }, [])\n\n useEffect(() => {\n const ele: HTMLElement = document.querySelector(`.trans-${id}`) as any\n if (rendered && ele) {\n let stimer: any = null\n let etimer: any = null\n ele.ontransitionstart = () => {\n clearTimeout(stimer)\n stimer = setTimeout(() => {\n const isOpen = Array.from(ele.classList).includes(\"trans-open\");\n (onOpen && isOpen) && onOpen();\n (onClose && !isOpen) && onClose()\n onState && onState(isOpen ? \"open\" : \"close\")\n setTransitionState(isOpen ? \"open\" : \"close\")\n }, 1)\n }\n ele.ontransitionend = () => {\n clearTimeout(etimer)\n etimer = setTimeout(() => {\n const isOpen = Array.from(ele.classList).includes(\"trans-open\");\n (onOpened && isOpen) && onOpened();\n (onClosed && !isOpen) && onClosed();\n onState && onState(isOpen ? \"opened\" : \"closed\")\n setTransitionState(isOpen ? \"opened\" : \"closed\")\n }, 1)\n }\n }\n }, [rendered])\n\n useEffect(() => {\n if (rendered) {\n if (!initial) {\n setInitial(true)\n setTimeout(() => {\n setCss(open ? to : from)\n }, 50);\n } else {\n setCss(open ? to : from)\n }\n }\n }, [rendered, open, JSON.stringify(from), JSON.stringify(to)])\n\n let _: any = {}\n if (rendered) {\n let trans = ` ${duration}ms ${_ease} ${delay || 0}ms`\n _ = {\n ..._css,\n transition: Object.keys(_css || {}).map(k => formatCSSProp(k)).join(trans + \", \") + trans,\n }\n }\n\n const cls = css(_)\n if (!children || Array.isArray(children)) throw new Error(\"Invalid children in Transition\")\n const first: any = Children.toArray(children).shift();\n let classname = `${cls.classname} trans-${id} trans-${(open ? \"open\" : \"close\")} trans-state-${transitionState}`\n const child = cloneElement(first, { classNames: [classname] })\n if (rendered) return child\n if (!rendered && disableInitialTransition && open) return child\n\n return (\n <Tag\n height={0}\n overflow=\"hidden\"\n >\n {child}\n </Tag>\n )\n}\n\n\nexport default Transition"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/Transition/index.tsx"],"sourcesContent":["import React, { ReactElement, cloneElement, Children, useState, useEffect, useId } from 'react';\nimport Tag from '../Tag';\nimport { animationEases } from '../hooks/useAnimation';\nimport { css } from '../css';\nimport { formatCSSProp } from 'oncss';\nimport { CSSProps } from '../css/types';\nimport * as variants from './variants'\nexport type TransitionVariantTypes = keyof typeof variants\n\nexport type TransitionElementProps = {\n height: number;\n width: number;\n rect: DOMRect | null\n}\n\nexport type TransitionState = \"open\" | \"opened\" | \"close\" | \"closed\"\n\nexport type TransitionProps = {\n children: ReactElement;\n open: boolean;\n variant: {\n from: CSSProps;\n to: CSSProps;\n } | TransitionVariantTypes;\n ease?: string;\n easing?: keyof typeof animationEases;\n duration?: number;\n delay?: number;\n disableInitialTransition?: boolean;\n onOpen?: () => void;\n onOpened?: () => void;\n onClose?: () => void;\n onClosed?: () => void;\n onState?: (state: TransitionState) => void;\n}\n\nconst Transition = ({ children, open, ...props }: TransitionProps) => {\n let { disableInitialTransition, variant, duration, delay, ease, easing, onOpen, onOpened, onClose, onClosed, onState } = props as TransitionProps\n let _ease = ease || (animationEases as any)[easing as any] || animationEases.easeBounceOut\n disableInitialTransition ??= false\n duration ??= 400\n variant ??= \"fade\"\n\n const id = useId().replace(/:/g, \"\")\n const [rendered, setRendered] = useState(false)\n const [initial, setInitial] = useState(false)\n const [transitionState, setTransitionState] = useState<TransitionState>(open ? (disableInitialTransition ? \"opened\" : \"open\") : \"closed\")\n const [element, setElement] = useState<TransitionElementProps>({\n height: 0,\n width: 0,\n rect: null\n });\n\n if (typeof variant === 'string') {\n variant = (variants as any)[variant](element)\n }\n\n let from = (variant as any).from\n let to = (variant as any).to\n\n const [_css, setCss] = useState(open ? to : from)\n\n useEffect(() => {\n const ele: HTMLElement = document.querySelector(`.trans-${id}`) as any\n if (ele) {\n setRendered(true)\n setElement({\n height: ele.clientHeight,\n width: ele.clientWidth,\n rect: ele.getBoundingClientRect()\n })\n if (!disableInitialTransition && open) {\n setCss(from)\n }\n }\n }, [])\n\n useEffect(() => {\n const ele: HTMLElement = document.querySelector(`.trans-${id}`) as any\n if (rendered && ele) {\n let stimer: any = null\n let etimer: any = null\n ele.ontransitionstart = () => {\n clearTimeout(stimer)\n stimer = setTimeout(() => {\n const isOpen = Array.from(ele.classList).includes(\"trans-open\");\n (onOpen && isOpen) && onOpen();\n (onClose && !isOpen) && onClose()\n onState && onState(isOpen ? \"open\" : \"close\")\n setTransitionState(isOpen ? \"open\" : \"close\")\n }, 1)\n }\n ele.ontransitionend = () => {\n clearTimeout(etimer)\n etimer = setTimeout(() => {\n const isOpen = Array.from(ele.classList).includes(\"trans-open\");\n (onOpened && isOpen) && onOpened();\n (onClosed && !isOpen) && onClosed();\n onState && onState(isOpen ? \"opened\" : \"closed\")\n setTransitionState(isOpen ? \"opened\" : \"closed\")\n }, 1)\n }\n }\n }, [rendered])\n\n useEffect(() => {\n if (rendered) {\n if (!initial) {\n setInitial(true)\n setTimeout(() => {\n setCss(open ? to : from)\n }, 50);\n } else {\n setCss(open ? to : from)\n }\n }\n }, [rendered, open, JSON.stringify(from), JSON.stringify(to)])\n\n let _: any = {}\n if (rendered) {\n let trans = ` ${duration}ms ${_ease} ${delay || 0}ms`\n _ = {\n ..._css,\n transition: Object.keys(_css || {}).map(k => formatCSSProp(k)).join(trans + \", \") + trans,\n }\n }\n\n const cls = css(_)\n if (!children || Array.isArray(children)) throw new Error(\"Invalid children in Transition\")\n const first: any = Children.toArray(children).shift();\n let classname = `${cls.classname} trans-${id} trans-${(open ? \"open\" : \"close\")} trans-state-${transitionState}`\n const child = cloneElement(first, { classNames: [classname] })\n if (rendered) return child\n if (!rendered && disableInitialTransition && open) return child\n\n return (\n <Tag\n height={0}\n overflow=\"hidden\"\n >\n {child}\n </Tag>\n )\n}\n\n\nex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,OAAO,KAAK;AAE/D,IAAA,QACIA,GAAA,CAAC,GAAG,EAAA,EACA,MAAM,EAAE,CAAC,EACT,QAAQ,EAAC,QAAQ,EAAA,QAAA,EAEhB,KAAK,EAAA,CACJ;AAEd"}
|
|
@@ -19,14 +19,12 @@ const getKey = () => {
|
|
|
19
19
|
return "xl";
|
|
20
20
|
};
|
|
21
21
|
const BreakpointProvider = ({ children }) => {
|
|
22
|
-
const [current, setCurrent] = React.useState(
|
|
22
|
+
const [current, setCurrent] = React.useState("xs");
|
|
23
23
|
const handler = React.useCallback(() => {
|
|
24
24
|
const newKey = getKey();
|
|
25
25
|
setCurrent(prev => (prev === newKey ? prev : newKey));
|
|
26
26
|
}, []);
|
|
27
27
|
React.useEffect(() => {
|
|
28
|
-
if (!isWindow.default())
|
|
29
|
-
return;
|
|
30
28
|
window.addEventListener("resize", handler);
|
|
31
29
|
handler(); // detect on mount
|
|
32
30
|
return () => window.removeEventListener("resize", handler);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreakpointProvider.js","sources":["../../src/breakpoint/BreakpointProvider.tsx"],"sourcesContent":["import React, { ReactNode, useState, useCallback } from \"react\";\nimport isWindow from \"../isWindow\";\nimport { breakpoints } from \"../css\";\nimport { BreakpointKeys } from \"../css/types\";\n\nexport const BreakpointCtx = React.createContext<BreakpointKeys>(\"xs\");\n\n/**\n * SSR-safe breakpoint detection\n */\nconst getKey = (): BreakpointKeys => {\n if (!isWindow()) {\n // Server fallback (mobile-first)\n return \"xs\";\n }\n\n const width = window.innerWidth;\n\n if (width < breakpoints.sm) return \"xs\";\n if (width < breakpoints.md) return \"sm\";\n if (width < breakpoints.lg) return \"md\";\n if (width < breakpoints.xl) return \"lg\";\n return \"xl\";\n};\n\nexport const BreakpointProvider = ({ children }: { children?: ReactNode }) => {\n const [current, setCurrent] = useState<BreakpointKeys>(
|
|
1
|
+
{"version":3,"file":"BreakpointProvider.js","sources":["../../src/breakpoint/BreakpointProvider.tsx"],"sourcesContent":["import React, { ReactNode, useState, useCallback } from \"react\";\nimport isWindow from \"../isWindow\";\nimport { breakpoints } from \"../css\";\nimport { BreakpointKeys } from \"../css/types\";\n\nexport const BreakpointCtx = React.createContext<BreakpointKeys>(\"xs\");\n\n/**\n * SSR-safe breakpoint detection\n */\nconst getKey = (): BreakpointKeys => {\n if (!isWindow()) {\n // Server fallback (mobile-first)\n return \"xs\";\n }\n\n const width = window.innerWidth;\n\n if (width < breakpoints.sm) return \"xs\";\n if (width < breakpoints.md) return \"sm\";\n if (width < breakpoints.lg) return \"md\";\n if (width < breakpoints.xl) return \"lg\";\n return \"xl\";\n};\n\nexport const BreakpointProvider = ({ children }: { children?: ReactNode }) => {\n const [current, setCurrent] = useState<BreakpointKeys>(\"xs\");\n\n const handler = useCallback(() => {\n const newKey = getKey();\n setCurrent(prev => (prev === newKey ? prev : newKey));\n }, []);\n\n React.useEffect(() => {\n window.addEventListener(\"resize\", handler);\n handler(); // detect on mount\n return () => window.removeEventListener(\"resize\", handler);\n }, [handler]);\n\n return (\n <BreakpointCtx.Provider value={current}>\n {children}\n </BreakpointCtx.Provider>\n );\n};\n"],"names":["isWindow","breakpoints","useState","useCallback","_jsx"],"mappings":"6MAKO,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAiB,IAAI;AAErE;;AAEG;AACH,MAAM,MAAM,GAAG,MAAqB;AAChC,IAAA,IAAI,CAACA,gBAAQ,EAAE,EAAE;;AAEb,QAAA,OAAO,IAAI;IACf;AAEA,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU;AAE/B,IAAA,IAAI,KAAK,GAAGC,iBAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAGA,iBAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAGA,iBAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAGA,iBAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,OAAO,IAAI;AACf,CAAC;MAEY,kBAAkB,GAAG,CAAC,EAAE,QAAQ,EAA4B,KAAI;IACzE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGC,cAAQ,CAAiB,IAAI,CAAC;AAE5D,IAAA,MAAM,OAAO,GAAGC,iBAAW,CAAC,MAAK;AAC7B,QAAA,MAAM,MAAM,GAAG,MAAM,EAAE;AACvB,QAAA,UAAU,CAAC,IAAI,KAAK,IAAI,KAAK,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC;IACzD,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,KAAK,CAAC,SAAS,CAAC,MAAK;AACjB,QAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC1C,OAAO,EAAE,CAAC;QACV,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC;AAC9D,IAAA,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AAEb,IAAA,QACIC,cAAA,CAAC,aAAa,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EACjC,QAAQ,EAAA,CACY;AAEjC"}
|
|
@@ -19,14 +19,12 @@ const getKey = () => {
|
|
|
19
19
|
return "xl";
|
|
20
20
|
};
|
|
21
21
|
const BreakpointProvider = ({ children }) => {
|
|
22
|
-
const [current, setCurrent] = useState(
|
|
22
|
+
const [current, setCurrent] = useState("xs");
|
|
23
23
|
const handler = useCallback(() => {
|
|
24
24
|
const newKey = getKey();
|
|
25
25
|
setCurrent(prev => (prev === newKey ? prev : newKey));
|
|
26
26
|
}, []);
|
|
27
27
|
React__default.useEffect(() => {
|
|
28
|
-
if (!isWindow())
|
|
29
|
-
return;
|
|
30
28
|
window.addEventListener("resize", handler);
|
|
31
29
|
handler(); // detect on mount
|
|
32
30
|
return () => window.removeEventListener("resize", handler);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreakpointProvider.mjs","sources":["../../src/breakpoint/BreakpointProvider.tsx"],"sourcesContent":["import React, { ReactNode, useState, useCallback } from \"react\";\nimport isWindow from \"../isWindow\";\nimport { breakpoints } from \"../css\";\nimport { BreakpointKeys } from \"../css/types\";\n\nexport const BreakpointCtx = React.createContext<BreakpointKeys>(\"xs\");\n\n/**\n * SSR-safe breakpoint detection\n */\nconst getKey = (): BreakpointKeys => {\n if (!isWindow()) {\n // Server fallback (mobile-first)\n return \"xs\";\n }\n\n const width = window.innerWidth;\n\n if (width < breakpoints.sm) return \"xs\";\n if (width < breakpoints.md) return \"sm\";\n if (width < breakpoints.lg) return \"md\";\n if (width < breakpoints.xl) return \"lg\";\n return \"xl\";\n};\n\nexport const BreakpointProvider = ({ children }: { children?: ReactNode }) => {\n const [current, setCurrent] = useState<BreakpointKeys>(
|
|
1
|
+
{"version":3,"file":"BreakpointProvider.mjs","sources":["../../src/breakpoint/BreakpointProvider.tsx"],"sourcesContent":["import React, { ReactNode, useState, useCallback } from \"react\";\nimport isWindow from \"../isWindow\";\nimport { breakpoints } from \"../css\";\nimport { BreakpointKeys } from \"../css/types\";\n\nexport const BreakpointCtx = React.createContext<BreakpointKeys>(\"xs\");\n\n/**\n * SSR-safe breakpoint detection\n */\nconst getKey = (): BreakpointKeys => {\n if (!isWindow()) {\n // Server fallback (mobile-first)\n return \"xs\";\n }\n\n const width = window.innerWidth;\n\n if (width < breakpoints.sm) return \"xs\";\n if (width < breakpoints.md) return \"sm\";\n if (width < breakpoints.lg) return \"md\";\n if (width < breakpoints.xl) return \"lg\";\n return \"xl\";\n};\n\nexport const BreakpointProvider = ({ children }: { children?: ReactNode }) => {\n const [current, setCurrent] = useState<BreakpointKeys>(\"xs\");\n\n const handler = useCallback(() => {\n const newKey = getKey();\n setCurrent(prev => (prev === newKey ? prev : newKey));\n }, []);\n\n React.useEffect(() => {\n window.addEventListener(\"resize\", handler);\n handler(); // detect on mount\n return () => window.removeEventListener(\"resize\", handler);\n }, [handler]);\n\n return (\n <BreakpointCtx.Provider value={current}>\n {children}\n </BreakpointCtx.Provider>\n );\n};\n"],"names":["React","_jsx"],"mappings":"6KAKO,MAAM,aAAa,GAAGA,cAAK,CAAC,aAAa,CAAiB,IAAI;AAErE;;AAEG;AACH,MAAM,MAAM,GAAG,MAAqB;AAChC,IAAA,IAAI,CAAC,QAAQ,EAAE,EAAE;;AAEb,QAAA,OAAO,IAAI;IACf;AAEA,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU;AAE/B,IAAA,IAAI,KAAK,GAAG,WAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAG,WAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAG,WAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAG,WAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,OAAO,IAAI;AACf,CAAC;MAEY,kBAAkB,GAAG,CAAC,EAAE,QAAQ,EAA4B,KAAI;IACzE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC;AAE5D,IAAA,MAAM,OAAO,GAAG,WAAW,CAAC,MAAK;AAC7B,QAAA,MAAM,MAAM,GAAG,MAAM,EAAE;AACvB,QAAA,UAAU,CAAC,IAAI,KAAK,IAAI,KAAK,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC;IACzD,CAAC,EAAE,EAAE,CAAC;AAEN,IAAAA,cAAK,CAAC,SAAS,CAAC,MAAK;AACjB,QAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC1C,OAAO,EAAE,CAAC;QACV,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC;AAC9D,IAAA,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AAEb,IAAA,QACIC,GAAA,CAAC,aAAa,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EACjC,QAAQ,EAAA,CACY;AAEjC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var index=require('
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var index=require('../css/index.js'),React=require('react');const animationEases = {
|
|
2
2
|
easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
3
3
|
easeOut: "cubic-bezier(0.0, 0, 0.2, 1)",
|
|
4
4
|
easeIn: "cubic-bezier(0.4, 0, 1, 1)",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnimation.js","sources":["../../src/hooks/useAnimation.ts"],"sourcesContent":["import { css } from '../css'\nimport { useId } from 'react'\nimport { CSSProps } from '../css/types'\n\nexport const animationEases = {\n easeInOut: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n easeOut: \"cubic-bezier(0.0, 0, 0.2, 1)\",\n easeIn: \"cubic-bezier(0.4, 0, 1, 1)\",\n sharp: \"cubic-bezier(0.4, 0, 0.6, 1)\",\n linear: \"cubic-bezier(0, 0, 1, 1)\",\n easeBounceOut: \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n}\n\nexport interface UseAnimationProps {\n delay?: number;\n duration?: number;\n from: CSSProps;\n to: CSSProps;\n ease?: keyof typeof animationEases;\n}\n\nconst useAnimation = ({ from, to, delay, ease, duration }: UseAnimationProps) => {\n let _delay = delay || 0;\n let _duration = duration || 600;\n let _ease = ease || \"easeBounceOut\"\n const id = \"anim\" + useId().replace(/:/g, \"\")\n const anim = css({\n animationName: id,\n animationDelay: _delay + \"ms\",\n animationDuration: _duration + \"ms\",\n animationTimingFunction: animationEases[_ease] || animationEases.easeBounceOut,\n [`@keyframes ${id}`]: {\n from: from as any,\n to: to as any\n }\n })\n return anim.classname\n}\n\nexport default useAnimation"],"names":["useId","css"],"mappings":"kIAIO,MAAM,cAAc,GAAG;AAC1B,IAAA,SAAS,EAAE,8BAA8B;AACzC,IAAA,OAAO,EAAE,8BAA8B;AACvC,IAAA,MAAM,EAAE,4BAA4B;AACpC,IAAA,KAAK,EAAE,8BAA8B;AACrC,IAAA,MAAM,EAAE,0BAA0B;AAClC,IAAA,aAAa,EAAE;;AAWnB,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAqB,KAAI;AAC5E,IAAA,IAAI,MAAM,GAAG,KAAK,IAAI,CAAC;AACvB,IAAA,IAAI,SAAS,GAAG,QAAQ,IAAI,GAAG;AAC/B,IAAA,IAAI,KAAK,GAAG,IAAI,IAAI,eAAe;AACnC,IAAA,MAAM,EAAE,GAAG,MAAM,GAAGA,WAAK,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;IAC7C,MAAM,IAAI,GAAGC,SAAG,CAAC;AACb,QAAA,aAAa,EAAE,EAAE;QACjB,cAAc,EAAE,MAAM,GAAG,IAAI;QAC7B,iBAAiB,EAAE,SAAS,GAAG,IAAI;QACnC,uBAAuB,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,aAAa;AAC9E,QAAA,CAAC,CAAA,WAAA,EAAc,EAAE,CAAA,CAAE,GAAG;AAClB,YAAA,IAAI,EAAE,IAAW;AACjB,YAAA,EAAE,EAAE;AACP;AACJ,KAAA,CAAC;IACF,OAAO,IAAI,CAAC,SAAS;AACzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {css}from'
|
|
1
|
+
import {css}from'../css/index.mjs';import {useId}from'react';const animationEases = {
|
|
2
2
|
easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
3
3
|
easeOut: "cubic-bezier(0.0, 0, 0.2, 1)",
|
|
4
4
|
easeIn: "cubic-bezier(0.4, 0, 1, 1)",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnimation.mjs","sources":["../../src/hooks/useAnimation.ts"],"sourcesContent":["import { css } from '../css'\nimport { useId } from 'react'\nimport { CSSProps } from '../css/types'\n\nexport const animationEases = {\n easeInOut: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n easeOut: \"cubic-bezier(0.0, 0, 0.2, 1)\",\n easeIn: \"cubic-bezier(0.4, 0, 1, 1)\",\n sharp: \"cubic-bezier(0.4, 0, 0.6, 1)\",\n linear: \"cubic-bezier(0, 0, 1, 1)\",\n easeBounceOut: \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n}\n\nexport interface UseAnimationProps {\n delay?: number;\n duration?: number;\n from: CSSProps;\n to: CSSProps;\n ease?: keyof typeof animationEases;\n}\n\nconst useAnimation = ({ from, to, delay, ease, duration }: UseAnimationProps) => {\n let _delay = delay || 0;\n let _duration = duration || 600;\n let _ease = ease || \"easeBounceOut\"\n const id = \"anim\" + useId().replace(/:/g, \"\")\n const anim = css({\n animationName: id,\n animationDelay: _delay + \"ms\",\n animationDuration: _duration + \"ms\",\n animationTimingFunction: animationEases[_ease] || animationEases.easeBounceOut,\n [`@keyframes ${id}`]: {\n from: from as any,\n to: to as any\n }\n })\n return anim.classname\n}\n\nexport default useAnimation"],"names":[],"mappings":"6DAIO,MAAM,cAAc,GAAG;AAC1B,IAAA,SAAS,EAAE,8BAA8B;AACzC,IAAA,OAAO,EAAE,8BAA8B;AACvC,IAAA,MAAM,EAAE,4BAA4B;AACpC,IAAA,KAAK,EAAE,8BAA8B;AACrC,IAAA,MAAM,EAAE,0BAA0B;AAClC,IAAA,aAAa,EAAE;;AAWnB,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAqB,KAAI;AAC5E,IAAA,IAAI,MAAM,GAAG,KAAK,IAAI,CAAC;AACvB,IAAA,IAAI,SAAS,GAAG,QAAQ,IAAI,GAAG;AAC/B,IAAA,IAAI,KAAK,GAAG,IAAI,IAAI,eAAe;AACnC,IAAA,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;IAC7C,MAAM,IAAI,GAAG,GAAG,CAAC;AACb,QAAA,aAAa,EAAE,EAAE;QACjB,cAAc,EAAE,MAAM,GAAG,IAAI;QAC7B,iBAAiB,EAAE,SAAS,GAAG,IAAI;QACnC,uBAAuB,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,aAAa;AAC9E,QAAA,CAAC,CAAA,WAAA,EAAc,EAAE,CAAA,CAAE,GAAG;AAClB,YAAA,IAAI,EAAE,IAAW;AACjB,YAAA,EAAE,EAAE;AACP;AACJ,KAAA,CAAC;IACF,OAAO,IAAI,CAAC,SAAS;AACzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});require('
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});require('../theme/ThemeDefaultOptions.js');var core=require('../theme/core.js');require('../css/getValue.js'),require('oncss'),require('tslib'),require('react/jsx-runtime'),require('react'),require('../Tag/index.js'),require('react-state-bucket');const useColorTemplate = (color, type) => {
|
|
2
2
|
var _a;
|
|
3
3
|
const theme = core.useTheme();
|
|
4
4
|
let _color = color === 'default' ? "background" : color;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useColorTemplate.js","sources":["../../src/hooks/useColorTemplate.ts"],"sourcesContent":["import { useTheme } from \"../theme\"\nexport type ColorTemplateColors = \"default\" | \"brand\" | \"accent\" | \"info\" | \"success\" | \"warning\" | \"danger\"\nexport type ColorTemplateType = \"fill\" | \"outline\" | \"text\" | \"alpha\"\n\nconst useColorTemplate = (color: ColorTemplateColors, type: ColorTemplateType) => {\n const theme: any = useTheme()\n let _color = color === 'default' ? \"background\" : color as any\n return theme.colors[_color]?.template[type]\n}\n\nexport default useColorTemplate"],"names":["useTheme"],"mappings":"6TAIA,MAAM,gBAAgB,GAAG,CAAC,KAA0B,EAAE,IAAuB,KAAI;;AAC7E,IAAA,MAAM,KAAK,GAAQA,aAAQ,EAAE;AAC7B,IAAA,IAAI,MAAM,GAAG,KAAK,KAAK,SAAS,GAAG,YAAY,GAAG,KAAY;AAC9D,IAAA,OAAO,CAAA,EAAA,GAAA,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,QAAQ,CAAC,IAAI,CAAC;AAC/C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import'
|
|
1
|
+
import'../theme/ThemeDefaultOptions.mjs';import {useTheme}from'../theme/core.mjs';import'../css/getValue.mjs';import'oncss';import'tslib';import'react/jsx-runtime';import'react';import'../Tag/index.mjs';import'react-state-bucket';const useColorTemplate = (color, type) => {
|
|
2
2
|
var _a;
|
|
3
3
|
const theme = useTheme();
|
|
4
4
|
let _color = color === 'default' ? "background" : color;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useColorTemplate.mjs","sources":["../../src/hooks/useColorTemplate.ts"],"sourcesContent":["import { useTheme } from \"../theme\"\nexport type ColorTemplateColors = \"default\" | \"brand\" | \"accent\" | \"info\" | \"success\" | \"warning\" | \"danger\"\nexport type ColorTemplateType = \"fill\" | \"outline\" | \"text\" | \"alpha\"\n\nconst useColorTemplate = (color: ColorTemplateColors, type: ColorTemplateType) => {\n const theme: any = useTheme()\n let _color = color === 'default' ? \"background\" : color as any\n return theme.colors[_color]?.template[type]\n}\n\nexport default useColorTemplate"],"names":[],"mappings":"sOAIA,MAAM,gBAAgB,GAAG,CAAC,KAA0B,EAAE,IAAuB,KAAI;;AAC7E,IAAA,MAAM,KAAK,GAAQ,QAAQ,EAAE;AAC7B,IAAA,IAAI,MAAM,GAAG,KAAK,KAAK,SAAS,GAAG,YAAY,GAAG,KAAY;AAC9D,IAAA,OAAO,CAAA,EAAA,GAAA,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,QAAQ,CAAC,IAAI,CAAC;AAC/C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});require('
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});require('../theme/ThemeDefaultOptions.js');var core=require('../theme/core.js');require('../css/getValue.js'),require('oncss'),require('tslib'),require('react/jsx-runtime'),require('react'),require('../Tag/index.js'),require('react-state-bucket');const useInterface = (name, userPorps, defaultProps) => {
|
|
2
2
|
const theme = core.useTheme();
|
|
3
3
|
const _interface = theme.interfaces[name];
|
|
4
4
|
if (_interface) {
|