@xanui/core 1.3.5 → 1.3.8
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.cjs +1 -1
- package/AppRoot/index.cjs.map +1 -1
- package/AppRoot/index.js +1 -1
- package/AppRoot/index.js.map +1 -1
- package/Tag/index.cjs +2 -2
- package/Tag/index.cjs.map +1 -1
- package/Tag/index.js +2 -2
- package/Tag/index.js.map +1 -1
- package/Tag/types.d.ts +2 -1
- package/Tag/useTagProps.cjs +60 -34
- package/Tag/useTagProps.cjs.map +1 -1
- package/Tag/useTagProps.d.ts +1 -0
- package/Tag/useTagProps.js +60 -34
- package/Tag/useTagProps.js.map +1 -1
- package/Transition/variants.cjs +2 -3
- package/Transition/variants.cjs.map +1 -1
- package/Transition/variants.js +2 -3
- package/Transition/variants.js.map +1 -1
- package/package.json +1 -1
- package/theme/ThemeCssVars.cjs +150 -3
- package/theme/ThemeCssVars.cjs.map +1 -1
- package/theme/ThemeCssVars.js +150 -3
- package/theme/ThemeCssVars.js.map +1 -1
- package/theme/ThemeDefaultOptions.cjs +6 -6
- package/theme/ThemeDefaultOptions.cjs.map +1 -1
- package/theme/ThemeDefaultOptions.js +6 -6
- package/theme/ThemeDefaultOptions.js.map +1 -1
- package/theme/ThemeProvider.cjs +2 -1
- package/theme/ThemeProvider.cjs.map +1 -1
- package/theme/ThemeProvider.d.ts +3 -3
- package/theme/ThemeProvider.js +3 -2
- package/theme/ThemeProvider.js.map +1 -1
- package/theme/core.cjs +9 -5
- package/theme/core.cjs.map +1 -1
- package/theme/core.d.ts +1 -1
- package/theme/core.js +10 -6
- package/theme/core.js.map +1 -1
- package/theme/types.d.ts +5 -1
package/AppRoot/index.cjs
CHANGED
|
@@ -36,7 +36,7 @@ const AppRoot = React.forwardRef((_a, ref) => {
|
|
|
36
36
|
React.useEffect(() => {
|
|
37
37
|
if (typeof _document === 'undefined')
|
|
38
38
|
return;
|
|
39
|
-
if (!cookie.exists("xuitm")) {
|
|
39
|
+
if (!cookie.exists("xuitm") && theme.name) {
|
|
40
40
|
cookie.set("xuitm", theme.name);
|
|
41
41
|
}
|
|
42
42
|
const styles = Array.from(_document.querySelectorAll('body style[data-oncss]'));
|
package/AppRoot/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { useEffect, useId, useLayoutEffect, useRef } from 'react';\nimport { TagComponentType } from '../Tag/types';\nimport { ThemeProvider, ThemeProviderProps } from '../theme';\nimport { BreakpointProvider } from '../breakpoint';\nimport { RenderRenderar } from './Renderar';\nimport { DocumentProvider } from '../Document';\nimport { AppRootProvider } from './AppRootProvider';\nimport useMergeRefs from '../hooks/useMergeRefs';\nimport { CSSCacheProvider } from '../css/CSSCacheProvider';\nimport { BreakpointKeys } from '../css/types';\nimport Cookie from '../cookie';\n\nexport type AppRootProps<T extends TagComponentType = \"div\"> = ThemeProviderProps<T> & {\n noScrollbarCss?: boolean;\n document?: Document;\n CSSCacheId?: string;\n disableRenderar?: boolean;\n defaultBreakpoint?: BreakpointKeys\n selectionColor?: \"default\" | \"brand\" | \"accent\" | \"success\" | \"info\" | \"warning\" | \"danger\";\n}\n\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, defaultBreakpoint, noScrollbarCss, CSSCacheId, theme, onThemeChange, disableRenderar, selectionColor, document: _document, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\n\n noScrollbarCss ??= false\n selectionColor ??= \"brand\"\n if (typeof window !== \"undefined\") {\n _document ??= document\n }\n disableRenderar ??= false\n const docid = useId()\n const csscacheId = useId()\n CSSCacheId ??= csscacheId\n\n const [visibility, setVisibility] = React.useState<string>(!defaultBreakpoint ? \"hidden\" : \"\");\n const rootRef = useRef(null)\n const mergeRef = useMergeRefs(rootRef, ref)\n\n useLayoutEffect(() => {\n !defaultBreakpoint && setVisibility(\"\");\n }, [])\n\n useEffect(() => {\n if (typeof _document === 'undefined') return;\n if (!Cookie.exists(\"xuitm\")) {\n Cookie.set(\"xuitm\", theme.name)\n }\n
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { useEffect, useId, useLayoutEffect, useRef } from 'react';\nimport { TagComponentType } from '../Tag/types';\nimport { ThemeProvider, ThemeProviderProps } from '../theme';\nimport { BreakpointProvider } from '../breakpoint';\nimport { RenderRenderar } from './Renderar';\nimport { DocumentProvider } from '../Document';\nimport { AppRootProvider } from './AppRootProvider';\nimport useMergeRefs from '../hooks/useMergeRefs';\nimport { CSSCacheProvider } from '../css/CSSCacheProvider';\nimport { BreakpointKeys } from '../css/types';\nimport Cookie from '../cookie';\n\nexport type AppRootProps<T extends TagComponentType = \"div\"> = ThemeProviderProps<T> & {\n noScrollbarCss?: boolean;\n document?: Document;\n CSSCacheId?: string;\n disableRenderar?: boolean;\n defaultBreakpoint?: BreakpointKeys\n selectionColor?: \"default\" | \"brand\" | \"accent\" | \"success\" | \"info\" | \"warning\" | \"danger\";\n}\n\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, defaultBreakpoint, noScrollbarCss, CSSCacheId, theme, onThemeChange, disableRenderar, selectionColor, document: _document, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\n\n noScrollbarCss ??= false\n selectionColor ??= \"brand\"\n if (typeof window !== \"undefined\") {\n _document ??= document\n }\n disableRenderar ??= false\n const docid = useId()\n const csscacheId = useId()\n CSSCacheId ??= csscacheId\n\n const [visibility, setVisibility] = React.useState<string>(!defaultBreakpoint ? \"hidden\" : \"\");\n const rootRef = useRef(null)\n const mergeRef = useMergeRefs(rootRef, ref)\n\n useLayoutEffect(() => {\n !defaultBreakpoint && setVisibility(\"\");\n }, [])\n\n useEffect(() => {\n if (typeof _document === 'undefined') return;\n if (!Cookie.exists(\"xuitm\") && theme.name) {\n Cookie.set(\"xuitm\", theme.name)\n }\n const styles = Array.from(_document.querySelectorAll('body style[data-oncss]'));\n styles.forEach((style) => {\n _document.head.appendChild(style);\n });\n }, [])\n\n let selection: any = {}\n if (selectionColor && selectionColor !== 'default') {\n selection = {\n \"&::selection\": {\n bgcolor: `${selectionColor}.primary`,\n color: `${selectionColor}.text`\n }\n }\n }\n\n return (\n <DocumentProvider value={_document ? { document: _document, id: docid } : undefined}>\n <CSSCacheProvider cacheId={CSSCacheId}>\n <AppRootProvider element={() => rootRef.current}>\n <ThemeProvider\n theme={theme}\n onThemeChange={(t) => {\n onThemeChange && onThemeChange(t)\n Cookie.set(\"xuitm\", t.name)\n }}\n {...props}\n ref={mergeRef}\n isRoot\n sx={{\n ...props.sx,\n ...(visibility === \"hidden\" ? { visibility: \"hidden\" } : {}),\n ...selection\n }}\n >\n <BreakpointProvider defaultKey={defaultBreakpoint ?? \"xl\"}>\n {children}\n {!disableRenderar && <RenderRenderar />}\n </BreakpointProvider>\n </ThemeProvider>\n </AppRootProvider>\n </CSSCacheProvider>\n </DocumentProvider>\n )\n})\n\nexport default AppRoot\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAsBA;;;;AAIG;;;;AAIA;AACA;;;AAIA;;;AAIG;;;;;AAKA;;;AAGA;AACA;AACG;AACH;;;AAIH;AACG;AACG;;;AAGC;;;;AAWW;;AAEH;AAmBlB;;"}
|
package/AppRoot/index.js
CHANGED
|
@@ -34,7 +34,7 @@ const AppRoot = React__default.forwardRef((_a, ref) => {
|
|
|
34
34
|
useEffect(() => {
|
|
35
35
|
if (typeof _document === 'undefined')
|
|
36
36
|
return;
|
|
37
|
-
if (!Cookie.exists("xuitm")) {
|
|
37
|
+
if (!Cookie.exists("xuitm") && theme.name) {
|
|
38
38
|
Cookie.set("xuitm", theme.name);
|
|
39
39
|
}
|
|
40
40
|
const styles = Array.from(_document.querySelectorAll('body style[data-oncss]'));
|
package/AppRoot/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { useEffect, useId, useLayoutEffect, useRef } from 'react';\nimport { TagComponentType } from '../Tag/types';\nimport { ThemeProvider, ThemeProviderProps } from '../theme';\nimport { BreakpointProvider } from '../breakpoint';\nimport { RenderRenderar } from './Renderar';\nimport { DocumentProvider } from '../Document';\nimport { AppRootProvider } from './AppRootProvider';\nimport useMergeRefs from '../hooks/useMergeRefs';\nimport { CSSCacheProvider } from '../css/CSSCacheProvider';\nimport { BreakpointKeys } from '../css/types';\nimport Cookie from '../cookie';\n\nexport type AppRootProps<T extends TagComponentType = \"div\"> = ThemeProviderProps<T> & {\n noScrollbarCss?: boolean;\n document?: Document;\n CSSCacheId?: string;\n disableRenderar?: boolean;\n defaultBreakpoint?: BreakpointKeys\n selectionColor?: \"default\" | \"brand\" | \"accent\" | \"success\" | \"info\" | \"warning\" | \"danger\";\n}\n\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, defaultBreakpoint, noScrollbarCss, CSSCacheId, theme, onThemeChange, disableRenderar, selectionColor, document: _document, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\n\n noScrollbarCss ??= false\n selectionColor ??= \"brand\"\n if (typeof window !== \"undefined\") {\n _document ??= document\n }\n disableRenderar ??= false\n const docid = useId()\n const csscacheId = useId()\n CSSCacheId ??= csscacheId\n\n const [visibility, setVisibility] = React.useState<string>(!defaultBreakpoint ? \"hidden\" : \"\");\n const rootRef = useRef(null)\n const mergeRef = useMergeRefs(rootRef, ref)\n\n useLayoutEffect(() => {\n !defaultBreakpoint && setVisibility(\"\");\n }, [])\n\n useEffect(() => {\n if (typeof _document === 'undefined') return;\n if (!Cookie.exists(\"xuitm\")) {\n Cookie.set(\"xuitm\", theme.name)\n }\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\"use client\";\nimport React, { useEffect, useId, useLayoutEffect, useRef } from 'react';\nimport { TagComponentType } from '../Tag/types';\nimport { ThemeProvider, ThemeProviderProps } from '../theme';\nimport { BreakpointProvider } from '../breakpoint';\nimport { RenderRenderar } from './Renderar';\nimport { DocumentProvider } from '../Document';\nimport { AppRootProvider } from './AppRootProvider';\nimport useMergeRefs from '../hooks/useMergeRefs';\nimport { CSSCacheProvider } from '../css/CSSCacheProvider';\nimport { BreakpointKeys } from '../css/types';\nimport Cookie from '../cookie';\n\nexport type AppRootProps<T extends TagComponentType = \"div\"> = ThemeProviderProps<T> & {\n noScrollbarCss?: boolean;\n document?: Document;\n CSSCacheId?: string;\n disableRenderar?: boolean;\n defaultBreakpoint?: BreakpointKeys\n selectionColor?: \"default\" | \"brand\" | \"accent\" | \"success\" | \"info\" | \"warning\" | \"danger\";\n}\n\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, defaultBreakpoint, noScrollbarCss, CSSCacheId, theme, onThemeChange, disableRenderar, selectionColor, document: _document, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\n\n noScrollbarCss ??= false\n selectionColor ??= \"brand\"\n if (typeof window !== \"undefined\") {\n _document ??= document\n }\n disableRenderar ??= false\n const docid = useId()\n const csscacheId = useId()\n CSSCacheId ??= csscacheId\n\n const [visibility, setVisibility] = React.useState<string>(!defaultBreakpoint ? \"hidden\" : \"\");\n const rootRef = useRef(null)\n const mergeRef = useMergeRefs(rootRef, ref)\n\n useLayoutEffect(() => {\n !defaultBreakpoint && setVisibility(\"\");\n }, [])\n\n useEffect(() => {\n if (typeof _document === 'undefined') return;\n if (!Cookie.exists(\"xuitm\") && theme.name) {\n Cookie.set(\"xuitm\", theme.name)\n }\n const styles = Array.from(_document.querySelectorAll('body style[data-oncss]'));\n styles.forEach((style) => {\n _document.head.appendChild(style);\n });\n }, [])\n\n let selection: any = {}\n if (selectionColor && selectionColor !== 'default') {\n selection = {\n \"&::selection\": {\n bgcolor: `${selectionColor}.primary`,\n color: `${selectionColor}.text`\n }\n }\n }\n\n return (\n <DocumentProvider value={_document ? { document: _document, id: docid } : undefined}>\n <CSSCacheProvider cacheId={CSSCacheId}>\n <AppRootProvider element={() => rootRef.current}>\n <ThemeProvider\n theme={theme}\n onThemeChange={(t) => {\n onThemeChange && onThemeChange(t)\n Cookie.set(\"xuitm\", t.name)\n }}\n {...props}\n ref={mergeRef}\n isRoot\n sx={{\n ...props.sx,\n ...(visibility === \"hidden\" ? { visibility: \"hidden\" } : {}),\n ...selection\n }}\n >\n <BreakpointProvider defaultKey={defaultBreakpoint ?? \"xl\"}>\n {children}\n {!disableRenderar && <RenderRenderar />}\n </BreakpointProvider>\n </ThemeProvider>\n </AppRootProvider>\n </CSSCacheProvider>\n </DocumentProvider>\n )\n})\n\nexport default AppRoot\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAsBA;;;;AAIG;;;;AAIA;AACA;;;AAIA;;;AAIG;;;;;AAKA;;;AAGA;AACA;AACG;AACH;;;AAIH;AACG;AACG;;;AAGC;;;;AAWW;;AAEH;AAmBlB;;"}
|
package/Tag/index.cjs
CHANGED
|
@@ -27,11 +27,11 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
27
27
|
|
|
28
28
|
const Tag = React__namespace.forwardRef((_a, ref) => {
|
|
29
29
|
var { component, children } = _a, rest = tslib.__rest(_a, ["component", "children"]);
|
|
30
|
-
const { props, style } = useTagProps(rest);
|
|
30
|
+
const { props, style, themeStyle } = useTagProps(rest);
|
|
31
31
|
props.ref = ref;
|
|
32
32
|
const ele = React__namespace.createElement(component || "div", props, children);
|
|
33
33
|
if (typeof window === 'undefined') {
|
|
34
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ServerStyleTag, { factory: style }), ele] }));
|
|
34
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ServerStyleTag, { factory: style }), themeStyle && jsxRuntime.jsx(ServerStyleTag, { factory: themeStyle }), ele] }));
|
|
35
35
|
}
|
|
36
36
|
return ele;
|
|
37
37
|
});
|
package/Tag/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/Tag/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { TagComponentType, TagPropsRoot } from './types';\nimport useTagProps from './useTagProps';\nimport ServerStyleTag from './ServerStyleTag';\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 (typeof window === 'undefined') {\n return (\n <>\n <ServerStyleTag factory={style} />\n {ele}\n </>\n )\n }\n return ele\n})\n\nexport default Tag"],"names":["React","__rest","_jsxs","
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Tag/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { TagComponentType, TagPropsRoot } from './types';\nimport useTagProps from './useTagProps';\nimport ServerStyleTag from './ServerStyleTag';\n\nconst Tag = React.forwardRef(<T extends TagComponentType = 'div'>({ component, children, ...rest }: TagPropsRoot<T>, ref: React.Ref<any>) => {\n const { props, style, themeStyle }: any = useTagProps(rest)\n props.ref = ref\n const ele = React.createElement(component || \"div\", props, children)\n if (typeof window === 'undefined') {\n return (\n <>\n <ServerStyleTag factory={style} />\n {themeStyle && <ServerStyleTag factory={themeStyle} />}\n {ele}\n </>\n )\n }\n return ele\n})\n\nexport default Tag"],"names":["React","__rest","_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,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;AAC5F,IAAA,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,GAAQ,WAAW,CAAC,IAAI,CAAC;AAC3D,IAAA,KAAK,CAAC,GAAG,GAAG,GAAG;AACf,IAAA,MAAM,GAAG,GAAGD,gBAAK,CAAC,aAAa,CAAC,SAAS,IAAI,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC;AACpE,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAC/B,QACIE,kDACIC,cAAA,CAAC,cAAc,IAAC,OAAO,EAAE,KAAK,EAAA,CAAI,EACjC,UAAU,IAAIA,cAAA,CAAC,cAAc,EAAA,EAAC,OAAO,EAAE,UAAU,GAAI,EACrD,GAAG,CAAA,EAAA,CACL;IAEX;AACA,IAAA,OAAO,GAAG;AACd,CAAC;;;;"}
|
package/Tag/index.js
CHANGED
|
@@ -6,11 +6,11 @@ import ServerStyleTag from './ServerStyleTag.js';
|
|
|
6
6
|
|
|
7
7
|
const Tag = React.forwardRef((_a, ref) => {
|
|
8
8
|
var { component, children } = _a, rest = __rest(_a, ["component", "children"]);
|
|
9
|
-
const { props, style } = useTagProps(rest);
|
|
9
|
+
const { props, style, themeStyle } = useTagProps(rest);
|
|
10
10
|
props.ref = ref;
|
|
11
11
|
const ele = React.createElement(component || "div", props, children);
|
|
12
12
|
if (typeof window === 'undefined') {
|
|
13
|
-
return (jsxs(Fragment, { children: [jsx(ServerStyleTag, { factory: style }), ele] }));
|
|
13
|
+
return (jsxs(Fragment, { children: [jsx(ServerStyleTag, { factory: style }), themeStyle && jsx(ServerStyleTag, { factory: themeStyle }), ele] }));
|
|
14
14
|
}
|
|
15
15
|
return ele;
|
|
16
16
|
});
|
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';\nimport ServerStyleTag from './ServerStyleTag';\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 (typeof window === 'undefined') {\n return (\n <>\n <ServerStyleTag factory={style} />\n {ele}\n </>\n )\n }\n return ele\n})\n\nexport default Tag"],"names":["_jsxs","
|
|
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 ServerStyleTag from './ServerStyleTag';\n\nconst Tag = React.forwardRef(<T extends TagComponentType = 'div'>({ component, children, ...rest }: TagPropsRoot<T>, ref: React.Ref<any>) => {\n const { props, style, themeStyle }: any = useTagProps(rest)\n props.ref = ref\n const ele = React.createElement(component || \"div\", props, children)\n if (typeof window === 'undefined') {\n return (\n <>\n <ServerStyleTag factory={style} />\n {themeStyle && <ServerStyleTag factory={themeStyle} />}\n {ele}\n </>\n )\n }\n return ele\n})\n\nexport default Tag"],"names":["_jsxs","_jsx"],"mappings":";;;;;;AAKA,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;AAC5F,IAAA,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,GAAQ,WAAW,CAAC,IAAI,CAAC;AAC3D,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,OAAO,MAAM,KAAK,WAAW,EAAE;QAC/B,QACIA,4BACIC,GAAA,CAAC,cAAc,IAAC,OAAO,EAAE,KAAK,EAAA,CAAI,EACjC,UAAU,IAAIA,GAAA,CAAC,cAAc,EAAA,EAAC,OAAO,EAAE,UAAU,GAAI,EACrD,GAAG,CAAA,EAAA,CACL;IAEX;AACA,IAAA,OAAO,GAAG;AACd,CAAC;;;;"}
|
package/Tag/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as CSS from 'csstype';
|
|
2
2
|
import { CSSValueType, BreakpointKeys, Aliases, CSSProps } from '../css/types.js';
|
|
3
|
-
import { ColorsRefTypes, TypographyRefTypes } from '../theme/types.js';
|
|
3
|
+
import { ColorsRefTypes, TypographyRefTypes, ThemeOptionInput } from '../theme/types.js';
|
|
4
4
|
import { classNamesTypes } from 'pretty-class';
|
|
5
5
|
|
|
6
6
|
type TagComponentType = keyof React.JSX.IntrinsicElements | React.ComponentType<any>;
|
|
@@ -176,6 +176,7 @@ type CSSPropAsAttr = Partial<TagCSSProperties> & Aliases & {
|
|
|
176
176
|
hover?: CSSProps;
|
|
177
177
|
disabled?: boolean;
|
|
178
178
|
classNames?: classNamesTypes;
|
|
179
|
+
theme?: ThemeOptionInput;
|
|
179
180
|
};
|
|
180
181
|
|
|
181
182
|
export type { CSSPropAsAttr, TagCSSProperties, TagComponentType, TagProps, TagPropsRoot };
|
package/Tag/useTagProps.cjs
CHANGED
|
@@ -1,54 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
4
|
+
var tslib = require('tslib');
|
|
5
|
+
var React = require('react');
|
|
3
6
|
var cssPropList = require('./cssPropList.cjs');
|
|
4
7
|
var index$1 = require('../css/index.cjs');
|
|
5
8
|
var prettyClass = require('pretty-class');
|
|
6
|
-
var React = require('react');
|
|
7
9
|
var index = require('../Document/index.cjs');
|
|
8
10
|
var CSSCacheProvider = require('../css/CSSCacheProvider.cjs');
|
|
11
|
+
var ThemeCssVars = require('../theme/ThemeCssVars.cjs');
|
|
9
12
|
|
|
10
13
|
const useTagProps = (props) => {
|
|
11
|
-
const cachekey = JSON.stringify(props, (key, value) => {
|
|
12
|
-
return key === '_owner' || key === '_store' ? undefined : value;
|
|
13
|
-
}, 2);
|
|
14
14
|
const doc = index.useDocument();
|
|
15
15
|
const cacheId = CSSCacheProvider.useCSSCacheId();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (!cssPropList[key]) {
|
|
29
|
-
_props[key] = val;
|
|
16
|
+
// Extract known styling-related props
|
|
17
|
+
const { sx, sxr, style, hover, className, classNames: clsNames, baseClass, theme } = props, rest = tslib.__rest(props, ["sx", "sxr", "style", "hover", "className", "classNames", "baseClass", "theme"]);
|
|
18
|
+
/**
|
|
19
|
+
* Split DOM props vs CSS props
|
|
20
|
+
*/
|
|
21
|
+
const { domProps, cssProps } = React.useMemo(() => {
|
|
22
|
+
const _dom = {};
|
|
23
|
+
const _css = {};
|
|
24
|
+
for (const key in rest) {
|
|
25
|
+
const val = rest[key];
|
|
26
|
+
if (cssPropList[key]) {
|
|
27
|
+
_css[key] = val;
|
|
30
28
|
}
|
|
31
29
|
else {
|
|
32
|
-
|
|
30
|
+
_dom[key] = val;
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
return { domProps: _dom, cssProps: _css };
|
|
34
|
+
}, [rest]);
|
|
35
|
+
/**
|
|
36
|
+
* Generate styles
|
|
37
|
+
*/
|
|
38
|
+
const { styles, themeStyle } = React.useMemo(() => {
|
|
39
|
+
const hoverStyles = hover && Object.keys(hover).length > 0
|
|
40
|
+
? { "&:hover": hover }
|
|
41
|
+
: undefined;
|
|
42
|
+
const cls = index$1.css(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, sxr), cssProps), sx), style), hoverStyles), {
|
|
43
|
+
injectStyle: typeof window !== "undefined",
|
|
37
44
|
container: doc === null || doc === void 0 ? void 0 : doc.document,
|
|
38
|
-
cacheId
|
|
45
|
+
cacheId,
|
|
39
46
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
let themeStyle;
|
|
48
|
+
if (theme) {
|
|
49
|
+
themeStyle = index$1.css({
|
|
50
|
+
"@global": {
|
|
51
|
+
[`.${cls.classname}`]: ThemeCssVars(theme)
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
injectStyle: typeof window !== "undefined",
|
|
55
|
+
container: doc === null || doc === void 0 ? void 0 : doc.document,
|
|
56
|
+
cacheId,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return { styles: cls, themeStyle };
|
|
60
|
+
}, [sx, sxr, style, hover, cssProps, doc, cacheId, theme]);
|
|
61
|
+
/**
|
|
62
|
+
* Compose className
|
|
63
|
+
*/
|
|
64
|
+
const finalClassName = React.useMemo(() => {
|
|
65
|
+
return prettyClass.classNames(baseClass ? "xui-" + baseClass : undefined, clsNames, className, styles.classname);
|
|
66
|
+
}, [baseClass, clsNames, className, styles.classname]);
|
|
67
|
+
/**
|
|
68
|
+
* Final props
|
|
69
|
+
*/
|
|
70
|
+
const finalProps = React.useMemo(() => {
|
|
71
|
+
return Object.assign(Object.assign({}, domProps), { className: finalClassName });
|
|
72
|
+
}, [domProps, finalClassName]);
|
|
73
|
+
return {
|
|
74
|
+
props: finalProps,
|
|
75
|
+
style: styles,
|
|
76
|
+
themeStyle
|
|
77
|
+
};
|
|
52
78
|
};
|
|
53
79
|
|
|
54
80
|
module.exports = useTagProps;
|
package/Tag/useTagProps.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTagProps.cjs","sources":["../../src/Tag/useTagProps.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"useTagProps.cjs","sources":["../../src/Tag/useTagProps.ts"],"sourcesContent":["\"use client\"\nimport { useMemo } from \"react\";\nimport { TagComponentType, TagProps, TagPropsRoot } from \"./types\";\nimport cssPropList from \"./cssPropList\";\nimport { css } from \"../css\";\nimport { classNames } from \"pretty-class\";\nimport { CSSFactoryType } from \"oncss\";\nimport { useDocument } from \"../Document\";\nimport { useCSSCacheId } from \"../css/CSSCacheProvider\";\nimport ThemeCssVars from \"../theme/ThemeCssVars\";\nimport { createTheme } from \"../theme\";\n\nexport type useTagPropsReturn<T extends TagComponentType = \"div\"> = {\n props: TagProps<T>;\n style: CSSFactoryType;\n themeStyle?: CSSFactoryType;\n};\n\nconst useTagProps = <T extends TagComponentType = \"div\">(props: TagPropsRoot<T>): useTagPropsReturn<T> => {\n const doc = useDocument();\n const cacheId = useCSSCacheId();\n\n // Extract known styling-related props\n const {\n sx,\n sxr,\n style,\n hover,\n className,\n classNames: clsNames,\n baseClass,\n theme,\n ...rest\n } = props;\n\n /**\n * Split DOM props vs CSS props\n */\n const { domProps, cssProps } = useMemo(() => {\n const _dom: any = {};\n const _css: any = {};\n\n for (const key in rest) {\n const val = (rest as any)[key];\n if (cssPropList[key]) {\n _css[key] = val;\n } else {\n _dom[key] = val;\n }\n }\n\n return { domProps: _dom, cssProps: _css };\n }, [rest]);\n\n /**\n * Generate styles\n */\n const { styles, themeStyle } = useMemo(() => {\n const hoverStyles =\n hover && Object.keys(hover).length > 0\n ? { \"&:hover\": hover }\n : undefined;\n\n const cls = css(\n {\n ...sxr,\n ...cssProps,\n ...sx,\n ...style,\n ...hoverStyles,\n },\n {\n injectStyle: typeof window !== \"undefined\",\n container: doc?.document,\n cacheId,\n }\n );\n\n let themeStyle\n if (theme) {\n themeStyle = css({\n \"@global\": {\n [`.${cls.classname}`]: ThemeCssVars(theme as any)\n }\n },\n {\n injectStyle: typeof window !== \"undefined\",\n container: doc?.document,\n cacheId,\n }\n );\n }\n\n return { styles: cls, themeStyle }\n }, [sx, sxr, style, hover, cssProps, doc, cacheId, theme]);\n\n\n /**\n * Compose className\n */\n const finalClassName = useMemo(() => {\n return classNames(\n baseClass ? \"xui-\" + baseClass : undefined,\n clsNames,\n className,\n styles.classname\n );\n }, [baseClass, clsNames, className, styles.classname]);\n\n /**\n * Final props\n */\n const finalProps = useMemo(() => {\n return {\n ...domProps,\n className: finalClassName,\n };\n }, [domProps, finalClassName]);\n\n return {\n props: finalProps,\n style: styles,\n themeStyle\n };\n};\n\nexport default useTagProps;"],"names":[],"mappings":";;;;;;;;;;;;AAkBA;AACG;AACA;;;AAeA;;AAEG;;;;AAKA;AACG;AACA;AACG;;;AAEA;;;;AAKT;AAEA;;AAEG;;AAEA;AAEM;;AAGN;AASM;AACA;;AAEF;AAGJ;;;AAGM;;AAEC;;AAGE;AACA;;AAEF;;AAIP;AACH;AAGA;;AAEG;AACH;;AAOA;AAEA;;AAEG;AACH;AACG;AAIH;;AAGG;AACA;;;AAGN;;"}
|
package/Tag/useTagProps.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { CSSFactoryType } from 'oncss';
|
|
|
4
4
|
type useTagPropsReturn<T extends TagComponentType = "div"> = {
|
|
5
5
|
props: TagProps<T>;
|
|
6
6
|
style: CSSFactoryType;
|
|
7
|
+
themeStyle?: CSSFactoryType;
|
|
7
8
|
};
|
|
8
9
|
declare const useTagProps: <T extends TagComponentType = "div">(props: TagPropsRoot<T>) => useTagPropsReturn<T>;
|
|
9
10
|
|
package/Tag/useTagProps.js
CHANGED
|
@@ -1,52 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { __rest } from 'tslib';
|
|
3
|
+
import { useMemo } from 'react';
|
|
1
4
|
import CSS_PROP_LIST from './cssPropList.js';
|
|
2
5
|
import { css } from '../css/index.js';
|
|
3
6
|
import { classNames } from 'pretty-class';
|
|
4
|
-
import { useMemo } from 'react';
|
|
5
7
|
import { useDocument } from '../Document/index.js';
|
|
6
8
|
import { useCSSCacheId } from '../css/CSSCacheProvider.js';
|
|
9
|
+
import ThemeCssVars from '../theme/ThemeCssVars.js';
|
|
7
10
|
|
|
8
11
|
const useTagProps = (props) => {
|
|
9
|
-
const cachekey = JSON.stringify(props, (key, value) => {
|
|
10
|
-
return key === '_owner' || key === '_store' ? undefined : value;
|
|
11
|
-
}, 2);
|
|
12
12
|
const doc = useDocument();
|
|
13
13
|
const cacheId = useCSSCacheId();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (!CSS_PROP_LIST[key]) {
|
|
27
|
-
_props[key] = val;
|
|
14
|
+
// Extract known styling-related props
|
|
15
|
+
const { sx, sxr, style, hover, className, classNames: clsNames, baseClass, theme } = props, rest = __rest(props, ["sx", "sxr", "style", "hover", "className", "classNames", "baseClass", "theme"]);
|
|
16
|
+
/**
|
|
17
|
+
* Split DOM props vs CSS props
|
|
18
|
+
*/
|
|
19
|
+
const { domProps, cssProps } = useMemo(() => {
|
|
20
|
+
const _dom = {};
|
|
21
|
+
const _css = {};
|
|
22
|
+
for (const key in rest) {
|
|
23
|
+
const val = rest[key];
|
|
24
|
+
if (CSS_PROP_LIST[key]) {
|
|
25
|
+
_css[key] = val;
|
|
28
26
|
}
|
|
29
27
|
else {
|
|
30
|
-
|
|
28
|
+
_dom[key] = val;
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
return { domProps: _dom, cssProps: _css };
|
|
32
|
+
}, [rest]);
|
|
33
|
+
/**
|
|
34
|
+
* Generate styles
|
|
35
|
+
*/
|
|
36
|
+
const { styles, themeStyle } = useMemo(() => {
|
|
37
|
+
const hoverStyles = hover && Object.keys(hover).length > 0
|
|
38
|
+
? { "&:hover": hover }
|
|
39
|
+
: undefined;
|
|
40
|
+
const cls = css(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, sxr), cssProps), sx), style), hoverStyles), {
|
|
41
|
+
injectStyle: typeof window !== "undefined",
|
|
35
42
|
container: doc === null || doc === void 0 ? void 0 : doc.document,
|
|
36
|
-
cacheId
|
|
43
|
+
cacheId,
|
|
37
44
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
let themeStyle;
|
|
46
|
+
if (theme) {
|
|
47
|
+
themeStyle = css({
|
|
48
|
+
"@global": {
|
|
49
|
+
[`.${cls.classname}`]: ThemeCssVars(theme)
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
injectStyle: typeof window !== "undefined",
|
|
53
|
+
container: doc === null || doc === void 0 ? void 0 : doc.document,
|
|
54
|
+
cacheId,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return { styles: cls, themeStyle };
|
|
58
|
+
}, [sx, sxr, style, hover, cssProps, doc, cacheId, theme]);
|
|
59
|
+
/**
|
|
60
|
+
* Compose className
|
|
61
|
+
*/
|
|
62
|
+
const finalClassName = useMemo(() => {
|
|
63
|
+
return classNames(baseClass ? "xui-" + baseClass : undefined, clsNames, className, styles.classname);
|
|
64
|
+
}, [baseClass, clsNames, className, styles.classname]);
|
|
65
|
+
/**
|
|
66
|
+
* Final props
|
|
67
|
+
*/
|
|
68
|
+
const finalProps = useMemo(() => {
|
|
69
|
+
return Object.assign(Object.assign({}, domProps), { className: finalClassName });
|
|
70
|
+
}, [domProps, finalClassName]);
|
|
71
|
+
return {
|
|
72
|
+
props: finalProps,
|
|
73
|
+
style: styles,
|
|
74
|
+
themeStyle
|
|
75
|
+
};
|
|
50
76
|
};
|
|
51
77
|
|
|
52
78
|
export { useTagProps as default };
|
package/Tag/useTagProps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTagProps.js","sources":["../../src/Tag/useTagProps.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"useTagProps.js","sources":["../../src/Tag/useTagProps.ts"],"sourcesContent":["\"use client\"\nimport { useMemo } from \"react\";\nimport { TagComponentType, TagProps, TagPropsRoot } from \"./types\";\nimport cssPropList from \"./cssPropList\";\nimport { css } from \"../css\";\nimport { classNames } from \"pretty-class\";\nimport { CSSFactoryType } from \"oncss\";\nimport { useDocument } from \"../Document\";\nimport { useCSSCacheId } from \"../css/CSSCacheProvider\";\nimport ThemeCssVars from \"../theme/ThemeCssVars\";\nimport { createTheme } from \"../theme\";\n\nexport type useTagPropsReturn<T extends TagComponentType = \"div\"> = {\n props: TagProps<T>;\n style: CSSFactoryType;\n themeStyle?: CSSFactoryType;\n};\n\nconst useTagProps = <T extends TagComponentType = \"div\">(props: TagPropsRoot<T>): useTagPropsReturn<T> => {\n const doc = useDocument();\n const cacheId = useCSSCacheId();\n\n // Extract known styling-related props\n const {\n sx,\n sxr,\n style,\n hover,\n className,\n classNames: clsNames,\n baseClass,\n theme,\n ...rest\n } = props;\n\n /**\n * Split DOM props vs CSS props\n */\n const { domProps, cssProps } = useMemo(() => {\n const _dom: any = {};\n const _css: any = {};\n\n for (const key in rest) {\n const val = (rest as any)[key];\n if (cssPropList[key]) {\n _css[key] = val;\n } else {\n _dom[key] = val;\n }\n }\n\n return { domProps: _dom, cssProps: _css };\n }, [rest]);\n\n /**\n * Generate styles\n */\n const { styles, themeStyle } = useMemo(() => {\n const hoverStyles =\n hover && Object.keys(hover).length > 0\n ? { \"&:hover\": hover }\n : undefined;\n\n const cls = css(\n {\n ...sxr,\n ...cssProps,\n ...sx,\n ...style,\n ...hoverStyles,\n },\n {\n injectStyle: typeof window !== \"undefined\",\n container: doc?.document,\n cacheId,\n }\n );\n\n let themeStyle\n if (theme) {\n themeStyle = css({\n \"@global\": {\n [`.${cls.classname}`]: ThemeCssVars(theme as any)\n }\n },\n {\n injectStyle: typeof window !== \"undefined\",\n container: doc?.document,\n cacheId,\n }\n );\n }\n\n return { styles: cls, themeStyle }\n }, [sx, sxr, style, hover, cssProps, doc, cacheId, theme]);\n\n\n /**\n * Compose className\n */\n const finalClassName = useMemo(() => {\n return classNames(\n baseClass ? \"xui-\" + baseClass : undefined,\n clsNames,\n className,\n styles.classname\n );\n }, [baseClass, clsNames, className, styles.classname]);\n\n /**\n * Final props\n */\n const finalProps = useMemo(() => {\n return {\n ...domProps,\n className: finalClassName,\n };\n }, [domProps, finalClassName]);\n\n return {\n props: finalProps,\n style: styles,\n themeStyle\n };\n};\n\nexport default useTagProps;"],"names":[],"mappings":";;;;;;;;;;AAkBA;AACG;AACA;;;AAeA;;AAEG;;;;AAKA;AACG;AACA;AACG;;;AAEA;;;;AAKT;AAEA;;AAEG;;AAEA;AAEM;;AAGN;AASM;AACA;;AAEF;AAGJ;;;AAGM;;AAEC;;AAGE;AACA;;AAEF;;AAIP;AACH;AAGA;;AAEG;AACH;;AAOA;AAEA;;AAEG;AACH;AACG;AAIH;;AAGG;AACA;;;AAGN;;"}
|
package/Transition/variants.cjs
CHANGED
|
@@ -42,10 +42,9 @@ const fade = (el, rect) => ({
|
|
|
42
42
|
onUpdate: ({ opacity }) => (el.style.opacity = opacity),
|
|
43
43
|
});
|
|
44
44
|
const fadeDown = (el, rect) => {
|
|
45
|
-
|
|
46
|
-
console.log(y);
|
|
45
|
+
getY(rect);
|
|
47
46
|
return {
|
|
48
|
-
from: { y: -
|
|
47
|
+
from: { y: -40, scale: 0.98, opacity: 0 },
|
|
49
48
|
to: { y: 0, scale: 1, opacity: 1 },
|
|
50
49
|
onUpdate: ({ y, scale, opacity }) => {
|
|
51
50
|
el.style.transform = `translateY(${y}px) scale(${scale})`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variants.cjs","sources":["../../src/Transition/variants.ts"],"sourcesContent":["\"use client\"\nconst getY = (rect: DOMRect) => (rect.height / 2, 40)\nconst getX = (rect: DOMRect) => (rect.width / 2, 40)\n\n// ------------------ Variants ------------------\n\nexport const slideDown = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n return {\n from: { y: -y },\n to: { y: 0 },\n onUpdate: ({ y }: any) => (el.style.transform = `translateY(${y}px)`),\n }\n}\n\nexport const slideUp = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n return {\n from: { y },\n to: { y: 0 },\n onUpdate: ({ y }: any) => (el.style.transform = `translateY(${y}px)`),\n }\n}\n\nexport const slideRight = (el: HTMLElement, rect: DOMRect) => {\n const x = getX(rect)\n return {\n from: { x: -x },\n to: { x: 0 },\n onUpdate: ({ x }: any) => (el.style.transform = `translateX(${x}px)`),\n }\n}\n\nexport const slideLeft = (el: HTMLElement, rect: DOMRect) => {\n const x = getX(rect)\n return {\n from: { x },\n to: { x: 0 },\n onUpdate: ({ x }: any) => (el.style.transform = `translateX(${x}px)`),\n }\n}\n\nexport const fade = (el: HTMLElement, rect: DOMRect) => ({\n from: { opacity: 0 },\n to: { opacity: 1 },\n onUpdate: ({ opacity }: any) => (el.style.opacity = opacity),\n})\n\nexport const fadeDown = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n
|
|
1
|
+
{"version":3,"file":"variants.cjs","sources":["../../src/Transition/variants.ts"],"sourcesContent":["\"use client\"\nconst getY = (rect: DOMRect) => (rect.height / 2, 40)\nconst getX = (rect: DOMRect) => (rect.width / 2, 40)\n\n// ------------------ Variants ------------------\n\nexport const slideDown = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n return {\n from: { y: -y },\n to: { y: 0 },\n onUpdate: ({ y }: any) => (el.style.transform = `translateY(${y}px)`),\n }\n}\n\nexport const slideUp = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n return {\n from: { y },\n to: { y: 0 },\n onUpdate: ({ y }: any) => (el.style.transform = `translateY(${y}px)`),\n }\n}\n\nexport const slideRight = (el: HTMLElement, rect: DOMRect) => {\n const x = getX(rect)\n return {\n from: { x: -x },\n to: { x: 0 },\n onUpdate: ({ x }: any) => (el.style.transform = `translateX(${x}px)`),\n }\n}\n\nexport const slideLeft = (el: HTMLElement, rect: DOMRect) => {\n const x = getX(rect)\n return {\n from: { x },\n to: { x: 0 },\n onUpdate: ({ x }: any) => (el.style.transform = `translateX(${x}px)`),\n }\n}\n\nexport const fade = (el: HTMLElement, rect: DOMRect) => ({\n from: { opacity: 0 },\n to: { opacity: 1 },\n onUpdate: ({ opacity }: any) => (el.style.opacity = opacity),\n})\n\nexport const fadeDown = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n return {\n from: { y: -y, scale: 0.98, opacity: 0 },\n to: { y: 0, scale: 1, opacity: 1 },\n onUpdate: ({ y, scale, opacity }: any) => {\n el.style.transform = `translateY(${y}px) scale(${scale})`\n el.style.opacity = String(opacity)\n }\n }\n}\n\nexport const fadeUp = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n return {\n from: { y, scale: 0.98, opacity: 0 },\n to: { y: 0, scale: 1, opacity: 1 },\n onUpdate: ({ y, scale, opacity }: any) => {\n el.style.transform = `translateY(${y}px) scale(${scale})`\n el.style.opacity = String(opacity)\n }\n }\n}\n\nexport const fadeRight = (el: HTMLElement, rect: DOMRect) => {\n const x = getX(rect)\n return {\n from: { x: -x, scale: 0.98, opacity: 0 },\n to: { x: 0, scale: 1, opacity: 1 },\n onUpdate: ({ x, scale, opacity }: any) => {\n el.style.transform = `translateX(${x}px) scale(${scale})`\n el.style.opacity = String(opacity)\n }\n }\n}\n\nexport const fadeLeft = (el: HTMLElement, rect: DOMRect) => {\n const x = getX(rect)\n return {\n from: { x, scale: 0.98, opacity: 0 },\n to: { x: 0, scale: 1, opacity: 1 },\n onUpdate: ({ x, scale, opacity }: any) => {\n el.style.transform = `translateX(${x}px) scale(${scale})`\n el.style.opacity = String(opacity)\n }\n }\n}\n\nexport const zoom = (el: HTMLElement, rect: DOMRect) => ({\n from: { scale: 0.8, opacity: 0 },\n to: { scale: 1, opacity: 1 },\n onUpdate: ({ scale, opacity }: any) => {\n el.style.transform = `scale(${scale})`\n el.style.opacity = String(opacity)\n },\n})\n\nexport const zoomOver = (el: HTMLElement, rect: DOMRect) => ({\n from: { scale: 1.2, opacity: 0 },\n to: { scale: 1, opacity: 1 },\n onUpdate: ({ scale, opacity }: any) => {\n el.style.transform = `scale(${scale})`\n el.style.opacity = String(opacity)\n },\n})\n\nexport const grow = (el: HTMLElement, rect: DOMRect) => ({\n from: { scaleX: 0.8, scaleY: 0.6, opacity: 0 },\n to: { scaleX: 1, scaleY: 1, opacity: 1 },\n onUpdate: ({ scaleX, scaleY, opacity }: any) => {\n el.style.transform = `scale(${scaleX}, ${scaleY})`\n el.style.opacity = String(opacity)\n }\n})\n\nexport const collapseVertical = (el: HTMLElement, rect: DOMRect) => {\n const height = rect.height\n return {\n from: { maxHeight: 0 },\n to: { maxHeight: height },\n onUpdate: ({ maxHeight }: any) => {\n el.style.maxHeight = `${maxHeight}px`\n },\n }\n}\n\nexport const collapseHorizontal = (el: HTMLElement, rect: DOMRect) => {\n const width = rect.width\n return {\n from: { width: 0 },\n to: { width },\n onUpdate: ({ width }: any) => {\n el.style.width = `${width}px`\n },\n }\n}"],"names":[],"mappings":";;;AACA;AACA;AAEA;;AAGI;;AAEI;AACA;AACA;;AAER;;AAGI;;;AAGI;AACA;;AAER;;AAGI;;AAEI;AACA;AACA;;AAER;;AAGI;;;AAGI;AACA;;AAER;AAEO;AACH;AACA;AACA;AACH;;AAGG;;AAEI;AACA;;;;;;AAMR;;AAGI;;;AAGI;;;;;;AAMR;;AAGI;;AAEI;AACA;;;;;;AAMR;;AAGI;;;AAGI;;;;;;AAMR;AAEO;;;;;;;AAON;AAEM;;;;;;;AAON;AAEM;AACH;AACA;;;;;AAKH;;AAGG;;AAEI;AACA;AACA;;;;AAIR;;AAGI;;AAEI;;AAEA;;;;AAIR;;;;;;;;;;;;;;;"}
|
package/Transition/variants.js
CHANGED
|
@@ -40,10 +40,9 @@ const fade = (el, rect) => ({
|
|
|
40
40
|
onUpdate: ({ opacity }) => (el.style.opacity = opacity),
|
|
41
41
|
});
|
|
42
42
|
const fadeDown = (el, rect) => {
|
|
43
|
-
|
|
44
|
-
console.log(y);
|
|
43
|
+
getY(rect);
|
|
45
44
|
return {
|
|
46
|
-
from: { y: -
|
|
45
|
+
from: { y: -40, scale: 0.98, opacity: 0 },
|
|
47
46
|
to: { y: 0, scale: 1, opacity: 1 },
|
|
48
47
|
onUpdate: ({ y, scale, opacity }) => {
|
|
49
48
|
el.style.transform = `translateY(${y}px) scale(${scale})`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variants.js","sources":["../../src/Transition/variants.ts"],"sourcesContent":["\"use client\"\nconst getY = (rect: DOMRect) => (rect.height / 2, 40)\nconst getX = (rect: DOMRect) => (rect.width / 2, 40)\n\n// ------------------ Variants ------------------\n\nexport const slideDown = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n return {\n from: { y: -y },\n to: { y: 0 },\n onUpdate: ({ y }: any) => (el.style.transform = `translateY(${y}px)`),\n }\n}\n\nexport const slideUp = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n return {\n from: { y },\n to: { y: 0 },\n onUpdate: ({ y }: any) => (el.style.transform = `translateY(${y}px)`),\n }\n}\n\nexport const slideRight = (el: HTMLElement, rect: DOMRect) => {\n const x = getX(rect)\n return {\n from: { x: -x },\n to: { x: 0 },\n onUpdate: ({ x }: any) => (el.style.transform = `translateX(${x}px)`),\n }\n}\n\nexport const slideLeft = (el: HTMLElement, rect: DOMRect) => {\n const x = getX(rect)\n return {\n from: { x },\n to: { x: 0 },\n onUpdate: ({ x }: any) => (el.style.transform = `translateX(${x}px)`),\n }\n}\n\nexport const fade = (el: HTMLElement, rect: DOMRect) => ({\n from: { opacity: 0 },\n to: { opacity: 1 },\n onUpdate: ({ opacity }: any) => (el.style.opacity = opacity),\n})\n\nexport const fadeDown = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n
|
|
1
|
+
{"version":3,"file":"variants.js","sources":["../../src/Transition/variants.ts"],"sourcesContent":["\"use client\"\nconst getY = (rect: DOMRect) => (rect.height / 2, 40)\nconst getX = (rect: DOMRect) => (rect.width / 2, 40)\n\n// ------------------ Variants ------------------\n\nexport const slideDown = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n return {\n from: { y: -y },\n to: { y: 0 },\n onUpdate: ({ y }: any) => (el.style.transform = `translateY(${y}px)`),\n }\n}\n\nexport const slideUp = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n return {\n from: { y },\n to: { y: 0 },\n onUpdate: ({ y }: any) => (el.style.transform = `translateY(${y}px)`),\n }\n}\n\nexport const slideRight = (el: HTMLElement, rect: DOMRect) => {\n const x = getX(rect)\n return {\n from: { x: -x },\n to: { x: 0 },\n onUpdate: ({ x }: any) => (el.style.transform = `translateX(${x}px)`),\n }\n}\n\nexport const slideLeft = (el: HTMLElement, rect: DOMRect) => {\n const x = getX(rect)\n return {\n from: { x },\n to: { x: 0 },\n onUpdate: ({ x }: any) => (el.style.transform = `translateX(${x}px)`),\n }\n}\n\nexport const fade = (el: HTMLElement, rect: DOMRect) => ({\n from: { opacity: 0 },\n to: { opacity: 1 },\n onUpdate: ({ opacity }: any) => (el.style.opacity = opacity),\n})\n\nexport const fadeDown = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n return {\n from: { y: -y, scale: 0.98, opacity: 0 },\n to: { y: 0, scale: 1, opacity: 1 },\n onUpdate: ({ y, scale, opacity }: any) => {\n el.style.transform = `translateY(${y}px) scale(${scale})`\n el.style.opacity = String(opacity)\n }\n }\n}\n\nexport const fadeUp = (el: HTMLElement, rect: DOMRect) => {\n const y = getY(rect)\n return {\n from: { y, scale: 0.98, opacity: 0 },\n to: { y: 0, scale: 1, opacity: 1 },\n onUpdate: ({ y, scale, opacity }: any) => {\n el.style.transform = `translateY(${y}px) scale(${scale})`\n el.style.opacity = String(opacity)\n }\n }\n}\n\nexport const fadeRight = (el: HTMLElement, rect: DOMRect) => {\n const x = getX(rect)\n return {\n from: { x: -x, scale: 0.98, opacity: 0 },\n to: { x: 0, scale: 1, opacity: 1 },\n onUpdate: ({ x, scale, opacity }: any) => {\n el.style.transform = `translateX(${x}px) scale(${scale})`\n el.style.opacity = String(opacity)\n }\n }\n}\n\nexport const fadeLeft = (el: HTMLElement, rect: DOMRect) => {\n const x = getX(rect)\n return {\n from: { x, scale: 0.98, opacity: 0 },\n to: { x: 0, scale: 1, opacity: 1 },\n onUpdate: ({ x, scale, opacity }: any) => {\n el.style.transform = `translateX(${x}px) scale(${scale})`\n el.style.opacity = String(opacity)\n }\n }\n}\n\nexport const zoom = (el: HTMLElement, rect: DOMRect) => ({\n from: { scale: 0.8, opacity: 0 },\n to: { scale: 1, opacity: 1 },\n onUpdate: ({ scale, opacity }: any) => {\n el.style.transform = `scale(${scale})`\n el.style.opacity = String(opacity)\n },\n})\n\nexport const zoomOver = (el: HTMLElement, rect: DOMRect) => ({\n from: { scale: 1.2, opacity: 0 },\n to: { scale: 1, opacity: 1 },\n onUpdate: ({ scale, opacity }: any) => {\n el.style.transform = `scale(${scale})`\n el.style.opacity = String(opacity)\n },\n})\n\nexport const grow = (el: HTMLElement, rect: DOMRect) => ({\n from: { scaleX: 0.8, scaleY: 0.6, opacity: 0 },\n to: { scaleX: 1, scaleY: 1, opacity: 1 },\n onUpdate: ({ scaleX, scaleY, opacity }: any) => {\n el.style.transform = `scale(${scaleX}, ${scaleY})`\n el.style.opacity = String(opacity)\n }\n})\n\nexport const collapseVertical = (el: HTMLElement, rect: DOMRect) => {\n const height = rect.height\n return {\n from: { maxHeight: 0 },\n to: { maxHeight: height },\n onUpdate: ({ maxHeight }: any) => {\n el.style.maxHeight = `${maxHeight}px`\n },\n }\n}\n\nexport const collapseHorizontal = (el: HTMLElement, rect: DOMRect) => {\n const width = rect.width\n return {\n from: { width: 0 },\n to: { width },\n onUpdate: ({ width }: any) => {\n el.style.width = `${width}px`\n },\n }\n}"],"names":[],"mappings":";AACA;AACA;AAEA;;AAGI;;AAEI;AACA;AACA;;AAER;;AAGI;;;AAGI;AACA;;AAER;;AAGI;;AAEI;AACA;AACA;;AAER;;AAGI;;;AAGI;AACA;;AAER;AAEO;AACH;AACA;AACA;AACH;;AAGG;;AAEI;AACA;;;;;;AAMR;;AAGI;;;AAGI;;;;;;AAMR;;AAGI;;AAEI;AACA;;;;;;AAMR;;AAGI;;;AAGI;;;;;;AAMR;AAEO;;;;;;;AAON;AAEM;;;;;;;AAON;AAEM;AACH;AACA;;;;;AAKH;;AAGG;;AAEI;AACA;AACA;;;;AAIR;;AAGI;;AAEI;;AAEA;;;;AAIR;;"}
|