@sproutsocial/seeds-react-theme 4.3.0 → 4.4.0

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.
Files changed (37) hide show
  1. package/README.md +21 -14
  2. package/commonjs/builders/buildCSS.js +5 -0
  3. package/commonjs/builders/buildTailwindV4.js +32 -14
  4. package/commonjs/builders/buildThemeSCSS.js +56 -0
  5. package/commonjs/builders/utils.js +35 -18
  6. package/commonjs/dark/theme.js +9 -2
  7. package/commonjs/light/theme.js +13 -5
  8. package/dist/tailwind-preset.css +5 -0
  9. package/dist/theme-all.css +14 -2
  10. package/dist/theme-dark.css +7 -1
  11. package/dist/theme.css +7 -1
  12. package/dist/themes/dark/_themed.scss +7 -3
  13. package/dist/themes/dark/theme.scss +10 -4
  14. package/dist/themes/extendedThemes/sproutTheme/dark/_themed.scss +7 -3
  15. package/dist/themes/extendedThemes/sproutTheme/dark/theme.scss +5 -2
  16. package/dist/themes/extendedThemes/sproutTheme/light/_themed.scss +7 -3
  17. package/dist/themes/extendedThemes/sproutTheme/light/theme.scss +5 -2
  18. package/dist/themes/light/_themed.scss +7 -3
  19. package/dist/themes/light/theme.scss +10 -4
  20. package/dist/types/builders/buildCSS.d.ts.map +1 -1
  21. package/dist/types/builders/buildTailwindV4.d.ts.map +1 -1
  22. package/dist/types/builders/buildThemeSCSS.d.ts +2 -0
  23. package/dist/types/builders/buildThemeSCSS.d.ts.map +1 -0
  24. package/dist/types/builders/utils.d.ts +4 -0
  25. package/dist/types/builders/utils.d.ts.map +1 -1
  26. package/dist/types/dark/theme.d.ts +6 -0
  27. package/dist/types/dark/theme.d.ts.map +1 -1
  28. package/dist/types/light/theme.d.ts +6 -0
  29. package/dist/types/light/theme.d.ts.map +1 -1
  30. package/lib/builders/buildCSS.js +6 -1
  31. package/lib/builders/buildTailwindV4.js +32 -14
  32. package/lib/builders/buildThemeSCSS.js +50 -0
  33. package/lib/builders/utils.js +34 -18
  34. package/lib/dark/theme.js +9 -2
  35. package/lib/light/theme.js +13 -5
  36. package/package.json +10 -5
  37. package/dist/themes/types/_themed.scss +0 -126
@@ -1,126 +0,0 @@
1
- // Inspired by https://medium.com/@katiemctigue/how-to-create-a-dark-mode-in-sass-609f131a3995
2
- // This file is excluded from stylelint, because stylelint is only set up to lint styled-components at the moment.
3
-
4
- // SET-UP
5
- // theme.scss is auto-generated based on the JS theme file, ensuring our SCSS theme variables stay in sync.
6
- // _themed.scss will be copied to each theme folder in /dist, where the theme.scss file for that theme will be.
7
- @import "./theme.scss";
8
-
9
- // CSS custom properties for values that can't be represented in SCSS maps.
10
- // radial-gradient + color-mix() breaks SCSS map parsing, so the theme object
11
- // holds a var() reference and the actual value is defined here.
12
- :root {
13
- --color-container-bg-ai-generated: radial-gradient(circle at bottom left, color-mix(in srgb, #205bc3, transparent 80%) 0%, color-mix(in srgb, #6f5ed3, transparent 80%) 61%, color-mix(in srgb, #f282f5, transparent 80%) 100%), #f3f4f4;
14
- }
15
-
16
- // In the JS theme file, the theme object is exported as "default" (i.e., using "export default"),
17
- // so we need to map-get "default" to access it.
18
- $theme: map-get($theme, "default");
19
-
20
- // FUNCTIONS
21
- // This function will allow you to get any value from the theme.
22
- // @param {string} $key - the period-separated path to the value in the theme object. e.g., "colors.text.body"
23
- @function t($key) {
24
- $keys: _str-split($key, ".");
25
- @return _map-deep-get($theme, $keys);
26
- }
27
-
28
- // The rest of the functions are convenience methods to get theme values for subsets of the theme.
29
- // @param {string} $key - the period-separated path to the value in the theme object, with "colors." omitted. e.g., "text.body"
30
- @function colors($key) {
31
- $keys: _str-split($key, ".");
32
- @return _map-deep-get($theme, join("colors", $keys));
33
- }
34
-
35
- // @param {string} $key - the period-separated path to the value in the theme object, with "typography." omitted. e.g., "100.fontSize"
36
- @function typography($key) {
37
- $keys: _str-split($key, ".");
38
- @return _map-deep-get($theme, join("typography", $keys));
39
- }
40
-
41
- // @param {string} $key - the period-separated path to the value in the theme object, with "fontWeights." omitted. e.g., "normal"
42
- @function fontWeights($key) {
43
- $keys: _str-split($key, ".");
44
- @return _map-deep-get($theme, join("fontWeights", $keys));
45
- }
46
-
47
- // @param {string} $key - the period-separated path to the value in the theme object, with "space." omitted. e.g., "100"
48
- @function space($key) {
49
- $keys: _str-split($key, ".");
50
- @return _map-deep-get($theme, join("space", $keys));
51
- }
52
-
53
- // @param {string} $key - the period-separated path to the value in the theme object, with "radii." omitted. e.g., "inner"
54
- @function radii($key) {
55
- $keys: _str-split($key, ".");
56
- @return _map-deep-get($theme, join("radii", $keys));
57
- }
58
-
59
- // @param {string} $key - the period-separated path to the value in the theme object, with "borders." omitted. e.g., "500"
60
- @function borders($key) {
61
- $keys: _str-split($key, ".");
62
- @return _map-deep-get($theme, join("borders", $keys));
63
- }
64
-
65
- // @param {string} $key - the period-separated path to the value in the theme object, with "borderWidths." omitted. e.g., "500"
66
- @function borderWidths($key) {
67
- $keys: _str-split($key, ".");
68
- @return _map-deep-get($theme, join("borderWidths", $keys));
69
- }
70
-
71
- // @param {string} $key - the period-separated path to the value in the theme object, with "shadows." omitted. e.g., "low"
72
- @function shadows($key) {
73
- $keys: _str-split($key, ".");
74
- @return _map-deep-get($theme, join("shadows", $keys));
75
- }
76
-
77
- // @param {string} $key - the period-separated path to the value in the theme object, with "easing." omitted. e.g., "ease_in"
78
- @function easing($key) {
79
- $keys: _str-split($key, ".");
80
- @return _map-deep-get($theme, join("easing", $keys));
81
- }
82
-
83
- // @param {string} $key - the period-separated path to the value in the theme object, with "duration." omitted. e.g., "fast"
84
- @function duration($key) {
85
- $keys: _str-split($key, ".");
86
- @return _map-deep-get($theme, join("duration", $keys));
87
- }
88
-
89
- // UTILITIES
90
- // Helper functions that power the functions above. Not relevant to the theme.
91
- // If you import this file with @use, these functions will be excluded because they are private.
92
-
93
- // Via https://stackoverflow.com/a/42295154
94
- // Used to split period-separated object keys, e.g. "colors.text.body" => ["colors", "text", "body"]
95
- // Only works with a single-character separator.
96
- @function _str-split($string, $separator) {
97
- // empty array/list
98
- $split-arr: ();
99
- // first index of separator in string
100
- $index: str-index($string, $separator);
101
- // loop through string
102
- @while $index != null {
103
- // get the substring from the first character to the separator
104
- $item: str-slice($string, 1, $index - 1);
105
- // push item to array
106
- $split-arr: append($split-arr, $item);
107
- // remove item and separator from string
108
- $string: str-slice($string, $index + 1);
109
- // find new index of separator
110
- $index: str-index($string, $separator);
111
- }
112
- // add the remaining string to list (the last item)
113
- $split-arr: append($split-arr, $string);
114
-
115
- @return $split-arr;
116
- }
117
-
118
- // Adapted from https://css-tricks.com/snippets/sass/deep-getset-maps/
119
- // Iterates over a list of keys to read multi-level maps.
120
- // e.g., _map-deep-get((colors: (text: (body: "#364141"))), ["colors", "text", "body"]) => "#364141"
121
- @function _map-deep-get($map, $keys) {
122
- @each $key in $keys {
123
- $map: map-get($map, $key);
124
- }
125
- @return $map;
126
- }