@bakers-build/addon-bakers-ui 0.10.1-next.6 → 0.10.1-next.7
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.
|
@@ -2,19 +2,24 @@ import { type VNode } from '@opentui/core';
|
|
|
2
2
|
import { SPLASH_MS } from '../lib/theme.js';
|
|
3
3
|
import type { TuiOptions } from '../types.js';
|
|
4
4
|
export { SPLASH_MS };
|
|
5
|
-
/** OpenTUI ASCIIFont name for the splash wordmark. */
|
|
6
|
-
export declare const SPLASH_FONT: "block";
|
|
7
5
|
/** Splash wordmark text (ASCIIFont has no emoji glyphs). */
|
|
8
|
-
export declare const SPLASH_TEXT = "bakers";
|
|
6
|
+
export declare const SPLASH_TEXT = "bakers.build";
|
|
9
7
|
/** Vertical padding inside the splash frame. */
|
|
10
8
|
export declare const SPLASH_FRAME_PAD_Y = 2;
|
|
11
9
|
/** Horizontal padding inside the splash frame. */
|
|
12
10
|
export declare const SPLASH_FRAME_PAD_X = 4;
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
export interface SplashWordmark {
|
|
12
|
+
tier: 'block' | 'tiny' | 'text';
|
|
13
|
+
frameWidth: number;
|
|
14
|
+
}
|
|
15
|
+
/** The largest wordmark whose frame fits `width` columns; plain text otherwise. */
|
|
16
|
+
export declare const splashWordmark: (width: number) => SplashWordmark;
|
|
15
17
|
/**
|
|
16
|
-
* Centered BORDER box with
|
|
17
|
-
*
|
|
18
|
+
* Centered BORDER box with the bakers.build wordmark sized for `width` columns —
|
|
19
|
+
* modal-like, not a wash. The terminal typeface is unchanged.
|
|
20
|
+
*
|
|
21
|
+
* shortcut: the tier is picked once at mount, a resize during the 500 ms hold is
|
|
22
|
+
* not followed; re-pick on resize if the splash is ever held longer.
|
|
18
23
|
*
|
|
19
24
|
* `position: 'absolute'` is load-bearing: the splash is mounted into the SAME
|
|
20
25
|
* `shell` that `createRegions` has already filled with `region-chrome`,
|
|
@@ -24,7 +29,7 @@ export declare const SPLASH_FRAME_WIDTH: number;
|
|
|
24
29
|
* `justifyContent`/`alignItems: center` place the frame in the true middle —
|
|
25
30
|
* the same treatment `region-modal` gets (`regions.ts`).
|
|
26
31
|
*/
|
|
27
|
-
export declare const splashTree: () => VNode;
|
|
32
|
+
export declare const splashTree: (width: number) => VNode;
|
|
28
33
|
export type SplashWait = (ms: number) => Promise<void>;
|
|
29
34
|
/** Hold for `ms` (injectable clock for tests). Failures must not block boot. */
|
|
30
35
|
export declare const awaitSplash: (ms?: number, wait?: SplashWait) => Promise<void>;
|
|
@@ -2,26 +2,53 @@
|
|
|
2
2
|
// Non-TTY / pipe never enters this path. Injected-renderer harnesses skip by
|
|
3
3
|
// default (`shouldSkipSplash`) so the bun suite does not pay SPLASH_MS.
|
|
4
4
|
//
|
|
5
|
-
// OpenTUI cannot change the terminal typeface.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import {
|
|
5
|
+
// OpenTUI cannot change the terminal typeface. The “bakers.build” wordmark uses
|
|
6
|
+
// the largest ASCIIFont that keeps the BORDER box inside the terminal, and plain
|
|
7
|
+
// text below that, so the splash never wraps or clips from 39 columns up.
|
|
8
|
+
import { ASCIIFontRenderable, BoxRenderable, h, measureText, TextRenderable, } from '@opentui/core';
|
|
9
|
+
import { BORDER, BORDER_EMPHASIS, DEFAULT_BACKGROUND, SPLASH_MS, } from '../lib/theme.js';
|
|
9
10
|
import { LOGO_WIDTH, logoTree } from './logo.js';
|
|
10
11
|
export { SPLASH_MS };
|
|
11
|
-
/** OpenTUI ASCIIFont name for the splash wordmark. */
|
|
12
|
-
export const SPLASH_FONT = 'block';
|
|
13
12
|
/** Splash wordmark text (ASCIIFont has no emoji glyphs). */
|
|
14
|
-
export const SPLASH_TEXT = 'bakers';
|
|
13
|
+
export const SPLASH_TEXT = 'bakers.build';
|
|
15
14
|
/** Vertical padding inside the splash frame. */
|
|
16
15
|
export const SPLASH_FRAME_PAD_Y = 2;
|
|
17
16
|
/** Horizontal padding inside the splash frame. */
|
|
18
17
|
export const SPLASH_FRAME_PAD_X = 4;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
/** Logo, gap 3, horizontal padding and the two border columns around the mark. */
|
|
19
|
+
const frameWidthFor = (markWidth) => markWidth + LOGO_WIDTH + 3 + SPLASH_FRAME_PAD_X * 2 + 2;
|
|
20
|
+
// Largest first; `tiny` is half blocks like the logo.
|
|
21
|
+
const FONT_TIERS = ['block', 'tiny'].map((font) => ({
|
|
22
|
+
tier: font,
|
|
23
|
+
frameWidth: frameWidthFor(measureText({ text: SPLASH_TEXT, font }).width),
|
|
24
|
+
}));
|
|
25
|
+
/** The largest wordmark whose frame fits `width` columns; plain text otherwise. */
|
|
26
|
+
export const splashWordmark = (width) => FONT_TIERS.find((tier) => tier.frameWidth <= width) ?? {
|
|
27
|
+
tier: 'text',
|
|
28
|
+
frameWidth: frameWidthFor(SPLASH_TEXT.length),
|
|
29
|
+
};
|
|
30
|
+
const wordmarkTree = (tier) => tier === 'text'
|
|
31
|
+
? h(TextRenderable, {
|
|
32
|
+
id: 'splash-wordmark',
|
|
33
|
+
content: SPLASH_TEXT,
|
|
34
|
+
fg: BORDER_EMPHASIS,
|
|
35
|
+
bg: DEFAULT_BACKGROUND,
|
|
36
|
+
selectable: false,
|
|
37
|
+
})
|
|
38
|
+
: h(ASCIIFontRenderable, {
|
|
39
|
+
id: 'splash-wordmark',
|
|
40
|
+
text: SPLASH_TEXT,
|
|
41
|
+
font: tier,
|
|
42
|
+
color: BORDER_EMPHASIS,
|
|
43
|
+
backgroundColor: DEFAULT_BACKGROUND,
|
|
44
|
+
selectable: false,
|
|
45
|
+
});
|
|
22
46
|
/**
|
|
23
|
-
* Centered BORDER box with
|
|
24
|
-
*
|
|
47
|
+
* Centered BORDER box with the bakers.build wordmark sized for `width` columns —
|
|
48
|
+
* modal-like, not a wash. The terminal typeface is unchanged.
|
|
49
|
+
*
|
|
50
|
+
* shortcut: the tier is picked once at mount, a resize during the 500 ms hold is
|
|
51
|
+
* not followed; re-pick on resize if the splash is ever held longer.
|
|
25
52
|
*
|
|
26
53
|
* `position: 'absolute'` is load-bearing: the splash is mounted into the SAME
|
|
27
54
|
* `shell` that `createRegions` has already filled with `region-chrome`,
|
|
@@ -31,45 +58,41 @@ export const SPLASH_FRAME_WIDTH = splashMarkSize.width + LOGO_WIDTH + 3 + SPLASH
|
|
|
31
58
|
* `justifyContent`/`alignItems: center` place the frame in the true middle —
|
|
32
59
|
* the same treatment `region-modal` gets (`regions.ts`).
|
|
33
60
|
*/
|
|
34
|
-
export const splashTree = () =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
color: DEFAULT_FOREGROUND,
|
|
70
|
-
backgroundColor: DEFAULT_BACKGROUND,
|
|
71
|
-
selectable: false,
|
|
72
|
-
})));
|
|
61
|
+
export const splashTree = (width) => {
|
|
62
|
+
const mark = splashWordmark(width);
|
|
63
|
+
return h(BoxRenderable, {
|
|
64
|
+
id: 'splash-root',
|
|
65
|
+
position: 'absolute',
|
|
66
|
+
left: 0,
|
|
67
|
+
top: 0,
|
|
68
|
+
flexDirection: 'column',
|
|
69
|
+
width: '100%',
|
|
70
|
+
height: '100%',
|
|
71
|
+
justifyContent: 'center',
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
backgroundColor: DEFAULT_BACKGROUND,
|
|
74
|
+
}, h(BoxRenderable, {
|
|
75
|
+
id: 'splash-frame',
|
|
76
|
+
border: true,
|
|
77
|
+
borderStyle: 'rounded',
|
|
78
|
+
borderColor: BORDER,
|
|
79
|
+
backgroundColor: DEFAULT_BACKGROUND,
|
|
80
|
+
width: mark.frameWidth,
|
|
81
|
+
paddingLeft: SPLASH_FRAME_PAD_X,
|
|
82
|
+
paddingRight: SPLASH_FRAME_PAD_X,
|
|
83
|
+
paddingTop: SPLASH_FRAME_PAD_Y,
|
|
84
|
+
paddingBottom: SPLASH_FRAME_PAD_Y,
|
|
85
|
+
flexDirection: 'row',
|
|
86
|
+
gap: 3,
|
|
87
|
+
justifyContent: 'center',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
}, h(BoxRenderable, {
|
|
90
|
+
id: 'splash-logo',
|
|
91
|
+
width: LOGO_WIDTH,
|
|
92
|
+
flexShrink: 0,
|
|
93
|
+
flexDirection: 'column',
|
|
94
|
+
}, ...logoTree()), wordmarkTree(mark.tier)));
|
|
95
|
+
};
|
|
73
96
|
const defaultWait = (ms) => new Promise((resolve) => {
|
|
74
97
|
setTimeout(resolve, ms);
|
|
75
98
|
});
|
|
@@ -329,7 +329,7 @@ export async function runTicketTui(_document, _context, services, options = {})
|
|
|
329
329
|
// Best-effort: paint/timer failure must not block reaching the main UI.
|
|
330
330
|
if (interactive && renderer && shell && !shouldSkipSplash(options)) {
|
|
331
331
|
try {
|
|
332
|
-
const splash = mountTree(renderer, shell, splashTree());
|
|
332
|
+
const splash = mountTree(renderer, shell, splashTree(renderer.width));
|
|
333
333
|
renderer.requestRender();
|
|
334
334
|
await awaitSplash(SPLASH_MS, options.wait);
|
|
335
335
|
unmountTree(shell, splash);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/addon-bakers-ui",
|
|
3
|
-
"version": "0.10.1-next.
|
|
3
|
+
"version": "0.10.1-next.7",
|
|
4
4
|
"description": "bakers.build TUI: interactive terminal UI (dashboard, projects, tickets) as a dropsh `tui` renderer plugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"zustand": "^5.0.15"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@bakers-build/core": "^0.10.1-next.
|
|
36
|
-
"@bakers-build/message": "^0.10.1-next.
|
|
35
|
+
"@bakers-build/core": "^0.10.1-next.7",
|
|
36
|
+
"@bakers-build/message": "^0.10.1-next.7"
|
|
37
37
|
},
|
|
38
38
|
"bakersBuild": {
|
|
39
|
-
"commit": "
|
|
39
|
+
"commit": "c45a694ff28d41c3755ec40bddc9b685295004e8",
|
|
40
40
|
"channel": "next"
|
|
41
41
|
}
|
|
42
42
|
}
|