@sproutsocial/seeds-react-theme 4.2.1 → 4.3.1
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/commonjs/builders/buildCSS.js +5 -0
- package/commonjs/builders/buildThemeSCSS.js +56 -0
- package/commonjs/dark/theme.js +3 -1
- package/commonjs/light/theme.js +3 -4
- package/dist/scrollbar.css +19 -0
- package/dist/theme-all.css +2 -2
- package/dist/theme-dark.css +1 -1
- package/dist/theme.css +1 -1
- package/dist/themes/dark/_themed.scss +7 -3
- package/dist/themes/dark/theme.scss +2 -2
- package/dist/themes/extendedThemes/sproutTheme/dark/_themed.scss +7 -3
- package/dist/themes/extendedThemes/sproutTheme/dark/theme.scss +1 -1
- package/dist/themes/extendedThemes/sproutTheme/light/_themed.scss +7 -3
- package/dist/themes/extendedThemes/sproutTheme/light/theme.scss +1 -1
- package/dist/themes/light/_themed.scss +7 -3
- package/dist/themes/light/theme.scss +2 -2
- package/dist/types/builders/buildCSS.d.ts.map +1 -1
- package/dist/types/builders/buildThemeSCSS.d.ts +2 -0
- package/dist/types/builders/buildThemeSCSS.d.ts.map +1 -0
- package/dist/types/dark/theme.d.ts.map +1 -1
- package/dist/types/light/theme.d.ts.map +1 -1
- package/lib/builders/buildCSS.js +5 -0
- package/lib/builders/buildThemeSCSS.js +50 -0
- package/lib/dark/theme.js +3 -1
- package/lib/light/theme.js +3 -4
- package/package.json +11 -5
- package/dist/themes/types/_themed.scss +0 -126
|
@@ -186,6 +186,11 @@ function _buildCSSVariables() {
|
|
|
186
186
|
combinedCSS = generateCombinedCSS();
|
|
187
187
|
_fs.default.writeFileSync(_path.default.join(distDir, "theme-all.css"), combinedCSS, "utf-8");
|
|
188
188
|
console.log(" \u2713 Written combined theme to dist/theme-all.css");
|
|
189
|
+
|
|
190
|
+
// Copy static utility stylesheets into dist (dist is generated + cleaned, so
|
|
191
|
+
// hand-authored CSS must be copied in during the build).
|
|
192
|
+
_fs.default.copyFileSync(_path.default.join(__dirname, "../css/scrollbar.css"), _path.default.join(distDir, "scrollbar.css"));
|
|
193
|
+
console.log(" \u2713 Copied scrollbar utility to dist/scrollbar.css");
|
|
189
194
|
console.log("\n✅ CSS variables built successfully!\n");
|
|
190
195
|
case 1:
|
|
191
196
|
return _context.a(2);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildThemeSCSSFiles = void 0;
|
|
7
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
8
|
+
var _glob = require("glob");
|
|
9
|
+
var _child_process = require("child_process");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
12
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
13
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
14
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
15
|
+
//@ts-ignore
|
|
16
|
+
var execSyncHelper = function execSyncHelper(command, extraEnv) {
|
|
17
|
+
return (0, _child_process.execSync)(command, {
|
|
18
|
+
stdio: "inherit",
|
|
19
|
+
env: Object.assign({}, process.env, extraEnv)
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Generate theme.scss and add a copy of _themed.scss to /dist for each theme
|
|
24
|
+
var buildThemeSCSSFiles = exports.buildThemeSCSSFiles = /*#__PURE__*/function () {
|
|
25
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
26
|
+
var themeFiles;
|
|
27
|
+
return _regenerator().w(function (_context) {
|
|
28
|
+
while (1) switch (_context.n) {
|
|
29
|
+
case 0:
|
|
30
|
+
console.log("Building theme stylesheets");
|
|
31
|
+
|
|
32
|
+
// "types" excluded: src/types/theme.ts is a type-only file that happens to
|
|
33
|
+
// share the "theme" basename with the real theme data modules, and its
|
|
34
|
+
// compiled output has no runtime keys for json-to-scss to convert.
|
|
35
|
+
themeFiles = (0, _glob.sync)("./commonjs/**/theme.js", {
|
|
36
|
+
ignore: "commonjs/types/**"
|
|
37
|
+
});
|
|
38
|
+
themeFiles.forEach(function (fileName) {
|
|
39
|
+
var themeDistDirectory = fileName.replace("commonjs", "dist/themes").replace("/theme.js", "");
|
|
40
|
+
if (!_fs.default.existsSync(themeDistDirectory)) {
|
|
41
|
+
_fs.default.mkdirSync(themeDistDirectory, {
|
|
42
|
+
recursive: true
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
execSyncHelper("json-to-scss '".concat(fileName, "' '").concat(themeDistDirectory, "/theme.scss' --k=\"dq\""));
|
|
46
|
+
execSyncHelper("cp './src/utils/_themed.scss' '".concat(themeDistDirectory, "/_themed.scss'"));
|
|
47
|
+
});
|
|
48
|
+
case 1:
|
|
49
|
+
return _context.a(2);
|
|
50
|
+
}
|
|
51
|
+
}, _callee);
|
|
52
|
+
}));
|
|
53
|
+
return function buildThemeSCSSFiles() {
|
|
54
|
+
return _ref.apply(this, arguments);
|
|
55
|
+
};
|
|
56
|
+
}();
|
package/commonjs/dark/theme.js
CHANGED
|
@@ -62,7 +62,9 @@ var colors = exports.colors = _objectSpread(_objectSpread({}, _theme.default.col
|
|
|
62
62
|
neutral_sentiment: _seedsColor.default.COLOR_NEUTRAL_300,
|
|
63
63
|
// 20% AI gradient tint over the dark container surface. Same token-driven
|
|
64
64
|
// value as light mode; the referenced tokens flip per theme.
|
|
65
|
-
|
|
65
|
+
// The comma-separated composed value lives in _themed.scss (see comment
|
|
66
|
+
// there) since a literal comma here breaks SCSS map parsing.
|
|
67
|
+
ai_generated: "var(--color-container-bg-ai-generated)"
|
|
66
68
|
},
|
|
67
69
|
border: {
|
|
68
70
|
base: _seedsColor.default.COLOR_NEUTRAL_1100,
|
package/commonjs/light/theme.js
CHANGED
|
@@ -68,10 +68,9 @@ var colors = exports.colors = _objectSpread(_objectSpread({
|
|
|
68
68
|
negative_sentiment: _seedsColor.default.COLOR_RED_500,
|
|
69
69
|
neutral_sentiment: _seedsColor.default.COLOR_NEUTRAL_300,
|
|
70
70
|
// 20% AI gradient tint composited over the themed container surface.
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
ai_generated: "var(--color-gradient-ai-subtle), var(--color-container-bg-base)"
|
|
71
|
+
// The comma-separated composed value lives in _themed.scss (see comment
|
|
72
|
+
// there) since a literal comma here breaks SCSS map parsing.
|
|
73
|
+
ai_generated: "var(--color-container-bg-ai-generated)"
|
|
75
74
|
},
|
|
76
75
|
border: {
|
|
77
76
|
base: _seedsColor.default.COLOR_NEUTRAL_200,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeds thin-scrollbar utility.
|
|
3
|
+
*
|
|
4
|
+
* Tailwind-hybrid replacement for the legacy styled-components `thinScrollbar`
|
|
5
|
+
* mixin. Apply `seeds-scrollbar-thin` to any scrollable element.
|
|
6
|
+
*
|
|
7
|
+
* Requires @sproutsocial/seeds-react-theme/dist/theme-all.css (or theme.css)
|
|
8
|
+
* loaded for the --color-menuItem-bg-active variable and dark-mode support.
|
|
9
|
+
*
|
|
10
|
+
* Wrapped in `@layer components` so consumer Tailwind utilities (unlayered) win
|
|
11
|
+
* the cascade over this component-level style.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
@layer components {
|
|
15
|
+
.seeds-scrollbar-thin {
|
|
16
|
+
scrollbar-width: thin;
|
|
17
|
+
scrollbar-color: var(--color-menuItem-bg-active) transparent;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/theme-all.css
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
--color-container-bg-positive_sentiment: #3876e3;
|
|
28
28
|
--color-container-bg-negative_sentiment: #f76054;
|
|
29
29
|
--color-container-bg-neutral_sentiment: #c8cccc;
|
|
30
|
-
--color-container-bg-ai_generated: var(--color-
|
|
30
|
+
--color-container-bg-ai_generated: var(--color-container-bg-ai-generated);
|
|
31
31
|
--color-container-border-base: #dee1e1;
|
|
32
32
|
--color-container-border-success: #59cb59;
|
|
33
33
|
--color-container-border-warning: #ffbc00;
|
|
@@ -508,7 +508,7 @@
|
|
|
508
508
|
--color-container-bg-positive_sentiment: #3876e3;
|
|
509
509
|
--color-container-bg-negative_sentiment: #f76054;
|
|
510
510
|
--color-container-bg-neutral_sentiment: #c8cccc;
|
|
511
|
-
--color-container-bg-ai_generated: var(--color-
|
|
511
|
+
--color-container-bg-ai_generated: var(--color-container-bg-ai-generated);
|
|
512
512
|
--color-container-border-base: #040404;
|
|
513
513
|
--color-container-border-success: #59cb59;
|
|
514
514
|
--color-container-border-warning: #ffbc00;
|
package/dist/theme-dark.css
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
--color-container-bg-positive_sentiment: #3876e3;
|
|
28
28
|
--color-container-bg-negative_sentiment: #f76054;
|
|
29
29
|
--color-container-bg-neutral_sentiment: #c8cccc;
|
|
30
|
-
--color-container-bg-ai_generated: var(--color-
|
|
30
|
+
--color-container-bg-ai_generated: var(--color-container-bg-ai-generated);
|
|
31
31
|
--color-container-border-base: #040404;
|
|
32
32
|
--color-container-border-success: #59cb59;
|
|
33
33
|
--color-container-border-warning: #ffbc00;
|
package/dist/theme.css
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
--color-container-bg-positive_sentiment: #3876e3;
|
|
28
28
|
--color-container-bg-negative_sentiment: #f76054;
|
|
29
29
|
--color-container-bg-neutral_sentiment: #c8cccc;
|
|
30
|
-
--color-container-bg-ai_generated: var(--color-
|
|
30
|
+
--color-container-bg-ai_generated: var(--color-container-bg-ai-generated);
|
|
31
31
|
--color-container-border-base: #dee1e1;
|
|
32
32
|
--color-container-border-success: #59cb59;
|
|
33
33
|
--color-container-border-warning: #ffbc00;
|
|
@@ -7,10 +7,14 @@
|
|
|
7
7
|
@import "./theme.scss";
|
|
8
8
|
|
|
9
9
|
// CSS custom properties for values that can't be represented in SCSS maps.
|
|
10
|
-
//
|
|
11
|
-
//
|
|
10
|
+
// A comma-separated CSS value (e.g. a multi-layer background) breaks SCSS map
|
|
11
|
+
// parsing, since Sass reads the top-level comma as a second map value with no
|
|
12
|
+
// key. So the theme object holds a single var() reference, and the composed,
|
|
13
|
+
// comma-separated value is defined here instead, built from the other
|
|
14
|
+
// theme-driven vars so it stays correct for light and dark automatically.
|
|
12
15
|
:root {
|
|
13
|
-
--color-container-bg-ai-generated:
|
|
16
|
+
--color-container-bg-ai-generated: var(--color-gradient-ai-subtle),
|
|
17
|
+
var(--color-container-bg-base);
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
// In the JS theme file, the theme object is exported as "default" (i.e., using "export default"),
|
|
@@ -31,7 +31,7 @@ $theme: (
|
|
|
31
31
|
"positive_sentiment": #3876e3,
|
|
32
32
|
"negative_sentiment": #f76054,
|
|
33
33
|
"neutral_sentiment": #c8cccc,
|
|
34
|
-
"ai_generated": var(--color-
|
|
34
|
+
"ai_generated": var(--color-container-bg-ai-generated)
|
|
35
35
|
),
|
|
36
36
|
"border": (
|
|
37
37
|
"base": #040404,
|
|
@@ -600,7 +600,7 @@ $theme: (
|
|
|
600
600
|
"positive_sentiment": #3876e3,
|
|
601
601
|
"negative_sentiment": #f76054,
|
|
602
602
|
"neutral_sentiment": #c8cccc,
|
|
603
|
-
"ai_generated": var(--color-
|
|
603
|
+
"ai_generated": var(--color-container-bg-ai-generated)
|
|
604
604
|
),
|
|
605
605
|
"border": (
|
|
606
606
|
"base": #040404,
|
|
@@ -7,10 +7,14 @@
|
|
|
7
7
|
@import "./theme.scss";
|
|
8
8
|
|
|
9
9
|
// CSS custom properties for values that can't be represented in SCSS maps.
|
|
10
|
-
//
|
|
11
|
-
//
|
|
10
|
+
// A comma-separated CSS value (e.g. a multi-layer background) breaks SCSS map
|
|
11
|
+
// parsing, since Sass reads the top-level comma as a second map value with no
|
|
12
|
+
// key. So the theme object holds a single var() reference, and the composed,
|
|
13
|
+
// comma-separated value is defined here instead, built from the other
|
|
14
|
+
// theme-driven vars so it stays correct for light and dark automatically.
|
|
12
15
|
:root {
|
|
13
|
-
--color-container-bg-ai-generated:
|
|
16
|
+
--color-container-bg-ai-generated: var(--color-gradient-ai-subtle),
|
|
17
|
+
var(--color-container-bg-base);
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
// In the JS theme file, the theme object is exported as "default" (i.e., using "export default"),
|
|
@@ -85,7 +85,7 @@ $theme: (
|
|
|
85
85
|
"positive_sentiment": #3876e3,
|
|
86
86
|
"negative_sentiment": #f76054,
|
|
87
87
|
"neutral_sentiment": #c8cccc,
|
|
88
|
-
"ai_generated": var(--color-
|
|
88
|
+
"ai_generated": var(--color-container-bg-ai-generated)
|
|
89
89
|
),
|
|
90
90
|
"border": (
|
|
91
91
|
"base": #040404,
|
|
@@ -7,10 +7,14 @@
|
|
|
7
7
|
@import "./theme.scss";
|
|
8
8
|
|
|
9
9
|
// CSS custom properties for values that can't be represented in SCSS maps.
|
|
10
|
-
//
|
|
11
|
-
//
|
|
10
|
+
// A comma-separated CSS value (e.g. a multi-layer background) breaks SCSS map
|
|
11
|
+
// parsing, since Sass reads the top-level comma as a second map value with no
|
|
12
|
+
// key. So the theme object holds a single var() reference, and the composed,
|
|
13
|
+
// comma-separated value is defined here instead, built from the other
|
|
14
|
+
// theme-driven vars so it stays correct for light and dark automatically.
|
|
12
15
|
:root {
|
|
13
|
-
--color-container-bg-ai-generated:
|
|
16
|
+
--color-container-bg-ai-generated: var(--color-gradient-ai-subtle),
|
|
17
|
+
var(--color-container-bg-base);
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
// In the JS theme file, the theme object is exported as "default" (i.e., using "export default"),
|
|
@@ -85,7 +85,7 @@ $theme: (
|
|
|
85
85
|
"positive_sentiment": #3876e3,
|
|
86
86
|
"negative_sentiment": #f76054,
|
|
87
87
|
"neutral_sentiment": #c8cccc,
|
|
88
|
-
"ai_generated": var(--color-
|
|
88
|
+
"ai_generated": var(--color-container-bg-ai-generated)
|
|
89
89
|
),
|
|
90
90
|
"border": (
|
|
91
91
|
"base": #dee1e1,
|
|
@@ -7,10 +7,14 @@
|
|
|
7
7
|
@import "./theme.scss";
|
|
8
8
|
|
|
9
9
|
// CSS custom properties for values that can't be represented in SCSS maps.
|
|
10
|
-
//
|
|
11
|
-
//
|
|
10
|
+
// A comma-separated CSS value (e.g. a multi-layer background) breaks SCSS map
|
|
11
|
+
// parsing, since Sass reads the top-level comma as a second map value with no
|
|
12
|
+
// key. So the theme object holds a single var() reference, and the composed,
|
|
13
|
+
// comma-separated value is defined here instead, built from the other
|
|
14
|
+
// theme-driven vars so it stays correct for light and dark automatically.
|
|
12
15
|
:root {
|
|
13
|
-
--color-container-bg-ai-generated:
|
|
16
|
+
--color-container-bg-ai-generated: var(--color-gradient-ai-subtle),
|
|
17
|
+
var(--color-container-bg-base);
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
// In the JS theme file, the theme object is exported as "default" (i.e., using "export default"),
|
|
@@ -42,7 +42,7 @@ $theme: (
|
|
|
42
42
|
"positive_sentiment": #3876e3,
|
|
43
43
|
"negative_sentiment": #f76054,
|
|
44
44
|
"neutral_sentiment": #c8cccc,
|
|
45
|
-
"ai_generated": var(--color-
|
|
45
|
+
"ai_generated": var(--color-container-bg-ai-generated)
|
|
46
46
|
),
|
|
47
47
|
"border": (
|
|
48
48
|
"base": #dee1e1,
|
|
@@ -611,7 +611,7 @@ $theme: (
|
|
|
611
611
|
"positive_sentiment": #3876e3,
|
|
612
612
|
"negative_sentiment": #f76054,
|
|
613
613
|
"neutral_sentiment": #c8cccc,
|
|
614
|
-
"ai_generated": var(--color-
|
|
614
|
+
"ai_generated": var(--color-container-bg-ai-generated)
|
|
615
615
|
),
|
|
616
616
|
"border": (
|
|
617
617
|
"base": #dee1e1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildCSS.d.ts","sourceRoot":"","sources":["../../../src/builders/buildCSS.ts"],"names":[],"mappings":"AAAA;;GAEG;AA4JH;;GAEG;AACH,wBAAsB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"buildCSS.d.ts","sourceRoot":"","sources":["../../../src/builders/buildCSS.ts"],"names":[],"mappings":"AAAA;;GAEG;AA4JH;;GAEG;AACH,wBAAsB,iBAAiB,kBAkCtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildThemeSCSS.d.ts","sourceRoot":"","sources":["../../../src/builders/buildThemeSCSS.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,mBAAmB,qBA2B/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/dark/theme.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,OAAO;;;;CAInB,CAAC;AAIF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAeb,mDAAmD;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/dark/theme.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,OAAO;;;;CAInB,CAAC;AAIF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAeb,mDAAmD;;;;;;;;;;;;;;;;;;;;;;;;;;YA8BnD,mDAAmD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAsMrD,mDAAmD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6RtD,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/lib/builders/buildCSS.js
CHANGED
|
@@ -184,6 +184,11 @@ function _buildCSSVariables() {
|
|
|
184
184
|
combinedCSS = generateCombinedCSS();
|
|
185
185
|
fs.writeFileSync(path.join(distDir, "theme-all.css"), combinedCSS, "utf-8");
|
|
186
186
|
console.log(" \u2713 Written combined theme to dist/theme-all.css");
|
|
187
|
+
|
|
188
|
+
// Copy static utility stylesheets into dist (dist is generated + cleaned, so
|
|
189
|
+
// hand-authored CSS must be copied in during the build).
|
|
190
|
+
fs.copyFileSync(path.join(__dirname, "../css/scrollbar.css"), path.join(distDir, "scrollbar.css"));
|
|
191
|
+
console.log(" \u2713 Copied scrollbar utility to dist/scrollbar.css");
|
|
187
192
|
console.log("\n✅ CSS variables built successfully!\n");
|
|
188
193
|
case 1:
|
|
189
194
|
return _context.a(2);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
2
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
3
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
4
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import { sync as globSync } from "glob";
|
|
7
|
+
import { execSync } from "child_process";
|
|
8
|
+
|
|
9
|
+
//@ts-ignore
|
|
10
|
+
var execSyncHelper = function execSyncHelper(command, extraEnv) {
|
|
11
|
+
return execSync(command, {
|
|
12
|
+
stdio: "inherit",
|
|
13
|
+
env: Object.assign({}, process.env, extraEnv)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Generate theme.scss and add a copy of _themed.scss to /dist for each theme
|
|
18
|
+
export var buildThemeSCSSFiles = /*#__PURE__*/function () {
|
|
19
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
20
|
+
var themeFiles;
|
|
21
|
+
return _regenerator().w(function (_context) {
|
|
22
|
+
while (1) switch (_context.n) {
|
|
23
|
+
case 0:
|
|
24
|
+
console.log("Building theme stylesheets");
|
|
25
|
+
|
|
26
|
+
// "types" excluded: src/types/theme.ts is a type-only file that happens to
|
|
27
|
+
// share the "theme" basename with the real theme data modules, and its
|
|
28
|
+
// compiled output has no runtime keys for json-to-scss to convert.
|
|
29
|
+
themeFiles = globSync("./commonjs/**/theme.js", {
|
|
30
|
+
ignore: "commonjs/types/**"
|
|
31
|
+
});
|
|
32
|
+
themeFiles.forEach(function (fileName) {
|
|
33
|
+
var themeDistDirectory = fileName.replace("commonjs", "dist/themes").replace("/theme.js", "");
|
|
34
|
+
if (!fs.existsSync(themeDistDirectory)) {
|
|
35
|
+
fs.mkdirSync(themeDistDirectory, {
|
|
36
|
+
recursive: true
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
execSyncHelper("json-to-scss '".concat(fileName, "' '").concat(themeDistDirectory, "/theme.scss' --k=\"dq\""));
|
|
40
|
+
execSyncHelper("cp './src/utils/_themed.scss' '".concat(themeDistDirectory, "/_themed.scss'"));
|
|
41
|
+
});
|
|
42
|
+
case 1:
|
|
43
|
+
return _context.a(2);
|
|
44
|
+
}
|
|
45
|
+
}, _callee);
|
|
46
|
+
}));
|
|
47
|
+
return function buildThemeSCSSFiles() {
|
|
48
|
+
return _ref.apply(this, arguments);
|
|
49
|
+
};
|
|
50
|
+
}();
|
package/lib/dark/theme.js
CHANGED
|
@@ -57,7 +57,9 @@ export var colors = _objectSpread(_objectSpread({}, lightTheme.colors), {}, {
|
|
|
57
57
|
neutral_sentiment: COLORS.COLOR_NEUTRAL_300,
|
|
58
58
|
// 20% AI gradient tint over the dark container surface. Same token-driven
|
|
59
59
|
// value as light mode; the referenced tokens flip per theme.
|
|
60
|
-
|
|
60
|
+
// The comma-separated composed value lives in _themed.scss (see comment
|
|
61
|
+
// there) since a literal comma here breaks SCSS map parsing.
|
|
62
|
+
ai_generated: "var(--color-container-bg-ai-generated)"
|
|
61
63
|
},
|
|
62
64
|
border: {
|
|
63
65
|
base: COLORS.COLOR_NEUTRAL_1100,
|
package/lib/light/theme.js
CHANGED
|
@@ -63,10 +63,9 @@ export var colors = _objectSpread(_objectSpread({
|
|
|
63
63
|
negative_sentiment: COLORS.COLOR_RED_500,
|
|
64
64
|
neutral_sentiment: COLORS.COLOR_NEUTRAL_300,
|
|
65
65
|
// 20% AI gradient tint composited over the themed container surface.
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
ai_generated: "var(--color-gradient-ai-subtle), var(--color-container-bg-base)"
|
|
66
|
+
// The comma-separated composed value lives in _themed.scss (see comment
|
|
67
|
+
// there) since a literal comma here breaks SCSS map parsing.
|
|
68
|
+
ai_generated: "var(--color-container-bg-ai-generated)"
|
|
70
69
|
},
|
|
71
70
|
border: {
|
|
72
71
|
base: COLORS.COLOR_NEUTRAL_200,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/seeds-react-theme",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "Seeds Theme",
|
|
5
5
|
"main": "commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"./css/theme": "./dist/theme.css",
|
|
24
24
|
"./css/theme-dark": "./dist/theme-dark.css",
|
|
25
25
|
"./css/theme-all": "./dist/theme-all.css",
|
|
26
|
+
"./css/scrollbar": "./dist/scrollbar.css",
|
|
26
27
|
"./css/tailwind-preset": "./dist/tailwind-preset.css"
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
@@ -31,7 +32,9 @@
|
|
|
31
32
|
"build:css": "tsx src/builders/buildCSS.ts",
|
|
32
33
|
"clean": "rm -rf .turbo dist lib commonjs __flow__",
|
|
33
34
|
"clean:modules": "rm -rf node_modules",
|
|
34
|
-
"typecheck": "tsc --noEmit"
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"test": "jest",
|
|
37
|
+
"test:watch": "jest --watch --coverage=false"
|
|
35
38
|
},
|
|
36
39
|
"dependencies": {
|
|
37
40
|
"@sproutsocial/seeds-border": "^1.7.1",
|
|
@@ -44,12 +47,15 @@
|
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
46
49
|
"@sproutsocial/seeds-build": "*",
|
|
50
|
+
"@sproutsocial/seeds-tsconfig": "*",
|
|
47
51
|
"glob": "^10.3.10",
|
|
52
|
+
"jest": "^29.7.0",
|
|
48
53
|
"json-to-scss": "^1.6.2",
|
|
54
|
+
"sass": "^1.50.0",
|
|
55
|
+
"tsc-alias": "^1.8.11",
|
|
56
|
+
"ts-jest": "^29.2.5",
|
|
49
57
|
"tsx": "^4.0.0",
|
|
50
|
-
"typescript": "^5.6.2"
|
|
51
|
-
"@sproutsocial/seeds-tsconfig": "*",
|
|
52
|
-
"tsc-alias": "^1.8.11"
|
|
58
|
+
"typescript": "^5.6.2"
|
|
53
59
|
},
|
|
54
60
|
"peerDependencies": {
|
|
55
61
|
"tailwindcss": ">=3.0.0 || >=4.0.0"
|
|
@@ -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
|
-
}
|