@solexllc/usx-theme 0.2.0 → 0.2.2
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 +2 -2
- package/build.js +6 -3
- package/package.json +2 -2
- package/src/_variables.scss +4 -4
- package/src/presets.js +1 -1
- /package/dist/{themes.css → themes/all.css} +0 -0
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ This package stores platform-agnostic tokens in JSON source files and compiles t
|
|
|
17
17
|
- `dist/tokens.js`: generated JS export
|
|
18
18
|
- `dist/theme-manifest.json`: generated theme manifest
|
|
19
19
|
- `dist/theme.css`: every `--usx-*` token at its default, on `:root`
|
|
20
|
-
- `dist/themes/<slug>.css`, `dist/themes.css`: each prebuilt theme as a `[data-theme="<slug>"]` block (and all of them together)
|
|
20
|
+
- `dist/themes/<slug>.css`, `dist/themes/all.css`: each prebuilt theme as a `[data-theme="<slug>"]` block (and all of them together)
|
|
21
21
|
- `dist/_themes-registry.scss`: generated data behind `src/_themes.scss`
|
|
22
22
|
|
|
23
23
|
## Build
|
|
@@ -128,7 +128,7 @@ wiring in this form):
|
|
|
128
128
|
|
|
129
129
|
```js
|
|
130
130
|
import '@solexllc/usx-theme/theme.css';
|
|
131
|
-
import '@solexllc/usx-theme/themes/forest.css'; // or .../themes.css for all
|
|
131
|
+
import '@solexllc/usx-theme/themes/forest.css'; // or .../themes/all.css for all
|
|
132
132
|
```
|
|
133
133
|
|
|
134
134
|
### Notes
|
package/build.js
CHANGED
|
@@ -96,7 +96,10 @@ function resolvePresets(themeManifest, derive, PRESETS) {
|
|
|
96
96
|
|
|
97
97
|
// themes/<slug>.css — one `[data-theme="<slug>"]` block per prebuilt theme,
|
|
98
98
|
// changed tokens only (theme.css's :root supplies the rest). "Default" has
|
|
99
|
-
// nothing to change and is skipped.
|
|
99
|
+
// nothing to change and is skipped. The bundle of all of them lives at
|
|
100
|
+
// themes/all.css rather than themes.css: Sass's pkg: importer tries
|
|
101
|
+
// `themes.css` when resolving `pkg:.../themes` and would find both it and the
|
|
102
|
+
// Sass module, then fail as ambiguous.
|
|
100
103
|
function buildThemeFileCss(theme) {
|
|
101
104
|
const lines = [` color-scheme: ${theme.colorScheme};`, ...theme.entries.map(([cssVar, value]) => ` ${cssVar}: ${value};`)];
|
|
102
105
|
return `${GENERATED_CSS}[data-theme="${theme.slug}"] {\n${lines.join('\n')}\n}\n`;
|
|
@@ -131,7 +134,7 @@ function writeThemes(themeManifest, derive, PRESETS) {
|
|
|
131
134
|
fs.writeFileSync(path.join(themesDistDir, `${theme.slug}.css`), css, 'utf8');
|
|
132
135
|
return css.replace(GENERATED_CSS, '');
|
|
133
136
|
});
|
|
134
|
-
fs.writeFileSync(path.join(
|
|
137
|
+
fs.writeFileSync(path.join(themesDistDir, 'all.css'), GENERATED_CSS + files.join('\n'), 'utf8');
|
|
135
138
|
fs.writeFileSync(path.join(distDir, '_themes-registry.scss'), buildThemesRegistryScss(themeManifest, themes, derive), 'utf8');
|
|
136
139
|
return withTokens.map((t) => t.slug);
|
|
137
140
|
}
|
|
@@ -155,7 +158,7 @@ async function build() {
|
|
|
155
158
|
);
|
|
156
159
|
const slugs = writeThemes(themeManifest, derive, PRESETS);
|
|
157
160
|
|
|
158
|
-
console.log(`[${new Date().toLocaleTimeString()}] Built tokens to dist/ (tokens.css, theme.css, _hooks.scss, tokens.js, theme-manifest.json,
|
|
161
|
+
console.log(`[${new Date().toLocaleTimeString()}] Built tokens to dist/ (tokens.css, theme.css, _hooks.scss, tokens.js, theme-manifest.json, _themes-registry.scss, themes/{all,${slugs.join(',')}}.css)`);
|
|
159
162
|
}
|
|
160
163
|
|
|
161
164
|
// `node build.js --watch` rebuilds on every change under src/ (primitives
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solexllc/usx-theme",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Design tokens package for USX.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"./themes": {
|
|
30
30
|
"sass": "./src/_themes.scss"
|
|
31
31
|
},
|
|
32
|
-
"./themes.css": "./dist/themes.css",
|
|
32
|
+
"./themes/all.css": "./dist/themes/all.css",
|
|
33
33
|
"./themes/*.css": "./dist/themes/*.css",
|
|
34
34
|
"./theme.css": "./dist/theme.css",
|
|
35
35
|
"./theme-manifest": {
|
package/src/_variables.scss
CHANGED
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
@return $fallback;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
//
|
|
37
|
-
// so partial
|
|
38
|
-
@function usx-when($condition, $value) {
|
|
36
|
+
// Omits null/false values; an optional second argument guards composites
|
|
37
|
+
// so partial values like `1px solid null` never reach the CSS output.
|
|
38
|
+
@function usx-when($condition, $value: $condition) {
|
|
39
39
|
@if not $condition {
|
|
40
40
|
@return null;
|
|
41
41
|
}
|
|
@@ -749,7 +749,7 @@ $usx-textarea-padding: null !default;
|
|
|
749
749
|
|
|
750
750
|
// ── Component tokens: File Input ─────────────────────────────────────────────
|
|
751
751
|
// Own hooks for the dropzone target and the managed-multiple file-item rows
|
|
752
|
-
// (see FileInput.
|
|
752
|
+
// (see FileInput.tsx) so either can be overridden independently — both
|
|
753
753
|
// chain to the shared border role/width by default, same as other
|
|
754
754
|
// components' advanced border overrides above.
|
|
755
755
|
$usx-file-input-border-var: null !default;
|
package/src/presets.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// Single source for: the Storybook toolbar theme toggle and Theme Playground
|
|
4
4
|
// preset buttons, and build.js, which resolves each preset (derive.js) and
|
|
5
|
-
// bakes it into dist/themes/<slug>.css, dist/themes.css and the Sass registry
|
|
5
|
+
// bakes it into dist/themes/<slug>.css, dist/themes/all.css and the Sass registry
|
|
6
6
|
// behind `pkg:@solexllc/usx-theme/themes`. Keys are manifest token names;
|
|
7
7
|
// values are CSS values (hex, `var(--usx-*)`, lengths, keywords).
|
|
8
8
|
|
|
File without changes
|