@textui/core 0.7.0 → 0.9.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 +4 -13
- package/dist/themes/builtin.d.ts.map +1 -1
- package/dist/themes/builtin.js +160 -48
- 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 +165 -49
- 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. */
|
|
@@ -16,10 +7,6 @@ export declare const CONSOLE: ThemeDefinition;
|
|
|
16
7
|
export declare const PAPER: ThemeDefinition;
|
|
17
8
|
/** Borderless. Whitespace and alignment do the separating. */
|
|
18
9
|
export declare const PAPER_LIGHT: ThemeDefinition;
|
|
19
|
-
/** Rounded chrome around a persistent frame. */
|
|
20
|
-
export declare const WORKBENCH: ThemeDefinition;
|
|
21
|
-
/** No colour at all. What a `colorDepth: 0` terminal or a pipe gets. */
|
|
22
|
-
export declare const MONO: ThemeDefinition;
|
|
23
10
|
/**
|
|
24
11
|
* Paper, after dark.
|
|
25
12
|
*
|
|
@@ -29,5 +16,9 @@ export declare const MONO: ThemeDefinition;
|
|
|
29
16
|
* reader moving between them is not moving between two different products.
|
|
30
17
|
*/
|
|
31
18
|
export declare const PAPER_DARK: ThemeDefinition;
|
|
19
|
+
/** Rounded chrome around a persistent frame. */
|
|
20
|
+
export declare const WORKBENCH: ThemeDefinition;
|
|
21
|
+
/** No colour at all. What a `colorDepth: 0` terminal or a pipe gets. */
|
|
22
|
+
export declare const MONO: ThemeDefinition;
|
|
32
23
|
export declare const BUILTIN_THEMES: ThemeDefinition[];
|
|
33
24
|
//# sourceMappingURL=builtin.d.ts.map
|
|
@@ -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;AAgFzD,eAAO,MAAM,IAAI,EAAE,eAgDlB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,eAgDnB,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,OAAO,EAAE,eA0CrB,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,KAAK,EAAE,eAyDnB,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,WAAW,EAAE,eAqCzB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,EAAE,eAiCxB,CAAC;AAEF,gDAAgD;AAChD,eAAO,MAAM,SAAS,EAAE,eAsCvB,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,IAAI,EAAE,eAiElB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAAe,EAE3C,CAAC"}
|