@timmo001/groundwork-tokens 0.9.38 → 0.9.39

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/page.ts +23 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmo001/groundwork-tokens",
3
- "version": "0.9.38",
3
+ "version": "0.9.39",
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",
package/src/page.ts CHANGED
@@ -101,11 +101,11 @@ export const coreThemeChoices: readonly ThemeChoice[] = [
101
101
  ].map(({ id, name }) => ({ id, name }));
102
102
 
103
103
  /**
104
- * The optional themes, mapped from other palettes, by family and then from
105
- * light to dark. One with a single mode is offered for that scheme alone;
106
- * one with both, such as GitHub's, for either.
104
+ * The optional themes' documents, by family and then from light to dark.
105
+ * They're bundled with the module, so an app compiled to one binary has them
106
+ * without reading `node_modules`. Decode one with the `MappedTheme` Schema.
107
107
  */
108
- export const optionalThemeChoices: readonly ThemeChoice[] = [
108
+ export const optionalThemeDocuments = [
109
109
  catppuccinLatte,
110
110
  catppuccinFrappe,
111
111
  catppuccinMacchiato,
@@ -117,17 +117,25 @@ export const optionalThemeChoices: readonly ThemeChoice[] = [
117
117
  github,
118
118
  githubDimmed,
119
119
  githubHighContrast,
120
- ].map((theme) => ({
121
- id: theme.id,
122
- name: theme.name,
123
- family: theme.family,
124
- mode:
125
- "otherPalette" in theme
126
- ? undefined
127
- : theme.mode === "light"
128
- ? "light"
129
- : "dark",
130
- }));
120
+ ] as const;
121
+
122
+ /**
123
+ * The optional themes, mapped from other palettes, by family and then from
124
+ * light to dark. One with a single mode is offered for that scheme alone;
125
+ * one with both, such as GitHub's, for either.
126
+ */
127
+ export const optionalThemeChoices: readonly ThemeChoice[] =
128
+ optionalThemeDocuments.map((theme) => ({
129
+ id: theme.id,
130
+ name: theme.name,
131
+ family: theme.family,
132
+ mode:
133
+ "otherPalette" in theme
134
+ ? undefined
135
+ : theme.mode === "light"
136
+ ? "light"
137
+ : "dark",
138
+ }));
131
139
 
132
140
  export interface PageThemeOptions {
133
141
  /** The local storage key prefix, such as `my-site:theme`. */