@flyingrobots/bijou 2.1.0 → 3.1.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 +28 -20
- package/dist/adapters/test/clock.d.ts +36 -0
- package/dist/adapters/test/clock.d.ts.map +1 -0
- package/dist/adapters/test/clock.js +132 -0
- package/dist/adapters/test/clock.js.map +1 -0
- package/dist/adapters/test/index.d.ts +8 -1
- package/dist/adapters/test/index.d.ts.map +1 -1
- package/dist/adapters/test/index.js +24 -2
- package/dist/adapters/test/index.js.map +1 -1
- package/dist/adapters/test/io.d.ts +3 -0
- package/dist/adapters/test/io.d.ts.map +1 -1
- package/dist/adapters/test/io.js +5 -4
- package/dist/adapters/test/io.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/ansi.d.ts +2 -0
- package/dist/core/ansi.d.ts.map +1 -1
- package/dist/core/ansi.js +2 -0
- package/dist/core/ansi.js.map +1 -1
- package/dist/core/clock.d.ts +12 -0
- package/dist/core/clock.d.ts.map +1 -0
- package/dist/core/clock.js +59 -0
- package/dist/core/clock.js.map +1 -0
- package/dist/core/components/alert-v3.d.ts +7 -0
- package/dist/core/components/alert-v3.d.ts.map +1 -0
- package/dist/core/components/alert-v3.js +37 -0
- package/dist/core/components/alert-v3.js.map +1 -0
- package/dist/core/components/alert.d.ts +4 -4
- package/dist/core/components/alert.d.ts.map +1 -1
- package/dist/core/components/alert.js +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 +17 -0
- package/dist/core/components/box-v3.d.ts.map +1 -0
- package/dist/core/components/box-v3.js +149 -0
- package/dist/core/components/box-v3.js.map +1 -0
- package/dist/core/components/box.d.ts +11 -4
- package/dist/core/components/box.d.ts.map +1 -1
- package/dist/core/components/box.js +37 -9
- package/dist/core/components/box.js.map +1 -1
- package/dist/core/components/index.d.ts +6 -0
- package/dist/core/components/index.d.ts.map +1 -1
- package/dist/core/components/index.js +4 -0
- package/dist/core/components/index.js.map +1 -1
- package/dist/core/components/log.d.ts.map +1 -1
- package/dist/core/components/log.js +6 -4
- package/dist/core/components/log.js.map +1 -1
- package/dist/core/components/overflow.d.ts +3 -0
- package/dist/core/components/overflow.d.ts.map +1 -0
- package/dist/core/components/overflow.js +33 -0
- package/dist/core/components/overflow.js.map +1 -0
- package/dist/core/components/progress.d.ts.map +1 -1
- package/dist/core/components/progress.js +3 -1
- package/dist/core/components/progress.js.map +1 -1
- package/dist/core/components/separator-v3.d.ts +7 -0
- package/dist/core/components/separator-v3.d.ts.map +1 -0
- package/dist/core/components/separator-v3.js +46 -0
- package/dist/core/components/separator-v3.js.map +1 -0
- 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/spinner.d.ts.map +1 -1
- package/dist/core/components/spinner.js +3 -1
- package/dist/core/components/spinner.js.map +1 -1
- package/dist/core/components/surface-text.d.ts +14 -0
- package/dist/core/components/surface-text.d.ts.map +1 -0
- package/dist/core/components/surface-text.js +95 -0
- package/dist/core/components/surface-text.js.map +1 -0
- package/dist/core/components/table-v3.d.ts +11 -0
- package/dist/core/components/table-v3.d.ts.map +1 -0
- package/dist/core/components/table-v3.js +148 -0
- package/dist/core/components/table-v3.js.map +1 -0
- package/dist/core/components/table.d.ts +2 -1
- package/dist/core/components/table.d.ts.map +1 -1
- package/dist/core/components/table.js +40 -11
- package/dist/core/components/table.js.map +1 -1
- package/dist/core/components/timer.d.ts.map +1 -1
- package/dist/core/components/timer.js +11 -9
- package/dist/core/components/timer.js.map +1 -1
- package/dist/core/components/types.d.ts +19 -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/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/runtime-viewport.d.ts +34 -0
- package/dist/core/runtime-viewport.d.ts.map +1 -0
- package/dist/core/runtime-viewport.js +74 -0
- package/dist/core/runtime-viewport.js.map +1 -0
- package/dist/core/text/index.d.ts +1 -0
- package/dist/core/text/index.d.ts.map +1 -1
- package/dist/core/text/index.js +1 -0
- package/dist/core/text/index.js.map +1 -1
- package/dist/core/text/wrap.d.ts +11 -0
- package/dist/core/text/wrap.d.ts.map +1 -0
- package/dist/core/text/wrap.js +90 -0
- package/dist/core/text/wrap.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 +3 -0
- package/dist/core/theme/index.d.ts.map +1 -1
- package/dist/core/theme/index.js +2 -0
- package/dist/core/theme/index.js.map +1 -1
- package/dist/core/theme/resolve.d.ts +3 -0
- package/dist/core/theme/resolve.d.ts.map +1 -1
- package/dist/core/theme/resolve.js +3 -0
- package/dist/core/theme/resolve.js.map +1 -1
- package/dist/factory.d.ts +3 -0
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +8 -0
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/ports/clock.d.ts +29 -0
- package/dist/ports/clock.d.ts.map +1 -0
- package/dist/ports/clock.js +2 -0
- package/dist/ports/clock.js.map +1 -0
- package/dist/ports/context.d.ts +12 -0
- package/dist/ports/context.d.ts.map +1 -1
- package/dist/ports/index.d.ts +1 -0
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.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
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { TokenValue, TextModifier } from './tokens.js';
|
|
2
|
+
/**
|
|
3
|
+
* Color transformation operations supported by the token graph.
|
|
4
|
+
*/
|
|
5
|
+
export type ColorTransform = {
|
|
6
|
+
type: 'darken';
|
|
7
|
+
amount: number;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'lighten';
|
|
10
|
+
amount: number;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'saturate';
|
|
13
|
+
amount: number;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'desaturate';
|
|
16
|
+
amount: number;
|
|
17
|
+
} | {
|
|
18
|
+
type: 'complementary';
|
|
19
|
+
} | {
|
|
20
|
+
type: 'mix';
|
|
21
|
+
with: string;
|
|
22
|
+
ratio?: number;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'inverse';
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A definition for a single token value.
|
|
28
|
+
* Can be a raw hex string, a reference to another token, or a mode-specific choice.
|
|
29
|
+
*/
|
|
30
|
+
export type ColorDefinition = string | {
|
|
31
|
+
ref: string;
|
|
32
|
+
transform?: ColorTransform[];
|
|
33
|
+
} | {
|
|
34
|
+
light: ColorDefinition;
|
|
35
|
+
dark: ColorDefinition;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A definition for a complete theme token (foreground, background, modifiers).
|
|
39
|
+
*/
|
|
40
|
+
export interface TokenDefinition {
|
|
41
|
+
/** Foreground color definition. */
|
|
42
|
+
fg: ColorDefinition;
|
|
43
|
+
/** Optional background color definition. */
|
|
44
|
+
bg?: ColorDefinition;
|
|
45
|
+
/** Optional text style modifiers. */
|
|
46
|
+
modifiers?: TextModifier[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Union of possible input values for a token path.
|
|
50
|
+
*/
|
|
51
|
+
export type TokenInput = ColorDefinition | TokenDefinition | TokenValue;
|
|
52
|
+
/**
|
|
53
|
+
* A flat or nested map of token definitions.
|
|
54
|
+
*/
|
|
55
|
+
export interface TokenDefinitions {
|
|
56
|
+
[key: string]: TokenInput | TokenDefinitions;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=graph-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-types.d.ts","sourceRoot":"","sources":["../../../src/core/theme/graph-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAExB;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,MAAM,GACN;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,cAAc,EAAE,CAAA;CAAE,GAC7C;IAAE,KAAK,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,EAAE,EAAE,eAAe,CAAC;IACpB,4CAA4C;IAC5C,EAAE,CAAC,EAAE,eAAe,CAAC;IACrB,qCAAqC;IACrC,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,eAAe,GAAG,UAAU,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,gBAAgB,CAAC;CAC9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-types.js","sourceRoot":"","sources":["../../../src/core/theme/graph-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TokenValue } from './tokens.js';
|
|
2
|
+
import type { ColorDefinition, TokenDefinitions, TokenInput } from './graph-types.js';
|
|
3
|
+
export type ThemeMode = 'light' | 'dark';
|
|
4
|
+
/**
|
|
5
|
+
* Reactive and Semantic Token Graph for Bijou themes.
|
|
6
|
+
*/
|
|
7
|
+
export interface TokenGraph {
|
|
8
|
+
/** Resolve a token definition path to a final TokenValue. */
|
|
9
|
+
get(path: string, mode?: ThemeMode): TokenValue;
|
|
10
|
+
/** Resolve a raw color definition to a hex string. */
|
|
11
|
+
getColor(def: ColorDefinition, mode?: ThemeMode): string;
|
|
12
|
+
/** Update a definition in the graph and notify subscribers. */
|
|
13
|
+
set(path: string, definition: TokenInput): void;
|
|
14
|
+
/** Register a listener for graph changes. */
|
|
15
|
+
on(handler: (path: string) => void): {
|
|
16
|
+
dispose(): void;
|
|
17
|
+
};
|
|
18
|
+
/** Import a standard Theme object or a nested definitions object. */
|
|
19
|
+
import(defs: TokenDefinitions): void;
|
|
20
|
+
/** Clear all definitions and subscribers from the graph. */
|
|
21
|
+
dispose(): void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a new TokenGraph.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createTokenGraph(initial?: TokenDefinitions): TokenGraph;
|
|
27
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/core/theme/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAW9C,OAAO,KAAK,EACV,eAAe,EAEf,gBAAgB,EAEhB,UAAU,EACX,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,6DAA6D;IAC7D,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAChD,sDAAsD;IACtD,QAAQ,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACzD,+DAA+D;IAC/D,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAChD,6CAA6C;IAC7C,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG;QAAE,OAAO,IAAI,IAAI,CAAA;KAAE,CAAC;IACzD,qEAAqE;IACrE,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACrC,4DAA4D;IAC5D,OAAO,IAAI,IAAI,CAAC;CACjB;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,UAAU,CA0JvE"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { hexToRgb, rgbToHex, lighten, darken, mix, complementary, saturate, desaturate } from './color.js';
|
|
2
|
+
function isTokenValue(obj) {
|
|
3
|
+
return typeof obj === 'object' && obj !== null && 'hex' in obj;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Create a new TokenGraph.
|
|
7
|
+
*/
|
|
8
|
+
export function createTokenGraph(initial) {
|
|
9
|
+
const definitions = new Map();
|
|
10
|
+
const subscribers = new Set();
|
|
11
|
+
if (initial) {
|
|
12
|
+
importInternal('', initial);
|
|
13
|
+
}
|
|
14
|
+
function importInternal(basePath, defs) {
|
|
15
|
+
for (const [key, value] of Object.entries(defs)) {
|
|
16
|
+
const fullPath = basePath ? `${basePath}.${key}` : key;
|
|
17
|
+
if (isTokenValue(value)) {
|
|
18
|
+
// Convert TokenValue to TokenDefinition
|
|
19
|
+
definitions.set(fullPath, {
|
|
20
|
+
fg: value.hex,
|
|
21
|
+
bg: value.bg,
|
|
22
|
+
modifiers: value.modifiers,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else if (typeof value === 'object' && value !== null && !('ref' in value) && !('light' in value) && !('fg' in value)) {
|
|
26
|
+
importInternal(fullPath, value);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
definitions.set(fullPath, value);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function resolveColor(def, mode, visited) {
|
|
34
|
+
if (typeof def === 'string') {
|
|
35
|
+
// Normalize hex string
|
|
36
|
+
try {
|
|
37
|
+
return rgbToHex(hexToRgb(def));
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return def;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if ('light' in def && 'dark' in def) {
|
|
44
|
+
return resolveColor(mode === 'light' ? def.light : def.dark, mode, visited);
|
|
45
|
+
}
|
|
46
|
+
if ('ref' in def) {
|
|
47
|
+
if (visited.has(def.ref)) {
|
|
48
|
+
throw new Error(`Circular token reference detected: ${Array.from(visited).join(' -> ')} -> ${def.ref}`);
|
|
49
|
+
}
|
|
50
|
+
visited.add(def.ref);
|
|
51
|
+
const target = definitions.get(def.ref);
|
|
52
|
+
if (!target) {
|
|
53
|
+
throw new Error(`Token reference not found: ${def.ref}`);
|
|
54
|
+
}
|
|
55
|
+
let color;
|
|
56
|
+
if (typeof target === 'object' && 'fg' in target) {
|
|
57
|
+
color = resolveColor(target.fg, mode, visited);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
color = resolveColor(target, mode, visited);
|
|
61
|
+
}
|
|
62
|
+
// Apply transforms
|
|
63
|
+
if (def.transform) {
|
|
64
|
+
for (const t of def.transform) {
|
|
65
|
+
color = applyTransform(color, t, mode, visited);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return color;
|
|
69
|
+
}
|
|
70
|
+
throw new Error(`Invalid color definition: ${JSON.stringify(def)}`);
|
|
71
|
+
}
|
|
72
|
+
function applyTransform(color, transform, mode, visited) {
|
|
73
|
+
const dummyToken = { hex: color };
|
|
74
|
+
let result;
|
|
75
|
+
switch (transform.type) {
|
|
76
|
+
case 'darken':
|
|
77
|
+
result = darken(dummyToken, transform.amount);
|
|
78
|
+
break;
|
|
79
|
+
case 'lighten':
|
|
80
|
+
result = lighten(dummyToken, transform.amount);
|
|
81
|
+
break;
|
|
82
|
+
case 'saturate':
|
|
83
|
+
result = saturate(dummyToken, transform.amount);
|
|
84
|
+
break;
|
|
85
|
+
case 'desaturate':
|
|
86
|
+
result = desaturate(dummyToken, transform.amount);
|
|
87
|
+
break;
|
|
88
|
+
case 'complementary':
|
|
89
|
+
result = complementary(dummyToken);
|
|
90
|
+
break;
|
|
91
|
+
case 'inverse': {
|
|
92
|
+
const rgb = hexToRgb(color);
|
|
93
|
+
result = { hex: rgbToHex([255 - rgb[0], 255 - rgb[1], 255 - rgb[2]]) };
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
case 'mix': {
|
|
97
|
+
const otherColor = resolveColor({ ref: transform.with }, mode, visited);
|
|
98
|
+
result = mix(dummyToken, { hex: otherColor }, transform.ratio ?? 0.5);
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
default:
|
|
102
|
+
// @ts-ignore
|
|
103
|
+
throw new Error(`Unknown transform type: ${transform.type}`);
|
|
104
|
+
}
|
|
105
|
+
return result.hex;
|
|
106
|
+
}
|
|
107
|
+
const graph = {
|
|
108
|
+
get(path, mode = 'dark') {
|
|
109
|
+
const def = definitions.get(path);
|
|
110
|
+
if (!def)
|
|
111
|
+
throw new Error(`Token not found: ${path}`);
|
|
112
|
+
if (typeof def === 'object' && 'fg' in def) {
|
|
113
|
+
const tokenDef = def;
|
|
114
|
+
return {
|
|
115
|
+
hex: resolveColor(tokenDef.fg, mode, new Set([path])),
|
|
116
|
+
bg: tokenDef.bg ? resolveColor(tokenDef.bg, mode, new Set([path])) : undefined,
|
|
117
|
+
modifiers: tokenDef.modifiers,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
// If it's just a color definition, return it as a TokenValue
|
|
121
|
+
return {
|
|
122
|
+
hex: resolveColor(def, mode, new Set([path])),
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
getColor(def, mode = 'dark') {
|
|
126
|
+
return resolveColor(def, mode, new Set());
|
|
127
|
+
},
|
|
128
|
+
set(path, definition) {
|
|
129
|
+
definitions.set(path, definition);
|
|
130
|
+
for (const handler of subscribers) {
|
|
131
|
+
handler(path);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
on(handler) {
|
|
135
|
+
subscribers.add(handler);
|
|
136
|
+
return {
|
|
137
|
+
dispose() {
|
|
138
|
+
subscribers.delete(handler);
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
import(defs) {
|
|
143
|
+
importInternal('', defs);
|
|
144
|
+
for (const handler of subscribers) {
|
|
145
|
+
handler('*'); // Notify full re-import
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
dispose() {
|
|
149
|
+
definitions.clear();
|
|
150
|
+
subscribers.clear();
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
return graph;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../../src/core/theme/graph.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,MAAM,EACN,GAAG,EACH,aAAa,EACb,QAAQ,EACR,UAAU,EACX,MAAM,YAAY,CAAC;AA6BpB,SAAS,YAAY,CAAC,GAAQ;IAC5B,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA0B;IACzD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAe,CAAC;IAC3C,MAAM,WAAW,GAAG,IAAI,GAAG,EAA0B,CAAC;IAEtD,IAAI,OAAO,EAAE,CAAC;QACZ,cAAc,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED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AG,EAAE,IAAI,GAAG,MAAM;YACzB,OAAO,YAAY,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAC5C,CAAC;QAED,GAAG,CAAC,IAAI,EAAE,UAAU;YAClB,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YAClC,KAAK,MAAM,OAAO,IAAI,WAAW,EAAE,CAAC;gBAClC,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC;QACH,CAAC;QAED,EAAE,CAAC,OAAO;YACR,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACzB,OAAO;gBACL,OAAO;oBACL,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAC9B,CAAC;aACF,CAAC;QACJ,CAAC;QAED,MAAM,CAAC,IAAI;YACT,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YACzB,KAAK,MAAM,OAAO,IAAI,WAAW,EAAE,CAAC;gBAClC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,wBAAwB;YACxC,CAAC;QACH,CAAC;QAED,OAAO;YACL,WAAW,CAAC,KAAK,EAAE,CAAC;YACpB,WAAW,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;KACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -17,5 +17,8 @@ export { fromDTCG, toDTCG } from './dtcg.js';
|
|
|
17
17
|
export type { DTCGDocument, DTCGToken, DTCGGroup } from './dtcg.js';
|
|
18
18
|
export { rgbToAnsi256, nearestAnsi256, rgbToAnsi16, ansi256ToAnsi16, type ColorLevel, } from './downsample.js';
|
|
19
19
|
export { createThemeAccessors, type ThemeAccessors } from './accessors.js';
|
|
20
|
+
export { createTokenGraph } from './graph.js';
|
|
21
|
+
export type { TokenGraph, ThemeMode } from './graph.js';
|
|
22
|
+
export type { ColorDefinition, TokenDefinition, TokenDefinitions, ColorTransform, } from './graph-types.js';
|
|
20
23
|
export { hexToRgb, rgbToHex, lighten, darken, mix, complementary, saturate, desaturate, } from './color.js';
|
|
21
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/theme/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,GAAG,EACH,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,aAAa,EACb,SAAS,EACT,eAAe,EACf,KAAK,GACN,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAG3E,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAIvF,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGzD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGpE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,eAAe,EACf,KAAK,UAAU,GAChB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/theme/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,GAAG,EACH,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,aAAa,EAC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21
21
|
export { rgbToAnsi256, nearestAnsi256, rgbToAnsi16, ansi256ToAnsi16, } from './downsample.js';
|
|
22
22
|
// Theme accessors
|
|
23
23
|
export { createThemeAccessors } from './accessors.js';
|
|
24
|
+
// Reactive Token Graph
|
|
25
|
+
export { createTokenGraph } from './graph.js';
|
|
24
26
|
// Color manipulation
|
|
25
27
|
export { hexToRgb, rgbToHex, lighten, darken, mix, complementary, saturate, desaturate, } from './color.js';
|
|
26
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/theme/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,UAAU;AACV,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAE3E,8BAA8B;AAC9B,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEnD,kBAAkB;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,WAAW;AACX,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEpD,WAAW;AACX,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,cAAc,GACf,MAAM,cAAc,CAAC;AAOtB,eAAe;AACf,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAG7C,qBAAqB;AACrB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,eAAe,GAEhB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/theme/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,UAAU;AACV,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAE3E,8BAA8B;AAC9B,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEnD,kBAAkB;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,WAAW;AACX,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEpD,WAAW;AACX,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,cAAc,GACf,MAAM,cAAc,CAAC;AAOtB,eAAe;AACf,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAG7C,qBAAqB;AACrB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,eAAe,GAEhB,MAAM,iBAAiB,CAAC;AACzB,kBAAkB;AAClB,OAAO,EAAE,oBAAoB,EAAuB,MAAM,gBAAgB,CAAC;AAE3E,uBAAuB;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAS9C,qBAAqB;AACrB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,MAAM,EACN,GAAG,EACH,aAAa,EACb,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAC"}
|
|
@@ -2,6 +2,7 @@ import type { Theme, TokenValue, InkColor } from './tokens.js';
|
|
|
2
2
|
import type { RuntimePort } from '../../ports/runtime.js';
|
|
3
3
|
import type { WritePort } from '../../ports/io.js';
|
|
4
4
|
import type { ColorScheme } from '../detect/tty.js';
|
|
5
|
+
import { type TokenGraph } from './graph.js';
|
|
5
6
|
/**
|
|
6
7
|
* Check the no-color.org spec: `NO_COLOR` defined (any value) means no color.
|
|
7
8
|
*
|
|
@@ -17,6 +18,8 @@ export interface ResolvedTheme {
|
|
|
17
18
|
noColor: boolean;
|
|
18
19
|
/** Detected terminal color scheme (light or dark background). */
|
|
19
20
|
colorScheme: ColorScheme;
|
|
21
|
+
/** Reactive and Semantic Token Graph for advanced theming. */
|
|
22
|
+
tokenGraph: TokenGraph;
|
|
20
23
|
/**
|
|
21
24
|
* Return a hex string for Ink's `color=` prop, or `undefined` when noColor.
|
|
22
25
|
* @param token - Token to read the color from.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/core/theme/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/core/theme/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAG/D;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAGvD;AAED,8EAA8E;AAC9E,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,KAAK,EAAE,KAAK,CAAC;IACb,yDAAyD;IACzD,OAAO,EAAE,OAAO,CAAC;IACjB,iEAAiE;IACjE,WAAW,EAAE,WAAW,CAAC;IACzB,8DAA8D;IAC9D,UAAU,EAAE,UAAU,CAAC;IAEvB;;;;OAIG;IACH,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAAC;IAEjC;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC;IAEpC;;;;OAIG;IACH,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,GAAE,WAAoB,GAAG,aAAa,CAwB/G;AAED,0DAA0D;AAC1D,MAAM,WAAW,oBAAoB;IACnC,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uFAAuF;IACvF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAChC,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,wCAAwC;IACxC,OAAO,EAAE,WAAW,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;CAC7C;AAED,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC5B,4DAA4D;IAC5D,QAAQ,IAAI,aAAa,CAAC;IAC1B;;;OAGG;IACH,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IAC3C,kDAAkD;IAClD,gBAAgB,IAAI,IAAI,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAuDhF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createEnvAccessor } from '../../ports/env.js';
|
|
2
2
|
import { detectColorScheme } from '../detect/tty.js';
|
|
3
3
|
import { PRESETS, CYAN_MAGENTA } from './presets.js';
|
|
4
|
+
import { createTokenGraph } from './graph.js';
|
|
4
5
|
/**
|
|
5
6
|
* Check the no-color.org spec: `NO_COLOR` defined (any value) means no color.
|
|
6
7
|
*
|
|
@@ -19,10 +20,12 @@ export function isNoColor(runtime) {
|
|
|
19
20
|
* @returns ResolvedTheme with convenience accessors.
|
|
20
21
|
*/
|
|
21
22
|
export function createResolved(theme, noColor, colorScheme = 'dark') {
|
|
23
|
+
const tokenGraph = createTokenGraph(theme);
|
|
22
24
|
return {
|
|
23
25
|
theme,
|
|
24
26
|
noColor,
|
|
25
27
|
colorScheme,
|
|
28
|
+
tokenGraph,
|
|
26
29
|
ink(token) {
|
|
27
30
|
return noColor ? undefined : token.hex;
|
|
28
31
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/core/theme/resolve.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/core/theme/resolve.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,YAAY,CAAC;AAG/D;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,OAAoB;IAC5C,MAAM,GAAG,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC;AACvC,CAAC;AAmCD;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,KAAY,EAAE,OAAgB,EAAE,cAA2B,MAAM;IAC9F,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAoC,CAAC,CAAC;IAE1E,OAAO;QACL,KAAK;QACL,OAAO;QACP,WAAW;QACX,UAAU;QAEV,GAAG,CAAC,KAAiB;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,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC;AACtD,CAAC"}
|
package/dist/factory.d.ts
CHANGED
|
@@ -3,12 +3,15 @@ import type { RuntimePort } from './ports/runtime.js';
|
|
|
3
3
|
import type { IOPort } from './ports/io.js';
|
|
4
4
|
import type { StylePort } from './ports/style.js';
|
|
5
5
|
import type { Theme } from './core/theme/tokens.js';
|
|
6
|
+
import type { ClockPort } from './ports/clock.js';
|
|
6
7
|
/** Options for {@link createBijou}. */
|
|
7
8
|
export interface CreateBijouOptions {
|
|
8
9
|
/** Runtime environment adapter. */
|
|
9
10
|
runtime: RuntimePort;
|
|
10
11
|
/** I/O adapter (stdin/stdout, filesystem). */
|
|
11
12
|
io: IOPort;
|
|
13
|
+
/** Clock/scheduler adapter. Defaults to the system clock. */
|
|
14
|
+
clock?: ClockPort;
|
|
12
15
|
/** Style adapter (chalk, plain-text, etc.). */
|
|
13
16
|
style: StylePort;
|
|
14
17
|
/** Explicit theme object. Defaults to {@link CYAN_MAGENTA}. */
|
package/dist/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAWpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,OAAO,EAAE,WAAW,CAAC;IACrB,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,6DAA6D;IAC7D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,+CAA+C;IAC/C,KAAK,EAAE,SAAS,CAAC;IACjB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAChC,4FAA4F;IAC5F,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,YAAY,CA2CrE"}
|
package/dist/factory.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createResolved } from './core/theme/resolve.js';
|
|
2
2
|
import { createThemeAccessors } from './core/theme/accessors.js';
|
|
3
|
+
import { createTokenGraph } from './core/theme/graph.js';
|
|
3
4
|
import { CYAN_MAGENTA } from './core/theme/presets.js';
|
|
4
5
|
import { PRESETS } from './core/theme/presets.js';
|
|
5
6
|
import { fromDTCG } from './core/theme/dtcg.js';
|
|
6
7
|
import { detectOutputMode } from './core/detect/tty.js';
|
|
8
|
+
import { systemClock } from './core/clock.js';
|
|
7
9
|
/**
|
|
8
10
|
* Create a fully-wired {@link BijouContext} from adapter ports.
|
|
9
11
|
*
|
|
@@ -17,6 +19,7 @@ import { detectOutputMode } from './core/detect/tty.js';
|
|
|
17
19
|
*/
|
|
18
20
|
export function createBijou(options) {
|
|
19
21
|
const { runtime, io, style } = options;
|
|
22
|
+
const clock = options.clock ?? systemClock();
|
|
20
23
|
const envVar = options.envVar ?? 'BIJOU_THEME';
|
|
21
24
|
const presets = options.presets ?? PRESETS;
|
|
22
25
|
const fallback = options.theme ?? CYAN_MAGENTA;
|
|
@@ -40,12 +43,17 @@ export function createBijou(options) {
|
|
|
40
43
|
}
|
|
41
44
|
const theme = createResolved(themeObj, noColor);
|
|
42
45
|
const mode = detectOutputMode(runtime);
|
|
46
|
+
// Initialize Reactive Token Graph
|
|
47
|
+
const tokenGraph = createTokenGraph(themeObj);
|
|
43
48
|
return {
|
|
44
49
|
theme,
|
|
45
50
|
mode,
|
|
46
51
|
runtime,
|
|
47
52
|
io,
|
|
53
|
+
clock,
|
|
48
54
|
style,
|
|
55
|
+
tokenGraph,
|
|
56
|
+
resolveBCSS: () => ({}),
|
|
49
57
|
...createThemeAccessors(theme),
|
|
50
58
|
};
|
|
51
59
|
}
|
package/dist/factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAsB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAqB,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAsB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MA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E,CAAC;gBACb,oCAAoC;YACtC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,QAAQ,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,MAAM,KAAK,GAAkB,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/D,MAAM,IAAI,GAAe,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAEnD,kCAAkC;IAClC,MAAM,UAAU,GAAG,gBAAgB,CAAC,QAAuC,CAAC,CAAC;IAE7E,OAAO;QACL,KAAK;QACL,IAAI;QACJ,OAAO;QACP,EAAE;QACF,KAAK;QACL,KAAK;QACL,UAAU;QACV,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;QACvB,GAAG,oBAAoB,CAAC,KAAK,CAAC;KAC/B,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,16 +4,22 @@
|
|
|
4
4
|
* Themed terminal components for CLIs, loggers, and scripts —
|
|
5
5
|
* with graceful degradation across output modes.
|
|
6
6
|
*/
|
|
7
|
-
export type { RuntimePort, WritePort, QueryPort, InteractivePort, FilePort, IOPort, RawInputHandle, TimerHandle, StylePort, BijouContext, } from './ports/index.js';
|
|
7
|
+
export type { RuntimePort, WritePort, QueryPort, InteractivePort, FilePort, IOPort, ClockPort, RawInputHandle, TimerHandle, StylePort, BijouContext, } from './ports/index.js';
|
|
8
|
+
export { type Cell, type Surface, type CellMask, type Matrix3x3, type TransformOptions, createSurface, FULL_MASK, ROTATION_CHAR_MAP, } from './ports/surface.js';
|
|
8
9
|
export { getDefaultContext, setDefaultContext, } from './context.js';
|
|
9
10
|
export { resolveCtx, resolveSafeCtx } from './core/resolve-ctx.js';
|
|
11
|
+
export { systemClock, resolveClock, sleep, defer } from './core/clock.js';
|
|
12
|
+
export { type RuntimeViewport, sanitizeRuntimeDimension, readRuntimeViewport, installRuntimeViewportOverlay, updateRuntimeViewport, } from './core/runtime-viewport.js';
|
|
10
13
|
export { renderByMode, type ModeHandler, type ModeMap, } from './core/mode-render.js';
|
|
11
14
|
export { shouldApplyBg, makeBgFill } from './core/bg-fill.js';
|
|
12
15
|
export { createBijou, type CreateBijouOptions } from './factory.js';
|
|
13
|
-
export { type RGB, type GradientStop, type TextModifier, type TokenValue, type InkColor, type BaseStatusKey, type BaseUiKey, type BaseGradientKey, type Theme, CYAN_MAGENTA, TEAL_ORANGE_PINK, PRESETS, tv, styled, styledStatus, extendTheme, lerp3, gradientText, type GradientTextOptions, isNoColor, createThemeResolver, createResolved, type ResolvedTheme, type ThemeResolver, type ThemeResolverOptions, fromDTCG, toDTCG, type DTCGDocument, type DTCGToken, type DTCGGroup, rgbToAnsi256, nearestAnsi256, rgbToAnsi16, ansi256ToAnsi16, type ColorLevel, createThemeAccessors, type ThemeAccessors, hexToRgb, rgbToHex, lighten, darken, mix, complementary, saturate, desaturate, } from './core/theme/index.js';
|
|
14
|
-
export { isWideChar, segmentGraphemes, graphemeClusterWidth, graphemeWidth, clipToWidth, ANSI_SGR_RE, stripAnsi, } from './core/text/index.js';
|
|
16
|
+
export { type RGB, type GradientStop, type TextModifier, type TokenValue, type InkColor, type BaseStatusKey, type BaseUiKey, type BaseGradientKey, type Theme, CYAN_MAGENTA, TEAL_ORANGE_PINK, PRESETS, tv, styled, styledStatus, extendTheme, lerp3, gradientText, type GradientTextOptions, isNoColor, createThemeResolver, createResolved, type ResolvedTheme, type ThemeResolver, type ThemeResolverOptions, fromDTCG, toDTCG, type DTCGDocument, type DTCGToken, type DTCGGroup, rgbToAnsi256, nearestAnsi256, rgbToAnsi16, ansi256ToAnsi16, type ColorLevel, createThemeAccessors, type ThemeAccessors, hexToRgb, rgbToHex, lighten, darken, mix, complementary, saturate, desaturate, createTokenGraph, type TokenGraph, type ThemeMode, type ColorDefinition, type TokenDefinition, type TokenDefinitions, type ColorTransform, } from './core/theme/index.js';
|
|
17
|
+
export { isWideChar, segmentGraphemes, graphemeClusterWidth, graphemeWidth, clipToWidth, wrapToWidth, ANSI_SGR_RE, stripAnsi, } from './core/text/index.js';
|
|
15
18
|
export { detectOutputMode, detectColorScheme, type OutputMode, type ColorScheme, } from './core/detect/index.js';
|
|
16
|
-
export { spinnerFrame, createSpinner, type SpinnerOptions, type SpinnerController, progressBar, createProgressBar, createAnimatedProgressBar, type ProgressBarOptions, type LiveProgressBarOptions, type AnimatedProgressBarOptions, type ProgressBarController, table, type TableColumn, type TableOptions, box, headerBox, type BoxOptions, type HeaderBoxOptions, selectLogoSize, loadRandomLogo, type LogoSize, type LogoResult, type LogoConstraints, type LogoOptions, separator, type SeparatorOptions, badge, type BadgeVariant, type BadgeOptions, alert, type AlertVariant, type AlertOptions, skeleton, type SkeletonOptions, kbd, type KbdOptions, tree, type TreeNode, type TreeOptions, accordion, type AccordionSection, type AccordionOptions, timeline, type TimelineEvent, type TimelineOptions, tabs, type TabItem, type TabsOptions, breadcrumb, type BreadcrumbOptions, paginator, type PaginatorOptions, stepper, type StepperStep, type StepperOptions, dag, dagSlice, dagLayout, type DagNode, type DagOptions, type DagNodePosition, type DagLayout, arraySource, isDagSource, isSlicedDagSource, type DagSource, type SlicedDagSource, type DagSliceOptions, dagStats, type DagStats, enumeratedList, type BulletStyle, type EnumeratedListOptions, hyperlink, type HyperlinkOptions, log, type LogLevel, type LogOptions, markdown, type MarkdownOptions, constrain, type ConstrainOptions, timer, createTimer, createStopwatch, type TimerOptions, type TimerController, type CreateTimerOptions, type CreateStopwatchOptions, cursorGuard, withHiddenCursor, type CursorGuard, type CursorHideHandle, } from './core/components/index.js';
|
|
19
|
+
export { spinnerFrame, createSpinner, type SpinnerOptions, type SpinnerController, type OverflowBehavior, progressBar, createProgressBar, createAnimatedProgressBar, type ProgressBarOptions, type LiveProgressBarOptions, type AnimatedProgressBarOptions, type ProgressBarController, table, type TableColumn, type TableOptions, tableSurface, type TableSurfaceCell, type TableSurfaceOptions, box, headerBox, type BoxOptions, type HeaderBoxOptions, boxSurface, boxV3, headerBoxSurface, selectLogoSize, loadRandomLogo, type LogoSize, type LogoResult, type LogoConstraints, type LogoOptions, separator, type SeparatorOptions, separatorSurface, badge, type BadgeVariant, type BadgeOptions, alert, type AlertVariant, type AlertOptions, alertSurface, skeleton, type SkeletonOptions, kbd, type KbdOptions, tree, type TreeNode, type TreeOptions, accordion, type AccordionSection, type AccordionOptions, timeline, type TimelineEvent, type TimelineOptions, tabs, type TabItem, type TabsOptions, breadcrumb, type BreadcrumbOptions, paginator, type PaginatorOptions, stepper, type StepperStep, type StepperOptions, dag, dagSlice, dagLayout, type DagNode, type DagOptions, type DagNodePosition, type DagLayout, arraySource, isDagSource, isSlicedDagSource, type DagSource, type SlicedDagSource, type DagSliceOptions, dagStats, type DagStats, enumeratedList, type BulletStyle, type EnumeratedListOptions, hyperlink, type HyperlinkOptions, log, type LogLevel, type LogOptions, markdown, type MarkdownOptions, constrain, type ConstrainOptions, timer, createTimer, createStopwatch, type TimerOptions, type TimerController, type CreateTimerOptions, type CreateStopwatchOptions, cursorGuard, withHiddenCursor, type CursorGuard, type CursorHideHandle, } from './core/components/index.js';
|
|
17
20
|
export { HIDE_CURSOR, SHOW_CURSOR, CLEAR_LINE_RETURN } from './core/ansi.js';
|
|
21
|
+
export { renderDiff, isSameCell, stringToSurface, parseAnsiToSurface, surfaceToString, paintLayoutNode } from './core/render/differ.js';
|
|
22
|
+
export type { LayoutRect, LayoutNode, LayoutEngine } from './ports/surface.js';
|
|
23
|
+
export { calculateFlex, type FlexOptions, type FlexChildProps } from './core/layout/flex.js';
|
|
18
24
|
export { type ValidationResult, type Validator, type FieldOptions, type SelectOption, type SelectFieldOptions, type ConfirmFieldOptions, type GroupFieldResult, type InputOptions, input, select, multiselect, confirm, group, textarea, type TextareaOptions, filter, type FilterOption, type FilterOptions, wizard, type WizardStep, type WizardOptions, note, type NoteOptions, } from './core/forms/index.js';
|
|
19
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,eAAe,EACf,QAAQ,EACR,MAAM,EACN,cAAc,EACd,WAAW,EACX,SAAS,EACT,YAAY,GACb,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,eAAe,EACf,QAAQ,EACR,MAAM,EACN,SAAS,EACT,cAAc,EACd,WAAW,EACX,SAAS,EACT,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,IAAI,EACT,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,aAAa,EACb,SAAS,EACT,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EACL,KAAK,eAAe,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,OAAO,GACb,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGpE,OAAO,E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rB,KAAK,EACL,WAAW,EACX,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,WAAW,EACX,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAG7E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAGxI,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG7F,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,EACL,MAAM,EACN,WAAW,EACX,OAAO,EACP,KAAK,EACL,QAAQ,EACR,KAAK,eAAe,EACpB,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,MAAM,EACN,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,IAAI,EACJ,KAAK,WAAW,GACjB,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
* Themed terminal components for CLIs, loggers, and scripts —
|
|
5
5
|
* with graceful degradation across output modes.
|
|
6
6
|
*/
|
|
7
|
+
export { createSurface, FULL_MASK, ROTATION_CHAR_MAP, } from './ports/surface.js';
|
|
7
8
|
// Context
|
|
8
9
|
export { getDefaultContext, setDefaultContext, } from './context.js';
|
|
9
10
|
// Context resolution helpers
|
|
10
11
|
export { resolveCtx, resolveSafeCtx } from './core/resolve-ctx.js';
|
|
12
|
+
export { systemClock, resolveClock, sleep, defer } from './core/clock.js';
|
|
13
|
+
export { sanitizeRuntimeDimension, readRuntimeViewport, installRuntimeViewportOverlay, updateRuntimeViewport, } from './core/runtime-viewport.js';
|
|
11
14
|
// Mode rendering strategy
|
|
12
15
|
export { renderByMode, } from './core/mode-render.js';
|
|
13
16
|
// Background fill utilities
|
|
@@ -33,15 +36,20 @@ rgbToAnsi256, nearestAnsi256, rgbToAnsi16, ansi256ToAnsi16,
|
|
|
33
36
|
// Theme accessors
|
|
34
37
|
createThemeAccessors,
|
|
35
38
|
// Color manipulation
|
|
36
|
-
hexToRgb, rgbToHex, lighten, darken, mix, complementary, saturate, desaturate,
|
|
39
|
+
hexToRgb, rgbToHex, lighten, darken, mix, complementary, saturate, desaturate,
|
|
40
|
+
// Reactive Token Graph
|
|
41
|
+
createTokenGraph, } from './core/theme/index.js';
|
|
37
42
|
// Text / grapheme utilities
|
|
38
|
-
export { isWideChar, segmentGraphemes, graphemeClusterWidth, graphemeWidth, clipToWidth, ANSI_SGR_RE, stripAnsi, } from './core/text/index.js';
|
|
43
|
+
export { isWideChar, segmentGraphemes, graphemeClusterWidth, graphemeWidth, clipToWidth, wrapToWidth, ANSI_SGR_RE, stripAnsi, } from './core/text/index.js';
|
|
39
44
|
// Detection
|
|
40
45
|
export { detectOutputMode, detectColorScheme, } from './core/detect/index.js';
|
|
41
46
|
// Components
|
|
42
|
-
export { spinnerFrame, createSpinner, progressBar, createProgressBar, createAnimatedProgressBar, table, box, headerBox, selectLogoSize, loadRandomLogo, separator, badge, alert, skeleton, kbd, tree, accordion, timeline, tabs, breadcrumb, paginator, stepper, dag, dagSlice, dagLayout, arraySource, isDagSource, isSlicedDagSource, dagStats, enumeratedList, hyperlink, log, markdown, constrain, timer, createTimer, createStopwatch, cursorGuard, withHiddenCursor, } from './core/components/index.js';
|
|
47
|
+
export { spinnerFrame, createSpinner, progressBar, createProgressBar, createAnimatedProgressBar, table, tableSurface, box, headerBox, boxSurface, boxV3, headerBoxSurface, selectLogoSize, loadRandomLogo, separator, separatorSurface, badge, alert, alertSurface, skeleton, kbd, tree, accordion, timeline, tabs, breadcrumb, paginator, stepper, dag, dagSlice, dagLayout, arraySource, isDagSource, isSlicedDagSource, dagStats, enumeratedList, hyperlink, log, markdown, constrain, timer, createTimer, createStopwatch, cursorGuard, withHiddenCursor, } from './core/components/index.js';
|
|
43
48
|
// Shared ANSI escape constants
|
|
44
49
|
export { HIDE_CURSOR, SHOW_CURSOR, CLEAR_LINE_RETURN } from './core/ansi.js';
|
|
50
|
+
// Rendering
|
|
51
|
+
export { renderDiff, isSameCell, stringToSurface, parseAnsiToSurface, surfaceToString, paintLayoutNode } from './core/render/differ.js';
|
|
52
|
+
export { calculateFlex } from './core/layout/flex.js';
|
|
45
53
|
// Forms
|
|
46
54
|
export { input, select, multiselect, confirm, group, textarea, filter, wizard, note, } from './core/forms/index.js';
|
|
47
55
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,OAAO,EAML,aAAa,EACb,SAAS,EACT,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,UAAU;AACV,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,6BAA6B;AAC7B,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAEL,wBAAwB,EACxB,mBAAmB,EACnB,6B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AGL,KAAK,EAGL,YAAY,EACZ,QAAQ,EAER,GAAG,EAEH,IAAI,EAGJ,SAAS,EAGT,QAAQ,EAGR,IAAI,EAGJ,UAAU,EAEV,SAAS,EAET,OAAO,EAGP,GAAG,EACH,QAAQ,EACR,SAAS,EAKT,WAAW,EACX,WAAW,EACX,iBAAiB,EAIjB,QAAQ,EAER,cAAc,EAGd,SAAS,EAET,GAAG,EAGH,QAAQ,EAER,SAAS,EAET,KAAK,EACL,WAAW,EACX,eAAe,EAKf,WAAW,EACX,gBAAgB,GAGjB,MAAM,4BAA4B,CAAC;AAEpC,+BAA+B;AAC/B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAE7E,YAAY;AACZ,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAIxI,OAAO,EAAE,aAAa,EAAyC,MAAM,uBAAuB,CAAC;AAE7F,QAAQ;AACR,OAAO,EASL,KAAK,EACL,MAAM,EACN,WAAW,EACX,OAAO,EACP,KAAK,EACL,QAAQ,EAER,MAAM,EAGN,MAAM,EAGN,IAAI,GAEL,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { TimerHandle } from './io.js';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract time/scheduling port.
|
|
4
|
+
*
|
|
5
|
+
* Provides wall-clock reads plus timer and microtask scheduling without
|
|
6
|
+
* coupling components to Node.js globals.
|
|
7
|
+
*/
|
|
8
|
+
export interface ClockPort {
|
|
9
|
+
/** Current wall-clock time in milliseconds since the Unix epoch. */
|
|
10
|
+
now(): number;
|
|
11
|
+
/**
|
|
12
|
+
* Create a Date object for a specific timestamp or for the current time when
|
|
13
|
+
* omitted.
|
|
14
|
+
*/
|
|
15
|
+
date(ms?: number): Date;
|
|
16
|
+
/**
|
|
17
|
+
* Schedule a one-shot callback.
|
|
18
|
+
* @returns A handle whose `dispose()` cancels the timeout.
|
|
19
|
+
*/
|
|
20
|
+
setTimeout(callback: () => void, ms: number): TimerHandle;
|
|
21
|
+
/**
|
|
22
|
+
* Schedule a repeating callback.
|
|
23
|
+
* @returns A handle whose `dispose()` cancels the interval.
|
|
24
|
+
*/
|
|
25
|
+
setInterval(callback: () => void, ms: number): TimerHandle;
|
|
26
|
+
/** Schedule a microtask callback. */
|
|
27
|
+
queueMicrotask(callback: () => void): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,oEAAoE;IACpE,GAAG,IAAI,MAAM,CAAC;IAEd;;;OAGG;IACH,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB;;;OAGG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,CAAC;IAE1D;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,CAAC;IAE3D,qCAAqC;IACrC,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.js","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":""}
|
package/dist/ports/context.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import type { Theme, TokenValue, GradientStop } from '../core/theme/tokens.js';
|
|
|
3
3
|
import type { OutputMode } from '../core/detect/tty.js';
|
|
4
4
|
import type { RuntimePort } from './runtime.js';
|
|
5
5
|
import type { IOPort } from './io.js';
|
|
6
|
+
import type { ClockPort } from './clock.js';
|
|
6
7
|
import type { StylePort } from './style.js';
|
|
8
|
+
import type { TokenGraph } from '../core/theme/graph.js';
|
|
7
9
|
/**
|
|
8
10
|
* Top-level dependency-injection context threaded through every bijou component.
|
|
9
11
|
*
|
|
@@ -19,8 +21,18 @@ export interface BijouContext {
|
|
|
19
21
|
readonly runtime: RuntimePort;
|
|
20
22
|
/** I/O adapter (stdin/stdout, filesystem). */
|
|
21
23
|
readonly io: IOPort;
|
|
24
|
+
/** Clock/scheduler adapter for deterministic time and timers. */
|
|
25
|
+
readonly clock?: ClockPort;
|
|
22
26
|
/** Color / text-decoration adapter. */
|
|
23
27
|
readonly style: StylePort;
|
|
28
|
+
/** Reactive and Semantic Token Graph for advanced theming. */
|
|
29
|
+
readonly tokenGraph: TokenGraph;
|
|
30
|
+
/** Resolve styles from a global stylesheet based on component identity. */
|
|
31
|
+
resolveBCSS(identity: {
|
|
32
|
+
type: string;
|
|
33
|
+
id?: string;
|
|
34
|
+
classes?: string[];
|
|
35
|
+
}): Record<string, string>;
|
|
24
36
|
/** Look up a semantic color token. */
|
|
25
37
|
semantic(key: keyof Theme['semantic']): TokenValue;
|
|
26
38
|
/** Look up a border color token. */
|