@xanui/core 1.1.13 → 1.1.14
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/package.json +1 -1
- package/theme/ThemeProvider.js +4 -1
- package/theme/ThemeProvider.js.map +1 -1
- package/theme/ThemeProvider.mjs +4 -1
- package/theme/ThemeProvider.mjs.map +1 -1
- package/useScrollbar.d.ts +10 -1
- package/useScrollbar.js +4 -4
- package/useScrollbar.js.map +1 -1
- package/useScrollbar.mjs +4 -4
- package/useScrollbar.mjs.map +1 -1
package/package.json
CHANGED
package/theme/ThemeProvider.js
CHANGED
|
@@ -16,7 +16,10 @@ const ThemeProvider = (_a) => {
|
|
|
16
16
|
index.css({
|
|
17
17
|
"@global": Object.assign(Object.assign({}, gstyles), { [root_cls]: ThemeCssVars.default(THEME) })
|
|
18
18
|
});
|
|
19
|
-
applyScrollbarCss && useScrollbar.default(
|
|
19
|
+
applyScrollbarCss && useScrollbar.default({
|
|
20
|
+
themeName: theme,
|
|
21
|
+
root_cls: root_cls
|
|
22
|
+
});
|
|
20
23
|
index.css({
|
|
21
24
|
"@global": {
|
|
22
25
|
"*": {
|
|
@@ -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 { BreakpointProvider } from \"../breakpoint\"\nimport { ThemeContex, ThemeFactory } from \"./core\"\nimport ThemeCssVars from \"./ThemeCssVars\"\nimport { css } from \"../css\"\nimport useScrollbar from \"../useScrollbar\"\nimport { createTheme } from \"./createTheme\"\nimport { darkColorPallete, lightColorPallete } from \"./ThemeDefaultOptions\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n applyScrollbarCss?: boolean;\n isRootProvider?: boolean;\n renderIsRoot?: React.ReactElement;\n}\n\ncreateTheme(\"light\", { colors: lightColorPallete })\ncreateTheme(\"dark\", { colors: darkColorPallete })\n\nconst ThemeProvider = <T extends TagComponentType = 'div'>({ children, theme, applyScrollbarCss, isRootProvider, renderIsRoot, ...props }: ThemeProviderProps<T>) => {\n\n const THEME = ThemeFactory.get(theme) as ThemeOptions\n if (!THEME) throw new Error(`Invalid theme name provided: ${theme}`)\n applyScrollbarCss ??= true\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\n applyScrollbarCss && useScrollbar(theme
|
|
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 { BreakpointProvider } from \"../breakpoint\"\nimport { ThemeContex, ThemeFactory } from \"./core\"\nimport ThemeCssVars from \"./ThemeCssVars\"\nimport { css } from \"../css\"\nimport useScrollbar from \"../useScrollbar\"\nimport { createTheme } from \"./createTheme\"\nimport { darkColorPallete, lightColorPallete } from \"./ThemeDefaultOptions\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n applyScrollbarCss?: boolean;\n isRootProvider?: boolean;\n renderIsRoot?: React.ReactElement;\n}\n\ncreateTheme(\"light\", { colors: lightColorPallete })\ncreateTheme(\"dark\", { colors: darkColorPallete })\n\nconst ThemeProvider = <T extends TagComponentType = 'div'>({ children, theme, applyScrollbarCss, isRootProvider, renderIsRoot, ...props }: ThemeProviderProps<T>) => {\n\n const THEME = ThemeFactory.get(theme) as ThemeOptions\n if (!THEME) throw new Error(`Invalid theme name provided: ${theme}`)\n applyScrollbarCss ??= true\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\n applyScrollbarCss && useScrollbar({\n themeName: theme,\n root_cls: root_cls\n })\n\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 }, [theme])\n\n return (\n <ThemeContex.Provider value={theme}>\n {\n isRootProvider ? <BreakpointProvider>\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 {renderIsRoot}\n </Tag>\n </BreakpointProvider> : <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 </ThemeContex.Provider>\n )\n}\n\nexport default ThemeProvider"],"names":["createTheme","lightColorPallete","darkColorPallete","__rest","ThemeFactory","React","css","ThemeCssVars","useScrollbar","_jsx","ThemeContex","BreakpointProvider","_jsxs","Tag"],"mappings":"q1BAmBAA,uBAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAEC,qCAAiB,EAAE,CAAC;AACnDD,uBAAW,CAAC,MAAM,EAAE,EAAE,MAAM,EAAEE,oCAAgB,EAAE,CAAC;AAEjD,MAAM,aAAa,GAAG,CAAqC,EAAqG,KAAI;AAAzG,IAAA,IAAA,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,YAAY,EAAA,GAAA,EAAmC,EAA9B,KAAK,GAAAC,YAAA,CAAA,EAAA,EAA5E,4EAA8E,CAAF;IAEpI,MAAM,KAAK,GAAGC,iBAAY,CAAC,GAAG,CAAC,KAAK,CAAiB;AACrD,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,CAAA,CAAE,CAAC;IACpE,iBAAiB,KAAA,IAAA,IAAjB,iBAAiB,KAAA,MAAA,GAAjB,iBAAiB,IAAjB,iBAAiB,GAAK,IAAI,CAAA;AAE1B,IAAAC,gBAAK,CAAC,OAAO,CAAC,MAAK;AAChB,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,W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ider.mjs
CHANGED
|
@@ -16,7 +16,10 @@ const ThemeProvider = (_a) => {
|
|
|
16
16
|
css({
|
|
17
17
|
"@global": Object.assign(Object.assign({}, gstyles), { [root_cls]: ThemeCssVars(THEME) })
|
|
18
18
|
});
|
|
19
|
-
applyScrollbarCss && useScrollbar(
|
|
19
|
+
applyScrollbarCss && useScrollbar({
|
|
20
|
+
themeName: theme,
|
|
21
|
+
root_cls: root_cls
|
|
22
|
+
});
|
|
20
23
|
css({
|
|
21
24
|
"@global": {
|
|
22
25
|
"*": {
|
|
@@ -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 { BreakpointProvider } from \"../breakpoint\"\nimport { ThemeContex, ThemeFactory } from \"./core\"\nimport ThemeCssVars from \"./ThemeCssVars\"\nimport { css } from \"../css\"\nimport useScrollbar from \"../useScrollbar\"\nimport { createTheme } from \"./createTheme\"\nimport { darkColorPallete, lightColorPallete } from \"./ThemeDefaultOptions\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n applyScrollbarCss?: boolean;\n isRootProvider?: boolean;\n renderIsRoot?: React.ReactElement;\n}\n\ncreateTheme(\"light\", { colors: lightColorPallete })\ncreateTheme(\"dark\", { colors: darkColorPallete })\n\nconst ThemeProvider = <T extends TagComponentType = 'div'>({ children, theme, applyScrollbarCss, isRootProvider, renderIsRoot, ...props }: ThemeProviderProps<T>) => {\n\n const THEME = ThemeFactory.get(theme) as ThemeOptions\n if (!THEME) throw new Error(`Invalid theme name provided: ${theme}`)\n applyScrollbarCss ??= true\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\n applyScrollbarCss && useScrollbar(theme
|
|
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 { BreakpointProvider } from \"../breakpoint\"\nimport { ThemeContex, ThemeFactory } from \"./core\"\nimport ThemeCssVars from \"./ThemeCssVars\"\nimport { css } from \"../css\"\nimport useScrollbar from \"../useScrollbar\"\nimport { createTheme } from \"./createTheme\"\nimport { darkColorPallete, lightColorPallete } from \"./ThemeDefaultOptions\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n applyScrollbarCss?: boolean;\n isRootProvider?: boolean;\n renderIsRoot?: React.ReactElement;\n}\n\ncreateTheme(\"light\", { colors: lightColorPallete })\ncreateTheme(\"dark\", { colors: darkColorPallete })\n\nconst ThemeProvider = <T extends TagComponentType = 'div'>({ children, theme, applyScrollbarCss, isRootProvider, renderIsRoot, ...props }: ThemeProviderProps<T>) => {\n\n const THEME = ThemeFactory.get(theme) as ThemeOptions\n if (!THEME) throw new Error(`Invalid theme name provided: ${theme}`)\n applyScrollbarCss ??= true\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\n applyScrollbarCss && useScrollbar({\n themeName: theme,\n root_cls: root_cls\n })\n\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 }, [theme])\n\n return (\n <ThemeContex.Provider value={theme}>\n {\n isRootProvider ? <BreakpointProvider>\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 {renderIsRoot}\n </Tag>\n </BreakpointProvider> : <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 </ThemeContex.Provider>\n )\n}\n\nexport default ThemeProvider"],"names":["_jsx","_jsxs"],"mappings":"+eAmBA,WAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;AACnD,WAAW,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;AAEjD,MAAM,aAAa,GAAG,CAAqC,EAAqG,KAAI;AAAzG,IAAA,IAAA,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,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,IACT,SAAS,EAAE,GAAG,KAAK,CAAA,WAAA,CAAa,EAChC,SAAS,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,GAAG,KAAK,aAEnC,QAAQ,EACR,YAAY,CAAA,EAAA,CAAA,CACV,EAAA,CACY,GAAGD,IAAC,GAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EACzB,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,EACxC,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,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,CAEW;AAE7B"}
|
package/useScrollbar.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
type UseScrollbarOption = {
|
|
2
|
+
themeName: string;
|
|
3
|
+
root_cls?: string;
|
|
4
|
+
thumbSize?: number;
|
|
5
|
+
thumbColor?: string;
|
|
6
|
+
trackColor?: string;
|
|
7
|
+
};
|
|
8
|
+
type ClassName = string;
|
|
9
|
+
declare const useScrollbar: ({ themeName, root_cls, thumbSize, thumbColor, trackColor }: UseScrollbarOption) => ClassName;
|
|
2
10
|
|
|
3
11
|
export { useScrollbar as default };
|
|
12
|
+
export type { UseScrollbarOption };
|
package/useScrollbar.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});require('./theme/ThemeDefaultOptions.js');var core=require('./theme/core.js'),index=require('./css/index.js');require('./theme/ThemeProvider.js'),require('react-state-bucket');const useScrollbar = (themeName, root_cls) => {
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});require('./theme/ThemeDefaultOptions.js');var core=require('./theme/core.js'),index=require('./css/index.js');require('./theme/ThemeProvider.js'),require('react-state-bucket');const useScrollbar = ({ themeName, root_cls, thumbSize, thumbColor, trackColor }) => {
|
|
2
2
|
const theme = core.getTheme(themeName);
|
|
3
3
|
if (!theme)
|
|
4
4
|
throw new Error(`theme "${themeName}" not found for ScrollbarCss`);
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
thumbSize = thumbSize || 10;
|
|
6
|
+
thumbColor = thumbColor || theme.colors.text.secondary;
|
|
7
|
+
trackColor = trackColor || theme.colors.divider;
|
|
8
8
|
root_cls = root_cls || "";
|
|
9
9
|
let clss = {
|
|
10
10
|
"*": root_cls ? `${root_cls} *` : `*`,
|
package/useScrollbar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollbar.js","sources":["../src/useScrollbar.ts"],"sourcesContent":["import { getTheme } from './theme'\nimport { css } from './css'\n\nconst useScrollbar = (themeName
|
|
1
|
+
{"version":3,"file":"useScrollbar.js","sources":["../src/useScrollbar.ts"],"sourcesContent":["import { getTheme } from './theme'\nimport { css } from './css'\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 const theme = getTheme(themeName)\n if (!theme) throw new Error(`theme \"${themeName}\" not found for ScrollbarCss`);\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":"sPAaA,MAAM,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAsB,KAAe;AAChH,IAAA,MAAM,KAAK,GAAGA,aAAQ,CAAC,SAAS,CAAC;AACjC,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,UAAU,SAAS,CAAA,4BAAA,CAA8B,CAAC;AAE9E,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,O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C,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"}
|
package/useScrollbar.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import'./theme/ThemeDefaultOptions.mjs';import {getTheme}from'./theme/core.mjs';import {css}from'./css/index.mjs';import'./theme/ThemeProvider.mjs';import'react-state-bucket';const useScrollbar = (themeName, root_cls) => {
|
|
1
|
+
import'./theme/ThemeDefaultOptions.mjs';import {getTheme}from'./theme/core.mjs';import {css}from'./css/index.mjs';import'./theme/ThemeProvider.mjs';import'react-state-bucket';const useScrollbar = ({ themeName, root_cls, thumbSize, thumbColor, trackColor }) => {
|
|
2
2
|
const theme = getTheme(themeName);
|
|
3
3
|
if (!theme)
|
|
4
4
|
throw new Error(`theme "${themeName}" not found for ScrollbarCss`);
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
thumbSize = thumbSize || 10;
|
|
6
|
+
thumbColor = thumbColor || theme.colors.text.secondary;
|
|
7
|
+
trackColor = trackColor || theme.colors.divider;
|
|
8
8
|
root_cls = root_cls || "";
|
|
9
9
|
let clss = {
|
|
10
10
|
"*": root_cls ? `${root_cls} *` : `*`,
|
package/useScrollbar.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollbar.mjs","sources":["../src/useScrollbar.ts"],"sourcesContent":["import { getTheme } from './theme'\nimport { css } from './css'\n\nconst useScrollbar = (themeName
|
|
1
|
+
{"version":3,"file":"useScrollbar.mjs","sources":["../src/useScrollbar.ts"],"sourcesContent":["import { getTheme } from './theme'\nimport { css } from './css'\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 const theme = getTheme(themeName)\n if (!theme) throw new Error(`theme \"${themeName}\" not found for ScrollbarCss`);\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":"+KAaA,MAAM,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAsB,KAAe;AAChH,IAAA,MAAM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