@xanui/core 1.0.0
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/ServerStyleTags.d.ts +3 -0
- package/ServerStyleTags.js +17 -0
- package/ServerStyleTags.js.map +7 -0
- package/Tag/cssPropList.d.ts +2 -0
- package/Tag/cssPropList.js +190 -0
- package/Tag/cssPropList.js.map +7 -0
- package/Tag/index.d.ts +6 -0
- package/Tag/index.js +12 -0
- package/Tag/index.js.map +7 -0
- package/Tag/types.d.ts +179 -0
- package/Tag/types.js +1 -0
- package/Tag/types.js.map +7 -0
- package/Tag/useTagProps.d.ts +3 -0
- package/Tag/useTagProps.js +27 -0
- package/Tag/useTagProps.js.map +7 -0
- package/Transition/index.d.ts +31 -0
- package/Transition/index.js +101 -0
- package/Transition/index.js.map +7 -0
- package/Transition/variants.d.ts +131 -0
- package/Transition/variants.js +175 -0
- package/Transition/variants.js.map +7 -0
- package/breakpoint/index.d.ts +6 -0
- package/breakpoint/index.js +46 -0
- package/breakpoint/index.js.map +7 -0
- package/breakpoint/useBreakpoint.d.ts +10 -0
- package/breakpoint/useBreakpoint.js +32 -0
- package/breakpoint/useBreakpoint.js.map +7 -0
- package/breakpoint/useBreakpointProps.d.ts +6 -0
- package/breakpoint/useBreakpointProps.js +48 -0
- package/breakpoint/useBreakpointProps.js.map +7 -0
- package/css/aliases.d.ts +4 -0
- package/css/aliases.js +34 -0
- package/css/aliases.js.map +7 -0
- package/css/getProps.d.ts +3 -0
- package/css/getProps.js +37 -0
- package/css/getProps.js.map +7 -0
- package/css/getValue.d.ts +3 -0
- package/css/getValue.js +108 -0
- package/css/getValue.js.map +7 -0
- package/css/index.d.ts +15 -0
- package/css/index.js +70 -0
- package/css/index.js.map +7 -0
- package/css/types.d.ts +54 -0
- package/css/types.js +1 -0
- package/css/types.js.map +7 -0
- package/index.d.ts +21 -0
- package/index.js +30 -0
- package/index.js.map +7 -0
- package/isWindow.d.ts +2 -0
- package/isWindow.js +6 -0
- package/isWindow.js.map +7 -0
- package/package.json +28 -0
- package/readme.md +0 -0
- package/theme/ThemeCssVars.d.ts +3 -0
- package/theme/ThemeCssVars.js +92 -0
- package/theme/ThemeCssVars.js.map +7 -0
- package/theme/ThemeDefaultOptions.d.ts +68 -0
- package/theme/ThemeDefaultOptions.js +148 -0
- package/theme/ThemeDefaultOptions.js.map +7 -0
- package/theme/ThemeProvider.d.ts +10 -0
- package/theme/ThemeProvider.js +120 -0
- package/theme/ThemeProvider.js.map +7 -0
- package/theme/core.d.ts +7 -0
- package/theme/core.js +26 -0
- package/theme/core.js.map +7 -0
- package/theme/createColor.d.ts +41 -0
- package/theme/createColor.js +52 -0
- package/theme/createColor.js.map +7 -0
- package/theme/createTheme.d.ts +2 -0
- package/theme/createTheme.js +33 -0
- package/theme/createTheme.js.map +7 -0
- package/theme/createThemeSwitcher.d.ts +6 -0
- package/theme/createThemeSwitcher.js +19 -0
- package/theme/createThemeSwitcher.js.map +7 -0
- package/theme/index.d.ts +4 -0
- package/theme/index.js +14 -0
- package/theme/index.js.map +7 -0
- package/theme/types.d.ts +124 -0
- package/theme/types.js +1 -0
- package/theme/types.js.map +7 -0
- package/useAnimation.d.ts +18 -0
- package/useAnimation.js +33 -0
- package/useAnimation.js.map +7 -0
- package/useColorTemplate.d.ts +4 -0
- package/useColorTemplate.js +11 -0
- package/useColorTemplate.js.map +7 -0
- package/useInterface.d.ts +2 -0
- package/useInterface.js +14 -0
- package/useInterface.js.map +7 -0
package/css/getValue.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
const getColor = (color) => {
|
|
2
|
+
return {
|
|
3
|
+
[`${color}`]: `var(--color-${color}-primary)`,
|
|
4
|
+
[`${color}.primary`]: `var(--color-${color}-primary)`,
|
|
5
|
+
[`${color}.secondary`]: `var(--color-${color}-secondary)`,
|
|
6
|
+
[`${color}.text`]: `var(--color-${color}-text)`,
|
|
7
|
+
[`${color}.alpha`]: `var(--color-${color}-alpha)`
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
const withImportant = (important, value) => important ? value + important : value;
|
|
11
|
+
const colors = {
|
|
12
|
+
"text": `var(--color-text-primary)`,
|
|
13
|
+
"text.primary": `var(--color-text-primary)`,
|
|
14
|
+
"text.secondary": `var(--color-text-secondary)`,
|
|
15
|
+
"background": `var(--color-background-primary)`,
|
|
16
|
+
"background.primary": `var(--color-background-primary)`,
|
|
17
|
+
"background.secondary": `var(--color-background-secondary)`,
|
|
18
|
+
"background.alpha": `var(--color-background-alpha)`,
|
|
19
|
+
"divider": `var(--color-divider)`,
|
|
20
|
+
...getColor("brand"),
|
|
21
|
+
...getColor("accent"),
|
|
22
|
+
...getColor("info"),
|
|
23
|
+
...getColor("success"),
|
|
24
|
+
...getColor("warning"),
|
|
25
|
+
...getColor("danger")
|
|
26
|
+
};
|
|
27
|
+
const breakpoints = {
|
|
28
|
+
"xs": "var(--bp-xs)",
|
|
29
|
+
"sm": "var(--bp-sm)",
|
|
30
|
+
"md": "var(--bp-md)",
|
|
31
|
+
"lg": "var(--bp-lg)",
|
|
32
|
+
"xl": "var(--bp-xl)"
|
|
33
|
+
};
|
|
34
|
+
let fontsizes = {
|
|
35
|
+
"h1": "var(--fontsize-h1)",
|
|
36
|
+
"h2": "var(--fontsize-h2)",
|
|
37
|
+
"h3": "var(--fontsize-h3)",
|
|
38
|
+
"h4": "var(--fontsize-h4)",
|
|
39
|
+
"h5": "var(--fontsize-h5)",
|
|
40
|
+
"h6": "var(--fontsize-h6)",
|
|
41
|
+
"text": "var(--fontsize-text)",
|
|
42
|
+
"button": "var(--fontsize-button)",
|
|
43
|
+
"small": "var(--fontsize-small)"
|
|
44
|
+
};
|
|
45
|
+
let lineHeights = {
|
|
46
|
+
"h1": "var(--lineheight-h1)",
|
|
47
|
+
"h2": "var(--lineheight-h2)",
|
|
48
|
+
"h3": "var(--lineheight-h3)",
|
|
49
|
+
"h4": "var(--lineheight-h4)",
|
|
50
|
+
"h5": "var(--lineheight-h5)",
|
|
51
|
+
"h6": "var(--lineheight-h6)",
|
|
52
|
+
"text": "var(--lineheight-text)",
|
|
53
|
+
"button": "var(--lineheight-button)",
|
|
54
|
+
"small": "var(--lineheight-small)"
|
|
55
|
+
};
|
|
56
|
+
let fontWeights = {
|
|
57
|
+
"h1": "var(--fontweight-h1)",
|
|
58
|
+
"h2": "var(--fontweight-h2)",
|
|
59
|
+
"h3": "var(--fontweight-h3)",
|
|
60
|
+
"h4": "var(--fontweight-h4)",
|
|
61
|
+
"h5": "var(--fontweight-h5)",
|
|
62
|
+
"h6": "var(--fontweight-h6)",
|
|
63
|
+
"text": "var(--fontweight-text)",
|
|
64
|
+
"button": "var(--fontweight-button)",
|
|
65
|
+
"small": "var(--fontweight-small)"
|
|
66
|
+
};
|
|
67
|
+
let font = {
|
|
68
|
+
"h1": "var(--font-h1)",
|
|
69
|
+
"h2": "var(--font-h2)",
|
|
70
|
+
"h3": "var(--font-h3)",
|
|
71
|
+
"h4": "var(--font-h4)",
|
|
72
|
+
"h5": "var(--font-h5)",
|
|
73
|
+
"h6": "var(--font-h6)",
|
|
74
|
+
"text": "var(--font-text)",
|
|
75
|
+
"button": "var(--font-button)",
|
|
76
|
+
"small": "var(--font-small)"
|
|
77
|
+
};
|
|
78
|
+
const getValue = (prop, value, _css) => {
|
|
79
|
+
let important;
|
|
80
|
+
if (typeof value === "string") {
|
|
81
|
+
const split = value.split("!");
|
|
82
|
+
important = split[1] ? "!important" : "";
|
|
83
|
+
value = split[0];
|
|
84
|
+
}
|
|
85
|
+
if (["width", "maxWidth", "minWidth", "max-width", "min-width"].includes(prop)) {
|
|
86
|
+
return withImportant(important, breakpoints[value] || value);
|
|
87
|
+
} else if (["fontFamily", "font-family"].includes(prop) && value === "default") {
|
|
88
|
+
return withImportant(important, "var(--font-family)");
|
|
89
|
+
}
|
|
90
|
+
if (prop === "font" && typeof value === "string" && ["h1", "h2", "h3", "h4", "h5", "h6", "text", "button", "small"].includes(value)) {
|
|
91
|
+
return withImportant(important, font[value] || value);
|
|
92
|
+
}
|
|
93
|
+
if (["fontWeight", "font-weight"].includes(prop) && typeof value === "string" && ["h1", "h2", "h3", "h4", "h5", "h6", "text", "button", "small"].includes(value)) {
|
|
94
|
+
return withImportant(important, fontWeights[value] || value);
|
|
95
|
+
} else if (["lineHeight", "line-height"].includes(prop) && typeof value === "string" && ["h1", "h2", "h3", "h4", "h5", "h6", "text", "button", "small"].includes(value)) {
|
|
96
|
+
return withImportant(important, lineHeights[value] || value);
|
|
97
|
+
} else if (["fontSize", "font-size"].includes(prop) && typeof value === "string") {
|
|
98
|
+
return withImportant(important, fontsizes[value] || value);
|
|
99
|
+
} else if (typeof value === "number" && ["shadow", "boxShadow"].includes(prop)) {
|
|
100
|
+
return withImportant(important, `var(--shadow-${value})`);
|
|
101
|
+
}
|
|
102
|
+
return withImportant(important, colors[value] || value);
|
|
103
|
+
};
|
|
104
|
+
var getValue_default = getValue;
|
|
105
|
+
export {
|
|
106
|
+
getValue_default as default
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=getValue.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/css/getValue.ts"],
|
|
4
|
+
"sourcesContent": ["import { CSSProps } from \"./types\"\n\nconst getColor = (color: string) => {\n return {\n [`${color}`]: `var(--color-${color}-primary)`,\n [`${color}.primary`]: `var(--color-${color}-primary)`,\n [`${color}.secondary`]: `var(--color-${color}-secondary)`,\n [`${color}.text`]: `var(--color-${color}-text)`,\n [`${color}.alpha`]: `var(--color-${color}-alpha)`\n }\n}\n\nconst withImportant = (important: any, value: any) => important ? value + important : value\nconst colors: any = {\n \"text\": `var(--color-text-primary)`,\n \"text.primary\": `var(--color-text-primary)`,\n \"text.secondary\": `var(--color-text-secondary)`,\n\n \"background\": `var(--color-background-primary)`,\n \"background.primary\": `var(--color-background-primary)`,\n \"background.secondary\": `var(--color-background-secondary)`,\n \"background.alpha\": `var(--color-background-alpha)`,\n \"divider\": `var(--color-divider)`,\n\n ...getColor(\"brand\"),\n ...getColor(\"accent\"),\n ...getColor(\"info\"),\n ...getColor(\"success\"),\n ...getColor(\"warning\"),\n ...getColor(\"danger\"),\n}\n\nconst breakpoints: any = {\n \"xs\": \"var(--bp-xs)\",\n \"sm\": \"var(--bp-sm)\",\n \"md\": \"var(--bp-md)\",\n \"lg\": \"var(--bp-lg)\",\n \"xl\": \"var(--bp-xl)\"\n}\n\nlet fontsizes: any = {\n \"h1\": \"var(--fontsize-h1)\",\n \"h2\": \"var(--fontsize-h2)\",\n \"h3\": \"var(--fontsize-h3)\",\n \"h4\": \"var(--fontsize-h4)\",\n \"h5\": \"var(--fontsize-h5)\",\n \"h6\": \"var(--fontsize-h6)\",\n \"text\": \"var(--fontsize-text)\",\n \"button\": \"var(--fontsize-button)\",\n \"small\": \"var(--fontsize-small)\"\n}\n\nlet lineHeights: any = {\n \"h1\": \"var(--lineheight-h1)\",\n \"h2\": \"var(--lineheight-h2)\",\n \"h3\": \"var(--lineheight-h3)\",\n \"h4\": \"var(--lineheight-h4)\",\n \"h5\": \"var(--lineheight-h5)\",\n \"h6\": \"var(--lineheight-h6)\",\n \"text\": \"var(--lineheight-text)\",\n \"button\": \"var(--lineheight-button)\",\n \"small\": \"var(--lineheight-small)\"\n}\n\nlet fontWeights: any = {\n \"h1\": \"var(--fontweight-h1)\",\n \"h2\": \"var(--fontweight-h2)\",\n \"h3\": \"var(--fontweight-h3)\",\n \"h4\": \"var(--fontweight-h4)\",\n \"h5\": \"var(--fontweight-h5)\",\n \"h6\": \"var(--fontweight-h6)\",\n \"text\": \"var(--fontweight-text)\",\n \"button\": \"var(--fontweight-button)\",\n \"small\": \"var(--fontweight-small)\"\n}\n\nlet font: any = {\n \"h1\": \"var(--font-h1)\",\n \"h2\": \"var(--font-h2)\",\n \"h3\": \"var(--font-h3)\",\n \"h4\": \"var(--font-h4)\",\n \"h5\": \"var(--font-h5)\",\n \"h6\": \"var(--font-h6)\",\n \"text\": \"var(--font-text)\",\n \"button\": \"var(--font-button)\",\n \"small\": \"var(--font-small)\"\n}\n\nconst getValue = (prop: any, value: string | number, _css: CSSProps): any => {\n let important;\n\n if (typeof value === 'string') {\n const split = value.split(\"!\")\n important = split[1] ? \"!important\" : \"\"\n value = split[0]\n }\n\n if (['width', 'maxWidth', 'minWidth', 'max-width', 'min-width'].includes(prop)) {\n return withImportant(important, breakpoints[value] || value)\n } else if (['fontFamily', 'font-family'].includes(prop) && value === 'default') {\n return withImportant(important, \"var(--font-family)\")\n } if (prop === 'font' && typeof value === \"string\" && ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'text', 'button', 'small'].includes(value)) {\n return withImportant(important, font[value] || value)\n } if (['fontWeight', 'font-weight'].includes(prop) && typeof value === 'string' && ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'text', 'button', 'small'].includes(value)) {\n return withImportant(important, fontWeights[value] || value)\n } else if (['lineHeight', 'line-height'].includes(prop) && typeof value === 'string' && ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'text', 'button', 'small'].includes(value)) {\n return withImportant(important, lineHeights[value] || value)\n } else if (['fontSize', 'font-size'].includes(prop) && typeof value === 'string') {\n return withImportant(important, fontsizes[value] || value)\n } else if (typeof value === \"number\" && [\"shadow\", \"boxShadow\"].includes(prop)) {\n return withImportant(important, `var(--shadow-${value})`)\n }\n\n return withImportant(important, colors[value] || value)\n}\n\nexport default getValue"],
|
|
5
|
+
"mappings": "AAEA,MAAM,WAAW,CAAC,UAAkB;AAChC,SAAO;AAAA,IACH,CAAC,GAAG,KAAK,EAAE,GAAG,eAAe,KAAK;AAAA,IAClC,CAAC,GAAG,KAAK,UAAU,GAAG,eAAe,KAAK;AAAA,IAC1C,CAAC,GAAG,KAAK,YAAY,GAAG,eAAe,KAAK;AAAA,IAC5C,CAAC,GAAG,KAAK,OAAO,GAAG,eAAe,KAAK;AAAA,IACvC,CAAC,GAAG,KAAK,QAAQ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EAC7D,WAAW,OAAO,UAAU,YAAY,CAAC,UAAU,WAAW,EAAE,SAAS,IAAI,GAAG;AAC5E,WAAO,cAAc,WAAW,gBAAgB,KAAK,GAAG;AAAA,EAC5D;AAEA,SAAO,cAAc,WAAW,OAAO,KAAK,KAAK,KAAK;AAC1D;AAEA,IAAO,mBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/css/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import getValue from "./getValue";
|
|
2
|
+
import getProps from "./getProps";
|
|
3
|
+
import { CSSOptionProps, CSSProps } from './types';
|
|
4
|
+
export { getValue, getProps };
|
|
5
|
+
export declare const breakpoints: {
|
|
6
|
+
xs: number;
|
|
7
|
+
sm: number;
|
|
8
|
+
md: number;
|
|
9
|
+
lg: number;
|
|
10
|
+
xl: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const css: (props: CSSProps, options?: CSSOptionProps) => import("oncss").CSSFactoryType;
|
|
13
|
+
export declare const adjustColor: (hex: string, factor: number) => string;
|
|
14
|
+
export declare const adjustTextContrast: (color: string) => "#FFFFFF" | "#111111";
|
|
15
|
+
export declare const alpha: (color: string, opacity?: number) => string;
|
package/css/index.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import getValue from "./getValue";
|
|
2
|
+
import getProps from "./getProps";
|
|
3
|
+
import aliases from "./aliases";
|
|
4
|
+
import { css as _css } from "oncss";
|
|
5
|
+
const breakpoints = {
|
|
6
|
+
xs: 0,
|
|
7
|
+
sm: 600,
|
|
8
|
+
md: 900,
|
|
9
|
+
lg: 1200,
|
|
10
|
+
xl: 1536
|
|
11
|
+
};
|
|
12
|
+
const css = (props, options) => {
|
|
13
|
+
const cssOptions = {
|
|
14
|
+
...options,
|
|
15
|
+
breakpoints,
|
|
16
|
+
aliases,
|
|
17
|
+
getValue: (p, v, _c) => {
|
|
18
|
+
if (options?.getValue) {
|
|
19
|
+
let _val = options?.getValue(p, v, _c);
|
|
20
|
+
if (_val) return _val;
|
|
21
|
+
}
|
|
22
|
+
return getValue(p, v, _c);
|
|
23
|
+
},
|
|
24
|
+
getProps: (p, v, _c) => {
|
|
25
|
+
if (options?.getProps) {
|
|
26
|
+
let _p = options?.getProps(p, v, _c);
|
|
27
|
+
if (_p) return _p;
|
|
28
|
+
}
|
|
29
|
+
return getProps(p, v, _c);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return _css(props, cssOptions);
|
|
33
|
+
};
|
|
34
|
+
const adjustColor = (hex, factor) => {
|
|
35
|
+
hex = hex.replace(/^#/, "");
|
|
36
|
+
let r = parseInt(hex.slice(0, 2), 16);
|
|
37
|
+
let g = parseInt(hex.slice(2, 4), 16);
|
|
38
|
+
let b = parseInt(hex.slice(4, 6), 16);
|
|
39
|
+
r = Math.floor(r * factor);
|
|
40
|
+
g = Math.floor(g * factor);
|
|
41
|
+
b = Math.floor(b * factor);
|
|
42
|
+
r = Math.min(255, Math.max(0, r));
|
|
43
|
+
g = Math.min(255, Math.max(0, g));
|
|
44
|
+
b = Math.min(255, Math.max(0, b));
|
|
45
|
+
return `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b.toString(16).padStart(2, "0")}`;
|
|
46
|
+
};
|
|
47
|
+
const adjustTextContrast = (color) => {
|
|
48
|
+
color = color.replace(/^#/, "");
|
|
49
|
+
const r = parseInt(color.slice(0, 2), 16);
|
|
50
|
+
const g = parseInt(color.slice(2, 4), 16);
|
|
51
|
+
const b = parseInt(color.slice(4, 6), 16);
|
|
52
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
53
|
+
return luminance > 0.5 ? "#111111" : "#FFFFFF";
|
|
54
|
+
};
|
|
55
|
+
const alpha = (color, opacity = 1) => {
|
|
56
|
+
if (typeof opacity !== "number") return color;
|
|
57
|
+
let _opacity = opacity * 100;
|
|
58
|
+
if (!color.startsWith("#")) throw new Error(`color must be hex`);
|
|
59
|
+
return (color + `0${Math.round(255 / 100 * _opacity).toString(16)}`.slice(-2)).toUpperCase();
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
adjustColor,
|
|
63
|
+
adjustTextContrast,
|
|
64
|
+
alpha,
|
|
65
|
+
breakpoints,
|
|
66
|
+
css,
|
|
67
|
+
getProps,
|
|
68
|
+
getValue
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
package/css/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/css/index.ts"],
|
|
4
|
+
"sourcesContent": ["import getValue from \"./getValue\"\nimport getProps from \"./getProps\"\nimport aliases from \"./aliases\"\nimport { Aliases, BreakpointKeys, CSSOptionProps, CSSProps } from './types'\nimport { css as _css } from \"oncss\"\n\nexport {\n getValue,\n getProps\n}\n\nexport const breakpoints = {\n xs: 0,\n sm: 600,\n md: 900,\n lg: 1200,\n xl: 1536\n}\n\nexport const css = (props: CSSProps, options?: CSSOptionProps) => {\n const cssOptions: CSSOptionProps = {\n ...options,\n breakpoints,\n aliases,\n getValue: (p: any, v: any, _c: any,) => {\n if (options?.getValue) {\n let _val = options?.getValue(p, v, _c)\n if (_val) return _val\n }\n return getValue(p, v, _c)\n },\n getProps: (p: any, v: any, _c: any) => {\n if (options?.getProps) {\n let _p = options?.getProps(p, v, _c)\n if (_p) return _p\n }\n return getProps(p, v, _c)\n },\n }\n return _css<Aliases, BreakpointKeys>(props, cssOptions)\n}\n\nexport const adjustColor = (hex: string, factor: number) => {\n\n hex = hex.replace(/^#/, '')\n\n let r = parseInt(hex.slice(0, 2), 16)\n let g = parseInt(hex.slice(2, 4), 16)\n let b = parseInt(hex.slice(4, 6), 16)\n\n r = Math.floor(r * factor)\n g = Math.floor(g * factor)\n b = Math.floor(b * factor)\n\n r = Math.min(255, Math.max(0, r))\n g = Math.min(255, Math.max(0, g))\n b = Math.min(255, Math.max(0, b))\n\n return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;\n}\n\nexport const adjustTextContrast = (color: string) => {\n color = color.replace(/^#/, '')\n const r = parseInt(color.slice(0, 2), 16);\n const g = parseInt(color.slice(2, 4), 16);\n const b = parseInt(color.slice(4, 6), 16);\n\n const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;\n return luminance > 0.5 ? '#111111' : '#FFFFFF';\n}\n\nexport const alpha = (color: string, opacity = 1) => {\n if (typeof opacity !== 'number') return color\n let _opacity = opacity * 100\n if (!color.startsWith(\"#\")) throw new Error(`color must be hex`)\n return (color + (`0${Math.round((255 / 100) * _opacity).toString(16)}`.slice(-2))).toUpperCase();\n};\n\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,cAAc;AACrB,OAAO,cAAc;AACrB,OAAO,aAAa;AAEpB,SAAS,OAAO,YAAY;AAOrB,MAAM,cAAc;AAAA,EACvB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACR;AAEO,MAAM,MAAM,CAAC,OAAiB,YAA6B;AAC9D,QAAM,aAA6B;AAAA,IAC/B,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA,UAAU,CAAC,GAAQ,GAAQ,OAAa;AACpC,UAAI,SAAS,UAAU;AACnB,YAAI,OAAO,SAAS,SAAS,GAAG,GAAG,EAAE;AACrC,YAAI,KAAM,QAAO;AAAA,MACrB;AACA,aAAO,SAAS,GAAG,GAAG,EAAE;AAAA,IAC5B;AAAA,IACA,UAAU,CAAC,GAAQ,GAAQ,OAAY;AACnC,UAAI,SAAS,UAAU;AACnB,YAAI,KAAK,SAAS,SAAS,GAAG,GAAG,EAAE;AACnC,YAAI,GAAI,QAAO;AAAA,MACnB;AACA,aAAO,SAAS,GAAG,GAAG,EAAE;AAAA,IAC5B;AAAA,EACJ;AACA,SAAO,KAA8B,OAAO,UAAU;AAC1D;AAEO,MAAM,cAAc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AAC/D,UAAQ,QAAS,IAAI,KAAK,MAAO,MAAM,MAAO,QAAQ,EAAE,SAAS,EAAE,CAAC,GAAG,MAAM,EAAE,GAAI,YAAY;AACnG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/css/types.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as CSS from 'csstype';
|
|
2
|
+
import { ColorsRefTypes, TypographyRefTypes, ThemeOptions } from '../theme/types';
|
|
3
|
+
import * as oncss from 'oncss';
|
|
4
|
+
export type FN = (theme: ThemeOptions) => string | number;
|
|
5
|
+
export type CSSBreakpointType = {
|
|
6
|
+
[key in BreakpointKeys]: string | number;
|
|
7
|
+
};
|
|
8
|
+
export type CSSValueType<T extends keyof CSS.Properties> = CSS.Properties[T] | Partial<CSSBreakpointType> | number;
|
|
9
|
+
export type Aliases = {
|
|
10
|
+
bgcolor?: CSSValueType<'background'> | ColorsRefTypes;
|
|
11
|
+
bgimage?: CSSValueType<'backgroundImage'>;
|
|
12
|
+
bg?: CSSValueType<'background'> | ColorsRefTypes;
|
|
13
|
+
p?: CSSValueType<'padding'>;
|
|
14
|
+
pt?: CSSValueType<'padding'>;
|
|
15
|
+
pr?: CSSValueType<'padding'>;
|
|
16
|
+
pb?: CSSValueType<'padding'>;
|
|
17
|
+
pl?: CSSValueType<'padding'>;
|
|
18
|
+
px?: CSSValueType<'padding'>;
|
|
19
|
+
py?: CSSValueType<'margin'>;
|
|
20
|
+
m?: CSSValueType<'margin'>;
|
|
21
|
+
mt?: CSSValueType<'margin'>;
|
|
22
|
+
mr?: CSSValueType<'margin'>;
|
|
23
|
+
mb?: CSSValueType<'margin'>;
|
|
24
|
+
ml?: CSSValueType<'margin'>;
|
|
25
|
+
mx?: CSSValueType<'margin'>;
|
|
26
|
+
my?: CSSValueType<'margin'>;
|
|
27
|
+
size?: CSSValueType<'width'>;
|
|
28
|
+
spacing?: Partial<CSSBreakpointType> | number;
|
|
29
|
+
radius?: CSSValueType<'borderRadius'> | number;
|
|
30
|
+
borderRadius?: CSSValueType<'borderRadius'> | number;
|
|
31
|
+
shadow?: CSSValueType<'boxShadow'> | number;
|
|
32
|
+
flexBox?: boolean;
|
|
33
|
+
flexRow?: boolean;
|
|
34
|
+
flexColumn?: boolean;
|
|
35
|
+
flexWraped?: boolean;
|
|
36
|
+
direction?: "row" | "column" | CSSValueType<'direction'>;
|
|
37
|
+
gap?: CSSValueType<'gap'>;
|
|
38
|
+
color?: CSSValueType<'color'> | ColorsRefTypes;
|
|
39
|
+
width?: CSSValueType<'width'> | BreakpointKeys;
|
|
40
|
+
height?: CSSValueType<'height'>;
|
|
41
|
+
borderColor?: CSSValueType<'backgroundColor'> | ColorsRefTypes;
|
|
42
|
+
fontFamily?: CSSValueType<"fontFamily"> | "default";
|
|
43
|
+
fontSize?: CSSValueType<"fontSize"> | TypographyRefTypes;
|
|
44
|
+
minWidth?: CSSValueType<"minWidth"> | BreakpointKeys;
|
|
45
|
+
maxWidth?: CSSValueType<"maxWidth"> | BreakpointKeys;
|
|
46
|
+
minHeight?: CSSValueType<"minHeight">;
|
|
47
|
+
maxHeight?: CSSValueType<"maxHeight">;
|
|
48
|
+
};
|
|
49
|
+
export type BreakpointKeys = "xs" | "sm" | "md" | "lg" | "xl";
|
|
50
|
+
export type CSSProps = oncss.CSSProps<Aliases, BreakpointKeys>;
|
|
51
|
+
export type CSSOptionProps = oncss.CSSOptionProps<Aliases, BreakpointKeys>;
|
|
52
|
+
export type GlobalCSS = {
|
|
53
|
+
[key: string]: oncss.CSSPropsWithoutGlobal<Aliases, BreakpointKeys>;
|
|
54
|
+
};
|
package/css/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
package/css/types.js.map
ADDED
package/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Tag from './Tag';
|
|
2
|
+
import useTagProps from './Tag/useTagProps';
|
|
3
|
+
import useAnimation from './useAnimation';
|
|
4
|
+
import useColorTemplate from './useColorTemplate';
|
|
5
|
+
import useBreakpoint from './breakpoint/useBreakpoint';
|
|
6
|
+
import useBreakpointProps from './breakpoint/useBreakpointProps';
|
|
7
|
+
import ServerStyleTags from './ServerStyleTags';
|
|
8
|
+
import isWindow from './isWindow';
|
|
9
|
+
import useInterface from './useInterface';
|
|
10
|
+
import Transition from './Transition';
|
|
11
|
+
export * from './css';
|
|
12
|
+
export * from "./theme";
|
|
13
|
+
export * from './css/types';
|
|
14
|
+
export * from './Tag/types';
|
|
15
|
+
export * from './theme/types';
|
|
16
|
+
export * from './useColorTemplate';
|
|
17
|
+
export * from './useAnimation';
|
|
18
|
+
export type * from './Transition';
|
|
19
|
+
export type * from './Tag/types';
|
|
20
|
+
export type { useBreakpointPropsType } from './breakpoint/useBreakpointProps';
|
|
21
|
+
export { Tag, useTagProps, useAnimation, Transition, useColorTemplate, ServerStyleTags, useBreakpoint, useBreakpointProps, isWindow, useInterface };
|
package/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Tag from "./Tag";
|
|
2
|
+
import useTagProps from "./Tag/useTagProps";
|
|
3
|
+
import useAnimation from "./useAnimation";
|
|
4
|
+
import useColorTemplate from "./useColorTemplate";
|
|
5
|
+
import useBreakpoint from "./breakpoint/useBreakpoint";
|
|
6
|
+
import useBreakpointProps from "./breakpoint/useBreakpointProps";
|
|
7
|
+
import ServerStyleTags from "./ServerStyleTags";
|
|
8
|
+
import isWindow from "./isWindow";
|
|
9
|
+
import useInterface from "./useInterface";
|
|
10
|
+
import Transition from "./Transition";
|
|
11
|
+
export * from "./css";
|
|
12
|
+
export * from "./theme";
|
|
13
|
+
export * from "./css/types";
|
|
14
|
+
export * from "./Tag/types";
|
|
15
|
+
export * from "./theme/types";
|
|
16
|
+
export * from "./useColorTemplate";
|
|
17
|
+
export * from "./useAnimation";
|
|
18
|
+
export {
|
|
19
|
+
ServerStyleTags,
|
|
20
|
+
Tag,
|
|
21
|
+
Transition,
|
|
22
|
+
isWindow,
|
|
23
|
+
useAnimation,
|
|
24
|
+
useBreakpoint,
|
|
25
|
+
useBreakpointProps,
|
|
26
|
+
useColorTemplate,
|
|
27
|
+
useInterface,
|
|
28
|
+
useTagProps
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import Tag from './Tag'\nimport useTagProps from './Tag/useTagProps'\nimport useAnimation from './useAnimation'\nimport useColorTemplate from './useColorTemplate'\nimport useBreakpoint from './breakpoint/useBreakpoint'\nimport useBreakpointProps from './breakpoint/useBreakpointProps'\nimport ServerStyleTags from './ServerStyleTags'\nimport isWindow from './isWindow'\nimport useInterface from './useInterface'\nimport Transition from './Transition'\n\nexport * from './css'\nexport * from \"./theme\"\nexport * from './css/types'\nexport * from './Tag/types'\nexport * from './theme/types'\nexport * from './useColorTemplate'\nexport * from './useAnimation'\nexport type * from './Transition'\nexport type * from './Tag/types'\nexport type { useBreakpointPropsType } from './breakpoint/useBreakpointProps'\n\nexport {\n Tag,\n useTagProps,\n useAnimation,\n Transition,\n useColorTemplate,\n ServerStyleTags,\n useBreakpoint,\n useBreakpointProps,\n isWindow,\n useInterface\n}"],
|
|
5
|
+
"mappings": "AAAA,OAAO,SAAS;AAChB,OAAO,iBAAiB;AACxB,OAAO,kBAAkB;AACzB,OAAO,sBAAsB;AAC7B,OAAO,mBAAmB;AAC1B,OAAO,wBAAwB;AAC/B,OAAO,qBAAqB;AAC5B,OAAO,cAAc;AACrB,OAAO,kBAAkB;AACzB,OAAO,gBAAgB;AAEvB,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/isWindow.d.ts
ADDED
package/isWindow.js
ADDED
package/isWindow.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/isWindow.ts"],
|
|
4
|
+
"sourcesContent": ["\nconst isWindow = (): Window | void => typeof window !== 'undefined' ? window : undefined\nexport default isWindow"],
|
|
5
|
+
"mappings": "AACA,MAAM,WAAW,MAAqB,OAAO,WAAW,cAAc,SAAS;AAC/E,IAAO,mBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xanui/core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "makepack serve -p 3000",
|
|
11
|
+
"pack": "makepack pack",
|
|
12
|
+
"publish:pack": "makepack pack -p"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"oncss": "^1.1.2",
|
|
16
|
+
"pretty-class": "^1.0.0",
|
|
17
|
+
"react": "^19.0.0",
|
|
18
|
+
"react-dom": "^19.0.0",
|
|
19
|
+
"react-state-bucket": "^1.1.4"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/react": "^19.0.2",
|
|
23
|
+
"@types/react-dom": "^19.0.2",
|
|
24
|
+
"makepack": "^1.3.4",
|
|
25
|
+
"typescript": "^4.4.2"
|
|
26
|
+
},
|
|
27
|
+
"keywords": []
|
|
28
|
+
}
|
package/readme.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const ThemeCssVars = (theme) => {
|
|
2
|
+
const shadows = {};
|
|
3
|
+
theme.shadow.forEach((s, i) => shadows[`--shadow-${i}`] = s);
|
|
4
|
+
return {
|
|
5
|
+
"--bp-xs": theme.breakpoints.xs,
|
|
6
|
+
"--bp-sm": theme.breakpoints.sm,
|
|
7
|
+
"--bp-md": theme.breakpoints.md,
|
|
8
|
+
"--bp-lg": theme.breakpoints.lg,
|
|
9
|
+
"--bp-xl": theme.breakpoints.xl,
|
|
10
|
+
"--font-family": theme.typography.fontFamily,
|
|
11
|
+
"--font-h1": `${theme.typography.h1.fontWeight} ${theme.typography.h1.fontSize}px/${theme.typography.h1.lineHeight} ${theme.typography.fontFamily}`,
|
|
12
|
+
"--font-h2": `${theme.typography.h2.fontWeight} ${theme.typography.h2.fontSize}px/${theme.typography.h2.lineHeight} ${theme.typography.fontFamily}`,
|
|
13
|
+
"--font-h3": `${theme.typography.h3.fontWeight} ${theme.typography.h3.fontSize}px/${theme.typography.h3.lineHeight} ${theme.typography.fontFamily}`,
|
|
14
|
+
"--font-h4": `${theme.typography.h4.fontWeight} ${theme.typography.h4.fontSize}px/${theme.typography.h4.lineHeight} ${theme.typography.fontFamily}`,
|
|
15
|
+
"--font-h5": `${theme.typography.h5.fontWeight} ${theme.typography.h5.fontSize}px/${theme.typography.h5.lineHeight} ${theme.typography.fontFamily}`,
|
|
16
|
+
"--font-h6": `${theme.typography.h6.fontWeight} ${theme.typography.h6.fontSize}px/${theme.typography.h6.lineHeight} ${theme.typography.fontFamily}`,
|
|
17
|
+
"--font-text": `${theme.typography.text.fontWeight} ${theme.typography.text.fontSize}px/${theme.typography.text.lineHeight} ${theme.typography.fontFamily}`,
|
|
18
|
+
"--font-button": `${theme.typography.button.fontWeight} ${theme.typography.button.fontSize}px/${theme.typography.button.lineHeight} ${theme.typography.fontFamily}`,
|
|
19
|
+
"--font-small": `${theme.typography.small.fontWeight} ${theme.typography.small.fontSize}px/${theme.typography.small.lineHeight} ${theme.typography.fontFamily}`,
|
|
20
|
+
"--fontsize-h1": `${theme.typography.h1.fontSize}px`,
|
|
21
|
+
"--fontsize-h2": `${theme.typography.h2.fontSize}px`,
|
|
22
|
+
"--fontsize-h3": `${theme.typography.h3.fontSize}px`,
|
|
23
|
+
"--fontsize-h4": `${theme.typography.h4.fontSize}px`,
|
|
24
|
+
"--fontsize-h5": `${theme.typography.h5.fontSize}px`,
|
|
25
|
+
"--fontsize-h6": `${theme.typography.h6.fontSize}px`,
|
|
26
|
+
"--fontsize-text": `${theme.typography.text.fontSize}px`,
|
|
27
|
+
"--fontsize-button": `${theme.typography.button.fontSize}px`,
|
|
28
|
+
"--fontsize-small": `${theme.typography.small.fontSize}px`,
|
|
29
|
+
"--fontweight-h1": theme.typography.h1.fontWeight + "",
|
|
30
|
+
"--fontweight-h2": theme.typography.h2.fontWeight + "",
|
|
31
|
+
"--fontweight-h3": theme.typography.h3.fontWeight + "",
|
|
32
|
+
"--fontweight-h4": theme.typography.h4.fontWeight + "",
|
|
33
|
+
"--fontweight-h5": theme.typography.h5.fontWeight + "",
|
|
34
|
+
"--fontweight-h6": theme.typography.h6.fontWeight + "",
|
|
35
|
+
"--fontweight-text": theme.typography.text.fontWeight + "",
|
|
36
|
+
"--fontweight-button": theme.typography.button.fontWeight + "",
|
|
37
|
+
"--fontweight-small": theme.typography.small.fontWeight + "",
|
|
38
|
+
"--lineheight-h1": theme.typography.h1.lineHeight + "",
|
|
39
|
+
"--lineheight-h2": theme.typography.h2.lineHeight + "",
|
|
40
|
+
"--lineheight-h3": theme.typography.h3.lineHeight + "",
|
|
41
|
+
"--lineheight-h4": theme.typography.h4.lineHeight + "",
|
|
42
|
+
"--lineheight-h5": theme.typography.h5.lineHeight + "",
|
|
43
|
+
"--lineheight-h6": theme.typography.h6.lineHeight + "",
|
|
44
|
+
"--lineheight-text": theme.typography.text.lineHeight + "",
|
|
45
|
+
"--lineheight-button": theme.typography.button.lineHeight + "",
|
|
46
|
+
"--lineheight-small": theme.typography.small.lineHeight + "",
|
|
47
|
+
"--color-text": theme.colors.text.primary,
|
|
48
|
+
"--color-text-primary": theme.colors.text.primary,
|
|
49
|
+
"--color-text-secondary": theme.colors.text.secondary,
|
|
50
|
+
"--color-background": theme.colors.background.primary,
|
|
51
|
+
"--color-background-primary": theme.colors.background.primary,
|
|
52
|
+
"--color-background-secondary": theme.colors.background.secondary,
|
|
53
|
+
"--color-background-alpha": theme.colors.background.alpha,
|
|
54
|
+
"--color-divider": theme.colors.divider,
|
|
55
|
+
"--color-brand": theme.colors.brand.primary,
|
|
56
|
+
"--color-brand-primary": theme.colors.brand.primary,
|
|
57
|
+
"--color-brand-secondary": theme.colors.brand.secondary,
|
|
58
|
+
"--color-brand-alpha": theme.colors.brand.alpha,
|
|
59
|
+
"--color-brand-text": theme.colors.brand.text,
|
|
60
|
+
"--color-accent": theme.colors.accent.primary,
|
|
61
|
+
"--color-accent-primary": theme.colors.accent.primary,
|
|
62
|
+
"--color-accent-secondary": theme.colors.accent.secondary,
|
|
63
|
+
"--color-accent-alpha": theme.colors.accent.alpha,
|
|
64
|
+
"--color-accent-text": theme.colors.accent.text,
|
|
65
|
+
"--color-info": theme.colors.info.primary,
|
|
66
|
+
"--color-info-primary": theme.colors.info.primary,
|
|
67
|
+
"--color-info-secondary": theme.colors.info.secondary,
|
|
68
|
+
"--color-info-alpha": theme.colors.info.alpha,
|
|
69
|
+
"--color-info-text": theme.colors.info.text,
|
|
70
|
+
"--color-success": theme.colors.success.primary,
|
|
71
|
+
"--color-success-primary": theme.colors.success.primary,
|
|
72
|
+
"--color-success-secondary": theme.colors.success.secondary,
|
|
73
|
+
"--color-success-alpha": theme.colors.success.alpha,
|
|
74
|
+
"--color-success-text": theme.colors.success.text,
|
|
75
|
+
"--color-warning": theme.colors.warning.primary,
|
|
76
|
+
"--color-warning-primary": theme.colors.warning.primary,
|
|
77
|
+
"--color-warning-secondary": theme.colors.warning.secondary,
|
|
78
|
+
"--color-warning-alpha": theme.colors.warning.alpha,
|
|
79
|
+
"--color-warning-text": theme.colors.warning.text,
|
|
80
|
+
"--color-danger": theme.colors.danger.primary,
|
|
81
|
+
"--color-danger-primary": theme.colors.danger.primary,
|
|
82
|
+
"--color-danger-secondary": theme.colors.danger.secondary,
|
|
83
|
+
"--color-danger-alpha": theme.colors.danger.alpha,
|
|
84
|
+
"--color-danger-text": theme.colors.danger.text,
|
|
85
|
+
...shadows
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
var ThemeCssVars_default = ThemeCssVars;
|
|
89
|
+
export {
|
|
90
|
+
ThemeCssVars_default as default
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=ThemeCssVars.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/theme/ThemeCssVars.ts"],
|
|
4
|
+
"sourcesContent": ["import { ThemeOptions } from \"./types\";\n\nconst ThemeCssVars = (theme: ThemeOptions) => {\n\n const shadows: any = {}\n theme.shadow.forEach((s, i) => shadows[`--shadow-${i}`] = s)\n\n return {\n \"--bp-xs\": theme.breakpoints.xs,\n \"--bp-sm\": theme.breakpoints.sm,\n \"--bp-md\": theme.breakpoints.md,\n \"--bp-lg\": theme.breakpoints.lg,\n \"--bp-xl\": theme.breakpoints.xl,\n\n \"--font-family\": theme.typography.fontFamily,\n \"--font-h1\": `${theme.typography.h1.fontWeight} ${theme.typography.h1.fontSize}px/${theme.typography.h1.lineHeight} ${theme.typography.fontFamily}`,\n \"--font-h2\": `${theme.typography.h2.fontWeight} ${theme.typography.h2.fontSize}px/${theme.typography.h2.lineHeight} ${theme.typography.fontFamily}`,\n \"--font-h3\": `${theme.typography.h3.fontWeight} ${theme.typography.h3.fontSize}px/${theme.typography.h3.lineHeight} ${theme.typography.fontFamily}`,\n \"--font-h4\": `${theme.typography.h4.fontWeight} ${theme.typography.h4.fontSize}px/${theme.typography.h4.lineHeight} ${theme.typography.fontFamily}`,\n \"--font-h5\": `${theme.typography.h5.fontWeight} ${theme.typography.h5.fontSize}px/${theme.typography.h5.lineHeight} ${theme.typography.fontFamily}`,\n \"--font-h6\": `${theme.typography.h6.fontWeight} ${theme.typography.h6.fontSize}px/${theme.typography.h6.lineHeight} ${theme.typography.fontFamily}`,\n \"--font-text\": `${theme.typography.text.fontWeight} ${theme.typography.text.fontSize}px/${theme.typography.text.lineHeight} ${theme.typography.fontFamily}`,\n \"--font-button\": `${theme.typography.button.fontWeight} ${theme.typography.button.fontSize}px/${theme.typography.button.lineHeight} ${theme.typography.fontFamily}`,\n \"--font-small\": `${theme.typography.small.fontWeight} ${theme.typography.small.fontSize}px/${theme.typography.small.lineHeight} ${theme.typography.fontFamily}`,\n\n \"--fontsize-h1\": `${theme.typography.h1.fontSize}px`,\n \"--fontsize-h2\": `${theme.typography.h2.fontSize}px`,\n \"--fontsize-h3\": `${theme.typography.h3.fontSize}px`,\n \"--fontsize-h4\": `${theme.typography.h4.fontSize}px`,\n \"--fontsize-h5\": `${theme.typography.h5.fontSize}px`,\n \"--fontsize-h6\": `${theme.typography.h6.fontSize}px`,\n \"--fontsize-text\": `${theme.typography.text.fontSize}px`,\n \"--fontsize-button\": `${theme.typography.button.fontSize}px`,\n \"--fontsize-small\": `${theme.typography.small.fontSize}px`,\n\n \"--fontweight-h1\": theme.typography.h1.fontWeight + \"\",\n \"--fontweight-h2\": theme.typography.h2.fontWeight + \"\",\n \"--fontweight-h3\": theme.typography.h3.fontWeight + \"\",\n \"--fontweight-h4\": theme.typography.h4.fontWeight + \"\",\n \"--fontweight-h5\": theme.typography.h5.fontWeight + \"\",\n \"--fontweight-h6\": theme.typography.h6.fontWeight + \"\",\n \"--fontweight-text\": theme.typography.text.fontWeight + \"\",\n \"--fontweight-button\": theme.typography.button.fontWeight + \"\",\n \"--fontweight-small\": theme.typography.small.fontWeight + \"\",\n\n \"--lineheight-h1\": theme.typography.h1.lineHeight + \"\",\n \"--lineheight-h2\": theme.typography.h2.lineHeight + \"\",\n \"--lineheight-h3\": theme.typography.h3.lineHeight + \"\",\n \"--lineheight-h4\": theme.typography.h4.lineHeight + \"\",\n \"--lineheight-h5\": theme.typography.h5.lineHeight + \"\",\n \"--lineheight-h6\": theme.typography.h6.lineHeight + \"\",\n \"--lineheight-text\": theme.typography.text.lineHeight + \"\",\n \"--lineheight-button\": theme.typography.button.lineHeight + \"\",\n \"--lineheight-small\": theme.typography.small.lineHeight + \"\",\n\n \"--color-text\": theme.colors.text.primary,\n \"--color-text-primary\": theme.colors.text.primary,\n \"--color-text-secondary\": theme.colors.text.secondary,\n\n \"--color-background\": theme.colors.background.primary,\n \"--color-background-primary\": theme.colors.background.primary,\n \"--color-background-secondary\": theme.colors.background.secondary,\n \"--color-background-alpha\": theme.colors.background.alpha,\n\n \"--color-divider\": theme.colors.divider,\n\n \"--color-brand\": theme.colors.brand.primary,\n \"--color-brand-primary\": theme.colors.brand.primary,\n \"--color-brand-secondary\": theme.colors.brand.secondary,\n \"--color-brand-alpha\": theme.colors.brand.alpha,\n \"--color-brand-text\": theme.colors.brand.text,\n\n \"--color-accent\": theme.colors.accent.primary,\n \"--color-accent-primary\": theme.colors.accent.primary,\n \"--color-accent-secondary\": theme.colors.accent.secondary,\n \"--color-accent-alpha\": theme.colors.accent.alpha,\n \"--color-accent-text\": theme.colors.accent.text,\n\n \"--color-info\": theme.colors.info.primary,\n \"--color-info-primary\": theme.colors.info.primary,\n \"--color-info-secondary\": theme.colors.info.secondary,\n \"--color-info-alpha\": theme.colors.info.alpha,\n \"--color-info-text\": theme.colors.info.text,\n\n \"--color-success\": theme.colors.success.primary,\n \"--color-success-primary\": theme.colors.success.primary,\n \"--color-success-secondary\": theme.colors.success.secondary,\n \"--color-success-alpha\": theme.colors.success.alpha,\n \"--color-success-text\": theme.colors.success.text,\n\n \"--color-warning\": theme.colors.warning.primary,\n \"--color-warning-primary\": theme.colors.warning.primary,\n \"--color-warning-secondary\": theme.colors.warning.secondary,\n \"--color-warning-alpha\": theme.colors.warning.alpha,\n \"--color-warning-text\": theme.colors.warning.text,\n\n \"--color-danger\": theme.colors.danger.primary,\n \"--color-danger-primary\": theme.colors.danger.primary,\n \"--color-danger-secondary\": theme.colors.danger.secondary,\n \"--color-danger-alpha\": theme.colors.danger.al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K;AAAA,IAC1C,0BAA0B,MAAM,OAAO,KAAK;AAAA,IAC5C,sBAAsB,MAAM,OAAO,KAAK;AAAA,IACxC,qBAAqB,MAAM,OAAO,KAAK;AAAA,IAEvC,mBAAmB,MAAM,OAAO,QAAQ;AAAA,IACxC,2BAA2B,MAAM,OAAO,QAAQ;AAAA,IAChD,6BAA6B,MAAM,OAAO,QAAQ;AAAA,IAClD,yBAAyB,MAAM,OAAO,QAAQ;AAAA,IAC9C,wBAAwB,MAAM,OAAO,QAAQ;AAAA,IAE7C,mBAAmB,MAAM,OAAO,QAAQ;AAAA,IACxC,2BAA2B,MAAM,OAAO,QAAQ;AAAA,IAChD,6BAA6B,MAAM,OAAO,QAAQ;AAAA,IAClD,yBAAyB,MAAM,OAAO,QAAQ;AAAA,IAC9C,wBAAwB,MAAM,OAAO,QAAQ;AAAA,IAE7C,kBAAkB,MAAM,OAAO,OAAO;AAAA,IACtC,0BAA0B,MAAM,OAAO,OAAO;AAAA,IAC9C,4BAA4B,MAAM,OAAO,OAAO;AAAA,IAChD,wBAAwB,MAAM,OAAO,OAAO;AAAA,IAC5C,uBAAuB,MAAM,OAAO,OAAO;AAAA,IAC3C,GAAG;AAAA,EACP;AACJ;AAGA,IAAO,uBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ThemeOptionInput, ThemeTypographyType } from './types';
|
|
2
|
+
export declare const lightColorPallete: {
|
|
3
|
+
text: {
|
|
4
|
+
primary: string;
|
|
5
|
+
secondary: string;
|
|
6
|
+
};
|
|
7
|
+
background: {
|
|
8
|
+
primary: string;
|
|
9
|
+
secondary: string;
|
|
10
|
+
};
|
|
11
|
+
divider: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const darkColorPallete: {
|
|
14
|
+
text: {
|
|
15
|
+
primary: string;
|
|
16
|
+
secondary: string;
|
|
17
|
+
};
|
|
18
|
+
background: {
|
|
19
|
+
primary: string;
|
|
20
|
+
secondary: string;
|
|
21
|
+
};
|
|
22
|
+
divider: string;
|
|
23
|
+
};
|
|
24
|
+
export declare const ThemeColors: {
|
|
25
|
+
brand: {
|
|
26
|
+
primary: string;
|
|
27
|
+
secondary: string;
|
|
28
|
+
text: string;
|
|
29
|
+
};
|
|
30
|
+
accent: {
|
|
31
|
+
primary: string;
|
|
32
|
+
secondary: string;
|
|
33
|
+
text: string;
|
|
34
|
+
};
|
|
35
|
+
info: {
|
|
36
|
+
primary: string;
|
|
37
|
+
secondary: string;
|
|
38
|
+
text: string;
|
|
39
|
+
};
|
|
40
|
+
success: {
|
|
41
|
+
primary: string;
|
|
42
|
+
secondary: string;
|
|
43
|
+
text: string;
|
|
44
|
+
};
|
|
45
|
+
warning: {
|
|
46
|
+
primary: string;
|
|
47
|
+
secondary: string;
|
|
48
|
+
text: string;
|
|
49
|
+
};
|
|
50
|
+
danger: {
|
|
51
|
+
primary: string;
|
|
52
|
+
secondary: string;
|
|
53
|
+
text: string;
|
|
54
|
+
};
|
|
55
|
+
text: {
|
|
56
|
+
primary: string;
|
|
57
|
+
secondary: string;
|
|
58
|
+
};
|
|
59
|
+
background: {
|
|
60
|
+
primary: string;
|
|
61
|
+
secondary: string;
|
|
62
|
+
};
|
|
63
|
+
divider: string;
|
|
64
|
+
};
|
|
65
|
+
export declare const ThemeTypography: ThemeTypographyType;
|
|
66
|
+
export declare const shadow: string[];
|
|
67
|
+
declare const _default: ThemeOptionInput;
|
|
68
|
+
export default _default;
|