@sproutsocial/seeds-react-theme 3.6.2 → 4.1.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.
- package/README.md +199 -0
- package/commonjs/builders/buildCSS.js +202 -0
- package/commonjs/builders/buildTailwindV4.js +238 -0
- package/commonjs/builders/index.js +65 -0
- package/commonjs/builders/utils.js +225 -0
- package/commonjs/dark/theme.js +48 -3
- package/commonjs/light/theme.js +56 -3
- package/dist/tailwind-preset.css +118 -0
- package/dist/theme-all.css +961 -0
- package/dist/theme-dark.css +480 -0
- package/dist/theme.css +480 -0
- package/dist/themes/dark/_themed.scss +7 -0
- package/dist/themes/dark/theme.scss +94 -6
- package/dist/themes/extendedThemes/sproutTheme/dark/_themed.scss +7 -0
- package/dist/themes/extendedThemes/sproutTheme/dark/theme.scss +47 -3
- package/dist/themes/extendedThemes/sproutTheme/light/_themed.scss +7 -0
- package/dist/themes/extendedThemes/sproutTheme/light/theme.scss +47 -3
- package/dist/themes/light/_themed.scss +7 -0
- package/dist/themes/light/theme.scss +94 -6
- package/dist/themes/types/_themed.scss +7 -0
- package/dist/types/builders/buildCSS.d.ts +8 -0
- package/dist/types/builders/buildCSS.d.ts.map +1 -0
- package/dist/types/builders/buildTailwindV4.d.ts +18 -0
- package/dist/types/builders/buildTailwindV4.d.ts.map +1 -0
- package/dist/types/builders/index.d.ts +10 -0
- package/dist/types/builders/index.d.ts.map +1 -0
- package/dist/types/builders/utils.d.ts +53 -0
- package/dist/types/builders/utils.d.ts.map +1 -0
- package/dist/types/dark/theme.d.ts +88 -0
- package/dist/types/dark/theme.d.ts.map +1 -1
- package/dist/types/light/theme.d.ts +88 -0
- package/dist/types/light/theme.d.ts.map +1 -1
- package/dist/types/types/theme.colors.d.ts +1 -0
- package/dist/types/types/theme.colors.d.ts.map +1 -1
- package/lib/builders/buildCSS.js +200 -0
- package/lib/builders/buildTailwindV4.js +233 -0
- package/lib/builders/index.js +37 -0
- package/lib/builders/utils.js +209 -0
- package/lib/dark/theme.js +48 -3
- package/lib/light/theme.js +56 -3
- package/package.json +24 -2
- package/tailwind-preset.js +199 -0
package/README.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# @sproutsocial/seeds-react-theme
|
|
2
|
+
|
|
3
|
+
The Seeds design system semantic theme layer, providing meaningful component-oriented design tokens.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides the Seeds theme in multiple formats for use across different frameworks and platforms:
|
|
8
|
+
|
|
9
|
+
- **React (styled-components)** - Original theme provider for React applications
|
|
10
|
+
- **Tailwind CSS** - Preset for Tailwind-based projects
|
|
11
|
+
- **CSS Custom Properties** - For Angular, Vue, Svelte, vanilla HTML/CSS
|
|
12
|
+
- **SCSS Variables** - For legacy SCSS-based projects
|
|
13
|
+
|
|
14
|
+
All formats support **light and dark mode** out of the box.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @sproutsocial/seeds-react-theme
|
|
20
|
+
# or
|
|
21
|
+
yarn add @sproutsocial/seeds-react-theme
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### React (styled-components)
|
|
27
|
+
|
|
28
|
+
```jsx
|
|
29
|
+
import { ThemeProvider } from 'styled-components';
|
|
30
|
+
import theme from '@sproutsocial/seeds-react-theme';
|
|
31
|
+
|
|
32
|
+
function App() {
|
|
33
|
+
return (
|
|
34
|
+
<ThemeProvider theme={theme}>
|
|
35
|
+
<YourApp />
|
|
36
|
+
</ThemeProvider>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Tailwind CSS
|
|
42
|
+
|
|
43
|
+
See [MULTI_FRAMEWORK_GUIDE.md](./MULTI_FRAMEWORK_GUIDE.md) for complete documentation.
|
|
44
|
+
|
|
45
|
+
**Quick start:**
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
// tailwind.config.js
|
|
49
|
+
module.exports = {
|
|
50
|
+
presets: [
|
|
51
|
+
require('@sproutsocial/seeds-react-theme/dist/tailwind-preset'),
|
|
52
|
+
],
|
|
53
|
+
content: ['./src/**/*.{js,jsx,ts,tsx}'],
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```jsx
|
|
58
|
+
<button className="bg-color-button-primary-bg-base text-color-button-primary-text-base px-space-400 py-space-300 rounded-radius-500">
|
|
59
|
+
Primary Button
|
|
60
|
+
</button>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### CSS Custom Properties
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<link rel="stylesheet" href="node_modules/@sproutsocial/seeds-react-theme/dist/theme.css">
|
|
67
|
+
|
|
68
|
+
<button style="
|
|
69
|
+
background: var(--color-button-primary-bg-base);
|
|
70
|
+
color: var(--color-button-primary-text-base);
|
|
71
|
+
padding: var(--space-400);
|
|
72
|
+
border-radius: var(--radius-500);
|
|
73
|
+
">
|
|
74
|
+
Primary Button
|
|
75
|
+
</button>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Angular / Vue / Svelte
|
|
79
|
+
|
|
80
|
+
Import the CSS file in your application entry point:
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
// Angular: styles.css or styles.scss
|
|
84
|
+
@import '@sproutsocial/seeds-react-theme/dist/theme-all.css';
|
|
85
|
+
|
|
86
|
+
// Vue: main.js
|
|
87
|
+
import '@sproutsocial/seeds-react-theme/dist/theme-all.css';
|
|
88
|
+
|
|
89
|
+
// Svelte: App.svelte or +layout.svelte
|
|
90
|
+
import '@sproutsocial/seeds-react-theme/dist/theme-all.css';
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Then use CSS variables in your component styles:
|
|
94
|
+
|
|
95
|
+
```css
|
|
96
|
+
.my-button {
|
|
97
|
+
background: var(--color-button-primary-bg-base);
|
|
98
|
+
color: var(--color-button-primary-text-base);
|
|
99
|
+
padding: var(--space-400);
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Dark Mode
|
|
104
|
+
|
|
105
|
+
### Tailwind CSS
|
|
106
|
+
|
|
107
|
+
Use the dark mode preset:
|
|
108
|
+
|
|
109
|
+
```javascript
|
|
110
|
+
module.exports = {
|
|
111
|
+
presets: [
|
|
112
|
+
require('@sproutsocial/seeds-react-theme/dist/tailwind-preset-dark'),
|
|
113
|
+
],
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### CSS Variables
|
|
118
|
+
|
|
119
|
+
Add the `data-theme="dark"` attribute to your HTML element:
|
|
120
|
+
|
|
121
|
+
```html
|
|
122
|
+
<html data-theme="dark">
|
|
123
|
+
<!-- All CSS variables automatically switch to dark mode values -->
|
|
124
|
+
</html>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Toggle with JavaScript:
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
// Enable dark mode
|
|
131
|
+
document.documentElement.setAttribute('data-theme', 'dark');
|
|
132
|
+
|
|
133
|
+
// Disable dark mode
|
|
134
|
+
document.documentElement.removeAttribute('data-theme');
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Available Tokens
|
|
138
|
+
|
|
139
|
+
### Colors
|
|
140
|
+
- Button colors (primary, secondary, destructive, etc.)
|
|
141
|
+
- Text colors (headline, body, subtext, inverse)
|
|
142
|
+
- Link colors
|
|
143
|
+
- Container backgrounds and borders
|
|
144
|
+
- Form backgrounds and borders
|
|
145
|
+
- Icon colors
|
|
146
|
+
|
|
147
|
+
### Spacing
|
|
148
|
+
- `0`, `100`, `200`, `300`, `350`, `400`, `450`, `500`, `600`
|
|
149
|
+
|
|
150
|
+
### Typography
|
|
151
|
+
- Font sizes and line heights (`100` - `1200`)
|
|
152
|
+
- Font families
|
|
153
|
+
- Font weights (normal, semibold, bold, extrabold)
|
|
154
|
+
|
|
155
|
+
### Other
|
|
156
|
+
- Border radius values
|
|
157
|
+
- Box shadows
|
|
158
|
+
- Motion (easing, duration)
|
|
159
|
+
|
|
160
|
+
## Package Exports
|
|
161
|
+
|
|
162
|
+
```javascript
|
|
163
|
+
{
|
|
164
|
+
".": "@sproutsocial/seeds-react-theme", // React theme
|
|
165
|
+
"./dist/tailwind-preset": "Tailwind preset (light)",
|
|
166
|
+
"./dist/tailwind-preset-dark": "Tailwind preset (dark)",
|
|
167
|
+
"./dist/theme.css": "CSS variables (light)",
|
|
168
|
+
"./dist/theme-dark.css": "CSS variables (dark)",
|
|
169
|
+
"./dist/theme-all.css": "CSS variables (light + dark)"
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Documentation
|
|
174
|
+
|
|
175
|
+
- **[Multi-Framework Guide](./MULTI_FRAMEWORK_GUIDE.md)** - Complete guide for using Seeds theme with Tailwind, Angular, Vue, Svelte, and HTML/CSS
|
|
176
|
+
- **[Changelog](./CHANGELOG.md)** - Version history and changes
|
|
177
|
+
|
|
178
|
+
## Development
|
|
179
|
+
|
|
180
|
+
Build all theme formats:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
yarn build
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Build specific formats:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
yarn build:tailwind # Build Tailwind presets
|
|
190
|
+
yarn build:css # Build CSS variables
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT
|
|
196
|
+
|
|
197
|
+
## Contributing
|
|
198
|
+
|
|
199
|
+
See the main [Seeds repository](https://github.com/sproutsocial/seeds) for contribution guidelines.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildCSSVariables = buildCSSVariables;
|
|
7
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
var _theme = _interopRequireDefault(require("../light/theme"));
|
|
10
|
+
var _theme2 = _interopRequireDefault(require("../dark/theme"));
|
|
11
|
+
var _utils = require("./utils");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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 }; })(); }
|
|
14
|
+
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); }
|
|
15
|
+
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); }
|
|
16
|
+
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); }); }; }
|
|
17
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
18
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
20
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
21
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
22
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
23
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
25
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
26
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
27
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /**
|
|
28
|
+
* Build CSS custom properties (variables) from Seeds theme objects
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Convert a flat object into CSS custom properties
|
|
32
|
+
*/
|
|
33
|
+
function objectToCSSVariables(obj) {
|
|
34
|
+
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
35
|
+
var variables = [];
|
|
36
|
+
for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
|
|
37
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
38
|
+
key = _Object$entries$_i[0],
|
|
39
|
+
value = _Object$entries$_i[1];
|
|
40
|
+
var varName = prefix ? "--".concat(prefix, "-").concat(key) : "--".concat(key);
|
|
41
|
+
variables.push(" ".concat(varName, ": ").concat(value, ";"));
|
|
42
|
+
}
|
|
43
|
+
return variables;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Build CSS variables for typography
|
|
48
|
+
*/
|
|
49
|
+
function typographyToCSSVariables(typography) {
|
|
50
|
+
var variables = [];
|
|
51
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries(typography); _i2 < _Object$entries2.length; _i2++) {
|
|
52
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
53
|
+
key = _Object$entries2$_i[0],
|
|
54
|
+
value = _Object$entries2$_i[1];
|
|
55
|
+
if (_typeof(value) === "object" && value !== null && "fontSize" in value && "lineHeight" in value) {
|
|
56
|
+
variables.push(" --font-size-".concat(key, ": ").concat(value.fontSize, ";"));
|
|
57
|
+
variables.push(" --line-height-".concat(key, ": ").concat(value.lineHeight, ";"));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return variables;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Build font family CSS variables
|
|
65
|
+
*/
|
|
66
|
+
function fontFamilyToCSSVariables(fontFamily) {
|
|
67
|
+
if (typeof fontFamily === "string") {
|
|
68
|
+
return [" --font-family: ".concat(fontFamily, ";")];
|
|
69
|
+
} else if (Array.isArray(fontFamily)) {
|
|
70
|
+
return [" --font-family: ".concat(fontFamily.join(", "), ";")];
|
|
71
|
+
} else if (_typeof(fontFamily) === "object") {
|
|
72
|
+
var variables = [];
|
|
73
|
+
for (var _i3 = 0, _Object$entries3 = Object.entries(fontFamily); _i3 < _Object$entries3.length; _i3++) {
|
|
74
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
|
|
75
|
+
key = _Object$entries3$_i[0],
|
|
76
|
+
value = _Object$entries3$_i[1];
|
|
77
|
+
if (Array.isArray(value)) {
|
|
78
|
+
variables.push(" --font-family-".concat(key, ": ").concat(value.join(", "), ";"));
|
|
79
|
+
} else {
|
|
80
|
+
variables.push(" --font-family-".concat(key, ": ").concat(value, ";"));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return variables;
|
|
84
|
+
}
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Transform a Seeds theme object into CSS custom properties
|
|
90
|
+
*/
|
|
91
|
+
function generateCSSVariables(themeObj, mode) {
|
|
92
|
+
console.log("Building CSS variables for ".concat(mode, " theme..."));
|
|
93
|
+
var selector = mode === "light" ? ":root" : '[data-theme="dark"], .dark, .lights-out';
|
|
94
|
+
var variables = [];
|
|
95
|
+
|
|
96
|
+
// Colors
|
|
97
|
+
var colors = (0, _utils.flattenColors)(themeObj.colors);
|
|
98
|
+
variables.push.apply(variables, _toConsumableArray(objectToCSSVariables(colors, "")));
|
|
99
|
+
console.log(" - Mapped ".concat(Object.keys(colors).length, " color tokens"));
|
|
100
|
+
|
|
101
|
+
// Spacing
|
|
102
|
+
var spacing = (0, _utils.flattenSpacing)(themeObj.space);
|
|
103
|
+
variables.push.apply(variables, _toConsumableArray(objectToCSSVariables(spacing, "")));
|
|
104
|
+
console.log(" - Mapped ".concat(Object.keys(spacing).length, " spacing tokens"));
|
|
105
|
+
|
|
106
|
+
// Typography
|
|
107
|
+
var typography = themeObj.typography.typography || themeObj.typography;
|
|
108
|
+
var typographyVars = typographyToCSSVariables(typography);
|
|
109
|
+
variables.push.apply(variables, _toConsumableArray(typographyVars));
|
|
110
|
+
console.log(" - Mapped ".concat(typographyVars.length / 2, " typography scales"));
|
|
111
|
+
|
|
112
|
+
// Font family
|
|
113
|
+
var fontFamilyVars = fontFamilyToCSSVariables(themeObj.fontFamily);
|
|
114
|
+
variables.push.apply(variables, _toConsumableArray(fontFamilyVars));
|
|
115
|
+
|
|
116
|
+
// Font weights
|
|
117
|
+
var fontWeights = (0, _utils.flattenFontWeights)(themeObj.fontWeights);
|
|
118
|
+
variables.push.apply(variables, _toConsumableArray(objectToCSSVariables(fontWeights, "font-weight")));
|
|
119
|
+
console.log(" - Mapped ".concat(Object.keys(fontWeights).length, " font weights"));
|
|
120
|
+
|
|
121
|
+
// Border radius
|
|
122
|
+
var radii = (0, _utils.flattenRadii)(themeObj.radii.radii || themeObj.radii);
|
|
123
|
+
variables.push.apply(variables, _toConsumableArray(objectToCSSVariables(radii, "radius")));
|
|
124
|
+
console.log(" - Mapped ".concat(Object.keys(radii).length, " border radius values"));
|
|
125
|
+
|
|
126
|
+
// Shadows
|
|
127
|
+
var shadows = (0, _utils.flattenShadows)(themeObj.shadows);
|
|
128
|
+
variables.push.apply(variables, _toConsumableArray(objectToCSSVariables(shadows, "shadow")));
|
|
129
|
+
console.log(" - Mapped ".concat(Object.keys(shadows).length, " shadow values"));
|
|
130
|
+
|
|
131
|
+
// Easing (transition timing functions)
|
|
132
|
+
var easing = (0, _utils.flattenEasing)(themeObj.easing);
|
|
133
|
+
variables.push.apply(variables, _toConsumableArray(objectToCSSVariables(easing, "ease")));
|
|
134
|
+
console.log(" - Mapped ".concat(Object.keys(easing).length, " easing functions"));
|
|
135
|
+
|
|
136
|
+
// Duration (transition durations)
|
|
137
|
+
var duration = (0, _utils.flattenDuration)(themeObj.duration);
|
|
138
|
+
variables.push.apply(variables, _toConsumableArray(objectToCSSVariables(duration, "duration")));
|
|
139
|
+
console.log(" - Mapped ".concat(Object.keys(duration).length, " duration values"));
|
|
140
|
+
|
|
141
|
+
// Build the CSS
|
|
142
|
+
return "/**\n * Seeds Design System - CSS Custom Properties (".concat(mode, " theme)\n * @see https://github.com/sproutsocial/seeds\n */\n\n").concat(selector, " {\n").concat(variables.join("\n"), "\n}\n");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Build a combined CSS file with both light and dark themes
|
|
147
|
+
*/
|
|
148
|
+
function generateCombinedCSS() {
|
|
149
|
+
console.log("Building combined CSS with light and dark themes...");
|
|
150
|
+
var lightCSS = generateCSSVariables(_theme.default, "light");
|
|
151
|
+
var darkCSS = generateCSSVariables(_theme2.default, "dark");
|
|
152
|
+
return "".concat(lightCSS, "\n").concat(darkCSS);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Main build function for CSS variables
|
|
157
|
+
*/
|
|
158
|
+
function buildCSSVariables() {
|
|
159
|
+
return _buildCSSVariables.apply(this, arguments);
|
|
160
|
+
} // Allow running this script directly
|
|
161
|
+
function _buildCSSVariables() {
|
|
162
|
+
_buildCSSVariables = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
163
|
+
var distDir, lightCSS, darkCSS, combinedCSS;
|
|
164
|
+
return _regenerator().w(function (_context) {
|
|
165
|
+
while (1) switch (_context.n) {
|
|
166
|
+
case 0:
|
|
167
|
+
console.log("\n=== Building CSS Custom Properties ===\n");
|
|
168
|
+
distDir = _path.default.join(__dirname, "../../dist"); // Ensure dist directory exists
|
|
169
|
+
if (!_fs.default.existsSync(distDir)) {
|
|
170
|
+
_fs.default.mkdirSync(distDir, {
|
|
171
|
+
recursive: true
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Build light theme CSS
|
|
176
|
+
lightCSS = generateCSSVariables(_theme.default, "light");
|
|
177
|
+
_fs.default.writeFileSync(_path.default.join(distDir, "theme.css"), lightCSS, "utf-8");
|
|
178
|
+
console.log(" \u2713 Written light theme to dist/theme.css");
|
|
179
|
+
|
|
180
|
+
// Build dark theme CSS
|
|
181
|
+
darkCSS = generateCSSVariables(_theme2.default, "dark");
|
|
182
|
+
_fs.default.writeFileSync(_path.default.join(distDir, "theme-dark.css"), darkCSS, "utf-8");
|
|
183
|
+
console.log(" \u2713 Written dark theme to dist/theme-dark.css");
|
|
184
|
+
|
|
185
|
+
// Build combined CSS
|
|
186
|
+
combinedCSS = generateCombinedCSS();
|
|
187
|
+
_fs.default.writeFileSync(_path.default.join(distDir, "theme-all.css"), combinedCSS, "utf-8");
|
|
188
|
+
console.log(" \u2713 Written combined theme to dist/theme-all.css");
|
|
189
|
+
console.log("\n✅ CSS variables built successfully!\n");
|
|
190
|
+
case 1:
|
|
191
|
+
return _context.a(2);
|
|
192
|
+
}
|
|
193
|
+
}, _callee);
|
|
194
|
+
}));
|
|
195
|
+
return _buildCSSVariables.apply(this, arguments);
|
|
196
|
+
}
|
|
197
|
+
if (require.main === module) {
|
|
198
|
+
buildCSSVariables().catch(function (error) {
|
|
199
|
+
console.error("Error building CSS variables:", error);
|
|
200
|
+
process.exit(1);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildTailwindV4Preset = buildTailwindV4Preset;
|
|
7
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
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 }; })(); }
|
|
11
|
+
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); }
|
|
12
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
13
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
16
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
17
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
18
|
+
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); }
|
|
19
|
+
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); }); }; } /**
|
|
20
|
+
* Build a Tailwind CSS v4 @theme preset from Seeds design tokens.
|
|
21
|
+
*
|
|
22
|
+
* In Tailwind v4, theme customization is done in CSS via @theme blocks
|
|
23
|
+
* instead of a JavaScript tailwind.config.js. This builder generates
|
|
24
|
+
* dist/tailwind-preset.css which consuming apps import as:
|
|
25
|
+
*
|
|
26
|
+
* @import "tailwindcss";
|
|
27
|
+
* @import "@sproutsocial/seeds-react-theme/css/tailwind-preset";
|
|
28
|
+
*
|
|
29
|
+
* The @theme block registers custom CSS properties that Tailwind v4 picks
|
|
30
|
+
* up and exposes as utility classes (e.g. --spacing-300 → p-300, gap-300).
|
|
31
|
+
*/
|
|
32
|
+
var COLORS = require("@sproutsocial/seeds-color");
|
|
33
|
+
var SPACE = require("@sproutsocial/seeds-space");
|
|
34
|
+
var BORDER = require("@sproutsocial/seeds-border");
|
|
35
|
+
var TYPOGRAPHY = require("@sproutsocial/seeds-typography");
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Build the Tailwind v4 CSS preset file
|
|
39
|
+
*/
|
|
40
|
+
function buildTailwindV4Preset() {
|
|
41
|
+
return _buildTailwindV4Preset.apply(this, arguments);
|
|
42
|
+
}
|
|
43
|
+
function _buildTailwindV4Preset() {
|
|
44
|
+
_buildTailwindV4Preset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
45
|
+
var distDir, lines, spacingMap, _i, _Object$entries, _Object$entries$_i, key, value, radiusMap, _i2, _Object$entries2, _Object$entries2$_i, _key, _value, typographyScales, _i3, _typographyScales, scale, _key2, val, buttonColors, _i4, _Object$entries3, _Object$entries3$_i, _key3, _value2, semanticColors, _i5, _Object$entries4, _Object$entries4$_i, _key4, _value3, darkButtonColors, _i6, _Object$entries5, _Object$entries5$_i, _key5, _value4, css, outPath;
|
|
46
|
+
return _regenerator().w(function (_context) {
|
|
47
|
+
while (1) switch (_context.n) {
|
|
48
|
+
case 0:
|
|
49
|
+
console.log("\n=== Building Tailwind v4 CSS Preset ===\n");
|
|
50
|
+
distDir = _path.default.join(__dirname, "../../dist");
|
|
51
|
+
if (!_fs.default.existsSync(distDir)) {
|
|
52
|
+
_fs.default.mkdirSync(distDir, {
|
|
53
|
+
recursive: true
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
lines = ["/**", " * Seeds Design System — Tailwind CSS v4 Preset", " *", " * Import this file in your CSS entry point:", ' * @import "tailwindcss";', ' * @import "@sproutsocial/seeds-react-theme/css/tailwind-preset";', " *", " * All values are sourced from Seeds token packages — no hardcoded values.", " * Dark mode is handled via the .dark class on <html>.", " */", "", "@theme {"]; // -------------------------------------------------------------------------
|
|
57
|
+
// Spacing — from @sproutsocial/seeds-space
|
|
58
|
+
// Tailwind v4: --spacing-{key} → p-{key}, m-{key}, gap-{key}, w-{key}, etc.
|
|
59
|
+
// -------------------------------------------------------------------------
|
|
60
|
+
lines.push(" /* Spacing — from @sproutsocial/seeds-space */");
|
|
61
|
+
spacingMap = {
|
|
62
|
+
0: SPACE.SPACE_SIZE_0,
|
|
63
|
+
100: SPACE.SPACE_SIZE_100,
|
|
64
|
+
200: SPACE.SPACE_SIZE_200,
|
|
65
|
+
300: SPACE.SPACE_SIZE_300,
|
|
66
|
+
350: SPACE.SPACE_SIZE_350,
|
|
67
|
+
400: SPACE.SPACE_SIZE_400,
|
|
68
|
+
450: SPACE.SPACE_SIZE_450,
|
|
69
|
+
500: SPACE.SPACE_SIZE_500,
|
|
70
|
+
600: SPACE.SPACE_SIZE_600
|
|
71
|
+
};
|
|
72
|
+
for (_i = 0, _Object$entries = Object.entries(spacingMap); _i < _Object$entries.length; _i++) {
|
|
73
|
+
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), key = _Object$entries$_i[0], value = _Object$entries$_i[1];
|
|
74
|
+
lines.push(" --spacing-".concat(key, ": ").concat(value, ";"));
|
|
75
|
+
}
|
|
76
|
+
console.log(" - Mapped ".concat(Object.keys(spacingMap).length, " spacing tokens"));
|
|
77
|
+
lines.push("");
|
|
78
|
+
|
|
79
|
+
// -------------------------------------------------------------------------
|
|
80
|
+
// Border radius — from @sproutsocial/seeds-border
|
|
81
|
+
// Tailwind v4: --radius-{key} → rounded-{key}
|
|
82
|
+
// -------------------------------------------------------------------------
|
|
83
|
+
lines.push(" /* Border radius — from @sproutsocial/seeds-border */");
|
|
84
|
+
radiusMap = {
|
|
85
|
+
400: BORDER.BORDER_RADIUS_400,
|
|
86
|
+
500: BORDER.BORDER_RADIUS_500,
|
|
87
|
+
600: BORDER.BORDER_RADIUS_600,
|
|
88
|
+
800: BORDER.BORDER_RADIUS_800,
|
|
89
|
+
900: BORDER.BORDER_RADIUS_900,
|
|
90
|
+
1000: BORDER.BORDER_RADIUS_1000,
|
|
91
|
+
pill: "999999px",
|
|
92
|
+
inner: "4px",
|
|
93
|
+
outer: "8px"
|
|
94
|
+
};
|
|
95
|
+
for (_i2 = 0, _Object$entries2 = Object.entries(radiusMap); _i2 < _Object$entries2.length; _i2++) {
|
|
96
|
+
_Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2), _key = _Object$entries2$_i[0], _value = _Object$entries2$_i[1];
|
|
97
|
+
lines.push(" --radius-".concat(_key, ": ").concat(_value, ";"));
|
|
98
|
+
}
|
|
99
|
+
console.log(" - Mapped ".concat(Object.keys(radiusMap).length, " border radius tokens"));
|
|
100
|
+
lines.push("");
|
|
101
|
+
|
|
102
|
+
// -------------------------------------------------------------------------
|
|
103
|
+
// Font size — from @sproutsocial/seeds-typography
|
|
104
|
+
// Tailwind v4: --text-{key}--font-size + --text-{key}--line-height → text-{key}
|
|
105
|
+
// -------------------------------------------------------------------------
|
|
106
|
+
lines.push(" /* Font size — from @sproutsocial/seeds-typography */");
|
|
107
|
+
typographyScales = [100, 200, 300, 400, 500, 600, 700];
|
|
108
|
+
for (_i3 = 0, _typographyScales = typographyScales; _i3 < _typographyScales.length; _i3++) {
|
|
109
|
+
scale = _typographyScales[_i3];
|
|
110
|
+
_key2 = "TYPOGRAPHY_SIZE_".concat(scale);
|
|
111
|
+
val = TYPOGRAPHY[_key2];
|
|
112
|
+
if (val && val.fontSize && val.lineHeight) {
|
|
113
|
+
// Tailwind v4 uses --text-*--font-size and --text-*--line-height for
|
|
114
|
+
// the two-value tuple equivalent
|
|
115
|
+
lines.push(" --text-".concat(scale, "--font-size: ").concat(val.fontSize, ";"));
|
|
116
|
+
lines.push(" --text-".concat(scale, "--line-height: ").concat(val.lineHeight, ";"));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
console.log(" - Mapped ".concat(typographyScales.length, " typography scales"));
|
|
120
|
+
lines.push("");
|
|
121
|
+
|
|
122
|
+
// -------------------------------------------------------------------------
|
|
123
|
+
// Button colors — from @sproutsocial/seeds-color (static values)
|
|
124
|
+
// Light mode defaults; dark mode via @variant dark overrides below.
|
|
125
|
+
// -------------------------------------------------------------------------
|
|
126
|
+
lines.push(" /* Button colors — from @sproutsocial/seeds-color (light mode) */");
|
|
127
|
+
buttonColors = {
|
|
128
|
+
// Primary
|
|
129
|
+
"color-button-primary-bg-base": COLORS.COLOR_BLUE_700,
|
|
130
|
+
"color-button-primary-bg-hover": COLORS.COLOR_BLUE_800,
|
|
131
|
+
"color-button-primary-bg-active": COLORS.COLOR_BLUE_900,
|
|
132
|
+
"color-button-primary-text-base": COLORS.COLOR_NEUTRAL_0,
|
|
133
|
+
"color-button-primary-text-hover": COLORS.COLOR_NEUTRAL_0,
|
|
134
|
+
"color-button-primary-border-base": "transparent",
|
|
135
|
+
// Secondary
|
|
136
|
+
"color-button-secondary-bg-base": "transparent",
|
|
137
|
+
"color-button-secondary-bg-hover": COLORS.COLOR_NEUTRAL_800,
|
|
138
|
+
"color-button-secondary-bg-active": COLORS.COLOR_NEUTRAL_900,
|
|
139
|
+
"color-button-secondary-text-base": COLORS.COLOR_NEUTRAL_800,
|
|
140
|
+
"color-button-secondary-text-hover": COLORS.COLOR_NEUTRAL_0,
|
|
141
|
+
"color-button-secondary-border-base": COLORS.COLOR_NEUTRAL_800,
|
|
142
|
+
// Destructive
|
|
143
|
+
"color-button-destructive-bg-base": COLORS.COLOR_RED_800,
|
|
144
|
+
"color-button-destructive-bg-hover": COLORS.COLOR_RED_900,
|
|
145
|
+
"color-button-destructive-bg-active": COLORS.COLOR_RED_1000,
|
|
146
|
+
"color-button-destructive-text-base": COLORS.COLOR_NEUTRAL_0,
|
|
147
|
+
"color-button-destructive-text-hover": COLORS.COLOR_NEUTRAL_0,
|
|
148
|
+
"color-button-destructive-border-base": "transparent",
|
|
149
|
+
// Placeholder
|
|
150
|
+
"color-button-placeholder-bg-base": "transparent",
|
|
151
|
+
"color-button-placeholder-bg-hover": COLORS.COLOR_NEUTRAL_0,
|
|
152
|
+
"color-button-placeholder-bg-active": COLORS.COLOR_NEUTRAL_0,
|
|
153
|
+
"color-button-placeholder-text-base": COLORS.COLOR_BLUE_700,
|
|
154
|
+
"color-button-placeholder-text-hover": COLORS.COLOR_BLUE_800,
|
|
155
|
+
"color-button-placeholder-border-base": COLORS.COLOR_NEUTRAL_500
|
|
156
|
+
};
|
|
157
|
+
for (_i4 = 0, _Object$entries3 = Object.entries(buttonColors); _i4 < _Object$entries3.length; _i4++) {
|
|
158
|
+
_Object$entries3$_i = _slicedToArray(_Object$entries3[_i4], 2), _key3 = _Object$entries3$_i[0], _value2 = _Object$entries3$_i[1];
|
|
159
|
+
lines.push(" --".concat(_key3, ": ").concat(_value2, ";"));
|
|
160
|
+
}
|
|
161
|
+
console.log(" - Mapped ".concat(Object.keys(buttonColors).length, " button color tokens"));
|
|
162
|
+
lines.push("");
|
|
163
|
+
|
|
164
|
+
// CSS variable passthrough tokens (app, container, text, form)
|
|
165
|
+
// These reference the custom properties defined in theme.css / theme-all.css.
|
|
166
|
+
lines.push(" /* Semantic tokens — reference CSS vars from theme-all.css */");
|
|
167
|
+
semanticColors = {
|
|
168
|
+
"color-app-bg-base": "var(--color-app-bg-base)",
|
|
169
|
+
"color-container-bg-base": "var(--color-container-bg-base)",
|
|
170
|
+
"color-container-bg-success": "var(--color-container-bg-success)",
|
|
171
|
+
"color-container-bg-warning": "var(--color-container-bg-warning)",
|
|
172
|
+
"color-container-bg-error": "var(--color-container-bg-error)",
|
|
173
|
+
"color-container-bg-info": "var(--color-container-bg-info)",
|
|
174
|
+
"color-container-bg-opportunity": "var(--color-container-bg-opportunity)",
|
|
175
|
+
"color-container-border-base": "var(--color-container-border-base)",
|
|
176
|
+
"color-container-border-success": "var(--color-container-border-success)",
|
|
177
|
+
"color-container-border-warning": "var(--color-container-border-warning)",
|
|
178
|
+
"color-container-border-error": "var(--color-container-border-error)",
|
|
179
|
+
"color-container-border-info": "var(--color-container-border-info)",
|
|
180
|
+
"color-container-border-opportunity": "var(--color-container-border-opportunity)",
|
|
181
|
+
"color-text-body": "var(--color-text-body)",
|
|
182
|
+
"color-text-headline": "var(--color-text-headline)",
|
|
183
|
+
"color-text-subtext": "var(--color-text-subtext)",
|
|
184
|
+
"color-form-bg-base": "var(--color-form-bg-base)",
|
|
185
|
+
"color-form-border-base": "var(--color-form-border-base)",
|
|
186
|
+
"color-form-border-selected": "var(--color-form-border-selected)",
|
|
187
|
+
"color-form-placeholder-base": "var(--color-form-placeholder-base)"
|
|
188
|
+
};
|
|
189
|
+
for (_i5 = 0, _Object$entries4 = Object.entries(semanticColors); _i5 < _Object$entries4.length; _i5++) {
|
|
190
|
+
_Object$entries4$_i = _slicedToArray(_Object$entries4[_i5], 2), _key4 = _Object$entries4$_i[0], _value3 = _Object$entries4$_i[1];
|
|
191
|
+
lines.push(" --".concat(_key4, ": ").concat(_value3, ";"));
|
|
192
|
+
}
|
|
193
|
+
console.log(" - Mapped ".concat(Object.keys(semanticColors).length, " semantic color tokens"));
|
|
194
|
+
|
|
195
|
+
// Dark mode variants for button colors — exposed as separate -dark tokens.
|
|
196
|
+
// Usage in JSX: `dark:bg-button-primary-bg-base-dark`
|
|
197
|
+
// (Same approach as the v3 preset — the `dark:` variant is built into Tailwind v4.)
|
|
198
|
+
lines.push(" /* Button colors — dark mode variants (use with dark: prefix) */");
|
|
199
|
+
darkButtonColors = {
|
|
200
|
+
"color-button-primary-bg-base-dark": COLORS.COLOR_BLUE_400,
|
|
201
|
+
"color-button-primary-bg-hover-dark": COLORS.COLOR_BLUE_300,
|
|
202
|
+
"color-button-primary-bg-active-dark": COLORS.COLOR_BLUE_200,
|
|
203
|
+
"color-button-primary-text-base-dark": COLORS.COLOR_NEUTRAL_900,
|
|
204
|
+
"color-button-primary-text-hover-dark": COLORS.COLOR_NEUTRAL_1000,
|
|
205
|
+
"color-button-secondary-bg-hover-dark": COLORS.COLOR_NEUTRAL_100,
|
|
206
|
+
"color-button-secondary-bg-active-dark": COLORS.COLOR_NEUTRAL_0,
|
|
207
|
+
"color-button-secondary-text-base-dark": COLORS.COLOR_NEUTRAL_0,
|
|
208
|
+
"color-button-secondary-text-hover-dark": COLORS.COLOR_NEUTRAL_800,
|
|
209
|
+
"color-button-secondary-border-base-dark": COLORS.COLOR_NEUTRAL_0,
|
|
210
|
+
"color-button-destructive-bg-base-dark": COLORS.COLOR_RED_400,
|
|
211
|
+
"color-button-destructive-bg-hover-dark": COLORS.COLOR_RED_300,
|
|
212
|
+
"color-button-destructive-bg-active-dark": COLORS.COLOR_RED_200,
|
|
213
|
+
"color-button-destructive-text-base-dark": COLORS.COLOR_NEUTRAL_900,
|
|
214
|
+
"color-button-destructive-text-hover-dark": COLORS.COLOR_NEUTRAL_1000,
|
|
215
|
+
"color-button-placeholder-bg-hover-dark": COLORS.COLOR_NEUTRAL_1100,
|
|
216
|
+
"color-button-placeholder-bg-active-dark": COLORS.COLOR_NEUTRAL_1100,
|
|
217
|
+
"color-button-placeholder-text-base-dark": COLORS.COLOR_BLUE_400,
|
|
218
|
+
"color-button-placeholder-text-hover-dark": COLORS.COLOR_BLUE_300
|
|
219
|
+
};
|
|
220
|
+
for (_i6 = 0, _Object$entries5 = Object.entries(darkButtonColors); _i6 < _Object$entries5.length; _i6++) {
|
|
221
|
+
_Object$entries5$_i = _slicedToArray(_Object$entries5[_i6], 2), _key5 = _Object$entries5$_i[0], _value4 = _Object$entries5$_i[1];
|
|
222
|
+
lines.push(" --".concat(_key5, ": ").concat(_value4, ";"));
|
|
223
|
+
}
|
|
224
|
+
console.log(" - Mapped ".concat(Object.keys(darkButtonColors).length, " dark mode button color tokens"));
|
|
225
|
+
lines.push("}");
|
|
226
|
+
lines.push("");
|
|
227
|
+
css = lines.join("\n");
|
|
228
|
+
outPath = _path.default.join(distDir, "tailwind-preset.css");
|
|
229
|
+
_fs.default.writeFileSync(outPath, css, "utf-8");
|
|
230
|
+
console.log(" ✓ Written Tailwind v4 preset to dist/tailwind-preset.css");
|
|
231
|
+
console.log("\n✅ Tailwind v4 preset built successfully!\n");
|
|
232
|
+
case 1:
|
|
233
|
+
return _context.a(2);
|
|
234
|
+
}
|
|
235
|
+
}, _callee);
|
|
236
|
+
}));
|
|
237
|
+
return _buildTailwindV4Preset.apply(this, arguments);
|
|
238
|
+
}
|