@tecsinapse/cortex-core 1.3.0-beta.2 → 1.3.0-beta.3
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/dist/cjs/index.js +1 -0
- package/dist/cjs/provider/DarkThemeContext.js +30 -10
- package/dist/cjs/tokens/definitions.js +26 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/provider/DarkThemeContext.js +30 -10
- package/dist/esm/tokens/definitions.js +26 -1
- package/dist/types/preset/index.d.ts +7 -0
- package/dist/types/tokens/definitions.d.ts +26 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -69,6 +69,7 @@ exports.borderRadius = definitions.borderRadius;
|
|
|
69
69
|
exports.borderWidth = definitions.borderWidth;
|
|
70
70
|
exports.boxShadow = definitions.boxShadow;
|
|
71
71
|
exports.colors = definitions.colors;
|
|
72
|
+
exports.darkColors = definitions.darkColors;
|
|
72
73
|
exports.fontFamily = definitions.fontFamily;
|
|
73
74
|
exports.fontSize = definitions.fontSize;
|
|
74
75
|
exports.spacing = definitions.spacing;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
|
+
var definitions = require('../tokens/definitions.js');
|
|
5
6
|
|
|
6
7
|
const ThemeContext = react.createContext(null);
|
|
7
8
|
const ThemeProvider = ({ children }) => {
|
|
@@ -9,17 +10,36 @@ const ThemeProvider = ({ children }) => {
|
|
|
9
10
|
react.useEffect(() => {
|
|
10
11
|
const style = document.documentElement.style;
|
|
11
12
|
if (theme === "dark") {
|
|
12
|
-
style.setProperty("--color-body",
|
|
13
|
-
style.setProperty("--color-text-default",
|
|
14
|
-
style.setProperty("--color-surface-base",
|
|
15
|
-
style.setProperty("--color-surface-raised",
|
|
16
|
-
style.setProperty("--color-surface-overlay",
|
|
13
|
+
style.setProperty("--color-body", definitions.darkColors.body);
|
|
14
|
+
style.setProperty("--color-text-default", definitions.darkColors.text.default);
|
|
15
|
+
style.setProperty("--color-surface-base", definitions.darkColors.surface.base);
|
|
16
|
+
style.setProperty("--color-surface-raised", definitions.darkColors.surface.raised);
|
|
17
|
+
style.setProperty("--color-surface-overlay", definitions.darkColors.surface.overlay);
|
|
18
|
+
style.setProperty("--color-content-primary", definitions.darkColors.content.primary);
|
|
19
|
+
style.setProperty(
|
|
20
|
+
"--color-content-secondary",
|
|
21
|
+
definitions.darkColors.content.secondary
|
|
22
|
+
);
|
|
23
|
+
style.setProperty(
|
|
24
|
+
"--color-content-tertiary",
|
|
25
|
+
definitions.darkColors.content.tertiary
|
|
26
|
+
);
|
|
27
|
+
style.setProperty(
|
|
28
|
+
"--color-content-disabled",
|
|
29
|
+
definitions.darkColors.content.disabled
|
|
30
|
+
);
|
|
31
|
+
style.setProperty("--color-content-inverse", definitions.darkColors.content.inverse);
|
|
17
32
|
} else {
|
|
18
|
-
style.setProperty("--color-body",
|
|
19
|
-
style.setProperty("--color-text-default",
|
|
20
|
-
style.setProperty("--color-surface-base",
|
|
21
|
-
style.setProperty("--color-surface-raised",
|
|
22
|
-
style.setProperty("--color-surface-overlay",
|
|
33
|
+
style.setProperty("--color-body", definitions.colors.miscellaneous.body);
|
|
34
|
+
style.setProperty("--color-text-default", definitions.textColor.default);
|
|
35
|
+
style.setProperty("--color-surface-base", definitions.colors.surface.base);
|
|
36
|
+
style.setProperty("--color-surface-raised", definitions.colors.surface.raised);
|
|
37
|
+
style.setProperty("--color-surface-overlay", definitions.colors.surface.overlay);
|
|
38
|
+
style.setProperty("--color-content-primary", definitions.colors.content.primary);
|
|
39
|
+
style.setProperty("--color-content-secondary", definitions.colors.content.secondary);
|
|
40
|
+
style.setProperty("--color-content-tertiary", definitions.colors.content.tertiary);
|
|
41
|
+
style.setProperty("--color-content-disabled", definitions.colors.content.disabled);
|
|
42
|
+
style.setProperty("--color-content-inverse", definitions.colors.content.inverse);
|
|
23
43
|
}
|
|
24
44
|
}, [theme]);
|
|
25
45
|
const toggleTheme = () => setTheme((t) => t === "light" ? "dark" : "light");
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const darkColors = {
|
|
4
|
+
body: "#1e1e1e",
|
|
5
|
+
text: {
|
|
6
|
+
default: "#fff"
|
|
7
|
+
},
|
|
8
|
+
surface: {
|
|
9
|
+
base: "#1e1e1e",
|
|
10
|
+
raised: "#252526",
|
|
11
|
+
overlay: "#2d2d30"
|
|
12
|
+
},
|
|
13
|
+
content: {
|
|
14
|
+
primary: "#f8f7f7",
|
|
15
|
+
secondary: "#c2bfbc",
|
|
16
|
+
tertiary: "#85807a",
|
|
17
|
+
disabled: "#5d5955",
|
|
18
|
+
inverse: "#353231"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
3
21
|
const colors = {
|
|
4
22
|
primary: {
|
|
5
23
|
xlight: "var(--color-primary-xlight, #fef9f0)",
|
|
@@ -41,6 +59,13 @@ const colors = {
|
|
|
41
59
|
raised: "var(--color-surface-raised, #fbfbfb)",
|
|
42
60
|
overlay: "var(--color-surface-overlay, #ffffff)"
|
|
43
61
|
},
|
|
62
|
+
content: {
|
|
63
|
+
primary: "var(--color-content-primary, #353231)",
|
|
64
|
+
secondary: "var(--color-content-secondary, #5d5955)",
|
|
65
|
+
tertiary: "var(--color-content-tertiary, #85807a)",
|
|
66
|
+
disabled: "var(--color-content-disabled, #c2bfbc)",
|
|
67
|
+
inverse: "var(--color-content-inverse, #ffffff)"
|
|
68
|
+
},
|
|
44
69
|
error: {
|
|
45
70
|
xlight: "#fdf3f2",
|
|
46
71
|
light: "#ee9891",
|
|
@@ -183,6 +208,7 @@ exports.borderRadius = borderRadius;
|
|
|
183
208
|
exports.borderWidth = borderWidth;
|
|
184
209
|
exports.boxShadow = boxShadow;
|
|
185
210
|
exports.colors = colors;
|
|
211
|
+
exports.darkColors = darkColors;
|
|
186
212
|
exports.fontFamily = fontFamily;
|
|
187
213
|
exports.fontSize = fontSize;
|
|
188
214
|
exports.spacing = spacing;
|
package/dist/esm/index.js
CHANGED
|
@@ -18,6 +18,6 @@ export { styleInputElement, styleLabelElement, toggle } from './components/toggl
|
|
|
18
18
|
export { tooltip, tooltipContainer } from './components/tooltip/tooltip.js';
|
|
19
19
|
export { manager } from './components/manager/manager.js';
|
|
20
20
|
export { default as preset } from './preset/index.js';
|
|
21
|
-
export { borderColor, borderRadius, borderWidth, boxShadow, colors, fontFamily, fontSize, spacing, textColor, zIndex } from './tokens/definitions.js';
|
|
21
|
+
export { borderColor, borderRadius, borderWidth, boxShadow, colors, darkColors, fontFamily, fontSize, spacing, textColor, zIndex } from './tokens/definitions.js';
|
|
22
22
|
export { setDarkMode, updateThemeColors } from './utils/index.js';
|
|
23
23
|
export { ThemeProvider, useDarkTheme } from './provider/DarkThemeContext.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { createContext, useState, useEffect, useContext } from 'react';
|
|
3
|
+
import { darkColors, colors, textColor } from '../tokens/definitions.js';
|
|
3
4
|
|
|
4
5
|
const ThemeContext = createContext(null);
|
|
5
6
|
const ThemeProvider = ({ children }) => {
|
|
@@ -7,17 +8,36 @@ const ThemeProvider = ({ children }) => {
|
|
|
7
8
|
useEffect(() => {
|
|
8
9
|
const style = document.documentElement.style;
|
|
9
10
|
if (theme === "dark") {
|
|
10
|
-
style.setProperty("--color-body",
|
|
11
|
-
style.setProperty("--color-text-default",
|
|
12
|
-
style.setProperty("--color-surface-base",
|
|
13
|
-
style.setProperty("--color-surface-raised",
|
|
14
|
-
style.setProperty("--color-surface-overlay",
|
|
11
|
+
style.setProperty("--color-body", darkColors.body);
|
|
12
|
+
style.setProperty("--color-text-default", darkColors.text.default);
|
|
13
|
+
style.setProperty("--color-surface-base", darkColors.surface.base);
|
|
14
|
+
style.setProperty("--color-surface-raised", darkColors.surface.raised);
|
|
15
|
+
style.setProperty("--color-surface-overlay", darkColors.surface.overlay);
|
|
16
|
+
style.setProperty("--color-content-primary", darkColors.content.primary);
|
|
17
|
+
style.setProperty(
|
|
18
|
+
"--color-content-secondary",
|
|
19
|
+
darkColors.content.secondary
|
|
20
|
+
);
|
|
21
|
+
style.setProperty(
|
|
22
|
+
"--color-content-tertiary",
|
|
23
|
+
darkColors.content.tertiary
|
|
24
|
+
);
|
|
25
|
+
style.setProperty(
|
|
26
|
+
"--color-content-disabled",
|
|
27
|
+
darkColors.content.disabled
|
|
28
|
+
);
|
|
29
|
+
style.setProperty("--color-content-inverse", darkColors.content.inverse);
|
|
15
30
|
} else {
|
|
16
|
-
style.setProperty("--color-body",
|
|
17
|
-
style.setProperty("--color-text-default",
|
|
18
|
-
style.setProperty("--color-surface-base",
|
|
19
|
-
style.setProperty("--color-surface-raised",
|
|
20
|
-
style.setProperty("--color-surface-overlay",
|
|
31
|
+
style.setProperty("--color-body", colors.miscellaneous.body);
|
|
32
|
+
style.setProperty("--color-text-default", textColor.default);
|
|
33
|
+
style.setProperty("--color-surface-base", colors.surface.base);
|
|
34
|
+
style.setProperty("--color-surface-raised", colors.surface.raised);
|
|
35
|
+
style.setProperty("--color-surface-overlay", colors.surface.overlay);
|
|
36
|
+
style.setProperty("--color-content-primary", colors.content.primary);
|
|
37
|
+
style.setProperty("--color-content-secondary", colors.content.secondary);
|
|
38
|
+
style.setProperty("--color-content-tertiary", colors.content.tertiary);
|
|
39
|
+
style.setProperty("--color-content-disabled", colors.content.disabled);
|
|
40
|
+
style.setProperty("--color-content-inverse", colors.content.inverse);
|
|
21
41
|
}
|
|
22
42
|
}, [theme]);
|
|
23
43
|
const toggleTheme = () => setTheme((t) => t === "light" ? "dark" : "light");
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
const darkColors = {
|
|
2
|
+
body: "#1e1e1e",
|
|
3
|
+
text: {
|
|
4
|
+
default: "#fff"
|
|
5
|
+
},
|
|
6
|
+
surface: {
|
|
7
|
+
base: "#1e1e1e",
|
|
8
|
+
raised: "#252526",
|
|
9
|
+
overlay: "#2d2d30"
|
|
10
|
+
},
|
|
11
|
+
content: {
|
|
12
|
+
primary: "#f8f7f7",
|
|
13
|
+
secondary: "#c2bfbc",
|
|
14
|
+
tertiary: "#85807a",
|
|
15
|
+
disabled: "#5d5955",
|
|
16
|
+
inverse: "#353231"
|
|
17
|
+
}
|
|
18
|
+
};
|
|
1
19
|
const colors = {
|
|
2
20
|
primary: {
|
|
3
21
|
xlight: "var(--color-primary-xlight, #fef9f0)",
|
|
@@ -39,6 +57,13 @@ const colors = {
|
|
|
39
57
|
raised: "var(--color-surface-raised, #fbfbfb)",
|
|
40
58
|
overlay: "var(--color-surface-overlay, #ffffff)"
|
|
41
59
|
},
|
|
60
|
+
content: {
|
|
61
|
+
primary: "var(--color-content-primary, #353231)",
|
|
62
|
+
secondary: "var(--color-content-secondary, #5d5955)",
|
|
63
|
+
tertiary: "var(--color-content-tertiary, #85807a)",
|
|
64
|
+
disabled: "var(--color-content-disabled, #c2bfbc)",
|
|
65
|
+
inverse: "var(--color-content-inverse, #ffffff)"
|
|
66
|
+
},
|
|
42
67
|
error: {
|
|
43
68
|
xlight: "#fdf3f2",
|
|
44
69
|
light: "#ee9891",
|
|
@@ -176,4 +201,4 @@ const zIndex = {
|
|
|
176
201
|
modal: 1e3
|
|
177
202
|
};
|
|
178
203
|
|
|
179
|
-
export { borderColor, borderRadius, borderWidth, boxShadow, colors, fontFamily, fontSize, spacing, textColor, zIndex };
|
|
204
|
+
export { borderColor, borderRadius, borderWidth, boxShadow, colors, darkColors, fontFamily, fontSize, spacing, textColor, zIndex };
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
declare const darkColors: {
|
|
2
|
+
body: string;
|
|
3
|
+
text: {
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
surface: {
|
|
7
|
+
base: string;
|
|
8
|
+
raised: string;
|
|
9
|
+
overlay: string;
|
|
10
|
+
};
|
|
11
|
+
content: {
|
|
12
|
+
primary: string;
|
|
13
|
+
secondary: string;
|
|
14
|
+
tertiary: string;
|
|
15
|
+
disabled: string;
|
|
16
|
+
inverse: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
1
19
|
declare const colors: {
|
|
2
20
|
primary: {
|
|
3
21
|
xlight: string;
|
|
@@ -39,6 +57,13 @@ declare const colors: {
|
|
|
39
57
|
raised: string;
|
|
40
58
|
overlay: string;
|
|
41
59
|
};
|
|
60
|
+
content: {
|
|
61
|
+
primary: string;
|
|
62
|
+
secondary: string;
|
|
63
|
+
tertiary: string;
|
|
64
|
+
disabled: string;
|
|
65
|
+
inverse: string;
|
|
66
|
+
};
|
|
42
67
|
error: {
|
|
43
68
|
xlight: string;
|
|
44
69
|
light: string;
|
|
@@ -121,4 +146,4 @@ declare const zIndex: {
|
|
|
121
146
|
sidebar: number;
|
|
122
147
|
modal: number;
|
|
123
148
|
};
|
|
124
|
-
export { borderColor, borderRadius, borderWidth, boxShadow, colors, fontFamily, fontSize, spacing, textColor, zIndex, };
|
|
149
|
+
export { borderColor, borderRadius, borderWidth, boxShadow, colors, darkColors, fontFamily, fontSize, spacing, textColor, zIndex, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-core",
|
|
3
|
-
"version": "1.3.0-beta.
|
|
3
|
+
"version": "1.3.0-beta.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Core library for tailwindcss based design",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"tailwindcss": ">=3.3.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "f13be73645bde5042aeb082331dc6c6d80fb506e"
|
|
35
35
|
}
|