@tecsinapse/cortex-core 1.3.0-beta.2 → 1.3.0-beta.4

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 CHANGED
@@ -69,12 +69,12 @@ 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;
75
76
  exports.textColor = definitions.textColor;
76
77
  exports.zIndex = definitions.zIndex;
77
- exports.setDarkMode = index$1.setDarkMode;
78
78
  exports.updateThemeColors = index$1.updateThemeColors;
79
79
  exports.ThemeProvider = DarkThemeContext.ThemeProvider;
80
80
  exports.useDarkTheme = DarkThemeContext.useDarkTheme;
@@ -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,27 @@ const ThemeProvider = ({ children }) => {
9
10
  react.useEffect(() => {
10
11
  const style = document.documentElement.style;
11
12
  if (theme === "dark") {
12
- style.setProperty("--color-body", "#1e1e1e");
13
- style.setProperty("--color-text-default", "#fff");
14
- style.setProperty("--color-surface-base", "#1e1e1e");
15
- style.setProperty("--color-surface-raised", "#252526");
16
- style.setProperty("--color-surface-overlay", "#2d2d30");
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-high", definitions.darkColors.content.high);
19
+ style.setProperty("--color-content-medium", definitions.darkColors.content.medium);
20
+ style.setProperty("--color-content-low", definitions.darkColors.content.low);
21
+ style.setProperty("--color-content-minimal", definitions.darkColors.content.minimal);
22
+ style.setProperty("--color-content-inverse", definitions.darkColors.content.inverse);
17
23
  } else {
18
- style.setProperty("--color-body", "#f8f7f7");
19
- style.setProperty("--color-text-default", "#000");
20
- style.setProperty("--color-surface-base", "#f8f7f7");
21
- style.setProperty("--color-surface-raised", "#fbfbfb");
22
- style.setProperty("--color-surface-overlay", "#ffffff");
24
+ style.setProperty("--color-body", definitions.colors.miscellaneous.body);
25
+ style.setProperty("--color-text-default", definitions.textColor.default);
26
+ style.setProperty("--color-surface-base", definitions.colors.surface.base);
27
+ style.setProperty("--color-surface-raised", definitions.colors.surface.raised);
28
+ style.setProperty("--color-surface-overlay", definitions.colors.surface.overlay);
29
+ style.setProperty("--color-content-high", definitions.colors.content.high);
30
+ style.setProperty("--color-content-medium", definitions.colors.content.medium);
31
+ style.setProperty("--color-content-low", definitions.colors.content.low);
32
+ style.setProperty("--color-content-minimal", definitions.colors.content.minimal);
33
+ style.setProperty("--color-content-inverse", definitions.colors.content.inverse);
23
34
  }
24
35
  }, [theme]);
25
36
  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
+ high: "#f8f7f7",
15
+ medium: "#c2bfbc",
16
+ low: "#85807a",
17
+ minimal: "#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
+ high: "var(--color-content-high, #353231)",
64
+ medium: "var(--color-content-medium, #5d5955)",
65
+ low: "var(--color-content-low, #85807a)",
66
+ minimal: "var(--color-content-minimal, #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;
@@ -10,15 +10,5 @@ const updateThemeColors = (theme) => {
10
10
  });
11
11
  });
12
12
  };
13
- const setDarkMode = () => {
14
- const style = document.documentElement.style;
15
- const isDark = style.getPropertyValue("--color-body") !== "#f8f7f7";
16
- if (!isDark) {
17
- style.setProperty("--color-body", "#1e1e1e");
18
- } else {
19
- style.setProperty("--color-body", "#f8f7f7");
20
- }
21
- };
22
13
 
23
- exports.setDarkMode = setDarkMode;
24
14
  exports.updateThemeColors = updateThemeColors;
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';
22
- export { setDarkMode, updateThemeColors } from './utils/index.js';
21
+ export { borderColor, borderRadius, borderWidth, boxShadow, colors, darkColors, fontFamily, fontSize, spacing, textColor, zIndex } from './tokens/definitions.js';
22
+ export { 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,27 @@ const ThemeProvider = ({ children }) => {
7
8
  useEffect(() => {
8
9
  const style = document.documentElement.style;
9
10
  if (theme === "dark") {
10
- style.setProperty("--color-body", "#1e1e1e");
11
- style.setProperty("--color-text-default", "#fff");
12
- style.setProperty("--color-surface-base", "#1e1e1e");
13
- style.setProperty("--color-surface-raised", "#252526");
14
- style.setProperty("--color-surface-overlay", "#2d2d30");
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-high", darkColors.content.high);
17
+ style.setProperty("--color-content-medium", darkColors.content.medium);
18
+ style.setProperty("--color-content-low", darkColors.content.low);
19
+ style.setProperty("--color-content-minimal", darkColors.content.minimal);
20
+ style.setProperty("--color-content-inverse", darkColors.content.inverse);
15
21
  } else {
16
- style.setProperty("--color-body", "#f8f7f7");
17
- style.setProperty("--color-text-default", "#000");
18
- style.setProperty("--color-surface-base", "#f8f7f7");
19
- style.setProperty("--color-surface-raised", "#fbfbfb");
20
- style.setProperty("--color-surface-overlay", "#ffffff");
22
+ style.setProperty("--color-body", colors.miscellaneous.body);
23
+ style.setProperty("--color-text-default", textColor.default);
24
+ style.setProperty("--color-surface-base", colors.surface.base);
25
+ style.setProperty("--color-surface-raised", colors.surface.raised);
26
+ style.setProperty("--color-surface-overlay", colors.surface.overlay);
27
+ style.setProperty("--color-content-high", colors.content.high);
28
+ style.setProperty("--color-content-medium", colors.content.medium);
29
+ style.setProperty("--color-content-low", colors.content.low);
30
+ style.setProperty("--color-content-minimal", colors.content.minimal);
31
+ style.setProperty("--color-content-inverse", colors.content.inverse);
21
32
  }
22
33
  }, [theme]);
23
34
  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
+ high: "#f8f7f7",
13
+ medium: "#c2bfbc",
14
+ low: "#85807a",
15
+ minimal: "#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
+ high: "var(--color-content-high, #353231)",
62
+ medium: "var(--color-content-medium, #5d5955)",
63
+ low: "var(--color-content-low, #85807a)",
64
+ minimal: "var(--color-content-minimal, #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 };
@@ -8,14 +8,5 @@ const updateThemeColors = (theme) => {
8
8
  });
9
9
  });
10
10
  };
11
- const setDarkMode = () => {
12
- const style = document.documentElement.style;
13
- const isDark = style.getPropertyValue("--color-body") !== "#f8f7f7";
14
- if (!isDark) {
15
- style.setProperty("--color-body", "#1e1e1e");
16
- } else {
17
- style.setProperty("--color-body", "#f8f7f7");
18
- }
19
- };
20
11
 
21
- export { setDarkMode, updateThemeColors };
12
+ export { updateThemeColors };
@@ -46,6 +46,13 @@ declare const preset: {
46
46
  raised: string;
47
47
  overlay: string;
48
48
  };
49
+ content: {
50
+ high: string;
51
+ medium: string;
52
+ low: string;
53
+ minimal: string;
54
+ inverse: string;
55
+ };
49
56
  error: {
50
57
  xlight: string;
51
58
  light: string;
@@ -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
+ high: string;
13
+ medium: string;
14
+ low: string;
15
+ minimal: 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
+ high: string;
62
+ medium: string;
63
+ low: string;
64
+ minimal: 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, };
@@ -1,3 +1,2 @@
1
1
  import { colors } from '../tokens/definitions';
2
2
  export declare const updateThemeColors: (theme: Partial<typeof colors>) => void;
3
- export declare const setDarkMode: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tecsinapse/cortex-core",
3
- "version": "1.3.0-beta.2",
3
+ "version": "1.3.0-beta.4",
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": "5365cc6cb2202caec12950731aff22afcc24ccbb"
34
+ "gitHead": "b874e5cbb323a24981bb9d6e2e1f1d2ccf454b0a"
35
35
  }