@timmo001/groundwork-report 0.0.0 → 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 +5 -4
  2. package/src/desktop.ts +16 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmo001/groundwork-report",
3
- "version": "0.0.0",
3
+ "version": "0.9.39",
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",
@@ -19,7 +19,8 @@
19
19
  "./src/client.ts"
20
20
  ],
21
21
  "publishConfig": {
22
- "access": "public"
22
+ "access": "public",
23
+ "provenance": true
23
24
  },
24
25
  "repository": {
25
26
  "type": "git",
@@ -34,8 +35,8 @@
34
35
  "format:check": "prettier --check ."
35
36
  },
36
37
  "dependencies": {
37
- "@timmo001/groundwork-tokens": "0.9.37",
38
- "@timmo001/groundwork-ui": "0.9.37",
38
+ "@timmo001/groundwork-tokens": "0.9.39",
39
+ "@timmo001/groundwork-ui": "0.9.39",
39
40
  "effect": "4.1.2"
40
41
  },
41
42
  "devDependencies": {
package/src/desktop.ts CHANGED
@@ -10,17 +10,16 @@
10
10
  *
11
11
  * @module
12
12
  */
13
- import { Result } from "effect";
13
+ 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 { optionalThemeChoices } from "@timmo001/groundwork-tokens/page";
17
+ import { optionalThemeDocuments } from "@timmo001/groundwork-tokens/page";
18
18
  import {
19
19
  omarchyTheme,
20
- parseTheme,
21
20
  type OmarchyCurrentTheme,
22
21
  } from "@timmo001/groundwork-tokens/runtime";
23
- import type { MappedTheme } from "@timmo001/groundwork-tokens";
22
+ import { MappedTheme } from "@timmo001/groundwork-tokens";
24
23
 
25
24
  /** What `readReportThemes` found, to spread into `reportPage`'s options. */
26
25
  export interface ReportThemes {
@@ -28,26 +27,18 @@ export interface ReportThemes {
28
27
  readonly desktop: readonly MappedTheme[];
29
28
  }
30
29
 
31
- /** The optional themes' documents, to drop desktop themes that match them. */
32
- const optionalThemes = async () => {
33
- const documents: MappedTheme[] = [];
30
+ const decodeMapped = Schema.decodeUnknownResult(MappedTheme);
34
31
 
35
- for (const { id } of optionalThemeChoices) {
36
- const file = await Bun.file(
37
- Bun.fileURLToPath(
38
- import.meta.resolve(`@timmo001/groundwork-tokens/themes/${id}.json`),
39
- ),
40
- ).text();
41
-
42
- const parsed = parseTheme(file);
43
-
44
- if (Result.isSuccess(parsed) && parsed.success.kind === "mapped") {
45
- documents.push(parsed.success);
46
- }
47
- }
32
+ /**
33
+ * The optional themes' documents, to drop desktop themes that match them.
34
+ * They come bundled rather than read from disk, so this works in an app
35
+ * compiled to one binary.
36
+ */
37
+ const optionalThemes = optionalThemeDocuments.flatMap((document) => {
38
+ const decoded = decodeMapped(document);
48
39
 
49
- return documents;
50
- };
40
+ return Result.isSuccess(decoded) ? [decoded.success] : [];
41
+ });
51
42
 
52
43
  /**
53
44
  * Reads the Omarchy theme in use and every other theme on the machine, the
@@ -55,18 +46,15 @@ const optionalThemes = async () => {
55
46
  * terminal following Omarchy doesn't show twice.
56
47
  */
57
48
  export const readReportThemes = async (): Promise<ReportThemes> => {
58
- const [omarchy, optional] = await Promise.all([
59
- readOmarchyTheme(),
60
- optionalThemes(),
61
- ]);
49
+ const omarchy = await readOmarchyTheme();
62
50
 
63
51
  const current =
64
52
  omarchy === null ? undefined : omarchyTheme(omarchy.colors, omarchy.name);
65
53
 
66
54
  const existing =
67
55
  current !== undefined && Result.isSuccess(current)
68
- ? [...optional, current.success]
69
- : optional;
56
+ ? [...optionalThemes, current.success]
57
+ : optionalThemes;
70
58
 
71
59
  return {
72
60
  omarchy,