@timmo001/groundwork-tui 0.20.0 → 0.20.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/package.json +5 -3
- package/src/theme.test.ts +0 -104
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timmo001/groundwork-tui",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "Groundwork's terminal components: OpenTUI renderables on the terminal tokens",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
|
-
".": "./src/index.ts"
|
|
8
|
+
".": "./src/index.ts",
|
|
9
|
+
"./*": "./src/*"
|
|
9
10
|
},
|
|
10
11
|
"files": [
|
|
11
12
|
"src",
|
|
13
|
+
"!src/*.test.ts",
|
|
12
14
|
"README.md",
|
|
13
15
|
"LICENSE"
|
|
14
16
|
],
|
|
@@ -31,7 +33,7 @@
|
|
|
31
33
|
"dependencies": {
|
|
32
34
|
"@effect/platform-node": "4.1.2",
|
|
33
35
|
"@opentui/core": "0.8.3",
|
|
34
|
-
"@timmo001/groundwork-tokens": "0.20.
|
|
36
|
+
"@timmo001/groundwork-tokens": "0.20.1",
|
|
35
37
|
"effect": "4.1.2",
|
|
36
38
|
"fuse.js": "7.5.0"
|
|
37
39
|
},
|
package/src/theme.test.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests loading a theme that isn't one of the generated ones: a theme file
|
|
3
|
-
* by path, an app's own document by id and from `GW_THEME`, and the
|
|
4
|
-
* transparent option.
|
|
5
|
-
*
|
|
6
|
-
* @module
|
|
7
|
-
*/
|
|
8
|
-
import { afterEach, expect, test } from "bun:test";
|
|
9
|
-
import { fileURLToPath } from "node:url";
|
|
10
|
-
import { parseTheme } from "@timmo001/groundwork-tokens/runtime";
|
|
11
|
-
import { Effect, Result } from "effect";
|
|
12
|
-
import {
|
|
13
|
-
DEFAULT_THEME,
|
|
14
|
-
loadThemeWith,
|
|
15
|
-
resolveTheme,
|
|
16
|
-
themeFor,
|
|
17
|
-
themeFromDocument,
|
|
18
|
-
themeOptionsWith,
|
|
19
|
-
} from "./theme.ts";
|
|
20
|
-
|
|
21
|
-
const glazingFile = fileURLToPath(
|
|
22
|
-
import.meta.resolve("@timmo001/groundwork-tokens/themes/glazing.json"),
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const kiln = Result.getOrThrow(
|
|
26
|
-
parseTheme(
|
|
27
|
-
JSON.stringify({
|
|
28
|
-
kind: "solved",
|
|
29
|
-
id: "kiln",
|
|
30
|
-
name: "Kiln",
|
|
31
|
-
description: "Warm clay and ember orange.",
|
|
32
|
-
background: "#1f1a17",
|
|
33
|
-
accent: "#e08a4f",
|
|
34
|
-
style: {
|
|
35
|
-
font: "Inter",
|
|
36
|
-
mono: "JetBrains Mono",
|
|
37
|
-
radius: { panel: 6, control: 4, chip: 4 },
|
|
38
|
-
border: { width: 1, strength: "soft" },
|
|
39
|
-
weights: { regular: 400, strong: 600 },
|
|
40
|
-
density: "compact",
|
|
41
|
-
capitals: false,
|
|
42
|
-
link: { color: "accent", underline: "thin" },
|
|
43
|
-
surfaceAccent: "none",
|
|
44
|
-
rows: "dense",
|
|
45
|
-
},
|
|
46
|
-
}),
|
|
47
|
-
),
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
afterEach(() => {
|
|
51
|
-
delete process.env.GW_THEME;
|
|
52
|
-
delete process.env.GW_MODE;
|
|
53
|
-
delete process.env.GW_TRANSPARENT;
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test("a theme file by path matches the generated theme", async () => {
|
|
57
|
-
const fromFile = await Effect.runPromise(
|
|
58
|
-
resolveTheme({ theme: glazingFile, mode: "light" }),
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
expect(fromFile).toEqual(themeFor("glazing", "light"));
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
test("a theme file that isn't there falls back to the default", async () => {
|
|
65
|
-
const theme = await Effect.runPromise(
|
|
66
|
-
resolveTheme({ theme: "./no-such-theme.json" }),
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
expect(theme).toEqual(DEFAULT_THEME);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
test("an app's own theme by id, in its own mode, and transparent", async () => {
|
|
73
|
-
const theme = await Effect.runPromise(
|
|
74
|
-
resolveTheme({ theme: "kiln", transparent: true }, [kiln]),
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
expect(theme).toEqual(
|
|
78
|
-
themeFromDocument(kiln, undefined, { transparent: true }),
|
|
79
|
-
);
|
|
80
|
-
expect(theme.transparent).toBe(true);
|
|
81
|
-
expect(theme.accent).not.toBe(DEFAULT_THEME.accent);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
test("GW_THEME takes a path and GW_TRANSPARENT the option", async () => {
|
|
85
|
-
process.env.GW_THEME = glazingFile;
|
|
86
|
-
process.env.GW_MODE = "darker";
|
|
87
|
-
process.env.GW_TRANSPARENT = "true";
|
|
88
|
-
|
|
89
|
-
const theme = await Effect.runPromise(loadThemeWith());
|
|
90
|
-
|
|
91
|
-
expect(theme).toEqual({
|
|
92
|
-
...themeFor("glazing", "darker"),
|
|
93
|
-
transparent: true,
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
test("the picker lists the app's themes first, then the optional ones too", async () => {
|
|
98
|
-
const options = await Effect.runPromise(themeOptionsWith([kiln]));
|
|
99
|
-
const ids = options.map((option) => option.id);
|
|
100
|
-
|
|
101
|
-
expect(ids[0]).toBe("kiln");
|
|
102
|
-
expect(ids).toContain("catppuccin-mocha");
|
|
103
|
-
expect(options[0]?.modes).toEqual(["light", "dark", "darker"]);
|
|
104
|
-
});
|