@xanui/core 1.1.26 → 1.2.1

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.js CHANGED
@@ -5,16 +5,17 @@ const appRootElement = () => document.querySelector(`.${appRootClassName}`);
5
5
  const AppRoot = React.forwardRef((_a, ref) => {
6
6
  var { children, noScrollbarCss, theme } = _a, props = tslib.__rest(_a, ["children", "noScrollbarCss", "theme"]);
7
7
  noScrollbarCss !== null && noScrollbarCss !== void 0 ? noScrollbarCss : (noScrollbarCss = false);
8
- React.useMemo(() => {
8
+ const [sx, setSx] = React.useState(Object.assign(Object.assign({}, props.sx), { visibility: typeof window === "undefined" ? "hidden" : 'hidden' }));
9
+ const scrollbarCss = React.useMemo(() => {
9
10
  if (noScrollbarCss)
10
11
  return;
11
- useScrollbar.default({
12
+ return useScrollbar.default({
12
13
  themeName: theme,
13
14
  root_cls: index$1.themeRootClass(theme)
14
15
  });
15
16
  }, [noScrollbarCss, theme]);
16
- React.useMemo(() => {
17
- index.css({
17
+ const globalStyle = React.useMemo(() => {
18
+ return index.css({
18
19
  "@global": {
19
20
  "*": {
20
21
  m: 0,
@@ -48,6 +49,8 @@ const AppRoot = React.forwardRef((_a, ref) => {
48
49
  overflowWrap: "break-word",
49
50
  }
50
51
  }
52
+ }, {
53
+ injectStyle: typeof window !== 'undefined'
51
54
  });
52
55
  }, []);
53
56
  React.useEffect(() => {
@@ -55,6 +58,9 @@ const AppRoot = React.forwardRef((_a, ref) => {
55
58
  if (!root || root.length > 1) {
56
59
  throw new Error("Multiple AppRoot detected in the application tree. Please ensure that there is only one AppRoot component wrapping your application.");
57
60
  }
61
+ setSx({
62
+ visibility: "visible"
63
+ });
58
64
  // move oncss style tags to head
59
65
  if (typeof window === 'undefined')
60
66
  return;
@@ -64,5 +70,5 @@ const AppRoot = React.forwardRef((_a, ref) => {
64
70
  head.appendChild(style);
65
71
  });
66
72
  }, []);
67
- return (jsxRuntime.jsx(ThemeProvider.default, Object.assign({ ref: ref, theme: theme }, props, { classNames: [appRootClassName], children: jsxRuntime.jsxs(BreakpointProvider.BreakpointProvider, { children: [children, jsxRuntime.jsx(Renderar.RenderRenderar, {})] }) })));
73
+ return (jsxRuntime.jsxs(ThemeProvider.default, Object.assign({ ref: ref, theme: theme }, props, { sx: sx, classNames: [appRootClassName], children: [typeof window === 'undefined' && jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("style", { precedence: globalStyle.classname, href: globalStyle.classname, dangerouslySetInnerHTML: { __html: globalStyle.css } }), scrollbarCss && jsxRuntime.jsx("style", { precedence: scrollbarCss.classname, href: scrollbarCss.classname, dangerouslySetInnerHTML: { __html: scrollbarCss.css } })] }), jsxRuntime.jsxs(BreakpointProvider.BreakpointProvider, { children: [children, jsxRuntime.jsx(Renderar.RenderRenderar, {})] })] })));
68
74
  });exports.appRootElement=appRootElement;exports.default=AppRoot;//# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\nimport React, { useEffect, useMemo } from 'react';\nimport { TagComponentType } from '../Tag/types';\nimport { createTheme, ThemeProvider, ThemeProviderProps, themeRootClass } from '../theme';\nimport { BreakpointProvider } from '../breakpoint';\nimport useScrollbar from '../hooks/useScrollbar';\nimport { css } from '../css';\nimport { darkColorPallete, lightColorPallete } from '../theme/ThemeDefaultOptions';\nimport { RenderRenderar } from './Renderar';\n\ncreateTheme(\"light\", { colors: lightColorPallete })\ncreateTheme(\"dark\", { colors: darkColorPallete })\n\nexport type AppRootProps<T extends TagComponentType = \"div\"> = ThemeProviderProps<T> & {\n noScrollbarCss?: boolean;\n}\n\nconst appRootClassName = \"xui-app-root\"\nexport const appRootElement = () => document.querySelector(`.${appRootClassName}`) as HTMLDivElement;\n\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, noScrollbarCss, theme, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\n noScrollbarCss ??= false\n\n useMemo(() => {\n if (noScrollbarCss) return;\n useScrollbar({\n themeName: theme,\n root_cls: themeRootClass(theme)\n })\n }, [noScrollbarCss, theme])\n\n useMemo(() => {\n css({\n \"@global\": {\n \"*\": {\n m: 0,\n p: 0,\n outline: \"none\",\n boxSizing: \"border-box\",\n verticalAlign: \"baseline\",\n },\n \"html, body\": {\n minHeight: \"100%\",\n \"-webkit-font-smoothing\": \"antialiased\"\n } as any,\n \"img, picture, video, canvas, svg\": {\n maxWidth: \"100%\",\n display: \"block\"\n },\n \"input, button, textarea, select\": {\n font: \"inherit\"\n },\n \"table\": {\n borderCollapse: \"collapse\",\n borderSpacing: 0\n },\n \"ol, ul\": {\n listStyle: \"none\"\n },\n \"a\": {\n display: \"inline-block\"\n },\n \"p, h1, h2, h3, h4, h5, h6\": {\n overflowWrap: \"break-word\",\n }\n }\n })\n }, [])\n\n useEffect(() => {\n\n const root = document.querySelectorAll(`.${appRootClassName}`)\n if (!root || root.length > 1) {\n throw new Error(\"Multiple AppRoot detected in the application tree. Please ensure that there is only one AppRoot component wrapping your application.\");\n }\n\n\n // move oncss style tags to head\n if (typeof window === 'undefined') return;\n const head = document.getElementsByTagName('head')[0];\n const styles = Array.from(document.querySelectorAll('body style[data-oncss]'));\n styles.forEach((style) => {\n head.appendChild(style);\n });\n }, [])\n\n return (\n <ThemeProvider\n ref={ref}\n theme={theme}\n {...props}\n classNames={[appRootClassName]}\n >\n <BreakpointProvider>\n {children}\n <RenderRenderar />\n </BreakpointProvider>\n </ThemeProvider>\n )\n})\n\nexport default AppRoot\n\n"],"names":["createTheme","lightColorPallete","darkColorPallete","__rest","useMemo","useScrollbar","themeRootClass","css","useEffect","_jsx","ThemeProvider","_jsxs","BreakpointProvider","RenderRenderar"],"mappings":"4hBAUAA,uBAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAEC,qCAAiB,EAAE,CAAC;AACnDD,uBAAW,CAAC,MAAM,EAAE,EAAE,MAAM,E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BAAc,EAAA,EAAA,CAAG,CAAA,EAAA,CACA,EAAA,CAAA,CACR;AAEtB,CAAC"}
1
+ {"version":3,"file":"index.js","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\nimport React, { useEffect, useMemo } from 'react';\nimport { TagComponentType } from '../Tag/types';\nimport { createTheme, ThemeProvider, ThemeProviderProps, themeRootClass } from '../theme';\nimport { BreakpointProvider } from '../breakpoint';\nimport useScrollbar from '../hooks/useScrollbar';\nimport { css } from '../css';\nimport { darkColorPallete, lightColorPallete } from '../theme/ThemeDefaultOptions';\nimport { RenderRenderar } from './Renderar';\n\ncreateTheme(\"light\", { colors: lightColorPallete })\ncreateTheme(\"dark\", { colors: darkColorPallete })\n\nexport type AppRootProps<T extends TagComponentType = \"div\"> = ThemeProviderProps<T> & {\n noScrollbarCss?: boolean;\n}\n\nconst appRootClassName = \"xui-app-root\"\nexport const appRootElement = () => document.querySelector(`.${appRootClassName}`) as HTMLDivElement;\n\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, noScrollbarCss, theme, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\n noScrollbarCss ??= false\n const [sx, setSx] = React.useState({\n ...props.sx,\n visibility: typeof window === \"undefined\" ? \"hidden\" : 'hidden',\n });\n\n const scrollbarCss: any = useMemo(() => {\n if (noScrollbarCss) return;\n return useScrollbar({\n themeName: theme,\n root_cls: themeRootClass(theme)\n })\n }, [noScrollbarCss, theme])\n\n const globalStyle = useMemo(() => {\n return css({\n \"@global\": {\n \"*\": {\n m: 0,\n p: 0,\n outline: \"none\",\n boxSizing: \"border-box\",\n verticalAlign: \"baseline\",\n },\n \"html, body\": {\n minHeight: \"100%\",\n \"-webkit-font-smoothing\": \"antialiased\"\n } as any,\n \"img, picture, video, canvas, svg\": {\n maxWidth: \"100%\",\n display: \"block\"\n },\n \"input, button, textarea, select\": {\n font: \"inherit\"\n },\n \"table\": {\n borderCollapse: \"collapse\",\n borderSpacing: 0\n },\n \"ol, ul\": {\n listStyle: \"none\"\n },\n \"a\": {\n display: \"inline-block\"\n },\n \"p, h1, h2, h3, h4, h5, h6\": {\n overflowWrap: \"break-word\",\n }\n }\n }, {\n injectStyle: typeof window !== 'undefined'\n })\n }, [])\n\n useEffect(() => {\n\n const root = document.querySelectorAll(`.${appRootClassName}`)\n if (!root || root.length > 1) {\n throw new Error(\"Multiple AppRoot detected in the application tree. Please ensure that there is only one AppRoot component wrapping your application.\");\n }\n\n setSx({\n visibility: \"visible\"\n });\n\n // move oncss style tags to head\n if (typeof window === 'undefined') return;\n const head = document.getElementsByTagName('head')[0];\n const styles = Array.from(document.querySelectorAll('body style[data-oncss]'));\n styles.forEach((style) => {\n head.appendChild(style);\n });\n }, [])\n\n return (\n <ThemeProvider\n ref={ref}\n theme={theme}\n {...props}\n sx={sx}\n classNames={[appRootClassName]}\n >\n {\n typeof window === 'undefined' && <>\n <style\n precedence={globalStyle.classname}\n href={globalStyle.classname}\n dangerouslySetInnerHTML={{ __html: globalStyle.css }}\n />\n {\n scrollbarCss && <style\n precedence={scrollbarCss.classname}\n href={scrollbarCss.classname}\n dangerouslySetInnerHTML={{ __html: scrollbarCss.css }}\n />\n }\n </>\n }\n <BreakpointProvider>\n {children}\n <RenderRenderar />\n </BreakpointProvider>\n </ThemeProvider>\n )\n})\n\nexport default AppRoot\n\n"],"names":["createTheme","lightColorPallete","darkColorPallete","__rest","useMemo","useScrollbar","themeRootClass","css","useEffect","_jsxs","ThemeProvider","_Fragment","_jsx","BreakpointProvider","RenderRenderar"],"mappings":"4hBAUAA,uBAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAEC,qCAAiB,EAAE,CAAC;AACnDD,uBAAW,CAAC,MAAM,EAAE,EAAE,MAAM,EAAEE,oCAAgB,EAAE,CAAC;AAMjD,MAAM,gBAAgB,GAAG,cAAc;AAChC,MAAM,cAAc,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,CAAA,CAAA,EAAI,gBAAgB,CAAA,CAAE;AAEj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EN,QACGC,gBAACC,qBAAa,EAAA,MAAA,CAAA,MAAA,CAAA,EACX,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EAAA,EACR,KAAK,IACT,EAAE,EAAE,EAAE,EACN,UAAU,EAAE,CAAC,gBAAgB,CAAC,EAAA,QAAA,EAAA,CAG3B,OAAO,MAAM,KAAK,WAAW,IAAID,eAAA,CAAAE,mBAAA,EAAA,EAAA,QAAA,EAAA,CAC9BC,cAAA,CAAA,OAAA,EAAA,EACG,UAAU,EAAE,WAAW,CAAC,SAAS,EACjC,IAAI,EAAE,WAAW,CAAC,SAAS,EAC3B,uBAAuB,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,GAAG,EAAE,GACrD,EAEC,YAAY,IAAIA,cAAA,CAAA,OAAA,EAAA,EACb,UAAU,EAAE,YAAY,CAAC,SAAS,EAClC,IAAI,EAAE,YAAY,CAAC,SAAS,EAC5B,uBAAuB,EAAE,EAAE,MAAM,EAAE,YAAY,CAAC,GAAG,EAAE,EAAA,CACtD,IAEL,EAENH,eAAA,CAACI,qCAAkB,EAAA,EAAA,QAAA,EAAA,CACf,QAAQ,EACTD,cAAA,CAACE,uBAAc,KAAG,CAAA,EAAA,CACA,CAAA,EAAA,CAAA,CACR;AAEtB,CAAC"}
package/AppRoot/index.mjs CHANGED
@@ -1,20 +1,21 @@
1
- import {__rest}from'tslib';import {jsx,jsxs}from'react/jsx-runtime';import React__default,{useMemo,useEffect}from'react';import {themeRootClass}from'../theme/index.mjs';import {BreakpointProvider}from'../breakpoint/BreakpointProvider.mjs';import {css}from'../css/index.mjs';import useScrollbar from'../hooks/useScrollbar.mjs';import {lightColorPallete,darkColorPallete}from'../theme/ThemeDefaultOptions.mjs';import {RenderRenderar}from'./Renderar.mjs';import {createTheme}from'../theme/createTheme.mjs';import ThemeProvider from'../theme/ThemeProvider.mjs';createTheme("light", { colors: lightColorPallete });
1
+ import {__rest}from'tslib';import {jsxs,Fragment,jsx}from'react/jsx-runtime';import React__default,{useMemo,useEffect}from'react';import {themeRootClass}from'../theme/index.mjs';import {BreakpointProvider}from'../breakpoint/BreakpointProvider.mjs';import {css}from'../css/index.mjs';import useScrollbar from'../hooks/useScrollbar.mjs';import {lightColorPallete,darkColorPallete}from'../theme/ThemeDefaultOptions.mjs';import {RenderRenderar}from'./Renderar.mjs';import {createTheme}from'../theme/createTheme.mjs';import ThemeProvider from'../theme/ThemeProvider.mjs';createTheme("light", { colors: lightColorPallete });
2
2
  createTheme("dark", { colors: darkColorPallete });
3
3
  const appRootClassName = "xui-app-root";
4
4
  const appRootElement = () => document.querySelector(`.${appRootClassName}`);
5
5
  const AppRoot = React__default.forwardRef((_a, ref) => {
6
6
  var { children, noScrollbarCss, theme } = _a, props = __rest(_a, ["children", "noScrollbarCss", "theme"]);
7
7
  noScrollbarCss !== null && noScrollbarCss !== void 0 ? noScrollbarCss : (noScrollbarCss = false);
8
- useMemo(() => {
8
+ const [sx, setSx] = React__default.useState(Object.assign(Object.assign({}, props.sx), { visibility: typeof window === "undefined" ? "hidden" : 'hidden' }));
9
+ const scrollbarCss = useMemo(() => {
9
10
  if (noScrollbarCss)
10
11
  return;
11
- useScrollbar({
12
+ return useScrollbar({
12
13
  themeName: theme,
13
14
  root_cls: themeRootClass(theme)
14
15
  });
15
16
  }, [noScrollbarCss, theme]);
16
- useMemo(() => {
17
- css({
17
+ const globalStyle = useMemo(() => {
18
+ return css({
18
19
  "@global": {
19
20
  "*": {
20
21
  m: 0,
@@ -48,6 +49,8 @@ const AppRoot = React__default.forwardRef((_a, ref) => {
48
49
  overflowWrap: "break-word",
49
50
  }
50
51
  }
52
+ }, {
53
+ injectStyle: typeof window !== 'undefined'
51
54
  });
52
55
  }, []);
53
56
  useEffect(() => {
@@ -55,6 +58,9 @@ const AppRoot = React__default.forwardRef((_a, ref) => {
55
58
  if (!root || root.length > 1) {
56
59
  throw new Error("Multiple AppRoot detected in the application tree. Please ensure that there is only one AppRoot component wrapping your application.");
57
60
  }
61
+ setSx({
62
+ visibility: "visible"
63
+ });
58
64
  // move oncss style tags to head
59
65
  if (typeof window === 'undefined')
60
66
  return;
@@ -64,5 +70,5 @@ const AppRoot = React__default.forwardRef((_a, ref) => {
64
70
  head.appendChild(style);
65
71
  });
66
72
  }, []);
67
- return (jsx(ThemeProvider, Object.assign({ ref: ref, theme: theme }, props, { classNames: [appRootClassName], children: jsxs(BreakpointProvider, { children: [children, jsx(RenderRenderar, {})] }) })));
73
+ return (jsxs(ThemeProvider, Object.assign({ ref: ref, theme: theme }, props, { sx: sx, classNames: [appRootClassName], children: [typeof window === 'undefined' && jsxs(Fragment, { children: [jsx("style", { precedence: globalStyle.classname, href: globalStyle.classname, dangerouslySetInnerHTML: { __html: globalStyle.css } }), scrollbarCss && jsx("style", { precedence: scrollbarCss.classname, href: scrollbarCss.classname, dangerouslySetInnerHTML: { __html: scrollbarCss.css } })] }), jsxs(BreakpointProvider, { children: [children, jsx(RenderRenderar, {})] })] })));
68
74
  });export{appRootElement,AppRoot as default};//# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\nimport React, { useEffect, useMemo } from 'react';\nimport { TagComponentType } from '../Tag/types';\nimport { createTheme, ThemeProvider, ThemeProviderProps, themeRootClass } from '../theme';\nimport { BreakpointProvider } from '../breakpoint';\nimport useScrollbar from '../hooks/useScrollbar';\nimport { css } from '../css';\nimport { darkColorPallete, lightColorPallete } from '../theme/ThemeDefaultOptions';\nimport { RenderRenderar } from './Renderar';\n\ncreateTheme(\"light\", { colors: lightColorPallete })\ncreateTheme(\"dark\", { colors: darkColorPallete })\n\nexport type AppRootProps<T extends TagComponentType = \"div\"> = ThemeProviderProps<T> & {\n noScrollbarCss?: boolean;\n}\n\nconst appRootClassName = \"xui-app-root\"\nexport const appRootElement = () => document.querySelector(`.${appRootClassName}`) as HTMLDivElement;\n\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, noScrollbarCss, theme, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\n noScrollbarCss ??= false\n\n useMemo(() => {\n if (noScrollbarCss) return;\n useScrollbar({\n themeName: theme,\n root_cls: themeRootClass(theme)\n })\n }, [noScrollbarCss, theme])\n\n useMemo(() => {\n css({\n \"@global\": {\n \"*\": {\n m: 0,\n p: 0,\n outline: \"none\",\n boxSizing: \"border-box\",\n verticalAlign: \"baseline\",\n },\n \"html, body\": {\n minHeight: \"100%\",\n \"-webkit-font-smoothing\": \"antialiased\"\n } as any,\n \"img, picture, video, canvas, svg\": {\n maxWidth: \"100%\",\n display: \"block\"\n },\n \"input, button, textarea, select\": {\n font: \"inherit\"\n },\n \"table\": {\n borderCollapse: \"collapse\",\n borderSpacing: 0\n },\n \"ol, ul\": {\n listStyle: \"none\"\n },\n \"a\": {\n display: \"inline-block\"\n },\n \"p, h1, h2, h3, h4, h5, h6\": {\n overflowWrap: \"break-word\",\n }\n }\n })\n }, [])\n\n useEffect(() => {\n\n const root = document.querySelectorAll(`.${appRootClassName}`)\n if (!root || root.length > 1) {\n throw new Error(\"Multiple AppRoot detected in the application tree. Please ensure that there is only one AppRoot component wrapping your application.\");\n }\n\n\n // move oncss style tags to head\n if (typeof window === 'undefined') return;\n const head = document.getElementsByTagName('head')[0];\n const styles = Array.from(document.querySelectorAll('body style[data-oncss]'));\n styles.forEach((style) => {\n head.appendChild(style);\n });\n }, [])\n\n return (\n <ThemeProvider\n ref={ref}\n theme={theme}\n {...props}\n classNames={[appRootClassName]}\n >\n <BreakpointProvider>\n {children}\n <RenderRenderar />\n </BreakpointProvider>\n </ThemeProvider>\n )\n})\n\nexport default AppRoot\n\n"],"names":["React","_jsx","_jsxs"],"mappings":"6iBAUA,WAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;AACnD,WAAW,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;AAMjD,MAAM,gBAAgB,GA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tB,CAAC"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\nimport React, { useEffect, useMemo } from 'react';\nimport { TagComponentType } from '../Tag/types';\nimport { createTheme, ThemeProvider, ThemeProviderProps, themeRootClass } from '../theme';\nimport { BreakpointProvider } from '../breakpoint';\nimport useScrollbar from '../hooks/useScrollbar';\nimport { css } from '../css';\nimport { darkColorPallete, lightColorPallete } from '../theme/ThemeDefaultOptions';\nimport { RenderRenderar } from './Renderar';\n\ncreateTheme(\"light\", { colors: lightColorPallete })\ncreateTheme(\"dark\", { colors: darkColorPallete })\n\nexport type AppRootProps<T extends TagComponentType = \"div\"> = ThemeProviderProps<T> & {\n noScrollbarCss?: boolean;\n}\n\nconst appRootClassName = \"xui-app-root\"\nexport const appRootElement = () => document.querySelector(`.${appRootClassName}`) as HTMLDivElement;\n\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, noScrollbarCss, theme, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\n noScrollbarCss ??= false\n const [sx, setSx] = React.useState({\n ...props.sx,\n visibility: typeof window === \"undefined\" ? \"hidden\" : 'hidden',\n });\n\n const scrollbarCss: any = useMemo(() => {\n if (noScrollbarCss) return;\n return useScrollbar({\n themeName: theme,\n root_cls: themeRootClass(theme)\n })\n }, [noScrollbarCss, theme])\n\n const globalStyle = useMemo(() => {\n return css({\n \"@global\": {\n \"*\": {\n m: 0,\n p: 0,\n outline: \"none\",\n boxSizing: \"border-box\",\n verticalAlign: \"baseline\",\n },\n \"html, body\": {\n minHeight: \"100%\",\n \"-webkit-font-smoothing\": \"antialiased\"\n } as any,\n \"img, picture, video, canvas, svg\": {\n maxWidth: \"100%\",\n display: \"block\"\n },\n \"input, button, textarea, select\": {\n font: \"inherit\"\n },\n \"table\": {\n borderCollapse: \"collapse\",\n borderSpacing: 0\n },\n \"ol, ul\": {\n listStyle: \"none\"\n },\n \"a\": {\n display: \"inline-block\"\n },\n \"p, h1, h2, h3, h4, h5, h6\": {\n overflowWrap: \"break-word\",\n }\n }\n }, {\n injectStyle: typeof window !== 'undefined'\n })\n }, [])\n\n useEffect(() => {\n\n const root = document.querySelectorAll(`.${appRootClassName}`)\n if (!root || root.length > 1) {\n throw new Error(\"Multiple AppRoot detected in the application tree. Please ensure that there is only one AppRoot component wrapping your application.\");\n }\n\n setSx({\n visibility: \"visible\"\n });\n\n // move oncss style tags to head\n if (typeof window === 'undefined') return;\n const head = document.getElementsByTagName('head')[0];\n const styles = Array.from(document.querySelectorAll('body style[data-oncss]'));\n styles.forEach((style) => {\n head.appendChild(style);\n });\n }, [])\n\n return (\n <ThemeProvider\n ref={ref}\n theme={theme}\n {...props}\n sx={sx}\n classNames={[appRootClassName]}\n >\n {\n typeof window === 'undefined' && <>\n <style\n precedence={globalStyle.classname}\n href={globalStyle.classname}\n dangerouslySetInnerHTML={{ __html: globalStyle.css }}\n />\n {\n scrollbarCss && <style\n precedence={scrollbarCss.classname}\n href={scrollbarCss.classname}\n dangerouslySetInnerHTML={{ __html: scrollbarCss.css }}\n />\n }\n </>\n }\n <BreakpointProvider>\n {children}\n <RenderRenderar />\n </BreakpointProvider>\n </ThemeProvider>\n )\n})\n\nexport default AppRoot\n\n"],"names":["React","_jsxs","_Fragment","_jsx"],"mappings":"sjBAUA,WAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;AACnD,WAAW,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;AAMjD,MAAM,gBAAgB,GAAG,cAAc;AAChC,MAAM,cAAc,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,CAAA,CAAA,EAAI,gBAAgB,CAAA,CAAE;AAEjF,MAAM,OAAO,GAAGA,cAAK,CAAC,UAAU,CAAC,CAAqC,EAA8D,EAAE,GAAmB,KAAI;QAAvF,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,OAA6B,EAAxB,KAAK,GAAA,MAAA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BAAgB,CAAC,EAAA,QAAA,EAAA,CAG3B,OAAO,MAAM,KAAK,WAAW,IAAIA,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CAC9BC,GAAA,CAAA,OAAA,EAAA,EACG,UAAU,EAAE,WAAW,CAAC,SAAS,EACjC,IAAI,EAAE,WAAW,CAAC,SAAS,EAC3B,uBAAuB,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,GAAG,EAAE,GACrD,EAEC,YAAY,IAAIA,GAAA,CAAA,OAAA,EAAA,EACb,UAAU,EAAE,YAAY,CAAC,SAAS,EAClC,IAAI,EAAE,YAAY,CAAC,SAAS,EAC5B,uBAAuB,EAAE,EAAE,MAAM,EAAE,YAAY,CAAC,GAAG,EAAE,EAAA,CACtD,IAEL,EAENF,IAAA,CAAC,kBAAkB,EAAA,EAAA,QAAA,EAAA,CACf,QAAQ,EACTE,GAAA,CAAC,cAAc,KAAG,CAAA,EAAA,CACA,CAAA,EAAA,CAAA,CACR;AAEtB,CAAC"}
package/Tag/index.js CHANGED
@@ -1,15 +1,10 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var tslib=require('tslib'),React=require('react'),useTagProps=require('./useTagProps.js'),isWindow=require('../isWindow.js');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var React__namespace=/*#__PURE__*/_interopNamespaceDefault(React);const Tag = React__namespace.forwardRef((_a, ref) => {
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var tslib=require('tslib'),jsxRuntime=require('react/jsx-runtime'),React=require('react'),useTagProps=require('./useTagProps.js');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var React__namespace=/*#__PURE__*/_interopNamespaceDefault(React);const Tag = React__namespace.forwardRef((_a, ref) => {
2
2
  var { component, children } = _a, rest = tslib.__rest(_a, ["component", "children"]);
3
3
  const { props, style } = useTagProps.default(rest);
4
4
  props.ref = ref;
5
5
  const ele = React__namespace.createElement(component || "div", props, children);
6
- if (!isWindow.default()) {
7
- const isCache = style.cache;
8
- const styletag = React__namespace.createElement("style", {
9
- dangerouslySetInnerHTML: { __html: style.css },
10
- 'data-oncss': style.classname
11
- });
12
- return React__namespace.createElement(React__namespace.Fragment, null, [isCache ? null : styletag, ele]);
6
+ if (typeof window === 'undefined') {
7
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style.css }, precedence: style.classname, href: style.classname }), ele] }));
13
8
  }
14
9
  return ele;
15
10
  });exports.default=Tag;//# sourceMappingURL=index.js.map
package/Tag/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/Tag/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { TagComponentType, TagPropsRoot } from './types';\nimport useTagProps from './useTagProps';\nimport isWindow from '../isWindow';\n\nconst Tag = React.forwardRef(<T extends TagComponentType = 'div'>({ component, children, ...rest }: TagPropsRoot<T>, ref: React.Ref<any>) => {\n const { props, style }: any = useTagProps(rest)\n props.ref = ref\n const ele = React.createElement(component || \"div\", props, children)\n if (!isWindow()) {\n const isCache = style.cache\n const styletag = React.createElement(\"style\", {\n dangerouslySetInnerHTML: { __html: style.css },\n 'data-oncss': style.classname\n })\n return React.createElement(React.Fragment, null, [isCache ? null : styletag, ele])\n }\n return ele\n})\n\nexport default Tag"],"names":["React","__rest","useTagProps","isWindow"],"mappings":"miBAKA,MAAM,GAAG,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAqC,EAAiD,EAAE,GAAmB,KAAI;QAA1E,EAAE,SAAS,EAAE,QAAQ,EAAA,GAAA,EAA4B,EAAvB,IAAI,GAAAC,YAAA,CAAA,EAAA,EAA9B,yBAAgC,CAAF;IAC5F,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAQC,mBAAW,CAAC,IAAI,CAAC;AAC/C,IAAA,KAAK,CAAC,GAAG,GAAG,GAAG;AACf,IAAA,MAAM,GAAG,GAAGF,gBAAK,CAAC,aAAa,CAAC,SAAS,IAAI,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC;AACpE,IAAA,IAAI,CAACG,gBAAQ,EAAE,EAAE;AACb,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK;AAC3B,QAAA,MAAM,QAAQ,GAAGH,gBAAK,CAAC,aAAa,CAAC,OAAO,EAAE;AAC1C,YAAA,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE;YAC9C,YAAY,EAAE,KAAK,CAAC;AACvB,SAAA,CAAC;QACF,OAAOA,gBAAK,CAAC,aAAa,CAACA,gBAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,OAAO,GAAG,IAAI,GAAG,QAAQ,EAAE,GAAG,CAAC,CAAC;IACtF;AACA,IAAA,OAAO,GAAG;AACd,CAAC"}
1
+ {"version":3,"file":"index.js","sources":["../../src/Tag/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { TagComponentType, TagPropsRoot } from './types';\nimport useTagProps from './useTagProps';\n\nconst Tag = React.forwardRef(<T extends TagComponentType = 'div'>({ component, children, ...rest }: TagPropsRoot<T>, ref: React.Ref<any>) => {\n const { props, 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 <style\n dangerouslySetInnerHTML={{ __html: style.css }}\n precedence={style.classname}\n href={style.classname}\n />\n {ele}\n </>\n )\n }\n return ele\n})\n\nexport default Tag"],"names":["React","__rest","useTagProps","_jsxs","_Fragment","_jsx"],"mappings":"wiBAIA,MAAM,GAAG,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAqC,EAAiD,EAAE,GAAmB,KAAI;QAA1E,EAAE,SAAS,EAAE,QAAQ,EAAA,GAAA,EAA4B,EAAvB,IAAI,GAAAC,YAAA,CAAA,EAAA,EAA9B,yBAAgC,CAAF;IAC5F,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAQC,mBAAW,CAAC,IAAI,CAAC;AAC/C,IAAA,KAAK,CAAC,GAAG,GAAG,GAAG;AACf,IAAA,MAAM,GAAG,GAAGF,gBAAK,CAAC,aAAa,CAAC,SAAS,IAAI,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC;AACpE,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAC/B,QAAA,QACIG,eAAA,CAAAC,mBAAA,EAAA,EAAA,QAAA,EAAA,CACIC,cAAA,CAAA,OAAA,EAAA,EACI,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,EAC9C,UAAU,EAAE,KAAK,CAAC,SAAS,EAC3B,IAAI,EAAE,KAAK,CAAC,SAAS,EAAA,CACvB,EACD,GAAG,CAAA,EAAA,CACL;IAEX;AACA,IAAA,OAAO,GAAG;AACd,CAAC"}
package/Tag/index.mjs CHANGED
@@ -1,15 +1,10 @@
1
- import {__rest}from'tslib';import*as React from'react';import useTagProps from'./useTagProps.mjs';import isWindow from'../isWindow.mjs';const Tag = React.forwardRef((_a, ref) => {
1
+ import {__rest}from'tslib';import {jsxs,Fragment,jsx}from'react/jsx-runtime';import*as React from'react';import useTagProps from'./useTagProps.mjs';const Tag = React.forwardRef((_a, ref) => {
2
2
  var { component, children } = _a, rest = __rest(_a, ["component", "children"]);
3
3
  const { props, style } = useTagProps(rest);
4
4
  props.ref = ref;
5
5
  const ele = React.createElement(component || "div", props, children);
6
- if (!isWindow()) {
7
- const isCache = style.cache;
8
- const styletag = React.createElement("style", {
9
- dangerouslySetInnerHTML: { __html: style.css },
10
- 'data-oncss': style.classname
11
- });
12
- return React.createElement(React.Fragment, null, [isCache ? null : styletag, ele]);
6
+ if (typeof window === 'undefined') {
7
+ return (jsxs(Fragment, { children: [jsx("style", { dangerouslySetInnerHTML: { __html: style.css }, precedence: style.classname, href: style.classname }), ele] }));
13
8
  }
14
9
  return ele;
15
10
  });export{Tag as default};//# sourceMappingURL=index.mjs.map
package/Tag/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/Tag/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { TagComponentType, TagPropsRoot } from './types';\nimport useTagProps from './useTagProps';\nimport isWindow from '../isWindow';\n\nconst Tag = React.forwardRef(<T extends TagComponentType = 'div'>({ component, children, ...rest }: TagPropsRoot<T>, ref: React.Ref<any>) => {\n const { props, style }: any = useTagProps(rest)\n props.ref = ref\n const ele = React.createElement(component || \"div\", props, children)\n if (!isWindow()) {\n const isCache = style.cache\n const styletag = React.createElement(\"style\", {\n dangerouslySetInnerHTML: { __html: style.css },\n 'data-oncss': style.classname\n })\n return React.createElement(React.Fragment, null, [isCache ? null : styletag, ele])\n }\n return ele\n})\n\nexport default Tag"],"names":[],"mappings":"wIAKA,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAAiD,EAAE,GAAmB,KAAI;QAA1E,EAAE,SAAS,EAAE,QAAQ,EAAA,GAAA,EAA4B,EAAvB,IAAI,GAAA,MAAA,CAAA,EAAA,EAA9B,yBAAgC,CAAF;IAC5F,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAQ,WAAW,CAAC,IAAI,CAAC;AAC/C,IAAA,KAAK,CAAC,GAAG,GAAG,GAAG;AACf,IAAA,MAAM,GAAG,GAAG,KAAK,CAAC,aAAa,CAAC,SAAS,IAAI,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC;AACpE,IAAA,IAAI,CAAC,QAAQ,EAAE,EAAE;AACb,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK;AAC3B,QAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE;AAC1C,YAAA,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE;YAC9C,YAAY,EAAE,KAAK,CAAC;AACvB,SAAA,CAAC;QACF,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,OAAO,GAAG,IAAI,GAAG,QAAQ,EAAE,GAAG,CAAC,CAAC;IACtF;AACA,IAAA,OAAO,GAAG;AACd,CAAC"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/Tag/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { TagComponentType, TagPropsRoot } from './types';\nimport useTagProps from './useTagProps';\n\nconst Tag = React.forwardRef(<T extends TagComponentType = 'div'>({ component, children, ...rest }: TagPropsRoot<T>, ref: React.Ref<any>) => {\n const { props, 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 <style\n dangerouslySetInnerHTML={{ __html: style.css }}\n precedence={style.classname}\n href={style.classname}\n />\n {ele}\n </>\n )\n }\n return ele\n})\n\nexport default Tag"],"names":["_jsxs","_Fragment","_jsx"],"mappings":"oJAIA,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,CAAA,OAAA,EAAA,EACI,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,EAC9C,UAAU,EAAE,KAAK,CAAC,SAAS,EAC3B,IAAI,EAAE,KAAK,CAAC,SAAS,EAAA,CACvB,EACD,GAAG,CAAA,EAAA,CACL;IAEX;AACA,IAAA,OAAO,GAAG;AACd,CAAC"}
@@ -1,11 +1,11 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var tslib=require('tslib'),cssPropList=require('./cssPropList.js'),index=require('../css/index.js'),prettyClass=require('pretty-class'),isWindow=require('../isWindow.js');const useTagProps = (_a) => {
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var tslib=require('tslib'),cssPropList=require('./cssPropList.js'),index=require('../css/index.js'),prettyClass=require('pretty-class');const useTagProps = (_a) => {
2
2
  var { sxr, sx, baseClass, classNames: clses, hover } = _a, props = tslib.__rest(_a, ["sxr", "sx", "baseClass", "classNames", "hover"]);
3
3
  let _css = Object.assign(Object.assign(Object.assign({}, sxr), sx), props);
4
4
  if (hover)
5
5
  _css['&:hover'] = hover;
6
6
  const style = index.css(_css, {
7
7
  skipProps: (prop, _val, dept) => dept === 1 && !cssPropList.default[prop],
8
- injectStyle: isWindow.default(),
8
+ injectStyle: typeof window !== 'undefined',
9
9
  });
10
10
  let skipProps = style.skiped[style.classname] || [];
11
11
  const _props = {};
@@ -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 isWindow from '../isWindow';\n\nexport type useTagPropsReturn<T extends TagComponentType = \"div\"> = {\n props: TagProps<T>,\n style: CSSFactoryType\n}\n\nconst useTagProps = <T extends TagComponentType = \"div\">({ sxr, sx, baseClass, classNames: clses, hover, ...props }: TagPropsRoot<T>): useTagPropsReturn<T> => {\n let _css: any = { ...sxr, ...sx, ...props }\n if (hover) _css['&:hover'] = hover\n const style = css(_css, {\n skipProps: (prop, _val, dept): any => dept === 1 && !cssPropList[prop],\n injectStyle: isWindow(),\n })\n\n let skipProps = style.skiped[style.classname as any] || []\n const _props: any = {};\n for (let prop of skipProps) {\n _props[prop] = (props as any)[prop]\n }\n _props.className = classNames([\n baseClass ? \"xui-\" + baseClass : \"\",\n style.classname,\n props.className,\n ...(clses as any || []),\n ])\n return { props: _props, style };\n}\n\n\nexport default useTagProps"],"names":["__rest","css","cssPropList","isWindow","classNames"],"mappings":"iPAYA,MAAM,WAAW,GAAG,CAAqC,EAA2E,KAA0B;AAArG,IAAA,IAAA,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAA,GAAA,EAA6B,EAAxB,KAAK,GAAAA,YAAA,CAAA,EAAA,EAAxD,iDAA0D,CAAF;IAC9G,IAAI,IAAI,iDAAa,GAAG,CAAA,EAAK,EAAE,CAAA,EAAK,KAAK,CAAE;AAC3C,IAAA,IAAI,KAAK;AAAE,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK;AAClC,IAAA,MAAM,KAAK,GAAGC,SAAG,CAAC,IAAI,EAAE;AACrB,QAAA,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,KAAU,IAAI,KAAK,CAAC,IAAI,CAACC,mBAAW,CAAC,IAAI,CAAC;QACtE,WAAW,EAAEC,gBAAQ,EAAE;AACzB,KAAA,CAAC;AAEF,IAAA,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAgB,CAAC,IAAI,EAAE;IAC1D,MAAM,MAAM,GAAQ,EAAE;AACtB,IAAA,KAAK,IAAI,IAAI,IAAI,SAAS,EAAE;QACzB,MAAM,CAAC,IAAI,CAAC,GAAI,KAAa,CAAC,IAAI,CAAC;IACtC;AACA,IAAA,MAAM,CAAC,SAAS,GAAGC,sBAAU,CAAC;QAC3B,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,EAAE;AACnC,QAAA,KAAK,CAAC,SAAS;AACf,QAAA,KAAK,CAAC,SAAS;AACf,QAAA,IAAI,KAAY,IAAI,EAAE,CAAC;AACzB,KAAA,CAAC;AACF,IAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;AAClC"}
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';\n\nexport type useTagPropsReturn<T extends TagComponentType = \"div\"> = {\n props: TagProps<T>,\n style: CSSFactoryType\n}\n\nconst useTagProps = <T extends TagComponentType = \"div\">({ sxr, sx, baseClass, classNames: clses, hover, ...props }: TagPropsRoot<T>): useTagPropsReturn<T> => {\n let _css: any = { ...sxr, ...sx, ...props }\n if (hover) _css['&:hover'] = hover\n const style = css(_css, {\n skipProps: (prop, _val, dept): any => dept === 1 && !cssPropList[prop],\n injectStyle: typeof window !== 'undefined',\n })\n\n let skipProps = style.skiped[style.classname as any] || []\n const _props: any = {};\n for (let prop of skipProps) {\n _props[prop] = (props as any)[prop]\n }\n _props.className = classNames([\n baseClass ? \"xui-\" + baseClass : \"\",\n style.classname,\n props.className,\n ...(clses as any || []),\n ])\n return { props: _props, style };\n}\n\n\nexport default useTagProps"],"names":["__rest","css","cssPropList","classNames"],"mappings":"8MAWA,MAAM,WAAW,GAAG,CAAqC,EAA2E,KAA0B;AAArG,IAAA,IAAA,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAA,GAAA,EAA6B,EAAxB,KAAK,GAAAA,YAAA,CAAA,EAAA,EAAxD,iDAA0D,CAAF;IAC9G,IAAI,IAAI,iDAAa,GAAG,CAAA,EAAK,EAAE,CAAA,EAAK,KAAK,CAAE;AAC3C,IAAA,IAAI,KAAK;AAAE,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK;AAClC,IAAA,MAAM,KAAK,GAAGC,SAAG,CAAC,IAAI,EAAE;AACrB,QAAA,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,KAAU,IAAI,KAAK,CAAC,IAAI,CAACC,mBAAW,CAAC,IAAI,CAAC;AACtE,QAAA,WAAW,EAAE,OAAO,MAAM,KAAK,WAAW;AAC5C,KAAA,CAAC;AAEF,IAAA,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAgB,CAAC,IAAI,EAAE;IAC1D,MAAM,MAAM,GAAQ,EAAE;AACtB,IAAA,KAAK,IAAI,IAAI,IAAI,SAAS,EAAE;QACzB,MAAM,CAAC,IAAI,CAAC,GAAI,KAAa,CAAC,IAAI,CAAC;IACtC;AACA,IAAA,MAAM,CAAC,SAAS,GAAGC,sBAAU,CAAC;QAC3B,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,EAAE;AACnC,QAAA,KAAK,CAAC,SAAS;AACf,QAAA,KAAK,CAAC,SAAS;AACf,QAAA,IAAI,KAAY,IAAI,EAAE,CAAC;AACzB,KAAA,CAAC;AACF,IAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;AAClC"}
@@ -1,11 +1,11 @@
1
- import {__rest}from'tslib';import CSS_PROP_LIST from'./cssPropList.mjs';import {css}from'../css/index.mjs';import {classNames}from'pretty-class';import isWindow from'../isWindow.mjs';const useTagProps = (_a) => {
1
+ import {__rest}from'tslib';import CSS_PROP_LIST from'./cssPropList.mjs';import {css}from'../css/index.mjs';import {classNames}from'pretty-class';const useTagProps = (_a) => {
2
2
  var { sxr, sx, baseClass, classNames: clses, hover } = _a, props = __rest(_a, ["sxr", "sx", "baseClass", "classNames", "hover"]);
3
3
  let _css = Object.assign(Object.assign(Object.assign({}, sxr), sx), props);
4
4
  if (hover)
5
5
  _css['&:hover'] = hover;
6
6
  const style = css(_css, {
7
7
  skipProps: (prop, _val, dept) => dept === 1 && !CSS_PROP_LIST[prop],
8
- injectStyle: isWindow(),
8
+ injectStyle: typeof window !== 'undefined',
9
9
  });
10
10
  let skipProps = style.skiped[style.classname] || [];
11
11
  const _props = {};
@@ -1 +1 @@
1
- {"version":3,"file":"useTagProps.mjs","sources":["../../src/Tag/useTagProps.ts"],"sourcesContent":["import { TagComponentType, TagProps, TagPropsRoot } from './types';\nimport cssPropList from './cssPropList';\nimport { css } from '../css';\nimport { classNames } from 'pretty-class';\nimport { CSSFactoryType } from 'oncss';\nimport isWindow from '../isWindow';\n\nexport type useTagPropsReturn<T extends TagComponentType = \"div\"> = {\n props: TagProps<T>,\n style: CSSFactoryType\n}\n\nconst useTagProps = <T extends TagComponentType = \"div\">({ sxr, sx, baseClass, classNames: clses, hover, ...props }: TagPropsRoot<T>): useTagPropsReturn<T> => {\n let _css: any = { ...sxr, ...sx, ...props }\n if (hover) _css['&:hover'] = hover\n const style = css(_css, {\n skipProps: (prop, _val, dept): any => dept === 1 && !cssPropList[prop],\n injectStyle: isWindow(),\n })\n\n let skipProps = style.skiped[style.classname as any] || []\n const _props: any = {};\n for (let prop of skipProps) {\n _props[prop] = (props as any)[prop]\n }\n _props.className = classNames([\n baseClass ? \"xui-\" + baseClass : \"\",\n style.classname,\n props.className,\n ...(clses as any || []),\n ])\n return { props: _props, style };\n}\n\n\nexport default useTagProps"],"names":["cssPropList"],"mappings":"uLAYA,MAAM,WAAW,GAAG,CAAqC,EAA2E,KAA0B;AAArG,IAAA,IAAA,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAA,GAAA,EAA6B,EAAxB,KAAK,GAAA,MAAA,CAAA,EAAA,EAAxD,iDAA0D,CAAF;IAC9G,IAAI,IAAI,iDAAa,GAAG,CAAA,EAAK,EAAE,CAAA,EAAK,KAAK,CAAE;AAC3C,IAAA,IAAI,KAAK;AAAE,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK;AAClC,IAAA,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,EAAE;AACrB,QAAA,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,KAAU,IAAI,KAAK,CAAC,IAAI,CAACA,aAAW,CAAC,IAAI,CAAC;QACtE,WAAW,EAAE,QAAQ,EAAE;AACzB,KAAA,CAAC;AAEF,IAAA,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAgB,CAAC,IAAI,EAAE;IAC1D,MAAM,MAAM,GAAQ,EAAE;AACtB,IAAA,KAAK,IAAI,IAAI,IAAI,SAAS,EAAE;QACzB,MAAM,CAAC,IAAI,CAAC,GAAI,KAAa,CAAC,IAAI,CAAC;IACtC;AACA,IAAA,MAAM,CAAC,SAAS,GAAG,UAAU,CAAC;QAC3B,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,EAAE;AACnC,QAAA,KAAK,CAAC,SAAS;AACf,QAAA,KAAK,CAAC,SAAS;AACf,QAAA,IAAI,KAAY,IAAI,EAAE,CAAC;AACzB,KAAA,CAAC;AACF,IAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;AAClC"}
1
+ {"version":3,"file":"useTagProps.mjs","sources":["../../src/Tag/useTagProps.ts"],"sourcesContent":["import { TagComponentType, TagProps, TagPropsRoot } from './types';\nimport cssPropList from './cssPropList';\nimport { css } from '../css';\nimport { classNames } from 'pretty-class';\nimport { CSSFactoryType } from 'oncss';\n\nexport type useTagPropsReturn<T extends TagComponentType = \"div\"> = {\n props: TagProps<T>,\n style: CSSFactoryType\n}\n\nconst useTagProps = <T extends TagComponentType = \"div\">({ sxr, sx, baseClass, classNames: clses, hover, ...props }: TagPropsRoot<T>): useTagPropsReturn<T> => {\n let _css: any = { ...sxr, ...sx, ...props }\n if (hover) _css['&:hover'] = hover\n const style = css(_css, {\n skipProps: (prop, _val, dept): any => dept === 1 && !cssPropList[prop],\n injectStyle: typeof window !== 'undefined',\n })\n\n let skipProps = style.skiped[style.classname as any] || []\n const _props: any = {};\n for (let prop of skipProps) {\n _props[prop] = (props as any)[prop]\n }\n _props.className = classNames([\n baseClass ? \"xui-\" + baseClass : \"\",\n style.classname,\n props.className,\n ...(clses as any || []),\n ])\n return { props: _props, style };\n}\n\n\nexport default useTagProps"],"names":["cssPropList"],"mappings":"iJAWA,MAAM,WAAW,GAAG,CAAqC,EAA2E,KAA0B;AAArG,IAAA,IAAA,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAA,GAAA,EAA6B,EAAxB,KAAK,GAAA,MAAA,CAAA,EAAA,EAAxD,iDAA0D,CAAF;IAC9G,IAAI,IAAI,iDAAa,GAAG,CAAA,EAAK,EAAE,CAAA,EAAK,KAAK,CAAE;AAC3C,IAAA,IAAI,KAAK;AAAE,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK;AAClC,IAAA,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,EAAE;AACrB,QAAA,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,KAAU,IAAI,KAAK,CAAC,IAAI,CAACA,aAAW,CAAC,IAAI,CAAC;AACtE,QAAA,WAAW,EAAE,OAAO,MAAM,KAAK,WAAW;AAC5C,KAAA,CAAC;AAEF,IAAA,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAgB,CAAC,IAAI,EAAE;IAC1D,MAAM,MAAM,GAAQ,EAAE;AACtB,IAAA,KAAK,IAAI,IAAI,IAAI,SAAS,EAAE;QACzB,MAAM,CAAC,IAAI,CAAC,GAAI,KAAa,CAAC,IAAI,CAAC;IACtC;AACA,IAAA,MAAM,CAAC,SAAS,GAAG,UAAU,CAAC;QAC3B,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,EAAE;AACnC,QAAA,KAAK,CAAC,SAAS;AACf,QAAA,KAAK,CAAC,SAAS;AACf,QAAA,IAAI,KAAY,IAAI,EAAE,CAAC;AACzB,KAAA,CAAC;AACF,IAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;AAClC"}
@@ -19,7 +19,7 @@ const getKey = () => {
19
19
  return "xl";
20
20
  };
21
21
  const BreakpointProvider = ({ children }) => {
22
- const [current, setCurrent] = React.useState("xs");
22
+ const [current, setCurrent] = React.useState("xl");
23
23
  const handler = React.useCallback(() => {
24
24
  const newKey = getKey();
25
25
  setCurrent(prev => (prev === newKey ? prev : newKey));
@@ -1 +1 @@
1
- {"version":3,"file":"BreakpointProvider.js","sources":["../../src/breakpoint/BreakpointProvider.tsx"],"sourcesContent":["import React, { ReactNode, useState, useCallback } from \"react\";\nimport isWindow from \"../isWindow\";\nimport { breakpoints } from \"../css\";\nimport { BreakpointKeys } from \"../css/types\";\n\nexport const BreakpointCtx = React.createContext<BreakpointKeys>(\"xs\");\n\n/**\n * SSR-safe breakpoint detection\n */\nconst getKey = (): BreakpointKeys => {\n if (!isWindow()) {\n // Server fallback (mobile-first)\n return \"xs\";\n }\n\n const width = window.innerWidth;\n\n if (width < breakpoints.sm) return \"xs\";\n if (width < breakpoints.md) return \"sm\";\n if (width < breakpoints.lg) return \"md\";\n if (width < breakpoints.xl) return \"lg\";\n return \"xl\";\n};\n\nexport const BreakpointProvider = ({ children }: { children?: ReactNode }) => {\n const [current, setCurrent] = useState<BreakpointKeys>(\"xs\");\n\n const handler = useCallback(() => {\n const newKey = getKey();\n setCurrent(prev => (prev === newKey ? prev : newKey));\n }, []);\n\n React.useEffect(() => {\n window.addEventListener(\"resize\", handler);\n handler(); // detect on mount\n return () => window.removeEventListener(\"resize\", handler);\n }, [handler]);\n\n return (\n <BreakpointCtx.Provider value={current}>\n {children}\n </BreakpointCtx.Provider>\n );\n};\n"],"names":["isWindow","breakpoints","useState","useCallback","_jsx"],"mappings":"6MAKO,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAiB,IAAI;AAErE;;AAEG;AACH,MAAM,MAAM,GAAG,MAAqB;AAChC,IAAA,IAAI,CAACA,gBAAQ,EAAE,EAAE;;AAEb,QAAA,OAAO,IAAI;IACf;AAEA,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU;AAE/B,IAAA,IAAI,KAAK,GAAGC,iBAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAGA,iBAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAGA,iBAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAGA,iBAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,OAAO,IAAI;AACf,CAAC;MAEY,kBAAkB,GAAG,CAAC,EAAE,QAAQ,EAA4B,KAAI;IACzE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGC,cAAQ,CAAiB,IAAI,CAAC;AAE5D,IAAA,MAAM,OAAO,GAAGC,iBAAW,CAAC,MAAK;AAC7B,QAAA,MAAM,MAAM,GAAG,MAAM,EAAE;AACvB,QAAA,UAAU,CAAC,IAAI,KAAK,IAAI,KAAK,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC;IACzD,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,KAAK,CAAC,SAAS,CAAC,MAAK;AACjB,QAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC1C,OAAO,EAAE,CAAC;QACV,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC;AAC9D,IAAA,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AAEb,IAAA,QACIC,cAAA,CAAC,aAAa,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EACjC,QAAQ,EAAA,CACY;AAEjC"}
1
+ {"version":3,"file":"BreakpointProvider.js","sources":["../../src/breakpoint/BreakpointProvider.tsx"],"sourcesContent":["import React, { ReactNode, useState, useCallback } from \"react\";\nimport isWindow from \"../isWindow\";\nimport { breakpoints } from \"../css\";\nimport { BreakpointKeys } from \"../css/types\";\n\nexport const BreakpointCtx = React.createContext<BreakpointKeys>(\"xs\");\n\n/**\n * SSR-safe breakpoint detection\n */\nconst getKey = (): BreakpointKeys => {\n if (!isWindow()) {\n // Server fallback (mobile-first)\n return \"xs\";\n }\n\n const width = window.innerWidth;\n\n if (width < breakpoints.sm) return \"xs\";\n if (width < breakpoints.md) return \"sm\";\n if (width < breakpoints.lg) return \"md\";\n if (width < breakpoints.xl) return \"lg\";\n return \"xl\";\n};\n\nexport const BreakpointProvider = ({ children }: { children?: ReactNode }) => {\n const [current, setCurrent] = useState<BreakpointKeys>(\"xl\");\n\n const handler = useCallback(() => {\n const newKey = getKey();\n setCurrent(prev => (prev === newKey ? prev : newKey));\n }, []);\n\n React.useEffect(() => {\n window.addEventListener(\"resize\", handler);\n handler(); // detect on mount\n return () => window.removeEventListener(\"resize\", handler);\n }, [handler]);\n\n return (\n <BreakpointCtx.Provider value={current}>\n {children}\n </BreakpointCtx.Provider>\n );\n};\n"],"names":["isWindow","breakpoints","useState","useCallback","_jsx"],"mappings":"6MAKO,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAiB,IAAI;AAErE;;AAEG;AACH,MAAM,MAAM,GAAG,MAAqB;AAChC,IAAA,IAAI,CAACA,gBAAQ,EAAE,EAAE;;AAEb,QAAA,OAAO,IAAI;IACf;AAEA,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU;AAE/B,IAAA,IAAI,KAAK,GAAGC,iBAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAGA,iBAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAGA,iBAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAGA,iBAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,OAAO,IAAI;AACf,CAAC;MAEY,kBAAkB,GAAG,CAAC,EAAE,QAAQ,EAA4B,KAAI;IACzE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGC,cAAQ,CAAiB,IAAI,CAAC;AAE5D,IAAA,MAAM,OAAO,GAAGC,iBAAW,CAAC,MAAK;AAC7B,QAAA,MAAM,MAAM,GAAG,MAAM,EAAE;AACvB,QAAA,UAAU,CAAC,IAAI,KAAK,IAAI,KAAK,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC;IACzD,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,KAAK,CAAC,SAAS,CAAC,MAAK;AACjB,QAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC1C,OAAO,EAAE,CAAC;QACV,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC;AAC9D,IAAA,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AAEb,IAAA,QACIC,cAAA,CAAC,aAAa,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EACjC,QAAQ,EAAA,CACY;AAEjC"}
@@ -19,7 +19,7 @@ const getKey = () => {
19
19
  return "xl";
20
20
  };
21
21
  const BreakpointProvider = ({ children }) => {
22
- const [current, setCurrent] = useState("xs");
22
+ const [current, setCurrent] = useState("xl");
23
23
  const handler = useCallback(() => {
24
24
  const newKey = getKey();
25
25
  setCurrent(prev => (prev === newKey ? prev : newKey));
@@ -1 +1 @@
1
- {"version":3,"file":"BreakpointProvider.mjs","sources":["../../src/breakpoint/BreakpointProvider.tsx"],"sourcesContent":["import React, { ReactNode, useState, useCallback } from \"react\";\nimport isWindow from \"../isWindow\";\nimport { breakpoints } from \"../css\";\nimport { BreakpointKeys } from \"../css/types\";\n\nexport const BreakpointCtx = React.createContext<BreakpointKeys>(\"xs\");\n\n/**\n * SSR-safe breakpoint detection\n */\nconst getKey = (): BreakpointKeys => {\n if (!isWindow()) {\n // Server fallback (mobile-first)\n return \"xs\";\n }\n\n const width = window.innerWidth;\n\n if (width < breakpoints.sm) return \"xs\";\n if (width < breakpoints.md) return \"sm\";\n if (width < breakpoints.lg) return \"md\";\n if (width < breakpoints.xl) return \"lg\";\n return \"xl\";\n};\n\nexport const BreakpointProvider = ({ children }: { children?: ReactNode }) => {\n const [current, setCurrent] = useState<BreakpointKeys>(\"xs\");\n\n const handler = useCallback(() => {\n const newKey = getKey();\n setCurrent(prev => (prev === newKey ? prev : newKey));\n }, []);\n\n React.useEffect(() => {\n window.addEventListener(\"resize\", handler);\n handler(); // detect on mount\n return () => window.removeEventListener(\"resize\", handler);\n }, [handler]);\n\n return (\n <BreakpointCtx.Provider value={current}>\n {children}\n </BreakpointCtx.Provider>\n );\n};\n"],"names":["React","_jsx"],"mappings":"6KAKO,MAAM,aAAa,GAAGA,cAAK,CAAC,aAAa,CAAiB,IAAI;AAErE;;AAEG;AACH,MAAM,MAAM,GAAG,MAAqB;AAChC,IAAA,IAAI,CAAC,QAAQ,EAAE,EAAE;;AAEb,QAAA,OAAO,IAAI;IACf;AAEA,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU;AAE/B,IAAA,IAAI,KAAK,GAAG,WAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAG,WAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAG,WAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAG,WAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,OAAO,IAAI;AACf,CAAC;MAEY,kBAAkB,GAAG,CAAC,EAAE,QAAQ,EAA4B,KAAI;IACzE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC;AAE5D,IAAA,MAAM,OAAO,GAAG,WAAW,CAAC,MAAK;AAC7B,QAAA,MAAM,MAAM,GAAG,MAAM,EAAE;AACvB,QAAA,UAAU,CAAC,IAAI,KAAK,IAAI,KAAK,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC;IACzD,CAAC,EAAE,EAAE,CAAC;AAEN,IAAAA,cAAK,CAAC,SAAS,CAAC,MAAK;AACjB,QAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC1C,OAAO,EAAE,CAAC;QACV,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC;AAC9D,IAAA,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AAEb,IAAA,QACIC,GAAA,CAAC,aAAa,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EACjC,QAAQ,EAAA,CACY;AAEjC"}
1
+ {"version":3,"file":"BreakpointProvider.mjs","sources":["../../src/breakpoint/BreakpointProvider.tsx"],"sourcesContent":["import React, { ReactNode, useState, useCallback } from \"react\";\nimport isWindow from \"../isWindow\";\nimport { breakpoints } from \"../css\";\nimport { BreakpointKeys } from \"../css/types\";\n\nexport const BreakpointCtx = React.createContext<BreakpointKeys>(\"xs\");\n\n/**\n * SSR-safe breakpoint detection\n */\nconst getKey = (): BreakpointKeys => {\n if (!isWindow()) {\n // Server fallback (mobile-first)\n return \"xs\";\n }\n\n const width = window.innerWidth;\n\n if (width < breakpoints.sm) return \"xs\";\n if (width < breakpoints.md) return \"sm\";\n if (width < breakpoints.lg) return \"md\";\n if (width < breakpoints.xl) return \"lg\";\n return \"xl\";\n};\n\nexport const BreakpointProvider = ({ children }: { children?: ReactNode }) => {\n const [current, setCurrent] = useState<BreakpointKeys>(\"xl\");\n\n const handler = useCallback(() => {\n const newKey = getKey();\n setCurrent(prev => (prev === newKey ? prev : newKey));\n }, []);\n\n React.useEffect(() => {\n window.addEventListener(\"resize\", handler);\n handler(); // detect on mount\n return () => window.removeEventListener(\"resize\", handler);\n }, [handler]);\n\n return (\n <BreakpointCtx.Provider value={current}>\n {children}\n </BreakpointCtx.Provider>\n );\n};\n"],"names":["React","_jsx"],"mappings":"6KAKO,MAAM,aAAa,GAAGA,cAAK,CAAC,aAAa,CAAiB,IAAI;AAErE;;AAEG;AACH,MAAM,MAAM,GAAG,MAAqB;AAChC,IAAA,IAAI,CAAC,QAAQ,EAAE,EAAE;;AAEb,QAAA,OAAO,IAAI;IACf;AAEA,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU;AAE/B,IAAA,IAAI,KAAK,GAAG,WAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAG,WAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAG,WAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,IAAI,KAAK,GAAG,WAAW,CAAC,EAAE;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,OAAO,IAAI;AACf,CAAC;MAEY,kBAAkB,GAAG,CAAC,EAAE,QAAQ,EAA4B,KAAI;IACzE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC;AAE5D,IAAA,MAAM,OAAO,GAAG,WAAW,CAAC,MAAK;AAC7B,QAAA,MAAM,MAAM,GAAG,MAAM,EAAE;AACvB,QAAA,UAAU,CAAC,IAAI,KAAK,IAAI,KAAK,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC;IACzD,CAAC,EAAE,EAAE,CAAC;AAEN,IAAAA,cAAK,CAAC,SAAS,CAAC,MAAK;AACjB,QAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC1C,OAAO,EAAE,CAAC;QACV,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC;AAC9D,IAAA,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AAEb,IAAA,QACIC,GAAA,CAAC,aAAa,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EACjC,QAAQ,EAAA,CACY;AAEjC"}
@@ -38,5 +38,7 @@
38
38
  borderRadius: "5px",
39
39
  },
40
40
  }
41
+ }, {
42
+ injectStyle: typeof window !== 'undefined'
41
43
  });
42
44
  };exports.default=useScrollbar;//# sourceMappingURL=useScrollbar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollbar.js","sources":["../../src/hooks/useScrollbar.ts"],"sourcesContent":["import { getTheme } from '../theme'\nimport { css } from '../css'\nimport { ThemeOptions } from '../theme/types';\n\nexport type UseScrollbarOption = {\n themeName: string\n root_cls?: string;\n thumbSize?: number\n thumbColor?: string\n trackColor?: string\n}\n\ntype ClassName = string\n\nconst useScrollbar = ({ themeName, root_cls, thumbSize, thumbColor, trackColor }: UseScrollbarOption): ClassName => {\n let theme = getTheme(themeName)\n if (!theme) {\n console.error(`useScrollbar: The theme '${themeName}' is not defined. Please make sure to use a valid theme name.`)\n theme = getTheme(\"light\") as ThemeOptions\n }\n\n thumbSize = thumbSize || 10\n thumbColor = thumbColor || theme.colors.text.secondary\n trackColor = trackColor || theme.colors.divider\n root_cls = root_cls || \"\"\n\n let clss = {\n \"*\": root_cls ? `${root_cls} *` : `*`,\n \"scrollbar\": root_cls ? `${root_cls}::-webkit-scrollbar, ${root_cls} ::-webkit-scrollbar` : `::-webkit-scrollbar`,\n \"scrollbarThumb\": root_cls ? `${root_cls}::-webkit-scrollbar-thumb, ${root_cls} ::-webkit-scrollbar-thumb` : `::-webkit-scrollbar-thumb`,\n \"scrollbarThumbHover\": root_cls ? `${root_cls}::-webkit-scrollbar-thumb:hover, ${root_cls} ::-webkit-scrollbar-thumb:hover` : `::-webkit-scrollbar-thumb:hover`,\n \"scrollbarTrack\": root_cls ? `${root_cls}::-webkit-scrollbar-track, ${root_cls} ::-webkit-scrollbar-track` : `::-webkit-scrollbar-track`,\n }\n\n return css({\n \"@global\": {\n [clss['*']]: {\n scrollbarWidth: \"thin\",\n scrollbarColor: `${thumbColor} ${trackColor}`,\n },\n [clss[\"scrollbar\"]]: {\n width: thumbSize,\n height: thumbSize,\n },\n [clss[\"scrollbarThumb\"]]: {\n backgroundColor: thumbColor,\n borderRadius: \"5px\",\n border: \"2px solid #f4f4f4\",\n },\n [clss[\"scrollbarThumbHover\"]]: {\n backgroundColor: thumbColor,\n },\n [clss['scrollbarTrack']]: {\n backgroundColor: trackColor,\n borderRadius: \"5px\",\n },\n }\n }) as any\n}\n\nexport default useScrollbar\n"],"names":["getTheme","css"],"mappings":"+SAcA,MAAM,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAsB,KAAe;AAChH,IAAA,IAAI,KAAK,GAAGA,aAAQ,CAAC,SAAS,CAAC;IAC/B,IAAI,CAAC,KAAK,EAAE;AACT,QAAA,OAAO,CAAC,KAAK,CAAC,4BAA4B,SAAS,CAAA,6DAAA,CAA+D,CAAC;AACnH,QAAA,KAAK,GAAGA,aAAQ,CAAC,OAAO,CAAiB;IAC5C;AAEA,IAAA,SAAS,GAAG,SAAS,IAAI,EAAE;IAC3B,UAAU,GAAG,UAAU,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS;IACtD,UAAU,GAAG,UAAU,IAAI,KAAK,CAAC,MAAM,C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A,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG;AAC5B,gBAAA,eAAe,EAAE,UAAU;AAC7B,aAAA;AACD,YAAA,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG;AACvB,gBAAA,eAAe,EAAE,UAAU;AAC3B,gBAAA,YAAY,EAAE,KAAK;AACrB,aAAA;AACH;AACH,KAAA,CAAQ;AACZ"}
1
+ {"version":3,"file":"useScrollbar.js","sources":["../../src/hooks/useScrollbar.ts"],"sourcesContent":["import { getTheme } from '../theme'\nimport { css } from '../css'\nimport { ThemeOptions } from '../theme/types';\n\nexport type UseScrollbarOption = {\n themeName: string\n root_cls?: string;\n thumbSize?: number\n thumbColor?: string\n trackColor?: string\n}\n\ntype ClassName = string\n\nconst useScrollbar = ({ themeName, root_cls, thumbSize, thumbColor, trackColor }: UseScrollbarOption): ClassName => {\n let theme = getTheme(themeName)\n if (!theme) {\n console.error(`useScrollbar: The theme '${themeName}' is not defined. Please make sure to use a valid theme name.`)\n theme = getTheme(\"light\") as ThemeOptions\n }\n\n thumbSize = thumbSize || 10\n thumbColor = thumbColor || theme.colors.text.secondary\n trackColor = trackColor || theme.colors.divider\n root_cls = root_cls || \"\"\n\n let clss = {\n \"*\": root_cls ? `${root_cls} *` : `*`,\n \"scrollbar\": root_cls ? `${root_cls}::-webkit-scrollbar, ${root_cls} ::-webkit-scrollbar` : `::-webkit-scrollbar`,\n \"scrollbarThumb\": root_cls ? `${root_cls}::-webkit-scrollbar-thumb, ${root_cls} ::-webkit-scrollbar-thumb` : `::-webkit-scrollbar-thumb`,\n \"scrollbarThumbHover\": root_cls ? `${root_cls}::-webkit-scrollbar-thumb:hover, ${root_cls} ::-webkit-scrollbar-thumb:hover` : `::-webkit-scrollbar-thumb:hover`,\n \"scrollbarTrack\": root_cls ? `${root_cls}::-webkit-scrollbar-track, ${root_cls} ::-webkit-scrollbar-track` : `::-webkit-scrollbar-track`,\n }\n\n return css({\n \"@global\": {\n [clss['*']]: {\n scrollbarWidth: \"thin\",\n scrollbarColor: `${thumbColor} ${trackColor}`,\n },\n [clss[\"scrollbar\"]]: {\n width: thumbSize,\n height: thumbSize,\n },\n [clss[\"scrollbarThumb\"]]: {\n backgroundColor: thumbColor,\n borderRadius: \"5px\",\n border: \"2px solid #f4f4f4\",\n },\n [clss[\"scrollbarThumbHover\"]]: {\n backgroundColor: thumbColor,\n },\n [clss['scrollbarTrack']]: {\n backgroundColor: trackColor,\n borderRadius: \"5px\",\n },\n }\n }, {\n injectStyle: typeof window !== 'undefined'\n }) as any\n}\n\nexport default useScrollbar\n"],"names":["getTheme","css"],"mappings":"+SAcA,MAAM,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAsB,KAAe;AAChH,IAAA,IAAI,KAAK,GAAGA,aAAQ,CAAC,SAAS,CAAC;IAC/B,IAAI,CAAC,KAAK,EAAE;AACT,QAAA,OAAO,CAAC,KAAK,CAAC,4BAA4B,SAAS,CAAA,6DAAA,CAA+D,CAAC;AACnH,QAAA,KAAK,GAAGA,aAAQ,CAAC,OAAO,CAAiB;IAC5C;AAEA,IAAA,SAAS,GAAG,SAAS,IAAI,EAAE;IAC3B,UAAU,GAAG,UAAU,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS;IACtD,UAAU,GAAG,UAAU,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO;AAC/C,IAAA,QAAQ,GAAG,QAAQ,IAAI,EAAE;AAEzB,IAAA,IAAI,IAAI,GAAG;QACR,GAAG,EAAE,QAAQ,GAAG,CAAA,EAAG,QAAQ,CAAA,EAAA,CAAI,GAAG,CAAA,CAAA,CAAG;AACrC,QAAA,WAAW,EAAE,QAAQ,GAAG,CAAA,EAAG,QAAQ,CAAA,qBAAA,EAAwB,QAAQ,CAAA,oBAAA,CAAsB,GAAG,CAAA,mBAAA,CAAqB;AACjH,QAAA,gBAAgB,EAAE,QAAQ,GAAG,CAAA,EA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.mjs
38
38
  borderRadius: "5px",
39
39
  },
40
40
  }
41
+ }, {
42
+ injectStyle: typeof window !== 'undefined'
41
43
  });
42
44
  };export{useScrollbar as default};//# sourceMappingURL=useScrollbar.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollbar.mjs","sources":["../../src/hooks/useScrollbar.ts"],"sourcesContent":["import { getTheme } from '../theme'\nimport { css } from '../css'\nimport { ThemeOptions } from '../theme/types';\n\nexport type UseScrollbarOption = {\n themeName: string\n root_cls?: string;\n thumbSize?: number\n thumbColor?: string\n trackColor?: string\n}\n\ntype ClassName = string\n\nconst useScrollbar = ({ themeName, root_cls, thumbSize, thumbColor, trackColor }: UseScrollbarOption): ClassName => {\n let theme = getTheme(themeName)\n if (!theme) {\n console.error(`useScrollbar: The theme '${themeName}' is not defined. Please make sure to use a valid theme name.`)\n theme = getTheme(\"light\") as ThemeOptions\n }\n\n thumbSize = thumbSize || 10\n thumbColor = thumbColor || theme.colors.text.secondary\n trackColor = trackColor || theme.colors.divider\n root_cls = root_cls || \"\"\n\n let clss = {\n \"*\": root_cls ? `${root_cls} *` : `*`,\n \"scrollbar\": root_cls ? `${root_cls}::-webkit-scrollbar, ${root_cls} ::-webkit-scrollbar` : `::-webkit-scrollbar`,\n \"scrollbarThumb\": root_cls ? `${root_cls}::-webkit-scrollbar-thumb, ${root_cls} ::-webkit-scrollbar-thumb` : `::-webkit-scrollbar-thumb`,\n \"scrollbarThumbHover\": root_cls ? `${root_cls}::-webkit-scrollbar-thumb:hover, ${root_cls} ::-webkit-scrollbar-thumb:hover` : `::-webkit-scrollbar-thumb:hover`,\n \"scrollbarTrack\": root_cls ? `${root_cls}::-webkit-scrollbar-track, ${root_cls} ::-webkit-scrollbar-track` : `::-webkit-scrollbar-track`,\n }\n\n return css({\n \"@global\": {\n [clss['*']]: {\n scrollbarWidth: \"thin\",\n scrollbarColor: `${thumbColor} ${trackColor}`,\n },\n [clss[\"scrollbar\"]]: {\n width: thumbSize,\n height: thumbSize,\n },\n [clss[\"scrollbarThumb\"]]: {\n backgroundColor: thumbColor,\n borderRadius: \"5px\",\n border: \"2px solid #f4f4f4\",\n },\n [clss[\"scrollbarThumbHover\"]]: {\n backgroundColor: thumbColor,\n },\n [clss['scrollbarTrack']]: {\n backgroundColor: trackColor,\n borderRadius: \"5px\",\n },\n }\n }) as any\n}\n\nexport default useScrollbar\n"],"names":[],"mappings":"+NAcA,MAAM,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAsB,KAAe;AAChH,IAAA,IAAI,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC;IAC/B,IAAI,CAAC,KAAK,EAAE;AACT,QAAA,OAAO,CAAC,KAAK,CAAC,4BAA4B,SAAS,CAAA,6DAAA,CAA+D,CAAC;AACnH,QAAA,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAiB;IAC5C;AAEA,IAAA,SAAS,GAAG,SAAS,IAAI,EAAE;IAC3B,UAAU,GAAG,UAAU,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS;IACtD,UAAU,GAAG,UAAU,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO;AAC/C,IAAA,QAAQ,GAAG,QAAQ,IAAI,EAAE;AAEzB,IAAA,IAAI,IAAI,GAAG;QACR,GAAG,EAAE,QAAQ,GAAG,CAAA,EAAG,QAAQ,CAAA,EAAA,CAAI,GAAG,CAAA,CAAA,CAAG;AACrC,QAAA,WAAW,EAAE,QAAQ,GAAG,CAAA,EAAG,QAAQ,CAAA,qBAAA,EAAwB,QAAQ,CAAA,oBAAA,CAAsB,GAAG,CAAA,mBAAA,CAAqB;AACjH,QAAA,gBAAgB,EAAE,QAAQ,GAAG,CAAA,EAAG,QAAQ,CAAA,2BAAA,EAA8B,QAAQ,CAAA,0BAAA,CAA4B,GAAG,CAAA,yBAAA,CAA2B;AACxI,QAAA,qBAAqB,EAAE,QAAQ,GAAG,CAAA,EAAG,QAAQ,CAAA,iCAAA,EAAoC,QAAQ,CAAA,gCAAA,CAAkC,GAAG,CAAA,+BAAA,CAAiC;AAC/J,QAAA,gBAAgB,EAAE,QAAQ,GAAG,CAAA,EAAG,QAAQ,CAAA,2BAAA,EAA8B,QAAQ,CAAA,0BAAA,CAA4B,GAAG,CAAA,yBAAA,CAA2B;KAC1I;AAED,IAAA,OAAO,GAAG,CAAC;AACR,QAAA,SAAS,EAAE;AACR,YAAA,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG;AACV,gBAAA,cAAc,EAAE,MAAM;AACtB,gBAAA,cAAc,EAAE,CAAA,EAAG,UAAU,CAAA,CAAA,EAAI,UAAU,CAAA,CAAE;AAC/C,aAAA;AACD,YAAA,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG;AAClB,gBAAA,KAAK,EAAE,SAAS;AAChB,gBAAA,MAAM,EAAE,SAAS;AACnB,aAAA;AACD,YAAA,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG;AACvB,gBAAA,eAAe,EAAE,UAAU;AAC3B,gBAAA,YAAY,EAAE,KAAK;AACnB,gBAAA,MAAM,EAAE,mBAAmB;AAC7B,aAAA;AACD,YAAA,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG;AAC5B,gBAAA,eAAe,EAAE,UAAU;AAC7B,aAAA;AACD,YAAA,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG;AACvB,gBAAA,eAAe,EAAE,UAAU;AAC3B,gBAAA,YAAY,EAAE,KAAK;AACrB,aAAA;AACH;AACH,KAAA,CAAQ;AACZ"}
1
+ {"version":3,"file":"useScrollbar.mjs","sources":["../../src/hooks/useScrollbar.ts"],"sourcesContent":["import { getTheme } from '../theme'\nimport { css } from '../css'\nimport { ThemeOptions } from '../theme/types';\n\nexport type UseScrollbarOption = {\n themeName: string\n root_cls?: string;\n thumbSize?: number\n thumbColor?: string\n trackColor?: string\n}\n\ntype ClassName = string\n\nconst useScrollbar = ({ themeName, root_cls, thumbSize, thumbColor, trackColor }: UseScrollbarOption): ClassName => {\n let theme = getTheme(themeName)\n if (!theme) {\n console.error(`useScrollbar: The theme '${themeName}' is not defined. Please make sure to use a valid theme name.`)\n theme = getTheme(\"light\") as ThemeOptions\n }\n\n thumbSize = thumbSize || 10\n thumbColor = thumbColor || theme.colors.text.secondary\n trackColor = trackColor || theme.colors.divider\n root_cls = root_cls || \"\"\n\n let clss = {\n \"*\": root_cls ? `${root_cls} *` : `*`,\n \"scrollbar\": root_cls ? `${root_cls}::-webkit-scrollbar, ${root_cls} ::-webkit-scrollbar` : `::-webkit-scrollbar`,\n \"scrollbarThumb\": root_cls ? `${root_cls}::-webkit-scrollbar-thumb, ${root_cls} ::-webkit-scrollbar-thumb` : `::-webkit-scrollbar-thumb`,\n \"scrollbarThumbHover\": root_cls ? `${root_cls}::-webkit-scrollbar-thumb:hover, ${root_cls} ::-webkit-scrollbar-thumb:hover` : `::-webkit-scrollbar-thumb:hover`,\n \"scrollbarTrack\": root_cls ? `${root_cls}::-webkit-scrollbar-track, ${root_cls} ::-webkit-scrollbar-track` : `::-webkit-scrollbar-track`,\n }\n\n return css({\n \"@global\": {\n [clss['*']]: {\n scrollbarWidth: \"thin\",\n scrollbarColor: `${thumbColor} ${trackColor}`,\n },\n [clss[\"scrollbar\"]]: {\n width: thumbSize,\n height: thumbSize,\n },\n [clss[\"scrollbarThumb\"]]: {\n backgroundColor: thumbColor,\n borderRadius: \"5px\",\n border: \"2px solid #f4f4f4\",\n },\n [clss[\"scrollbarThumbHover\"]]: {\n backgroundColor: thumbColor,\n },\n [clss['scrollbarTrack']]: {\n backgroundColor: trackColor,\n borderRadius: \"5px\",\n },\n }\n }, {\n injectStyle: typeof window !== 'undefined'\n }) as any\n}\n\nexport default useScrollbar\n"],"names":[],"mappings":"+NAcA,MAAM,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAsB,KAAe;AAChH,IAAA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AA,cAAc,EAAE,CAAA,EAAG,UAAU,CAAA,CAAA,EAAI,UAAU,CAAA,CAAE;AAC/C,aAAA;AACD,YAAA,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG;AAClB,gBAAA,KAAK,EAAE,SAAS;AAChB,gBAAA,MAAM,EAAE,SAAS;AACnB,aAAA;AACD,YAAA,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG;AACvB,gBAAA,eAAe,EAAE,UAAU;AAC3B,gBAAA,YAAY,EAAE,KAAK;AACnB,gBAAA,MAAM,EAAE,mBAAmB;AAC7B,aAAA;AACD,YAAA,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG;AAC5B,gBAAA,eAAe,EAAE,UAAU;AAC7B,aAAA;AACD,YAAA,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG;AACvB,gBAAA,eAAe,EAAE,UAAU;AAC3B,gBAAA,YAAY,EAAE,KAAK;AACrB,aAAA;AACH;KACH,EAAE;AACA,QAAA,WAAW,EAAE,OAAO,MAAM,KAAK;AACjC,KAAA,CAAQ;AACZ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xanui/core",
3
- "version": "1.1.26",
3
+ "version": "1.2.1",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "main": "./index.js",
@@ -8,7 +8,7 @@
8
8
  "types": "./index.d.ts",
9
9
  "sideEffects": false,
10
10
  "dependencies": {
11
- "oncss": "^1.2.3",
11
+ "oncss": "^1.2.4",
12
12
  "pretty-class": "^1.0.8",
13
13
  "react-state-bucket": "^1.2.4"
14
14
  },
@@ -5,16 +5,18 @@
5
5
  console.error(`ThemeProvider: The theme '${theme}' is not defined. Please make sure to use a valid theme name.`);
6
6
  THEME = core.ThemeFactory.get("light");
7
7
  }
8
- React__namespace.useMemo(() => {
8
+ const globalStyle = React__namespace.useMemo(() => {
9
9
  const root_cls = `.xui-${theme}-theme-root`;
10
10
  let gkeys = Object.keys(THEME.globalStyle || {});
11
11
  let gstyles = {};
12
12
  gkeys.forEach((key) => {
13
13
  gstyles[`${root_cls} ${key}`] = THEME.globalStyle[key];
14
14
  });
15
- index.css({
15
+ return index.css({
16
16
  "@global": Object.assign(Object.assign({}, gstyles), { [root_cls]: ThemeCssVars.default(THEME) })
17
+ }, {
18
+ injectStyle: typeof window !== 'undefined'
17
19
  });
18
20
  }, [theme]);
19
- return (jsxRuntime.jsx(core.ThemeContex.Provider, { value: theme, children: jsxRuntime.jsx(index$1.default, Object.assign({ minHeight: "100%", bgcolor: THEME.colors.background.primary, fontFamily: THEME.typography.fontFamily, fontSize: THEME.typography.text.fontSize, fontWeight: THEME.typography.text.fontWeight, lineHeight: THEME.typography.text.lineHeight }, props, { baseClass: `${theme}-theme-root`, direction: THEME.rtl ? "rtl" : "ltr", children: children })) }));
21
+ return (jsxRuntime.jsxs(core.ThemeContex.Provider, { value: theme, children: [typeof window === 'undefined' && jsxRuntime.jsx("style", { precedence: globalStyle.classname, href: globalStyle.classname, dangerouslySetInnerHTML: { __html: globalStyle.css } }), jsxRuntime.jsx(index$1.default, Object.assign({ minHeight: "100%", bgcolor: THEME.colors.background.primary, color: THEME.colors.text.primary, fontFamily: THEME.typography.fontFamily, fontSize: THEME.typography.text.fontSize, fontWeight: THEME.typography.text.fontWeight, lineHeight: THEME.typography.text.lineHeight }, props, { baseClass: `${theme}-theme-root`, direction: THEME.rtl ? "rtl" : "ltr", children: children }))] }));
20
22
  };exports.default=ThemeProvider;//# sourceMappingURL=ThemeProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.js","sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { ThemeOptions } from \"./types\"\nimport Tag from \"../Tag\"\nimport { TagComponentType, TagProps } from \"../Tag/types\"\nimport { ThemeContex, ThemeFactory } from \"./core\"\nimport ThemeCssVars from \"./ThemeCssVars\"\nimport { css } from \"../css\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n}\n\n\nconst ThemeProvider = <T extends TagComponentType = 'div'>({ children, theme, ...props }: ThemeProviderProps<T>) => {\n let THEME = ThemeFactory.get(theme) as ThemeOptions\n if (!THEME) {\n console.error(`ThemeProvider: The theme '${theme}' is not defined. Please make sure to use a valid theme name.`)\n THEME = ThemeFactory.get(\"light\") as ThemeOptions\n }\n\n React.useMemo(() => {\n const root_cls = `.xui-${theme}-theme-root`\n let gkeys = Object.keys(THEME.globalStyle || {})\n let gstyles: any = {}\n gkeys.forEach((key) => {\n gstyles[`${root_cls} ${key}`] = THEME.globalStyle[key as any]\n })\n\n css({\n \"@global\": {\n ...gstyles,\n [root_cls]: ThemeCssVars(THEME)\n }\n })\n }, [theme])\n\n return (\n <ThemeContex.Provider value={theme}>\n <Tag\n minHeight=\"100%\"\n bgcolor={THEME.colors.background.primary}\n fontFamily={THEME.typography.fontFamily}\n fontSize={THEME.typography.text.fontSize}\n fontWeight={THEME.typography.text.fontWeight}\n lineHeight={THEME.typography.text.lineHeight}\n {...props}\n baseClass={`${theme}-theme-root`}\n direction={THEME.rtl ? \"rtl\" : \"ltr\"}\n >\n {children}\n </Tag>\n </ThemeContex.Provider>\n )\n}\n\nexport default ThemeProvider"],"names":["__rest","ThemeFactory","React","css","ThemeCssVars","_jsx","ThemeContex","Tag"],"mappings":"woBAaA,MAAM,aAAa,GAAG,CAAqC,EAAoD,KAAI;QAAxD,EAAE,QAAQ,EAAE,KAAK,EAAA,GAAA,EAAmC,EAA9B,KAAK,GAAAA,YAAA,CAAA,EAAA,EAA3B,qBAA6B,CAAF;IACnF,IAAI,KAAK,GAAGC,iBAAY,CAAC,GAAG,CAAC,KAAK,CAAiB;IACnD,IAAI,CAAC,KAAK,EAAE;AACT,QAAA,OAAO,CAAC,KAAK,CAAC,6BAA6B,KAAK,CAAA,6DAAA,CAA+D,CAAC;AAChH,QAAA,KAAK,GAAGA,iBAAY,CAAC,GAAG,CAAC,OAAO,CAAiB;IACpD;AAEA,IAA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nC,QAAQ,EAAA,CAAA,CACN,EAAA,CACc;AAE7B"}
1
+ {"version":3,"file":"ThemeProvider.js","sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { ThemeOptions } from \"./types\"\nimport Tag from \"../Tag\"\nimport { TagComponentType, TagProps } from \"../Tag/types\"\nimport { ThemeContex, ThemeFactory } from \"./core\"\nimport ThemeCssVars from \"./ThemeCssVars\"\nimport { css } from \"../css\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n}\n\n\nconst ThemeProvider = <T extends TagComponentType = 'div'>({ children, theme, ...props }: ThemeProviderProps<T>) => {\n let THEME = ThemeFactory.get(theme) as ThemeOptions\n if (!THEME) {\n console.error(`ThemeProvider: The theme '${theme}' is not defined. Please make sure to use a valid theme name.`)\n THEME = ThemeFactory.get(\"light\") as ThemeOptions\n }\n\n const globalStyle: any = React.useMemo(() => {\n const root_cls = `.xui-${theme}-theme-root`\n let gkeys = Object.keys(THEME.globalStyle || {})\n let gstyles: any = {}\n gkeys.forEach((key) => {\n gstyles[`${root_cls} ${key}`] = THEME.globalStyle[key as any]\n })\n\n return css({\n \"@global\": {\n ...gstyles,\n [root_cls]: ThemeCssVars(THEME)\n }\n }, {\n injectStyle: typeof window !== 'undefined'\n })\n }, [theme])\n\n return (\n <ThemeContex.Provider value={theme}>\n {\n typeof window === 'undefined' && <style\n precedence={globalStyle.classname}\n href={globalStyle.classname}\n dangerouslySetInnerHTML={{ __html: globalStyle.css }}\n />\n }\n <Tag\n minHeight=\"100%\"\n bgcolor={THEME.colors.background.primary}\n color={THEME.colors.text.primary}\n fontFamily={THEME.typography.fontFamily}\n fontSize={THEME.typography.text.fontSize}\n fontWeight={THEME.typography.text.fontWeight}\n lineHeight={THEME.typography.text.lineHeight}\n {...props}\n baseClass={`${theme}-theme-root`}\n direction={THEME.rtl ? \"rtl\" : \"ltr\"}\n >\n {children}\n </Tag>\n </ThemeContex.Provider>\n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,CAAC,CAAC;AAEX,IAAA,QACGC,eAAA,CAACC,gBAAW,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,QAAA,EAAA,CAE5B,OAAO,MAAM,KAAK,WAAW,IAAIC,cAAA,CAAA,OAAA,EAAA,EAC9B,UAAU,EAAE,WAAW,CAAC,SAAS,EACjC,IAAI,EAAE,WAAW,CAAC,SAAS,EAC3B,uBAAuB,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,GAAG,EAAE,EAAA,CACrD,EAELA,cAAA,CAACC,eAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EACD,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,EACxC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAChC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,UAAU,EACvC,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EACxC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAC5C,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAA,EACxC,KAAK,EAAA,EACT,SAAS,EAAE,CAAA,EAAG,KAAK,CAAA,WAAA,CAAa,EAChC,SAAS,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,GAAG,KAAK,EAAA,QAAA,EAEnC,QAAQ,EAAA,CAAA,CACN,CAAA,EAAA,CACc;AAE7B"}
@@ -1,20 +1,22 @@
1
- import {__rest}from'tslib';import {jsx}from'react/jsx-runtime';import*as React from'react';import Tag from'../Tag/index.mjs';import {ThemeFactory,ThemeContex}from'./core.mjs';import ThemeCssVars from'./ThemeCssVars.mjs';import {css}from'../css/index.mjs';const ThemeProvider = (_a) => {
1
+ import {__rest}from'tslib';import {jsxs,jsx}from'react/jsx-runtime';import*as React from'react';import Tag from'../Tag/index.mjs';import {ThemeFactory,ThemeContex}from'./core.mjs';import ThemeCssVars from'./ThemeCssVars.mjs';import {css}from'../css/index.mjs';const ThemeProvider = (_a) => {
2
2
  var { children, theme } = _a, props = __rest(_a, ["children", "theme"]);
3
3
  let THEME = ThemeFactory.get(theme);
4
4
  if (!THEME) {
5
5
  console.error(`ThemeProvider: The theme '${theme}' is not defined. Please make sure to use a valid theme name.`);
6
6
  THEME = ThemeFactory.get("light");
7
7
  }
8
- React.useMemo(() => {
8
+ const globalStyle = React.useMemo(() => {
9
9
  const root_cls = `.xui-${theme}-theme-root`;
10
10
  let gkeys = Object.keys(THEME.globalStyle || {});
11
11
  let gstyles = {};
12
12
  gkeys.forEach((key) => {
13
13
  gstyles[`${root_cls} ${key}`] = THEME.globalStyle[key];
14
14
  });
15
- css({
15
+ return css({
16
16
  "@global": Object.assign(Object.assign({}, gstyles), { [root_cls]: ThemeCssVars(THEME) })
17
+ }, {
18
+ injectStyle: typeof window !== 'undefined'
17
19
  });
18
20
  }, [theme]);
19
- return (jsx(ThemeContex.Provider, { value: theme, children: jsx(Tag, Object.assign({ minHeight: "100%", bgcolor: THEME.colors.background.primary, fontFamily: THEME.typography.fontFamily, fontSize: THEME.typography.text.fontSize, fontWeight: THEME.typography.text.fontWeight, lineHeight: THEME.typography.text.lineHeight }, props, { baseClass: `${theme}-theme-root`, direction: THEME.rtl ? "rtl" : "ltr", children: children })) }));
21
+ return (jsxs(ThemeContex.Provider, { value: theme, children: [typeof window === 'undefined' && jsx("style", { precedence: globalStyle.classname, href: globalStyle.classname, dangerouslySetInnerHTML: { __html: globalStyle.css } }), jsx(Tag, Object.assign({ minHeight: "100%", bgcolor: THEME.colors.background.primary, color: THEME.colors.text.primary, fontFamily: THEME.typography.fontFamily, fontSize: THEME.typography.text.fontSize, fontWeight: THEME.typography.text.fontWeight, lineHeight: THEME.typography.text.lineHeight }, props, { baseClass: `${theme}-theme-root`, direction: THEME.rtl ? "rtl" : "ltr", children: children }))] }));
20
22
  };export{ThemeProvider as default};//# sourceMappingURL=ThemeProvider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.mjs","sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { ThemeOptions } from \"./types\"\nimport Tag from \"../Tag\"\nimport { TagComponentType, TagProps } from \"../Tag/types\"\nimport { ThemeContex, ThemeFactory } from \"./core\"\nimport ThemeCssVars from \"./ThemeCssVars\"\nimport { css } from \"../css\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n}\n\n\nconst ThemeProvider = <T extends TagComponentType = 'div'>({ children, theme, ...props }: ThemeProviderProps<T>) => {\n let THEME = ThemeFactory.get(theme) as ThemeOptions\n if (!THEME) {\n console.error(`ThemeProvider: The theme '${theme}' is not defined. Please make sure to use a valid theme name.`)\n THEME = ThemeFactory.get(\"light\") as ThemeOptions\n }\n\n React.useMemo(() => {\n const root_cls = `.xui-${theme}-theme-root`\n let gkeys = Object.keys(THEME.globalStyle || {})\n let gstyles: any = {}\n gkeys.forEach((key) => {\n gstyles[`${root_cls} ${key}`] = THEME.globalStyle[key as any]\n })\n\n css({\n \"@global\": {\n ...gstyles,\n [root_cls]: ThemeCssVars(THEME)\n }\n })\n }, [theme])\n\n return (\n <ThemeContex.Provider value={theme}>\n <Tag\n minHeight=\"100%\"\n bgcolor={THEME.colors.background.primary}\n fontFamily={THEME.typography.fontFamily}\n fontSize={THEME.typography.text.fontSize}\n fontWeight={THEME.typography.text.fontWeight}\n lineHeight={THEME.typography.text.lineHeight}\n {...props}\n baseClass={`${theme}-theme-root`}\n direction={THEME.rtl ? \"rtl\" : \"ltr\"}\n >\n {children}\n </Tag>\n </ThemeContex.Provider>\n )\n}\n\nexport default ThemeProvider"],"names":["_jsx"],"mappings":"+PAaA,MAAM,aAAa,GAAG,CAAqC,EAAoD,KAAI;QAAxD,EAAE,QAAQ,EAAE,KAAK,EAAA,GAAA,EAAmC,EAA9B,KAAK,GAAA,M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CAAC,QAAQ,EACxC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAC5C,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAA,EACxC,KAAK,IACT,SAAS,EAAE,GAAG,KAAK,CAAA,WAAA,CAAa,EAChC,SAAS,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,GAAG,KAAK,EAAA,QAAA,EAEnC,QAAQ,EAAA,CAAA,CACN,EAAA,CACc;AAE7B"}
1
+ {"version":3,"file":"ThemeProvider.mjs","sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { ThemeOptions } from \"./types\"\nimport Tag from \"../Tag\"\nimport { TagComponentType, TagProps } from \"../Tag/types\"\nimport { ThemeContex, ThemeFactory } from \"./core\"\nimport ThemeCssVars from \"./ThemeCssVars\"\nimport { css } from \"../css\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n}\n\n\nconst ThemeProvider = <T extends TagComponentType = 'div'>({ children, theme, ...props }: ThemeProviderProps<T>) => {\n let THEME = ThemeFactory.get(theme) as ThemeOptions\n if (!THEME) {\n console.error(`ThemeProvider: The theme '${theme}' is not defined. Please make sure to use a valid theme name.`)\n THEME = ThemeFactory.get(\"light\") as ThemeOptions\n }\n\n const globalStyle: any = React.useMemo(() => {\n const root_cls = `.xui-${theme}-theme-root`\n let gkeys = Object.keys(THEME.globalStyle || {})\n let gstyles: any = {}\n gkeys.forEach((key) => {\n gstyles[`${root_cls} ${key}`] = THEME.globalStyle[key as any]\n })\n\n return css({\n \"@global\": {\n ...gstyles,\n [root_cls]: ThemeCssVars(THEME)\n }\n }, {\n injectStyle: typeof window !== 'undefined'\n })\n }, [theme])\n\n return (\n <ThemeContex.Provider value={theme}>\n {\n typeof window === 'undefined' && <style\n precedence={globalStyle.classname}\n href={globalStyle.classname}\n dangerouslySetInnerHTML={{ __html: globalStyle.css }}\n />\n }\n <Tag\n minHeight=\"100%\"\n bgcolor={THEME.colors.background.primary}\n color={THEME.colors.text.primary}\n fontFamily={THEME.typography.fontFamily}\n fontSize={THEME.typography.text.fontSize}\n fontWeight={THEME.typography.text.fontWeight}\n lineHeight={THEME.typography.text.lineHeight}\n {...props}\n baseClass={`${theme}-theme-root`}\n direction={THEME.rtl ? \"rtl\" : \"ltr\"}\n >\n {children}\n </Tag>\n </ThemeContex.Provider>\n )\n}\n\nexport default ThemeProvider"],"names":["_jsxs","_jsx"],"mappings":"oQAaA,MAAM,aAAa,GAAG,CAAqC,EAAoD,KAAI;QAAxD,EAAE,QAAQ,EAAE,KAAK,EAAA,GAAA,EAAmC,EAA9B,KAAK,GAAA,MAAA,CAAA,EAAA,EAA3B,qBAA6B,CAAF;IACnF,IAAI,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,CAAiB;IACnD,IAAI,CAAC,KAAK,EAAE;AACT,QAAA,OAAO,CAAC,KAAK,CAAC,6BAA6B,KAAK,CAAA,6DAAA,CAA+D,CAAC;AAChH,QAAA,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAiB;IACpD;AAEA,IAAA,MAAM,WAAW,GAAQ,KAAK,CAAC,OAAO,CAAC,MAAK;AACzC,QAAA,MAAM,QAAQ,GAAG,CAAA,KAAA,EAAQ,KAAK,aAAa;AAC3C,QAAA,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC;QAChD,IAAI,OAAO,GAAQ,EAAE;AACrB,QAAA,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,KAAI;AACnB,YAAA,OAAO,CAAC,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,GAAG,CAAA,CAAE,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,GAAU,CAAC;AAChE,QAAA,CAAC,CAAC;AAEF,QAAA,OAAO,GAAG,CAAC;YACR,SAAS,EAAA,MAAA,CAAA,M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