@remember-web/mixin 0.4.6 → 0.4.7
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.
|
@@ -35,7 +35,11 @@ function getThemeCssFragment(_ref2) {
|
|
|
35
35
|
var _ref4 = _slicedToArray__default.default(_ref3, 2),
|
|
36
36
|
key = _ref4[0],
|
|
37
37
|
value = _ref4[1];
|
|
38
|
-
|
|
38
|
+
var baseDeclaration = "".concat(key, ": ").concat(value, ";");
|
|
39
|
+
if (typeof value === 'string' && value.startsWith('#')) {
|
|
40
|
+
return "".concat(baseDeclaration, " ").concat(key, "__rgb: ").concat(utils.hexToRgb(value), ";");
|
|
41
|
+
}
|
|
42
|
+
return baseDeclaration;
|
|
39
43
|
});
|
|
40
44
|
}
|
|
41
45
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.cjs.js","sources":["../../../src/provider/styles.ts"],"sourcesContent":["'use client';\n\nimport { createGlobalStyle, css } from 'styled-components';\n\nimport { type ColorThemeType, type ThemeType, hexToRgb } from '@/colors';\nimport { RUI_COLOR_THEME } from '@/colors/theme';\n\nexport const RUIGlobalStyle = createGlobalStyle<{\n customMixins?: ColorThemeType;\n forceTheme?: ThemeType;\n}>(\n ({ customMixins, forceTheme }) => css`\n :root {\n ${getThemeCssFragment({ theme: forceTheme || 'light', customMixins })};\n\n @media (prefers-color-scheme: dark) {\n ${getThemeCssFragment({ theme: forceTheme || 'dark', customMixins })}\n }\n }\n `\n);\n\nfunction getThemeCssFragment({\n theme,\n customMixins,\n}: {\n theme: ThemeType;\n customMixins?: ColorThemeType;\n}) {\n return Object.entries({\n ...RUI_COLOR_THEME[theme],\n ...customMixins?.[theme],\n }).map(\n ([key, value]) => `${key}: ${value}
|
|
1
|
+
{"version":3,"file":"styles.cjs.js","sources":["../../../src/provider/styles.ts"],"sourcesContent":["'use client';\n\nimport { createGlobalStyle, css } from 'styled-components';\n\nimport { type ColorThemeType, type ThemeType, hexToRgb } from '@/colors';\nimport { RUI_COLOR_THEME } from '@/colors/theme';\n\nexport const RUIGlobalStyle = createGlobalStyle<{\n customMixins?: ColorThemeType;\n forceTheme?: ThemeType;\n}>(\n ({ customMixins, forceTheme }) => css`\n :root {\n ${getThemeCssFragment({ theme: forceTheme || 'light', customMixins })};\n\n @media (prefers-color-scheme: dark) {\n ${getThemeCssFragment({ theme: forceTheme || 'dark', customMixins })}\n }\n }\n `\n);\n\nfunction getThemeCssFragment({\n theme,\n customMixins,\n}: {\n theme: ThemeType;\n customMixins?: ColorThemeType;\n}) {\n return Object.entries({\n ...RUI_COLOR_THEME[theme],\n ...customMixins?.[theme],\n }).map(\n ([key, value]) => {\n const baseDeclaration = `${key}: ${value};`;\n if (typeof value === 'string' && value.startsWith('#')) {\n return `${baseDeclaration} ${key}__rgb: ${hexToRgb(value)};`;\n }\n return baseDeclaration; \n }\n );\n}\n"],"names":["customMixins","key","value"],"mappings":";;;;;;;;;;;;;;;;AAAa;AAAA;AAAA;;AAWX;;;;AAE0DA;;;AAGCA;AAAa;AAAE;AAM5E;AAMG;;AACD;AAIoB;AAAhBC;AAAKC;;;AAGH;AACF;AACA;AACF;AAEJ;;"}
|
|
@@ -27,7 +27,11 @@ function getThemeCssFragment(_ref2) {
|
|
|
27
27
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
28
28
|
key = _ref4[0],
|
|
29
29
|
value = _ref4[1];
|
|
30
|
-
|
|
30
|
+
var baseDeclaration = "".concat(key, ": ").concat(value, ";");
|
|
31
|
+
if (typeof value === 'string' && value.startsWith('#')) {
|
|
32
|
+
return "".concat(baseDeclaration, " ").concat(key, "__rgb: ").concat(hexToRgb(value), ";");
|
|
33
|
+
}
|
|
34
|
+
return baseDeclaration;
|
|
31
35
|
});
|
|
32
36
|
}
|
|
33
37
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.esm.js","sources":["../../../src/provider/styles.ts"],"sourcesContent":["'use client';\n\nimport { createGlobalStyle, css } from 'styled-components';\n\nimport { type ColorThemeType, type ThemeType, hexToRgb } from '@/colors';\nimport { RUI_COLOR_THEME } from '@/colors/theme';\n\nexport const RUIGlobalStyle = createGlobalStyle<{\n customMixins?: ColorThemeType;\n forceTheme?: ThemeType;\n}>(\n ({ customMixins, forceTheme }) => css`\n :root {\n ${getThemeCssFragment({ theme: forceTheme || 'light', customMixins })};\n\n @media (prefers-color-scheme: dark) {\n ${getThemeCssFragment({ theme: forceTheme || 'dark', customMixins })}\n }\n }\n `\n);\n\nfunction getThemeCssFragment({\n theme,\n customMixins,\n}: {\n theme: ThemeType;\n customMixins?: ColorThemeType;\n}) {\n return Object.entries({\n ...RUI_COLOR_THEME[theme],\n ...customMixins?.[theme],\n }).map(\n ([key, value]) => `${key}: ${value}
|
|
1
|
+
{"version":3,"file":"styles.esm.js","sources":["../../../src/provider/styles.ts"],"sourcesContent":["'use client';\n\nimport { createGlobalStyle, css } from 'styled-components';\n\nimport { type ColorThemeType, type ThemeType, hexToRgb } from '@/colors';\nimport { RUI_COLOR_THEME } from '@/colors/theme';\n\nexport const RUIGlobalStyle = createGlobalStyle<{\n customMixins?: ColorThemeType;\n forceTheme?: ThemeType;\n}>(\n ({ customMixins, forceTheme }) => css`\n :root {\n ${getThemeCssFragment({ theme: forceTheme || 'light', customMixins })};\n\n @media (prefers-color-scheme: dark) {\n ${getThemeCssFragment({ theme: forceTheme || 'dark', customMixins })}\n }\n }\n `\n);\n\nfunction getThemeCssFragment({\n theme,\n customMixins,\n}: {\n theme: ThemeType;\n customMixins?: ColorThemeType;\n}) {\n return Object.entries({\n ...RUI_COLOR_THEME[theme],\n ...customMixins?.[theme],\n }).map(\n ([key, value]) => {\n const baseDeclaration = `${key}: ${value};`;\n if (typeof value === 'string' && value.startsWith('#')) {\n return `${baseDeclaration} ${key}__rgb: ${hexToRgb(value)};`;\n }\n return baseDeclaration; \n }\n );\n}\n"],"names":["customMixins","key","value"],"mappings":";;;;;;;;AAAa;AAAA;AAAA;;AAWX;;;;AAE0DA;;;AAGCA;AAAa;AAAE;AAM5E;AAMG;;AACD;AAIoB;AAAhBC;AAAKC;;;AAGH;AACF;AACA;AACF;AAEJ;;"}
|
package/package.json
CHANGED
package/src/provider/styles.ts
CHANGED
|
@@ -31,6 +31,12 @@ function getThemeCssFragment({
|
|
|
31
31
|
...RUI_COLOR_THEME[theme],
|
|
32
32
|
...customMixins?.[theme],
|
|
33
33
|
}).map(
|
|
34
|
-
([key, value]) =>
|
|
34
|
+
([key, value]) => {
|
|
35
|
+
const baseDeclaration = `${key}: ${value};`;
|
|
36
|
+
if (typeof value === 'string' && value.startsWith('#')) {
|
|
37
|
+
return `${baseDeclaration} ${key}__rgb: ${hexToRgb(value)};`;
|
|
38
|
+
}
|
|
39
|
+
return baseDeclaration;
|
|
40
|
+
}
|
|
35
41
|
);
|
|
36
42
|
}
|