@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 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]'));
@@ -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\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;;;;;;;;AASA;AACA;AACG;AACH;;;AAIH;AACG;AACG;;;AAGC;;;;AAWW;;AAEH;AAmBlB;;"}
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]'));
@@ -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\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;;;;;;;;AASA;AACA;AACG;AACH;;;AAIH;AACG;AACG;;;AAGC;;;;AAWW;;AAEH;AAmBlB;;"}
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","_Fragment","_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;IAC5F,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAQ,WAAW,CAAC,IAAI,CAAC;AAC/C,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;AAC/B,QAAA,QACIE,eAAA,CAAAC,mBAAA,EAAA,EAAA,QAAA,EAAA,CACIC,cAAA,CAAC,cAAc,EAAA,EAAC,OAAO,EAAE,KAAK,EAAA,CAAI,EACjC,GAAG,CAAA,EAAA,CACL;IAEX;AACA,IAAA,OAAO,GAAG;AACd,CAAC;;;;"}
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","_Fragment","_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;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,OAAO,MAAM,KAAK,WAAW,EAAE;AAC/B,QAAA,QACIA,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACIC,GAAA,CAAC,cAAc,EAAA,EAAC,OAAO,EAAE,KAAK,EAAA,CAAI,EACjC,GAAG,CAAA,EAAA,CACL;IAEX;AACA,IAAA,OAAO,GAAG;AACd,CAAC;;;;"}
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 };
@@ -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
- const parsed = React.useMemo(() => {
17
- let _props = {};
18
- let _css = {};
19
- if (props.hover && Object.keys(props.hover).length > 0) {
20
- _css['&:hover'] = Object.assign({}, props.hover);
21
- }
22
- for (let key in props) {
23
- const keys = ["sx", "sxr", "style", "hover", "className", "classNames", "baseClass"];
24
- if (keys.includes(key)) {
25
- continue;
26
- }
27
- let val = props[key];
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
- _css[key] = val;
30
+ _dom[key] = val;
33
31
  }
34
32
  }
35
- const styles = index$1.css(Object.assign(Object.assign(Object.assign(Object.assign({}, props.sxr), _css), props.sx), props.style), {
36
- injectStyle: typeof window !== 'undefined',
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
- return {
41
- props: _props,
42
- styles,
43
- className: prettyClass.classNames(props.baseClass ? "xui-" + props.baseClass : undefined, props.classNames, props.className, styles.classname)
44
- };
45
- }, [cachekey]);
46
- const _props = {};
47
- for (let prop in parsed.props) {
48
- _props[prop] = props[prop];
49
- }
50
- _props.className = parsed.className;
51
- return { props: _props, style: parsed.styles };
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;
@@ -1 +1 @@
1
- {"version":3,"file":"useTagProps.cjs","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 { useMemo } from 'react';\nimport { useDocument } from '../Document';\nimport { useCSSCacheId } from '../css/CSSCacheProvider';\n\nexport type useTagPropsReturn<T extends TagComponentType = \"div\"> = {\n props: TagProps<T>,\n style: CSSFactoryType\n}\n\nconst useTagProps = <T extends TagComponentType = \"div\">(props: TagPropsRoot<T>): useTagPropsReturn<T> => {\n const cachekey = JSON.stringify(props, (key, value) => {\n return key === '_owner' || key === '_store' ? undefined : value;\n }, 2);\n\n const doc = useDocument();\n const cacheId = useCSSCacheId()\n\n const parsed = useMemo(() => {\n let _props: any = {}\n let _css: any = {}\n\n if (props.hover && Object.keys(props.hover).length > 0) {\n _css['&:hover'] = {\n ...props.hover\n }\n }\n\n for (let key in props) {\n const keys = [\"sx\", \"sxr\", \"style\", \"hover\", \"className\", \"classNames\", \"baseClass\"];\n if (keys.includes(key)) {\n continue;\n }\n let val = (props as any)[key];\n if (!cssPropList[key]) {\n _props[key] = val\n } else {\n _css[key] = val\n }\n }\n\n const styles = css({ ...props.sxr, ..._css, ...props.sx, ...props.style }, {\n injectStyle: typeof window !== 'undefined',\n container: doc?.document,\n cacheId\n })\n\n return {\n props: _props,\n styles,\n className: classNames(\n props.baseClass ? \"xui-\" + props.baseClass : undefined,\n props.classNames,\n props.className,\n styles.classname\n )\n }\n }, [cachekey])\n\n const _props: any = {};\n for (let prop in parsed.props) {\n _props[prop] = (props as any)[prop]\n }\n _props.className = parsed.className;\n\n return { props: _props, style: parsed.styles };\n}\n\n\nexport default useTagProps"],"names":["useDocument","useCSSCacheId","useMemo","css","classNames"],"mappings":";;;;;;;;;AAcA,MAAM,WAAW,GAAG,CAAqC,KAAsB,KAA0B;AACtG,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,KAAK,KAAI;AACnD,QAAA,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,QAAQ,GAAG,SAAS,GAAG,KAAK;IAClE,CAAC,EAAE,CAAC,CAAC;AAEL,IAAA,MAAM,GAAG,GAAGA,iBAAW,EAAE;AACzB,IAAA,MAAM,OAAO,GAAGC,8BAAa,EAAE;AAE/B,IAAA,MAAM,MAAM,GAAGC,aAAO,CAAC,MAAK;QACzB,IAAI,MAAM,GAAQ,EAAE;QACpB,IAAI,IAAI,GAAQ,EAAE;AAElB,QAAA,IAAI,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YACrD,IAAI,CAAC,SAAS,CAAC,GAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACT,KAAK,CAAC,KAAK,CAChB;QACJ;AAEA,QAAA,KAAK,IAAI,GAAG,IAAI,KAAK,EAAE;AACpB,YAAA,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,CAAC;AACpF,YAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACrB;YACH;AACA,YAAA,IAAI,GAAG,GAAI,KAAa,CAAC,GAAG,CAAC;AAC7B,YAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE;AACpB,gBAAA,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG;YACpB;iBAAO;AACJ,gBAAA,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG;YAClB;QACH;AAEA,QAAA,MAAM,MAAM,GAAGC,WAAG,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAM,KAAK,CAAC,GAAG,CAAA,EAAK,IAAI,CAAA,EAAK,KAAK,CAAC,EAAE,GAAK,KAAK,CAAC,KAAK,CAAA,EAAI;AACxE,YAAA,WAAW,EAAE,OAAO,MAAM,KAAK,WAAW;AAC1C,YAAA,SAAS,EAAE,GAAG,KAAA,IAAA,IAAH,GAAG,KAAA,MAAA,GAAA,MAAA,GAAH,GAAG,CAAE,QAAQ;YACxB;AACF,SAAA,CAAC;QAEF,OAAO;AACJ,YAAA,KAAK,EAAE,MAAM;YACb,MAAM;AACN,YAAA,SAAS,EAAEC,sBAAU,CAClB,KAAK,CAAC,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC,SAAS,GAAG,SAAS,EACtD,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,SAAS,EACf,MAAM,CAAC,SAAS;SAErB;AACJ,IAAA,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAEd,MAAM,MAAM,GAAQ,EAAE;AACtB,IAAA,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE;QAC5B,MAAM,CAAC,IAAI,CAAC,GAAI,KAAa,CAAC,IAAI,CAAC;IACtC;AACA,IAAA,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS;IAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;AACjD;;;;"}
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;;"}
@@ -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
 
@@ -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
- const parsed = useMemo(() => {
15
- let _props = {};
16
- let _css = {};
17
- if (props.hover && Object.keys(props.hover).length > 0) {
18
- _css['&:hover'] = Object.assign({}, props.hover);
19
- }
20
- for (let key in props) {
21
- const keys = ["sx", "sxr", "style", "hover", "className", "classNames", "baseClass"];
22
- if (keys.includes(key)) {
23
- continue;
24
- }
25
- let val = props[key];
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
- _css[key] = val;
28
+ _dom[key] = val;
31
29
  }
32
30
  }
33
- const styles = css(Object.assign(Object.assign(Object.assign(Object.assign({}, props.sxr), _css), props.sx), props.style), {
34
- injectStyle: typeof window !== 'undefined',
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
- return {
39
- props: _props,
40
- styles,
41
- className: classNames(props.baseClass ? "xui-" + props.baseClass : undefined, props.classNames, props.className, styles.classname)
42
- };
43
- }, [cachekey]);
44
- const _props = {};
45
- for (let prop in parsed.props) {
46
- _props[prop] = props[prop];
47
- }
48
- _props.className = parsed.className;
49
- return { props: _props, style: parsed.styles };
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 };
@@ -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';\nimport { CSSFactoryType } from 'oncss';\nimport { useMemo } from 'react';\nimport { useDocument } from '../Document';\nimport { useCSSCacheId } from '../css/CSSCacheProvider';\n\nexport type useTagPropsReturn<T extends TagComponentType = \"div\"> = {\n props: TagProps<T>,\n style: CSSFactoryType\n}\n\nconst useTagProps = <T extends TagComponentType = \"div\">(props: TagPropsRoot<T>): useTagPropsReturn<T> => {\n const cachekey = JSON.stringify(props, (key, value) => {\n return key === '_owner' || key === '_store' ? undefined : value;\n }, 2);\n\n const doc = useDocument();\n const cacheId = useCSSCacheId()\n\n const parsed = useMemo(() => {\n let _props: any = {}\n let _css: any = {}\n\n if (props.hover && Object.keys(props.hover).length > 0) {\n _css['&:hover'] = {\n ...props.hover\n }\n }\n\n for (let key in props) {\n const keys = [\"sx\", \"sxr\", \"style\", \"hover\", \"className\", \"classNames\", \"baseClass\"];\n if (keys.includes(key)) {\n continue;\n }\n let val = (props as any)[key];\n if (!cssPropList[key]) {\n _props[key] = val\n } else {\n _css[key] = val\n }\n }\n\n const styles = css({ ...props.sxr, ..._css, ...props.sx, ...props.style }, {\n injectStyle: typeof window !== 'undefined',\n container: doc?.document,\n cacheId\n })\n\n return {\n props: _props,\n styles,\n className: classNames(\n props.baseClass ? \"xui-\" + props.baseClass : undefined,\n props.classNames,\n props.className,\n styles.classname\n )\n }\n }, [cachekey])\n\n const _props: any = {};\n for (let prop in parsed.props) {\n _props[prop] = (props as any)[prop]\n }\n _props.className = parsed.className;\n\n return { props: _props, style: parsed.styles };\n}\n\n\nexport default useTagProps"],"names":["cssPropList"],"mappings":";;;;;;;AAcA,MAAM,WAAW,GAAG,CAAqC,KAAsB,KAA0B;AACtG,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,KAAK,KAAI;AACnD,QAAA,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,QAAQ,GAAG,SAAS,GAAG,KAAK;IAClE,CAAC,EAAE,CAAC,CAAC;AAEL,IAAA,MAAM,GAAG,GAAG,WAAW,EAAE;AACzB,IAAA,MAAM,OAAO,GAAG,aAAa,EAAE;AAE/B,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAK;QACzB,IAAI,MAAM,GAAQ,EAAE;QACpB,IAAI,IAAI,GAAQ,EAAE;AAElB,QAAA,IAAI,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YACrD,IAAI,CAAC,SAAS,CAAC,GAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACT,KAAK,CAAC,KAAK,CAChB;QACJ;AAEA,QAAA,KAAK,IAAI,GAAG,IAAI,KAAK,EAAE;AACpB,YAAA,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,CAAC;AACpF,YAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACrB;YACH;AACA,YAAA,IAAI,GAAG,GAAI,KAAa,CAAC,GAAG,CAAC;AAC7B,YAAA,IAAI,CAACA,aAAW,CAAC,GAAG,CAAC,EAAE;AACpB,gBAAA,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG;YACpB;iBAAO;AACJ,gBAAA,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG;YAClB;QACH;AAEA,QAAA,MAAM,MAAM,GAAG,GAAG,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAM,KAAK,CAAC,GAAG,CAAA,EAAK,IAAI,CAAA,EAAK,KAAK,CAAC,EAAE,GAAK,KAAK,CAAC,KAAK,CAAA,EAAI;AACxE,YAAA,WAAW,EAAE,OAAO,MAAM,KAAK,WAAW;AAC1C,YAAA,SAAS,EAAE,GAAG,KAAA,IAAA,IAAH,GAAG,KAAA,MAAA,GAAA,MAAA,GAAH,GAAG,CAAE,QAAQ;YACxB;AACF,SAAA,CAAC;QAEF,OAAO;AACJ,YAAA,KAAK,EAAE,MAAM;YACb,MAAM;AACN,YAAA,SAAS,EAAE,UAAU,CAClB,KAAK,CAAC,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC,SAAS,GAAG,SAAS,EACtD,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,SAAS,EACf,MAAM,CAAC,SAAS;SAErB;AACJ,IAAA,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAEd,MAAM,MAAM,GAAQ,EAAE;AACtB,IAAA,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE;QAC5B,MAAM,CAAC,IAAI,CAAC,GAAI,KAAa,CAAC,IAAI,CAAC;IACtC;AACA,IAAA,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS;IAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;AACjD;;;;"}
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;;"}
@@ -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
- const y = getY(rect);
46
- console.log(y);
45
+ getY(rect);
47
46
  return {
48
- from: { y: -y, scale: 0.98, opacity: 0 },
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 console.log(y);\n\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;AACA;;AAGI;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;;;;;;;;;;;;;;;"}
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;;;;;;;;;;;;;;;"}
@@ -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
- const y = getY(rect);
44
- console.log(y);
43
+ getY(rect);
45
44
  return {
46
- from: { y: -y, scale: 0.98, opacity: 0 },
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 console.log(y);\n\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;AACA;;AAGI;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;;"}
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;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xanui/core",
3
- "version": "1.3.5",
3
+ "version": "1.3.8",
4
4
  "description": "Xanui Core Library",
5
5
  "private": false,
6
6
  "main": "./index.cjs",