@solexllc/usx-theme 0.2.0 → 0.2.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/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(distDir, 'themes.css'), GENERATED_CSS + files.join('\n'), 'utf8');
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, themes.css, _themes-registry.scss, themes/{${slugs.join(',')}}.css)`);
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.0",
3
+ "version": "0.2.1",
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/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