@sproutsocial/seeds-react-theme 4.3.1 → 4.5.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.
@@ -22,9 +22,11 @@ var ABBREVIATIONS = {
22
22
  };
23
23
 
24
24
  /**
25
- * Apply abbreviation rules to a key
25
+ * Apply abbreviation rules to a single token-path segment. Shared by the CSS
26
+ * var generator (`flattenObject`) and the seeds-react-system-props shim's
27
+ * color-prop fallback, so the `--color-*` names each side produces can't drift.
26
28
  */
27
- function abbreviate(key) {
29
+ export function abbreviate(key) {
28
30
  return ABBREVIATIONS[key] || key;
29
31
  }
30
32
 
@@ -118,11 +120,11 @@ export function flattenRadii(radii) {
118
120
  }
119
121
 
120
122
  /**
121
- * Flatten shadows
123
+ * Flatten border widths
122
124
  */
123
- export function flattenShadows(shadows) {
125
+ export function flattenBorderWidths(borderWidths) {
124
126
  var flattened = {};
125
- for (var _i5 = 0, _Object$entries5 = Object.entries(shadows); _i5 < _Object$entries5.length; _i5++) {
127
+ for (var _i5 = 0, _Object$entries5 = Object.entries(borderWidths); _i5 < _Object$entries5.length; _i5++) {
126
128
  var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2),
127
129
  key = _Object$entries5$_i[0],
128
130
  value = _Object$entries5$_i[1];
@@ -134,15 +136,15 @@ export function flattenShadows(shadows) {
134
136
  }
135
137
 
136
138
  /**
137
- * Flatten font weights
139
+ * Flatten shadows
138
140
  */
139
- export function flattenFontWeights(fontWeights) {
141
+ export function flattenShadows(shadows) {
140
142
  var flattened = {};
141
- for (var _i6 = 0, _Object$entries6 = Object.entries(fontWeights); _i6 < _Object$entries6.length; _i6++) {
143
+ for (var _i6 = 0, _Object$entries6 = Object.entries(shadows); _i6 < _Object$entries6.length; _i6++) {
142
144
  var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i6], 2),
143
145
  key = _Object$entries6$_i[0],
144
146
  value = _Object$entries6$_i[1];
145
- if (typeof value === "string" || typeof value === "number") {
147
+ if (typeof value === "string") {
146
148
  flattened[key] = value;
147
149
  }
148
150
  }
@@ -150,15 +152,15 @@ export function flattenFontWeights(fontWeights) {
150
152
  }
151
153
 
152
154
  /**
153
- * Flatten easing (transition timing functions)
155
+ * Flatten font weights
154
156
  */
155
- export function flattenEasing(easing) {
157
+ export function flattenFontWeights(fontWeights) {
156
158
  var flattened = {};
157
- for (var _i7 = 0, _Object$entries7 = Object.entries(easing); _i7 < _Object$entries7.length; _i7++) {
159
+ for (var _i7 = 0, _Object$entries7 = Object.entries(fontWeights); _i7 < _Object$entries7.length; _i7++) {
158
160
  var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i7], 2),
159
161
  key = _Object$entries7$_i[0],
160
162
  value = _Object$entries7$_i[1];
161
- if (typeof value === "string") {
163
+ if (typeof value === "string" || typeof value === "number") {
162
164
  flattened[key] = value;
163
165
  }
164
166
  }
@@ -166,11 +168,11 @@ export function flattenEasing(easing) {
166
168
  }
167
169
 
168
170
  /**
169
- * Flatten duration (transition durations)
171
+ * Flatten easing (transition timing functions)
170
172
  */
171
- export function flattenDuration(duration) {
173
+ export function flattenEasing(easing) {
172
174
  var flattened = {};
173
- for (var _i8 = 0, _Object$entries8 = Object.entries(duration); _i8 < _Object$entries8.length; _i8++) {
175
+ for (var _i8 = 0, _Object$entries8 = Object.entries(easing); _i8 < _Object$entries8.length; _i8++) {
174
176
  var _Object$entries8$_i = _slicedToArray(_Object$entries8[_i8], 2),
175
177
  key = _Object$entries8$_i[0],
176
178
  value = _Object$entries8$_i[1];
@@ -181,6 +183,22 @@ export function flattenDuration(duration) {
181
183
  return flattened;
182
184
  }
183
185
 
186
+ /**
187
+ * Flatten duration (transition durations)
188
+ */
189
+ export function flattenDuration(duration) {
190
+ var flattened = {};
191
+ for (var _i9 = 0, _Object$entries9 = Object.entries(duration); _i9 < _Object$entries9.length; _i9++) {
192
+ var _Object$entries9$_i = _slicedToArray(_Object$entries9[_i9], 2),
193
+ key = _Object$entries9$_i[0],
194
+ value = _Object$entries9$_i[1];
195
+ if (typeof value === "string") {
196
+ flattened[key] = value;
197
+ }
198
+ }
199
+ return flattened;
200
+ }
201
+
184
202
  /**
185
203
  * Check if a value is a valid CSS color
186
204
  * Filters out complex values like color-mix() which may not work everywhere
@@ -194,10 +212,10 @@ export function isSimpleColor(value) {
194
212
  */
195
213
  export function filterComplexColors(colors) {
196
214
  var filtered = {};
197
- for (var _i9 = 0, _Object$entries9 = Object.entries(colors); _i9 < _Object$entries9.length; _i9++) {
198
- var _Object$entries9$_i = _slicedToArray(_Object$entries9[_i9], 2),
199
- key = _Object$entries9$_i[0],
200
- value = _Object$entries9$_i[1];
215
+ for (var _i0 = 0, _Object$entries0 = Object.entries(colors); _i0 < _Object$entries0.length; _i0++) {
216
+ var _Object$entries0$_i = _slicedToArray(_Object$entries0[_i0], 2),
217
+ key = _Object$entries0$_i[0],
218
+ value = _Object$entries0$_i[1];
201
219
  if (isSimpleColor(value)) {
202
220
  filtered[key] = value;
203
221
  } else {
package/lib/dark/theme.js CHANGED
@@ -91,7 +91,12 @@ export var colors = _objectSpread(_objectSpread({}, lightTheme.colors), {}, {
91
91
  // contrast against the dark surface (Figma Sprout Variables, "Trellis" dark).
92
92
  gradient: {
93
93
  ai: "radial-gradient(circle at bottom left, #679eff 0%, #b984ff 61%, #f282f5 100%)",
94
- "ai-subtle": "radial-gradient(circle at bottom left, color-mix(in srgb, #679eff, transparent 80%) 0%, color-mix(in srgb, #b984ff, transparent 80%) 61%, color-mix(in srgb, #f282f5, transparent 80%) 100%)"
94
+ "ai-subtle": "radial-gradient(circle at bottom left, color-mix(in srgb, #679eff, transparent 80%) 0%, color-mix(in srgb, #b984ff, transparent 80%) 61%, color-mix(in srgb, #f282f5, transparent 80%) 100%)",
95
+ // Discrete stops for SVG paint servers — see the light theme for why these
96
+ // exist alongside the composed gradient strings.
97
+ "ai-stop-1": "#679eff",
98
+ "ai-stop-2": "#b984ff",
99
+ "ai-stop-3": "#f282f5"
95
100
  },
96
101
  button: {
97
102
  primary: {
@@ -100,7 +100,16 @@ export var colors = _objectSpread(_objectSpread({
100
100
  ai: "radial-gradient(circle at bottom left, #205bc3 0%, #9747ff 61%, #f282f5 100%)",
101
101
  // 20% tint — AI secondary (composited over a white base in CSS).
102
102
  // Kebab key so it flattens to --color-gradient-ai-subtle.
103
- "ai-subtle": "radial-gradient(circle at bottom left, color-mix(in srgb, #205bc3, transparent 80%) 0%, color-mix(in srgb, #9747ff, transparent 80%) 61%, color-mix(in srgb, #f282f5, transparent 80%) 100%)"
103
+ "ai-subtle": "radial-gradient(circle at bottom left, color-mix(in srgb, #205bc3, transparent 80%) 0%, color-mix(in srgb, #9747ff, transparent 80%) 61%, color-mix(in srgb, #f282f5, transparent 80%) 100%)",
104
+ // The same three stops as discrete colors, flattening to
105
+ // --color-gradient-ai-stop-{1,2,3}. SVG needs a real <radialGradient> with
106
+ // separate <stop> elements to use as a paint server, and a CSS
107
+ // radial-gradient() string can't be decomposed back into stops. Consumed by
108
+ // seeds-react-icon's gradient defs (see icon.css) so gradient-filled icons
109
+ // pick up dark mode through the usual .dark variable swap.
110
+ "ai-stop-1": "#205bc3",
111
+ "ai-stop-2": "#9747ff",
112
+ "ai-stop-3": "#f282f5"
104
113
  },
105
114
  button: {
106
115
  primary: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutsocial/seeds-react-theme",
3
- "version": "4.3.1",
3
+ "version": "4.5.0",
4
4
  "description": "Seeds Theme",
5
5
  "main": "commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -20,6 +20,11 @@
20
20
  "types": "./dist/types/index.d.ts"
21
21
  },
22
22
  "./tailwind-preset": "./tailwind-preset.js",
23
+ "./token-utils": {
24
+ "import": "./lib/builders/utils.js",
25
+ "require": "./commonjs/builders/utils.js",
26
+ "types": "./dist/types/builders/utils.d.ts"
27
+ },
23
28
  "./css/theme": "./dist/theme.css",
24
29
  "./css/theme-dark": "./dist/theme-dark.css",
25
30
  "./css/theme-all": "./dist/theme-all.css",