@ankhorage/surface 8.0.0 → 9.0.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 (479) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{surfaceColor.d.ts → constants/surfaceColor.d.ts} +0 -4
  3. package/dist/constants/surfaceColor.d.ts.map +1 -0
  4. package/dist/constants/surfaceColor.js.map +1 -0
  5. package/dist/features/app-bar/adapters/inbound/AppBar.d.ts.map +1 -1
  6. package/dist/features/app-bar/adapters/inbound/AppBar.js +1 -1
  7. package/dist/features/app-bar/adapters/inbound/AppBar.js.map +1 -1
  8. package/dist/features/badge/adapters/inbound/Badge.d.ts.map +1 -1
  9. package/dist/features/badge/adapters/inbound/Badge.js +1 -1
  10. package/dist/features/badge/adapters/inbound/Badge.js.map +1 -1
  11. package/dist/features/button/adapters/inbound/Button.d.ts.map +1 -1
  12. package/dist/features/button/adapters/inbound/Button.js +1 -1
  13. package/dist/features/button/adapters/inbound/Button.js.map +1 -1
  14. package/dist/features/button/adapters/inbound/IconButton.d.ts.map +1 -1
  15. package/dist/features/button/adapters/inbound/IconButton.js +1 -1
  16. package/dist/features/button/adapters/inbound/IconButton.js.map +1 -1
  17. package/dist/features/card/adapters/inbound/Card.d.ts.map +1 -1
  18. package/dist/features/card/adapters/inbound/Card.js +1 -1
  19. package/dist/features/card/adapters/inbound/Card.js.map +1 -1
  20. package/dist/features/font/adapters/inbound/FontProvider.d.ts +4 -0
  21. package/dist/features/font/adapters/inbound/FontProvider.d.ts.map +1 -0
  22. package/dist/features/font/adapters/inbound/FontProvider.js +16 -0
  23. package/dist/features/font/adapters/inbound/FontProvider.js.map +1 -0
  24. package/dist/features/font/adapters/inbound/FontRuntimeContext.d.ts +4 -0
  25. package/dist/features/font/adapters/inbound/FontRuntimeContext.d.ts.map +1 -0
  26. package/dist/features/font/adapters/inbound/FontRuntimeContext.js +9 -0
  27. package/dist/features/font/adapters/inbound/FontRuntimeContext.js.map +1 -0
  28. package/dist/features/font/adapters/inbound/useFontRuntime.d.ts +4 -0
  29. package/dist/features/font/adapters/inbound/useFontRuntime.d.ts.map +1 -0
  30. package/dist/features/font/adapters/inbound/useFontRuntime.js +7 -0
  31. package/dist/features/font/adapters/inbound/useFontRuntime.js.map +1 -0
  32. package/dist/features/font/public.d.ts +3 -0
  33. package/dist/features/font/public.d.ts.map +1 -0
  34. package/dist/features/font/public.js +2 -0
  35. package/dist/features/font/public.js.map +1 -0
  36. package/dist/features/form/checkbox/adapters/inbound/Checkbox.d.ts.map +1 -1
  37. package/dist/features/form/checkbox/adapters/inbound/Checkbox.js +1 -1
  38. package/dist/features/form/checkbox/adapters/inbound/Checkbox.js.map +1 -1
  39. package/dist/features/form/radio/adapters/inbound/Radio.d.ts.map +1 -1
  40. package/dist/features/form/radio/adapters/inbound/Radio.js +1 -1
  41. package/dist/features/form/radio/adapters/inbound/Radio.js.map +1 -1
  42. package/dist/features/form/switch/adapters/inbound/Switch.d.ts.map +1 -1
  43. package/dist/features/form/switch/adapters/inbound/Switch.js +1 -1
  44. package/dist/features/form/switch/adapters/inbound/Switch.js.map +1 -1
  45. package/dist/features/form/text-input/adapters/inbound/TextInput.d.ts.map +1 -1
  46. package/dist/features/form/text-input/adapters/inbound/TextInput.js +1 -1
  47. package/dist/features/form/text-input/adapters/inbound/TextInput.js.map +1 -1
  48. package/dist/features/form/text-input/utils/resolveTextInputPresentation.d.ts +1 -1
  49. package/dist/features/form/text-input/utils/resolveTextInputPresentation.d.ts.map +1 -1
  50. package/dist/features/form/text-input/utils/resolveTextInputPresentation.js.map +1 -1
  51. package/dist/features/icon/adapters/inbound/Icon.d.ts.map +1 -1
  52. package/dist/features/icon/adapters/inbound/Icon.js +2 -2
  53. package/dist/features/icon/adapters/inbound/Icon.js.map +1 -1
  54. package/dist/features/image/adapters/inbound/Image.d.ts.map +1 -1
  55. package/dist/features/image/adapters/inbound/Image.js +1 -1
  56. package/dist/features/image/adapters/inbound/Image.js.map +1 -1
  57. package/dist/features/image/utils/resolveImageStyle.d.ts +1 -1
  58. package/dist/features/image/utils/resolveImageStyle.d.ts.map +1 -1
  59. package/dist/features/image/utils/resolveImageStyle.js +1 -1
  60. package/dist/features/image/utils/resolveImageStyle.js.map +1 -1
  61. package/dist/features/layout/adapters/inbound/Grid.d.ts.map +1 -1
  62. package/dist/features/layout/adapters/inbound/Grid.js +1 -1
  63. package/dist/features/layout/adapters/inbound/Grid.js.map +1 -1
  64. package/dist/features/layout/adapters/inbound/ScrollView.d.ts.map +1 -1
  65. package/dist/features/layout/adapters/inbound/ScrollView.js +1 -1
  66. package/dist/features/layout/adapters/inbound/ScrollView.js.map +1 -1
  67. package/dist/features/layout/adapters/inbound/View.d.ts.map +1 -1
  68. package/dist/features/layout/adapters/inbound/View.js +1 -1
  69. package/dist/features/layout/adapters/inbound/View.js.map +1 -1
  70. package/dist/features/list/adapters/inbound/ListItem.d.ts.map +1 -1
  71. package/dist/features/list/adapters/inbound/ListItem.js +1 -1
  72. package/dist/features/list/adapters/inbound/ListItem.js.map +1 -1
  73. package/dist/features/modal/adapters/inbound/Modal.d.ts.map +1 -1
  74. package/dist/features/modal/adapters/inbound/Modal.js +1 -1
  75. package/dist/features/modal/adapters/inbound/Modal.js.map +1 -1
  76. package/dist/features/popover-menu/adapters/inbound/PopoverMenu.d.ts.map +1 -1
  77. package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js +1 -1
  78. package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js.map +1 -1
  79. package/dist/features/pressable/adapters/inbound/Pressable.d.ts.map +1 -1
  80. package/dist/features/pressable/adapters/inbound/Pressable.js +1 -1
  81. package/dist/features/pressable/adapters/inbound/Pressable.js.map +1 -1
  82. package/dist/features/surface/adapters/inbound/Surface.d.ts.map +1 -1
  83. package/dist/features/surface/adapters/inbound/Surface.js +1 -1
  84. package/dist/features/surface/adapters/inbound/Surface.js.map +1 -1
  85. package/dist/features/tabs/adapters/inbound/Tab.d.ts.map +1 -1
  86. package/dist/features/tabs/adapters/inbound/Tab.js +1 -1
  87. package/dist/features/tabs/adapters/inbound/Tab.js.map +1 -1
  88. package/dist/features/theme/adapters/inbound/ThemeProvider.d.ts +4 -0
  89. package/dist/features/theme/adapters/inbound/ThemeProvider.d.ts.map +1 -0
  90. package/dist/features/theme/adapters/inbound/ThemeProvider.js +27 -0
  91. package/dist/features/theme/adapters/inbound/ThemeProvider.js.map +1 -0
  92. package/dist/features/theme/adapters/inbound/ThemeRuntimeContext.d.ts +4 -0
  93. package/dist/features/theme/adapters/inbound/ThemeRuntimeContext.d.ts.map +1 -0
  94. package/dist/features/theme/adapters/inbound/ThemeRuntimeContext.js +11 -0
  95. package/dist/features/theme/adapters/inbound/ThemeRuntimeContext.js.map +1 -0
  96. package/dist/features/theme/adapters/inbound/ThemeScope.d.ts +4 -0
  97. package/dist/features/theme/adapters/inbound/ThemeScope.d.ts.map +1 -0
  98. package/dist/features/theme/adapters/inbound/ThemeScope.js +17 -0
  99. package/dist/features/theme/adapters/inbound/ThemeScope.js.map +1 -0
  100. package/dist/features/theme/adapters/inbound/useTheme.d.ts +4 -0
  101. package/dist/features/theme/adapters/inbound/useTheme.d.ts.map +1 -0
  102. package/dist/features/theme/adapters/inbound/useTheme.js +7 -0
  103. package/dist/features/theme/adapters/inbound/useTheme.js.map +1 -0
  104. package/dist/features/theme/application/use-cases/createTheme.d.ts +5 -0
  105. package/dist/features/theme/application/use-cases/createTheme.d.ts.map +1 -0
  106. package/dist/features/theme/application/use-cases/createTheme.js +56 -0
  107. package/dist/features/theme/application/use-cases/createTheme.js.map +1 -0
  108. package/dist/features/theme/constants.d.ts +10 -0
  109. package/dist/features/theme/constants.d.ts.map +1 -0
  110. package/dist/{theme/defaultTokens.js → features/theme/constants.js} +9 -2
  111. package/dist/features/theme/constants.js.map +1 -0
  112. package/dist/{theme → features/theme/domain}/createSurfaceColorDiagnosticCollector.d.ts +1 -1
  113. package/dist/features/theme/domain/createSurfaceColorDiagnosticCollector.d.ts.map +1 -0
  114. package/dist/features/theme/domain/createSurfaceColorDiagnosticCollector.js.map +1 -0
  115. package/dist/{theme → features/theme/domain}/createSurfaceSemanticPolicy.d.ts +1 -1
  116. package/dist/features/theme/domain/createSurfaceSemanticPolicy.d.ts.map +1 -0
  117. package/dist/{theme → features/theme/domain}/createSurfaceSemanticPolicy.js +1 -1
  118. package/dist/features/theme/domain/createSurfaceSemanticPolicy.js.map +1 -0
  119. package/dist/features/theme/domain/generatePalette.d.ts +10 -0
  120. package/dist/features/theme/domain/generatePalette.d.ts.map +1 -0
  121. package/dist/{theme/colorEngine.js → features/theme/domain/generatePalette.js} +2 -10
  122. package/dist/features/theme/domain/generatePalette.js.map +1 -0
  123. package/dist/{theme → features/theme/domain}/resolveRoleSemantics.d.ts +1 -1
  124. package/dist/features/theme/domain/resolveRoleSemantics.d.ts.map +1 -0
  125. package/dist/{theme → features/theme/domain}/resolveRoleSemantics.js +1 -1
  126. package/dist/features/theme/domain/resolveRoleSemantics.js.map +1 -0
  127. package/dist/features/theme/domain/resolveSemanticColors.d.ts +4 -0
  128. package/dist/features/theme/domain/resolveSemanticColors.d.ts.map +1 -0
  129. package/dist/features/theme/domain/resolveSemanticColors.js +10 -0
  130. package/dist/features/theme/domain/resolveSemanticColors.js.map +1 -0
  131. package/dist/{theme → features/theme/domain}/resolveSurfaceSemanticModel.d.ts +1 -1
  132. package/dist/features/theme/domain/resolveSurfaceSemanticModel.d.ts.map +1 -0
  133. package/dist/features/theme/domain/resolveSurfaceSemanticModel.js.map +1 -0
  134. package/dist/features/theme/public.d.ts +3 -0
  135. package/dist/features/theme/public.d.ts.map +1 -0
  136. package/dist/features/theme/public.js +2 -0
  137. package/dist/features/theme/public.js.map +1 -0
  138. package/dist/features/theme/runtime.d.ts +5 -0
  139. package/dist/features/theme/runtime.d.ts.map +1 -0
  140. package/dist/features/theme/runtime.js +4 -0
  141. package/dist/features/theme/runtime.js.map +1 -0
  142. package/dist/{theme → features/theme/utils}/resolveGlobalTokens.d.ts +1 -1
  143. package/dist/features/theme/utils/resolveGlobalTokens.d.ts.map +1 -0
  144. package/dist/{theme → features/theme/utils}/resolveGlobalTokens.js +1 -1
  145. package/dist/features/theme/utils/resolveGlobalTokens.js.map +1 -0
  146. package/dist/{theme → features/theme/utils}/resolveHeadingTokenOverrides.d.ts +1 -1
  147. package/dist/features/theme/utils/resolveHeadingTokenOverrides.d.ts.map +1 -0
  148. package/dist/features/theme/utils/resolveHeadingTokenOverrides.js.map +1 -0
  149. package/dist/features/theme/utils/resolveNumericTokenOverrides.d.ts.map +1 -0
  150. package/dist/features/theme/utils/resolveNumericTokenOverrides.js.map +1 -0
  151. package/dist/{theme → features/theme/utils}/resolveToken.d.ts +2 -8
  152. package/dist/features/theme/utils/resolveToken.d.ts.map +1 -0
  153. package/dist/features/theme/utils/resolveToken.js +10 -0
  154. package/dist/features/theme/utils/resolveToken.js.map +1 -0
  155. package/dist/{theme → features/theme/utils}/resolveWeightTokenOverrides.d.ts +1 -1
  156. package/dist/features/theme/utils/resolveWeightTokenOverrides.d.ts.map +1 -0
  157. package/dist/{theme → features/theme/utils}/resolveWeightTokenOverrides.js +3 -5
  158. package/dist/features/theme/utils/resolveWeightTokenOverrides.js.map +1 -0
  159. package/dist/features/toast/adapters/inbound/Toast.d.ts.map +1 -1
  160. package/dist/features/toast/adapters/inbound/Toast.js +1 -1
  161. package/dist/features/toast/adapters/inbound/Toast.js.map +1 -1
  162. package/dist/features/tooltip/adapters/inbound/Tooltip.d.ts.map +1 -1
  163. package/dist/features/tooltip/adapters/inbound/Tooltip.js +1 -1
  164. package/dist/features/tooltip/adapters/inbound/Tooltip.js.map +1 -1
  165. package/dist/features/typography/adapters/inbound/Heading.d.ts +2 -2
  166. package/dist/features/typography/adapters/inbound/Heading.d.ts.map +1 -1
  167. package/dist/features/typography/adapters/inbound/Heading.js +4 -20
  168. package/dist/features/typography/adapters/inbound/Heading.js.map +1 -1
  169. package/dist/features/typography/adapters/inbound/Text.d.ts +1 -1
  170. package/dist/features/typography/adapters/inbound/Text.d.ts.map +1 -1
  171. package/dist/features/typography/adapters/inbound/Text.js +3 -20
  172. package/dist/features/typography/adapters/inbound/Text.js.map +1 -1
  173. package/dist/features/typography/utils/resolveHeadingTextStyle.d.ts +2 -2
  174. package/dist/features/typography/utils/resolveHeadingTextStyle.d.ts.map +1 -1
  175. package/dist/features/typography/utils/resolveHeadingTextStyle.js.map +1 -1
  176. package/dist/index.d.ts +9 -10
  177. package/dist/index.d.ts.map +1 -1
  178. package/dist/index.js +4 -6
  179. package/dist/index.js.map +1 -1
  180. package/dist/internal/resolvers/resolveControlSize.d.ts +1 -1
  181. package/dist/internal/resolvers/resolveControlSize.js.map +1 -1
  182. package/dist/internal/resolvers/resolveFieldPresentation.d.ts +1 -1
  183. package/dist/internal/resolvers/resolveFieldPresentation.d.ts.map +1 -1
  184. package/dist/internal/resolvers/resolveFieldPresentation.js.map +1 -1
  185. package/dist/internal/resolvers/resolveIconSize.d.ts +1 -1
  186. package/dist/internal/resolvers/resolveIconSize.js.map +1 -1
  187. package/dist/internal/resolvers/resolveInteractiveColors.d.ts +2 -2
  188. package/dist/internal/resolvers/resolveInteractiveColors.d.ts.map +1 -1
  189. package/dist/internal/resolvers/resolveInteractiveColors.js.map +1 -1
  190. package/dist/internal/resolvers/resolveSelectionControlColors.d.ts +2 -2
  191. package/dist/internal/resolvers/resolveSelectionControlColors.d.ts.map +1 -1
  192. package/dist/internal/resolvers/resolveSelectionControlColors.js.map +1 -1
  193. package/dist/internal/resolvers/resolveSurfaceColor.d.ts +2 -2
  194. package/dist/internal/resolvers/resolveSurfaceColor.d.ts.map +1 -1
  195. package/dist/internal/resolvers/resolveSurfaceColor.js.map +1 -1
  196. package/dist/internal/resolvers/resolveTextColor.d.ts +2 -2
  197. package/dist/internal/resolvers/resolveTextColor.d.ts.map +1 -1
  198. package/dist/internal/resolvers/resolveTextColor.js.map +1 -1
  199. package/dist/internal/resolvers/resolveTextStyles.d.ts +1 -1
  200. package/dist/internal/resolvers/resolveTextStyles.js.map +1 -1
  201. package/dist/types/accordion.d.ts +1 -1
  202. package/dist/types/accordion.d.ts.map +1 -1
  203. package/dist/types/accordion.js.map +1 -1
  204. package/dist/types/badge.d.ts +1 -1
  205. package/dist/types/badge.d.ts.map +1 -1
  206. package/dist/types/badge.js.map +1 -1
  207. package/dist/types/button.d.ts +1 -1
  208. package/dist/types/button.d.ts.map +1 -1
  209. package/dist/types/button.js.map +1 -1
  210. package/dist/types/checkbox.d.ts +1 -1
  211. package/dist/types/checkbox.d.ts.map +1 -1
  212. package/dist/types/checkbox.js.map +1 -1
  213. package/dist/types/font.d.ts +13 -0
  214. package/dist/types/font.d.ts.map +1 -0
  215. package/dist/types/font.js +2 -0
  216. package/dist/types/font.js.map +1 -0
  217. package/dist/types/icon.d.ts +1 -1
  218. package/dist/types/icon.d.ts.map +1 -1
  219. package/dist/types/icon.js.map +1 -1
  220. package/dist/types/image.d.ts +1 -1
  221. package/dist/types/image.d.ts.map +1 -1
  222. package/dist/types/image.js.map +1 -1
  223. package/dist/types/interactionPolicy.d.ts.map +1 -0
  224. package/dist/types/interactionPolicy.js.map +1 -0
  225. package/dist/types/layout.d.ts +1 -1
  226. package/dist/types/layout.d.ts.map +1 -1
  227. package/dist/types/layout.js.map +1 -1
  228. package/dist/types/list.d.ts +1 -1
  229. package/dist/types/list.d.ts.map +1 -1
  230. package/dist/types/list.js.map +1 -1
  231. package/dist/types/modal.d.ts +1 -1
  232. package/dist/types/modal.d.ts.map +1 -1
  233. package/dist/types/modal.js.map +1 -1
  234. package/dist/types/popover.d.ts +1 -1
  235. package/dist/types/popover.d.ts.map +1 -1
  236. package/dist/types/popover.js.map +1 -1
  237. package/dist/types/popoverMenu.d.ts +1 -1
  238. package/dist/types/popoverMenu.d.ts.map +1 -1
  239. package/dist/types/popoverMenu.js.map +1 -1
  240. package/dist/types/pressable.d.ts +1 -1
  241. package/dist/types/pressable.d.ts.map +1 -1
  242. package/dist/types/pressable.js.map +1 -1
  243. package/dist/types/radio.d.ts +1 -1
  244. package/dist/types/radio.d.ts.map +1 -1
  245. package/dist/types/radio.js.map +1 -1
  246. package/dist/types/surfaceColor.d.ts +6 -0
  247. package/dist/types/surfaceColor.d.ts.map +1 -0
  248. package/dist/types/surfaceColor.js +2 -0
  249. package/dist/types/surfaceColor.js.map +1 -0
  250. package/dist/types/switch.d.ts +1 -1
  251. package/dist/types/switch.d.ts.map +1 -1
  252. package/dist/types/switch.js.map +1 -1
  253. package/dist/types/tabs.d.ts +1 -1
  254. package/dist/types/tabs.d.ts.map +1 -1
  255. package/dist/types/tabs.js.map +1 -1
  256. package/dist/types/text-input.d.ts +1 -1
  257. package/dist/types/text-input.d.ts.map +1 -1
  258. package/dist/types/text-input.js.map +1 -1
  259. package/dist/{theme/types.d.ts → types/theme.d.ts} +19 -3
  260. package/dist/types/theme.d.ts.map +1 -0
  261. package/dist/types/theme.js +2 -0
  262. package/dist/types/theme.js.map +1 -0
  263. package/dist/types/toast.d.ts +2 -2
  264. package/dist/types/toast.d.ts.map +1 -1
  265. package/dist/types/toast.js.map +1 -1
  266. package/dist/types/tooltip.d.ts +1 -1
  267. package/dist/types/tooltip.d.ts.map +1 -1
  268. package/dist/types/tooltip.js.map +1 -1
  269. package/dist/types/typography.d.ts +1 -1
  270. package/dist/types/typography.d.ts.map +1 -1
  271. package/dist/types/typography.js.map +1 -1
  272. package/dist/utils/resolveSpacing.d.ts +1 -1
  273. package/dist/utils/resolveSpacing.d.ts.map +1 -1
  274. package/dist/utils/resolveSpacing.js +1 -1
  275. package/dist/utils/resolveSpacing.js.map +1 -1
  276. package/dist/utils/resolveViewStyles.d.ts +1 -1
  277. package/dist/utils/resolveViewStyles.d.ts.map +1 -1
  278. package/dist/utils/resolveViewStyles.js +1 -1
  279. package/dist/utils/resolveViewStyles.js.map +1 -1
  280. package/package.json +16 -7
  281. package/src/constants/surfaceColor.public.test.ts +34 -0
  282. package/src/constants/surfaceColor.test.ts +18 -0
  283. package/src/{surfaceColor.ts → constants/surfaceColor.ts} +0 -5
  284. package/src/features/app-bar/adapters/inbound/AppBar.tsx +1 -1
  285. package/src/features/badge/adapters/inbound/Badge.tsx +1 -1
  286. package/src/features/button/adapters/inbound/Button.tsx +2 -2
  287. package/src/features/button/adapters/inbound/IconButton.tsx +1 -1
  288. package/src/features/card/adapters/inbound/Card.tsx +1 -1
  289. package/src/features/font/adapters/inbound/FontProvider.tsx +27 -0
  290. package/src/features/font/adapters/inbound/FontRuntimeContext.tsx +12 -0
  291. package/src/features/font/adapters/inbound/useFontRuntime.ts +9 -0
  292. package/src/features/font/public.ts +2 -0
  293. package/src/features/form/checkbox/adapters/inbound/Checkbox.tsx +2 -2
  294. package/src/features/form/radio/adapters/inbound/Radio.tsx +2 -2
  295. package/src/features/form/switch/adapters/inbound/Switch.tsx +1 -1
  296. package/src/features/form/text-input/adapters/inbound/TextInput.tsx +1 -1
  297. package/src/features/form/text-input/utils/resolveTextInputPresentation.ts +1 -1
  298. package/src/features/icon/adapters/inbound/Icon.tsx +2 -2
  299. package/src/features/image/adapters/inbound/Image.tsx +1 -1
  300. package/src/features/image/utils/resolveImageProps.test.ts +1 -1
  301. package/src/features/image/utils/resolveImageStyle.ts +2 -2
  302. package/src/features/layout/adapters/inbound/Grid.tsx +1 -1
  303. package/src/features/layout/adapters/inbound/ScrollView.tsx +1 -1
  304. package/src/features/layout/adapters/inbound/View.tsx +1 -1
  305. package/src/features/list/adapters/inbound/ListItem.tsx +2 -2
  306. package/src/features/modal/adapters/inbound/Modal.tsx +1 -1
  307. package/src/features/popover-menu/adapters/inbound/PopoverMenu.tsx +1 -1
  308. package/src/features/pressable/adapters/inbound/Pressable.tsx +1 -1
  309. package/src/features/surface/adapters/inbound/Surface.tsx +1 -1
  310. package/src/features/tabs/adapters/inbound/Tab.tsx +1 -1
  311. package/src/features/theme/adapters/inbound/ThemeProvider.tsx +46 -0
  312. package/src/features/theme/adapters/inbound/ThemeRuntimeContext.tsx +14 -0
  313. package/src/features/theme/adapters/inbound/ThemeScope.test.tsx +52 -0
  314. package/src/features/theme/adapters/inbound/ThemeScope.tsx +29 -0
  315. package/src/features/theme/adapters/inbound/useTheme.ts +9 -0
  316. package/src/features/theme/application/use-cases/createTheme.ts +71 -0
  317. package/src/{theme → features/theme/application/use-cases}/createThemeOverrides.test.ts +8 -9
  318. package/src/{theme → features/theme/application/use-cases}/createThemeValidation.test.ts +4 -2
  319. package/src/features/theme/constants.ts +68 -0
  320. package/src/{theme → features/theme/domain}/createSurfaceColorDiagnosticCollector.ts +4 -1
  321. package/src/{theme → features/theme/domain}/createSurfaceSemanticPolicy.ts +2 -2
  322. package/src/features/theme/domain/generatePalette.test.ts +294 -0
  323. package/src/{theme/colorEngine.ts → features/theme/domain/generatePalette.ts} +3 -30
  324. package/src/{theme → features/theme/domain}/inverseSemantics.test.ts +1 -1
  325. package/src/{theme → features/theme/domain}/resolveRoleSemantics.ts +2 -2
  326. package/src/features/theme/domain/resolveSemanticColors.ts +23 -0
  327. package/src/{theme → features/theme/domain}/resolveSurfaceSemanticModel.ts +4 -4
  328. package/src/{theme → features/theme}/public.test.ts +1 -1
  329. package/src/features/theme/public.ts +18 -0
  330. package/src/features/theme/runtime.test.ts +13 -0
  331. package/src/features/theme/runtime.ts +4 -0
  332. package/src/{theme → features/theme/utils}/resolveGlobalTokens.ts +2 -2
  333. package/src/{theme → features/theme/utils}/resolveHeadingTokenOverrides.ts +1 -1
  334. package/src/features/theme/utils/resolveToken.ts +16 -0
  335. package/src/{theme → features/theme/utils}/resolveWeightTokenOverrides.ts +12 -12
  336. package/src/features/toast/adapters/inbound/Toast.tsx +3 -3
  337. package/src/features/tooltip/adapters/inbound/Tooltip.tsx +1 -1
  338. package/src/features/typography/adapters/inbound/Heading.tsx +3 -30
  339. package/src/features/typography/adapters/inbound/Text.tsx +3 -23
  340. package/src/features/typography/utils/resolveHeadingTextStyle.test.ts +1 -1
  341. package/src/features/typography/utils/resolveHeadingTextStyle.ts +2 -2
  342. package/src/index.test.ts +19 -9
  343. package/src/index.ts +30 -15
  344. package/src/internal/resolvers/resolveControlSize.test.ts +1 -1
  345. package/src/internal/resolvers/resolveControlSize.ts +1 -1
  346. package/src/internal/resolvers/resolveFieldPresentation.ts +1 -1
  347. package/src/internal/resolvers/resolveIconSize.ts +1 -1
  348. package/src/internal/resolvers/resolveInteractiveColors.test.ts +1 -1
  349. package/src/internal/resolvers/resolveInteractiveColors.ts +2 -2
  350. package/src/internal/resolvers/resolveSelectionControlColors.test.ts +1 -1
  351. package/src/internal/resolvers/resolveSelectionControlColors.ts +2 -2
  352. package/src/internal/resolvers/resolveSurfaceColor.test.ts +1 -1
  353. package/src/internal/resolvers/resolveSurfaceColor.ts +2 -2
  354. package/src/internal/resolvers/resolveTextColor.test.ts +1 -1
  355. package/src/internal/resolvers/resolveTextColor.ts +2 -2
  356. package/src/internal/resolvers/resolveTextStyles.test.ts +1 -1
  357. package/src/internal/resolvers/resolveTextStyles.ts +1 -1
  358. package/src/structureOwnership.test.ts +16 -0
  359. package/src/types/accordion.ts +1 -1
  360. package/src/types/badge.ts +1 -1
  361. package/src/types/button.ts +1 -1
  362. package/src/types/checkbox.ts +1 -1
  363. package/src/types/font.ts +14 -0
  364. package/src/types/icon.ts +1 -1
  365. package/src/types/image.ts +1 -1
  366. package/src/types/interactionPolicy.test.ts +30 -0
  367. package/src/types/layout.ts +1 -1
  368. package/src/types/list.ts +1 -1
  369. package/src/types/modal.ts +1 -1
  370. package/src/types/popover.ts +1 -1
  371. package/src/types/popoverMenu.ts +1 -1
  372. package/src/types/pressable.ts +1 -1
  373. package/src/types/radio.ts +1 -1
  374. package/src/types/surfaceColor.test.ts +18 -0
  375. package/src/types/surfaceColor.ts +11 -0
  376. package/src/types/switch.ts +1 -1
  377. package/src/types/tabs.ts +1 -1
  378. package/src/types/text-input.ts +1 -1
  379. package/src/{theme/types.ts → types/theme.ts} +22 -13
  380. package/src/types/toast.ts +2 -2
  381. package/src/types/tooltip.ts +1 -1
  382. package/src/types/typography.ts +1 -1
  383. package/src/utils/resolveSpacing.ts +2 -2
  384. package/src/utils/resolveViewStyles.test.ts +1 -1
  385. package/src/utils/resolveViewStyles.ts +2 -2
  386. package/src/webAcceptance.test.tsx +1 -1
  387. package/dist/context/FontContext.d.ts +0 -20
  388. package/dist/context/FontContext.d.ts.map +0 -1
  389. package/dist/context/FontContext.js +0 -27
  390. package/dist/context/FontContext.js.map +0 -1
  391. package/dist/context/TranslationContext.d.ts +0 -22
  392. package/dist/context/TranslationContext.d.ts.map +0 -1
  393. package/dist/context/TranslationContext.js +0 -25
  394. package/dist/context/TranslationContext.js.map +0 -1
  395. package/dist/interactionPolicy.d.ts.map +0 -1
  396. package/dist/interactionPolicy.js.map +0 -1
  397. package/dist/surfaceColor.d.ts.map +0 -1
  398. package/dist/surfaceColor.js.map +0 -1
  399. package/dist/theme/ThemeContext.d.ts +0 -27
  400. package/dist/theme/ThemeContext.d.ts.map +0 -1
  401. package/dist/theme/ThemeContext.js +0 -59
  402. package/dist/theme/ThemeContext.js.map +0 -1
  403. package/dist/theme/colorEngine.d.ts +0 -16
  404. package/dist/theme/colorEngine.d.ts.map +0 -1
  405. package/dist/theme/colorEngine.js.map +0 -1
  406. package/dist/theme/createSurfaceColorDiagnosticCollector.d.ts.map +0 -1
  407. package/dist/theme/createSurfaceColorDiagnosticCollector.js.map +0 -1
  408. package/dist/theme/createSurfaceSemanticPolicy.d.ts.map +0 -1
  409. package/dist/theme/createSurfaceSemanticPolicy.js.map +0 -1
  410. package/dist/theme/createTheme.d.ts +0 -5
  411. package/dist/theme/createTheme.d.ts.map +0 -1
  412. package/dist/theme/createTheme.js +0 -49
  413. package/dist/theme/createTheme.js.map +0 -1
  414. package/dist/theme/defaultTokens.d.ts +0 -3
  415. package/dist/theme/defaultTokens.d.ts.map +0 -1
  416. package/dist/theme/defaultTokens.js.map +0 -1
  417. package/dist/theme/index.d.ts +0 -3
  418. package/dist/theme/index.d.ts.map +0 -1
  419. package/dist/theme/index.js +0 -3
  420. package/dist/theme/index.js.map +0 -1
  421. package/dist/theme/public.d.ts +0 -5
  422. package/dist/theme/public.d.ts.map +0 -1
  423. package/dist/theme/public.js +0 -5
  424. package/dist/theme/public.js.map +0 -1
  425. package/dist/theme/resolveGlobalTokens.d.ts.map +0 -1
  426. package/dist/theme/resolveGlobalTokens.js.map +0 -1
  427. package/dist/theme/resolveHeadingTokenOverrides.d.ts.map +0 -1
  428. package/dist/theme/resolveHeadingTokenOverrides.js.map +0 -1
  429. package/dist/theme/resolveNumericTokenOverrides.d.ts.map +0 -1
  430. package/dist/theme/resolveNumericTokenOverrides.js.map +0 -1
  431. package/dist/theme/resolveRoleSemantics.d.ts.map +0 -1
  432. package/dist/theme/resolveRoleSemantics.js.map +0 -1
  433. package/dist/theme/resolveSurfaceSemanticModel.d.ts.map +0 -1
  434. package/dist/theme/resolveSurfaceSemanticModel.js.map +0 -1
  435. package/dist/theme/resolveToken.d.ts.map +0 -1
  436. package/dist/theme/resolveToken.js +0 -19
  437. package/dist/theme/resolveToken.js.map +0 -1
  438. package/dist/theme/resolveWeightTokenOverrides.d.ts.map +0 -1
  439. package/dist/theme/resolveWeightTokenOverrides.js.map +0 -1
  440. package/dist/theme/surfaceColorPolicy.d.ts +0 -8
  441. package/dist/theme/surfaceColorPolicy.d.ts.map +0 -1
  442. package/dist/theme/surfaceColorPolicy.js +0 -8
  443. package/dist/theme/surfaceColorPolicy.js.map +0 -1
  444. package/dist/theme/types.d.ts.map +0 -1
  445. package/dist/theme/types.js +0 -2
  446. package/dist/theme/types.js.map +0 -1
  447. package/dist/utils/deepEqual.d.ts +0 -6
  448. package/dist/utils/deepEqual.d.ts.map +0 -1
  449. package/dist/utils/deepEqual.js +0 -36
  450. package/dist/utils/deepEqual.js.map +0 -1
  451. package/dist/utils/deepMerge.d.ts +0 -6
  452. package/dist/utils/deepMerge.d.ts.map +0 -1
  453. package/dist/utils/deepMerge.js +0 -26
  454. package/dist/utils/deepMerge.js.map +0 -1
  455. package/src/context/FontContext.tsx +0 -59
  456. package/src/context/TranslationContext.tsx +0 -50
  457. package/src/interactionPolicy.test.ts +0 -86
  458. package/src/surfaceColor.test.ts +0 -44
  459. package/src/theme/ThemeContext.tsx +0 -94
  460. package/src/theme/colorEngine.test.ts +0 -302
  461. package/src/theme/createTheme.ts +0 -60
  462. package/src/theme/defaultTokens.ts +0 -61
  463. package/src/theme/index.ts +0 -2
  464. package/src/theme/public.ts +0 -4
  465. package/src/theme/resolveToken.ts +0 -32
  466. package/src/theme/surfaceColorPolicy.ts +0 -7
  467. package/src/utils/deepEqual.ts +0 -34
  468. package/src/utils/deepMerge.test.ts +0 -113
  469. package/src/utils/deepMerge.ts +0 -29
  470. /package/dist/{surfaceColor.js → constants/surfaceColor.js} +0 -0
  471. /package/dist/{theme → features/theme/domain}/createSurfaceColorDiagnosticCollector.js +0 -0
  472. /package/dist/{theme → features/theme/domain}/resolveSurfaceSemanticModel.js +0 -0
  473. /package/dist/{theme → features/theme/utils}/resolveHeadingTokenOverrides.js +0 -0
  474. /package/dist/{theme → features/theme/utils}/resolveNumericTokenOverrides.d.ts +0 -0
  475. /package/dist/{theme → features/theme/utils}/resolveNumericTokenOverrides.js +0 -0
  476. /package/dist/{interactionPolicy.d.ts → types/interactionPolicy.d.ts} +0 -0
  477. /package/dist/{interactionPolicy.js → types/interactionPolicy.js} +0 -0
  478. /package/src/{theme → features/theme/utils}/resolveNumericTokenOverrides.ts +0 -0
  479. /package/src/{interactionPolicy.ts → types/interactionPolicy.ts} +0 -0
@@ -0,0 +1,13 @@
1
+ import { readFileSync } from 'node:fs';
2
+
3
+ import { describe, expect, it } from 'bun:test';
4
+
5
+ describe('theme runtime ownership', () => {
6
+ it('keeps nested scopes on the Surface runtime boundary without exposing raw context', () => {
7
+ const root = readFileSync(new URL('../../index.ts', import.meta.url), 'utf8');
8
+ const runtime = readFileSync(new URL('./runtime.ts', import.meta.url), 'utf8');
9
+ expect(root).toContain('ThemeProvider, ThemeScope, useTheme');
10
+ expect(root).not.toContain('ThemeContext');
11
+ expect(runtime).not.toContain('ThemeRuntimeContext');
12
+ });
13
+ });
@@ -0,0 +1,4 @@
1
+ export type { ThemeProviderProps, ThemeRuntime, ThemeScopeProps } from '../../types/theme';
2
+ export { ThemeProvider } from './adapters/inbound/ThemeProvider';
3
+ export { ThemeScope } from './adapters/inbound/ThemeScope';
4
+ export { useTheme } from './adapters/inbound/useTheme';
@@ -1,10 +1,10 @@
1
1
  import type { ThemeGlobalTokenOverrides } from '@ankhorage/contracts';
2
2
 
3
- import { DEFAULT_TOKENS } from './defaultTokens';
3
+ import type { ThemeTokens } from '../../../types/theme';
4
+ import { DEFAULT_TOKENS } from '../constants';
4
5
  import { resolveHeadingTokenOverrides } from './resolveHeadingTokenOverrides';
5
6
  import { resolveNumericTokenOverrides } from './resolveNumericTokenOverrides';
6
7
  import { resolveWeightTokenOverrides } from './resolveWeightTokenOverrides';
7
- import type { ThemeTokens } from './types';
8
8
 
9
9
  type GlobalThemeTokens = Omit<
10
10
  ThemeTokens,
@@ -1,6 +1,6 @@
1
1
  import type { ThemeTypographyHeadingOverrides } from '@ankhorage/contracts';
2
2
 
3
- import type { ThemeTokens } from './types';
3
+ import type { ThemeTokens } from '../../../types/theme';
4
4
 
5
5
  type HeadingTokens = ThemeTokens['typography']['headings'];
6
6
  type HeadingToken = HeadingTokens[1];
@@ -0,0 +1,16 @@
1
+ /*** Resolve a theme token key through its map while preserving raw values. */
2
+ type ResolvedToken<TMap, TValue> = TValue extends keyof TMap ? TMap[TValue] : TValue;
3
+
4
+ /*** Resolve a mapped theme token or return the supplied raw value unchanged. */
5
+ export function resolveToken<
6
+ TMap extends Record<string | number, unknown>,
7
+ TValue extends string | number | undefined,
8
+ >(map: TMap, value: TValue): ResolvedToken<TMap, TValue> {
9
+ if (value === undefined) return undefined as ResolvedToken<TMap, TValue>;
10
+
11
+ if (Object.prototype.hasOwnProperty.call(map, value)) {
12
+ return map[value as keyof TMap] as ResolvedToken<TMap, TValue>;
13
+ }
14
+
15
+ return value as ResolvedToken<TMap, TValue>;
16
+ }
@@ -1,4 +1,4 @@
1
- import type { FontWeight } from './types';
1
+ import type { FontWeight } from '../../../types/theme';
2
2
 
3
3
  const WEIGHT_TOKEN_KEYS = new Set<string>([
4
4
  'thin',
@@ -30,17 +30,17 @@ export function resolveWeightTokenOverrides(
30
30
  ): Readonly<Record<string, FontWeight>> {
31
31
  if (overrides === undefined) return {};
32
32
 
33
- const resolved: Record<string, FontWeight> = {};
34
- for (const [token, value] of Object.entries(overrides)) {
35
- if (!WEIGHT_TOKEN_KEYS.has(token)) {
36
- throw new RangeError(`Unknown typography weight token: ${token}.`);
37
- }
38
- if (!isFontWeight(value)) {
39
- throw new RangeError(`Invalid font weight for typography.weights.${token}: ${value}.`);
40
- }
41
- resolved[token] = value;
42
- }
43
- return resolved;
33
+ return Object.fromEntries(
34
+ Object.entries(overrides).map(([token, value]) => {
35
+ if (!WEIGHT_TOKEN_KEYS.has(token)) {
36
+ throw new RangeError(`Unknown typography weight token: ${token}.`);
37
+ }
38
+ if (!isFontWeight(value)) {
39
+ throw new RangeError(`Invalid font weight for typography.weights.${token}: ${value}.`);
40
+ }
41
+ return [token, value] as const;
42
+ }),
43
+ );
44
44
  }
45
45
 
46
46
  function isFontWeight(value: string): value is FontWeight {
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
  import { Pressable, StyleSheet, type ViewStyle } from 'react-native';
3
3
 
4
- import type { SurfaceColor } from '../../../../surfaceColor';
5
- import { useTheme } from '../../../../theme/ThemeContext';
6
- import type { SurfaceTheme } from '../../../../theme/types';
4
+ import type { SurfaceColor } from '../../../../types/surfaceColor';
5
+ import type { SurfaceTheme } from '../../../../types/theme';
7
6
  import type { ToastProps } from '../../../../types/toast';
8
7
  import { View } from '../../../layout/public';
9
8
  import { Surface } from '../../../surface/public';
9
+ import { useTheme } from '../../../theme/runtime';
10
10
  import { Text } from '../../../typography/public';
11
11
 
12
12
  /*** Renders one transient toast notification. */
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { Platform, Pressable, View } from 'react-native';
3
3
 
4
- import { useTheme } from '../../../../theme/ThemeContext';
5
4
  import type { TooltipProps } from '../../../../types/tooltip';
6
5
  import { Popover } from '../../../popover/public';
7
6
  import { Surface } from '../../../surface/public';
7
+ import { useTheme } from '../../../theme/runtime';
8
8
  import { Text } from '../../../typography/public';
9
9
  import { useTooltipVisibility } from '../../composition/useTooltipVisibility';
10
10
 
@@ -1,12 +1,11 @@
1
1
  import React from 'react';
2
2
  import { Text as ReactNativeText } from 'react-native';
3
3
 
4
- import { useTranslationContext } from '../../../../context/TranslationContext';
5
- import { useTheme } from '../../../../theme/ThemeContext';
6
4
  import type { HeadingProps } from '../../../../types/typography';
5
+ import { useTheme } from '../../../theme/runtime';
7
6
  import { resolveHeadingTextStyle } from '../../utils/resolveHeadingTextStyle';
8
7
 
9
- /*** Renders a semantic, translatable heading using Surface typography tokens. */
8
+ /*** Renders a semantic heading using Surface typography tokens. */
10
9
  export function Heading({
11
10
  text,
12
11
  children,
@@ -15,12 +14,10 @@ export function Heading({
15
14
  color,
16
15
  emphasis = 'default',
17
16
  numberOfLines,
18
- i18nKey,
19
17
  testID,
20
18
  }: HeadingProps) {
21
19
  const { theme } = useTheme();
22
- const { t } = useTranslationContext();
23
- const content = resolveHeadingContent({ text, children, i18nKey, translate: t });
20
+ const content = text ?? children;
24
21
 
25
22
  return (
26
23
  <ReactNativeText
@@ -33,27 +30,3 @@ export function Heading({
33
30
  </ReactNativeText>
34
31
  );
35
32
  }
36
-
37
- /*** Resolves authored or translated heading content without mutating source input. */
38
- function resolveHeadingContent({
39
- text,
40
- children,
41
- i18nKey,
42
- translate,
43
- }: {
44
- text: HeadingProps['text'];
45
- children: HeadingProps['children'];
46
- i18nKey: HeadingProps['i18nKey'];
47
- translate: (key: string) => string;
48
- }) {
49
- const content = text ?? children;
50
- if (!i18nKey) return content;
51
-
52
- try {
53
- const translated = translate(i18nKey);
54
- return translated && translated !== i18nKey ? translated : content;
55
- } catch (error) {
56
- console.warn('[Heading] Translation error:', error);
57
- return content;
58
- }
59
- }
@@ -1,12 +1,11 @@
1
1
  import React from 'react';
2
2
  import { Text as ReactNativeText } from 'react-native';
3
3
 
4
- import { useTranslationContext } from '../../../../context/TranslationContext';
5
4
  import { resolveTextColor, resolveTextStyles } from '../../../../internal/resolvers';
6
- import { useTheme } from '../../../../theme/ThemeContext';
7
5
  import type { TextProps } from '../../../../types/typography';
6
+ import { useTheme } from '../../../theme/runtime';
8
7
 
9
- /*** Renders translatable body text using Surface semantic typography. */
8
+ /*** Renders body text using Surface semantic typography. */
10
9
  export function Text({
11
10
  children,
12
11
  i18nKey,
@@ -20,8 +19,7 @@ export function Text({
20
19
  testID,
21
20
  }: TextProps) {
22
21
  const { theme } = useTheme();
23
- const { t } = useTranslationContext();
24
- const content = resolveTextContent(children, i18nKey, t);
22
+ const content = children ?? i18nKey ?? null;
25
23
 
26
24
  return (
27
25
  <ReactNativeText
@@ -36,21 +34,3 @@ export function Text({
36
34
  </ReactNativeText>
37
35
  );
38
36
  }
39
-
40
- /*** Resolves authored or translated Text content with a stable fallback. */
41
- function resolveTextContent(
42
- children: TextProps['children'],
43
- i18nKey: TextProps['i18nKey'],
44
- translate: (key: string) => string,
45
- ) {
46
- if (children !== undefined) return children;
47
- if (!i18nKey) return null;
48
-
49
- try {
50
- const translated = translate(i18nKey);
51
- return translated && translated !== i18nKey ? translated : i18nKey;
52
- } catch (error) {
53
- console.warn('[Text] Translation error:', error);
54
- return i18nKey;
55
- }
56
- }
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'bun:test';
2
2
 
3
- import { createTheme } from '../../../theme/createTheme';
3
+ import { createTheme } from '../../theme/application/use-cases/createTheme';
4
4
  import { resolveHeadingTextStyle } from './resolveHeadingTextStyle';
5
5
 
6
6
  describe('resolveHeadingTextStyle', () => {
@@ -2,8 +2,8 @@ import type { TextStyle } from 'react-native';
2
2
 
3
3
  import { resolveTextColor } from '../../../internal/resolvers/resolveTextColor';
4
4
  import { resolveTextStyles } from '../../../internal/resolvers/resolveTextStyles';
5
- import type { SurfaceColor, SurfaceEmphasis } from '../../../surfaceColor';
6
- import type { SurfaceTheme } from '../../../theme/types';
5
+ import type { SurfaceColor, SurfaceEmphasis } from '../../../types/surfaceColor';
6
+ import type { SurfaceTheme } from '../../../types/theme';
7
7
  import type { HeadingLevel, HeadingProps } from '../../../types/typography';
8
8
 
9
9
  /*** Resolves theme-driven typography styles for one heading level. */
package/src/index.test.ts CHANGED
@@ -2,8 +2,8 @@ import { readFileSync } from 'node:fs';
2
2
 
3
3
  import { describe, expect, it } from 'bun:test';
4
4
 
5
- import type { SelectionSemantics, SurfaceColorDiagnostics } from './index';
6
- import { createTheme } from './theme/createTheme';
5
+ import type { SelectionSemantics, SurfaceColorDiagnostics } from './features/theme/public';
6
+ import { createTheme } from './features/theme/public';
7
7
 
8
8
  const indexSource = readFileSync(new URL('./index.ts', import.meta.url), 'utf8');
9
9
  const packageJson = JSON.parse(
@@ -43,8 +43,10 @@ const expectedFeatureRootExports = [
43
43
  ] as const;
44
44
 
45
45
  const expectedCrossCuttingRootExports = [
46
- "export type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';",
46
+ "export type { InteractionPolicy, InteractionPolicyProps } from './types/interactionPolicy';",
47
47
  "export * from './core/responsive';",
48
+ "export { FontProvider } from './features/font/public';",
49
+ "export { ThemeProvider, ThemeScope, useTheme } from './features/theme/runtime';",
48
50
  ] as const;
49
51
 
50
52
  describe('feature-owned root barrel contract', () => {
@@ -127,13 +129,21 @@ describe('public package metadata contract', () => {
127
129
  import: './dist/features/bottom-sheet/public.js',
128
130
  types: './dist/features/bottom-sheet/public.d.ts',
129
131
  },
132
+ './color': {
133
+ bun: './src/constants/surfaceColor.ts',
134
+ 'react-native': './src/constants/surfaceColor.ts',
135
+ browser: './src/constants/surfaceColor.ts',
136
+ default: './dist/constants/surfaceColor.js',
137
+ import: './dist/constants/surfaceColor.js',
138
+ types: './dist/constants/surfaceColor.d.ts',
139
+ },
130
140
  './theme': {
131
- bun: './src/theme/public.ts',
132
- 'react-native': './src/theme/public.ts',
133
- browser: './src/theme/public.ts',
134
- default: './dist/theme/public.js',
135
- import: './dist/theme/public.js',
136
- types: './dist/theme/public.d.ts',
141
+ bun: './src/features/theme/public.ts',
142
+ 'react-native': './src/features/theme/public.ts',
143
+ browser: './src/features/theme/public.ts',
144
+ default: './dist/features/theme/public.js',
145
+ import: './dist/features/theme/public.js',
146
+ types: './dist/features/theme/public.d.ts',
137
147
  },
138
148
  './package.json': './package.json',
139
149
  });
package/src/index.ts CHANGED
@@ -1,7 +1,9 @@
1
- export type { FontRuntime } from './context/FontContext';
2
- export { FontProvider, useFontContext } from './context/FontContext';
3
- export type { I18nInstance, TranslationRuntime, Translator } from './context/TranslationContext';
4
- export { TranslationProvider, useTranslationContext } from './context/TranslationContext';
1
+ export {
2
+ SURFACE_COLORS,
3
+ SURFACE_EMPHASES,
4
+ SURFACE_PALETTE_COLORS,
5
+ SURFACE_STATUS_COLORS,
6
+ } from './constants/surfaceColor';
5
7
  export * from './core/responsive';
6
8
  export type {
7
9
  AccordionContentProps,
@@ -26,6 +28,8 @@ export type { ButtonIconSpec, ButtonProps, IconButtonProps } from './features/bu
26
28
  export { Button, IconButton } from './features/button/public';
27
29
  export type { CardProps } from './features/card/public';
28
30
  export { Card } from './features/card/public';
31
+ export type { FontProviderProps, FontRuntime } from './features/font/public';
32
+ export { FontProvider } from './features/font/public';
29
33
  export type { CheckboxProps } from './features/form/checkbox/public';
30
34
  export { Checkbox } from './features/form/checkbox/public';
31
35
  export type { FieldProps } from './features/form/field/public';
@@ -76,6 +80,26 @@ export type { SurfaceProps, SurfaceVariant } from './features/surface/public';
76
80
  export { Surface } from './features/surface/public';
77
81
  export type { TabListProps, TabPanelProps, TabProps, TabsProps } from './features/tabs/public';
78
82
  export { Tab, TabList, TabPanel, Tabs } from './features/tabs/public';
83
+ export type {
84
+ ActionSemantics,
85
+ BorderSemantics,
86
+ ContentSemantics,
87
+ FontWeight,
88
+ NeutralSemantics,
89
+ RoleSemantics,
90
+ SelectionSemantics,
91
+ SurfaceColorDiagnostics,
92
+ SurfaceColorSelectionDiagnostic,
93
+ SurfaceContrastDiagnostic,
94
+ SurfaceSemantics,
95
+ SurfaceTheme,
96
+ ThemeMode,
97
+ ThemeSemantics,
98
+ ThemeTokens,
99
+ } from './features/theme/public';
100
+ export { createTheme } from './features/theme/public';
101
+ export type { ThemeProviderProps, ThemeRuntime, ThemeScopeProps } from './features/theme/runtime';
102
+ export { ThemeProvider, ThemeScope, useTheme } from './features/theme/runtime';
79
103
  export type {
80
104
  ToastController,
81
105
  ToastOptions,
@@ -88,19 +112,10 @@ export type { TooltipProps } from './features/tooltip/public';
88
112
  export { Tooltip } from './features/tooltip/public';
89
113
  export type { HeadingLevel, HeadingProps, TextProps } from './features/typography/public';
90
114
  export { Heading, Text } from './features/typography/public';
91
- export type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';
115
+ export type { InteractionPolicy, InteractionPolicyProps } from './types/interactionPolicy';
92
116
  export type {
93
117
  SurfaceColor,
94
118
  SurfaceEmphasis,
95
119
  SurfacePaletteColor,
96
120
  SurfaceStatusColor,
97
- } from './surfaceColor';
98
- export {
99
- SURFACE_COLORS,
100
- SURFACE_EMPHASES,
101
- SURFACE_PALETTE_COLORS,
102
- SURFACE_STATUS_COLORS,
103
- } from './surfaceColor';
104
- export * from './theme';
105
- export { isDeepEqual } from './utils/deepEqual';
106
- export { deepMerge } from './utils/deepMerge';
121
+ } from './types/surfaceColor';
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'bun:test';
2
2
 
3
- import { createTheme } from '../../theme/createTheme';
3
+ import { createTheme } from '../../features/theme/application/use-cases/createTheme';
4
4
  import { resolveControlSize } from './resolveControlSize';
5
5
 
6
6
  describe('resolveControlSize', () => {
@@ -1,4 +1,4 @@
1
- import type { SurfaceTheme } from '../../theme/types';
1
+ import type { SurfaceTheme } from '../../types/theme';
2
2
 
3
3
  export type ControlSize = 's' | 'm' | 'l';
4
4
 
@@ -1,4 +1,4 @@
1
- import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
1
+ import type { SurfaceColor, SurfaceEmphasis } from '../../types/surfaceColor';
2
2
  import type { FieldState } from './resolveFieldState';
3
3
 
4
4
  export interface ResolvedFieldPresentation {
@@ -1,4 +1,4 @@
1
- import type { SurfaceTheme } from '../../theme/types';
1
+ import type { SurfaceTheme } from '../../types/theme';
2
2
  import { type ControlSize, resolveControlSize } from './resolveControlSize';
3
3
 
4
4
  export function resolveIconSize(theme: SurfaceTheme, size: ControlSize = 'm'): number {
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'bun:test';
2
2
 
3
- import { createTheme } from '../../theme/createTheme';
3
+ import { createTheme } from '../../features/theme/application/use-cases/createTheme';
4
4
  import { resolveFieldState } from './resolveFieldState';
5
5
  import { resolveButtonColors, resolveInputColors } from './resolveInteractiveColors';
6
6
 
@@ -1,5 +1,5 @@
1
- import type { SurfaceColor } from '../../surfaceColor';
2
- import type { SurfaceTheme } from '../../theme/types';
1
+ import type { SurfaceColor } from '../../types/surfaceColor';
2
+ import type { SurfaceTheme } from '../../types/theme';
3
3
  import type { FieldState } from './resolveFieldState';
4
4
  import type { InteractionState } from './resolveInteractiveState';
5
5
  import { resolveSurfaceColor } from './resolveSurfaceColor';
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'bun:test';
2
2
 
3
- import { createTheme } from '../../theme/createTheme';
3
+ import { createTheme } from '../../features/theme/application/use-cases/createTheme';
4
4
  import { resolveFieldState } from './resolveFieldState';
5
5
  import { resolveSelectionControlColors } from './resolveSelectionControlColors';
6
6
 
@@ -1,5 +1,5 @@
1
- import type { SurfaceColor } from '../../surfaceColor';
2
- import type { SurfaceTheme } from '../../theme/types';
1
+ import type { SurfaceColor } from '../../types/surfaceColor';
2
+ import type { SurfaceTheme } from '../../types/theme';
3
3
  import type { FieldState } from './resolveFieldState';
4
4
  import { resolveSurfaceColor } from './resolveSurfaceColor';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'bun:test';
2
2
 
3
- import { createTheme } from '../../theme/createTheme';
3
+ import { createTheme } from '../../features/theme/application/use-cases/createTheme';
4
4
  import { resolveSurfaceColor } from './resolveSurfaceColor';
5
5
 
6
6
  describe('resolveSurfaceColor', () => {
@@ -1,5 +1,5 @@
1
- import type { SurfaceColor } from '../../surfaceColor';
2
- import type { RoleSemantics, SurfaceTheme } from '../../theme/types';
1
+ import type { SurfaceColor } from '../../types/surfaceColor';
2
+ import type { RoleSemantics, SurfaceTheme } from '../../types/theme';
3
3
 
4
4
  export function resolveSurfaceColor(
5
5
  theme: SurfaceTheme,
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'bun:test';
2
2
 
3
- import { createTheme } from '../../theme/createTheme';
3
+ import { createTheme } from '../../features/theme/application/use-cases/createTheme';
4
4
  import { resolveTextColor } from './resolveTextColor';
5
5
 
6
6
  describe('resolveTextColor', () => {
@@ -1,5 +1,5 @@
1
- import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
2
- import type { SurfaceTheme } from '../../theme/types';
1
+ import type { SurfaceColor, SurfaceEmphasis } from '../../types/surfaceColor';
2
+ import type { SurfaceTheme } from '../../types/theme';
3
3
  import { resolveSurfaceColor } from './resolveSurfaceColor';
4
4
 
5
5
  export function resolveTextColor(
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'bun:test';
2
2
 
3
- import { createTheme } from '../../theme/createTheme';
3
+ import { createTheme } from '../../features/theme/application/use-cases/createTheme';
4
4
  import { resolveTextStyles } from './resolveTextStyles';
5
5
 
6
6
  describe('resolveTextStyles', () => {
@@ -1,6 +1,6 @@
1
1
  import type { TextStyle } from 'react-native';
2
2
 
3
- import type { FontWeight, SurfaceTheme } from '../../theme/types';
3
+ import type { FontWeight, SurfaceTheme } from '../../types/theme';
4
4
 
5
5
  export type TextVariant = 'body' | 'bodySmall' | 'caption' | 'label' | 'mono';
6
6
  export type TextWeight = keyof SurfaceTheme['typography']['weights'] | FontWeight;
@@ -0,0 +1,16 @@
1
+ import { existsSync } from 'node:fs';
2
+
3
+ import { describe, expect, it } from 'bun:test';
4
+
5
+ describe('canonical Surface ownership', () => {
6
+ it('does not retain superseded technical roots or local generic deep utilities', () => {
7
+ const src = new URL('.', import.meta.url);
8
+ expect(existsSync(new URL('./context', src))).toBe(false);
9
+ expect(existsSync(new URL('./theme', src))).toBe(false);
10
+ expect(existsSync(new URL('./contracts', src))).toBe(false);
11
+ expect(existsSync(new URL('./interactionPolicy.ts', src))).toBe(false);
12
+ expect(existsSync(new URL('./surfaceColor.ts', src))).toBe(false);
13
+ expect(existsSync(new URL('./utils/deepEqual.ts', src))).toBe(false);
14
+ expect(existsSync(new URL('./utils/deepMerge.ts', src))).toBe(false);
15
+ });
16
+ });
@@ -1,7 +1,7 @@
1
1
  import type React from 'react';
2
2
  import type { PressableProps, ViewProps } from 'react-native';
3
3
 
4
- import type { InteractionPolicy, InteractionPolicyProps } from '../interactionPolicy';
4
+ import type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';
5
5
 
6
6
  export type AccordionMode = 'single' | 'multiple';
7
7
 
@@ -2,7 +2,7 @@ import type React from 'react';
2
2
 
3
3
  import type { ControlSize } from '../internal/resolvers/resolveControlSize';
4
4
  import type { ButtonVariant } from '../internal/resolvers/resolveInteractiveColors';
5
- import type { SurfaceColor } from '../surfaceColor';
5
+ import type { SurfaceColor } from './surfaceColor';
6
6
 
7
7
  export interface BadgeProps {
8
8
  content?: React.ReactNode;
@@ -2,9 +2,9 @@ import type React from 'react';
2
2
 
3
3
  import type { ControlSize } from '../internal/resolvers/resolveControlSize';
4
4
  import type { ButtonVariant } from '../internal/resolvers/resolveInteractiveColors';
5
- import type { SurfaceColor } from '../surfaceColor';
6
5
  import type { IconSource } from './icon';
7
6
  import type { PressableProps } from './pressable';
7
+ import type { SurfaceColor } from './surfaceColor';
8
8
 
9
9
  export type ButtonIconSpec = IconSource;
10
10
 
@@ -1,8 +1,8 @@
1
1
  import type React from 'react';
2
2
 
3
3
  import type { ControlSize } from '../internal/resolvers/resolveControlSize';
4
- import type { SurfaceColor } from '../surfaceColor';
5
4
  import type { PressableProps } from './pressable';
5
+ import type { SurfaceColor } from './surfaceColor';
6
6
 
7
7
  export interface CheckboxProps extends Omit<
8
8
  PressableProps,
@@ -0,0 +1,14 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export interface FontRuntime {
4
+ fontsLoaded: boolean;
5
+ activeFontId: string | null;
6
+ setActiveFontId: (id: string) => void;
7
+ }
8
+
9
+ export interface FontProviderProps {
10
+ fontsLoaded: boolean;
11
+ activeFontId?: string | null;
12
+ children: ReactNode;
13
+ onActiveFontChange?: (id: string) => void;
14
+ }
package/src/types/icon.ts CHANGED
@@ -13,8 +13,8 @@ import type { IoniconsIconName } from '@react-native-vector-icons/ionicons/stati
13
13
  import type { MaterialDesignIconsIconName } from '@react-native-vector-icons/material-design-icons/static';
14
14
  import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
15
15
 
16
- import type { SurfaceTheme } from '../theme/types';
17
16
  import type { SurfaceImageSource } from './image';
17
+ import type { SurfaceTheme } from './theme';
18
18
 
19
19
  export type IconProvider =
20
20
  'Ionicons' | 'FontAwesome' | 'FontAwesome5' | 'FontAwesome6' | 'MaterialDesignIcons';
@@ -6,7 +6,7 @@ import type {
6
6
  StyleProp,
7
7
  } from 'react-native';
8
8
 
9
- import type { SurfaceTheme } from '../theme/types';
9
+ import type { SurfaceTheme } from './theme';
10
10
 
11
11
  export type SurfaceImageSource = string | ImageSourcePropType;
12
12
  export type ImageFit = ImageResizeMode;
@@ -0,0 +1,30 @@
1
+ import { readFileSync } from 'node:fs';
2
+
3
+ import { describe, expect, it } from 'bun:test';
4
+
5
+ import type { PressableProps } from '../features/pressable/public';
6
+ import type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';
7
+
8
+ const indexSource = readFileSync(new URL('../index.ts', import.meta.url), 'utf8');
9
+
10
+ describe('InteractionPolicy ownership', () => {
11
+ it('exports the policy types from the public root', () => {
12
+ expect(indexSource).toContain(
13
+ "export type { InteractionPolicy, InteractionPolicyProps } from './types/interactionPolicy';",
14
+ );
15
+ });
16
+
17
+ it('keeps the allowed policy values explicit', () => {
18
+ const enabled: InteractionPolicy = 'enabled';
19
+ const passive: InteractionPolicy = 'passive';
20
+
21
+ expect([enabled, passive]).toEqual(['enabled', 'passive']);
22
+ });
23
+
24
+ it('shares the owned policy contract with PressableProps', () => {
25
+ const policyProps: InteractionPolicyProps = { interactionPolicy: 'passive' };
26
+ const pressableProps: PressableProps = policyProps;
27
+
28
+ expect(pressableProps.interactionPolicy).toBe('passive');
29
+ });
30
+ });
@@ -7,7 +7,7 @@ import type {
7
7
  } from 'react-native';
8
8
 
9
9
  import type { Responsive } from '../core/responsive';
10
- import type { SurfaceTheme } from '../theme/types';
10
+ import type { SurfaceTheme } from './theme';
11
11
 
12
12
  type SpaceToken = keyof SurfaceTheme['spacing'];
13
13
  type RadiusToken = keyof SurfaceTheme['radii'];