@xanui/core 1.2.17 → 1.2.19
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/css/getProps.js +7 -17
- package/css/getProps.js.map +1 -1
- package/css/getProps.mjs +7 -17
- package/css/getProps.mjs.map +1 -1
- package/package.json +2 -2
- package/theme/ThemeProvider.js +2 -2
- package/theme/ThemeProvider.js.map +1 -1
- package/theme/ThemeProvider.mjs +2 -2
- package/theme/ThemeProvider.mjs.map +1 -1
package/css/getProps.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use strict';Object.defineProperty(exports,'__esModule',{value:true});const getProps = (prop, value, _css) => {
|
|
2
|
-
let important;
|
|
3
2
|
if (typeof value === 'string') {
|
|
4
3
|
const split = value.split("!");
|
|
5
|
-
|
|
4
|
+
split[1] ? "!important" : "";
|
|
6
5
|
value = split[0];
|
|
7
6
|
}
|
|
8
7
|
if (prop === 'disabled') {
|
|
@@ -24,22 +23,13 @@
|
|
|
24
23
|
}
|
|
25
24
|
if (prop === "spacing" && typeof value === "number") {
|
|
26
25
|
const val = value * 8;
|
|
27
|
-
const isFlex = (_css === null || _css === void 0 ? void 0 : _css.flexBox) ||
|
|
28
|
-
(_css === null || _css === void 0 ? void 0 : _css.flexRow) ||
|
|
29
|
-
(_css === null || _css === void 0 ? void 0 : _css.flexColumn) ||
|
|
30
|
-
(_css === null || _css === void 0 ? void 0 : _css.display) === "flex";
|
|
31
|
-
if (isFlex) {
|
|
32
|
-
const isColumn = (_css === null || _css === void 0 ? void 0 : _css.flexColumn) === true;
|
|
33
|
-
return Object.assign(Object.assign({}, (isColumn
|
|
34
|
-
? { marginTop: `-${val}px${important || ""}` }
|
|
35
|
-
: { marginLeft: `-${val}px${important || ""}` })), { "& > *": isColumn
|
|
36
|
-
? { marginTop: `${val}px${important || ""}` }
|
|
37
|
-
: { marginLeft: `${val}px${important || ""}` } });
|
|
38
|
-
}
|
|
39
|
-
// non-flex fallback (safe & predictable)
|
|
40
26
|
return {
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
marginLeft: `-${val}px`,
|
|
28
|
+
marginTop: `-${val}px`,
|
|
29
|
+
width: `calc(100% + ${val}px)`,
|
|
30
|
+
"& > *": {
|
|
31
|
+
paddingLeft: `${val}px`,
|
|
32
|
+
paddingTop: `${val}px`,
|
|
43
33
|
},
|
|
44
34
|
};
|
|
45
35
|
}
|
package/css/getProps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProps.js","sources":["../../src/css/getProps.ts"],"sourcesContent":["import { CSSProps } from \"./types\";\n\nconst getProps = (prop: string, value: string, _css: CSSProps) => {\n let important;\n if (typeof value === 'string') {\n const split = value.split(\"!\")\n important = split[1] ? \"!important\" : \"\"\n value = split[0]\n }\n\n if (prop === 'disabled') {\n if ((value as any) === true) {\n let c: any = {\n pointerEvents: \"none!important\",\n cursor: \"default!important\",\n userSelect: \"none!important\",\n opacity: \"0.5!important\",\n color: `text.primary!important`,\n borderColor: `divider.secondary!important`,\n }\n\n if ((_css as any).bgcolor && (_css as any).bgcolor !== 'transparent') {\n c.bgcolor = `divider.primary!important`\n }\n return c\n }\n return {}\n }\n\n\n if (prop === \"spacing\" && typeof value === \"number\") {\n const val = value * 8;\n
|
|
1
|
+
{"version":3,"file":"getProps.js","sources":["../../src/css/getProps.ts"],"sourcesContent":["import { CSSProps } from \"./types\";\n\nconst getProps = (prop: string, value: string, _css: CSSProps) => {\n let important;\n if (typeof value === 'string') {\n const split = value.split(\"!\")\n important = split[1] ? \"!important\" : \"\"\n value = split[0]\n }\n\n if (prop === 'disabled') {\n if ((value as any) === true) {\n let c: any = {\n pointerEvents: \"none!important\",\n cursor: \"default!important\",\n userSelect: \"none!important\",\n opacity: \"0.5!important\",\n color: `text.primary!important`,\n borderColor: `divider.secondary!important`,\n }\n\n if ((_css as any).bgcolor && (_css as any).bgcolor !== 'transparent') {\n c.bgcolor = `divider.primary!important`\n }\n return c\n }\n return {}\n }\n\n\n if (prop === \"spacing\" && typeof value === \"number\") {\n const val = value * 8;\n\n return {\n marginLeft: `-${val}px`,\n marginTop: `-${val}px`,\n width: `calc(100% + ${val}px)`,\n\n \"& > *\": {\n paddingLeft: `${val}px`,\n paddingTop: `${val}px`,\n },\n } as any;\n }\n\n\n\n // if (value && typeof value === \"number\" && [\"border\", \"borderRight\", \"borderLeft\", \"borderTop\", \"borderBottom\"].includes(prop as any)) {\n // const keys: any = Object.keys(_css)\n // let p: any = {\n // [`${prop}Width`]: value + 'px' + (important || \"\"),\n // }\n // // if (!keys.includes(`${prop}Color`)) {\n // // p[`${prop}Color`] = \"divider.primary\"\n // // }\n // if (!keys.includes(`${prop}Style`)) {\n // p[`${prop}Style`] = \"solid\"\n // }\n // return p\n // }\n}\n\nexport default getProps"],"names":[],"mappings":"sEAEA,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,IAAc,KAAI;AAE7D,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;AAC9B,QAAY,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,EAAE;AACxC,QAAA,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;IACpB;AAEA,IAAA,IAAI,IAAI,KAAK,UAAU,EAAE;AACrB,QAAA,IAAK,KAAa,KAAK,IAAI,EAAE;AACzB,YAAA,IAAI,CAAC,GAAQ;AACT,gBAAA,aAAa,EAAE,gBAAgB;AAC/B,gBAAA,MAAM,EAAE,mBAAmB;AAC3B,gBAAA,UAAU,EAAE,gBAAgB;AAC5B,gBAAA,OAAO,EAAE,eAAe;AACxB,gBAAA,KAAK,EAAE,CAAA,sBAAA,CAAwB;AAC/B,gBAAA,WAAW,EAAE,CAAA,2BAAA,CAA6B;aAC7C;YAED,IAAK,IAAY,CAAC,OAAO,IAAK,IAAY,CAAC,OAAO,KAAK,aAAa,EAAE;AAClE,gBAAA,CAAC,CAAC,OAAO,GAAG,CAAA,yBAAA,CAA2B;YAC3C;AACA,YAAA,OAAO,CAAC;QACZ;AACA,QAAA,OAAO,EAAE;IACb;IAGA,IAAI,IAAI,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACjD,QAAA,MAAM,GAAG,GAAG,KAAK,GAAG,CAAC;QAErB,OAAO;YACH,UAAU,EAAE,CAAA,CAAA,EAAI,GAAG,CAAA,EAAA,CAAI;YACvB,SAAS,EAAE,CAAA,CAAA,EAAI,GAAG,CAAA,EAAA,CAAI;YACtB,KAAK,EAAE,CAAA,YAAA,EAAe,GAAG,CAAA,GAAA,CAAK;AAE9B,YAAA,OAAO,EAAE;gBACL,WAAW,EAAE,CAAA,EAAG,GAAG,CAAA,EAAA,CAAI;gBACvB,UAAU,EAAE,CAAA,EAAG,GAAG,CAAA,EAAA,CAAI;AACzB,aAAA;SACG;IACZ;;;;;;;;;;;;;;AAiBJ"}
|
package/css/getProps.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const getProps = (prop, value, _css) => {
|
|
2
|
-
let important;
|
|
3
2
|
if (typeof value === 'string') {
|
|
4
3
|
const split = value.split("!");
|
|
5
|
-
|
|
4
|
+
split[1] ? "!important" : "";
|
|
6
5
|
value = split[0];
|
|
7
6
|
}
|
|
8
7
|
if (prop === 'disabled') {
|
|
@@ -24,22 +23,13 @@ const getProps = (prop, value, _css) => {
|
|
|
24
23
|
}
|
|
25
24
|
if (prop === "spacing" && typeof value === "number") {
|
|
26
25
|
const val = value * 8;
|
|
27
|
-
const isFlex = (_css === null || _css === void 0 ? void 0 : _css.flexBox) ||
|
|
28
|
-
(_css === null || _css === void 0 ? void 0 : _css.flexRow) ||
|
|
29
|
-
(_css === null || _css === void 0 ? void 0 : _css.flexColumn) ||
|
|
30
|
-
(_css === null || _css === void 0 ? void 0 : _css.display) === "flex";
|
|
31
|
-
if (isFlex) {
|
|
32
|
-
const isColumn = (_css === null || _css === void 0 ? void 0 : _css.flexColumn) === true;
|
|
33
|
-
return Object.assign(Object.assign({}, (isColumn
|
|
34
|
-
? { marginTop: `-${val}px${important || ""}` }
|
|
35
|
-
: { marginLeft: `-${val}px${important || ""}` })), { "& > *": isColumn
|
|
36
|
-
? { marginTop: `${val}px${important || ""}` }
|
|
37
|
-
: { marginLeft: `${val}px${important || ""}` } });
|
|
38
|
-
}
|
|
39
|
-
// non-flex fallback (safe & predictable)
|
|
40
26
|
return {
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
marginLeft: `-${val}px`,
|
|
28
|
+
marginTop: `-${val}px`,
|
|
29
|
+
width: `calc(100% + ${val}px)`,
|
|
30
|
+
"& > *": {
|
|
31
|
+
paddingLeft: `${val}px`,
|
|
32
|
+
paddingTop: `${val}px`,
|
|
43
33
|
},
|
|
44
34
|
};
|
|
45
35
|
}
|
package/css/getProps.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProps.mjs","sources":["../../src/css/getProps.ts"],"sourcesContent":["import { CSSProps } from \"./types\";\n\nconst getProps = (prop: string, value: string, _css: CSSProps) => {\n let important;\n if (typeof value === 'string') {\n const split = value.split(\"!\")\n important = split[1] ? \"!important\" : \"\"\n value = split[0]\n }\n\n if (prop === 'disabled') {\n if ((value as any) === true) {\n let c: any = {\n pointerEvents: \"none!important\",\n cursor: \"default!important\",\n userSelect: \"none!important\",\n opacity: \"0.5!important\",\n color: `text.primary!important`,\n borderColor: `divider.secondary!important`,\n }\n\n if ((_css as any).bgcolor && (_css as any).bgcolor !== 'transparent') {\n c.bgcolor = `divider.primary!important`\n }\n return c\n }\n return {}\n }\n\n\n if (prop === \"spacing\" && typeof value === \"number\") {\n const val = value * 8;\n
|
|
1
|
+
{"version":3,"file":"getProps.mjs","sources":["../../src/css/getProps.ts"],"sourcesContent":["import { CSSProps } from \"./types\";\n\nconst getProps = (prop: string, value: string, _css: CSSProps) => {\n let important;\n if (typeof value === 'string') {\n const split = value.split(\"!\")\n important = split[1] ? \"!important\" : \"\"\n value = split[0]\n }\n\n if (prop === 'disabled') {\n if ((value as any) === true) {\n let c: any = {\n pointerEvents: \"none!important\",\n cursor: \"default!important\",\n userSelect: \"none!important\",\n opacity: \"0.5!important\",\n color: `text.primary!important`,\n borderColor: `divider.secondary!important`,\n }\n\n if ((_css as any).bgcolor && (_css as any).bgcolor !== 'transparent') {\n c.bgcolor = `divider.primary!important`\n }\n return c\n }\n return {}\n }\n\n\n if (prop === \"spacing\" && typeof value === \"number\") {\n const val = value * 8;\n\n return {\n marginLeft: `-${val}px`,\n marginTop: `-${val}px`,\n width: `calc(100% + ${val}px)`,\n\n \"& > *\": {\n paddingLeft: `${val}px`,\n paddingTop: `${val}px`,\n },\n } as any;\n }\n\n\n\n // if (value && typeof value === \"number\" && [\"border\", \"borderRight\", \"borderLeft\", \"borderTop\", \"borderBottom\"].includes(prop as any)) {\n // const keys: any = Object.keys(_css)\n // let p: any = {\n // [`${prop}Width`]: value + 'px' + (important || \"\"),\n // }\n // // if (!keys.includes(`${prop}Color`)) {\n // // p[`${prop}Color`] = \"divider.primary\"\n // // }\n // if (!keys.includes(`${prop}Style`)) {\n // p[`${prop}Style`] = \"solid\"\n // }\n // return p\n // }\n}\n\nexport default getProps"],"names":[],"mappings":"AAEA,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,IAAc,KAAI;AAE7D,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;AAC9B,QAAY,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,EAAE;AACxC,QAAA,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;IACpB;AAEA,IAAA,IAAI,IAAI,KAAK,UAAU,EAAE;AACrB,QAAA,IAAK,KAAa,KAAK,IAAI,EAAE;AACzB,YAAA,IAAI,CAAC,GAAQ;AACT,gBAAA,aAAa,EAAE,gBAAgB;AAC/B,gBAAA,MAAM,EAAE,mBAAmB;AAC3B,gBAAA,UAAU,EAAE,gBAAgB;AAC5B,gBAAA,OAAO,EAAE,eAAe;AACxB,gBAAA,KAAK,EAAE,CAAA,sBAAA,CAAwB;AAC/B,gBAAA,WAAW,EAAE,CAAA,2BAAA,CAA6B;aAC7C;YAED,IAAK,IAAY,CAAC,OAAO,IAAK,IAAY,CAAC,OAAO,KAAK,aAAa,EAAE;AAClE,gBAAA,CAAC,CAAC,OAAO,GAAG,CAAA,yBAAA,CAA2B;YAC3C;AACA,YAAA,OAAO,CAAC;QACZ;AACA,QAAA,OAAO,EAAE;IACb;IAGA,IAAI,IAAI,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACjD,QAAA,MAAM,GAAG,GAAG,KAAK,GAAG,CAAC;QAErB,OAAO;YACH,UAAU,EAAE,CAAA,CAAA,EAAI,GAAG,CAAA,EAAA,CAAI;YACvB,SAAS,EAAE,CAAA,CAAA,EAAI,GAAG,CAAA,EAAA,CAAI;YACtB,KAAK,EAAE,CAAA,YAAA,EAAe,GAAG,CAAA,GAAA,CAAK;AAE9B,YAAA,OAAO,EAAE;gBACL,WAAW,EAAE,CAAA,EAAG,GAAG,CAAA,EAAA,CAAI;gBACvB,UAAU,EAAE,CAAA,EAAG,GAAG,CAAA,EAAA,CAAI;AACzB,aAAA;SACG;IACZ;;;;;;;;;;;;;;AAiBJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xanui/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"oncss": "^1.2.4",
|
|
12
12
|
"pretty-class": "^1.0.8",
|
|
13
|
-
"react-state-bucket": "^1.2.
|
|
13
|
+
"react-state-bucket": "^1.2.6"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/react": "^19.2.7",
|
package/theme/ThemeProvider.js
CHANGED
|
@@ -19,9 +19,9 @@ const ThemeProvider = (_a) => {
|
|
|
19
19
|
injectStyle: typeof window !== 'undefined'
|
|
20
20
|
});
|
|
21
21
|
}, [theme]);
|
|
22
|
-
return (jsxRuntime.jsxs(core.ThemeContex.Provider, { value: theme, children: [jsxRuntime.jsx(ServerStyleTag.default, { factory: globalStyle }), jsxRuntime.jsx(index$1.default, Object.assign({ minHeight: "100%", bgcolor:
|
|
22
|
+
return (jsxRuntime.jsxs(core.ThemeContex.Provider, { value: theme, children: [jsxRuntime.jsx(ServerStyleTag.default, { factory: globalStyle }), jsxRuntime.jsx(index$1.default, Object.assign({ minHeight: "100%", bgcolor: "background.primary", color: "text.primary", fontSize: "text", fontWeight: "text", lineHeight: "text", fontFamily: `system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif` }, props, { sxr: {
|
|
23
23
|
"& a": {
|
|
24
|
-
color:
|
|
24
|
+
color: "brand.primary",
|
|
25
25
|
},
|
|
26
26
|
}, baseClass: `${theme}-theme-root`, direction: THEME.rtl ? "rtl" : "ltr", children: children }))] }));
|
|
27
27
|
};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\"\nimport { createDefaultThemes } from \"./ThemeDefaultOptions\"\nimport ServerStyleTag from \"../Tag/ServerStyleTag\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n}\n\ncreateDefaultThemes()\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 <ServerStyleTag factory={globalStyle} />\n <Tag\n minHeight=\"100%\"\n bgcolor
|
|
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\"\nimport { createDefaultThemes } from \"./ThemeDefaultOptions\"\nimport ServerStyleTag from \"../Tag/ServerStyleTag\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n}\n\ncreateDefaultThemes()\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 <ServerStyleTag factory={globalStyle} />\n <Tag\n minHeight=\"100%\"\n bgcolor=\"background.primary\"\n color=\"text.primary\"\n fontSize=\"text\"\n fontWeight=\"text\"\n lineHeight=\"text\"\n fontFamily={`system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif`}\n {...props}\n sxr={{\n \"& a\": {\n color: \"brand.primary\",\n },\n }}\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":["createDefaultThemes","__rest","ThemeFactory","React","css","ThemeCssVars","_jsxs","ThemeContex","_jsx","ServerStyleTag","Tag"],"mappings":"mvBAcAA,uCAAmB,EAAE;AAErB,MAAM,aAAa,GAAG,CAAqC,EAAoD,KAAI;QAAxD,EAAE,QAAQ,EAAE,KAAK,EAAA,GAAA,EAAmC,EAA9B,KAAK,GAAAC,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,IAAA,MAAM,WAAW,GAAQC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AE,CAAA,EAAG,KAAK,CAAA,WAAA,CAAa,EAChC,SAAS,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,GAAG,KAAK,YAEnC,QAAQ,EAAA,CAAA,CACN,CAAA,EAAA,CACc;AAE7B"}
|
package/theme/ThemeProvider.mjs
CHANGED
|
@@ -19,9 +19,9 @@ const ThemeProvider = (_a) => {
|
|
|
19
19
|
injectStyle: typeof window !== 'undefined'
|
|
20
20
|
});
|
|
21
21
|
}, [theme]);
|
|
22
|
-
return (jsxs(ThemeContex.Provider, { value: theme, children: [jsx(ServerStyleTag, { factory: globalStyle }), jsx(Tag, Object.assign({ minHeight: "100%", bgcolor:
|
|
22
|
+
return (jsxs(ThemeContex.Provider, { value: theme, children: [jsx(ServerStyleTag, { factory: globalStyle }), jsx(Tag, Object.assign({ minHeight: "100%", bgcolor: "background.primary", color: "text.primary", fontSize: "text", fontWeight: "text", lineHeight: "text", fontFamily: `system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif` }, props, { sxr: {
|
|
23
23
|
"& a": {
|
|
24
|
-
color:
|
|
24
|
+
color: "brand.primary",
|
|
25
25
|
},
|
|
26
26
|
}, baseClass: `${theme}-theme-root`, direction: THEME.rtl ? "rtl" : "ltr", children: children }))] }));
|
|
27
27
|
};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\"\nimport { createDefaultThemes } from \"./ThemeDefaultOptions\"\nimport ServerStyleTag from \"../Tag/ServerStyleTag\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n}\n\ncreateDefaultThemes()\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 <ServerStyleTag factory={globalStyle} />\n <Tag\n minHeight=\"100%\"\n bgcolor
|
|
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\"\nimport { createDefaultThemes } from \"./ThemeDefaultOptions\"\nimport ServerStyleTag from \"../Tag/ServerStyleTag\"\n\nexport type ThemeProviderProps<T extends TagComponentType = 'div'> = TagProps<T> & {\n theme: string;\n}\n\ncreateDefaultThemes()\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 <ServerStyleTag factory={globalStyle} />\n <Tag\n minHeight=\"100%\"\n bgcolor=\"background.primary\"\n color=\"text.primary\"\n fontSize=\"text\"\n fontWeight=\"text\"\n lineHeight=\"text\"\n fontFamily={`system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif`}\n {...props}\n sxr={{\n \"& a\": {\n color: \"brand.primary\",\n },\n }}\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":"sXAcA,mBAAmB,EAAE;AAErB,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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