@timmo001/groundwork-report 0.9.39 → 0.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmo001/groundwork-report",
3
- "version": "0.9.39",
3
+ "version": "0.10.0",
4
4
  "description": "Groundwork's report page: one self-contained HTML file built from blocks, with every theme and the desktop's Omarchy theme",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -35,8 +35,8 @@
35
35
  "format:check": "prettier --check ."
36
36
  },
37
37
  "dependencies": {
38
- "@timmo001/groundwork-tokens": "0.9.39",
39
- "@timmo001/groundwork-ui": "0.9.39",
38
+ "@timmo001/groundwork-tokens": "0.10.0",
39
+ "@timmo001/groundwork-ui": "0.10.0",
40
40
  "effect": "4.1.2"
41
41
  },
42
42
  "devDependencies": {
package/src/assets.ts CHANGED
@@ -17,17 +17,21 @@ import type { ReportAssets } from "./page.ts";
17
17
 
18
18
  /** Bundles the page script and reads the themes' CSS. */
19
19
  export const reportAssets = async (): Promise<ReportAssets> => {
20
- const build = await Bun.build({
21
- entrypoints: [fileURLToPath(import.meta.resolve("./client.ts"))],
22
- target: "browser",
23
- format: "esm",
24
- minify: true,
25
- });
20
+ // The CLI rather than `Bun.build`, which can't run inside a macro while
21
+ // the bundler waits on it
22
+ const build = Bun.spawnSync([
23
+ process.execPath,
24
+ "build",
25
+ fileURLToPath(import.meta.resolve("./client.ts")),
26
+ "--target=browser",
27
+ "--format=esm",
28
+ "--minify",
29
+ ]);
26
30
 
27
- const [output] = build.outputs;
28
-
29
- if (!build.success || output === undefined) {
30
- throw new AggregateError(build.logs, "The report script didn't build");
31
+ if (!build.success) {
32
+ throw new Error(
33
+ `The report script didn't build:\n${build.stderr.toString()}`,
34
+ );
31
35
  }
32
36
 
33
37
  const css = await Bun.file(
@@ -36,5 +40,5 @@ export const reportAssets = async (): Promise<ReportAssets> => {
36
40
  ),
37
41
  ).text();
38
42
 
39
- return { css, script: await output.text() };
43
+ return { css, script: build.stdout.toString() };
40
44
  };
package/src/client.ts CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  coreThemeChoices,
13
13
  optionalThemeChoices,
14
14
  pageTheme,
15
+ themeOptions,
15
16
  type ThemeChoice,
16
17
  type ThemeMode,
17
18
  } from "@timmo001/groundwork-tokens/page";
@@ -44,7 +45,6 @@ const page = pageTheme({
44
45
  key: config.key,
45
46
  themes: [...coreThemeChoices, ...optionalThemeChoices, ...desktopChoices],
46
47
  defaultTheme: config.defaultTheme,
47
- followOmarchy: false,
48
48
  });
49
49
 
50
50
  // A desktop theme is solved the first time it's picked, then cached so the
@@ -97,23 +97,22 @@ page.subscribe((state) => applyDesktop(state.theme));
97
97
  const picker = document.querySelector("gw-theme-picker");
98
98
 
99
99
  if (picker !== null) {
100
+ // The report's own theme first, then the other core themes, then the
101
+ // optional ones grouped by the palette they come from, such as Catppuccin
102
+ const builtIn = themeOptions([
103
+ ...coreThemeChoices.filter(({ id }) => id === config.defaultTheme),
104
+ ...coreThemeChoices.filter(({ id }) => id !== config.defaultTheme),
105
+ ...optionalThemeChoices,
106
+ ]);
107
+
100
108
  const render = () => {
101
- const { mode, theme, omarchy } = page.state();
109
+ const { mode, theme, only, omarchy } = page.state();
102
110
 
103
111
  picker.mode = mode;
104
112
  picker.theme = theme;
113
+ picker.scheme = only ?? "";
105
114
  picker.themes = [
106
- ...coreThemeChoices.map(({ id, name }) => ({
107
- value: id,
108
- label: name,
109
- group: "Core",
110
- })),
111
- // Grouped by the palette they come from, such as Catppuccin
112
- ...optionalThemeChoices.map(({ id, name, family }) => ({
113
- value: id,
114
- label: name,
115
- group: family ?? "More themes",
116
- })),
115
+ ...builtIn,
117
116
  // Themes translated from the machine the page was made on: the Omarchy
118
117
  // theme in use, which reads `Omarchy (Tokyo Night)`, then the rest,
119
118
  // such as `Nord (Omarchy)` or `Ghostty (Ghostty)`
package/src/desktop.ts CHANGED
@@ -14,7 +14,7 @@ import { Result, Schema } from "effect";
14
14
 
15
15
  import { readDesktopThemes } from "@timmo001/groundwork-tokens/desktop-themes";
16
16
  import { readOmarchyTheme } from "@timmo001/groundwork-tokens/omarchy-current";
17
- import { optionalThemeDocuments } from "@timmo001/groundwork-tokens/page";
17
+ import { optionalThemeDocuments } from "@timmo001/groundwork-tokens/choices";
18
18
  import {
19
19
  omarchyTheme,
20
20
  type OmarchyCurrentTheme,
package/src/page.ts CHANGED
@@ -7,7 +7,8 @@
7
7
  */
8
8
  import type { MappedTheme } from "@timmo001/groundwork-tokens";
9
9
  import type { OmarchyCurrentTheme } from "@timmo001/groundwork-tokens/runtime";
10
- import { themeBootScript } from "@timmo001/groundwork-tokens/page";
10
+ // From `choices`, not `page`, so a CLI without the DOM lib type-checks it
11
+ import { themeBootScript } from "@timmo001/groundwork-tokens/choices";
11
12
 
12
13
  import { html, raw, type Content } from "./html.ts";
13
14
  import { reportCss } from "./styles.ts";
@@ -103,7 +104,7 @@ export const reportPage = (options: ReportPageOptions) => {
103
104
  />
104
105
  <title>${options.title}</title>
105
106
  <script>
106
- ${raw(inline(themeBootScript({ key, defaultTheme, followOmarchy: false }) + desktopBootScript(key), "script"))};
107
+ ${raw(inline(themeBootScript({ key, defaultTheme }) + desktopBootScript(key), "script"))};
107
108
  </script>
108
109
  <style>
109
110
  ${raw(inline(options.assets.css, "style"))}