react-native-terra-ui 0.7.2 → 0.8.1

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.
Files changed (252) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +1 -1
  3. package/lib/module/components/avatar/Avatar.js +20 -20
  4. package/lib/module/components/avatar/Avatar.js.map +1 -1
  5. package/lib/module/components/button/Button.js +11 -11
  6. package/lib/module/components/button/Button.js.map +1 -1
  7. package/lib/module/components/chip/Chip.js +32 -32
  8. package/lib/module/components/chip/Chip.js.map +1 -1
  9. package/lib/module/components/empty-state/EmptyState.js +3 -3
  10. package/lib/module/components/empty-state/EmptyState.js.map +1 -1
  11. package/lib/module/components/header/variants/LargeTitleHeader/index.js +30 -32
  12. package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
  13. package/lib/module/components/header/variants/TitleHeader/index.js +26 -18
  14. package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -1
  15. package/lib/module/components/icon/Icon.js +3 -3
  16. package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js +2 -2
  17. package/lib/module/components/screen/Screen.js +63 -34
  18. package/lib/module/components/screen/Screen.js.map +1 -1
  19. package/lib/module/components/screen/ScreenContext.js +28 -9
  20. package/lib/module/components/screen/ScreenContext.js.map +1 -1
  21. package/lib/module/components/screen/ScreenFlatList.js +4 -162
  22. package/lib/module/components/screen/ScreenFlatList.js.map +1 -1
  23. package/lib/module/components/screen/ScreenList.js +81 -97
  24. package/lib/module/components/screen/ScreenList.js.map +1 -1
  25. package/lib/module/components/screen/ScreenScrollView.js +64 -115
  26. package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
  27. package/lib/module/components/screen/hooks/use-screen-ref.js +18 -0
  28. package/lib/module/components/screen/hooks/use-screen-ref.js.map +1 -0
  29. package/lib/module/components/screen/hooks/use-screen-scroll-handler.js +19 -0
  30. package/lib/module/components/screen/hooks/use-screen-scroll-handler.js.map +1 -0
  31. package/lib/module/components/screen/index.js.map +1 -1
  32. package/lib/module/components/screen/parts/ScreenFrame.js +47 -0
  33. package/lib/module/components/screen/parts/ScreenFrame.js.map +1 -0
  34. package/lib/module/components/screen/parts/ScreenHeaderAppearance.js +43 -0
  35. package/lib/module/components/screen/parts/ScreenHeaderAppearance.js.map +1 -0
  36. package/lib/module/components/screen/parts/ScreenPlaceholder.js +11 -13
  37. package/lib/module/components/screen/parts/ScreenPlaceholder.js.map +1 -1
  38. package/lib/module/components/screen/parts/ScreenSafeArea.android.js +27 -0
  39. package/lib/module/components/screen/parts/ScreenSafeArea.android.js.map +1 -0
  40. package/lib/module/components/screen/parts/ScreenSafeArea.js +26 -0
  41. package/lib/module/components/screen/parts/ScreenSafeArea.js.map +1 -0
  42. package/lib/module/components/screen/utils.js +18 -9
  43. package/lib/module/components/screen/utils.js.map +1 -1
  44. package/lib/module/components/spinner/Spinner.js +2 -2
  45. package/lib/module/components/text/Text.js +1 -1
  46. package/lib/module/components/toast/Toast.js +13 -13
  47. package/lib/module/components/toast/Toast.js.map +1 -1
  48. package/lib/module/components/toolbar/Toolbar.js +2 -2
  49. package/lib/module/context/ThemeProvider.js +22 -39
  50. package/lib/module/context/ThemeProvider.js.map +1 -1
  51. package/lib/module/context/index.js +1 -1
  52. package/lib/module/context/index.js.map +1 -1
  53. package/lib/module/theme/breakpoints.js +1 -1
  54. package/lib/module/theme/define-config.js +21 -0
  55. package/lib/module/theme/define-config.js.map +1 -0
  56. package/lib/module/theme/diagnostics.js +13 -0
  57. package/lib/module/theme/diagnostics.js.map +1 -0
  58. package/lib/module/theme/errors.js +15 -0
  59. package/lib/module/theme/errors.js.map +1 -0
  60. package/lib/module/theme/index.js +7 -1
  61. package/lib/module/theme/index.js.map +1 -1
  62. package/lib/module/theme/legacy-tokens.js +119 -0
  63. package/lib/module/theme/legacy-tokens.js.map +1 -0
  64. package/lib/module/theme/registry.js +122 -130
  65. package/lib/module/theme/registry.js.map +1 -1
  66. package/lib/module/theme/resolve-config.js +346 -0
  67. package/lib/module/theme/resolve-config.js.map +1 -0
  68. package/lib/module/theme/runtime.js +57 -12
  69. package/lib/module/theme/runtime.js.map +1 -1
  70. package/lib/module/theme/screen-margin.js +6 -14
  71. package/lib/module/theme/screen-margin.js.map +1 -1
  72. package/lib/module/theme/screen-padding.js +17 -0
  73. package/lib/module/theme/screen-padding.js.map +1 -0
  74. package/lib/module/theme/selection-store.js +75 -0
  75. package/lib/module/theme/selection-store.js.map +1 -0
  76. package/lib/module/theme/theme.js +81 -36
  77. package/lib/module/theme/theme.js.map +1 -1
  78. package/lib/module/theme/tokens/canonical-color-keys.js +102 -0
  79. package/lib/module/theme/tokens/canonical-color-keys.js.map +1 -0
  80. package/lib/module/theme/tokens/dark.js +72 -88
  81. package/lib/module/theme/tokens/dark.js.map +1 -1
  82. package/lib/module/theme/tokens/light.js +69 -83
  83. package/lib/module/theme/tokens/light.js.map +1 -1
  84. package/lib/module/theme/tokens/primitives.js +14 -14
  85. package/lib/module/theme/tokens/primitives.js.map +1 -1
  86. package/lib/module/theme/tokens/validate.js +238 -0
  87. package/lib/module/theme/tokens/validate.js.map +1 -0
  88. package/lib/module/theme/unistyles-adapter.js +77 -0
  89. package/lib/module/theme/unistyles-adapter.js.map +1 -0
  90. package/lib/module/utils/accent-generator.js +476 -0
  91. package/lib/module/utils/accent-generator.js.map +1 -0
  92. package/lib/module/utils/accent-utils.js +52 -35
  93. package/lib/module/utils/accent-utils.js.map +1 -1
  94. package/lib/module/utils/color-utils.js +224 -7
  95. package/lib/module/utils/color-utils.js.map +1 -1
  96. package/lib/module/utils/deep-merge.js +1 -1
  97. package/lib/module/utils/deep-merge.js.map +1 -1
  98. package/lib/module/utils/resolve-theme-color.js +2 -2
  99. package/lib/typescript/src/components/chip/types.d.ts +1 -1
  100. package/lib/typescript/src/components/empty-state/EmptyState.d.ts +1 -1
  101. package/lib/typescript/src/components/empty-state/EmptyState.d.ts.map +1 -1
  102. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts +6 -5
  103. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts.map +1 -1
  104. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts +11 -5
  105. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -1
  106. package/lib/typescript/src/components/icon/Icon.d.ts +2 -2
  107. package/lib/typescript/src/components/screen/Screen.d.ts +45 -16
  108. package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -1
  109. package/lib/typescript/src/components/screen/ScreenContext.d.ts +42 -26
  110. package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -1
  111. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts +5 -46
  112. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -1
  113. package/lib/typescript/src/components/screen/ScreenList.d.ts +62 -50
  114. package/lib/typescript/src/components/screen/ScreenList.d.ts.map +1 -1
  115. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts +18 -58
  116. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
  117. package/lib/typescript/src/components/screen/hooks/use-screen-ref.d.ts +5 -0
  118. package/lib/typescript/src/components/screen/hooks/use-screen-ref.d.ts.map +1 -0
  119. package/lib/typescript/src/components/screen/hooks/use-screen-scroll-handler.d.ts +53 -0
  120. package/lib/typescript/src/components/screen/hooks/use-screen-scroll-handler.d.ts.map +1 -0
  121. package/lib/typescript/src/components/screen/index.d.ts +2 -2
  122. package/lib/typescript/src/components/screen/index.d.ts.map +1 -1
  123. package/lib/typescript/src/components/screen/parts/ScreenFrame.d.ts +6 -0
  124. package/lib/typescript/src/components/screen/parts/ScreenFrame.d.ts.map +1 -0
  125. package/lib/typescript/src/components/screen/parts/ScreenHeaderAppearance.d.ts +21 -0
  126. package/lib/typescript/src/components/screen/parts/ScreenHeaderAppearance.d.ts.map +1 -0
  127. package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts +6 -8
  128. package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts.map +1 -1
  129. package/lib/typescript/src/components/screen/parts/ScreenSafeArea.android.d.ts +7 -0
  130. package/lib/typescript/src/components/screen/parts/ScreenSafeArea.android.d.ts.map +1 -0
  131. package/lib/typescript/src/components/screen/parts/ScreenSafeArea.d.ts +6 -0
  132. package/lib/typescript/src/components/screen/parts/ScreenSafeArea.d.ts.map +1 -0
  133. package/lib/typescript/src/components/screen/types.d.ts +27 -32
  134. package/lib/typescript/src/components/screen/types.d.ts.map +1 -1
  135. package/lib/typescript/src/components/screen/utils.d.ts +9 -8
  136. package/lib/typescript/src/components/screen/utils.d.ts.map +1 -1
  137. package/lib/typescript/src/components/text/Text.d.ts +1 -1
  138. package/lib/typescript/src/components/text/Text.d.ts.map +1 -1
  139. package/lib/typescript/src/components/toolbar/Toolbar.d.ts +2 -2
  140. package/lib/typescript/src/context/ThemeProvider.d.ts +29 -12
  141. package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
  142. package/lib/typescript/src/context/index.d.ts +1 -1
  143. package/lib/typescript/src/context/index.d.ts.map +1 -1
  144. package/lib/typescript/src/theme/breakpoints.d.ts +1 -1
  145. package/lib/typescript/src/theme/define-config.d.ts +23 -0
  146. package/lib/typescript/src/theme/define-config.d.ts.map +1 -0
  147. package/lib/typescript/src/theme/diagnostics.d.ts +4 -0
  148. package/lib/typescript/src/theme/diagnostics.d.ts.map +1 -0
  149. package/lib/typescript/src/theme/errors.d.ts +10 -0
  150. package/lib/typescript/src/theme/errors.d.ts.map +1 -0
  151. package/lib/typescript/src/theme/index.d.ts +10 -2
  152. package/lib/typescript/src/theme/index.d.ts.map +1 -1
  153. package/lib/typescript/src/theme/legacy-tokens.d.ts +187 -0
  154. package/lib/typescript/src/theme/legacy-tokens.d.ts.map +1 -0
  155. package/lib/typescript/src/theme/registry.d.ts +12 -17
  156. package/lib/typescript/src/theme/registry.d.ts.map +1 -1
  157. package/lib/typescript/src/theme/resolve-config.d.ts +99 -0
  158. package/lib/typescript/src/theme/resolve-config.d.ts.map +1 -0
  159. package/lib/typescript/src/theme/runtime.d.ts +25 -4
  160. package/lib/typescript/src/theme/runtime.d.ts.map +1 -1
  161. package/lib/typescript/src/theme/screen-margin.d.ts +6 -14
  162. package/lib/typescript/src/theme/screen-margin.d.ts.map +1 -1
  163. package/lib/typescript/src/theme/screen-padding.d.ts +15 -0
  164. package/lib/typescript/src/theme/screen-padding.d.ts.map +1 -0
  165. package/lib/typescript/src/theme/selection-store.d.ts +41 -0
  166. package/lib/typescript/src/theme/selection-store.d.ts.map +1 -0
  167. package/lib/typescript/src/theme/theme.d.ts +54 -1
  168. package/lib/typescript/src/theme/theme.d.ts.map +1 -1
  169. package/lib/typescript/src/theme/tokens/canonical-color-keys.d.ts +95 -0
  170. package/lib/typescript/src/theme/tokens/canonical-color-keys.d.ts.map +1 -0
  171. package/lib/typescript/src/theme/tokens/dark.d.ts +56 -63
  172. package/lib/typescript/src/theme/tokens/dark.d.ts.map +1 -1
  173. package/lib/typescript/src/theme/tokens/light.d.ts +56 -71
  174. package/lib/typescript/src/theme/tokens/light.d.ts.map +1 -1
  175. package/lib/typescript/src/theme/tokens/primitives.d.ts +11 -10
  176. package/lib/typescript/src/theme/tokens/primitives.d.ts.map +1 -1
  177. package/lib/typescript/src/theme/tokens/validate.d.ts +34 -0
  178. package/lib/typescript/src/theme/tokens/validate.d.ts.map +1 -0
  179. package/lib/typescript/src/theme/types.d.ts +166 -86
  180. package/lib/typescript/src/theme/types.d.ts.map +1 -1
  181. package/lib/typescript/src/theme/unistyles-adapter.d.ts +33 -0
  182. package/lib/typescript/src/theme/unistyles-adapter.d.ts.map +1 -0
  183. package/lib/typescript/src/utils/accent-generator.d.ts +103 -0
  184. package/lib/typescript/src/utils/accent-generator.d.ts.map +1 -0
  185. package/lib/typescript/src/utils/accent-utils.d.ts +15 -2
  186. package/lib/typescript/src/utils/accent-utils.d.ts.map +1 -1
  187. package/lib/typescript/src/utils/color-utils.d.ts +59 -2
  188. package/lib/typescript/src/utils/color-utils.d.ts.map +1 -1
  189. package/lib/typescript/src/utils/deep-merge.d.ts +1 -0
  190. package/lib/typescript/src/utils/deep-merge.d.ts.map +1 -1
  191. package/lib/typescript/src/utils/resolve-theme-color.d.ts +2 -2
  192. package/package.json +1 -1
  193. package/src/components/avatar/Avatar.tsx +20 -20
  194. package/src/components/button/Button.tsx +11 -11
  195. package/src/components/chip/Chip.tsx +32 -32
  196. package/src/components/chip/types.ts +1 -1
  197. package/src/components/empty-state/EmptyState.tsx +4 -4
  198. package/src/components/header/variants/LargeTitleHeader/index.tsx +31 -30
  199. package/src/components/header/variants/TitleHeader/index.tsx +33 -22
  200. package/src/components/icon/Icon.tsx +4 -4
  201. package/src/components/page-indicator/hooks/use-page-indicator-colors.ts +2 -2
  202. package/src/components/screen/Screen.tsx +89 -43
  203. package/src/components/screen/ScreenContext.tsx +48 -28
  204. package/src/components/screen/ScreenFlatList.tsx +5 -191
  205. package/src/components/screen/ScreenList.tsx +197 -175
  206. package/src/components/screen/ScreenScrollView.tsx +92 -167
  207. package/src/components/screen/hooks/use-screen-ref.ts +24 -0
  208. package/src/components/screen/hooks/use-screen-scroll-handler.ts +31 -0
  209. package/src/components/screen/index.ts +8 -2
  210. package/src/components/screen/parts/ScreenFrame.tsx +49 -0
  211. package/src/components/screen/parts/ScreenHeaderAppearance.tsx +52 -0
  212. package/src/components/screen/parts/ScreenPlaceholder.tsx +16 -16
  213. package/src/components/screen/parts/ScreenSafeArea.android.tsx +22 -0
  214. package/src/components/screen/parts/ScreenSafeArea.tsx +20 -0
  215. package/src/components/screen/types.ts +29 -32
  216. package/src/components/screen/utils.ts +24 -11
  217. package/src/components/spinner/Spinner.tsx +2 -2
  218. package/src/components/text/Text.tsx +2 -2
  219. package/src/components/toast/Toast.tsx +13 -13
  220. package/src/components/toolbar/Toolbar.tsx +4 -4
  221. package/src/context/ThemeProvider.tsx +47 -51
  222. package/src/context/index.ts +1 -1
  223. package/src/theme/breakpoints.ts +1 -1
  224. package/src/theme/define-config.ts +27 -0
  225. package/src/theme/diagnostics.ts +11 -0
  226. package/src/theme/errors.ts +14 -0
  227. package/src/theme/index.ts +40 -1
  228. package/src/theme/legacy-tokens.ts +227 -0
  229. package/src/theme/registry.ts +119 -137
  230. package/src/theme/resolve-config.ts +406 -0
  231. package/src/theme/runtime.ts +52 -14
  232. package/src/theme/screen-margin.ts +6 -25
  233. package/src/theme/screen-padding.ts +26 -0
  234. package/src/theme/selection-store.ts +76 -0
  235. package/src/theme/theme.ts +104 -39
  236. package/src/theme/tokens/canonical-color-keys.ts +107 -0
  237. package/src/theme/tokens/dark.ts +91 -98
  238. package/src/theme/tokens/light.ts +88 -93
  239. package/src/theme/tokens/primitives.ts +14 -14
  240. package/src/theme/tokens/validate.ts +271 -0
  241. package/src/theme/types.ts +184 -95
  242. package/src/theme/unistyles-adapter.ts +75 -0
  243. package/src/utils/accent-generator.ts +530 -0
  244. package/src/utils/accent-utils.ts +66 -39
  245. package/src/utils/color-utils.ts +225 -8
  246. package/src/utils/deep-merge.ts +1 -1
  247. package/src/utils/resolve-theme-color.ts +2 -2
  248. package/lib/module/components/screen/parts/BottomSafeArea.js +0 -62
  249. package/lib/module/components/screen/parts/BottomSafeArea.js.map +0 -1
  250. package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts +0 -30
  251. package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts.map +0 -1
  252. package/src/components/screen/parts/BottomSafeArea.tsx +0 -59
@@ -1,12 +1,21 @@
1
1
  "use strict";
2
2
 
3
- import { StyleSheet, UnistylesRuntime } from "react-native-unistyles";
4
- import { normalizeAccent } from "../utils/accent-utils.js";
5
- import { deepMerge } from "../utils/deep-merge.js";
6
- import { breakpoints } from "./breakpoints.js";
3
+ /**
4
+ * Installation lifecycle: `configureTerraUI` / `bootstrapTerraUI` and the
5
+ * read-only getters components use (icons, image renderer, component defaults).
6
+ *
7
+ * Theme resolution lives in `resolve-config.ts`; native calls in
8
+ * `unistyles-adapter.ts`; the selection snapshot and installed config in
9
+ * `selection-store.ts`. This module orchestrates them in a fixed order:
10
+ * build and validate (pure, may throw) → native work → publish state.
11
+ */
7
12
  import { defaultIcons } from "./defaults/icons.js";
8
13
  import { defaultImage } from "./defaults/image.js";
9
- import { buildRadiusScale, buildSpacingScale, defaultDarkTheme, defaultLightTheme } from "./theme.js";
14
+ import { warnContrastDiagnostics } from "./diagnostics.js";
15
+ import { normalizeThemeInput, resolveThemeScheme, resolveThemes } from "./resolve-config.js";
16
+ import { getInstalledConfig, publishThemeSelection, setInstalledConfig } from "./selection-store.js";
17
+ import { applyMode, configureUnistyles, hasConfiguredUnistyles, updateThemes } from "./unistyles-adapter.js";
18
+
10
19
  // ─── Radius / elevation defaults ─────────────────────────────────────────────
11
20
 
12
21
  /** Fallback when a component's radius is not configured. */
@@ -21,111 +30,88 @@ const resolveDefaultRadius = components => ({
21
30
 
22
31
  // ─── Unistyles module augmentation ────────────────────────────────────────────
23
32
 
24
- const registry = {
25
- baseLight: defaultLightTheme,
26
- baseDark: defaultDarkTheme,
27
- accents: {},
28
- currentAccent: undefined,
29
- defaultRadius: resolveDefaultRadius(),
30
- surfaceElevation: DEFAULT_ELEVATION,
31
- icons: {},
32
- imageComponent: defaultImage,
33
- configured: false
34
- };
35
-
36
- /** @internal */
37
- export const getRegistry = () => registry;
38
- export const getIsConfigured = () => registry.configured;
39
- export const getAccentNames = () => Object.keys(registry.accents);
40
- export const getImageComponent = () => registry.imageComponent;
41
- export const getIcon = name => registry.icons[name] ?? defaultIcons[name];
42
- export const getRequiredIcon = name => registry.icons[name] ?? defaultIcons[name];
33
+ // ─── Private registry state ──────────────────────────────────────────────────
34
+
35
+ /** Adapters and component defaults, installed at configure time only. */
36
+
37
+ const buildSettings = config => ({
38
+ defaultRadius: resolveDefaultRadius(config.components),
39
+ surfaceElevation: config.components?.surface?.elevation ?? DEFAULT_ELEVATION,
40
+ icons: {
41
+ ...(config.icons ?? {})
42
+ },
43
+ imageComponent: config.image ?? defaultImage
44
+ });
45
+ let settings = buildSettings({});
46
+
47
+ /**
48
+ * Installation state. `unconfigured` nothing has run; `fallback` → the
49
+ * provider's placeholder defaults are live and an app call still replaces
50
+ * them; `app` the app configured, later calls are ignored with a warning.
51
+ */
52
+ let installation = "unconfigured";
53
+
54
+ // ─── Getters (read-only) ─────────────────────────────────────────────────────
55
+
56
+ export const getIsConfigured = () => installation !== "unconfigured";
57
+
58
+ /** Names of the registered accents, in declaration order. Returns a fresh array. */
59
+ export const getAccentNames = () => [...getInstalledConfig().accentNames];
60
+ export const getImageComponent = () => settings.imageComponent;
61
+ export const getIcon = name => settings.icons[name] ?? defaultIcons[name];
62
+ export const getRequiredIcon = name => settings.icons[name] ?? defaultIcons[name];
43
63
 
44
64
  /**
45
65
  * The configured default corner radius for a component (Button, Surface).
46
66
  * Set via {@link configureTerraUI}; defaults to `'md'`.
47
67
  */
48
- export const getDefaultRadius = component => registry.defaultRadius[component];
68
+ export const getDefaultRadius = component => settings.defaultRadius[component];
49
69
 
50
70
  /**
51
71
  * The configured default drop-shadow depth for Surface (`'none'` = no shadow).
52
72
  * Set via {@link configureTerraUI}; defaults to `'none'`.
53
73
  */
54
- export const getSurfaceElevation = () => registry.surfaceElevation;
74
+ export const getSurfaceElevation = () => settings.surfaceElevation;
55
75
 
56
- /** Resolves a scheme's theme = base ⊕ the named accent's partial override. */
76
+ /**
77
+ * Resolves one scheme's theme from the installed configuration with the named
78
+ * accent overlaid. Omitting `accentName` selects the base theme (no accent —
79
+ * not the configured `defaultAccent`). An unknown name warns in development
80
+ * and falls back to the base theme. Pure with respect to runtime state: it
81
+ * never changes the applied selection.
82
+ */
57
83
  export function resolveTheme(scheme, accentName) {
58
- const base = scheme === "light" ? registry.baseLight : registry.baseDark;
59
- const accent = accentName ? registry.accents[accentName] : undefined;
60
- return deepMerge(base, accent ? accent[scheme] : undefined);
61
- }
62
- const mergeThemeOverride = (theme, override) => {
63
- if (!override) return theme;
64
- const {
65
- radius,
66
- spacing,
67
- ...rest
68
- } = override;
69
- let next = deepMerge(theme, rest);
70
- if (radius) {
71
- const {
72
- base,
73
- ...radiusTokens
74
- } = radius;
75
- if (base != null) {
76
- next = deepMerge(next, {
77
- radius: buildRadiusScale(base)
78
- });
84
+ const config = getInstalledConfig();
85
+ let accent = null;
86
+ if (accentName !== undefined) {
87
+ if (config.accentNames.includes(accentName)) {
88
+ accent = accentName;
89
+ } else if (__DEV__) {
90
+ console.warn(`[react-native-terra-ui] Unknown accent "${accentName}"; resolving the base theme.`);
79
91
  }
80
- next = deepMerge(next, {
81
- radius: radiusTokens
82
- });
83
- }
84
- if (spacing) {
85
- const {
86
- base,
87
- ...spacingTokens
88
- } = spacing;
89
- if (base != null) {
90
- next = deepMerge(next, {
91
- spacing: buildSpacingScale(base)
92
- });
93
- }
94
- next = deepMerge(next, {
95
- spacing: spacingTokens
96
- });
97
92
  }
98
- return next;
99
- };
100
-
101
- /**
102
- * Whether the live configuration is the provider's fallback rather than an
103
- * app's own call. A fallback is a placeholder, so a real call still replaces
104
- * it; two real calls remain an error.
105
- */
106
- let configuredByFallback = false;
93
+ return resolveThemeScheme(config, scheme, accent).theme;
94
+ }
107
95
 
108
- /**
109
- * Whether `StyleSheet.configure` has run. Tracked separately from
110
- * {@link Registry.configured} because it may only happen once per app.
111
- */
112
- let unistylesConfigured = false;
96
+ // ─── Configuration ───────────────────────────────────────────────────────────
113
97
 
114
98
  /**
115
99
  * Configure Terra UI's themes. Call ONCE, as early as possible — before any
116
100
  * component renders (e.g. top of the app entry, imported from
117
101
  * `react-native-terra-ui/theme`). With no arguments it registers the default
118
102
  * theme; `<TerraUIProvider>` calls it for you if you haven't.
103
+ *
104
+ * Invalid input throws {@link TerraConfigError} before anything is installed,
105
+ * so a corrected retry is still the app's one configure call.
119
106
  */
120
107
  export function configureTerraUI(config = {}) {
121
- if (registry.configured && !configuredByFallback) {
108
+ if (installation === "app") {
122
109
  if (__DEV__ && Object.keys(config).length > 0) {
123
110
  console.warn("[react-native-terra-ui] configureTerraUI() was called more than once; the later call was ignored.");
124
111
  }
125
112
  return;
126
113
  }
127
- configuredByFallback = false;
128
- applyConfig(config);
114
+ applyConfig(config, "app");
129
115
  }
130
116
 
131
117
  /**
@@ -141,60 +127,66 @@ export function configureTerraUI(config = {}) {
141
127
  * @internal
142
128
  */
143
129
  export function bootstrapTerraUI() {
144
- if (registry.configured) {
130
+ if (installation !== "unconfigured") {
145
131
  return;
146
132
  }
147
- applyConfig({});
148
- configuredByFallback = true;
133
+ applyConfig({}, "fallback");
149
134
  }
150
- function applyConfig(config) {
151
- registry.configured = true;
152
- registry.baseLight = mergeThemeOverride(mergeThemeOverride(defaultLightTheme, config.shared), config.schemes?.light);
153
- registry.baseDark = mergeThemeOverride(mergeThemeOverride(defaultDarkTheme, config.shared), config.schemes?.dark);
154
- registry.defaultRadius = resolveDefaultRadius(config.components);
155
- registry.surfaceElevation = config.components?.surface?.elevation ?? DEFAULT_ELEVATION;
156
- registry.icons = config.icons ?? {};
157
- registry.imageComponent = config.image ?? defaultImage;
158
- registry.accents = {};
159
- for (const [name, accent] of Object.entries(config.accents ?? {})) {
160
- registry.accents[name] = normalizeAccent(accent);
161
- }
162
- const {
163
- defaultAccent
164
- } = config;
165
- registry.currentAccent = defaultAccent && registry.accents[defaultAccent] ? defaultAccent : undefined;
166
- const themes = {
167
- light: resolveTheme("light", registry.currentAccent),
168
- dark: resolveTheme("dark", registry.currentAccent)
169
- };
170
- const adaptive = config.adaptiveThemes ?? true;
171
- const settings = config.initialScheme ? {
172
- initialTheme: config.initialScheme
173
- } : adaptive ? {
174
- adaptiveThemes: true
175
- } : {
176
- initialTheme: "light"
177
- };
178
- if (unistylesConfigured) {
179
- // `StyleSheet.configure` is a one-time startup call — calling it again
180
- // leaves the themes it already registered in place, which would strand an
181
- // app's config behind the fallback's defaults. Hand the rebuilt themes to
182
- // the runtime instead, the same way `applyAccent` swaps a palette.
183
- UnistylesRuntime.updateTheme("light", () => themes.light);
184
- UnistylesRuntime.updateTheme("dark", () => themes.dark);
185
- if ("adaptiveThemes" in settings) {
186
- UnistylesRuntime.setAdaptiveThemes(true);
187
- } else {
188
- UnistylesRuntime.setAdaptiveThemes(false);
189
- UnistylesRuntime.setTheme(settings.initialTheme);
135
+
136
+ /**
137
+ * Derives the starting theme mode. `mode` wins; otherwise the deprecated
138
+ * settings keep their existing meaning: `initialScheme` pins that scheme,
139
+ * `adaptiveThemes: false` starts in light, and the default follows the system.
140
+ */
141
+ function deriveMode(config) {
142
+ const hasLegacy = config.initialScheme !== undefined || config.adaptiveThemes !== undefined;
143
+ if (config.mode !== undefined) {
144
+ if (__DEV__ && hasLegacy) {
145
+ console.warn("[react-native-terra-ui] configureTerraUI(): `mode` was supplied together with the deprecated `initialScheme` / `adaptiveThemes`; `mode` wins and the deprecated settings are ignored.");
190
146
  }
191
- return;
147
+ return config.mode;
192
148
  }
193
- StyleSheet.configure({
149
+ if (config.initialScheme !== undefined) return config.initialScheme;
150
+ if (config.adaptiveThemes === false) return "light";
151
+ return "system";
152
+ }
153
+ const pickThemeInput = config => ({
154
+ shared: config.shared,
155
+ schemes: config.schemes,
156
+ accents: config.accents,
157
+ defaultAccent: config.defaultAccent
158
+ });
159
+ function applyConfig(config, kind) {
160
+ // (a) Pure: validate and build everything. Throws leave ALL state untouched.
161
+ const themeConfig = normalizeThemeInput(pickThemeInput(config));
162
+ const mode = deriveMode(config);
163
+ const {
194
164
  themes,
195
- settings,
196
- breakpoints
165
+ diagnostics
166
+ } = resolveThemes(themeConfig, themeConfig.defaultAccent);
167
+ const nextSettings = buildSettings(config);
168
+
169
+ // (b) Native. `StyleSheet.configure` runs once per app; after that the
170
+ // rebuilt themes reach the runtime the same way an accent change does, so an
171
+ // app's config is never stranded behind the fallback's defaults.
172
+ if (hasConfiguredUnistyles()) {
173
+ updateThemes(themes);
174
+ applyMode(mode);
175
+ } else {
176
+ configureUnistyles({
177
+ themes,
178
+ mode
179
+ });
180
+ }
181
+
182
+ // (c) Publish only after native work succeeded.
183
+ installation = kind;
184
+ settings = nextSettings;
185
+ setInstalledConfig(themeConfig);
186
+ publishThemeSelection({
187
+ accent: themeConfig.defaultAccent ?? undefined,
188
+ mode
197
189
  });
198
- unistylesConfigured = true;
190
+ warnContrastDiagnostics(diagnostics);
199
191
  }
200
192
  //# sourceMappingURL=registry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["StyleSheet","UnistylesRuntime","normalizeAccent","deepMerge","breakpoints","defaultIcons","defaultImage","buildRadiusScale","buildSpacingScale","defaultDarkTheme","defaultLightTheme","DEFAULT_RADIUS","DEFAULT_ELEVATION","resolveDefaultRadius","components","button","radius","surface","registry","baseLight","baseDark","accents","currentAccent","undefined","defaultRadius","surfaceElevation","icons","imageComponent","configured","getRegistry","getIsConfigured","getAccentNames","Object","keys","getImageComponent","getIcon","name","getRequiredIcon","getDefaultRadius","component","getSurfaceElevation","resolveTheme","scheme","accentName","base","accent","mergeThemeOverride","theme","override","spacing","rest","next","radiusTokens","spacingTokens","configuredByFallback","unistylesConfigured","configureTerraUI","config","__DEV__","length","console","warn","applyConfig","bootstrapTerraUI","shared","schemes","light","dark","elevation","image","entries","defaultAccent","themes","adaptive","adaptiveThemes","settings","initialScheme","initialTheme","updateTheme","setAdaptiveThemes","setTheme","configure"],"sourceRoot":"../../../src","sources":["theme/registry.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,gBAAgB,QAAQ,wBAAwB;AAErE,SAASC,eAAe;AACxB,SAASC,SAAS;AAClB,SAASC,WAAW;AACpB,SAASC,YAAY;AACrB,SAASC,YAAY;AACrB,SAASC,gBAAgB,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAEC,iBAAiB;AAgBjF;;AAEA;AACA,MAAMC,cAAkC,GAAG,IAAI;AAC/C;AACA,MAAMC,iBAA+B,GAAG,MAAM;AAI9C;AACA,MAAMC,oBAAoB,GAAIC,UAA8B,KAAsB;EAChFC,MAAM,EAAED,UAAU,EAAEC,MAAM,EAAEC,MAAM,IAAI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,MAAMN,MAAM,CAACL,IAAI,CAAC;IAEvD,IAAI,gBAAgB,IAAIQ,QAAQ,EAAE;MAChC1E,gBAAgB,CAAC8E,iBAAiB,CAAC,IAAI,CAAC;IAC1C,CAAC,MAAM;MACL9E,gBAAgB,CAAC8E,iBAAiB,CAAC,KAAK,CAAC;MACzC9E,gBAAgB,CAAC+E,QAAQ,CAACL,QAAQ,CAACE,YAAY,CAAC;IAClD;IAEA;EACF;EAEA7E,UAAU,CAACiF,SAAS,CAAC;IAAET,MAAM;IAAEG,QAAQ;IAAEvE;EAAY,CAAC,CAAC;EACvDmD,mBAAmB,GAAG,IAAI;AAC5B","ignoreList":[]}
1
+ {"version":3,"names":["defaultIcons","defaultImage","warnContrastDiagnostics","normalizeThemeInput","resolveThemeScheme","resolveThemes","getInstalledConfig","publishThemeSelection","setInstalledConfig","applyMode","configureUnistyles","hasConfiguredUnistyles","updateThemes","DEFAULT_RADIUS","DEFAULT_ELEVATION","resolveDefaultRadius","components","button","radius","surface","buildSettings","config","defaultRadius","surfaceElevation","elevation","icons","imageComponent","image","settings","installation","getIsConfigured","getAccentNames","accentNames","getImageComponent","getIcon","name","getRequiredIcon","getDefaultRadius","component","getSurfaceElevation","resolveTheme","scheme","accentName","accent","undefined","includes","__DEV__","console","warn","theme","configureTerraUI","Object","keys","length","applyConfig","bootstrapTerraUI","deriveMode","hasLegacy","initialScheme","adaptiveThemes","mode","pickThemeInput","shared","schemes","accents","defaultAccent","kind","themeConfig","themes","diagnostics","nextSettings"],"sourceRoot":"../../../src","sources":["theme/registry.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY;AACrB,SAASC,YAAY;AACrB,SAASC,uBAAuB;AAChC,SAASC,mBAAmB,EAAEC,kBAAkB,EAAEC,aAAa;AAC/D,SAASC,kBAAkB,EAAEC,qBAAqB,EAAEC,kBAAkB;AAetE,SAASC,SAAS,EAAEC,kBAAkB,EAAEC,sBAAsB,EAA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