@ankhorage/zora 27.3.9 → 27.4.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 (305) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/features/color/ColorHueScale.d.ts +4 -0
  4. package/dist/features/color/ColorHueScale.d.ts.map +1 -0
  5. package/dist/features/color/ColorHueScale.js +22 -0
  6. package/dist/features/color/ColorHueScale.js.map +1 -0
  7. package/dist/features/color/ColorPicker.d.ts +5 -0
  8. package/dist/features/color/ColorPicker.d.ts.map +1 -0
  9. package/dist/features/color/ColorPicker.js +48 -0
  10. package/dist/features/color/ColorPicker.js.map +1 -0
  11. package/dist/features/color/ColorTone.d.ts +5 -0
  12. package/dist/features/color/ColorTone.d.ts.map +1 -0
  13. package/dist/features/color/ColorTone.js +65 -0
  14. package/dist/features/color/ColorTone.js.map +1 -0
  15. package/dist/features/color/ColorWheel.d.ts +5 -0
  16. package/dist/features/color/ColorWheel.d.ts.map +1 -0
  17. package/dist/features/color/ColorWheel.js +125 -0
  18. package/dist/features/color/ColorWheel.js.map +1 -0
  19. package/dist/features/color/ColorWheelKeyboardProxy.d.ts +10 -0
  20. package/dist/features/color/ColorWheelKeyboardProxy.d.ts.map +1 -0
  21. package/dist/features/color/ColorWheelKeyboardProxy.js +2 -0
  22. package/dist/features/color/ColorWheelKeyboardProxy.js.map +1 -0
  23. package/dist/features/color/ColorWheelKeyboardProxy.native.d.ts +4 -0
  24. package/dist/features/color/ColorWheelKeyboardProxy.native.d.ts.map +1 -0
  25. package/dist/features/color/ColorWheelKeyboardProxy.native.js +17 -0
  26. package/dist/features/color/ColorWheelKeyboardProxy.native.js.map +1 -0
  27. package/dist/features/color/ColorWheelKeyboardProxy.web.d.ts +5 -0
  28. package/dist/features/color/ColorWheelKeyboardProxy.web.d.ts.map +1 -0
  29. package/dist/features/color/ColorWheelKeyboardProxy.web.js +29 -0
  30. package/dist/features/color/ColorWheelKeyboardProxy.web.js.map +1 -0
  31. package/dist/features/color/public.d.ts +6 -0
  32. package/dist/features/color/public.d.ts.map +1 -0
  33. package/dist/features/color/public.js +5 -0
  34. package/dist/features/color/public.js.map +1 -0
  35. package/dist/features/color/utils/resolveColorAtHue.d.ts +4 -0
  36. package/dist/features/color/utils/resolveColorAtHue.d.ts.map +1 -0
  37. package/dist/features/color/utils/resolveColorAtHue.js +12 -0
  38. package/dist/features/color/utils/resolveColorAtHue.js.map +1 -0
  39. package/dist/features/color/utils/resolveColorHue.d.ts +4 -0
  40. package/dist/features/color/utils/resolveColorHue.d.ts.map +1 -0
  41. package/dist/features/color/utils/resolveColorHue.js +8 -0
  42. package/dist/features/color/utils/resolveColorHue.js.map +1 -0
  43. package/dist/features/color/utils/resolveOklchColor.d.ts +5 -0
  44. package/dist/features/color/utils/resolveOklchColor.d.ts.map +1 -0
  45. package/dist/features/color/utils/resolveOklchColor.js +10 -0
  46. package/dist/features/color/utils/resolveOklchColor.js.map +1 -0
  47. package/dist/features/color/utils/resolveWheelColor.d.ts +4 -0
  48. package/dist/features/color/utils/resolveWheelColor.d.ts.map +1 -0
  49. package/dist/features/color/utils/resolveWheelColor.js +17 -0
  50. package/dist/features/color/utils/resolveWheelColor.js.map +1 -0
  51. package/dist/features/color/utils/resolveWheelColorComponents.d.ts +7 -0
  52. package/dist/features/color/utils/resolveWheelColorComponents.d.ts.map +1 -0
  53. package/dist/features/color/utils/resolveWheelColorComponents.js +11 -0
  54. package/dist/features/color/utils/resolveWheelColorComponents.js.map +1 -0
  55. package/dist/features/graph-view/adapters/inbound/web-artifact/GraphView.d.ts.map +1 -1
  56. package/dist/features/graph-view/adapters/inbound/web-artifact/GraphView.js +11 -7
  57. package/dist/features/graph-view/adapters/inbound/web-artifact/GraphView.js.map +1 -1
  58. package/dist/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.d.ts +2 -2
  59. package/dist/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.d.ts.map +1 -1
  60. package/dist/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.js +7 -7
  61. package/dist/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.js.map +1 -1
  62. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.d.ts +7 -0
  63. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.d.ts.map +1 -0
  64. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.js +40 -0
  65. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.js.map +1 -0
  66. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.d.ts +1 -1
  67. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.d.ts.map +1 -1
  68. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js +28 -4
  69. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js.map +1 -1
  70. package/dist/features/selection/application/resolveSelectionEventIntent.d.ts +1 -1
  71. package/dist/features/selection/application/resolveSelectionEventIntent.d.ts.map +1 -1
  72. package/dist/features/selection/application/resolveSelectionEventIntent.js +14 -5
  73. package/dist/features/selection/application/resolveSelectionEventIntent.js.map +1 -1
  74. package/dist/index.d.ts +2 -0
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +1 -0
  77. package/dist/index.js.map +1 -1
  78. package/dist/types/color.d.ts +70 -0
  79. package/dist/types/color.d.ts.map +1 -0
  80. package/dist/types/color.js +2 -0
  81. package/dist/types/color.js.map +1 -0
  82. package/package.json +3 -1
  83. package/src/audit.test.ts +3 -3
  84. package/src/features/color/ColorHueScale.tsx +57 -0
  85. package/src/features/color/ColorPicker.tsx +105 -0
  86. package/src/features/color/ColorTone.tsx +137 -0
  87. package/src/features/color/ColorWheel.tsx +251 -0
  88. package/src/features/color/ColorWheelKeyboardProxy.native.tsx +34 -0
  89. package/src/features/color/ColorWheelKeyboardProxy.tsx +11 -0
  90. package/src/features/color/ColorWheelKeyboardProxy.web.tsx +47 -0
  91. package/src/features/color/public.ts +17 -0
  92. package/src/features/color/utils/colorMath.test.ts +37 -0
  93. package/src/features/color/utils/resolveColorAtHue.ts +14 -0
  94. package/src/features/color/utils/resolveColorHue.ts +10 -0
  95. package/src/features/color/utils/resolveOklchColor.ts +13 -0
  96. package/src/features/color/utils/resolveWheelColor.ts +28 -0
  97. package/src/features/color/utils/resolveWheelColorComponents.ts +16 -0
  98. package/src/features/graph-view/adapters/inbound/web-artifact/GraphView.tsx +16 -4
  99. package/src/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.ts +24 -4
  100. package/src/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.test.ts +28 -0
  101. package/src/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.ts +48 -0
  102. package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.test.ts +16 -6
  103. package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.ts +34 -3
  104. package/src/features/selection/application/resolveSelectionEventIntent.test.ts +1 -0
  105. package/src/features/selection/application/resolveSelectionEventIntent.ts +18 -4
  106. package/src/index.ts +14 -0
  107. package/src/types/color.ts +75 -0
  108. package/src/webPackageExports.test.ts +15 -0
  109. package/web-dist/authoring/index.js +6 -5
  110. package/web-dist/chunks/{Accordion-5w8chhxm.js → Accordion-001ymezm.js} +3 -63
  111. package/web-dist/chunks/{Accordion-2d5jdxeg.js → Accordion-01s50nga.js} +2 -2
  112. package/web-dist/chunks/{Accordion-dhnd347t.js → Accordion-09jkcm1x.js} +695 -4591
  113. package/web-dist/chunks/Accordion-0z2t95zw.js +548 -0
  114. package/web-dist/chunks/{Accordion-z1k4wg10.js → Accordion-120nmpbe.js} +3 -3
  115. package/web-dist/chunks/{Accordion-zrn4dy6s.js → Accordion-401452az.js} +6 -6
  116. package/web-dist/chunks/{Accordion-yy6qy5y2.js → Accordion-44bcsg35.js} +6 -6
  117. package/web-dist/chunks/{Accordion-5hvq2r84.js → Accordion-49m38edd.js} +4 -4
  118. package/web-dist/chunks/{Accordion-x4bpna1q.js → Accordion-49mzcav8.js} +4 -4
  119. package/web-dist/chunks/{Accordion-h3r90b65.js → Accordion-52a3dpsm.js} +4 -4
  120. package/web-dist/chunks/{Accordion-bhr3r525.js → Accordion-549akrjn.js} +4 -4
  121. package/web-dist/chunks/{Accordion-7atd70rg.js → Accordion-64px84rh.js} +10 -10
  122. package/web-dist/chunks/{Accordion-enracgev.js → Accordion-6ec9bfd8.js} +4 -4
  123. package/web-dist/chunks/Accordion-6jb7b67v.js +66 -0
  124. package/web-dist/chunks/{Accordion-5gbd0wzf.js → Accordion-8ac6dkcs.js} +1 -1
  125. package/web-dist/chunks/{Accordion-w18jbs39.js → Accordion-8q7hn9aj.js} +1 -1
  126. package/web-dist/chunks/{Accordion-825x4t0z.js → Accordion-8vcs6nz6.js} +1 -1
  127. package/web-dist/chunks/{Accordion-qqv9mak2.js → Accordion-9d3rd7ne.js} +1 -1
  128. package/web-dist/chunks/{Accordion-zfsnh03k.js → Accordion-9hcbf56f.js} +2 -2
  129. package/web-dist/chunks/{Accordion-rrmy3736.js → Accordion-a6xxvydp.js} +2 -2
  130. package/web-dist/chunks/{Accordion-dv281jw0.js → Accordion-b4yr6yq3.js} +2 -2
  131. package/web-dist/chunks/{Accordion-c1x8bqnr.js → Accordion-b8t2gq8g.js} +9 -9
  132. package/web-dist/chunks/{Accordion-25xjvp3t.js → Accordion-dk40hsc0.js} +2 -2
  133. package/web-dist/chunks/{Accordion-1dr6ktbf.js → Accordion-dxhs3xwx.js} +7 -7
  134. package/web-dist/chunks/{Accordion-q5swmcwm.js → Accordion-e1krqvc4.js} +3 -3
  135. package/web-dist/chunks/{Accordion-md1g54wg.js → Accordion-eq27a9ms.js} +6 -5
  136. package/web-dist/chunks/{Accordion-b7jgtnvm.js → Accordion-ew2cebyd.js} +3 -3
  137. package/web-dist/chunks/{Accordion-j3twwxyt.js → Accordion-g9m813fh.js} +2 -2
  138. package/web-dist/chunks/{Accordion-b36h9a7g.js → Accordion-gysa24fk.js} +1 -1
  139. package/web-dist/chunks/{Accordion-2xdwc579.js → Accordion-h21ah8w3.js} +6 -6
  140. package/web-dist/chunks/{Accordion-2rtkfs9t.js → Accordion-hfb983jm.js} +3 -3
  141. package/web-dist/chunks/{Accordion-5p0pc8wp.js → Accordion-j61qh3rb.js} +2 -2
  142. package/web-dist/chunks/{Accordion-tf459afq.js → Accordion-kexh248h.js} +2 -2
  143. package/web-dist/chunks/{Accordion-gbe84kyw.js → Accordion-kx6695j5.js} +2 -2
  144. package/web-dist/chunks/{Accordion-w42y21pt.js → Accordion-mrhkw8n6.js} +1 -1
  145. package/web-dist/chunks/{Accordion-vyr0wyp9.js → Accordion-ng9pnz9r.js} +9 -9
  146. package/web-dist/chunks/{Accordion-x3shxr1k.js → Accordion-p43psvv8.js} +6 -6
  147. package/web-dist/chunks/{Accordion-6y9ac3ad.js → Accordion-rcs75kj4.js} +3 -3
  148. package/web-dist/chunks/Accordion-rj3ayvn5.js +3925 -0
  149. package/web-dist/chunks/{Accordion-4d12nnq0.js → Accordion-sheqvs8c.js} +11 -11
  150. package/web-dist/chunks/{Accordion-j77vvja1.js → Accordion-ss57gqjb.js} +5 -5
  151. package/web-dist/chunks/{Accordion-hsnh2dgt.js → Accordion-sttjd4rs.js} +7 -7
  152. package/web-dist/chunks/{Accordion-n95zwem8.js → Accordion-sz17szqm.js} +8 -8
  153. package/web-dist/chunks/{Accordion-0ecj6p6b.js → Accordion-tchccn9f.js} +5 -5
  154. package/web-dist/chunks/{Accordion-4d4xahgg.js → Accordion-tpd1vvy9.js} +77 -74
  155. package/web-dist/chunks/{Accordion-bm75sm6d.js → Accordion-vzgpdtr2.js} +1 -1
  156. package/web-dist/chunks/{Accordion-4hthnyjj.js → Accordion-wdefxczv.js} +9 -9
  157. package/web-dist/chunks/{Accordion-2pq8kbaq.js → Accordion-wtqev4qa.js} +7 -7
  158. package/web-dist/chunks/{Accordion-s6n61fx6.js → Accordion-x33am5bc.js} +3 -3
  159. package/web-dist/chunks/{Accordion-5zx8d19h.js → Accordion-xfdp8w37.js} +13 -13
  160. package/web-dist/chunks/{Accordion-st7rj6hc.js → Accordion-xs9aspze.js} +4 -4
  161. package/web-dist/chunks/{Accordion-nf16vayy.js → Accordion-z4m47w0b.js} +2 -2
  162. package/web-dist/chunks/{Accordion-x2d68rrj.js → Accordion-z5kr43w5.js} +4 -4
  163. package/web-dist/chunks/{Accordion-nks69epp.js → Accordion-z8c7y6d8.js} +5 -5
  164. package/web-dist/components/accordion/Accordion.js +10 -10
  165. package/web-dist/components/accordion-item/AccordionItem.js +10 -10
  166. package/web-dist/components/activity-indicator/ActivityIndicator.js +3 -3
  167. package/web-dist/components/app-bar/AppBar.js +16 -15
  168. package/web-dist/components/app-header/AppHeader.js +16 -15
  169. package/web-dist/components/app-shell/AppShell.js +4 -4
  170. package/web-dist/components/auth-screen/AuthScreen.js +21 -19
  171. package/web-dist/components/avatar/Avatar.js +10 -10
  172. package/web-dist/components/avatar-group/AvatarGroup.js +10 -10
  173. package/web-dist/components/badge/Badge.js +5 -5
  174. package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +19 -18
  175. package/web-dist/components/bottom-sheet/BottomSheet.js +6 -6
  176. package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +6 -6
  177. package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +6 -6
  178. package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +6 -6
  179. package/web-dist/components/bottom-sheet-view/BottomSheetView.js +6 -6
  180. package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +6 -6
  181. package/web-dist/components/breadcrumbs/Breadcrumbs.js +15 -14
  182. package/web-dist/components/button/Button.js +11 -10
  183. package/web-dist/components/button-group/ButtonGroup.js +11 -10
  184. package/web-dist/components/camera-permission-view/CameraPermissionView.js +19 -18
  185. package/web-dist/components/card/Card.js +18 -17
  186. package/web-dist/components/card-back/CardBack.js +4 -4
  187. package/web-dist/components/card-hand/CardHand.js +4 -4
  188. package/web-dist/components/chat-list-item/ChatListItem.js +14 -14
  189. package/web-dist/components/checkbox/Checkbox.js +10 -10
  190. package/web-dist/components/checkbox-group/CheckboxGroup.js +10 -10
  191. package/web-dist/components/chess-board/ChessBoard.js +4 -4
  192. package/web-dist/components/chip/Chip.js +11 -11
  193. package/web-dist/components/chip-group/ChipGroup.js +11 -11
  194. package/web-dist/components/collection-editor/CollectionEditor.js +20 -19
  195. package/web-dist/components/color-hue-scale/ColorHueScale.d.ts +6 -0
  196. package/web-dist/components/color-hue-scale/ColorHueScale.js +33 -0
  197. package/web-dist/components/color-hue-scale/index.d.ts +1 -0
  198. package/web-dist/components/color-hue-scale/index.js +2 -0
  199. package/web-dist/components/color-picker/ColorPicker.d.ts +6 -0
  200. package/web-dist/components/color-picker/ColorPicker.js +33 -0
  201. package/web-dist/components/color-picker/index.d.ts +1 -0
  202. package/web-dist/components/color-picker/index.js +2 -0
  203. package/web-dist/components/color-tone/ColorTone.d.ts +6 -0
  204. package/web-dist/components/color-tone/ColorTone.js +33 -0
  205. package/web-dist/components/color-tone/index.d.ts +1 -0
  206. package/web-dist/components/color-tone/index.js +2 -0
  207. package/web-dist/components/color-wheel/ColorWheel.d.ts +6 -0
  208. package/web-dist/components/color-wheel/ColorWheel.js +33 -0
  209. package/web-dist/components/color-wheel/index.d.ts +1 -0
  210. package/web-dist/components/color-wheel/index.js +2 -0
  211. package/web-dist/components/content-rail/ContentRail.js +14 -13
  212. package/web-dist/components/data-table/DataTable.js +25 -24
  213. package/web-dist/components/date-picker/DatePicker.js +16 -15
  214. package/web-dist/components/dialog/Dialog.js +9 -9
  215. package/web-dist/components/divider/Divider.js +4 -4
  216. package/web-dist/components/empty-state/EmptyState.js +19 -18
  217. package/web-dist/components/explorer/Explorer.js +11 -11
  218. package/web-dist/components/field/Field.js +10 -10
  219. package/web-dist/components/file-explorer/FileExplorer.js +11 -11
  220. package/web-dist/components/flat-list/FlatList.js +11 -11
  221. package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +21 -19
  222. package/web-dist/components/form/Form.js +15 -14
  223. package/web-dist/components/form-actions/FormActions.js +15 -14
  224. package/web-dist/components/form-error/FormError.js +15 -14
  225. package/web-dist/components/game/Game.js +5 -5
  226. package/web-dist/components/game-entity/GameEntity.js +5 -5
  227. package/web-dist/components/game-field/GameField.js +5 -5
  228. package/web-dist/components/game-input-zone/GameInputZone.js +5 -5
  229. package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +5 -5
  230. package/web-dist/components/game-overlay/GameOverlay.js +5 -5
  231. package/web-dist/components/gradient/Gradient.js +5 -5
  232. package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +5 -5
  233. package/web-dist/components/graph-view/GraphView.js +81 -18
  234. package/web-dist/components/grid/Grid.js +4 -4
  235. package/web-dist/components/grid-line-overlay/GridLineOverlay.js +4 -4
  236. package/web-dist/components/grid-ruler/GridRuler.js +4 -4
  237. package/web-dist/components/heading/Heading.js +5 -5
  238. package/web-dist/components/hero/Hero.js +20 -19
  239. package/web-dist/components/icon/Icon.js +4 -4
  240. package/web-dist/components/icon-button/IconButton.js +11 -10
  241. package/web-dist/components/image/Image.js +8 -8
  242. package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +3 -3
  243. package/web-dist/components/list/List.js +11 -11
  244. package/web-dist/components/list-item/ListItem.js +11 -11
  245. package/web-dist/components/list-section/ListSection.js +11 -11
  246. package/web-dist/components/matrix-grid/MatrixGrid.js +5 -5
  247. package/web-dist/components/media-card/MediaCard.js +18 -17
  248. package/web-dist/components/media-explorer/MediaExplorer.js +11 -11
  249. package/web-dist/components/message-bubble/MessageBubble.js +14 -14
  250. package/web-dist/components/metric-card/MetricCard.js +18 -17
  251. package/web-dist/components/missing-element/MissingElement.js +9 -9
  252. package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +21 -19
  253. package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +21 -19
  254. package/web-dist/components/opening-book/OpeningBook.js +4 -4
  255. package/web-dist/components/otp-form/OtpForm.js +21 -19
  256. package/web-dist/components/pagination/Pagination.js +14 -13
  257. package/web-dist/components/palette-item/PaletteItem.js +18 -17
  258. package/web-dist/components/playing-card/PlayingCard.js +4 -4
  259. package/web-dist/components/poker-training-table/PokerTrainingTable.js +4 -4
  260. package/web-dist/components/popover-menu/PopoverMenu.js +10 -10
  261. package/web-dist/components/post-card/PostCard.js +18 -17
  262. package/web-dist/components/product-card/ProductCard.js +18 -17
  263. package/web-dist/components/progress/Progress.js +8 -8
  264. package/web-dist/components/progress-ring/ProgressRing.js +8 -8
  265. package/web-dist/components/radio/Radio.js +12 -12
  266. package/web-dist/components/radio-group/RadioGroup.js +12 -12
  267. package/web-dist/components/rating/Rating.js +7 -7
  268. package/web-dist/components/reader/Reader.js +21 -20
  269. package/web-dist/components/scan-overlay/ScanOverlay.js +19 -18
  270. package/web-dist/components/screen/Screen.js +4 -4
  271. package/web-dist/components/screen-section/ScreenSection.js +8 -8
  272. package/web-dist/components/scroll-view/ScrollView.js +4 -4
  273. package/web-dist/components/search-input/SearchInput.js +14 -12
  274. package/web-dist/components/section-header/SectionHeader.js +8 -8
  275. package/web-dist/components/section-list/SectionList.js +11 -11
  276. package/web-dist/components/select/Select.js +14 -13
  277. package/web-dist/components/selectable-item/SelectableItem.js +3 -3
  278. package/web-dist/components/selection-provider/SelectionProvider.js +3 -3
  279. package/web-dist/components/sign-in-form/SignInForm.js +21 -19
  280. package/web-dist/components/sign-up-form/SignUpForm.js +21 -19
  281. package/web-dist/components/skeleton/Skeleton.js +21 -20
  282. package/web-dist/components/skeleton-card/SkeletonCard.js +21 -20
  283. package/web-dist/components/skeleton-list/SkeletonList.js +21 -20
  284. package/web-dist/components/skeleton-text/SkeletonText.js +21 -20
  285. package/web-dist/components/surface/Surface.js +5 -5
  286. package/web-dist/components/switch/Switch.js +5 -5
  287. package/web-dist/components/tab/Tab.js +5 -5
  288. package/web-dist/components/tab-list/TabList.js +5 -5
  289. package/web-dist/components/tab-panel/TabPanel.js +5 -5
  290. package/web-dist/components/tabletop-table/TabletopTable.js +4 -4
  291. package/web-dist/components/tabs/Tabs.js +5 -5
  292. package/web-dist/components/text/Text.js +5 -5
  293. package/web-dist/components/text-input/TextInput.js +14 -12
  294. package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +13 -12
  295. package/web-dist/components/time-picker/TimePicker.js +16 -15
  296. package/web-dist/components/timeline/Timeline.js +9 -9
  297. package/web-dist/components/toast/Toast.js +7 -7
  298. package/web-dist/components/toast-provider/ToastProvider.js +7 -7
  299. package/web-dist/components/toolbar/Toolbar.js +18 -17
  300. package/web-dist/components/tree-item/TreeItem.js +19 -18
  301. package/web-dist/components/tree-view/TreeView.js +1 -1
  302. package/web-dist/components/uploader/Uploader.js +23 -22
  303. package/web-dist/components/view/View.js +4 -4
  304. package/web-dist/manifest.json +1473 -1271
  305. package/web-dist/runtime/ZoraProvider.js +6 -6
@@ -0,0 +1,137 @@
1
+ import { Button, Pressable } from '@ankhorage/surface';
2
+ import React from 'react';
3
+
4
+ import type { ColorToneProps } from '../../types/color';
5
+ import { View } from '../layout/public';
6
+ import { withZoraThemeScope } from '../theme/adapters/inbound/withZoraThemeScope';
7
+ import { ColorWheel } from './ColorWheel';
8
+ import { resolveColorHue } from './utils/resolveColorHue';
9
+ import { resolveOklchColor } from './utils/resolveOklchColor';
10
+
11
+ const MAX_TONE_COLORS = 4;
12
+
13
+ /*** Selects consumer-provided OKLCH tone targets while keeping hue adjustable. */
14
+ export const ColorTone = withZoraThemeScope(ColorToneInner);
15
+
16
+ /*** Renders one supplied tone and its actual, editable OKLCH color selections. */
17
+ function ColorToneInner({
18
+ themeId: _themeId,
19
+ mode: _mode,
20
+ inverted: _inverted,
21
+ interactionPolicy,
22
+ tones,
23
+ selectionMode = 'single',
24
+ value,
25
+ onChange,
26
+ testID,
27
+ }: ColorToneProps) {
28
+ const [editingColorIndex, setEditingColorIndex] = React.useState(0);
29
+ const selectedTone = tones.find((tone) => tone.id === value?.toneId);
30
+ const colors = value
31
+ ? selectionMode === 'single'
32
+ ? value.colors.slice(0, 1)
33
+ : value.colors.slice(0, MAX_TONE_COLORS)
34
+ : [];
35
+ const currentEditingColorIndex = Math.min(editingColorIndex, Math.max(0, colors.length - 1));
36
+ const selectedColor = colors.at(currentEditingColorIndex);
37
+ const selectTone = (tone: ColorToneProps['tones'][number]) => {
38
+ const hue = selectedColor ? resolveColorHue(selectedColor) : 0;
39
+ setEditingColorIndex(0);
40
+ onChange({ toneId: tone.id, colors: [resolveOklchColor(tone.accentTarget, hue)] });
41
+ };
42
+
43
+ return (
44
+ <View gap="sm" testID={testID}>
45
+ <View direction="row" wrap="wrap" gap="sm">
46
+ {tones.map((tone) => {
47
+ const selected = value?.toneId === tone.id;
48
+ const color =
49
+ selected && selectedColor ? selectedColor : resolveOklchColor(tone.accentTarget, 0);
50
+ return (
51
+ <Pressable
52
+ key={tone.id}
53
+ accessibilityLabel={tone.accent}
54
+ accessibilityRole="radio"
55
+ accessibilityState={{ checked: selected }}
56
+ bg={color}
57
+ borderColor="border"
58
+ borderWidth={selected ? 3 : 1}
59
+ disabled={interactionPolicy === 'passive'}
60
+ height={44}
61
+ onPress={() => selectTone(tone)}
62
+ radius="md"
63
+ width={44}
64
+ />
65
+ );
66
+ })}
67
+ </View>
68
+ {selectedTone && selectedColor && value ? (
69
+ <>
70
+ <View direction="row" gap="xs" wrap="wrap">
71
+ {colors.map((color, index) => (
72
+ <Pressable
73
+ key={`${color}-${index}`}
74
+ accessibilityLabel={`Selected ${selectedTone.accent} color ${index + 1}: ${color}`}
75
+ accessibilityRole="radio"
76
+ accessibilityState={{ checked: currentEditingColorIndex === index }}
77
+ bg={color}
78
+ borderColor="border"
79
+ borderWidth={currentEditingColorIndex === index ? 3 : 1}
80
+ disabled={interactionPolicy === 'passive'}
81
+ height={44}
82
+ onPress={() => setEditingColorIndex(index)}
83
+ radius="md"
84
+ width={44}
85
+ />
86
+ ))}
87
+ {selectionMode === 'multiple' ? (
88
+ <Button
89
+ disabled={interactionPolicy === 'passive' || colors.length >= MAX_TONE_COLORS}
90
+ onPress={() => {
91
+ setEditingColorIndex(colors.length);
92
+ onChange({
93
+ toneId: selectedTone.id,
94
+ colors: [...colors, resolveOklchColor(selectedTone.accentTarget, 0)],
95
+ });
96
+ }}
97
+ >
98
+ Add color
99
+ </Button>
100
+ ) : null}
101
+ {selectionMode === 'multiple' && colors.length > 1 ? (
102
+ <Button
103
+ disabled={interactionPolicy === 'passive'}
104
+ onPress={() => {
105
+ const nextColors = colors.filter(
106
+ (_, index) => index !== currentEditingColorIndex,
107
+ );
108
+ setEditingColorIndex(Math.min(currentEditingColorIndex, nextColors.length - 1));
109
+ onChange({ toneId: selectedTone.id, colors: nextColors });
110
+ }}
111
+ >
112
+ Remove color
113
+ </Button>
114
+ ) : null}
115
+ </View>
116
+ <ColorWheel
117
+ harmony={null}
118
+ interactionPolicy={interactionPolicy}
119
+ onChange={({ color }) => {
120
+ const nextColor = resolveOklchColor(
121
+ selectedTone.accentTarget,
122
+ resolveColorHue(color),
123
+ );
124
+ onChange({
125
+ toneId: selectedTone.id,
126
+ colors: colors.map((entry, index) =>
127
+ index === currentEditingColorIndex ? nextColor : entry,
128
+ ),
129
+ });
130
+ }}
131
+ value={selectedColor}
132
+ />
133
+ </>
134
+ ) : null}
135
+ </View>
136
+ );
137
+ }
@@ -0,0 +1,251 @@
1
+ import { generateHarmonyRoleColors, type HexColor, isHexColor } from '@ankhorage/color-theory';
2
+ import { Button, TextInput } from '@ankhorage/surface';
3
+ import React from 'react';
4
+ import { Circle, Line, Path, Polygon, Svg } from 'react-native-svg';
5
+
6
+ import type { ColorWheelProps } from '../../types/color';
7
+ import { View } from '../layout/public';
8
+ import { withZoraThemeScope } from '../theme/adapters/inbound/withZoraThemeScope';
9
+ import { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy';
10
+ import { resolveColorHue } from './utils/resolveColorHue';
11
+ import { resolveOklchColor } from './utils/resolveOklchColor';
12
+ import { resolveWheelColor } from './utils/resolveWheelColor';
13
+ import { resolveWheelColorComponents } from './utils/resolveWheelColorComponents';
14
+
15
+ const WHEEL_SIZE = 240;
16
+ const WHEEL_CENTER = WHEEL_SIZE / 2;
17
+ const WHEEL_RADIUS = 104;
18
+ const WHEEL_SEGMENT_COUNT = 36;
19
+ const WHEEL_MAX_CHROMA = 0.2;
20
+
21
+ /*** Selects an OKLCH hue and optionally visualizes the existing color-theory harmony. */
22
+ export const ColorWheel = withZoraThemeScope(ColorWheelInner);
23
+
24
+ /*** Renders a directly manipulable hue wheel and harmony controls without returning derived colors. */
25
+ function ColorWheelInner({
26
+ themeId: _themeId,
27
+ mode: _mode,
28
+ inverted: _inverted,
29
+ interactionPolicy,
30
+ value,
31
+ harmony = null,
32
+ harmonies,
33
+ onChange,
34
+ testID,
35
+ }: ColorWheelProps) {
36
+ const hue = resolveColorHue(value);
37
+ const { chroma, lightness } = resolveWheelColorComponents(value);
38
+ const harmonyColors = harmony ? generateHarmonyRoleColors(value, harmony).colors : [];
39
+ const selectedPoint = resolveWheelPoint(hue, Math.min(1, chroma / WHEEL_MAX_CHROMA));
40
+ const harmonyPoints = harmonyColors.map((color) => resolveWheelPoint(color.hueDegrees));
41
+ const harmonyLines = resolveHarmonyLines(harmonyPoints, selectedPoint);
42
+ const changeColorAt = (x: number, y: number) => {
43
+ if (interactionPolicy === 'passive') return;
44
+ onChange({
45
+ color: resolveWheelColor(value, x, y, WHEEL_CENTER, WHEEL_RADIUS, WHEEL_MAX_CHROMA),
46
+ harmony,
47
+ });
48
+ };
49
+ const changeLightness = (offset: number) =>
50
+ onChange({
51
+ color: resolveOklchColor(
52
+ { chroma, lightness: Math.max(0, Math.min(1, lightness + offset)) },
53
+ hue,
54
+ ),
55
+ harmony,
56
+ });
57
+
58
+ return (
59
+ <View align="center" gap="sm" testID={testID}>
60
+ <ColorWheelKeyboardProxy
61
+ chroma={chroma}
62
+ disabled={interactionPolicy === 'passive'}
63
+ hue={hue}
64
+ onChange={(nextHue, nextChroma) =>
65
+ onChange({
66
+ color: resolveOklchColor(
67
+ { lightness: resolveWheelLightness(value), chroma: nextChroma },
68
+ nextHue,
69
+ ),
70
+ harmony,
71
+ })
72
+ }
73
+ >
74
+ <Svg
75
+ accessibilityLabel="Color wheel"
76
+ height={WHEEL_SIZE}
77
+ onResponderGrant={(event) => {
78
+ const { locationX, locationY } = event.nativeEvent;
79
+ changeColorAt(locationX, locationY);
80
+ }}
81
+ onResponderMove={(event) => {
82
+ const { locationX, locationY } = event.nativeEvent;
83
+ changeColorAt(locationX, locationY);
84
+ }}
85
+ onStartShouldSetResponder={() => interactionPolicy !== 'passive'}
86
+ width={WHEEL_SIZE}
87
+ >
88
+ {resolveWheelSegments().map((segment) => (
89
+ <Path d={segment.path} fill={segment.color} key={segment.hue} />
90
+ ))}
91
+ {harmony === 'triadic' && harmonyPoints.length === 3 ? (
92
+ <Polygon
93
+ fill="none"
94
+ points={harmonyPoints.map((point) => `${point.x},${point.y}`).join(' ')}
95
+ stroke="currentColor"
96
+ strokeWidth={2}
97
+ />
98
+ ) : (
99
+ harmonyLines
100
+ )}
101
+ {harmonyPoints.map((point) => (
102
+ <Circle
103
+ cx={point.x}
104
+ cy={point.y}
105
+ fill="currentColor"
106
+ key={`${point.x}-${point.y}`}
107
+ r={5}
108
+ />
109
+ ))}
110
+ <Circle
111
+ cx={selectedPoint.x}
112
+ cy={selectedPoint.y}
113
+ fill="none"
114
+ r={9}
115
+ stroke="currentColor"
116
+ strokeWidth={3}
117
+ />
118
+ </Svg>
119
+ </ColorWheelKeyboardProxy>
120
+ <View direction="row" gap="xs" wrap="wrap">
121
+ <Button
122
+ disabled={interactionPolicy === 'passive' || lightness <= 0}
123
+ onPress={() => changeLightness(-0.05)}
124
+ >
125
+ Lightness -
126
+ </Button>
127
+ <Button
128
+ disabled={interactionPolicy === 'passive' || lightness >= 1}
129
+ onPress={() => changeLightness(0.05)}
130
+ >
131
+ Lightness +
132
+ </Button>
133
+ </View>
134
+ <ColorHexInput
135
+ disabled={interactionPolicy === 'passive'}
136
+ harmony={harmony}
137
+ key={value}
138
+ onChange={onChange}
139
+ value={value}
140
+ />
141
+ {harmonies ? (
142
+ <View direction="row" gap="xs" wrap="wrap">
143
+ <Button
144
+ disabled={interactionPolicy === 'passive'}
145
+ onPress={() => onChange({ color: value, harmony: null })}
146
+ variant={harmony === null ? 'solid' : 'outline'}
147
+ >
148
+ None
149
+ </Button>
150
+ {harmonies.map((candidate) => (
151
+ <Button
152
+ key={candidate}
153
+ disabled={interactionPolicy === 'passive'}
154
+ onPress={() => onChange({ color: value, harmony: candidate })}
155
+ variant={harmony === candidate ? 'solid' : 'outline'}
156
+ >
157
+ {candidate}
158
+ </Button>
159
+ ))}
160
+ </View>
161
+ ) : null}
162
+ </View>
163
+ );
164
+ }
165
+
166
+ /*** Build the wheel's OKLCH segments from the existing conversion tool. */
167
+ function resolveWheelSegments(): readonly {
168
+ readonly color: HexColor;
169
+ readonly hue: number;
170
+ readonly path: string;
171
+ }[] {
172
+ return Array.from({ length: WHEEL_SEGMENT_COUNT }, (_, index) => {
173
+ const hue = (index * 360) / WHEEL_SEGMENT_COUNT;
174
+ return {
175
+ color: resolveOklchColor({ lightness: 0.65, chroma: WHEEL_MAX_CHROMA }, hue),
176
+ hue,
177
+ path: resolveSegmentPath(hue, hue + 360 / WHEEL_SEGMENT_COUNT),
178
+ };
179
+ });
180
+ }
181
+
182
+ /*** Describe one wedge in the visual hue wheel. */
183
+ function resolveSegmentPath(startHue: number, endHue: number): string {
184
+ const start = resolveWheelPoint(startHue);
185
+ const end = resolveWheelPoint(endHue);
186
+ return `M ${WHEEL_CENTER} ${WHEEL_CENTER} L ${start.x} ${start.y} A ${WHEEL_RADIUS} ${WHEEL_RADIUS} 0 0 1 ${end.x} ${end.y} Z`;
187
+ }
188
+
189
+ /*** Convert a hue degree to the corresponding visual wheel coordinate. */
190
+ function resolveWheelPoint(
191
+ hue: number,
192
+ radiusRatio = 1,
193
+ ): { readonly x: number; readonly y: number } {
194
+ const radians = ((hue - 90) * Math.PI) / 180;
195
+ return {
196
+ x: WHEEL_CENTER + WHEEL_RADIUS * radiusRatio * Math.cos(radians),
197
+ y: WHEEL_CENTER + WHEEL_RADIUS * radiusRatio * Math.sin(radians),
198
+ };
199
+ }
200
+
201
+ /*** Connect consecutive harmony points without dynamic collection indexing. */
202
+ function resolveHarmonyLines(
203
+ points: readonly { readonly x: number; readonly y: number }[],
204
+ selectedPoint: { readonly x: number; readonly y: number },
205
+ ) {
206
+ return points.slice(1).reduce(
207
+ ({ lines, previous }, point) => ({
208
+ lines: [
209
+ ...lines,
210
+ <Line
211
+ key={`${previous.x}-${previous.y}-${point.x}-${point.y}`}
212
+ stroke="currentColor"
213
+ strokeWidth={2}
214
+ x1={previous.x}
215
+ x2={point.x}
216
+ y1={previous.y}
217
+ y2={point.y}
218
+ />,
219
+ ],
220
+ previous: point,
221
+ }),
222
+ { lines: [] as React.ReactNode[], previous: points.at(0) ?? selectedPoint },
223
+ ).lines;
224
+ }
225
+
226
+ /*** Read the selected color's lightness for wheel-only hue and chroma changes. */
227
+ function resolveWheelLightness(color: HexColor): number {
228
+ const { lightness } = resolveWheelColorComponents(color);
229
+ return lightness;
230
+ }
231
+
232
+ /*** Retains in-progress hexadecimal input while resetting for an externally controlled color. */
233
+ function ColorHexInput({
234
+ disabled,
235
+ harmony,
236
+ onChange,
237
+ value,
238
+ }: Pick<ColorWheelProps, 'harmony' | 'onChange' | 'value'> & { readonly disabled: boolean }) {
239
+ const [input, setInput] = React.useState<string>(value);
240
+ return (
241
+ <TextInput
242
+ accessibilityLabel="Color hex value"
243
+ disabled={disabled}
244
+ onChangeText={(nextValue) => {
245
+ setInput(nextValue);
246
+ if (isHexColor(nextValue)) onChange({ color: nextValue, harmony: harmony ?? null });
247
+ }}
248
+ value={input}
249
+ />
250
+ );
251
+ }
@@ -0,0 +1,34 @@
1
+ import { View } from 'react-native';
2
+
3
+ import type { ColorWheelKeyboardProxyProps } from './ColorWheelKeyboardProxy';
4
+
5
+ /*** Exposes native accessibility increment and decrement actions for the controlled color wheel. */
6
+ export function ColorWheelKeyboardProxy({
7
+ children,
8
+ chroma,
9
+ disabled,
10
+ hue,
11
+ onChange,
12
+ }: ColorWheelKeyboardProxyProps) {
13
+ return (
14
+ <View
15
+ accessible
16
+ accessibilityActions={[{ name: 'increment' }, { name: 'decrement' }]}
17
+ accessibilityLabel="Color wheel"
18
+ accessibilityRole="adjustable"
19
+ accessibilityState={{ disabled }}
20
+ accessibilityValue={{
21
+ max: 360,
22
+ min: 0,
23
+ now: Math.round(hue),
24
+ text: `Hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`,
25
+ }}
26
+ onAccessibilityAction={(event) => {
27
+ if (disabled) return;
28
+ onChange(event.nativeEvent.actionName === 'increment' ? hue + 5 : hue - 5, chroma);
29
+ }}
30
+ >
31
+ {children}
32
+ </View>
33
+ );
34
+ }
@@ -0,0 +1,11 @@
1
+ import type React from 'react';
2
+
3
+ export { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy.native';
4
+
5
+ export interface ColorWheelKeyboardProxyProps {
6
+ readonly children: React.ReactNode;
7
+ readonly chroma: number;
8
+ readonly disabled: boolean;
9
+ readonly hue: number;
10
+ readonly onChange: (hue: number, chroma: number) => void;
11
+ }
@@ -0,0 +1,47 @@
1
+ import type React from 'react';
2
+
3
+ import type { ColorWheelKeyboardProxyProps } from './ColorWheelKeyboardProxy';
4
+
5
+ /*** Bridges browser keyboard input to controlled OKLCH wheel hue and chroma changes. */
6
+ export function ColorWheelKeyboardProxy({
7
+ children,
8
+ chroma,
9
+ disabled,
10
+ hue,
11
+ onChange,
12
+ }: ColorWheelKeyboardProxyProps) {
13
+ return (
14
+ <div
15
+ aria-label={`Color wheel, hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`}
16
+ aria-valuemax={360}
17
+ aria-valuemin={0}
18
+ aria-valuenow={Math.round(hue)}
19
+ aria-valuetext={`Hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`}
20
+ aria-disabled={disabled}
21
+ onKeyDown={(event) => {
22
+ const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma);
23
+ if (!nextValue || disabled) return;
24
+ event.preventDefault();
25
+ onChange(nextValue.hue, nextValue.chroma);
26
+ }}
27
+ role="slider"
28
+ tabIndex={disabled ? -1 : 0}
29
+ >
30
+ {children}
31
+ </div>
32
+ );
33
+ }
34
+
35
+ /*** Resolve portable arrow keys into bounded color-wheel increments. */
36
+ function resolveKeyboardWheelValue(key: string, hue: number, chroma: number) {
37
+ if (key === 'ArrowLeft') return { chroma, hue: normalizeHue(hue - 5) };
38
+ if (key === 'ArrowRight') return { chroma, hue: normalizeHue(hue + 5) };
39
+ if (key === 'ArrowDown') return { chroma: Math.max(0, chroma - 0.02), hue };
40
+ if (key === 'ArrowUp') return { chroma: Math.min(0.2, chroma + 0.02), hue };
41
+ return undefined;
42
+ }
43
+
44
+ /*** Normalize keyboard hue increments to the slider's documented range. */
45
+ function normalizeHue(hue: number): number {
46
+ return hue < 0 ? hue + 360 : hue >= 360 ? hue - 360 : hue;
47
+ }
@@ -0,0 +1,17 @@
1
+ export type {
2
+ ColorHueScaleProps,
3
+ ColorPickerProps,
4
+ ColorPickerSelection,
5
+ ColorPickerTab,
6
+ ColorPickerValue,
7
+ ColorToneDefinition,
8
+ ColorToneProps,
9
+ ColorToneSelection,
10
+ ColorToneTarget,
11
+ ColorWheelProps,
12
+ ColorWheelSelection,
13
+ } from '../../types/color';
14
+ export { ColorHueScale } from './ColorHueScale';
15
+ export { ColorPicker } from './ColorPicker';
16
+ export { ColorTone } from './ColorTone';
17
+ export { ColorWheel } from './ColorWheel';
@@ -0,0 +1,37 @@
1
+ import { isHexColor, parseHexColorOrThrow } from '@ankhorage/color-theory';
2
+ import { expect, test } from 'bun:test';
3
+
4
+ import { resolveColorAtHue } from './resolveColorAtHue';
5
+ import { resolveColorHue } from './resolveColorHue';
6
+ import { resolveOklchColor } from './resolveOklchColor';
7
+ import { resolveWheelColor } from './resolveWheelColor';
8
+ import { resolveWheelColorComponents } from './resolveWheelColorComponents';
9
+
10
+ test('converts a consumer-provided OKLCH target without a ZORA tone catalog', () => {
11
+ const color = resolveOklchColor({ lightness: 0.53, chroma: 0.18 }, 280);
12
+
13
+ expect(isHexColor(color)).toBe(true);
14
+ });
15
+
16
+ test('preserves an editable hue through the published color-theory conversion boundary', () => {
17
+ const base = parseHexColorOrThrow('#2563eb');
18
+ const adjusted = resolveColorAtHue(base, 120);
19
+
20
+ expect(isHexColor(adjusted)).toBe(true);
21
+ expect(Math.abs(resolveColorHue(adjusted) - 120)).toBeLessThan(5);
22
+ });
23
+
24
+ test('maps wheel radius to chroma while preserving a selected color lightness', () => {
25
+ const base = parseHexColorOrThrow('#2563eb');
26
+ const centerColor = resolveWheelColor(base, 120, 120, 120, 104, 0.2);
27
+ const edgeColor = resolveWheelColor(base, 120, 16, 120, 104, 0.2);
28
+ const baseValues = resolveWheelColorComponents(base);
29
+ const centerValues = resolveWheelColorComponents(centerColor);
30
+ const edgeValues = resolveWheelColorComponents(edgeColor);
31
+
32
+ expect(centerValues.chroma).toBeLessThan(0.01);
33
+ expect(edgeValues.chroma).toBeGreaterThan(centerValues.chroma);
34
+ expect(Math.abs(edgeValues.lightness - baseValues.lightness)).toBeLessThan(0.02);
35
+ const edgeHue = resolveColorHue(edgeColor);
36
+ expect(Math.min(edgeHue, 360 - edgeHue)).toBeLessThan(5);
37
+ });
@@ -0,0 +1,14 @@
1
+ import type { HexColor } from '@ankhorage/color-theory';
2
+ import { parseHexColorOrThrow } from '@ankhorage/color-theory';
3
+ import { converter, formatHex } from '@ankhorage/color-theory/culori/fn';
4
+
5
+ const toOklch = converter('oklch');
6
+
7
+ /*** Preserve the selected color's lightness and chroma while changing its hue. */
8
+ export function resolveColorAtHue(color: HexColor, hue: number): HexColor {
9
+ const parsed = toOklch(color);
10
+ if (!parsed || typeof parsed.l !== 'number' || typeof parsed.c !== 'number') return color;
11
+
12
+ const formatted = formatHex({ mode: 'oklch', l: parsed.l, c: parsed.c, h: hue });
13
+ return formatted ? parseHexColorOrThrow(formatted) : color;
14
+ }
@@ -0,0 +1,10 @@
1
+ import type { HexColor } from '@ankhorage/color-theory';
2
+ import { converter } from '@ankhorage/color-theory/culori/fn';
3
+
4
+ const toOklch = converter('oklch');
5
+
6
+ /*** Read the editable hue from a selected hex color. */
7
+ export function resolveColorHue(color: HexColor): number {
8
+ const parsed = toOklch(color);
9
+ return typeof parsed?.h === 'number' ? parsed.h : 0;
10
+ }
@@ -0,0 +1,13 @@
1
+ import type { HexColor } from '@ankhorage/color-theory';
2
+ import { parseHexColorOrThrow } from '@ankhorage/color-theory';
3
+ import { formatHex } from '@ankhorage/color-theory/culori/fn';
4
+
5
+ import type { ColorToneTarget } from '../../../types/color';
6
+
7
+ /*** Resolve a valid hex color from a bounded OKLCH target without owning color theory policy. */
8
+ export function resolveOklchColor(target: ColorToneTarget, hue: number): HexColor {
9
+ const formatted = formatHex({ mode: 'oklch', l: target.lightness, c: target.chroma, h: hue });
10
+ if (!formatted)
11
+ throw new Error('The supplied OKLCH target cannot be represented as a hex color.');
12
+ return parseHexColorOrThrow(formatted);
13
+ }
@@ -0,0 +1,28 @@
1
+ import type { HexColor } from '@ankhorage/color-theory';
2
+
3
+ import { resolveOklchColor } from './resolveOklchColor';
4
+ import { resolveWheelColorComponents } from './resolveWheelColorComponents';
5
+
6
+ /*** Resolve a wheel coordinate into a bounded OKLCH color while retaining the selected lightness. */
7
+ export function resolveWheelColor(
8
+ color: HexColor,
9
+ x: number,
10
+ y: number,
11
+ center: number,
12
+ radius: number,
13
+ maxChroma: number,
14
+ ): HexColor {
15
+ const { lightness } = resolveWheelColorComponents(color);
16
+
17
+ const deltaX = x - center;
18
+ const deltaY = y - center;
19
+ const distance = Math.min(Math.hypot(deltaX, deltaY), radius);
20
+ const hue = normalizeHue((Math.atan2(deltaY, deltaX) * 180) / Math.PI + 90);
21
+ const chroma = (distance / radius) * maxChroma;
22
+ return resolveOklchColor({ lightness, chroma }, hue);
23
+ }
24
+
25
+ /*** Normalize an angular wheel coordinate to the OKLCH hue range. */
26
+ function normalizeHue(hue: number): number {
27
+ return hue < 0 ? hue + 360 : hue;
28
+ }
@@ -0,0 +1,16 @@
1
+ import type { HexColor } from '@ankhorage/color-theory';
2
+ import { converter } from '@ankhorage/color-theory/culori/fn';
3
+
4
+ const toOklch = converter('oklch');
5
+
6
+ /*** Read the selected OKLCH values used by wheel keyboard and accessibility controls. */
7
+ export function resolveWheelColorComponents(color: HexColor): {
8
+ readonly chroma: number;
9
+ readonly lightness: number;
10
+ } {
11
+ const parsed = toOklch(color);
12
+ return {
13
+ chroma: typeof parsed?.c === 'number' ? parsed.c : 0,
14
+ lightness: typeof parsed?.l === 'number' ? parsed.l : 0.65,
15
+ };
16
+ }