@udixio/theme 1.0.0-beta.22 → 1.0.0-beta.24
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/config/config.interface.d.ts +3 -3
- package/dist/plugins/font/font.plugin.d.ts +1 -1
- package/dist/plugins/tailwind/plugins-tailwind/themer.d.ts +10 -4
- package/dist/plugins/tailwind/tailwind.plugin.d.ts +3 -2
- package/dist/theme.cjs.development.js +59 -7
- package/dist/theme.cjs.development.js.map +1 -1
- package/dist/theme.cjs.production.min.js +1 -1
- package/dist/theme.cjs.production.min.js.map +1 -1
- package/dist/theme.esm.js +59 -7
- package/dist/theme.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/config/config.interface.ts +3 -3
- package/src/plugins/font/font.plugin.ts +1 -1
- package/src/plugins/tailwind/plugins-tailwind/themer.ts +82 -9
- package/src/plugins/tailwind/tailwind.plugin.ts +10 -5
package/dist/theme.esm.js
CHANGED
|
@@ -1865,7 +1865,25 @@ var addAllNewComponents = function addAllNewComponents(_ref, _ref2, colorKeys) {
|
|
|
1865
1865
|
addComponents(newComponents);
|
|
1866
1866
|
};
|
|
1867
1867
|
|
|
1868
|
-
|
|
1868
|
+
function createSubTheme(_ref) {
|
|
1869
|
+
var name = _ref.name,
|
|
1870
|
+
darkMode = _ref.darkMode,
|
|
1871
|
+
isDarkTheme = _ref.isDarkTheme,
|
|
1872
|
+
colors = _ref.colors;
|
|
1873
|
+
var theme = {
|
|
1874
|
+
name: isDarkTheme ? name + 'Dark' : name,
|
|
1875
|
+
selectors: isDarkTheme && darkMode === 'class' ? ['.dark-mode .theme-' + name, '.dark-mode.theme-' + name, '[data-theme="dark"] .theme-' + name, '[data-theme="dark"].theme-' + name] : ['.theme-' + name],
|
|
1876
|
+
mediaQuery: '@media (prefers-color-scheme: dark)',
|
|
1877
|
+
extend: {
|
|
1878
|
+
colors: colors
|
|
1879
|
+
}
|
|
1880
|
+
};
|
|
1881
|
+
return theme;
|
|
1882
|
+
}
|
|
1883
|
+
var themer = function themer(args) {
|
|
1884
|
+
var _args$appService = args.appService,
|
|
1885
|
+
themeService = _args$appService.themeService,
|
|
1886
|
+
colorService = _args$appService.colorService;
|
|
1869
1887
|
var options = {
|
|
1870
1888
|
defaultTheme: {
|
|
1871
1889
|
extend: {
|
|
@@ -1879,14 +1897,43 @@ var themer = function themer(colors, darkMode) {
|
|
|
1879
1897
|
}
|
|
1880
1898
|
}]
|
|
1881
1899
|
};
|
|
1882
|
-
Object.entries(colors).forEach(function (
|
|
1883
|
-
var key =
|
|
1884
|
-
value =
|
|
1900
|
+
Object.entries(args.colors).forEach(function (_ref2) {
|
|
1901
|
+
var key = _ref2[0],
|
|
1902
|
+
value = _ref2[1];
|
|
1885
1903
|
options.defaultTheme.extend.colors[key] = value.light;
|
|
1886
1904
|
options.themes[0].extend.colors[key] = value.dark;
|
|
1887
1905
|
});
|
|
1888
|
-
options.themes[0].selectors = darkMode === 'class' ? ['.dark-mode', '[data-theme="dark"]'] : undefined;
|
|
1889
|
-
options.themes[0].mediaQuery = darkMode === 'media' ? '@media (prefers-color-scheme: dark)' : undefined;
|
|
1906
|
+
options.themes[0].selectors = args.darkMode === 'class' ? ['.dark-mode', '[data-theme="dark"]'] : undefined;
|
|
1907
|
+
options.themes[0].mediaQuery = args.darkMode === 'media' ? '@media (prefers-color-scheme: dark)' : undefined;
|
|
1908
|
+
if (args.subThemes) {
|
|
1909
|
+
Object.entries(args.subThemes).forEach(function (_ref3) {
|
|
1910
|
+
var key = _ref3[0],
|
|
1911
|
+
value = _ref3[1];
|
|
1912
|
+
themeService.update({
|
|
1913
|
+
sourceColorHex: value
|
|
1914
|
+
});
|
|
1915
|
+
for (var _i = 0, _arr = [true, false]; _i < _arr.length; _i++) {
|
|
1916
|
+
var isDarkTheme = _arr[_i];
|
|
1917
|
+
var colors = {};
|
|
1918
|
+
themeService.update({
|
|
1919
|
+
isDark: isDarkTheme
|
|
1920
|
+
});
|
|
1921
|
+
for (var _iterator = _createForOfIteratorHelperLoose(colorService.getColors().entries()), _step; !(_step = _iterator()).done;) {
|
|
1922
|
+
var _step$value = _step.value,
|
|
1923
|
+
_key = _step$value[0],
|
|
1924
|
+
_value = _step$value[1];
|
|
1925
|
+
var newKey = _key.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();
|
|
1926
|
+
colors[newKey] = _value.getHex();
|
|
1927
|
+
}
|
|
1928
|
+
options.themes.push(createSubTheme({
|
|
1929
|
+
name: key,
|
|
1930
|
+
isDarkTheme: isDarkTheme,
|
|
1931
|
+
darkMode: args.darkMode,
|
|
1932
|
+
colors: colors
|
|
1933
|
+
}));
|
|
1934
|
+
}
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1890
1937
|
return require('tailwindcss-themer')(options);
|
|
1891
1938
|
};
|
|
1892
1939
|
|
|
@@ -1988,7 +2035,12 @@ var TailwindPlugin = /*#__PURE__*/function (_PluginAbstract) {
|
|
|
1988
2035
|
return {
|
|
1989
2036
|
colors: {},
|
|
1990
2037
|
fontFamily: fontFamily,
|
|
1991
|
-
plugins: [state(Object.keys(colors)),
|
|
2038
|
+
plugins: [state(Object.keys(colors)), font(fontStyles, this.options.responsiveBreakPoints), themer({
|
|
2039
|
+
colors: colors,
|
|
2040
|
+
darkMode: this.options.darkMode,
|
|
2041
|
+
subThemes: this.options.subThemes,
|
|
2042
|
+
appService: this.appService
|
|
2043
|
+
})]
|
|
1992
2044
|
};
|
|
1993
2045
|
};
|
|
1994
2046
|
return TailwindPlugin;
|