@docsplain-kit/core 0.0.46 → 0.0.48
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/accordion/accordion-content/accordion-content.js +17 -1
- package/accordion/accordion-content/accordion-content.js.map +1 -1
- package/accordion/accordion-header/accordion-header.js +16 -1
- package/accordion/accordion-header/accordion-header.js.map +1 -1
- package/accordion/accordion-item/accordion-item.js +20 -3
- package/accordion/accordion-item/accordion-item.js.map +1 -1
- package/accordion/accordion-item/accordion-item.style.d.ts +0 -33
- package/accordion/accordion-item/accordion-item.style.js +1 -34
- package/accordion/accordion-item/accordion-item.style.js.map +1 -1
- package/accordion/accordion-item/accordion-item.theme.d.ts +158 -0
- package/accordion/accordion-item/accordion-item.theme.js +171 -0
- package/accordion/accordion-item/accordion-item.theme.js.map +1 -0
- package/alert/alert-theme.d.ts +22 -0
- package/alert/alert-theme.js +60 -0
- package/alert/alert-theme.js.map +1 -0
- package/alert/alert.js +11 -2
- package/alert/alert.js.map +1 -1
- package/avatar/avatar-theme.d.ts +14 -0
- package/avatar/avatar-theme.js +81 -0
- package/avatar/avatar-theme.js.map +1 -0
- package/avatar/avatar.js +11 -1
- package/avatar/avatar.js.map +1 -1
- package/avatar/avatar.props.d.ts +1 -1
- package/avatar/index.d.ts +1 -1
- package/badge/badge-theme.d.ts +16 -0
- package/badge/badge-theme.js +82 -0
- package/badge/badge-theme.js.map +1 -0
- package/badge/badge.js +11 -1
- package/badge/badge.js.map +1 -1
- package/button/button.js +34 -1
- package/button/button.js.map +1 -1
- package/button/button.style.d.ts +1 -146
- package/button/button.style.js +1 -156
- package/button/button.style.js.map +1 -1
- package/button/button.theme.d.ts +314 -0
- package/button/button.theme.js +344 -0
- package/button/button.theme.js.map +1 -0
- package/checkbox/checkbox-theme.d.ts +16 -0
- package/checkbox/checkbox-theme.js +82 -0
- package/checkbox/checkbox-theme.js.map +1 -0
- package/checkbox/checkbox.js +13 -3
- package/checkbox/checkbox.js.map +1 -1
- package/chip/chip-theme.d.ts +370 -0
- package/chip/chip-theme.js +391 -0
- package/chip/chip-theme.js.map +1 -0
- package/chip/chip.js +19 -1
- package/chip/chip.js.map +1 -1
- package/index.d.ts +10 -8
- package/index.js +24 -15
- package/index.js.map +1 -1
- package/package.json +28 -28
- package/provider/docsplain-provider.d.ts +24 -0
- package/provider/docsplain-provider.js +47 -0
- package/provider/docsplain-provider.js.map +1 -0
- package/provider/docsplain-provider.types.d.ts +16 -0
- package/provider/docsplain-provider.types.js +3 -0
- package/provider/docsplain-provider.types.js.map +1 -0
- package/provider/hooks/index.d.ts +6 -0
- package/provider/hooks/index.js +25 -0
- package/provider/hooks/index.js.map +1 -0
- package/provider/hooks/use-font-size.d.ts +19 -0
- package/provider/hooks/use-font-size.js +102 -0
- package/provider/hooks/use-font-size.js.map +1 -0
- package/provider/hooks/use-responsive-font-size.d.ts +10 -0
- package/provider/hooks/use-responsive-font-size.js +24 -0
- package/provider/hooks/use-responsive-font-size.js.map +1 -0
- package/provider/hooks/use-text-direction.d.ts +12 -0
- package/provider/hooks/use-text-direction.js +20 -0
- package/provider/hooks/use-text-direction.js.map +1 -0
- package/provider/hooks/use-text-scale.d.ts +12 -0
- package/provider/hooks/use-text-scale.js +20 -0
- package/provider/hooks/use-text-scale.js.map +1 -0
- package/provider/hooks/use-theme.d.ts +12 -0
- package/provider/hooks/use-theme.js +20 -0
- package/provider/hooks/use-theme.js.map +1 -0
- package/provider/index.d.ts +3 -0
- package/provider/index.js +24 -0
- package/provider/index.js.map +1 -0
- package/radio-button/radio-button-theme.d.ts +25 -0
- package/radio-button/radio-button-theme.js +48 -0
- package/radio-button/radio-button-theme.js.map +1 -0
- package/radio-button/radio-button.js +12 -2
- package/radio-button/radio-button.js.map +1 -1
- package/spinner/spinner-theme.d.ts +14 -0
- package/spinner/spinner-theme.js +80 -0
- package/spinner/spinner-theme.js.map +1 -0
- package/spinner/spinner.js +11 -1
- package/spinner/spinner.js.map +1 -1
- package/switch-box/switch-box-theme.d.ts +14 -0
- package/switch-box/switch-box-theme.js +80 -0
- package/switch-box/switch-box-theme.js.map +1 -0
- package/switch-box/switch-box.js +32 -2
- package/switch-box/switch-box.js.map +1 -1
- package/text/text.js +39 -1
- package/text/text.js.map +1 -1
- package/text/text.theme.d.ts +23 -0
- package/text/text.theme.js +114 -0
- package/text/text.theme.js.map +1 -0
- package/theme/index.d.ts +6 -0
- package/theme/index.js +33 -0
- package/theme/index.js.map +1 -0
- package/theme/theme-utils.d.ts +87 -0
- package/theme/theme-utils.js +147 -0
- package/theme/theme-utils.js.map +1 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Theme } from '../provider';
|
|
2
|
+
/**
|
|
3
|
+
* Theme Utility Functions
|
|
4
|
+
*
|
|
5
|
+
* These utilities help you create consistent dark mode color schemes
|
|
6
|
+
* across all components.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Adjusts Tailwind color weight for dark mode
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* adjustColorWeight('bg-primary-500') // → 'bg-primary-400'
|
|
13
|
+
* adjustColorWeight('hover:bg-primary-700') // → 'hover:bg-primary-300'
|
|
14
|
+
*/
|
|
15
|
+
export declare const adjustColorWeight: (lightModeClass: string) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Inverts text color for better contrast in dark mode
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* invertTextColor('text-white') // → 'text-gray-900'
|
|
21
|
+
* invertTextColor('text-gray-900') // → 'text-gray-100'
|
|
22
|
+
*/
|
|
23
|
+
export declare const invertTextColor: (textClass: string) => string;
|
|
24
|
+
/**
|
|
25
|
+
* Converts control colors to dark mode grays
|
|
26
|
+
*/
|
|
27
|
+
export declare const convertControlColors: (controlClass: string) => string;
|
|
28
|
+
/**
|
|
29
|
+
* Helper to safely get theme from provider
|
|
30
|
+
* Returns 'light' if not in provider context
|
|
31
|
+
*/
|
|
32
|
+
export declare const useThemeSafe: () => Theme;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a theme selector function for component styles
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* const getStyles = createThemeSelector(STYLES_LIGHT, STYLES_DARK);
|
|
38
|
+
* const styles = getStyles(theme);
|
|
39
|
+
*/
|
|
40
|
+
export declare function createThemeSelector<T>(lightStyles: T, darkStyles: T): (theme: Theme) => T;
|
|
41
|
+
/**
|
|
42
|
+
* Merges light and dark color objects into a theme-aware getter
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* const getColor = createColorGetter(COLORS_LIGHT, COLORS_DARK);
|
|
46
|
+
* const color = getColor(theme, 'primary');
|
|
47
|
+
*/
|
|
48
|
+
export declare function createColorGetter<K extends string>(lightColors: Record<K, string>, darkColors: Record<K, string>): (theme: Theme, key: K) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Common background colors for dark mode
|
|
51
|
+
*/
|
|
52
|
+
export declare const DARK_BACKGROUNDS: {
|
|
53
|
+
page: string;
|
|
54
|
+
card: string;
|
|
55
|
+
elevated: string;
|
|
56
|
+
overlay: string;
|
|
57
|
+
subtle: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Common text colors for dark mode
|
|
61
|
+
*/
|
|
62
|
+
export declare const DARK_TEXT: {
|
|
63
|
+
primary: string;
|
|
64
|
+
secondary: string;
|
|
65
|
+
muted: string;
|
|
66
|
+
disabled: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Common border colors for dark mode
|
|
70
|
+
*/
|
|
71
|
+
export declare const DARK_BORDERS: {
|
|
72
|
+
default: string;
|
|
73
|
+
subtle: string;
|
|
74
|
+
strong: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Quick check if currently in dark theme
|
|
78
|
+
*/
|
|
79
|
+
export declare const isDarkTheme: () => boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Get theme-aware class conditionally
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* themeClass('bg-white', 'bg-gray-800')
|
|
85
|
+
* // Returns 'bg-white' in light, 'bg-gray-800' in dark
|
|
86
|
+
*/
|
|
87
|
+
export declare const themeClass: (lightClass: string, darkClass: string) => string;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.themeClass = exports.isDarkTheme = exports.DARK_BORDERS = exports.DARK_TEXT = exports.DARK_BACKGROUNDS = exports.createColorGetter = exports.createThemeSelector = exports.useThemeSafe = exports.convertControlColors = exports.invertTextColor = exports.adjustColorWeight = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Theme Utility Functions
|
|
6
|
+
*
|
|
7
|
+
* These utilities help you create consistent dark mode color schemes
|
|
8
|
+
* across all components.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Adjusts Tailwind color weight for dark mode
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* adjustColorWeight('bg-primary-500') // → 'bg-primary-400'
|
|
15
|
+
* adjustColorWeight('hover:bg-primary-700') // → 'hover:bg-primary-300'
|
|
16
|
+
*/
|
|
17
|
+
var adjustColorWeight = function (lightModeClass) {
|
|
18
|
+
return lightModeClass
|
|
19
|
+
.replace(/-50\b/g, '-900/40')
|
|
20
|
+
.replace(/-100\b/g, '-900/30')
|
|
21
|
+
.replace(/-200\b/g, '-800')
|
|
22
|
+
.replace(/-300\b/g, '-700')
|
|
23
|
+
.replace(/-500\b/g, '-400')
|
|
24
|
+
.replace(/-700\b/g, '-300')
|
|
25
|
+
.replace(/-800\b/g, '-200')
|
|
26
|
+
.replace(/-900\b/g, '-100');
|
|
27
|
+
};
|
|
28
|
+
exports.adjustColorWeight = adjustColorWeight;
|
|
29
|
+
/**
|
|
30
|
+
* Inverts text color for better contrast in dark mode
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* invertTextColor('text-white') // → 'text-gray-900'
|
|
34
|
+
* invertTextColor('text-gray-900') // → 'text-gray-100'
|
|
35
|
+
*/
|
|
36
|
+
var invertTextColor = function (textClass) {
|
|
37
|
+
return textClass
|
|
38
|
+
.replace(/text-white\b/g, 'text-gray-900')
|
|
39
|
+
.replace(/text-black\b/g, 'text-gray-100')
|
|
40
|
+
.replace(/text-gray-900\b/g, 'text-gray-100');
|
|
41
|
+
};
|
|
42
|
+
exports.invertTextColor = invertTextColor;
|
|
43
|
+
/**
|
|
44
|
+
* Converts control colors to dark mode grays
|
|
45
|
+
*/
|
|
46
|
+
var convertControlColors = function (controlClass) {
|
|
47
|
+
return controlClass
|
|
48
|
+
.replace(/control-50\b/g, 'gray-800')
|
|
49
|
+
.replace(/control-100\b/g, 'gray-800')
|
|
50
|
+
.replace(/control-300\b/g, 'gray-700')
|
|
51
|
+
.replace(/control-500\b/g, 'gray-600')
|
|
52
|
+
.replace(/control-700\b/g, 'gray-500')
|
|
53
|
+
.replace(/control-dark\b/g, 'gray-600')
|
|
54
|
+
.replace(/control-light\b/g, 'gray-600')
|
|
55
|
+
.replace(/\bcontrol\b/g, 'gray-600');
|
|
56
|
+
};
|
|
57
|
+
exports.convertControlColors = convertControlColors;
|
|
58
|
+
/**
|
|
59
|
+
* Helper to safely get theme from provider
|
|
60
|
+
* Returns 'light' if not in provider context
|
|
61
|
+
*/
|
|
62
|
+
var useThemeSafe = function () {
|
|
63
|
+
var theme = 'light';
|
|
64
|
+
try {
|
|
65
|
+
var useTheme = require('../provider').useTheme;
|
|
66
|
+
theme = useTheme();
|
|
67
|
+
}
|
|
68
|
+
catch (_a) {
|
|
69
|
+
// Not in provider, use default
|
|
70
|
+
}
|
|
71
|
+
return theme;
|
|
72
|
+
};
|
|
73
|
+
exports.useThemeSafe = useThemeSafe;
|
|
74
|
+
/**
|
|
75
|
+
* Creates a theme selector function for component styles
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* const getStyles = createThemeSelector(STYLES_LIGHT, STYLES_DARK);
|
|
79
|
+
* const styles = getStyles(theme);
|
|
80
|
+
*/
|
|
81
|
+
function createThemeSelector(lightStyles, darkStyles) {
|
|
82
|
+
return function (theme) {
|
|
83
|
+
return theme === 'dark' ? darkStyles : lightStyles;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
exports.createThemeSelector = createThemeSelector;
|
|
87
|
+
/**
|
|
88
|
+
* Merges light and dark color objects into a theme-aware getter
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* const getColor = createColorGetter(COLORS_LIGHT, COLORS_DARK);
|
|
92
|
+
* const color = getColor(theme, 'primary');
|
|
93
|
+
*/
|
|
94
|
+
function createColorGetter(lightColors, darkColors) {
|
|
95
|
+
return function (theme, key) {
|
|
96
|
+
var colors = theme === 'dark' ? darkColors : lightColors;
|
|
97
|
+
return colors[key];
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
exports.createColorGetter = createColorGetter;
|
|
101
|
+
/**
|
|
102
|
+
* Common background colors for dark mode
|
|
103
|
+
*/
|
|
104
|
+
exports.DARK_BACKGROUNDS = {
|
|
105
|
+
page: 'bg-gray-900',
|
|
106
|
+
card: 'bg-gray-800',
|
|
107
|
+
elevated: 'bg-gray-700',
|
|
108
|
+
overlay: 'bg-black/50',
|
|
109
|
+
subtle: 'bg-gray-800/50'
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Common text colors for dark mode
|
|
113
|
+
*/
|
|
114
|
+
exports.DARK_TEXT = {
|
|
115
|
+
primary: 'text-gray-100',
|
|
116
|
+
secondary: 'text-gray-400',
|
|
117
|
+
muted: 'text-gray-500',
|
|
118
|
+
disabled: 'text-gray-600'
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Common border colors for dark mode
|
|
122
|
+
*/
|
|
123
|
+
exports.DARK_BORDERS = {
|
|
124
|
+
"default": 'border-gray-700',
|
|
125
|
+
subtle: 'border-gray-800',
|
|
126
|
+
strong: 'border-gray-600'
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Quick check if currently in dark theme
|
|
130
|
+
*/
|
|
131
|
+
var isDarkTheme = function () {
|
|
132
|
+
return (0, exports.useThemeSafe)() === 'dark';
|
|
133
|
+
};
|
|
134
|
+
exports.isDarkTheme = isDarkTheme;
|
|
135
|
+
/**
|
|
136
|
+
* Get theme-aware class conditionally
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* themeClass('bg-white', 'bg-gray-800')
|
|
140
|
+
* // Returns 'bg-white' in light, 'bg-gray-800' in dark
|
|
141
|
+
*/
|
|
142
|
+
var themeClass = function (lightClass, darkClass) {
|
|
143
|
+
var theme = (0, exports.useThemeSafe)();
|
|
144
|
+
return theme === 'dark' ? darkClass : lightClass;
|
|
145
|
+
};
|
|
146
|
+
exports.themeClass = themeClass;
|
|
147
|
+
//# sourceMappingURL=theme-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-utils.js","sourceRoot":"","sources":["../../theme/theme-utils.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AAEH;;;;;;GAMG;AACI,IAAM,iBAAiB,GAAG,UAAC,cAAsB;IACtD,OAAO,cAAc;SAClB,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC;SAC5B,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC;SAC7B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAChC,CAAC,CAAC;AAVW,QAAA,iBAAiB,qBAU5B;AAEF;;;;;;GAMG;AACI,IAAM,eAAe,GAAG,UAAC,SAAiB;IAC/C,OAAO,SAAS;SACb,OAAO,CAAC,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