@bakers-build/addon-bakers-ui 0.10.1-next.6 → 0.10.1-next.8

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
- /** Outer frame width: mark + horizontal pad + border columns. */
14
- export declare const SPLASH_FRAME_WIDTH: number;
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 an ASCIIFont bakers mark — modal-like, not a wash.
17
- * Font is OpenTUI block letters; the terminal typeface is unchanged.
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. Splash “bakers” uses ASCIIFont
6
- // (multi-line block letters) so the mark reads large inside a BORDER box.
7
- import { ASCIIFontRenderable, BoxRenderable, h, measureText, } from '@opentui/core';
8
- import { BORDER, DEFAULT_BACKGROUND, DEFAULT_FOREGROUND, SPLASH_MS, } from '../lib/theme.js';
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
- const splashMarkSize = measureText({ text: SPLASH_TEXT, font: SPLASH_FONT });
20
- /** Outer frame width: mark + horizontal pad + border columns. */
21
- export const SPLASH_FRAME_WIDTH = splashMarkSize.width + LOGO_WIDTH + 3 + SPLASH_FRAME_PAD_X * 2 + 2;
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 an ASCIIFont bakers mark — modal-like, not a wash.
24
- * Font is OpenTUI block letters; the terminal typeface is unchanged.
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 = () => h(BoxRenderable, {
35
- id: 'splash-root',
36
- position: 'absolute',
37
- left: 0,
38
- top: 0,
39
- flexDirection: 'column',
40
- width: '100%',
41
- height: '100%',
42
- justifyContent: 'center',
43
- alignItems: 'center',
44
- backgroundColor: DEFAULT_BACKGROUND,
45
- }, h(BoxRenderable, {
46
- id: 'splash-frame',
47
- border: true,
48
- borderStyle: 'rounded',
49
- borderColor: BORDER,
50
- backgroundColor: DEFAULT_BACKGROUND,
51
- width: SPLASH_FRAME_WIDTH,
52
- paddingLeft: SPLASH_FRAME_PAD_X,
53
- paddingRight: SPLASH_FRAME_PAD_X,
54
- paddingTop: SPLASH_FRAME_PAD_Y,
55
- paddingBottom: SPLASH_FRAME_PAD_Y,
56
- flexDirection: 'row',
57
- gap: 3,
58
- justifyContent: 'center',
59
- alignItems: 'center',
60
- }, h(BoxRenderable, {
61
- id: 'splash-logo',
62
- width: LOGO_WIDTH,
63
- flexShrink: 0,
64
- flexDirection: 'column',
65
- }, ...logoTree()), h(ASCIIFontRenderable, {
66
- id: 'splash-bakers',
67
- text: SPLASH_TEXT,
68
- font: SPLASH_FONT,
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.6",
3
+ "version": "0.10.1-next.8",
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.6",
36
- "@bakers-build/message": "^0.10.1-next.6"
35
+ "@bakers-build/core": "^0.10.1-next.8",
36
+ "@bakers-build/message": "^0.10.1-next.8"
37
37
  },
38
38
  "bakersBuild": {
39
- "commit": "93f045b91e4490c2e2569bd02bd641f4d1c6491f",
39
+ "commit": "6d6a551127b476e4a073f4d842b7fdb10ef6ccb1",
40
40
  "channel": "next"
41
41
  }
42
42
  }