@textui/core 0.7.0 → 0.8.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/dist/app/app.d.ts.map +1 -1
- package/dist/app/app.js +8 -1
- package/dist/core/i18n.d.ts +1 -1
- package/dist/core/i18n.d.ts.map +1 -1
- package/dist/core/i18n.js +2 -2
- package/dist/jsx/intrinsics.d.ts +23 -0
- package/dist/jsx/intrinsics.d.ts.map +1 -1
- package/dist/runtime/paint.js +12 -2
- package/dist/runtime/style.d.ts +17 -7
- package/dist/runtime/style.d.ts.map +1 -1
- package/dist/runtime/style.js +66 -6
- package/dist/themes/builtin.d.ts +0 -9
- package/dist/themes/builtin.d.ts.map +1 -1
- package/dist/themes/builtin.js +101 -4
- package/dist/themes/registry.d.ts.map +1 -1
- package/dist/themes/registry.js +26 -0
- package/dist/types/i18n.d.ts +9 -1
- package/dist/types/i18n.d.ts.map +1 -1
- package/dist/types/style.d.ts +53 -14
- package/dist/types/style.d.ts.map +1 -1
- package/dist/types/theme.d.ts +37 -3
- package/dist/types/theme.d.ts.map +1 -1
- package/dist/util/text.d.ts +9 -0
- package/dist/util/text.d.ts.map +1 -1
- package/dist/util/text.js +16 -0
- package/package.json +1 -1
- package/src/app/app.ts +8 -1
- package/src/core/i18n.ts +2 -2
- package/src/jsx/intrinsics.ts +25 -0
- package/src/runtime/paint.ts +11 -2
- package/src/runtime/style.ts +73 -9
- package/src/themes/builtin.ts +105 -4
- package/src/themes/registry.ts +23 -0
- package/src/types/i18n.ts +9 -1
- package/src/types/style.ts +85 -18
- package/src/types/theme.ts +37 -3
- package/src/util/text.ts +15 -0
package/dist/app/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/app/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAC3C,MAAM,iBAAiB,CAAC;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AAI,MAAM;IAIhB,KAAK,IAAI,KAAK,GAAG,IAAI;IAMrB;;;;;;;;;;OAUG;IACH,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAwCpC,OAAO,CAAC,aAAa;IAwBrB;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAsEjB,OAAO,CAAC,WAAW;IA+CnB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IA4BnB,2DAA2D;IAC3D,OAAO,CAAC,aAAa;IA4BrB,OAAO,CAAC,YAAY;IASpB,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAwC;IAC/D,YAAY,EAAE,SAAS,CAAC,cAAc,CAAC,CACI;IAC3C;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,UAAU;IAoBrD,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CACa;IAI1C,OAAO,IAAI,aAAa,GAAG,IAAI;IAK/B,KAAK,IAAI;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IAU7D,OAAO,CAAC,WAAW;CAYpB;AAmCD;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC;IAC5B,UAAU,IAAI,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,wDAA2C,CAAC;AAEnE,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,GAAG,CAE7D"}
|
package/dist/app/app.js
CHANGED
|
@@ -669,8 +669,15 @@ export class App {
|
|
|
669
669
|
stateOf(instance) {
|
|
670
670
|
const id = typeof instance.props.id === 'string' ? instance.props.id : instance.id;
|
|
671
671
|
const focusedId = this.focus.focused();
|
|
672
|
+
// A node may state its own focus, and a row has to: the list holds the
|
|
673
|
+
// keyboard, the row is where it lands. Left to the id comparison every
|
|
674
|
+
// row in every list reads as unfocused, so "the current row" and "the
|
|
675
|
+
// current row you can type at" would be the same fill.
|
|
676
|
+
const stated = instance.props.focused;
|
|
672
677
|
return {
|
|
673
|
-
focused:
|
|
678
|
+
focused: typeof stated === 'boolean'
|
|
679
|
+
? stated
|
|
680
|
+
: focusedId === id || focusedId === `${instance.id}:focus`,
|
|
674
681
|
hovered: this.hovered === id || this.hoveredChain.has(instance),
|
|
675
682
|
active: false,
|
|
676
683
|
selected: instance.props.selected === true,
|
package/dist/core/i18n.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare class I18nRegistry implements I18n {
|
|
|
23
23
|
date(value: Date | number, options?: Intl.DateTimeFormatOptions): string;
|
|
24
24
|
relative(value: number, unit: Intl.RelativeTimeFormatUnit): string;
|
|
25
25
|
list(items: string[], options?: Intl.ListFormatOptions): string;
|
|
26
|
-
plural(count: number, forms: Record<string, string>): string;
|
|
26
|
+
plural(count: number, forms: Record<string, string>, values?: Record<string, unknown>): string;
|
|
27
27
|
onChange(fn: (locale: LocaleId) => void): Disposable;
|
|
28
28
|
}
|
|
29
29
|
export declare function createI18n(locale?: string, fallback?: string): I18nRegistry;
|
package/dist/core/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/core/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAsBzD;;;;GAIG;AACH,qBAAa,YAAa,YAAW,IAAI;IAOrC,OAAO,CAAC,cAAc;IANxB,MAAM,EAAE,QAAQ,CAAC;IACjB,OAAO,CAAC,OAAO,CAAgD;IAC/D,OAAO,CAAC,SAAS,CAAyC;gBAGxD,MAAM,GAAE,QAAe,EACf,cAAc,GAAE,QAAe;IAKzC,SAAS,CAAC,MAAM,EAAE,QAAQ,GAAG,IAA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C,QAAQ,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU;IAS/C,OAAO,IAAI,QAAQ,EAAE;IAIrB;;;OAGG;IACH,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAiB3E,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,GAAG,MAAM;IAIjE,IAAI,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,GAAG,MAAM;IAIxE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,sBAAsB,GAAG,MAAM;IAIlE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,GAAG,MAAM;IAI/D,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;IAM9F,QAAQ,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAK,IAAI,GAAG,UAAU;CAIrD;AAED,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,YAAY,CAE3E"}
|
package/dist/core/i18n.js
CHANGED
|
@@ -77,10 +77,10 @@ export class I18nRegistry {
|
|
|
77
77
|
list(items, options) {
|
|
78
78
|
return new Intl.ListFormat(this.locale, options).format(items);
|
|
79
79
|
}
|
|
80
|
-
plural(count, forms) {
|
|
80
|
+
plural(count, forms, values) {
|
|
81
81
|
const rule = new Intl.PluralRules(this.locale).select(count);
|
|
82
82
|
const template = forms[rule] ?? forms.other ?? '';
|
|
83
|
-
return interpolate(template, { count });
|
|
83
|
+
return interpolate(template, { ...values, count });
|
|
84
84
|
}
|
|
85
85
|
onChange(fn) {
|
|
86
86
|
this.listeners.add(fn);
|
package/dist/jsx/intrinsics.d.ts
CHANGED
|
@@ -21,6 +21,29 @@ export interface BaseProps extends Style {
|
|
|
21
21
|
description?: string;
|
|
22
22
|
disabled?: boolean;
|
|
23
23
|
selected?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The states this node is in, for `style` overlays and for a theme.
|
|
26
|
+
*
|
|
27
|
+
* `focused` is a tri-state on purpose. Left out, the runtime asks the focus
|
|
28
|
+
* manager - which is right for a control and wrong for a row: a list row does
|
|
29
|
+
* not hold the keyboard, the list does. A row that has to be told so, or the
|
|
30
|
+
* distinction between "this is the current row" and "this is the current row
|
|
31
|
+
* and you can type at it" cannot be drawn at all.
|
|
32
|
+
*/
|
|
33
|
+
focused?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Which of the component's boxes a theme styles.
|
|
36
|
+
*
|
|
37
|
+
* A composite component draws plain `box` nodes, so without this its entry
|
|
38
|
+
* in a theme's `components` map is a key nothing reads - a list row is a
|
|
39
|
+
* `box`, and `components.List.selected` is what a theme author would reach
|
|
40
|
+
* for. The name has to be stated by the component that owns the box, which
|
|
41
|
+
* is the only place that knows what the row is part of.
|
|
42
|
+
*
|
|
43
|
+
* Omitted, the node is styled under its own host name, so `components.box`
|
|
44
|
+
* and a `variant` keep working exactly as they did.
|
|
45
|
+
*/
|
|
46
|
+
styleAs?: string;
|
|
24
47
|
/** Participates in tab order. Implied by an interactive role. */
|
|
25
48
|
focusable?: boolean;
|
|
26
49
|
/** The focus scope this node belongs to. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intrinsics.d.ts","sourceRoot":"","sources":["../../src/jsx/intrinsics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAA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AA+C;IAC/C,QAAQ,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAAC;IACtD,sDAAsD;IACtD,SAAS,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
package/dist/runtime/paint.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ATTR_DIM } from '../types/cells.js';
|
|
|
2
2
|
import { overflowOn } from '../render/layout.js';
|
|
3
3
|
import { COLOR_DEFAULT, mix, packColor } from '../render/color.js';
|
|
4
4
|
import { rectIntersect } from '../types/geometry.js';
|
|
5
|
-
import { graphemes, graphemeWidth, isAscii, sanitize, stringWidth, truncate, truncateSideOf, wrapModeOf, wrapText, } from '../util/text.js';
|
|
5
|
+
import { graphemes, graphemeWidth, isAscii, markCut, sanitize, stringWidth, truncate, truncateSideOf, wrapModeOf, wrapText, } from '../util/text.js';
|
|
6
6
|
import { attrsFromStyle, NO_INTERACTION, packStyleColor, resolveBorder, resolveStyle, } from './style.js';
|
|
7
7
|
/**
|
|
8
8
|
* Painting.
|
|
@@ -585,7 +585,17 @@ function paintText(surface, box, visual, instance, env) {
|
|
|
585
585
|
: wrap === 'none' ? content.split('\n') : wrapText(content, area.width, wrapModeOf(wrap));
|
|
586
586
|
for (let i = 0; i < raw.length && i < area.height; i++) {
|
|
587
587
|
let line = raw[i];
|
|
588
|
-
|
|
588
|
+
// The last line the box has room for is cut when the text goes on past
|
|
589
|
+
// it, exactly as a line too wide for the box is. Without this a wrapped
|
|
590
|
+
// paragraph with more to say stopped mid-sentence and read as the whole
|
|
591
|
+
// of it, which is the failure `truncate` exists to prevent sideways.
|
|
592
|
+
const stopped = i === area.height - 1 && raw.length > area.height;
|
|
593
|
+
if (stopped) {
|
|
594
|
+
// The last row it has room for, with more to say: always marked, since
|
|
595
|
+
// the row itself may fit to the cell.
|
|
596
|
+
line = truncateSide === false ? line : markCut(line, area.width, ellipsis);
|
|
597
|
+
}
|
|
598
|
+
else if (stringWidth(line) > area.width) {
|
|
589
599
|
line = truncateSide === false
|
|
590
600
|
? line
|
|
591
601
|
: truncate(line, area.width, ellipsis, truncateSide ?? 'end');
|
package/dist/runtime/style.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Style, StyleInput, BorderSpec, BorderStyle, StyleColor } from '../types/style.js';
|
|
1
|
+
import type { Style, StyleInput, BorderSpec, BorderColor, BorderStyle, StyleColor, StateName } from '../types/style.js';
|
|
2
2
|
import type { ResolvedTheme } from '../types/theme.js';
|
|
3
3
|
import type { Edges } from '../types/geometry.js';
|
|
4
4
|
import type { Color } from '../types/cells.js';
|
|
@@ -16,31 +16,41 @@ export declare const STYLE_KEYS: Set<string>;
|
|
|
16
16
|
export interface InteractionState {
|
|
17
17
|
focused: boolean;
|
|
18
18
|
hovered: boolean;
|
|
19
|
+
/** Pressed. Not a selection - that is `selected`. */
|
|
19
20
|
active: boolean;
|
|
20
21
|
selected: boolean;
|
|
21
22
|
disabled: boolean;
|
|
22
23
|
}
|
|
23
24
|
export declare const NO_INTERACTION: InteractionState;
|
|
25
|
+
/** The names of the states that are true, in the order the last one wins. */
|
|
26
|
+
export declare function stateVariants(state: InteractionState): StateName[];
|
|
24
27
|
export declare function mergeStyles(...styles: (Style | undefined)[]): Style;
|
|
25
28
|
/** Flatten a `style` prop, applying state overlays in a fixed order. */
|
|
26
29
|
export declare function flattenStyleInput(input: StyleInput | undefined, state: InteractionState): Style;
|
|
27
30
|
/** Pick the style keys written inline as convenience props. */
|
|
28
31
|
export declare function styleFromProps(props: Record<string, unknown>): Style;
|
|
29
32
|
export declare function resolveStyle(props: Record<string, unknown>, theme: ResolvedTheme, component: string, defaultStyle: Style | undefined, state: InteractionState): Style;
|
|
30
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* A token name, a literal colour, or nothing.
|
|
35
|
+
*
|
|
36
|
+
* Takes the whole union because it is the one place a colour is turned into
|
|
37
|
+
* a cell value: the narrowing happened at the field that named it, which is
|
|
38
|
+
* where the mistake is made and where the error belongs.
|
|
39
|
+
*/
|
|
31
40
|
export declare function resolveColor(value: StyleColor | undefined, theme: ResolvedTheme, fallback?: Color): Color;
|
|
41
|
+
/** Pack a colour for a cell, at the caller's own channel. */
|
|
32
42
|
export declare function packStyleColor(value: StyleColor | undefined, theme: ResolvedTheme, fallback?: Color): PackedColor;
|
|
33
43
|
export declare function attrsFromStyle(style: Style): number;
|
|
34
44
|
export interface ResolvedBorder {
|
|
35
45
|
style: BorderStyle;
|
|
36
46
|
chars: BorderChars;
|
|
37
|
-
color:
|
|
47
|
+
color: BorderColor | undefined;
|
|
38
48
|
/** Per-edge overrides. Undefined here means "use `color`". */
|
|
39
49
|
colors: {
|
|
40
|
-
top?:
|
|
41
|
-
right?:
|
|
42
|
-
bottom?:
|
|
43
|
-
left?:
|
|
50
|
+
top?: BorderColor;
|
|
51
|
+
right?: BorderColor;
|
|
52
|
+
bottom?: BorderColor;
|
|
53
|
+
left?: BorderColor;
|
|
44
54
|
};
|
|
45
55
|
dim: boolean;
|
|
46
56
|
sides: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/runtime/style.ts"],"names":[],"mappings":"AAAA,OAAO,KA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AAE,aAAa,GAAG,cAAc,CAoChG"}
|
package/dist/runtime/style.js
CHANGED
|
@@ -20,6 +20,35 @@ export const STYLE_KEYS = new Set([
|
|
|
20
20
|
export const NO_INTERACTION = {
|
|
21
21
|
focused: false, hovered: false, active: false, selected: false, disabled: false,
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* The states, least to most specific - the order the last one wins.
|
|
25
|
+
*
|
|
26
|
+
* `flattenStyleInput` merges a `style` prop in this order and so does a
|
|
27
|
+
* theme's per-component map, which is the only way the two can be made to
|
|
28
|
+
* agree: a theme states `focus` over `selected` and gets the same answer
|
|
29
|
+
* whether the state came from the node or from the theme. `hovered` is the
|
|
30
|
+
* state; `hover` is the name it wears, which is why this is the one place
|
|
31
|
+
* that has to know the difference.
|
|
32
|
+
*/
|
|
33
|
+
const STATE_ORDER = [
|
|
34
|
+
'selected', 'hovered', 'active', 'focused', 'disabled',
|
|
35
|
+
];
|
|
36
|
+
const STATE_VARIANT = {
|
|
37
|
+
selected: 'selected',
|
|
38
|
+
hovered: 'hover',
|
|
39
|
+
active: 'active',
|
|
40
|
+
focused: 'focus',
|
|
41
|
+
disabled: 'disabled',
|
|
42
|
+
};
|
|
43
|
+
/** The names of the states that are true, in the order the last one wins. */
|
|
44
|
+
export function stateVariants(state) {
|
|
45
|
+
const out = [];
|
|
46
|
+
for (const key of STATE_ORDER) {
|
|
47
|
+
if (state[key])
|
|
48
|
+
out.push(STATE_VARIANT[key]);
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
23
52
|
function isStateful(value) {
|
|
24
53
|
return ('base' in value || 'focus' in value || 'hover' in value ||
|
|
25
54
|
'active' in value || 'selected' in value || 'disabled' in value);
|
|
@@ -44,6 +73,7 @@ export function flattenStyleInput(input, state) {
|
|
|
44
73
|
return input;
|
|
45
74
|
// Order matters: selected loses to active, active loses to focus, and
|
|
46
75
|
// disabled wins over everything - a disabled control is not focusable.
|
|
76
|
+
// The same order `stateVariants` gives a theme, so the two cannot disagree.
|
|
47
77
|
return mergeStyles(input.base, state.selected ? input.selected : undefined, state.hovered ? input.hover : undefined, state.active ? input.active : undefined, state.focused ? input.focus : undefined, state.disabled ? input.disabled : undefined);
|
|
48
78
|
}
|
|
49
79
|
/** Pick the style keys written inline as convenience props. */
|
|
@@ -56,22 +86,52 @@ export function styleFromProps(props) {
|
|
|
56
86
|
return out;
|
|
57
87
|
}
|
|
58
88
|
export function resolveStyle(props, theme, component, defaultStyle, state) {
|
|
59
|
-
const
|
|
89
|
+
const qualifiers = [];
|
|
60
90
|
if (typeof props.variant === 'string')
|
|
61
|
-
|
|
91
|
+
qualifiers.push(props.variant);
|
|
62
92
|
if (typeof props.tone === 'string')
|
|
63
|
-
|
|
93
|
+
qualifiers.push(props.tone);
|
|
64
94
|
if (typeof props.size === 'string')
|
|
65
|
-
|
|
66
|
-
|
|
95
|
+
qualifiers.push(props.size);
|
|
96
|
+
const variants = [...qualifiers];
|
|
97
|
+
// The states join last, so a theme's entry for one of them wins over the
|
|
98
|
+
// same name used as a variant - `List.focused` is the fill on the row the
|
|
99
|
+
// keyboard is on, and a `focused` variant means nothing else.
|
|
100
|
+
//
|
|
101
|
+
// Each state is also offered qualified by each of the props-driven names,
|
|
102
|
+
// immediately after the flat one, for the case the flat name cannot say:
|
|
103
|
+
// whether a state paints at all is sometimes a property of a variant rather
|
|
104
|
+
// than of the state. A solid tab is filled and an underline one is not, and
|
|
105
|
+
// `Tabs.selected` has to mean the pair for both while `Tabs.solid.selected`
|
|
106
|
+
// is the one that adds the fill. The qualified name merges last and the
|
|
107
|
+
// order between the states is unchanged, so `disabled` still wins over
|
|
108
|
+
// everything and `focus` still wins over `selected`.
|
|
109
|
+
for (const name of stateVariants(state)) {
|
|
110
|
+
variants.push(name);
|
|
111
|
+
for (const qualifier of qualifiers)
|
|
112
|
+
variants.push(`${qualifier}.${name}`);
|
|
113
|
+
}
|
|
114
|
+
// `styleAs` is how a component says which of its boxes a theme styles. A
|
|
115
|
+
// list draws its rows as plain `box` nodes, so without it `components.List`
|
|
116
|
+
// would be a key nothing ever reads - which is what every `components` entry
|
|
117
|
+
// written for a composite component was until this.
|
|
118
|
+
const owner = typeof props.styleAs === 'string' ? props.styleAs : component;
|
|
119
|
+
return mergeStyles(theme.styleFor(owner, variants), defaultStyle, styleFromProps(props), flattenStyleInput(props.style, state));
|
|
67
120
|
}
|
|
68
121
|
// ------------------------------------------------------------------ colour
|
|
69
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* A token name, a literal colour, or nothing.
|
|
124
|
+
*
|
|
125
|
+
* Takes the whole union because it is the one place a colour is turned into
|
|
126
|
+
* a cell value: the narrowing happened at the field that named it, which is
|
|
127
|
+
* where the mistake is made and where the error belongs.
|
|
128
|
+
*/
|
|
70
129
|
export function resolveColor(value, theme, fallback = 'default') {
|
|
71
130
|
if (value === undefined)
|
|
72
131
|
return fallback;
|
|
73
132
|
return theme.color(value);
|
|
74
133
|
}
|
|
134
|
+
/** Pack a colour for a cell, at the caller's own channel. */
|
|
75
135
|
export function packStyleColor(value, theme, fallback = 'default') {
|
|
76
136
|
return packColor(resolveColor(value, theme, fallback));
|
|
77
137
|
}
|
package/dist/themes/builtin.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import type { ThemeDefinition } from '../types/theme.js';
|
|
2
|
-
/**
|
|
3
|
-
* The built-in themes.
|
|
4
|
-
*
|
|
5
|
-
* `dark` and `light` are the two bases; everything else extends one of them
|
|
6
|
-
* and restates only what it changes. The three that follow exist because the
|
|
7
|
-
* same application should be able to look like a dense operator console, an
|
|
8
|
-
* airy report or a workbench without a component knowing which - so the
|
|
9
|
-
* difference lives here, in border style and density, not in the catalog.
|
|
10
|
-
*/
|
|
11
2
|
export declare const DARK: ThemeDefinition;
|
|
12
3
|
export declare const LIGHT: ThemeDefinition;
|
|
13
4
|
/** Dense, bordered, high contrast. Every region is a labelled box. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/themes/builtin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/themes/builtin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA8EzD,eAAO,MAAM,IAAI,EAAE,eA8ClB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,eA8CnB,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,OAAO,EAAE,eAuCrB,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,KAAK,EAAE,eAyDnB,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,WAAW,EAAE,eAkCzB,CAAC;AAEF,gDAAgD;AAChD,eAAO,MAAM,SAAS,EAAE,eAqCvB,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,IAAI,EAAE,eAiElB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,EAAE,eA+BxB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAAe,EAE3C,CAAC"}
|
package/dist/themes/builtin.js
CHANGED
|
@@ -7,6 +7,70 @@
|
|
|
7
7
|
* airy report or a workbench without a component knowing which - so the
|
|
8
8
|
* difference lives here, in border style and density, not in the catalog.
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* A selection, in the two states it has.
|
|
12
|
+
*
|
|
13
|
+
* `selected` is "this is the current one" and `focus` is the same row while
|
|
14
|
+
* the component holds the keyboard, so a theme states the bright fill once and
|
|
15
|
+
* the dimmer one for everything the reader has walked away from. They were one
|
|
16
|
+
* name once - `active` meant both this and pressed - and a word that means two
|
|
17
|
+
* things gets filled with either.
|
|
18
|
+
*
|
|
19
|
+
* Both name tokens rather than colours, which is the point of the whole
|
|
20
|
+
* arrangement: retint the palette and every component that has not said
|
|
21
|
+
* otherwise moves with it, while a theme that states `components.List.focused`
|
|
22
|
+
* moves the list and leaves the table where it was.
|
|
23
|
+
*/
|
|
24
|
+
const SELECTION_FOCUSED = { bg: 'selected', fg: 'onSelected', dim: true };
|
|
25
|
+
const SELECTION_UNFOCUSED = { bg: 'active', fg: 'onActive' };
|
|
26
|
+
const SELECTION_HOVER = { bg: 'hover', fg: 'onActive' };
|
|
27
|
+
// The other way to draw a selection: reverse video, which is legible whatever
|
|
28
|
+
// a theme's own two colours are. Left beside the three above while that is
|
|
29
|
+
// decided - nothing reads them yet.
|
|
30
|
+
// const SELECTION_DEFAULT: Style = { bg: 'default', fg: 'default', inverse: true };
|
|
31
|
+
// const SELECTION_DIMMED: Style = { bg: 'default', fg: 'default', inverse: true, dim: true };
|
|
32
|
+
/**
|
|
33
|
+
* The state colours every built-in theme starts from.
|
|
34
|
+
*
|
|
35
|
+
* Stated once and spread into `dark` and `light` because a theme that
|
|
36
|
+
* extends either inherits it whole: the entries name tokens, so `console`
|
|
37
|
+
* keeps its own `selected` and gets its own fills, without restating a single
|
|
38
|
+
* component. That is also what makes them the *defaults* - a theme states
|
|
39
|
+
* `components` to differ, and says nothing here about what it does not.
|
|
40
|
+
*/
|
|
41
|
+
const STATE_STYLES = {
|
|
42
|
+
List: { selected: SELECTION_UNFOCUSED, focus: SELECTION_FOCUSED },
|
|
43
|
+
Tree: { selected: SELECTION_UNFOCUSED, focus: SELECTION_FOCUSED },
|
|
44
|
+
Table: { selected: SELECTION_UNFOCUSED, focus: SELECTION_FOCUSED },
|
|
45
|
+
// The field's own selection, over the text it covers. Same pair, same
|
|
46
|
+
// reason: a selection left visible in an unfocused field says what is on
|
|
47
|
+
// the clipboard, and saying it as loudly as the live one would put two
|
|
48
|
+
// selections on the screen.
|
|
49
|
+
TextArea: { selected: SELECTION_UNFOCUSED, focus: SELECTION_FOCUSED },
|
|
50
|
+
// A marked line is a selection. The caret line is that selection plus the
|
|
51
|
+
// keyboard, so it takes the next fill up rather than a colour of its own.
|
|
52
|
+
CodeViewer: { selected: SELECTION_UNFOCUSED, focus: SELECTION_HOVER },
|
|
53
|
+
Menu: { selected: SELECTION_UNFOCUSED, focus: SELECTION_FOCUSED },
|
|
54
|
+
// A tab is open, not selected. Dimming it when the strip does not have the
|
|
55
|
+
// keyboard would say no document is open, which is a different claim and a
|
|
56
|
+
// wrong one - so it has one state and no second.
|
|
57
|
+
//
|
|
58
|
+
// Whether a tab is *filled* is a property of the variant rather than of the
|
|
59
|
+
// state: a solid tab is, an underline one is not. So the pair is stated for
|
|
60
|
+
// the state and the fill only for the variant that has one.
|
|
61
|
+
Tabs: { selected: { fg: 'onSelected' }, 'solid.selected': SELECTION_FOCUSED },
|
|
62
|
+
// The chat rows take the same fills, and for the same reason. `ToolCallRow`
|
|
63
|
+
// and `ReasoningBlock` are selections in a transcript that the caller
|
|
64
|
+
// names, so they have `selected` and no `focus`; a `ComposerChip` lights up
|
|
65
|
+
// only while it holds the keyboard, so it has `focus` and no `selected`.
|
|
66
|
+
ToolCallRow: { selected: SELECTION_FOCUSED },
|
|
67
|
+
ReasoningBlock: { selected: SELECTION_FOCUSED },
|
|
68
|
+
ComposerChip: { focus: SELECTION_FOCUSED },
|
|
69
|
+
// A range in a document is a selection, and it keeps the colours the text
|
|
70
|
+
// under it was already drawn in - the syntax of a selection is the syntax of
|
|
71
|
+
// the code it covers.
|
|
72
|
+
Editor: { selected: { bg: 'active' } },
|
|
73
|
+
};
|
|
10
74
|
export const DARK = {
|
|
11
75
|
id: 'dark',
|
|
12
76
|
name: 'Dark',
|
|
@@ -52,6 +116,7 @@ export const DARK = {
|
|
|
52
116
|
shadow: '#010409',
|
|
53
117
|
},
|
|
54
118
|
spacing: { none: 0, xs: 0, sm: 1, md: 1, lg: 2, xl: 3 },
|
|
119
|
+
components: { ...STATE_STYLES },
|
|
55
120
|
};
|
|
56
121
|
export const LIGHT = {
|
|
57
122
|
id: 'light',
|
|
@@ -89,7 +154,7 @@ export const LIGHT = {
|
|
|
89
154
|
onWarning: '#ffffff',
|
|
90
155
|
onDanger: '#ffffff',
|
|
91
156
|
hover: '#eaeef2',
|
|
92
|
-
active: '#
|
|
157
|
+
active: '#a5bdd8',
|
|
93
158
|
selected: '#0969da',
|
|
94
159
|
focus: '#0969da',
|
|
95
160
|
disabled: '#8c959f',
|
|
@@ -98,6 +163,7 @@ export const LIGHT = {
|
|
|
98
163
|
shadow: '#d0d7de',
|
|
99
164
|
},
|
|
100
165
|
spacing: { none: 0, xs: 0, sm: 1, md: 1, lg: 2, xl: 3 },
|
|
166
|
+
components: { ...STATE_STYLES },
|
|
101
167
|
};
|
|
102
168
|
/** Dense, bordered, high contrast. Every region is a labelled box. */
|
|
103
169
|
export const CONSOLE = {
|
|
@@ -122,7 +188,9 @@ export const CONSOLE = {
|
|
|
122
188
|
//
|
|
123
189
|
// The two selection backgrounds are picked rather than derived: `selected`
|
|
124
190
|
// carries `inverted` text so it has to be light, and `active` carries
|
|
125
|
-
// `text` so it has to be dark. Same hue, opposite ends.
|
|
191
|
+
// `text` so it has to be dark. Same hue, opposite ends. `active` is what
|
|
192
|
+
// a selection looks like when the component does not have the keyboard -
|
|
193
|
+
// it is the dim end of the pair, not a pressed control.
|
|
126
194
|
primary: '#88c0d0',
|
|
127
195
|
info: '#88c0d0',
|
|
128
196
|
selected: '#6ba3b2',
|
|
@@ -166,6 +234,7 @@ export const PAPER = {
|
|
|
166
234
|
warning: '#d29922',
|
|
167
235
|
danger: '#f85149',
|
|
168
236
|
info: '#58a6ff',
|
|
237
|
+
/* ---- */
|
|
169
238
|
onAccent: '#0d1117',
|
|
170
239
|
onDefault: '#0d1117',
|
|
171
240
|
onPrimary: '#0d1117',
|
|
@@ -175,17 +244,22 @@ export const PAPER = {
|
|
|
175
244
|
onInfo: '#0d1117',
|
|
176
245
|
onWarning: '#0d1117',
|
|
177
246
|
onDanger: '#0d1117',
|
|
247
|
+
/* ---- */
|
|
178
248
|
hover: '#1f2937',
|
|
179
|
-
active: '
|
|
180
|
-
|
|
249
|
+
active: 'default',
|
|
250
|
+
onActive: '#3191ff',
|
|
251
|
+
selected: 'default',
|
|
252
|
+
onSelected: '#58a6ff',
|
|
181
253
|
focus: '#58a6ff',
|
|
182
254
|
disabled: '#484f58',
|
|
255
|
+
/* ---- */
|
|
183
256
|
scrim: '#010409',
|
|
184
257
|
cursor: 'default',
|
|
185
258
|
shadow: '#010409',
|
|
186
259
|
},
|
|
187
260
|
spacing: { none: 0, xs: 1, sm: 1, md: 2, lg: 3, xl: 4 },
|
|
188
261
|
components: {
|
|
262
|
+
...STATE_STYLES,
|
|
189
263
|
Panel: { base: { border: 'none', padding: [1, 2] } },
|
|
190
264
|
Button: { base: { padding: [0, 2] } },
|
|
191
265
|
},
|
|
@@ -255,6 +329,9 @@ export const WORKBENCH = {
|
|
|
255
329
|
hover: '#313244',
|
|
256
330
|
active: '#45475a',
|
|
257
331
|
selected: '#585b70',
|
|
332
|
+
// The selection is a mid grey, so the light text is what reads on it; the
|
|
333
|
+
// inherited `inverted` is darker than the fill and nearly disappears.
|
|
334
|
+
onSelected: '#cdd6f4',
|
|
258
335
|
focus: '#89b4fa',
|
|
259
336
|
scrim: '#11111b',
|
|
260
337
|
},
|
|
@@ -267,7 +344,12 @@ export const MONO = {
|
|
|
267
344
|
id: 'mono',
|
|
268
345
|
name: 'Monochrome',
|
|
269
346
|
appearance: 'dark',
|
|
347
|
+
// The theme's own colours are all `default`; this is what makes that true of
|
|
348
|
+
// the ones a component states for itself, which is the difference between a
|
|
349
|
+
// palette that happens to be grey and a theme with no colour in it.
|
|
350
|
+
monochrome: true,
|
|
270
351
|
border: 'ascii',
|
|
352
|
+
// border: 'none',
|
|
271
353
|
cursor: 'underline',
|
|
272
354
|
// Chosen, not downgraded to: this theme is ascii on a terminal that could
|
|
273
355
|
// draw anything, so the rule has to say so too.
|
|
@@ -308,6 +390,21 @@ export const MONO = {
|
|
|
308
390
|
cursor: 'default',
|
|
309
391
|
shadow: 'default',
|
|
310
392
|
},
|
|
393
|
+
components: {
|
|
394
|
+
List: { selected: { bold: true }, focus: { bold: true } },
|
|
395
|
+
Tree: { selected: { bold: true }, focus: { bold: true } },
|
|
396
|
+
Table: { selected: { bold: true }, focus: { bold: true } },
|
|
397
|
+
TextArea: { selected: { bold: true }, focus: { bold: true } },
|
|
398
|
+
CodeViewer: { selected: { bold: true }, focus: { bold: true } },
|
|
399
|
+
Menu: { selected: { bold: true }, focus: { bold: true } },
|
|
400
|
+
Tabs: { selected: { bold: true }, 'solid.selected': { bold: true } },
|
|
401
|
+
ToolCallRow: { selected: { bold: true } },
|
|
402
|
+
ReasoningBlock: { selected: { bold: true } },
|
|
403
|
+
ComposerChip: { focus: { bold: true } },
|
|
404
|
+
Editor: { selected: { bold: true } },
|
|
405
|
+
Panel: { base: { border: 'ascii', padding: [0, 1] } },
|
|
406
|
+
Button: { base: { padding: [0, 1] } },
|
|
407
|
+
}
|
|
311
408
|
};
|
|
312
409
|
/**
|
|
313
410
|
* Paper, after dark.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/themes/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAAE,eAAe,EAAe,aAAa,EAC3D,MAAM,mBAAmB,CAAC;AAK3B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/themes/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAAE,eAAe,EAAe,aAAa,EAC3D,MAAM,mBAAmB,CAAC;AAK3B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAsDzD,qBAAa,MAAO,YAAW,aAAa;IAC1C,OAAO,CAAC,IAAI,CAAsC;IAClD,OAAO,CAAC,KAAK,CAAoC;gBAErC,OAAO,GAAE,eAAe,EAAmB;IAIvD,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,UAAU;IAS1C,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAK5B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAI5C,IAAI,IAAI,eAAe,EAAE;IAIzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,aAAa;CA6K/D;AAED,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,eAAe,EAAE,GAAG,MAAM,CAEhE"}
|
package/dist/themes/registry.js
CHANGED
|
@@ -13,6 +13,7 @@ const FALLBACK_COLORS = {
|
|
|
13
13
|
onDefault: 'default', onMuted: 'default',
|
|
14
14
|
onAccent: 'default', onPrimary: 'default', onSecondary: 'default',
|
|
15
15
|
onSuccess: 'default', onWarning: 'default', onDanger: 'default', onInfo: 'default',
|
|
16
|
+
onSelected: 'default', onActive: 'default',
|
|
16
17
|
hover: 'default', active: 'default', selected: 'default', focus: 'default',
|
|
17
18
|
disabled: 'default', scrim: 'default', cursor: 'default', shadow: 'default',
|
|
18
19
|
};
|
|
@@ -105,6 +106,7 @@ export class Themes {
|
|
|
105
106
|
// opts in rather than out.
|
|
106
107
|
let tableRules = 'header';
|
|
107
108
|
let density = 'normal';
|
|
109
|
+
let monochrome = false;
|
|
108
110
|
const components = {};
|
|
109
111
|
let syntaxOverrides = {};
|
|
110
112
|
for (const def of chain) {
|
|
@@ -143,10 +145,28 @@ export class Themes {
|
|
|
143
145
|
tableRules = def.tableRules;
|
|
144
146
|
if (def.density)
|
|
145
147
|
density = def.density;
|
|
148
|
+
if (def.monochrome !== undefined)
|
|
149
|
+
monochrome = def.monochrome;
|
|
146
150
|
for (const [name, variants] of Object.entries(def.components ?? {})) {
|
|
147
151
|
components[name] = { ...components[name], ...variants };
|
|
148
152
|
}
|
|
149
153
|
}
|
|
154
|
+
// What is written on a filled row, derived rather than restated.
|
|
155
|
+
//
|
|
156
|
+
// A selection background is only half a pair: `selected` carries
|
|
157
|
+
// `inverted` and `active` carries `text`. Stated as two independent
|
|
158
|
+
// colours, a theme that restates one half - `paper-light` restates
|
|
159
|
+
// `inverted`, `paper` leaves `text` as the terminal's - would take the
|
|
160
|
+
// other half from the theme it extends, or from the terminal, and a row
|
|
161
|
+
// could come out unreadable with nothing in the theme saying so.
|
|
162
|
+
//
|
|
163
|
+
// So the pair follows the theme's own values unless it says otherwise. A
|
|
164
|
+
// theme that wants a different colour on a fill states it, which is what
|
|
165
|
+
// `paper` does for `active`.
|
|
166
|
+
if (colors.onSelected === 'default')
|
|
167
|
+
colors.onSelected = colors.inverted;
|
|
168
|
+
if (colors.onActive === 'default')
|
|
169
|
+
colors.onActive = colors.text;
|
|
150
170
|
// A colourless terminal gets no colour, whatever the theme says.
|
|
151
171
|
if (caps.colorDepth === 0) {
|
|
152
172
|
for (const token of Object.keys(colors)) {
|
|
@@ -175,6 +195,7 @@ export class Themes {
|
|
|
175
195
|
id: leaf.id,
|
|
176
196
|
name: leaf.name,
|
|
177
197
|
appearance: leaf.appearance,
|
|
198
|
+
monochrome,
|
|
178
199
|
colors,
|
|
179
200
|
spacing,
|
|
180
201
|
glyphs,
|
|
@@ -186,6 +207,11 @@ export class Themes {
|
|
|
186
207
|
components,
|
|
187
208
|
syntax,
|
|
188
209
|
color(token) {
|
|
210
|
+
// A monochrome theme has no colour to give, and that has to include the
|
|
211
|
+
// literal a component states for itself - otherwise the one theme whose
|
|
212
|
+
// whole point is no colour is the one that cannot promise it.
|
|
213
|
+
if (monochrome)
|
|
214
|
+
return 'default';
|
|
189
215
|
if (token in colors)
|
|
190
216
|
return colors[token];
|
|
191
217
|
// Not a token: a literal colour passed straight through.
|
package/dist/types/i18n.d.ts
CHANGED
|
@@ -20,7 +20,15 @@ export interface I18n {
|
|
|
20
20
|
date(value: Date | number, options?: Intl.DateTimeFormatOptions): string;
|
|
21
21
|
relative(value: number, unit: Intl.RelativeTimeFormatUnit): string;
|
|
22
22
|
list(items: string[], options?: Intl.ListFormatOptions): string;
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The form the locale's plural rules pick for `count`, with `{count}` and
|
|
25
|
+
* anything the sentence needs around it.
|
|
26
|
+
*
|
|
27
|
+
* `values` carries what else the form names - a limit, a glyph, the total a
|
|
28
|
+
* count is out of - because a sentence that inflects a noun is the whole
|
|
29
|
+
* sentence and not a noun with a number in front of it.
|
|
30
|
+
*/
|
|
31
|
+
plural(count: number, forms: Record<string, string>, values?: Record<string, unknown>): string;
|
|
24
32
|
onChange(fn: (locale: LocaleId) => void): Disposable;
|
|
25
33
|
}
|
|
26
34
|
//# sourceMappingURL=i18n.d.ts.map
|
package/dist/types/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/types/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,QAAQ,CAAC;IACjB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,QAAQ,CAAC;IACjB,SAAS,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU,CAAC;IAChD,OAAO,IAAI,QAAQ,EAAE,CAAC;IACtB;;;OAGG;IACH,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5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