react-native-terra-ui 0.10.1 → 0.11.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/CHANGELOG.md +29 -0
- package/README.md +8 -4
- package/lib/module/components/button/Button.js +21 -13
- package/lib/module/components/button/Button.js.map +1 -1
- package/lib/module/components/button/index.js.map +1 -1
- package/lib/module/components/divider/Divider.js +127 -0
- package/lib/module/components/divider/Divider.js.map +1 -0
- package/lib/module/components/divider/index.js +4 -0
- package/lib/module/components/divider/index.js.map +1 -0
- package/lib/module/components/index.js +2 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/pressable/index.js +4 -0
- package/lib/module/components/pressable/index.js.map +1 -0
- package/lib/module/components/pressable/variants/PressableScale/index.js +110 -0
- package/lib/module/components/pressable/variants/PressableScale/index.js.map +1 -0
- package/lib/module/context/ThemeProvider.js +5 -5
- package/lib/module/context/ThemeProvider.js.map +1 -1
- package/lib/module/theme/define-config.js +5 -5
- package/lib/module/theme/define-config.js.map +1 -1
- package/lib/module/theme/errors.js +1 -1
- package/lib/module/theme/index.js +2 -2
- package/lib/module/theme/index.js.map +1 -1
- package/lib/module/theme/registry.js +15 -21
- package/lib/module/theme/registry.js.map +1 -1
- package/lib/module/theme/resolve-config.js +68 -68
- package/lib/module/theme/resolve-config.js.map +1 -1
- package/lib/module/theme/runtime.js +11 -11
- package/lib/module/theme/runtime.js.map +1 -1
- package/lib/module/theme/selection-store.js +7 -7
- package/lib/module/theme/selection-store.js.map +1 -1
- package/lib/module/theme/unistyles-adapter.js +1 -1
- package/lib/module/utils/accent-utils.js +24 -24
- package/lib/module/utils/accent-utils.js.map +1 -1
- package/lib/typescript/src/components/button/Button.d.ts +7 -0
- package/lib/typescript/src/components/button/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/button/index.d.ts +1 -1
- package/lib/typescript/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/divider/Divider.d.ts +49 -0
- package/lib/typescript/src/components/divider/Divider.d.ts.map +1 -0
- package/lib/typescript/src/components/divider/index.d.ts +3 -0
- package/lib/typescript/src/components/divider/index.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +2 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/components/pressable/index.d.ts +3 -0
- package/lib/typescript/src/components/pressable/index.d.ts.map +1 -0
- package/lib/typescript/src/components/pressable/variants/PressableScale/index.d.ts +47 -0
- package/lib/typescript/src/components/pressable/variants/PressableScale/index.d.ts.map +1 -0
- package/lib/typescript/src/context/ThemeProvider.d.ts +7 -7
- package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
- package/lib/typescript/src/theme/define-config.d.ts +11 -8
- package/lib/typescript/src/theme/define-config.d.ts.map +1 -1
- package/lib/typescript/src/theme/errors.d.ts +1 -1
- package/lib/typescript/src/theme/index.d.ts +3 -3
- package/lib/typescript/src/theme/index.d.ts.map +1 -1
- package/lib/typescript/src/theme/registry.d.ts +5 -5
- package/lib/typescript/src/theme/registry.d.ts.map +1 -1
- package/lib/typescript/src/theme/resolve-config.d.ts +25 -25
- package/lib/typescript/src/theme/resolve-config.d.ts.map +1 -1
- package/lib/typescript/src/theme/runtime.d.ts +5 -5
- package/lib/typescript/src/theme/runtime.d.ts.map +1 -1
- package/lib/typescript/src/theme/selection-store.d.ts +5 -5
- package/lib/typescript/src/theme/selection-store.d.ts.map +1 -1
- package/lib/typescript/src/theme/types.d.ts +20 -47
- package/lib/typescript/src/theme/types.d.ts.map +1 -1
- package/lib/typescript/src/theme/unistyles-adapter.d.ts +1 -1
- package/lib/typescript/src/utils/accent-utils.d.ts +6 -7
- package/lib/typescript/src/utils/accent-utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/button/Button.tsx +32 -13
- package/src/components/button/index.ts +1 -0
- package/src/components/divider/Divider.tsx +164 -0
- package/src/components/divider/index.ts +7 -0
- package/src/components/index.ts +2 -0
- package/src/components/pressable/index.ts +5 -0
- package/src/components/pressable/variants/PressableScale/index.tsx +166 -0
- package/src/context/ThemeProvider.tsx +10 -10
- package/src/theme/define-config.ts +12 -7
- package/src/theme/errors.ts +1 -1
- package/src/theme/index.ts +6 -8
- package/src/theme/registry.ts +15 -23
- package/src/theme/resolve-config.ts +88 -95
- package/src/theme/runtime.ts +11 -11
- package/src/theme/selection-store.ts +9 -9
- package/src/theme/types.ts +21 -47
- package/src/theme/unistyles-adapter.ts +1 -1
- package/src/utils/accent-utils.ts +25 -25
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { normalizeTokenOverride } from "../theme/legacy-tokens.js";
|
|
4
|
-
import {
|
|
4
|
+
import { normalizeThemeScheme } from "../theme/resolve-config.js";
|
|
5
5
|
import { defaultDarkTheme, defaultLightTheme } from "../theme/theme.js";
|
|
6
6
|
import { ACCENT_SURFACE_ROLES, generateAccentColors } from "./accent-generator.js";
|
|
7
7
|
/**
|
|
@@ -21,32 +21,33 @@ export function defaultAccentContext(scheme) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
* the
|
|
26
|
-
*
|
|
24
|
+
* Generate a palette using the named theme's ordinary surface overrides. The
|
|
25
|
+
* rest of the patch passes through as authored, matching the unseeded branch —
|
|
26
|
+
* so `spacing.base` / `radius.base` stay pseudo-tokens here; only
|
|
27
|
+
* `applyThemeLayer` expands them into a scale.
|
|
27
28
|
*/
|
|
28
|
-
function seedToColorPatch(seed,
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
color: overrides
|
|
35
|
-
})?.color;
|
|
36
|
-
if (normalized) {
|
|
37
|
-
for (const [key, value] of Object.entries(normalized)) {
|
|
38
|
-
if (value !== undefined) color[key] = value;
|
|
39
|
-
}
|
|
29
|
+
function seedToColorPatch(seed, patch, scheme) {
|
|
30
|
+
const normalized = normalizeTokenOverride(patch);
|
|
31
|
+
const context = defaultAccentContext(scheme);
|
|
32
|
+
for (const role of ACCENT_SURFACE_ROLES) {
|
|
33
|
+
const value = normalized?.color?.[role];
|
|
34
|
+
if (value !== undefined) context.surfaces[role] = value;
|
|
40
35
|
}
|
|
36
|
+
context.pressedOpacity = normalized?.opacity?.pressed ?? context.pressedOpacity;
|
|
37
|
+
const generated = generateAccentColors(seed, context).colors;
|
|
41
38
|
return {
|
|
42
|
-
|
|
39
|
+
...normalized,
|
|
40
|
+
color: {
|
|
41
|
+
...generated,
|
|
42
|
+
...normalized?.color
|
|
43
|
+
}
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
function normalizeSchemeInput(input, scheme) {
|
|
46
|
-
const normalized =
|
|
47
|
+
const normalized = normalizeThemeScheme(input, `themes.<name>.${scheme}`);
|
|
47
48
|
if (normalized.kind === "none") return {};
|
|
48
49
|
if (normalized.kind === "seed") {
|
|
49
|
-
return seedToColorPatch(normalized.seed, normalized.
|
|
50
|
+
return seedToColorPatch(normalized.seed, normalized.patch, scheme);
|
|
50
51
|
}
|
|
51
52
|
// Preserve the compatibility helper's identity contract for full patches;
|
|
52
53
|
// the resolver itself uses the sanitized copy in `normalized.patch`.
|
|
@@ -54,11 +55,10 @@ function normalizeSchemeInput(input, scheme) {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* pass through unchanged. Pure and independent of the registry.
|
|
58
|
+
* @deprecated Prefer createTerraThemes for complete theme resolution.
|
|
59
|
+
* Generates per-scheme patches without shared config. Explicit unseeded patches
|
|
60
|
+
* pass through unchanged; seeded entries generate against their own surface and
|
|
61
|
+
* color tokens and carry the remainder of the patch through unresolved.
|
|
62
62
|
*/
|
|
63
63
|
export function normalizeAccent(accent) {
|
|
64
64
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["normalizeTokenOverride","
|
|
1
|
+
{"version":3,"names":["normalizeTokenOverride","normalizeThemeScheme","defaultDarkTheme","defaultLightTheme","ACCENT_SURFACE_ROLES","generateAccentColors","defaultAccentContext","scheme","theme","surfaces","role","color","pressedOpacity","opacity","pressed","seedToColorPatch","seed","patch","normalized","context","value","undefined","generated","colors","normalizeSchemeInput","input","kind","normalizeAccent","accent","light","dark"],"sourceRoot":"../../../src","sources":["utils/accent-utils.ts"],"mappings":";;AAAA,SAASA,sBAAsB;AAC/B,SAASC,oBAAoB;AAC7B,SAASC,gBAAgB,EAAEC,iBAAiB;AAS5C,SACEC,oBAAoB,EAGpBC,oBAAoB;AAItB;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,MAAc,EAA2B;EAC5E,MAAMC,KAAK,GAAGD,MAAM,KAAK,OAAO,GAAGJ,iBAAiB,GAAGD,gBAAgB;EACvE,MAAMO,QAAQ,GAAG,CAAC,CAAsC;EACxD,KAAK,MAAMC,IAAI,IAAIN,oBAAoB,EAAEK,QAAQ,CAACC,IAAI,CAAC,GAAGF,KAAK,CAACG,KAAK,CAACD,IAAI,CAAC;EAC3E,OAAO;IAAEH,MAAM;IAAEE,QAAQ;IAAEG,cAAc,EAAEJ,KAAK,CAACK,OAAO,CAACC;EAAQ,CAAC;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CACvBC,IAAY,EACZC,KAAqC,EACrCV,MAAc,EACW;EACzB,MAAMW,UAAU,GAAGlB,sBAAsB,CAACiB,KAAK,CAAC;EAChD,MAAME,OAAO,GAAGb,oBAAoB,CAACC,MAAM,CAAC;EAC5C,KAAK,MAAMG,IAAI,IAAIN,oBAAoB,EAAE;IACvC,MAAMgB,KAAK,GAAGF,UAAU,EAAEP,KAAK,GAAGD,IAAI,CAAC;IACvC,IAAIU,KAAK,KAAKC,SAAS,EAAEF,OAAO,CAACV,QAAQ,CAACC,IAAI,CAAC,GAAGU,KAAK;EACzD;EACAD,OAAO,CAACP,cAAc,GAAGM,UAAU,EAAEL,OAAO,EAAEC,OAAO,IAAIK,OAAO,CAACP,cAAc;EAC/E,MAAMU,SAAS,GAAGjB,oBAAoB,CAACW,IAAI,EAAEG,OAAO,CAAC,CAACI,MAAM;EAC5D,OAAO;IAAE,GAAGL,UAAU;IAAEP,KAAK,EAAE;MAAE,GAAGW,SAAS;MAAE,GAAGJ,UAAU,EAAEP;IAAM;EAAE,CAAC;AACzE;AAEA,SAASa,oBAAoBA,CAACC,KAAmC,EAAElB,MAAc,EAA2B;EAC1G,MAAMW,UAAU,GAAGjB,oBAAoB,CAACwB,KAAK,EAAE,iBAAiBlB,MAAM,EAAE,CAAC;EACzE,IAAIW,UAAU,CAACQ,IAAI,KAAK,MAAM,EAAE,OAAO,CAAC,CAAC;EACzC,IAAIR,UAAU,CAACQ,IAAI,KAAK,MAAM,EAAE;IAC9B,OAAOX,gBAAgB,CAACG,UAAU,CAACF,IAAI,EAAEE,UAAU,CAACD,KAAK,EAAEV,MAAM,CAAC;EACpE;EACA;EACA;EACA,OAAOkB,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,eAAeA,CAACC,MAAkB,EAAoB;EACpE,OAAO;IACLC,KAAK,EAAEL,oBAAoB,CAACI,MAAM,CAACC,KAAK,EAAE,OAAO,CAAC;IAClDC,IAAI,EAAEN,oBAAoB,CAACI,MAAM,CAACE,IAAI,EAAE,MAAM;EAChD,CAAC;AACH","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import type { ColorToken, TerraIconName } from "../../theme/types";
|
|
|
4
4
|
export type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "danger";
|
|
5
5
|
export type ButtonSize = "sm" | "md" | "lg";
|
|
6
6
|
export type ButtonRadius = "none" | "sm" | "md" | "lg" | "xl" | "full";
|
|
7
|
+
export type ButtonAnimation = "scale" | "opacity" | "none";
|
|
7
8
|
export interface ButtonProps extends Omit<PressableProps, "style" | "children" | "disabled"> {
|
|
8
9
|
variant?: ButtonVariant;
|
|
9
10
|
size?: ButtonSize;
|
|
@@ -19,6 +20,12 @@ export interface ButtonProps extends Omit<PressableProps, "style" | "children" |
|
|
|
19
20
|
fullWidth?: boolean;
|
|
20
21
|
/** Remove the button's built-in horizontal padding. */
|
|
21
22
|
compact?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Press feedback. `'scale'` shrinks the button to 0.96, `'opacity'` dims it
|
|
25
|
+
* to `opacity.pressed`, `'none'` leaves it static. The two are mutually
|
|
26
|
+
* exclusive. Defaults to `'scale'`.
|
|
27
|
+
*/
|
|
28
|
+
animation?: ButtonAnimation;
|
|
22
29
|
/**
|
|
23
30
|
* Overrides the variant's resolved background color (theme token or raw
|
|
24
31
|
* CSS color). The label/icon/spinner foreground automatically switches to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0D,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAC3G,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0D,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAC3G,OAAO,KAAK,EAAa,cAAc,EAA8B,MAAM,cAAc,CAAC;AAK1F,OAAO,KAAK,EAAE,UAAU,EAAmB,aAAa,EAA2B,MAAM,cAAc,CAAC;AAQxG,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AACrF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC5C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AACvE,MAAM,MAAM,eAAe,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AE,OAAO,WAAW,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,MAAM,EAAiB,eAAe,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { ButtonIconProps, ButtonProps, ButtonRadius, ButtonSize, ButtonVariant, } from "./Button.js";
|
|
1
|
+
export type { ButtonAnimation, ButtonIconProps, ButtonProps, ButtonRadius, ButtonSize, ButtonVariant, } from "./Button.js";
|
|
2
2
|
export { Button, useButtonContext } from "./Button.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,aAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,eAAe,EACf,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,aAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAU,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ViewProps } from "react-native";
|
|
3
|
+
import type { ColorToken, SpacingKey } from "../../theme/types";
|
|
4
|
+
export type DividerOrientation = "horizontal" | "vertical";
|
|
5
|
+
export type DividerLabelAlign = "start" | "center" | "end";
|
|
6
|
+
/** `number | 'hairline'`, mirroring `Box`'s `borderWidth`. */
|
|
7
|
+
export type DividerThickness = number | "hairline";
|
|
8
|
+
export interface DividerProps extends ViewProps {
|
|
9
|
+
/** Rule direction. Defaults to `'horizontal'`. */
|
|
10
|
+
orientation?: DividerOrientation;
|
|
11
|
+
/** Rule color. Defaults to `'border.default'`. */
|
|
12
|
+
color?: ColorToken;
|
|
13
|
+
/**
|
|
14
|
+
* Rule weight. `'hairline'` is the thinnest line the display can draw —
|
|
15
|
+
* a true 1px rule at any density. Defaults to `'hairline'`.
|
|
16
|
+
*/
|
|
17
|
+
thickness?: DividerThickness;
|
|
18
|
+
/**
|
|
19
|
+
* Symmetric margin on the cross axis — above and below a horizontal rule,
|
|
20
|
+
* either side of a vertical one. Defaults to `undefined` (no margin).
|
|
21
|
+
*/
|
|
22
|
+
spacing?: SpacingKey;
|
|
23
|
+
/**
|
|
24
|
+
* Where the label sits along the rule. Ignored without `children`.
|
|
25
|
+
* Defaults to `'center'`.
|
|
26
|
+
*/
|
|
27
|
+
labelAlign?: DividerLabelAlign;
|
|
28
|
+
/**
|
|
29
|
+
* An optional label, drawn with the rule running either side of it. Strings
|
|
30
|
+
* and numbers are wrapped in `Text` automatically. Horizontal only — a
|
|
31
|
+
* vertical divider ignores children.
|
|
32
|
+
*/
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A rule that separates content.
|
|
37
|
+
*
|
|
38
|
+
* Decorative by default — screen readers skip it, because the separation it
|
|
39
|
+
* expresses is already carried by the content either side. A labelled divider
|
|
40
|
+
* keeps its label readable.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* <Divider />
|
|
44
|
+
* <Divider spacing="4" />
|
|
45
|
+
* <Divider orientation="vertical" />
|
|
46
|
+
* <Divider>OR</Divider>
|
|
47
|
+
*/
|
|
48
|
+
export declare const Divider: import("react").ForwardRefExoticComponent<DividerProps & import("react").RefAttributes<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>>;
|
|
49
|
+
//# sourceMappingURL=Divider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../../../../src/components/divider/Divider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIhF,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI3D,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAC;AAC3D,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE3D,8DAA8D;AAC9D,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,UAAU,CAAC;AAEnD,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,kDAAkD;IAClD,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,kDAAkD;IAClD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AA0BD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,0LAgElB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/divider/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,GACjB,MAAM,cAAW,CAAC;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAW,CAAC"}
|
|
@@ -2,12 +2,14 @@ export * from "./avatar/index.js";
|
|
|
2
2
|
export * from "./box/index.js";
|
|
3
3
|
export * from "./button/index.js";
|
|
4
4
|
export * from "./chip/index.js";
|
|
5
|
+
export * from "./divider/index.js";
|
|
5
6
|
export * from "./empty-state/index.js";
|
|
6
7
|
export * from "./header/index.js";
|
|
7
8
|
export * from "./icon/index.js";
|
|
8
9
|
export * from "./image/index.js";
|
|
9
10
|
export * from "./page-indicator/index.js";
|
|
10
11
|
export * from "./portal/index.js";
|
|
12
|
+
export * from "./pressable/index.js";
|
|
11
13
|
export * from "./screen/index.js";
|
|
12
14
|
export * from "./slot/index.js";
|
|
13
15
|
export * from "./spinner/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAU,CAAC;AACzB,cAAc,gBAAO,CAAC;AACtB,cAAc,mBAAU,CAAC;AACzB,cAAc,iBAAQ,CAAC;AACvB,cAAc,wBAAe,CAAC;AAC9B,cAAc,mBAAU,CAAC;AACzB,cAAc,iBAAQ,CAAC;AACvB,cAAc,kBAAS,CAAC;AACxB,cAAc,2BAAkB,CAAC;AACjC,cAAc,mBAAU,CAAC;AACzB,cAAc,mBAAU,CAAC;AACzB,cAAc,iBAAQ,CAAC;AACvB,cAAc,oBAAW,CAAC;AAC1B,cAAc,oBAAW,CAAC;AAC1B,cAAc,iBAAQ,CAAC;AACvB,cAAc,kBAAS,CAAC;AACxB,cAAc,oBAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAU,CAAC;AACzB,cAAc,gBAAO,CAAC;AACtB,cAAc,mBAAU,CAAC;AACzB,cAAc,iBAAQ,CAAC;AACvB,cAAc,oBAAW,CAAC;AAC1B,cAAc,wBAAe,CAAC;AAC9B,cAAc,mBAAU,CAAC;AACzB,cAAc,iBAAQ,CAAC;AACvB,cAAc,kBAAS,CAAC;AACxB,cAAc,2BAAkB,CAAC;AACjC,cAAc,mBAAU,CAAC;AACzB,cAAc,sBAAa,CAAC;AAC5B,cAAc,mBAAU,CAAC;AACzB,cAAc,iBAAQ,CAAC;AACvB,cAAc,oBAAW,CAAC;AAC1B,cAAc,oBAAW,CAAC;AAC1B,cAAc,iBAAQ,CAAC;AACvB,cAAc,kBAAS,CAAC;AACxB,cAAc,oBAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/pressable/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,6BAA6B,EAC7B,mBAAmB,GACpB,MAAM,oCAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAA2B,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { PressableProps, PressableStateCallbackType, StyleProp, ViewStyle } from "react-native";
|
|
2
|
+
import { type WithSpringConfig, type WithTimingConfig } from "react-native-reanimated";
|
|
3
|
+
export type PressableScaleAnimationConfig = {
|
|
4
|
+
type: "timing";
|
|
5
|
+
config?: WithTimingConfig;
|
|
6
|
+
} | {
|
|
7
|
+
type: "spring";
|
|
8
|
+
config?: WithSpringConfig;
|
|
9
|
+
};
|
|
10
|
+
export interface PressableScaleProps extends Omit<PressableProps, "style" | "disabled"> {
|
|
11
|
+
/** Scale held at rest. Defaults to `1`. */
|
|
12
|
+
baseScale?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Scale held while pressed. Values below `baseScale` shrink, above it grow.
|
|
15
|
+
* Defaults to `0.96`.
|
|
16
|
+
*/
|
|
17
|
+
minScale?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Opacity held while pressed, animated on the same curve as the scale.
|
|
20
|
+
* Defaults to `undefined` — opacity is left untouched so `style` keeps
|
|
21
|
+
* ownership of it.
|
|
22
|
+
*/
|
|
23
|
+
pressedOpacity?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Drives the press animation. Defaults to `{ type: 'timing' }` with a 250ms
|
|
26
|
+
* ease; pass `{ type: 'spring' }` for a springy release.
|
|
27
|
+
*/
|
|
28
|
+
animationConfig?: PressableScaleAnimationConfig;
|
|
29
|
+
/** Blocks presses and holds the resting scale. Defaults to `false`. */
|
|
30
|
+
isDisabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Styles for the pressable itself. The function form receives `pressed`
|
|
33
|
+
* only — `hovered` and `focused` are not tracked, because the animated
|
|
34
|
+
* style has to be merged outside of `Pressable`'s own callback.
|
|
35
|
+
*/
|
|
36
|
+
style?: StyleProp<ViewStyle> | ((state: PressableStateCallbackType) => StyleProp<ViewStyle>);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A `Pressable` that animates a scale (and optionally an opacity) between its
|
|
40
|
+
* resting and pressed states, driven by a single shared `progress` value on the
|
|
41
|
+
* UI thread.
|
|
42
|
+
*
|
|
43
|
+
* Use it anywhere a press deserves physical feedback — cards, list rows, custom
|
|
44
|
+
* controls. `Button` renders one internally via its `animation` prop.
|
|
45
|
+
*/
|
|
46
|
+
export declare const PressableScale: import("react").ForwardRefExoticComponent<PressableScaleProps & import("react").RefAttributes<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>>;
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/pressable/variants/PressableScale/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,cAAc,EACd,0BAA0B,EAC1B,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAGtB,OAAiB,EAKf,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAGtB,MAAM,yBAAyB,CAAC;AAWjC,MAAM,MAAM,6BAA6B,GACrC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAElD,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,UAAU,CAAC;IACrF,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,6BAA6B,CAAC;IAChD,uEAAuE;IACvE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,0BAA0B,KAAK,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;CAC9F;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,iMAsF1B,CAAC"}
|
|
@@ -20,13 +20,13 @@ export interface UseThemeResult {
|
|
|
20
20
|
scheme: Scheme;
|
|
21
21
|
/** Pin a scheme (stops following the system). Same as `setMode(scheme)`. */
|
|
22
22
|
setScheme: (scheme: Scheme) => void;
|
|
23
|
-
/** Applied
|
|
24
|
-
|
|
23
|
+
/** Applied theme name, or `undefined` for the base themes. */
|
|
24
|
+
themeName: string | undefined;
|
|
25
25
|
/**
|
|
26
|
-
* Apply a registered
|
|
27
|
-
* name warns in development and leaves the
|
|
26
|
+
* Apply a registered theme; `null` restores the base themes. An unknown
|
|
27
|
+
* name warns in development and leaves the theme unchanged.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
setTheme: (name: string | null) => void;
|
|
30
30
|
/**
|
|
31
31
|
* How the active scheme is chosen: `system` follows the OS appearance,
|
|
32
32
|
* `light` / `dark` pin a scheme. A system appearance change updates
|
|
@@ -37,8 +37,8 @@ export interface UseThemeResult {
|
|
|
37
37
|
setMode: (mode: ThemeMode) => void;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* Access the active theme and switch scheme / mode /
|
|
41
|
-
* comes from the runtime store, so changes made imperatively (`
|
|
40
|
+
* Access the active theme and switch scheme / mode / theme. Selection state
|
|
41
|
+
* comes from the runtime store, so changes made imperatively (`setTheme`,
|
|
42
42
|
* `setThemeMode`) and through this hook are observed by every consumer.
|
|
43
43
|
*/
|
|
44
44
|
export declare function useTheme(): UseThemeResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/context/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,OAAO,CAAC;AAarE,OAAO,EAAE,KAAK,qBAAqB,EAAwB,MAAM,4BAAyB,CAAC;AAC3F,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAgB,CAAC;AAOpE;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,iBAAiB,gCAE9D,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,KAAK,EAAE,UAAU,CAAC;IAClB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/context/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,OAAO,CAAC;AAarE,OAAO,EAAE,KAAK,qBAAqB,EAAwB,MAAM,4BAAyB,CAAC;AAC3F,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAgB,CAAC;AAOpE;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,iBAAiB,gCAE9D,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,KAAK,EAAE,UAAU,CAAC;IAClB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,8DAA8D;IAC9D,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,IAAI,EAAE,SAAS,CAAC;IAChB,+EAA+E;IAC/E,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACpC;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,IAAI,cAAc,CAazC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAGxD;AAED,wCAAwC;AACxC,eAAO,MAAM,eAAe,yBAAmB,CAAC"}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import type { TerraConfig } from "./types.js";
|
|
2
|
-
/** The literal
|
|
3
|
-
type
|
|
4
|
-
|
|
2
|
+
/** The literal theme names declared in `T.themes`, or `never` when none are declared. */
|
|
3
|
+
type DeclaredThemeNames<T> = T extends {
|
|
4
|
+
themes: infer A;
|
|
5
5
|
} ? A extends Record<string, unknown> ? keyof A & string : never : never;
|
|
6
6
|
/**
|
|
7
7
|
* Identity helper for authoring a {@link TerraConfig} with contextual typing.
|
|
8
|
-
* Has no side effects. With literal `
|
|
9
|
-
* them; a dynamic `Record<string,
|
|
8
|
+
* Has no side effects. With literal `themes`, `defaultTheme` must name one of
|
|
9
|
+
* them; a dynamic `Record<string, NamedTheme>` keeps `defaultTheme` as `string`
|
|
10
10
|
* and defers to runtime validation.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* const config = defineTerraConfig({
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* themes: { indigo: { light: "#4f46e5", dark: "#818cf8" } },
|
|
15
|
+
* defaultTheme: "indigo",
|
|
16
16
|
* });
|
|
17
17
|
* configureTerraUI(config);
|
|
18
18
|
*/
|
|
19
19
|
export declare function defineTerraConfig<const T extends TerraConfig>(config: T & {
|
|
20
|
-
|
|
20
|
+
defaultTheme?: DeclaredThemeNames<T>;
|
|
21
|
+
schemes?: never;
|
|
22
|
+
accents?: never;
|
|
23
|
+
defaultAccent?: never;
|
|
21
24
|
}): T;
|
|
22
25
|
export {};
|
|
23
26
|
//# sourceMappingURL=define-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../../../../src/theme/define-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAS,CAAC;AAE3C,
|
|
1
|
+
{"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../../../../src/theme/define-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAS,CAAC;AAE3C,yFAAyF;AACzF,KAAK,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACtD,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,MAAM,CAAC,GAAG,MAAM,GAChB,KAAK,GACP,KAAK,CAAC;AAEV;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,CAAC,SAAS,WAAW,EAC3D,MAAM,EAAE,CAAC,GAAG;IACV,YAAY,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB,GACA,CAAC,CAEH"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Thrown for invalid pure configuration input — before any registry, selection,
|
|
3
3
|
* or native state is touched. `path` points at the offending config entry, e.g.
|
|
4
|
-
* `
|
|
4
|
+
* `themes.indigo.dark.seed` or `defaultTheme`.
|
|
5
5
|
*/
|
|
6
6
|
export declare class TerraConfigError extends Error {
|
|
7
7
|
readonly path: string;
|
|
@@ -10,14 +10,14 @@ export type { AppBreakpoints, BreakpointName } from "./breakpoints.js";
|
|
|
10
10
|
export { breakpoints, resolveBreakpointValue } from "./breakpoints.js";
|
|
11
11
|
export { defineTerraConfig } from "./define-config.js";
|
|
12
12
|
export { TerraConfigError } from "./errors.js";
|
|
13
|
-
export { configureTerraUI,
|
|
13
|
+
export { configureTerraUI, getDefaultRadius, getIcon, getImageComponent, getIsConfigured, getRequiredIcon, getSurfaceElevation, getThemeNames, resolveTheme, } from "./registry.js";
|
|
14
14
|
export { createTerraThemes } from "./resolve-config.js";
|
|
15
15
|
export type { ThemeSelection } from "./runtime.js";
|
|
16
|
-
export {
|
|
16
|
+
export { applyScheme, getCurrentTheme, getThemeMode, getThemeSelection, setTheme, setThemeMode, } from "./runtime.js";
|
|
17
17
|
export type { ResolvedScreenMargin } from "./screen-margin.js";
|
|
18
18
|
export { resolveScreenMargin } from "./screen-margin.js";
|
|
19
19
|
export type { ResolvedScreenPadding } from "./screen-padding.js";
|
|
20
20
|
export { resolveScreenPadding } from "./screen-padding.js";
|
|
21
21
|
export { defaultDarkTheme, defaultLightTheme } from "./theme.js";
|
|
22
|
-
export type {
|
|
22
|
+
export type { AccentColorToken, ActionColorToken, BackgroundColorToken, BorderColorToken, ButtonDefaults, CanonicalThemeColor, ColorToken, ComponentDefaults, ContentColorToken, CreateTerraThemesOptions, DefaultRadiusToken, ElevationKey, ElevationScale, ElevationStyle, FontWeightToken, LayoutTokens, NamedTheme, NeutralColorToken, OpacityTokens, RadiusComponent, RadiusKey, Scheme, ScreenPaddingTokens, SpacingKey, StatusColorToken, SurfaceColorToken, SurfaceDefaults, TerraColorRegistry, TerraColorRegistryCollision, TerraConfig, TerraCustomColorName, TerraIconComponent, TerraIconName, TerraIconProps, TerraImageComponent, TerraImageContentFit, TerraImageProps, TerraSemanticIconName, TerraTheme, TerraThemeInput, TerraThemeOverride, TextColorToken, TextVariant, ThemeColor, ThemeMode, ThemeRadiusOverride, ThemeSchemeInput, ThemeSeed, ThemeSpacingOverride, TypeStyle, Typography, } from "./types.js";
|
|
23
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/index.ts"],"names":[],"mappings":"AAQA,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAe,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,kBAAe,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAU,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/index.ts"],"names":[],"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AM,oBAAiB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAkB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAkB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAS,CAAC;AAE9D,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,SAAS,EACT,MAAM,EACN,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,2BAA2B,EAC3B,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,UAAU,GACX,MAAM,YAAS,CAAC"}
|
|
@@ -6,8 +6,8 @@ declare module "react-native-unistyles" {
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
export declare const getIsConfigured: () => boolean;
|
|
9
|
-
/** Names of the registered
|
|
10
|
-
export declare const
|
|
9
|
+
/** Names of the registered themes, in declaration order. Returns a fresh array. */
|
|
10
|
+
export declare const getThemeNames: () => string[];
|
|
11
11
|
export declare const getImageComponent: () => TerraImageComponent;
|
|
12
12
|
export declare const getIcon: (name: string) => TerraIconComponent | undefined;
|
|
13
13
|
export declare const getRequiredIcon: (name: TerraSemanticIconName) => TerraIconComponent;
|
|
@@ -23,12 +23,12 @@ export declare const getDefaultRadius: (component: RadiusComponent) => DefaultRa
|
|
|
23
23
|
export declare const getSurfaceElevation: () => ElevationKey;
|
|
24
24
|
/**
|
|
25
25
|
* Resolves one scheme's theme from the installed configuration with the named
|
|
26
|
-
*
|
|
27
|
-
* not the configured `
|
|
26
|
+
* theme selected. Omitting `name` selects the base theme (defaults + shared —
|
|
27
|
+
* not the configured `defaultTheme`). An unknown name warns in development
|
|
28
28
|
* and falls back to the base theme. Pure with respect to runtime state: it
|
|
29
29
|
* never changes the applied selection.
|
|
30
30
|
*/
|
|
31
|
-
export declare function resolveTheme(scheme: Scheme,
|
|
31
|
+
export declare function resolveTheme(scheme: Scheme, name?: string): TerraTheme;
|
|
32
32
|
/**
|
|
33
33
|
* Configure Terra UI's themes. Call ONCE, as early as possible — before any
|
|
34
34
|
* component renders (e.g. top of the app entry, imported from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/theme/registry.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAEV,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,MAAM,EACN,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,UAAU,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/theme/registry.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAEV,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,MAAM,EACN,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,UAAU,EAEX,MAAM,YAAS,CAAC;AAmBjB,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAiB,eAAe;QAC9B,KAAK,EAAE,UAAU,CAAC;QAClB,IAAI,EAAE,UAAU,CAAC;KAClB;CACF;AA8BD,eAAO,MAAM,eAAe,QAAO,OAA0C,CAAC;AAE9E,mFAAmF;AACnF,eAAO,MAAM,aAAa,QAAO,MAAM,EAA0C,CAAC;AAElF,eAAO,MAAM,iBAAiB,QAAO,mBAA8C,CAAC;AAEpF,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,kBAAkB,GAAG,SACS,CAAC;AAEtE,eAAO,MAAM,eAAe,GAAI,MAAM,qBAAqB,KAAG,kBAClB,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,WAAW,eAAe,KAAG,kBAC3B,CAAC;AAEpC;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAO,YAAyC,CAAC;AAEjF;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAWtE;AAID;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,WAAgB,GAAG,IAAI,CAW/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAMvC"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pure theme resolution — normalization, layer processing, derived values and
|
|
3
|
-
* theme creation. Shared by startup configuration, runtime
|
|
3
|
+
* theme creation. Shared by startup configuration, runtime theme changes and
|
|
4
4
|
* previews so every consumer sees the same colors for the same input.
|
|
5
5
|
*
|
|
6
6
|
* Precedence, identical for both schemes:
|
|
7
7
|
*
|
|
8
|
-
* default tokens → shared →
|
|
9
|
-
*
|
|
8
|
+
* default tokens → shared → generated accent → selected theme tokens
|
|
9
|
+
* Generation uses the selected theme's resolved surfaces and pressed opacity.
|
|
10
10
|
*
|
|
11
11
|
* This module must stay free of registry, provider, Unistyles and renderer
|
|
12
12
|
* imports so `createTerraThemes` works without any native configuration.
|
|
13
13
|
*/
|
|
14
14
|
import { type ContrastDiagnostic } from "../utils/accent-generator";
|
|
15
15
|
import { type ThemeSource } from "./theme.js";
|
|
16
|
-
import type {
|
|
16
|
+
import type { CreateTerraThemesOptions, ElevationKey, Scheme, TerraTheme, TerraThemeInput, TerraThemeOverride, ThemeSchemeInput } from "./types.js";
|
|
17
17
|
/**
|
|
18
18
|
* A theme mid-resolution: its source form plus provenance for every elevation
|
|
19
19
|
* level whose `shadowColor` a layer pinned explicitly. Default shadow colors are
|
|
@@ -25,8 +25,8 @@ export interface ThemeLayerState {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Applies one override layer onto `state` and returns the next state. Every
|
|
28
|
-
* layer — shared,
|
|
29
|
-
*
|
|
28
|
+
* layer — shared, generated accent, or selected theme tokens — goes through
|
|
29
|
+
* here, so they all follow the same rules:
|
|
30
30
|
* - deprecated names are normalized within the layer (canonical wins);
|
|
31
31
|
* - `undefined`/`null` leaves are no override; arrays replace; objects merge;
|
|
32
32
|
* - `spacing.base` / `radius.base` regenerate their scale, then that layer's
|
|
@@ -36,37 +36,37 @@ export interface ThemeLayerState {
|
|
|
36
36
|
* Inputs are never mutated.
|
|
37
37
|
*/
|
|
38
38
|
export declare function applyThemeLayer(state: ThemeLayerState, override?: TerraThemeOverride): ThemeLayerState;
|
|
39
|
-
export type
|
|
39
|
+
export type NormalizedThemeScheme = {
|
|
40
40
|
readonly kind: "none";
|
|
41
41
|
} | {
|
|
42
42
|
readonly kind: "seed";
|
|
43
43
|
readonly seed: string;
|
|
44
|
-
readonly
|
|
44
|
+
readonly patch?: TerraThemeOverride;
|
|
45
45
|
} | {
|
|
46
46
|
readonly kind: "patch";
|
|
47
47
|
readonly patch: TerraThemeOverride;
|
|
48
48
|
};
|
|
49
|
-
interface
|
|
50
|
-
readonly light:
|
|
51
|
-
readonly dark:
|
|
49
|
+
interface NormalizedThemeEntry {
|
|
50
|
+
readonly light: NormalizedThemeScheme;
|
|
51
|
+
readonly dark: NormalizedThemeScheme;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* A validated, immutable theme configuration. `base` is the fully layered
|
|
55
|
-
* `defaults → shared
|
|
56
|
-
* re-resolved from it rather than from a previously resolved
|
|
55
|
+
* `defaults → shared` state per scheme; every theme selection is
|
|
56
|
+
* re-resolved from it rather than from a previously resolved theme.
|
|
57
57
|
*/
|
|
58
58
|
export interface NormalizedThemeConfig {
|
|
59
|
-
readonly
|
|
60
|
-
readonly
|
|
61
|
-
/** @internal Immutable `defaults → shared
|
|
59
|
+
readonly themeNames: readonly string[];
|
|
60
|
+
readonly defaultTheme: string | null;
|
|
61
|
+
/** @internal Immutable `defaults → shared` state per scheme. */
|
|
62
62
|
readonly base: Readonly<Record<Scheme, ThemeLayerState>>;
|
|
63
|
-
/** @internal Per-
|
|
64
|
-
readonly
|
|
63
|
+
/** @internal Per-theme, per-scheme normalized inputs. */
|
|
64
|
+
readonly themes: Readonly<Record<string, NormalizedThemeEntry>>;
|
|
65
65
|
}
|
|
66
|
-
export declare function
|
|
66
|
+
export declare function normalizeThemeScheme(input: ThemeSchemeInput | undefined, path: string): NormalizedThemeScheme;
|
|
67
67
|
/**
|
|
68
68
|
* Validates a theme input and pre-computes the immutable per-scheme base
|
|
69
|
-
* (`defaults → shared
|
|
69
|
+
* (`defaults → shared`). Throws {@link TerraConfigError} for invalid
|
|
70
70
|
* input — before any state exists to mutate. Never mutates `input` or the
|
|
71
71
|
* exported defaults.
|
|
72
72
|
*/
|
|
@@ -77,20 +77,20 @@ export interface ResolvedThemes {
|
|
|
77
77
|
diagnostics: ContrastDiagnostic[];
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
|
-
* Resolves both schemes for `
|
|
80
|
+
* Resolves both schemes for `themeName` from the config's immutable base. `null`
|
|
81
81
|
* selects the base themes; an unknown name throws {@link TerraConfigError}.
|
|
82
82
|
* Returned themes are freshly built and independently owned.
|
|
83
83
|
*/
|
|
84
|
-
export declare function resolveThemes(config: NormalizedThemeConfig,
|
|
84
|
+
export declare function resolveThemes(config: NormalizedThemeConfig, themeName: string | null): ResolvedThemes;
|
|
85
85
|
/** Resolves one scheme without generating and finalizing the other. */
|
|
86
|
-
export declare function resolveThemeScheme(config: NormalizedThemeConfig, scheme: Scheme,
|
|
86
|
+
export declare function resolveThemeScheme(config: NormalizedThemeConfig, scheme: Scheme, themeName: string | null): {
|
|
87
87
|
theme: TerraTheme;
|
|
88
88
|
diagnostics: ContrastDiagnostic[];
|
|
89
89
|
};
|
|
90
90
|
/**
|
|
91
91
|
* Pure theme creation — no Unistyles configuration or registry involved.
|
|
92
|
-
* `options.
|
|
93
|
-
* themes. Invalid input and unknown
|
|
92
|
+
* `options.theme` omitted → the input's `defaultTheme`; `null` → the base
|
|
93
|
+
* themes. Invalid input and unknown themes throw {@link TerraConfigError}.
|
|
94
94
|
* In development, contrast diagnostics are reported once each via
|
|
95
95
|
* `console.warn`; requested colors are never altered.
|
|
96
96
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-config.d.ts","sourceRoot":"","sources":["../../../../src/theme/resolve-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAGL,KAAK,kBAAkB,EAMxB,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,YAAS,CAAC;AACjB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"resolve-config.d.ts","sourceRoot":"","sources":["../../../../src/theme/resolve-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAGL,KAAK,kBAAkB,EAMxB,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,YAAS,CAAC;AACjB,OAAO,KAAK,EACV,wBAAwB,EACxB,YAAY,EAEZ,MAAM,EACN,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,YAAS,CAAC;AAajB;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,kBAAkB,EAAE,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tF;AAID,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnC,yFAAyF;IACzF,WAAW,EAAE,kBAAkB,EAAE,CAAC;CACnC;AA8DD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,cAAc,CAYrG;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAAG,IAAI,GACvB;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,kBAAkB,EAAE,CAAA;CAAE,CAG1D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,CAAC,EAAE,eAAe,EACvB,OAAO,CAAC,EAAE,wBAAwB,GACjC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAQ5B"}
|
|
@@ -2,16 +2,16 @@ import type { Scheme, ThemeMode } from "./types.js";
|
|
|
2
2
|
export type { ThemeSelection } from "./selection-store.js";
|
|
3
3
|
export { getThemeSelection, subscribeThemeSelection } from "./selection-store.js";
|
|
4
4
|
/**
|
|
5
|
-
* Apply a registered
|
|
5
|
+
* Apply a registered theme (`null` restores the base themes) by updating both
|
|
6
6
|
* registered themes. An unknown name warns in development and changes nothing.
|
|
7
7
|
*
|
|
8
8
|
* If the native update fails part-way (see `updateThemes` in the adapter), the
|
|
9
9
|
* error propagates and the previous selection stays published; calling
|
|
10
|
-
* `
|
|
10
|
+
* `setTheme(getCurrentTheme() ?? null)` rewrites both themes.
|
|
11
11
|
*/
|
|
12
|
-
export declare function
|
|
13
|
-
/** The applied
|
|
14
|
-
export declare const
|
|
12
|
+
export declare function setTheme(name: string | null): void;
|
|
13
|
+
/** The applied theme name, or `undefined` for the base themes. */
|
|
14
|
+
export declare const getCurrentTheme: () => string | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* Choose how the active scheme is selected: `system` follows the OS appearance;
|
|
17
17
|
* `light` / `dark` pin a scheme until the next call.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/theme/runtime.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAAS,CAAC;AAGjD,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAmB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,sBAAmB,CAAC;AAE/E;;;;;;;GAOG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/theme/runtime.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAAS,CAAC;AAGjD,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAmB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,sBAAmB,CAAC;AAE/E;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAalD;AAED,kEAAkE;AAClE,eAAO,MAAM,eAAe,QAAO,MAAM,GAAG,SAA0C,CAAC;AAEvF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAGlD;AAED,6EAA6E;AAC7E,eAAO,MAAM,YAAY,QAAO,SAAqC,CAAC;AAEtE;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEhD"}
|