@flyingrobots/bijou 1.8.0 → 3.0.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/README.md +11 -11
- package/dist/adapters/test/index.d.ts +0 -1
- package/dist/adapters/test/index.d.ts.map +1 -1
- package/dist/adapters/test/index.js +4 -1
- package/dist/adapters/test/index.js.map +1 -1
- package/dist/adapters/test/runtime.d.ts +2 -0
- package/dist/adapters/test/runtime.d.ts.map +1 -1
- package/dist/adapters/test/runtime.js +1 -0
- package/dist/adapters/test/runtime.js.map +1 -1
- package/dist/core/components/alert.d.ts +2 -4
- package/dist/core/components/alert.d.ts.map +1 -1
- package/dist/core/components/alert.js.map +1 -1
- package/dist/core/components/badge.d.ts +6 -12
- package/dist/core/components/badge.d.ts.map +1 -1
- package/dist/core/components/badge.js +39 -24
- package/dist/core/components/badge.js.map +1 -1
- package/dist/core/components/bcss-style.d.ts +6 -0
- package/dist/core/components/bcss-style.d.ts.map +1 -0
- package/dist/core/components/bcss-style.js +44 -0
- package/dist/core/components/bcss-style.js.map +1 -0
- package/dist/core/components/box-v3.d.ts +9 -0
- package/dist/core/components/box-v3.d.ts.map +1 -0
- package/dist/core/components/box-v3.js +91 -0
- package/dist/core/components/box-v3.js.map +1 -0
- package/dist/core/components/box.d.ts +4 -4
- package/dist/core/components/box.d.ts.map +1 -1
- package/dist/core/components/box.js +26 -4
- package/dist/core/components/box.js.map +1 -1
- package/dist/core/components/log.d.ts.map +1 -1
- package/dist/core/components/log.js +2 -1
- package/dist/core/components/log.js.map +1 -1
- package/dist/core/components/separator.d.ts +2 -4
- package/dist/core/components/separator.d.ts.map +1 -1
- package/dist/core/components/separator.js.map +1 -1
- package/dist/core/components/types.d.ts +15 -0
- package/dist/core/components/types.d.ts.map +1 -0
- package/dist/core/components/types.js +2 -0
- package/dist/core/components/types.js.map +1 -0
- package/dist/core/detect/tty.d.ts +5 -15
- package/dist/core/detect/tty.d.ts.map +1 -1
- package/dist/core/detect/tty.js +3 -13
- package/dist/core/detect/tty.js.map +1 -1
- package/dist/core/layout/flex.d.ts +28 -0
- package/dist/core/layout/flex.d.ts.map +1 -0
- package/dist/core/layout/flex.js +126 -0
- package/dist/core/layout/flex.js.map +1 -0
- package/dist/core/render/differ.d.ts +49 -0
- package/dist/core/render/differ.d.ts.map +1 -0
- package/dist/core/render/differ.js +271 -0
- package/dist/core/render/differ.js.map +1 -0
- package/dist/core/theme/accessors.d.ts.map +1 -1
- package/dist/core/theme/accessors.js +21 -5
- package/dist/core/theme/accessors.js.map +1 -1
- package/dist/core/theme/graph-types.d.ts +58 -0
- package/dist/core/theme/graph-types.d.ts.map +1 -0
- package/dist/core/theme/graph-types.js +2 -0
- package/dist/core/theme/graph-types.js.map +1 -0
- package/dist/core/theme/graph.d.ts +27 -0
- package/dist/core/theme/graph.d.ts.map +1 -0
- package/dist/core/theme/graph.js +155 -0
- package/dist/core/theme/graph.js.map +1 -0
- package/dist/core/theme/index.d.ts +4 -1
- package/dist/core/theme/index.d.ts.map +1 -1
- package/dist/core/theme/index.js +3 -1
- package/dist/core/theme/index.js.map +1 -1
- package/dist/core/theme/resolve.d.ts +8 -33
- package/dist/core/theme/resolve.d.ts.map +1 -1
- package/dist/core/theme/resolve.js +6 -39
- package/dist/core/theme/resolve.js.map +1 -1
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +5 -0
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/ports/context.d.ts +9 -0
- package/dist/ports/context.d.ts.map +1 -1
- package/dist/ports/env.d.ts +7 -14
- package/dist/ports/env.d.ts.map +1 -1
- package/dist/ports/env.js +7 -16
- package/dist/ports/env.js.map +1 -1
- package/dist/ports/io.d.ts +6 -0
- package/dist/ports/io.d.ts.map +1 -1
- package/dist/ports/runtime.d.ts +5 -0
- package/dist/ports/runtime.d.ts.map +1 -1
- package/dist/ports/surface.d.ts +152 -0
- package/dist/ports/surface.d.ts.map +1 -0
- package/dist/ports/surface.js +199 -0
- package/dist/ports/surface.js.map +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/core/components/log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/core/components/log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAM3D,mDAAmD;AACnD,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAErE,2DAA2D;AAC3D,MAAM,WAAW,UAAU;IACzB,sEAAsE;IACtE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,6DAA6D;IAC7D,QAAQ,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC;CAC7B;AA0CD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM,CA6ClF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resolveSafeCtx as resolveCtx } from '../resolve-ctx.js';
|
|
2
2
|
import { badge } from './badge.js';
|
|
3
3
|
import { renderByMode } from '../mode-render.js';
|
|
4
|
+
import { surfaceToString } from '../render/differ.js';
|
|
4
5
|
/** Abbreviated 3-letter labels for each log level used in pipe/interactive modes. */
|
|
5
6
|
const LABELS = {
|
|
6
7
|
debug: 'DBG',
|
|
@@ -94,7 +95,7 @@ export function log(level, message, options) {
|
|
|
94
95
|
}
|
|
95
96
|
if (showPrefix) {
|
|
96
97
|
const variant = BADGE_VARIANTS[level];
|
|
97
|
-
parts.push(badge(LABELS[level], { variant, ctx }));
|
|
98
|
+
parts.push(surfaceToString(badge(LABELS[level], { variant, ctx }), ctx.style));
|
|
98
99
|
}
|
|
99
100
|
parts.push(message);
|
|
100
101
|
return parts.join(' ');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/core/components/log.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/core/components/log.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAetD,qFAAqF;AACrF,MAAM,MAAM,GAA6B;IACvC,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,KAAK;CACb,CAAC;AAEF,gFAAgF;AAChF,MAAM,cAAc,GAA6B;IAC/C,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,mEAAmE;AACnE,MAAM,iBAAiB,GAA6B;IAClD,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,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CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;YACjF,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACpB,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;KACF,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import type { BijouContext } from '../../ports/context.js';
|
|
2
1
|
import type { TokenValue } from '../theme/tokens.js';
|
|
2
|
+
import type { BijouNodeOptions } from './types.js';
|
|
3
3
|
/** Configuration for rendering a horizontal separator line. */
|
|
4
|
-
export interface SeparatorOptions {
|
|
4
|
+
export interface SeparatorOptions extends BijouNodeOptions {
|
|
5
5
|
/** Optional centered label text. */
|
|
6
6
|
label?: string;
|
|
7
7
|
/** Total width in characters (defaults to terminal column count). */
|
|
8
8
|
width?: number;
|
|
9
9
|
/** Theme token applied to the separator line. */
|
|
10
10
|
borderToken?: TokenValue;
|
|
11
|
-
/** Bijou context for I/O, styling, and mode detection. */
|
|
12
|
-
ctx?: BijouContext;
|
|
13
11
|
}
|
|
14
12
|
/**
|
|
15
13
|
* Render a horizontal separator line, optionally centered around a label.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../../../src/core/components/separator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../../../src/core/components/separator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,+DAA+D;AAC/D,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,WAAW,CAAC,EAAE,UAAU,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,MAAM,CA4BhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"separator.js","sourceRoot":"","sources":["../../../src/core/components/separator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"separator.js","sourceRoot":"","sources":["../../../src/core/components/separator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAajD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CAAC,UAA4B,EAAE;IACtD,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC;IAEnD,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE;QAC5B,IAAI,EAAE,GAAG,EAAE;YACT,IAAI,KAAK;gBAAE,OAAO,OAAO,KAAK,MAAM,CAAC;YACrC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,UAAU,EAAE,GAAG,EAAE;YACf,IAAI,KAAK;gBAAE,OAAO,OAAO,KAAK,MAAM,CAAC;YACrC,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,WAAW,EAAE,GAAG,EAAE;YAChB,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAEzD,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,eAAe,GAAG,IAAI,KAAK,GAAG,CAAC;gBACrC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;gBAC9D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;gBACvC,MAAM,KAAK,GAAG,SAAS,GAAG,IAAI,CAAC;gBAC/B,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,eAAe,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC5H,CAAC;YAED,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACzD,CAAC;KACF,EAAE,OAAO,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BijouContext } from '../../ports/context.js';
|
|
2
|
+
/**
|
|
3
|
+
* Base options shared by all Bijou UI components.
|
|
4
|
+
*
|
|
5
|
+
* Part of the Standardized BijouNode Protocol.
|
|
6
|
+
*/
|
|
7
|
+
export interface BijouNodeOptions {
|
|
8
|
+
/** Unique identifier for the component. Used for CSS styling (#id) and layout tracking. */
|
|
9
|
+
id?: string;
|
|
10
|
+
/** CSS class name(s) for the component. Space-separated. */
|
|
11
|
+
class?: string;
|
|
12
|
+
/** Optional Bijou context. If omitted, the global default context is used. */
|
|
13
|
+
ctx?: BijouContext;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2FAA2F;IAC3F,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/components/types.ts"],"names":[],"mappings":""}
|
|
@@ -21,18 +21,13 @@ export type OutputMode = 'interactive' | 'static' | 'pipe' | 'accessible';
|
|
|
21
21
|
/**
|
|
22
22
|
* Detect the appropriate output mode for the current environment.
|
|
23
23
|
*
|
|
24
|
-
* Inspects environment variables and TTY status via the
|
|
24
|
+
* Inspects environment variables and TTY status via the
|
|
25
25
|
* {@link RuntimePort} abstraction.
|
|
26
26
|
*
|
|
27
|
-
* @
|
|
28
|
-
* `process.env` / `process.stdout`, bypassing hexagonal ports. Prefer
|
|
29
|
-
* `detectOutputMode(runtime)` with an explicit {@link RuntimePort}, or
|
|
30
|
-
* use `createBijou()` which handles detection internally.
|
|
31
|
-
*
|
|
32
|
-
* @param runtime - Optional runtime port for environment access.
|
|
27
|
+
* @param runtime - Runtime port for environment access.
|
|
33
28
|
* @returns The detected {@link OutputMode}.
|
|
34
29
|
*/
|
|
35
|
-
export declare function detectOutputMode(runtime
|
|
30
|
+
export declare function detectOutputMode(runtime: RuntimePort): OutputMode;
|
|
36
31
|
/**
|
|
37
32
|
* Terminal color scheme.
|
|
38
33
|
*
|
|
@@ -47,13 +42,8 @@ export type ColorScheme = 'light' | 'dark';
|
|
|
47
42
|
* `"default;fg;bg"`). The last segment is treated as the background
|
|
48
43
|
* color index: 0–6 → dark, 7+ → light.
|
|
49
44
|
*
|
|
50
|
-
* @
|
|
51
|
-
* `process.env`, bypassing hexagonal ports. Prefer
|
|
52
|
-
* `detectColorScheme(runtime)` with an explicit {@link RuntimePort}, or
|
|
53
|
-
* use `createBijou()` which handles detection internally.
|
|
54
|
-
*
|
|
55
|
-
* @param runtime - Optional runtime port for environment access. Falls back to `process`.
|
|
45
|
+
* @param runtime - Runtime port for environment access.
|
|
56
46
|
* @returns The detected {@link ColorScheme}. Defaults to `'dark'`.
|
|
57
47
|
*/
|
|
58
|
-
export declare function detectColorScheme(runtime
|
|
48
|
+
export declare function detectColorScheme(runtime: RuntimePort): ColorScheme;
|
|
59
49
|
//# sourceMappingURL=tty.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tty.d.ts","sourceRoot":"","sources":["../../../src/core/detect/tty.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,QAAQ,GAAG,MAAM,GAAG,YAAY,CAAC;AAE1E
|
|
1
|
+
{"version":3,"file":"tty.d.ts","sourceRoot":"","sources":["../../../src/core/detect/tty.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,QAAQ,GAAG,MAAM,GAAG,YAAY,CAAC;AAE1E;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,CAcjE;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,CAcnE"}
|
package/dist/core/detect/tty.js
CHANGED
|
@@ -12,15 +12,10 @@ import { createEnvAccessor, createTTYAccessor } from '../../ports/env.js';
|
|
|
12
12
|
/**
|
|
13
13
|
* Detect the appropriate output mode for the current environment.
|
|
14
14
|
*
|
|
15
|
-
* Inspects environment variables and TTY status via the
|
|
15
|
+
* Inspects environment variables and TTY status via the
|
|
16
16
|
* {@link RuntimePort} abstraction.
|
|
17
17
|
*
|
|
18
|
-
* @
|
|
19
|
-
* `process.env` / `process.stdout`, bypassing hexagonal ports. Prefer
|
|
20
|
-
* `detectOutputMode(runtime)` with an explicit {@link RuntimePort}, or
|
|
21
|
-
* use `createBijou()` which handles detection internally.
|
|
22
|
-
*
|
|
23
|
-
* @param runtime - Optional runtime port for environment access.
|
|
18
|
+
* @param runtime - Runtime port for environment access.
|
|
24
19
|
* @returns The detected {@link OutputMode}.
|
|
25
20
|
*/
|
|
26
21
|
export function detectOutputMode(runtime) {
|
|
@@ -45,12 +40,7 @@ export function detectOutputMode(runtime) {
|
|
|
45
40
|
* `"default;fg;bg"`). The last segment is treated as the background
|
|
46
41
|
* color index: 0–6 → dark, 7+ → light.
|
|
47
42
|
*
|
|
48
|
-
* @
|
|
49
|
-
* `process.env`, bypassing hexagonal ports. Prefer
|
|
50
|
-
* `detectColorScheme(runtime)` with an explicit {@link RuntimePort}, or
|
|
51
|
-
* use `createBijou()` which handles detection internally.
|
|
52
|
-
*
|
|
53
|
-
* @param runtime - Optional runtime port for environment access. Falls back to `process`.
|
|
43
|
+
* @param runtime - Runtime port for environment access.
|
|
54
44
|
* @returns The detected {@link ColorScheme}. Defaults to `'dark'`.
|
|
55
45
|
*/
|
|
56
46
|
export function detectColorScheme(runtime) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tty.js","sourceRoot":"","sources":["../../../src/core/detect/tty.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAY1E
|
|
1
|
+
{"version":3,"file":"tty.js","sourceRoot":"","sources":["../../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,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { LayoutNode, LayoutRect } from '../../ports/surface.js';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the flex layout engine.
|
|
4
|
+
*/
|
|
5
|
+
export interface FlexOptions {
|
|
6
|
+
direction?: 'row' | 'column';
|
|
7
|
+
gap?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Metadata for a flex child.
|
|
11
|
+
*/
|
|
12
|
+
export interface FlexChildProps {
|
|
13
|
+
id?: string;
|
|
14
|
+
flex?: number;
|
|
15
|
+
basis?: number;
|
|
16
|
+
minSize?: number;
|
|
17
|
+
maxSize?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Calculate flex layout geometry.
|
|
21
|
+
*
|
|
22
|
+
* @param options - Flex container options.
|
|
23
|
+
* @param children - Properties for each child.
|
|
24
|
+
* @param bounds - Available space.
|
|
25
|
+
* @returns Root LayoutNode containing child rects.
|
|
26
|
+
*/
|
|
27
|
+
export declare function calculateFlex(options: FlexOptions, children: FlexChildProps[], bounds: LayoutRect): LayoutNode;
|
|
28
|
+
//# sourceMappingURL=flex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.d.ts","sourceRoot":"","sources":["../../../src/core/layout/flex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,cAAc,EAAE,EAC1B,MAAM,EAAE,UAAU,GACjB,UAAU,CA4HZ"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculate flex layout geometry.
|
|
3
|
+
*
|
|
4
|
+
* @param options - Flex container options.
|
|
5
|
+
* @param children - Properties for each child.
|
|
6
|
+
* @param bounds - Available space.
|
|
7
|
+
* @returns Root LayoutNode containing child rects.
|
|
8
|
+
*/
|
|
9
|
+
export function calculateFlex(options, children, bounds) {
|
|
10
|
+
const direction = options.direction ?? 'row';
|
|
11
|
+
const gap = options.gap ?? 0;
|
|
12
|
+
const isRow = direction === 'row';
|
|
13
|
+
const mainAxisTotal = isRow ? bounds.width : bounds.height;
|
|
14
|
+
const crossAxisTotal = isRow ? bounds.height : bounds.width;
|
|
15
|
+
if (children.length === 0) {
|
|
16
|
+
return { rect: bounds, children: [] };
|
|
17
|
+
}
|
|
18
|
+
const totalGaps = gap * (children.length - 1);
|
|
19
|
+
const available = Math.max(0, mainAxisTotal - totalGaps);
|
|
20
|
+
// First pass: fixed sizes
|
|
21
|
+
const sizes = [];
|
|
22
|
+
let usedByFixed = 0;
|
|
23
|
+
let totalFlex = 0;
|
|
24
|
+
for (const child of children) {
|
|
25
|
+
const flexGrow = child.flex ?? 0;
|
|
26
|
+
if (flexGrow > 0) {
|
|
27
|
+
sizes.push(0);
|
|
28
|
+
totalFlex += flexGrow;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const b = child.basis ?? 0;
|
|
32
|
+
const clamped = clamp(b, child.minSize, child.maxSize);
|
|
33
|
+
sizes.push(clamped);
|
|
34
|
+
usedByFixed += clamped;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Second pass: distribute remaining space to flex children iteratively
|
|
38
|
+
// to correctly handle min/max constraints.
|
|
39
|
+
let remaining = Math.max(0, available - usedByFixed);
|
|
40
|
+
let activeFlex = totalFlex;
|
|
41
|
+
const isConstrained = new Array(children.length).fill(false);
|
|
42
|
+
// Iteratively distribute until all flex space is assigned or all flex children are constrained
|
|
43
|
+
while (activeFlex > 0 && remaining > 0) {
|
|
44
|
+
let spaceDistributed = false;
|
|
45
|
+
const perFlexUnit = remaining / activeFlex;
|
|
46
|
+
for (let i = 0; i < children.length; i++) {
|
|
47
|
+
if (isConstrained[i])
|
|
48
|
+
continue;
|
|
49
|
+
const child = children[i];
|
|
50
|
+
const flexGrow = child.flex ?? 0;
|
|
51
|
+
if (flexGrow <= 0)
|
|
52
|
+
continue;
|
|
53
|
+
const currentSize = sizes[i];
|
|
54
|
+
const targetSize = currentSize + (flexGrow * perFlexUnit);
|
|
55
|
+
const clamped = clamp(targetSize, child.minSize, child.maxSize);
|
|
56
|
+
if (clamped !== targetSize) {
|
|
57
|
+
// This child hit a constraint
|
|
58
|
+
sizes[i] = clamped;
|
|
59
|
+
remaining -= (clamped - currentSize);
|
|
60
|
+
activeFlex -= flexGrow;
|
|
61
|
+
isConstrained[i] = true;
|
|
62
|
+
spaceDistributed = true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (!spaceDistributed) {
|
|
66
|
+
// Final pass: distribute the last remaining bits without constraints (they are already satisfied)
|
|
67
|
+
const fractionalShares = [];
|
|
68
|
+
let assigned = 0;
|
|
69
|
+
for (let i = 0; i < children.length; i++) {
|
|
70
|
+
if (!isConstrained[i] && (children[i].flex ?? 0) > 0) {
|
|
71
|
+
const flexGrow = children[i].flex;
|
|
72
|
+
const share = (flexGrow / activeFlex) * remaining;
|
|
73
|
+
const whole = Math.floor(share);
|
|
74
|
+
sizes[i] += whole;
|
|
75
|
+
assigned += whole;
|
|
76
|
+
fractionalShares.push({ index: i, remainder: share - whole });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
let leftover = remaining - assigned;
|
|
80
|
+
fractionalShares.sort((a, b) => b.remainder - a.remainder || a.index - b.index);
|
|
81
|
+
for (let i = 0; i < fractionalShares.length && leftover > 0; i++, leftover--) {
|
|
82
|
+
sizes[fractionalShares[i].index] += 1;
|
|
83
|
+
}
|
|
84
|
+
remaining = 0; // All done
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Third pass: position calculation
|
|
88
|
+
const childNodes = [];
|
|
89
|
+
let offset = 0;
|
|
90
|
+
for (let i = 0; i < children.length; i++) {
|
|
91
|
+
const child = children[i];
|
|
92
|
+
const size = sizes[i];
|
|
93
|
+
const childRect = isRow
|
|
94
|
+
? {
|
|
95
|
+
x: bounds.x + offset,
|
|
96
|
+
y: bounds.y,
|
|
97
|
+
width: size,
|
|
98
|
+
height: crossAxisTotal
|
|
99
|
+
}
|
|
100
|
+
: {
|
|
101
|
+
x: bounds.x,
|
|
102
|
+
y: bounds.y + offset,
|
|
103
|
+
width: crossAxisTotal,
|
|
104
|
+
height: size
|
|
105
|
+
};
|
|
106
|
+
childNodes.push({
|
|
107
|
+
id: child.id,
|
|
108
|
+
rect: childRect,
|
|
109
|
+
children: []
|
|
110
|
+
});
|
|
111
|
+
offset += size + gap;
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
rect: bounds,
|
|
115
|
+
children: childNodes
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function clamp(val, min, max) {
|
|
119
|
+
let res = val;
|
|
120
|
+
if (min !== undefined)
|
|
121
|
+
res = Math.max(res, min);
|
|
122
|
+
if (max !== undefined)
|
|
123
|
+
res = Math.min(res, max);
|
|
124
|
+
return Math.max(0, res);
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=flex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.js","sourceRoot":"","sources":["../../../src/core/layout/flex.ts"],"names":[],"mappings":"AAqBA;;;;;;;GAOG;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,UAAU;KACrB,CAAC;AACJ,CAAC;AAED,SAAS,KAAK,CAAC,GAAW,EAAE,GAAY,EAAE,GAAY;IACpD,IAAI,GAAG,GAAG,GAAG,CAAC;IACd,IAAI,GAAG,KAAK,SAAS;QAAE,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAChD,IAAI,GAAG,KAAK,SAAS;QAAE,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAChD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type Surface, type Cell, type LayoutNode } from '../../ports/surface.js';
|
|
2
|
+
import type { WritePort, StylePort } from '../../ports/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Convert a multi-line string into a Surface.
|
|
5
|
+
*
|
|
6
|
+
* Note: This is a legacy migration helper. It currently strips ANSI
|
|
7
|
+
* and treats all characters as the default style.
|
|
8
|
+
*/
|
|
9
|
+
export declare function stringToSurface(text: string, width: number, height: number): Surface;
|
|
10
|
+
/**
|
|
11
|
+
* Robust ANSI-aware string to Surface conversion.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseAnsiToSurface(text: string, width: number, height: number): Surface;
|
|
14
|
+
/**
|
|
15
|
+
* Convert a Surface into a multi-line string with ANSI escape codes.
|
|
16
|
+
*
|
|
17
|
+
* Note: This is a legacy migration helper.
|
|
18
|
+
*
|
|
19
|
+
* @param surface - The surface to convert.
|
|
20
|
+
* @param style - The style port to use for color resolution.
|
|
21
|
+
* @returns A string representation of the surface.
|
|
22
|
+
*/
|
|
23
|
+
export declare function surfaceToString(surface: Surface, style: StylePort): string;
|
|
24
|
+
/**
|
|
25
|
+
* Paint a LayoutNode tree onto a Surface.
|
|
26
|
+
*
|
|
27
|
+
* @param target - The surface to paint onto.
|
|
28
|
+
* @param node - The root layout node to paint.
|
|
29
|
+
*/
|
|
30
|
+
export declare function paintLayoutNode(target: Surface, node: LayoutNode): void;
|
|
31
|
+
/**
|
|
32
|
+
* Compare two cells for equality (content and style).
|
|
33
|
+
*/
|
|
34
|
+
export declare function isSameCell(a: Cell, b: Cell): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Diff two surfaces and write the minimal set of changes to the WritePort.
|
|
37
|
+
*
|
|
38
|
+
* Optimizations:
|
|
39
|
+
* 1. Skips identical cells.
|
|
40
|
+
* 2. Minimizes CUP (move cursor) commands by detecting contiguous changes.
|
|
41
|
+
* 3. Batches cells with identical styles to minimize SGR codes and keep strings contiguous.
|
|
42
|
+
*
|
|
43
|
+
* @param current - The surface currently on the terminal.
|
|
44
|
+
* @param target - The desired surface state.
|
|
45
|
+
* @param io - The port to write ANSI codes to.
|
|
46
|
+
* @param style - The port to resolve cell styling.
|
|
47
|
+
*/
|
|
48
|
+
export declare function renderDiff(current: Surface, target: Surface, io: WritePort, style: StylePort): void;
|
|
49
|
+
//# sourceMappingURL=differ.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differ.d.ts","sourceRoot":"","sources":["../../../src/core/render/differ.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjE;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAcpF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAiFvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAgB1E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAQvE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,OAAO,CAcpD;AAUD;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,EACf,EAAE,EAAE,SAAS,EACb,KAAK,EAAE,SAAS,GACf,IAAI,CAmEN"}
|