@xanui/core 1.0.3 → 1.0.5

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.
@@ -2,10 +2,10 @@ import cssPropList from "./cssPropList";
2
2
  import { css } from "../css";
3
3
  import { classNames } from "pretty-class";
4
4
  const useTagProps = ({ sxr, sx, baseClass, classNames: clses, hover, ...props }) => {
5
- let _css = { ...sxr, ...sx, ...props };
5
+ let _css = { ...props, ...sxr, ...sx };
6
6
  if (hover) _css["&:hover"] = hover;
7
7
  const style = css(_css, {
8
- skipProps: (prop) => !cssPropList[prop]
8
+ skipProps: (prop, _val, dept) => dept === 1 && !cssPropList[prop]
9
9
  });
10
10
  let skipProps = style.skiped[style.classname] || [];
11
11
  const _props = {};
@@ -13,7 +13,7 @@ const useTagProps = ({ sxr, sx, baseClass, classNames: clses, hover, ...props })
13
13
  _props[prop] = props[prop];
14
14
  }
15
15
  _props.className = classNames([
16
- baseClass ? "nui-" + baseClass : "",
16
+ baseClass ? "xui-" + baseClass : "",
17
17
  style.classname,
18
18
  props.className,
19
19
  ...clses || []
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Tag/useTagProps.ts"],
4
- "sourcesContent": ["import { TagComponentType, TagProps, TagPropsRoot } from './types';\nimport cssPropList from './cssPropList';\nimport { css } from '../css';\nimport { classNames } from 'pretty-class';\n\nconst useTagProps = <T extends TagComponentType = \"div\">({ sxr, sx, baseClass, classNames: clses, hover, ...props }: TagPropsRoot<T>): TagProps<T> => {\n let _css: any = { ...sxr, ...sx, ...props }\n if (hover) _css['&:hover'] = hover\n const style = css(_css, {\n skipProps: (prop): any => !cssPropList[prop]\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 ? \"nui-\" + baseClass : \"\",\n style.classname,\n props.className,\n ...(clses as any || []),\n ])\n return _props\n}\n\n\nexport default useTagProps"],
5
- "mappings": "AACA,OAAO,iBAAiB;AACxB,SAAS,WAAW;AACpB,SAAS,kBAAkB;AAE3B,MAAM,cAAc,CAAqC,EAAE,KAAK,IAAI,WAAW,YAAY,OAAO,OAAO,GAAG,MAAM,MAAoC;AACnJ,MAAI,OAAY,EAAE,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM;AAC1C,MAAI,MAAO,MAAK,SAAS,IAAI;AAC7B,QAAM,QAAQ,IAAI,MAAM;AAAA,IACrB,WAAW,CAAC,SAAc,CAAC,YAAY,IAAI;AAAA,EAC9C,CAAC;AAED,MAAI,YAAY,MAAM,OAAO,MAAM,SAAgB,KAAK,CAAC;AACzD,QAAM,SAAc,CAAC;AACrB,WAAS,QAAQ,WAAW;AACzB,WAAO,IAAI,IAAK,MAAc,IAAI;AAAA,EACrC;AACA,SAAO,YAAY,WAAW;AAAA,IAC3B,YAAY,SAAS,YAAY;AAAA,IACjC,MAAM;AAAA,IACN,MAAM;AAAA,IACN,GAAI,SAAgB,CAAC;AAAA,EACxB,CAAC;AACD,SAAO;AACV;AAGA,IAAO,sBAAQ;",
4
+ "sourcesContent": ["import { TagComponentType, TagProps, TagPropsRoot } from './types';\nimport cssPropList from './cssPropList';\nimport { css } from '../css';\nimport { classNames } from 'pretty-class';\n\nconst useTagProps = <T extends TagComponentType = \"div\">({ sxr, sx, baseClass, classNames: clses, hover, ...props }: TagPropsRoot<T>): TagProps<T> => {\n let _css: any = { ...props, ...sxr, ...sx }\n if (hover) _css['&:hover'] = hover\n const style = css(_css, {\n skipProps: (prop, _val, dept): any => dept === 1 && !cssPropList[prop]\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\n}\n\n\nexport default useTagProps"],
5
+ "mappings": "AACA,OAAO,iBAAiB;AACxB,SAAS,WAAW;AACpB,SAAS,kBAAkB;AAE3B,MAAM,cAAc,CAAqC,EAAE,KAAK,IAAI,WAAW,YAAY,OAAO,OAAO,GAAG,MAAM,MAAoC;AACnJ,MAAI,OAAY,EAAE,GAAG,OAAO,GAAG,KAAK,GAAG,GAAG;AAC1C,MAAI,MAAO,MAAK,SAAS,IAAI;AAC7B,QAAM,QAAQ,IAAI,MAAM;AAAA,IACrB,WAAW,CAAC,MAAM,MAAM,SAAc,SAAS,KAAK,CAAC,YAAY,IAAI;AAAA,EACxE,CAAC;AAED,MAAI,YAAY,MAAM,OAAO,MAAM,SAAgB,KAAK,CAAC;AACzD,QAAM,SAAc,CAAC;AACrB,WAAS,QAAQ,WAAW;AACzB,WAAO,IAAI,IAAK,MAAc,IAAI;AAAA,EACrC;AACA,SAAO,YAAY,WAAW;AAAA,IAC3B,YAAY,SAAS,YAAY;AAAA,IACjC,MAAM;AAAA,IACN,MAAM;AAAA,IACN,GAAI,SAAgB,CAAC;AAAA,EACxB,CAAC;AACD,SAAO;AACV;AAGA,IAAO,sBAAQ;",
6
6
  "names": []
7
7
  }
package/css/aliases.js CHANGED
@@ -1,9 +1,9 @@
1
1
  const isStr = (v, or) => typeof v === "string" ? v : or;
2
2
  const aliases = {
3
3
  bgcolor: (v) => ({ backgroundColor: v }),
4
- bgimage: (v) => ({ backgroundImage: `url(${v})`, "background-size": "cover", "background-repeat": "no-repeat" }),
5
- bg: (v) => ({ "background": v }),
6
- p: (v) => ({ "padding": isStr(v, 8 * v) }),
4
+ bgimage: (v) => ({ backgroundImage: `url(${v})`, backgroundSize: "cover", backgroundRepeat: "no-repeat" }),
5
+ bg: (v) => ({ background: v }),
6
+ p: (v) => ({ padding: isStr(v, 8 * v) }),
7
7
  pt: (v) => ({ paddingTop: isStr(v, 8 * v) }),
8
8
  pr: (v) => ({ paddingRight: isStr(v, 8 * v) }),
9
9
  pb: (v) => ({ paddingBottom: isStr(v, 8 * v) }),
@@ -24,8 +24,8 @@ const aliases = {
24
24
  flexRow: (v) => v ? { flexDirection: "row" } : {},
25
25
  flexColumn: (v) => v ? { flexDirection: "column" } : {},
26
26
  flexWraped: (v) => v ? { flexWrap: "wrap" } : {},
27
- direction: (v) => v === "row" || v === "column" ? { "flex-direction": v } : { direction: v },
28
- gap: (v) => ({ "gap": isStr(v, 8 * v) })
27
+ direction: (v) => v === "row" || v === "column" ? { flexDirection: v } : { direction: v },
28
+ gap: (v) => ({ gap: isStr(v, 8 * v) })
29
29
  };
30
30
  var aliases_default = aliases;
31
31
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/css/aliases.ts"],
4
- "sourcesContent": ["import { OptionAliases } from 'oncss'\nimport { Aliases } from './types'\n\nconst isStr = (v: any, or: any) => typeof v === 'string' ? v : or\n\nconst aliases: OptionAliases<Aliases> = {\n bgcolor: (v) => ({ backgroundColor: v }),\n bgimage: (v) => ({ backgroundImage: `url(${v})`, \"background-size\": \"cover\", \"background-repeat\": \"no-repeat\" }),\n bg: (v) => ({ 'background': v }),\n p: (v) => ({ \"padding\": isStr(v, 8 * v) }),\n pt: (v) => ({ paddingTop: isStr(v, 8 * v) }),\n pr: (v) => ({ paddingRight: isStr(v, 8 * v) }),\n pb: (v) => ({ paddingBottom: isStr(v, 8 * v) }),\n pl: (v) => ({ paddingLeft: isStr(v, 8 * v) }),\n px: (v) => ({ paddingLeft: isStr(v, 8 * v), paddingRight: isStr(v, 8 * v) }),\n py: (v) => ({ paddingTop: isStr(v, 8 * v), paddingBottom: isStr(v, 8 * v) }),\n m: (v) => ({ margin: isStr(v, 8 * v) }),\n mt: (v) => ({ marginTop: isStr(v, 8 * v) }),\n mr: (v) => ({ marginRight: isStr(v, 8 * v) }),\n mb: (v) => ({ marginBottom: isStr(v, 8 * v) }),\n ml: (v) => ({ marginLeft: isStr(v, 8 * v) }),\n mx: (v) => ({ marginLeft: isStr(v, 8 * v), marginRight: isStr(v, 8 * v) }),\n my: (v) => ({ marginTop: isStr(v, 8 * v), marginBottom: isStr(v, 8 * v) }),\n radius: (v) => ({ borderRadius: isStr(v, 8 * v) }),\n borderRadius: (v) => ({ borderRadius: isStr(v, 8 * v) }),\n shadow: (v) => ({ boxShadow: v }),\n flexBox: (v) => (v ? { display: \"flex\" } : {}),\n flexRow: (v) => (v ? { flexDirection: \"row\" } : {}),\n flexColumn: (v) => (v ? { flexDirection: \"column\" } : {}),\n flexWraped: (v) => (v ? { flexWrap: \"wrap\" } : {}),\n direction: (v) => (v === 'row' || v === 'column' ? { \"flex-direction\": v } : { direction: v }),\n gap: (v) => ({ \"gap\": isStr(v, 8 * v) }),\n};\n\nexport default aliases"],
5
- "mappings": "AAGA,MAAM,QAAQ,CAAC,GAAQ,OAAY,OAAO,MAAM,WAAW,IAAI;AAE/D,MAAM,UAAkC;AAAA,EACrC,SAAS,CAAC,OAAO,EAAE,iBAAiB,EAAE;AAAA,EACtC,SAAS,CAAC,OAAO,EAAE,iBAAiB,OAAO,CAAC,KAAK,mBAAmB,SAAS,qBAAqB,YAAY;AAAA,EAC9G,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE;AAAA,EAC9B,GAAG,CAAC,OAAO,EAAE,WAAW,MAAM,GAAG,IAAI,CAAC,EAAE;AAAA,EACxC,IAAI,CAAC,OAAO,EAAE,YAAY,MAAM,GAAG,IAAI,CAAC,EAAE;AAAA,EAC1C,IAAI,CAAC,OAAO,EAAE,cAAc,MAAM,GAAG,IAAI,CAAC,EAAE;AAAA,EAC5C,IAAI,CAAC,OAAO,EAAE,eAAe,MAAM,GAAG,IAAI,CAAC,EAAE;AAAA,EAC7C,IAAI,CAAC,OAAO,EAAE,aAAa,MAAM,GAAG,IAAI,CAAC,EAAE;AAAA,EAC3C,IAAI,CAAC,OAAO,EAAE,aAAa,MAAM,GAAG,IAAI,CAAC,GAAG,cAAc,MAAM,GAAG,IAAI,CAAC,EAAE;AAAA,EAC1E,IAAI,CAAC,OAAO,EAAE,YAAY,M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C,OAAO,EAAE,OAAO,MAAM,GAAG,IAAI,CAAC,EAAE;AACzC;AAEA,IAAO,kBAAQ;",
4
+ "sourcesContent": ["import { OptionAliases } from 'oncss'\nimport { Aliases } from './types'\n\nconst isStr = (v: any, or: any) => typeof v === 'string' ? v : or\n\nconst aliases: OptionAliases<Aliases> = {\n bgcolor: (v) => ({ backgroundColor: v }),\n bgimage: (v) => ({ backgroundImage: `url(${v})`, backgroundSize: \"cover\", backgroundRepeat: \"no-repeat\" }),\n bg: (v) => ({ background: v }),\n p: (v) => ({ padding: isStr(v, 8 * v) }),\n pt: (v) => ({ paddingTop: isStr(v, 8 * v) }),\n pr: (v) => ({ paddingRight: isStr(v, 8 * v) }),\n pb: (v) => ({ paddingBottom: isStr(v, 8 * v) }),\n pl: (v) => ({ paddingLeft: isStr(v, 8 * v) }),\n px: (v) => ({ paddingLeft: isStr(v, 8 * v), paddingRight: isStr(v, 8 * v) }),\n py: (v) => ({ paddingTop: isStr(v, 8 * v), paddingBottom: isStr(v, 8 * v) }),\n m: (v) => ({ margin: isStr(v, 8 * v) }),\n mt: (v) => ({ marginTop: isStr(v, 8 * v) }),\n mr: (v) => ({ marginRight: isStr(v, 8 * v) }),\n mb: (v) => ({ marginBottom: isStr(v, 8 * v) }),\n ml: (v) => ({ marginLeft: isStr(v, 8 * v) }),\n mx: (v) => ({ marginLeft: isStr(v, 8 * v), marginRight: isStr(v, 8 * v) }),\n my: (v) => ({ marginTop: isStr(v, 8 * v), marginBottom: isStr(v, 8 * v) }),\n radius: (v) => ({ borderRadius: isStr(v, 8 * v) }),\n borderRadius: (v) => ({ borderRadius: isStr(v, 8 * v) }),\n shadow: (v) => ({ boxShadow: v }),\n flexBox: (v) => (v ? { display: \"flex\" } : {}),\n flexRow: (v) => (v ? { flexDirection: \"row\" } : {}),\n flexColumn: (v) => (v ? { flexDirection: \"column\" } : {}),\n flexWraped: (v) => (v ? { flexWrap: \"wrap\" } : {}),\n direction: (v) => (v === 'row' || v === 'column' ?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AAE;AAAA,EAC5C,IAAI,CAAC,OAAO,EAAE,YAAY,MAAM,GAAG,IAAI,CAAC,EAAE;AAAA,EAC1C,IAAI,CAAC,OAAO,EAAE,YAAY,MAAM,GAAG,IAAI,CAAC,GAAG,aAAa,MAAM,GAAG,IAAI,CAAC,EAAE;AAAA,EACxE,IAAI,CAAC,OAAO,EAAE,WAAW,MAAM,GAAG,IAAI,CAAC,GAAG,cAAc,MAAM,GAAG,IAAI,CAAC,EAAE;AAAA,EACxE,QAAQ,CAAC,OAAO,EAAE,cAAc,MAAM,GAAG,IAAI,CAAC,EAAE;AAAA,EAChD,cAAc,CAAC,OAAO,EAAE,cAAc,MAAM,GAAG,IAAI,CAAC,EAAE;AAAA,EACtD,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE;AAAA,EAC/B,SAAS,CAAC,MAAO,IAAI,EAAE,SAAS,OAAO,IAAI,CAAC;AAAA,EAC5C,SAAS,CAAC,MAAO,IAAI,EAAE,eAAe,MAAM,IAAI,CAAC;AAAA,EACjD,YAAY,CAAC,MAAO,IAAI,EAAE,eAAe,SAAS,IAAI,CAAC;AAAA,EACvD,YAAY,CAAC,MAAO,IAAI,EAAE,UAAU,OAAO,IAAI,CAAC;AAAA,EAChD,WAAW,CAAC,MAAO,MAAM,SAAS,MAAM,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE;AAAA,EACzF,KAAK,CAAC,OAAO,EAAE,KAAK,MAAM,GAAG,IAAI,CAAC,EAAE;AACvC;AAEA,IAAO,kBAAQ;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xanui/core",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "publishConfig": {
@@ -12,7 +12,7 @@
12
12
  "publish:pack": "makepack pack -p"
13
13
  },
14
14
  "dependencies": {
15
- "oncss": "^1.1.2",
15
+ "oncss": "^1.1.5",
16
16
  "pretty-class": "^1.0.0",
17
17
  "react": "^19.0.0",
18
18
  "react-dom": "^19.0.0",
@@ -19,7 +19,7 @@ const ThemeProvider = ({ children, theme, resetCss, scrollbarCss, renderIsRoot,
19
19
  }
20
20
  css({
21
21
  "@global": {
22
- [`.nui-${theme}-theme-root`]: ThemeCssVars(THEME)
22
+ [`.xui-${theme}-theme-root`]: ThemeCssVars(THEME)
23
23
  }
24
24
  });
25
25
  if (scrollbarCss && typeof document !== "undefined") {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/theme/ThemeProvider.tsx"],
4
- "sourcesContent": ["import * as React from \"react\"\nimport { ThemeOptions } from \"./types\"\nimport Tag from \"../Tag\"\nimport { TagComponentType, TagProps } from \"../Tag/types\"\nimport { BreakpointProvider } from \"../breakpoint\"\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 resetCss?: boolean;\n scrollbarCss?: boolean;\n renderIsRoot?: React.ReactElement;\n}\n\nconst providers: string[] = []\n\nconst ThemeProvider = ({ children, theme, resetCss, scrollbarCss, renderIsRoot, ...props }: ThemeProviderProps) => {\n const id = React.useId()\n const THEME = ThemeFactory.get(theme) as ThemeOptions\n if (!THEME) throw new Error(`Invalid theme name provided: ${theme}`)\n resetCss ??= true\n scrollbarCss ??= true\n\n React.useMemo(() => {\n if (!!Object.keys(THEME.globalStyle).length) {\n css({\n \"@global\": THEME.globalStyle\n })\n }\n\n css({\n \"@global\": {\n [`.nui-${theme}-theme-root`]: ThemeCssVars(THEME)\n }\n })\n\n if (scrollbarCss && typeof document !== 'undefined') {\n let thumbSize = 10\n let thumbColor = THEME.colors.divider\n let trackColor = THEME.colors.background.secondary\n css({\n \"@global\": {\n \"*\": {\n scrollbarWidth: \"thin\",\n scrollbarColor: `${thumbColor} ${trackColor}`,\n },\n \"::-webkit-scrollbar\": {\n width: thumbSize,\n height: thumbSize,\n },\n \"::-webkit-scrollbar-thumb\": {\n backgroundColor: thumbColor,\n borderRadius: \"5px\",\n border: \"2px solid #f4f4f4\",\n },\n \"::-webkit-scrollbar-thumb:hover\": {\n backgroundColor: thumbColor,\n },\n \"::-webkit-scrollbar-track\": {\n backgroundColor: trackColor,\n borderRadius: \"5px\",\n },\n }\n })\n }\n\n resetCss && 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 }, [theme])\n\n React.useMemo(() => {\n providers.push(id)\n }, [])\n\n React.useEffect(() => {\n return () => {\n providers.splice(providers.indexOf(id), 1)\n }\n }, [])\n\n const isRoot = id === providers[0]\n\n let content = (\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 )\n\n return (\n <ThemeContex.Provider value={theme}>\n {\n isRoot ? <BreakpointProvider>\n {content}\n {renderIsRoot}\n </BreakpointProvider> : content\n }\n </ThemeContex.Provider>\n )\n}\n\n\nexport default ThemeProvider"],
4
+ "sourcesContent": ["import * as React from \"react\"\nimport { ThemeOptions } from \"./types\"\nimport Tag from \"../Tag\"\nimport { TagComponentType, TagProps } from \"../Tag/types\"\nimport { BreakpointProvider } from \"../breakpoint\"\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 resetCss?: boolean;\n scrollbarCss?: boolean;\n renderIsRoot?: React.ReactElement;\n}\n\nconst providers: string[] = []\n\nconst ThemeProvider = ({ children, theme, resetCss, scrollbarCss, renderIsRoot, ...props }: ThemeProviderProps) => {\n const id = React.useId()\n const THEME = ThemeFactory.get(theme) as ThemeOptions\n if (!THEME) throw new Error(`Invalid theme name provided: ${theme}`)\n resetCss ??= true\n scrollbarCss ??= true\n\n React.useMemo(() => {\n if (!!Object.keys(THEME.globalStyle).length) {\n css({\n \"@global\": THEME.globalStyle\n })\n }\n\n css({\n \"@global\": {\n [`.xui-${theme}-theme-root`]: ThemeCssVars(THEME)\n }\n })\n\n if (scrollbarCss && typeof document !== 'undefined') {\n let thumbSize = 10\n let thumbColor = THEME.colors.divider\n let trackColor = THEME.colors.background.secondary\n css({\n \"@global\": {\n \"*\": {\n scrollbarWidth: \"thin\",\n scrollbarColor: `${thumbColor} ${trackColor}`,\n },\n \"::-webkit-scrollbar\": {\n width: thumbSize,\n height: thumbSize,\n },\n \"::-webkit-scrollbar-thumb\": {\n backgroundColor: thumbColor,\n borderRadius: \"5px\",\n border: \"2px solid #f4f4f4\",\n },\n \"::-webkit-scrollbar-thumb:hover\": {\n backgroundColor: thumbColor,\n },\n \"::-webkit-scrollbar-track\": {\n backgroundColor: trackColor,\n borderRadius: \"5px\",\n },\n }\n })\n }\n\n resetCss && 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 }, [theme])\n\n React.useMemo(() => {\n providers.push(id)\n }, [])\n\n React.useEffect(() => {\n return () => {\n providers.splice(providers.indexOf(id), 1)\n }\n }, [])\n\n const isRoot = id === providers[0]\n\n let content = (\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 )\n\n return (\n <ThemeContex.Provider value={theme}>\n {\n isRoot ? <BreakpointProvider>\n {content}\n {renderIsRoot}\n </BreakpointProvider> : content\n }\n </ThemeContex.Provider>\n )\n}\n\n\nexport default ThemeProvider"],
5
5
  "mappings": "AAAA,YAAY,WAAW;AAEvB,OAAO,SAAS;AAEhB,SAAS,0BAA0B;AACnC,SAAS,aAAa,oBAAoB;AAC1C,OAAO,kBAAkB;AACzB,SAAS,WAAW;AASpB,MAAM,YAAsB,CAAC;AAE7B,MAAM,gBAAgB,CAAC,EAAE,UAAU,OAAO,UAAU,cAAc,cAAc,GAAG,MAAM,MAA0B;AAChH,QAAM,KAAK,MAAM,MAAM;AACvB,QAAM,QAAQ,aAAa,IAAI,KAAK;AACpC,MAAI,CAAC,MAAO,OAAM,IAAI,MAAM,gCAAgC,KAAK,EAAE;AACnE,eAAa;AACb,mBAAiB;AAEjB,QAAM,QAAQ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