@timmo001/groundwork-tokens 0.10.1 → 0.10.3

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
@@ -31,6 +31,10 @@ their own:
31
31
  import { parseTheme, runtimeTheme } from "@timmo001/groundwork-tokens/runtime";
32
32
  ```
33
33
 
34
+ `blumeThemeCss` from the same export renders a solved theme as Blume's tokens,
35
+ for a docs site on `@timmo001/docs-kit` whose app has its own theme. The
36
+ [docs-kit README](https://github.com/timmo001/groundwork/tree/main/packages/docs-kit#theme) shows the site script.
37
+
34
38
  The `omarchy-current` export reads and watches the Omarchy theme a machine
35
39
  is using, for apps outside a browser, such as a desktop app's main process or
36
40
  a terminal UI. `pageTheme`'s `setOmarchyTheme` offers it in the view:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmo001/groundwork-tokens",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "description": "Groundwork's design tokens: the theme schema, the OKLCH solver and every theme as CSS and JSON",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -59,7 +59,7 @@
59
59
  "@timmo001/oxlint-rules": "0.6.4",
60
60
  "@types/bun": "1.4.4",
61
61
  "oxlint": "1.91.0",
62
- "oxlint-tsgolint": "7.0.2005",
62
+ "oxlint-tsgolint": "7.0.2006",
63
63
  "prettier": "3.9.10",
64
64
  "typescript": "7.0.2"
65
65
  }
package/src/generate.ts CHANGED
@@ -475,19 +475,27 @@ const blumeRoles = {
475
475
  "code-word-border": "border-info",
476
476
  };
477
477
 
478
- /** Blume's color tokens from a theme's roles in one mode. */
478
+ /**
479
+ * Blume's color tokens from a theme's roles in one mode, plus the link color
480
+ * docs-kit's `theme.css` gives prose links, as Blume has no token for it.
481
+ */
479
482
  const blumeColors = (roles: Roles) =>
480
483
  Object.fromEntries(
481
- Object.entries(blumeRoles).flatMap(([token, role]) => {
484
+ [
485
+ ...Object.entries(blumeRoles).map(
486
+ ([token, role]) => [`--blume-${token}`, role] as const,
487
+ ),
488
+ ["--gw-docs-link", "link"] as const,
489
+ ].flatMap(([property, role]) => {
482
490
  const color = roles[role];
483
491
 
484
- return color === undefined ? [] : [[token, toCss(color)]];
492
+ return color === undefined ? [] : [[property, toCss(color)]];
485
493
  }),
486
494
  );
487
495
 
488
496
  const blumeDeclarations = (properties: Record<string, string>) =>
489
497
  Object.entries(properties)
490
- .map(([name, value]) => ` --blume-${name}: ${value};`)
498
+ .map(([name, value]) => ` ${name}: ${value};`)
491
499
  .join("\n");
492
500
 
493
501
  /**
@@ -498,10 +506,10 @@ const blumeRules = (theme: ResolvedTheme, root: string) => {
498
506
  const { light, dark, darker } = theme.modes;
499
507
 
500
508
  const style = {
501
- radius: `${theme.style.radius.panel}px`,
502
- "font-body": fontStack(theme.style.font),
503
- "font-display": fontStack(theme.style.font),
504
- "font-mono": fontStack(theme.style.mono),
509
+ "--blume-radius": `${theme.style.radius.panel}px`,
510
+ "--blume-font-body": fontStack(theme.style.font),
511
+ "--blume-font-display": fontStack(theme.style.font),
512
+ "--blume-font-mono": fontStack(theme.style.mono),
505
513
  };
506
514
 
507
515
  const lightTokens: Record<string, string> =
@@ -525,14 +533,18 @@ const blumeRules = (theme: ResolvedTheme, root: string) => {
525
533
  };
526
534
 
527
535
  /**
528
- * One theme as Blume's tokens, for docs-kit. Fonts are stacks, so the site
529
- * loads the files.
536
+ * One theme as Blume's tokens on `:root`, in each of its modes. Fonts are
537
+ * stacks, so the site loads the files.
530
538
  */
539
+ export const blumeThemeCss = (theme: ResolvedTheme) =>
540
+ blumeRules(theme, ":root").join("\n\n");
541
+
542
+ /** One theme's docs-kit stylesheet. */
531
543
  export const blumeTheme = (theme: ResolvedTheme) =>
532
544
  [
533
545
  `/* ${header} */`,
534
546
  `/* ${theme.name}: ${theme.description} */`,
535
- ...blumeRules(theme, ":root"),
547
+ blumeThemeCss(theme),
536
548
  ].join("\n\n") + "\n";
537
549
 
538
550
  /**
package/src/runtime.ts CHANGED
@@ -14,7 +14,7 @@ import { appTonesCss, type AppTones } from "./tones.ts";
14
14
 
15
15
  export { omarchyTheme, type OmarchyCurrentTheme } from "./omarchy.ts";
16
16
 
17
- export { hexModes } from "./generate.ts";
17
+ export { blumeThemeCss, hexModes } from "./generate.ts";
18
18
 
19
19
  export { appTonesCss, type AppTones } from "./tones.ts";
20
20