@ankhorage/zora 28.10.1 → 28.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -1
  3. package/dist/features/flow/adapters/inbound/FlowCanvas.d.ts +5 -0
  4. package/dist/features/flow/adapters/inbound/FlowCanvas.d.ts.map +1 -0
  5. package/dist/features/flow/adapters/inbound/FlowCanvas.js +261 -0
  6. package/dist/features/flow/adapters/inbound/FlowCanvas.js.map +1 -0
  7. package/dist/features/flow/application/createFlowEditorController.d.ts +13 -0
  8. package/dist/features/flow/application/createFlowEditorController.d.ts.map +1 -0
  9. package/dist/features/flow/application/createFlowEditorController.js +86 -0
  10. package/dist/features/flow/application/createFlowEditorController.js.map +1 -0
  11. package/dist/features/flow/application/getFlowPortAnchor.d.ts +10 -0
  12. package/dist/features/flow/application/getFlowPortAnchor.d.ts.map +1 -0
  13. package/dist/features/flow/application/getFlowPortAnchor.js +18 -0
  14. package/dist/features/flow/application/getFlowPortAnchor.js.map +1 -0
  15. package/dist/features/flow/application/mapFlowViewport.d.ts +10 -0
  16. package/dist/features/flow/application/mapFlowViewport.d.ts.map +1 -0
  17. package/dist/features/flow/application/mapFlowViewport.js +22 -0
  18. package/dist/features/flow/application/mapFlowViewport.js.map +1 -0
  19. package/dist/features/flow/public.d.ts +3 -0
  20. package/dist/features/flow/public.d.ts.map +1 -0
  21. package/dist/features/flow/public.js +2 -0
  22. package/dist/features/flow/public.js.map +1 -0
  23. package/dist/features/graph-node/adapters/inbound/GraphNode.d.ts +5 -0
  24. package/dist/features/graph-node/adapters/inbound/GraphNode.d.ts.map +1 -0
  25. package/dist/features/graph-node/adapters/inbound/GraphNode.js +190 -0
  26. package/dist/features/graph-node/adapters/inbound/GraphNode.js.map +1 -0
  27. package/dist/features/graph-node/getGraphNodePortGeometry.d.ts +17 -0
  28. package/dist/features/graph-node/getGraphNodePortGeometry.d.ts.map +1 -0
  29. package/dist/features/graph-node/getGraphNodePortGeometry.js +23 -0
  30. package/dist/features/graph-node/getGraphNodePortGeometry.js.map +1 -0
  31. package/dist/features/graph-node/public.d.ts +3 -0
  32. package/dist/features/graph-node/public.d.ts.map +1 -0
  33. package/dist/features/graph-node/public.js +2 -0
  34. package/dist/features/graph-node/public.js.map +1 -0
  35. package/dist/features/grid-view/adapters/inbound/GridView.d.ts +1 -1
  36. package/dist/features/grid-view/adapters/inbound/GridView.d.ts.map +1 -1
  37. package/dist/features/grid-view/adapters/inbound/GridView.js +105 -41
  38. package/dist/features/grid-view/adapters/inbound/GridView.js.map +1 -1
  39. package/dist/features/grid-view/application/createGridScrollSync.d.ts +2 -5
  40. package/dist/features/grid-view/application/createGridScrollSync.d.ts.map +1 -1
  41. package/dist/features/grid-view/application/createGridScrollSync.js +109 -45
  42. package/dist/features/grid-view/application/createGridScrollSync.js.map +1 -1
  43. package/dist/features/grid-view/public.d.ts +1 -1
  44. package/dist/features/grid-view/public.d.ts.map +1 -1
  45. package/dist/features/grid-view/public.js.map +1 -1
  46. package/dist/features/layout/utils/createScrollGestureLock.d.ts.map +1 -1
  47. package/dist/features/layout/utils/createScrollGestureLock.js +4 -0
  48. package/dist/features/layout/utils/createScrollGestureLock.js.map +1 -1
  49. package/dist/features/theme/node.d.ts +5 -0
  50. package/dist/features/theme/node.d.ts.map +1 -0
  51. package/dist/features/theme/node.js +4 -0
  52. package/dist/features/theme/node.js.map +1 -0
  53. package/dist/features/theme/public.d.ts +2 -0
  54. package/dist/features/theme/public.d.ts.map +1 -1
  55. package/dist/features/theme/public.js +1 -0
  56. package/dist/features/theme/public.js.map +1 -1
  57. package/dist/types/flow.d.ts +81 -0
  58. package/dist/types/flow.d.ts.map +1 -0
  59. package/dist/types/flow.js +2 -0
  60. package/dist/types/flow.js.map +1 -0
  61. package/dist/types/graph-node.d.ts +42 -0
  62. package/dist/types/graph-node.d.ts.map +1 -0
  63. package/dist/types/graph-node.js +2 -0
  64. package/dist/types/graph-node.js.map +1 -0
  65. package/dist/types/grid-view.d.ts +27 -3
  66. package/dist/types/grid-view.d.ts.map +1 -1
  67. package/dist/types/grid-view.js.map +1 -1
  68. package/dist/types/layout.d.ts +2 -0
  69. package/dist/types/layout.d.ts.map +1 -1
  70. package/dist/types/layout.js.map +1 -1
  71. package/package.json +21 -3
  72. package/src/features/flow/adapters/inbound/FlowCanvas.tsx +501 -0
  73. package/src/features/flow/application/createFlowEditorController.test.ts +146 -0
  74. package/src/features/flow/application/createFlowEditorController.ts +99 -0
  75. package/src/features/flow/application/getFlowPortAnchor.test.ts +23 -0
  76. package/src/features/flow/application/getFlowPortAnchor.ts +30 -0
  77. package/src/features/flow/application/mapFlowViewport.test.ts +11 -0
  78. package/src/features/flow/application/mapFlowViewport.ts +29 -0
  79. package/src/features/flow/public.test.ts +7 -0
  80. package/src/features/flow/public.ts +13 -0
  81. package/src/features/graph-node/adapters/inbound/GraphNode.test.tsx +80 -0
  82. package/src/features/graph-node/adapters/inbound/GraphNode.tsx +259 -0
  83. package/src/features/graph-node/getGraphNodePortGeometry.test.ts +35 -0
  84. package/src/features/graph-node/getGraphNodePortGeometry.ts +41 -0
  85. package/src/features/graph-node/public.test.ts +7 -0
  86. package/src/features/graph-node/public.ts +2 -0
  87. package/src/features/grid-view/adapters/inbound/GridView.nativeScrollSync.test.tsx +198 -7
  88. package/src/features/grid-view/adapters/inbound/GridView.tsx +248 -145
  89. package/src/features/grid-view/application/createGridScrollSync.test.ts +46 -17
  90. package/src/features/grid-view/application/createGridScrollSync.ts +100 -43
  91. package/src/features/grid-view/public.ts +6 -1
  92. package/src/features/layout/utils/createScrollGestureLock.ts +4 -0
  93. package/src/features/theme/application/use-cases/compileZoraTheme.test.ts +1 -1
  94. package/src/features/theme/node.ts +18 -0
  95. package/src/features/theme/public.ts +7 -0
  96. package/src/platformAcceptance.test.ts +15 -11
  97. package/src/types/flow.ts +99 -0
  98. package/src/types/graph-node.ts +45 -0
  99. package/src/types/grid-view.ts +25 -3
  100. package/src/types/layout.ts +2 -0
  101. package/web-dist/chunks/{Accordion-9dq115tn.js → Accordion-064hgrct.js} +3 -3
  102. package/web-dist/chunks/{Accordion-wbf7gqrm.js → Accordion-2b3sd76b.js} +3 -3
  103. package/web-dist/chunks/{Accordion-k9n1yse4.js → Accordion-2kv6p7by.js} +10 -38
  104. package/web-dist/chunks/{Accordion-6gc0jw1n.js → Accordion-5x4cv0kv.js} +1 -1
  105. package/web-dist/chunks/{Accordion-r8swmfjm.js → Accordion-6d63tc7d.js} +1 -1
  106. package/web-dist/chunks/{Accordion-vbz1mjm6.js → Accordion-7eysykr1.js} +4 -4
  107. package/web-dist/chunks/{Accordion-59x6e7bs.js → Accordion-91qf4q27.js} +1 -1
  108. package/web-dist/chunks/{Accordion-hadw5304.js → Accordion-98886mbn.js} +1 -1
  109. package/web-dist/chunks/{Accordion-vtbs98r4.js → Accordion-a0hbjxg9.js} +4 -4
  110. package/web-dist/chunks/{Accordion-73p2mg3h.js → Accordion-a49s4ywn.js} +4 -4
  111. package/web-dist/chunks/{Accordion-tb0vc91c.js → Accordion-a8b6g53f.js} +4 -4
  112. package/web-dist/chunks/{Accordion-25v2vczc.js → Accordion-afxbyvwp.js} +3 -3
  113. package/web-dist/chunks/{Accordion-g5pvs1aa.js → Accordion-ajqj6ymg.js} +5 -5
  114. package/web-dist/chunks/{Accordion-w2kx944a.js → Accordion-ak6dvant.js} +3 -3
  115. package/web-dist/chunks/{Accordion-778fjjsh.js → Accordion-b1tqkxx6.js} +3 -3
  116. package/web-dist/chunks/{Accordion-rp9cjtpg.js → Accordion-bm30dkbw.js} +2 -2
  117. package/web-dist/chunks/{Accordion-rsw5jt7m.js → Accordion-cah5j61y.js} +2 -2
  118. package/web-dist/chunks/{Accordion-pr1tv6jx.js → Accordion-dfr26j8m.js} +1 -1
  119. package/web-dist/chunks/{Accordion-zmrbktd8.js → Accordion-dnfgtbq3.js} +8 -8
  120. package/web-dist/chunks/{Accordion-m3tq2vcc.js → Accordion-dy1j2a7p.js} +6 -6
  121. package/web-dist/chunks/{Accordion-7pgh8q4h.js → Accordion-e9jwetg7.js} +2 -2
  122. package/web-dist/chunks/{Accordion-gnkzvj03.js → Accordion-e9xmwxzp.js} +1 -1
  123. package/web-dist/chunks/{Accordion-q8ymmar7.js → Accordion-ek0hh2nx.js} +4 -4
  124. package/web-dist/chunks/{Accordion-2berhsg5.js → Accordion-et7xzm6k.js} +9 -9
  125. package/web-dist/chunks/Accordion-eysfka31.js +1590 -0
  126. package/web-dist/chunks/{Accordion-3xfqmr1r.js → Accordion-gy3bx3xa.js} +2 -2
  127. package/web-dist/chunks/{Accordion-tj4fe6wk.js → Accordion-h2rnzgyv.js} +3 -3
  128. package/web-dist/chunks/Accordion-hbwhya78.js +83 -0
  129. package/web-dist/chunks/{Accordion-t9w365ke.js → Accordion-hbwyj12m.js} +1 -1
  130. package/web-dist/chunks/{Accordion-q2yxtdzc.js → Accordion-j3esnt3f.js} +6 -6
  131. package/web-dist/chunks/Accordion-jkgd7dmf.js +1 -0
  132. package/web-dist/chunks/{Accordion-qwftammh.js → Accordion-kxjjp03t.js} +5 -5
  133. package/web-dist/chunks/Accordion-mkd3k28h.js +275 -0
  134. package/web-dist/chunks/{Accordion-xqkkfwkm.js → Accordion-nhf8zjt4.js} +2 -2
  135. package/web-dist/chunks/{Accordion-hg4db1sk.js → Accordion-p84h11ek.js} +4 -4
  136. package/web-dist/chunks/{Accordion-zhgty1ae.js → Accordion-pagdkp07.js} +3 -3
  137. package/web-dist/chunks/{Accordion-dv5c27w4.js → Accordion-pjbmmr20.js} +1 -1
  138. package/web-dist/chunks/{Accordion-7ayxbm7k.js → Accordion-pr4a281g.js} +1 -1
  139. package/web-dist/chunks/{Accordion-yca8r7kx.js → Accordion-qz6ddnmv.js} +3 -3
  140. package/web-dist/chunks/{Accordion-dcjzxzv3.js → Accordion-rv90tjqr.js} +2 -2
  141. package/web-dist/chunks/{Accordion-0zk0xp73.js → Accordion-snk6nggm.js} +326 -174
  142. package/web-dist/chunks/{Accordion-casb2ndy.js → Accordion-th7yhwhf.js} +5 -5
  143. package/web-dist/chunks/{Accordion-e6ettgh0.js → Accordion-vbh3xqv6.js} +2 -2
  144. package/web-dist/chunks/{Accordion-vdzyhtyd.js → Accordion-w4zh2nws.js} +8 -8
  145. package/web-dist/chunks/Accordion-w8zke8fa.js +37 -0
  146. package/web-dist/chunks/{Accordion-3e60xwvy.js → Accordion-wkqemqjw.js} +1 -1
  147. package/web-dist/chunks/{Accordion-vwqf8kn1.js → Accordion-x9sb23p3.js} +3 -3
  148. package/web-dist/chunks/{Accordion-xhkphta6.js → Accordion-y6sg47rv.js} +1 -1
  149. package/web-dist/chunks/{Accordion-mw8zh0vs.js → Accordion-yannd7r3.js} +4 -4
  150. package/web-dist/chunks/{Accordion-457amtv7.js → Accordion-z3m3wvfz.js} +6 -1580
  151. package/web-dist/chunks/{Accordion-pvcdvh3w.js → Accordion-zagrbkq1.js} +2 -2
  152. package/web-dist/chunks/{Accordion-2jcas7qq.js → Accordion-zays65re.js} +5 -5
  153. package/web-dist/chunks/{RichTextClient-w75r2x97.js → RichTextClient-qd6gmm0x.js} +12 -11
  154. package/web-dist/chunks/{Video.native-bb9g33nd.js → Video.native-7zsbp5vg.js} +7 -6
  155. package/web-dist/components/accordion/Accordion.js +6 -5
  156. package/web-dist/components/accordion-item/AccordionItem.js +6 -5
  157. package/web-dist/components/activity-indicator/ActivityIndicator.js +1 -1
  158. package/web-dist/components/app-bar/AppBar.js +8 -7
  159. package/web-dist/components/app-header/AppHeader.js +8 -7
  160. package/web-dist/components/app-shell/AppShell.js +3 -2
  161. package/web-dist/components/audio/Audio.js +6 -5
  162. package/web-dist/components/auth-screen/AuthScreen.js +11 -10
  163. package/web-dist/components/avatar/Avatar.js +6 -5
  164. package/web-dist/components/avatar-group/AvatarGroup.js +6 -5
  165. package/web-dist/components/badge/Badge.js +2 -2
  166. package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +11 -10
  167. package/web-dist/components/bottom-sheet/BottomSheet.js +4 -3
  168. package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +4 -3
  169. package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +4 -3
  170. package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +4 -3
  171. package/web-dist/components/bottom-sheet-view/BottomSheetView.js +4 -3
  172. package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +4 -3
  173. package/web-dist/components/breadcrumbs/Breadcrumbs.js +6 -5
  174. package/web-dist/components/button/Button.js +4 -3
  175. package/web-dist/components/button-group/ButtonGroup.js +4 -3
  176. package/web-dist/components/calendar/Calendar.js +8 -7
  177. package/web-dist/components/camera-permission-view/CameraPermissionView.js +11 -10
  178. package/web-dist/components/card/Card.js +10 -9
  179. package/web-dist/components/card-back/CardBack.js +2 -2
  180. package/web-dist/components/card-hand/CardHand.js +2 -2
  181. package/web-dist/components/chat-list-item/ChatListItem.js +8 -7
  182. package/web-dist/components/checkbox/Checkbox.js +5 -4
  183. package/web-dist/components/checkbox-group/CheckboxGroup.js +5 -4
  184. package/web-dist/components/chess-board/ChessBoard.js +4 -3
  185. package/web-dist/components/chip/Chip.js +6 -5
  186. package/web-dist/components/chip-group/ChipGroup.js +6 -5
  187. package/web-dist/components/collection-editor/CollectionEditor.js +10 -9
  188. package/web-dist/components/color-hue-scale/ColorHueScale.js +17 -15
  189. package/web-dist/components/color-picker/ColorPicker.js +17 -15
  190. package/web-dist/components/color-tone/ColorTone.js +17 -15
  191. package/web-dist/components/color-wheel/ColorWheel.js +17 -15
  192. package/web-dist/components/content-rail/ContentRail.js +5 -4
  193. package/web-dist/components/data-table/DataTable.js +16 -15
  194. package/web-dist/components/date-picker/DatePicker.js +10 -9
  195. package/web-dist/components/dialog/Dialog.js +5 -4
  196. package/web-dist/components/divider/Divider.js +3 -2
  197. package/web-dist/components/empty-state/EmptyState.js +11 -10
  198. package/web-dist/components/explorer/Explorer.js +8 -7
  199. package/web-dist/components/field/Field.js +5 -4
  200. package/web-dist/components/file-explorer/FileExplorer.js +8 -7
  201. package/web-dist/components/flat-list/FlatList.js +6 -5
  202. package/web-dist/components/flow-canvas/FlowCanvas.d.ts +7 -0
  203. package/web-dist/components/flow-canvas/FlowCanvas.dependency-0.d.ts +27 -0
  204. package/web-dist/components/flow-canvas/FlowCanvas.dependency-1.d.ts +3 -0
  205. package/web-dist/components/flow-canvas/FlowCanvas.js +513 -0
  206. package/web-dist/components/flow-canvas/FlowCanvas.types-0.d.ts +92 -0
  207. package/web-dist/components/flow-canvas/index.d.ts +2 -0
  208. package/web-dist/components/flow-canvas/index.js +2 -0
  209. package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +11 -10
  210. package/web-dist/components/form/Form.js +7 -6
  211. package/web-dist/components/form-actions/FormActions.js +7 -6
  212. package/web-dist/components/form-error/FormError.js +7 -6
  213. package/web-dist/components/game/Game.js +4 -3
  214. package/web-dist/components/game-entity/GameEntity.js +4 -3
  215. package/web-dist/components/game-field/GameField.js +4 -3
  216. package/web-dist/components/game-input-zone/GameInputZone.js +4 -3
  217. package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +4 -3
  218. package/web-dist/components/game-overlay/GameOverlay.js +4 -3
  219. package/web-dist/components/gradient/Gradient.js +4 -3
  220. package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +4 -3
  221. package/web-dist/components/graph-node/GraphNode.d.ts +7 -0
  222. package/web-dist/components/graph-node/GraphNode.dependency-0.d.ts +27 -0
  223. package/web-dist/components/graph-node/GraphNode.dependency-1.d.ts +3 -0
  224. package/web-dist/components/graph-node/GraphNode.dependency-2.d.ts +5 -0
  225. package/web-dist/components/graph-node/GraphNode.js +20 -0
  226. package/web-dist/components/graph-node/GraphNode.types-0.d.ts +46 -0
  227. package/web-dist/components/graph-node/index.d.ts +2 -0
  228. package/web-dist/components/graph-node/index.js +2 -0
  229. package/web-dist/components/grid/Grid.js +3 -2
  230. package/web-dist/components/grid-line-overlay/GridLineOverlay.js +2 -2
  231. package/web-dist/components/grid-ruler/GridRuler.js +2 -2
  232. package/web-dist/components/grid-view/GridView.d.ts +1 -1
  233. package/web-dist/components/grid-view/GridView.js +2 -1
  234. package/web-dist/components/grid-view/GridView.types-0.d.ts +21 -0
  235. package/web-dist/components/heading/Heading.js +2 -2
  236. package/web-dist/components/hero/Hero.js +10 -9
  237. package/web-dist/components/icon/Icon.js +2 -2
  238. package/web-dist/components/icon-button/IconButton.js +4 -3
  239. package/web-dist/components/image/Image.js +5 -4
  240. package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +2 -2
  241. package/web-dist/components/link/Link.js +2 -2
  242. package/web-dist/components/list/List.js +6 -5
  243. package/web-dist/components/list-item/ListItem.js +6 -5
  244. package/web-dist/components/list-section/ListSection.js +6 -5
  245. package/web-dist/components/master-detail/MasterDetail.js +3 -2
  246. package/web-dist/components/matrix-grid/MatrixGrid.js +5 -4
  247. package/web-dist/components/media-card/MediaCard.js +10 -9
  248. package/web-dist/components/media-explorer/MediaExplorer.js +8 -7
  249. package/web-dist/components/message-bubble/MessageBubble.js +8 -7
  250. package/web-dist/components/metric-card/MetricCard.js +10 -9
  251. package/web-dist/components/missing-element/MissingElement.js +5 -4
  252. package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +11 -10
  253. package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +11 -10
  254. package/web-dist/components/opening-book/OpeningBook.js +4 -3
  255. package/web-dist/components/otp-form/OtpForm.js +11 -10
  256. package/web-dist/components/pagination/Pagination.js +5 -4
  257. package/web-dist/components/palette-item/PaletteItem.js +10 -9
  258. package/web-dist/components/playing-card/PlayingCard.js +2 -2
  259. package/web-dist/components/poker-training-table/PokerTrainingTable.js +2 -2
  260. package/web-dist/components/popover/Popover.js +1 -1
  261. package/web-dist/components/popover-menu/PopoverMenu.js +5 -4
  262. package/web-dist/components/post-card/PostCard.js +10 -9
  263. package/web-dist/components/product-card/ProductCard.js +10 -9
  264. package/web-dist/components/progress/Progress.js +5 -4
  265. package/web-dist/components/progress-ring/ProgressRing.js +5 -4
  266. package/web-dist/components/radio/Radio.js +6 -5
  267. package/web-dist/components/radio-group/RadioGroup.js +6 -5
  268. package/web-dist/components/rating/Rating.js +4 -3
  269. package/web-dist/components/reader/Reader.js +11 -10
  270. package/web-dist/components/rich-text/RichText.js +3 -3
  271. package/web-dist/components/runtime-authoring-overlay/RuntimeAuthoringOverlay.js +4 -3
  272. package/web-dist/components/scan-overlay/ScanOverlay.js +11 -10
  273. package/web-dist/components/screen/Screen.js +3 -2
  274. package/web-dist/components/screen-section/ScreenSection.js +5 -4
  275. package/web-dist/components/scroll-view/ScrollView.js +3 -2
  276. package/web-dist/components/search-input/SearchInput.js +6 -5
  277. package/web-dist/components/section-header/SectionHeader.js +5 -4
  278. package/web-dist/components/section-list/SectionList.js +6 -5
  279. package/web-dist/components/select/Select.js +11 -10
  280. package/web-dist/components/selectable-item/SelectableItem.js +4 -3
  281. package/web-dist/components/selection-provider/SelectionProvider.js +4 -3
  282. package/web-dist/components/sign-in-form/SignInForm.js +11 -10
  283. package/web-dist/components/sign-up-form/SignUpForm.js +11 -10
  284. package/web-dist/components/skeleton/Skeleton.js +13 -12
  285. package/web-dist/components/skeleton-card/SkeletonCard.js +13 -12
  286. package/web-dist/components/skeleton-list/SkeletonList.js +13 -12
  287. package/web-dist/components/skeleton-text/SkeletonText.js +13 -12
  288. package/web-dist/components/spatial-grid/SpatialGrid.js +2 -1
  289. package/web-dist/components/surface/Surface.js +2 -2
  290. package/web-dist/components/switch/Switch.js +1 -1
  291. package/web-dist/components/tab/Tab.js +2 -2
  292. package/web-dist/components/tab-list/TabList.js +2 -2
  293. package/web-dist/components/tab-panel/TabPanel.js +2 -2
  294. package/web-dist/components/tabletop-table/TabletopTable.js +2 -2
  295. package/web-dist/components/tabs/Tabs.js +2 -2
  296. package/web-dist/components/text/Text.js +2 -2
  297. package/web-dist/components/text-input/TextInput.js +5 -4
  298. package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +4 -3
  299. package/web-dist/components/tile-grid/TileGrid.js +2 -1
  300. package/web-dist/components/time-grid/TimeGrid.js +3 -2
  301. package/web-dist/components/time-picker/TimePicker.js +7 -6
  302. package/web-dist/components/timeline/Timeline.js +6 -5
  303. package/web-dist/components/toast/Toast.js +2 -2
  304. package/web-dist/components/toast-provider/ToastProvider.js +2 -2
  305. package/web-dist/components/toolbar/Toolbar.js +11 -10
  306. package/web-dist/components/tree-item/TreeItem.js +9 -8
  307. package/web-dist/components/uploader/Uploader.js +13 -12
  308. package/web-dist/components/video/Video.js +7 -6
  309. package/web-dist/components/view/View.js +3 -2
  310. package/web-dist/components/zora-provider/ZoraProvider.d.ts +7 -0
  311. package/web-dist/components/zora-provider/ZoraProvider.dependency-0.d.ts +15 -0
  312. package/web-dist/components/zora-provider/ZoraProvider.js +11 -0
  313. package/web-dist/components/zora-provider/ZoraProvider.types-0.d.ts +19 -0
  314. package/web-dist/components/zora-provider/index.d.ts +2 -0
  315. package/web-dist/components/zora-provider/index.js +2 -0
  316. package/web-dist/components/zora-theme-scope/ZoraThemeScope.d.ts +14 -0
  317. package/web-dist/components/zora-theme-scope/ZoraThemeScope.js +11 -0
  318. package/web-dist/components/zora-theme-scope/ZoraThemeScope.types-0.d.ts +3 -0
  319. package/web-dist/components/zora-theme-scope/index.d.ts +2 -0
  320. package/web-dist/components/zora-theme-scope/index.js +2 -0
  321. package/web-dist/components/zora-web-style-sheet/ZoraWebStyleSheet.js +3 -2
  322. package/web-dist/manifest.json +1058 -832
  323. package/web-dist/runtime/ZoraProvider.js +4 -80
@@ -0,0 +1,1590 @@
1
+ 'use client';
2
+ import {
3
+ converter_default,
4
+ formatHex,
5
+ normalizeHueDegrees,
6
+ parseHexToOklch,
7
+ oklchToHex,
8
+ deltaEoklch
9
+ } from "./Accordion-cwx73cjc.js";
10
+ import {
11
+ withZoraThemeScope
12
+ } from "./Accordion-pagdkp07.js";
13
+ import {
14
+ View2,
15
+ Divider2
16
+ } from "./Accordion-2kv6p7by.js";
17
+ import {
18
+ useZoraTheme2
19
+ } from "./Accordion-x1ze1wvk.js";
20
+ import {
21
+ Heading2,
22
+ Text2
23
+ } from "./Accordion-5x4cv0kv.js";
24
+ import {
25
+ IconButton2
26
+ } from "./Accordion-vbh3xqv6.js";
27
+ import {
28
+ Circle,
29
+ Defs,
30
+ Line,
31
+ LinearGradient,
32
+ Path,
33
+ Polygon,
34
+ RadialGradient,
35
+ Rect,
36
+ Stop,
37
+ Svg
38
+ } from "./Accordion-z3m3wvfz.js";
39
+ import {
40
+ Card2
41
+ } from "./Accordion-dnfgtbq3.js";
42
+ import {
43
+ Icon2
44
+ } from "./Accordion-hbwyj12m.js";
45
+ import {
46
+ Select2
47
+ } from "./Accordion-w4zh2nws.js";
48
+ import {
49
+ Gradient2
50
+ } from "./Accordion-zagrbkq1.js";
51
+ import {
52
+ isHexColor,
53
+ parseHexColorOrThrow
54
+ } from "./Accordion-fsdgssfq.js";
55
+
56
+ // node_modules/@ankhorage/color-theory/dist/harmony.js
57
+ var COLOR_HARMONY_CATALOG = [
58
+ {
59
+ id: "monochromatic",
60
+ label: "Monochromatic",
61
+ description: "Uses one hue with ramp variation.",
62
+ offsets: [0],
63
+ roles: ["primary"],
64
+ roleCount: 1
65
+ },
66
+ {
67
+ id: "analogous",
68
+ label: "Analogous",
69
+ description: "Uses the primary hue and its two neighboring hues at minus and plus 30 degrees.",
70
+ offsets: [0, -30, 30],
71
+ roles: ["primary", "secondary", "tertiary"],
72
+ roleCount: 3
73
+ },
74
+ {
75
+ id: "complementary",
76
+ label: "Complementary",
77
+ description: "Pairs the primary hue with its opposite hue at 180 degrees.",
78
+ offsets: [0, 180],
79
+ roles: ["primary", "secondary"],
80
+ roleCount: 2
81
+ },
82
+ {
83
+ id: "splitComplementary",
84
+ label: "Split complementary",
85
+ description: "Uses the primary hue with hues at 150 and 210 degrees.",
86
+ offsets: [0, 150, 210],
87
+ roles: ["primary", "secondary", "tertiary"],
88
+ roleCount: 3
89
+ },
90
+ {
91
+ id: "triadic",
92
+ label: "Triadic",
93
+ description: "Uses three evenly spaced hues at 120-degree intervals.",
94
+ offsets: [0, 120, 240],
95
+ roles: ["primary", "secondary", "tertiary"],
96
+ roleCount: 3
97
+ },
98
+ {
99
+ id: "tetradic",
100
+ label: "Tetradic",
101
+ description: "Uses a rectangular tetrad at 0, 60, 180, and 240 degrees.",
102
+ offsets: [0, 60, 180, 240],
103
+ roles: ["primary", "secondary", "tertiary", "quaternary"],
104
+ roleCount: 4
105
+ },
106
+ {
107
+ id: "square",
108
+ label: "Square",
109
+ description: "Uses four evenly spaced hues at 90-degree intervals.",
110
+ offsets: [0, 90, 180, 270],
111
+ roles: ["primary", "secondary", "tertiary", "quaternary"],
112
+ roleCount: 4
113
+ }
114
+ ];
115
+ var COLOR_HARMONIES = COLOR_HARMONY_CATALOG.map(({ id }) => id);
116
+ var MIN_HUEFUL_CHROMA = 0.015;
117
+ function createHarmonyGenerationDiagnostics(primaryChroma) {
118
+ const warnings = [];
119
+ if (primaryChroma === 0) {
120
+ warnings.push({
121
+ code: "achromatic_primary",
122
+ message: "The selected primary is achromatic, so generated hue relationships are not visible."
123
+ });
124
+ } else if (primaryChroma < MIN_HUEFUL_CHROMA) {
125
+ warnings.push({
126
+ code: "low_chroma_primary",
127
+ message: "The selected primary has low chroma, so generated hue relationships may be weak."
128
+ });
129
+ }
130
+ return {
131
+ isHueReliable: primaryChroma >= MIN_HUEFUL_CHROMA,
132
+ primaryChroma,
133
+ warnings
134
+ };
135
+ }
136
+ function getHarmonyDefinition(harmony) {
137
+ const definition = COLOR_HARMONY_CATALOG.find(({ id }) => id === harmony);
138
+ if (!definition) {
139
+ throw new Error(`[color-theory] Missing definition for harmony ${harmony}.`);
140
+ }
141
+ return definition;
142
+ }
143
+ function generateHarmonyRoleColors(primaryColor, harmony) {
144
+ const base = parseHexToOklch(primaryColor);
145
+ const definition = getHarmonyDefinition(harmony);
146
+ const baseHue = normalizeHueDegrees(base.h);
147
+ const colors = definition.roles.map((role, index) => {
148
+ const hueDegrees = normalizeHueDegrees(baseHue + (definition.offsets.at(index) ?? 0));
149
+ return {
150
+ role,
151
+ hex: role === "primary" ? primaryColor : oklchToHex({ ...base, h: hueDegrees }),
152
+ hueDegrees,
153
+ source: role === "primary" ? "selected" : "generated"
154
+ };
155
+ });
156
+ const primary = colors.find((color) => color.role === "primary");
157
+ if (!primary) {
158
+ throw new Error("[color-theory] Expected generated harmony role colors to include primary.");
159
+ }
160
+ const secondary = colors.find((color) => color.role === "secondary");
161
+ const tertiary = colors.find((color) => color.role === "tertiary");
162
+ const quaternary = colors.find((color) => color.role === "quaternary");
163
+ return {
164
+ harmony,
165
+ colors,
166
+ primary,
167
+ ...secondary ? { secondary } : {},
168
+ ...tertiary ? { tertiary } : {},
169
+ ...quaternary ? { quaternary } : {},
170
+ diagnostics: createHarmonyGenerationDiagnostics(base.c)
171
+ };
172
+ }
173
+
174
+ // node_modules/@ankhorage/color-theory/dist/swatches.js
175
+ var COLOR_SWATCH_STEPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
176
+ var COLOR_SWATCH_BASE_STEP = 500;
177
+ var COLOR_SWATCH_BASE_LIGHTNESS = 0.551;
178
+ var BASELINE_LIGHTNESS_BY_STEP = new Map([
179
+ [50, 0.985],
180
+ [100, 0.967],
181
+ [200, 0.928],
182
+ [300, 0.872],
183
+ [400, 0.707],
184
+ [COLOR_SWATCH_BASE_STEP, COLOR_SWATCH_BASE_LIGHTNESS],
185
+ [600, 0.446],
186
+ [700, 0.373],
187
+ [800, 0.278],
188
+ [900, 0.21],
189
+ [950, 0.13]
190
+ ]);
191
+ var MIN_USABLE_ADJACENT_DELTA = 0.012;
192
+ var MIN_USABLE_LIGHTNESS_RANGE = 0.35;
193
+ function clamp01(value) {
194
+ if (!Number.isFinite(value))
195
+ return 0;
196
+ return Math.min(1, Math.max(0, value));
197
+ }
198
+ function chromaMultiplierForStep(step) {
199
+ if (step <= 200)
200
+ return 0.55;
201
+ if (step <= 400)
202
+ return 0.75;
203
+ if (step === COLOR_SWATCH_BASE_STEP)
204
+ return 1;
205
+ if (step <= 700)
206
+ return 0.9;
207
+ return 0.8;
208
+ }
209
+ function getBaselineLightness(step) {
210
+ const lightness = BASELINE_LIGHTNESS_BY_STEP.get(step);
211
+ if (lightness === undefined) {
212
+ throw new Error(`[color-theory] Missing baseline lightness for swatch step ${step}.`);
213
+ }
214
+ return lightness;
215
+ }
216
+ function createSwatchSample(baseColor, step, baseOffset) {
217
+ const base = parseHexToOklch(baseColor);
218
+ if (step === COLOR_SWATCH_BASE_STEP) {
219
+ return { hex: baseColor, lightness: base.l, step };
220
+ }
221
+ const target = {
222
+ ...base,
223
+ l: clamp01(getBaselineLightness(step) + baseOffset),
224
+ c: clamp01(base.c * chromaMultiplierForStep(step))
225
+ };
226
+ const hex = oklchToHex(target);
227
+ return { hex, lightness: parseHexToOklch(hex).l, step };
228
+ }
229
+ function createWeakStepWarning(baseColor, sample) {
230
+ if (sample.step === COLOR_SWATCH_BASE_STEP)
231
+ return;
232
+ const deltaEFromBase = deltaEoklch(parseHexToOklch(baseColor), parseHexToOklch(sample.hex));
233
+ if (deltaEFromBase >= 0.02)
234
+ return;
235
+ return {
236
+ code: "weak_step",
237
+ step: sample.step,
238
+ deltaEFromBase,
239
+ message: `Swatch step ${sample.step} is visually close to the base color.`
240
+ };
241
+ }
242
+ function generateSwatchSamples(baseColor) {
243
+ const baseOffset = parseHexToOklch(baseColor).l - COLOR_SWATCH_BASE_LIGHTNESS;
244
+ const samples = COLOR_SWATCH_STEPS.map((step) => createSwatchSample(baseColor, step, baseOffset));
245
+ const warnings = samples.map((sample) => createWeakStepWarning(baseColor, sample)).filter((warning) => warning !== undefined);
246
+ return { samples, warnings };
247
+ }
248
+ function measureAdjacentSamples(samples) {
249
+ const pairs = samples.slice(1).map((current, index) => ({ current, previous: samples.at(index) }));
250
+ const measured = pairs.flatMap(({ current, previous }) => {
251
+ if (!previous)
252
+ return [];
253
+ const delta = deltaEoklch(parseHexToOklch(previous.hex), parseHexToOklch(current.hex));
254
+ const warning = delta < MIN_USABLE_ADJACENT_DELTA ? {
255
+ code: "weak_adjacent_delta",
256
+ step: current.step,
257
+ deltaEFromBase: delta,
258
+ message: `Swatch step ${current.step} is visually close to adjacent step ${previous.step}.`
259
+ } : undefined;
260
+ return [{ delta, warning }];
261
+ });
262
+ return {
263
+ deltas: measured.map(({ delta }) => delta),
264
+ warnings: measured.map(({ warning }) => warning).filter((warning) => warning !== undefined)
265
+ };
266
+ }
267
+ function createSwatchDiagnostics(samples, adjacentDeltas, warnings) {
268
+ const minAdjacentDelta = Math.min(...adjacentDeltas);
269
+ const maxAdjacentDelta = Math.max(...adjacentDeltas);
270
+ const lightnessEntries = samples.map(({ lightness }) => lightness);
271
+ const minLightness = Math.min(...lightnessEntries);
272
+ const maxLightness = Math.max(...lightnessEntries);
273
+ const lightnessRange = maxLightness - minLightness;
274
+ const rangeWarnings = lightnessRange < MIN_USABLE_LIGHTNESS_RANGE ? [
275
+ {
276
+ code: "limited_lightness_range",
277
+ message: "Generated swatch has a limited lightness range."
278
+ }
279
+ ] : [];
280
+ return {
281
+ isUsable: minAdjacentDelta >= MIN_USABLE_ADJACENT_DELTA && lightnessRange >= MIN_USABLE_LIGHTNESS_RANGE,
282
+ warnings: [...warnings, ...rangeWarnings],
283
+ minAdjacentDelta,
284
+ maxAdjacentDelta,
285
+ lightnessRange: { min: minLightness, max: maxLightness }
286
+ };
287
+ }
288
+ function generateColorSwatch(baseColor) {
289
+ const generated = generateSwatchSamples(baseColor);
290
+ const adjacent = measureAdjacentSamples(generated.samples);
291
+ const swatch = Object.fromEntries(generated.samples.map(({ hex, step }) => [step, hex]));
292
+ return {
293
+ swatch,
294
+ diagnostics: createSwatchDiagnostics(generated.samples, adjacent.deltas, [
295
+ ...generated.warnings,
296
+ ...adjacent.warnings
297
+ ])
298
+ };
299
+ }
300
+
301
+ // src/features/color/ColorHueScale.tsx
302
+ import { Pressable } from "@ankhorage/surface/web";
303
+
304
+ // src/features/color/ColorHexField.tsx
305
+ import { useClipboardWriter, writeClipboardTextAsync } from "@ankhorage/runtime";
306
+ import { TextInput } from "@ankhorage/surface/web";
307
+ import React from "react";
308
+ import { jsx, jsxs } from "react/jsx-runtime";
309
+ function ColorHexField({
310
+ disabled,
311
+ onChange,
312
+ value
313
+ }) {
314
+ const [input, setInput] = React.useState(value);
315
+ const [previousValue, setPreviousValue] = React.useState(value);
316
+ const [copyFeedback, setCopyFeedback] = React.useState();
317
+ const clipboardWriter = useClipboardWriter();
318
+ const { theme } = useZoraTheme2();
319
+ if (value !== previousValue) {
320
+ setPreviousValue(value);
321
+ setInput(value);
322
+ }
323
+ return /* @__PURE__ */ jsxs(View2, {
324
+ children: [
325
+ /* @__PURE__ */ jsx(TextInput, {
326
+ accessibilityLabel: "Color hex value",
327
+ disabled,
328
+ leadingAccessory: /* @__PURE__ */ jsx(View2, {
329
+ bg: value,
330
+ borderColor: theme.semantics.border.default,
331
+ borderWidth: 1,
332
+ height: 30,
333
+ radius: "s",
334
+ width: 30
335
+ }),
336
+ onChangeText: (nextValue) => {
337
+ setInput(nextValue);
338
+ if (isHexColor(nextValue))
339
+ onChange(nextValue);
340
+ },
341
+ trailingAccessory: /* @__PURE__ */ jsx(IconButton2, {
342
+ iconName: copyFeedback === "Color hex copied." ? "checkmark" : copyFeedback ? "warning" : "copy-outline",
343
+ label: copyFeedback ?? "Copy color hex value",
344
+ disabled,
345
+ onPress: () => {
346
+ writeClipboardTextAsync(clipboardWriter, value).then((result) => {
347
+ setCopyFeedback(result === "written" ? "Color hex copied." : result === "denied" ? "Clipboard access was denied." : "Clipboard is unavailable.");
348
+ });
349
+ },
350
+ variant: "ghost"
351
+ }),
352
+ value: input
353
+ }),
354
+ copyFeedback ? /* @__PURE__ */ jsx(Text2, {
355
+ accessibilityLiveRegion: "polite",
356
+ emphasis: "muted",
357
+ style: { position: "absolute", opacity: 0 },
358
+ variant: "caption",
359
+ children: copyFeedback
360
+ }) : null
361
+ ]
362
+ });
363
+ }
364
+
365
+ // src/features/color/ColorSpectrumSlider.tsx
366
+ import React3 from "react";
367
+
368
+ // src/features/color/ColorHorizontalPointerProxy.web.tsx
369
+ import React2 from "react";
370
+ import { jsx as jsx2 } from "react/jsx-runtime";
371
+ function ColorHorizontalPointerProxy({
372
+ children,
373
+ disabled,
374
+ onChange,
375
+ width
376
+ }) {
377
+ const dragging = React2.useRef(false);
378
+ const changeAt = (event) => {
379
+ const target = event.currentTarget;
380
+ const rect = target.getBoundingClientRect();
381
+ onChange((event.clientX - rect.left) / rect.width * width);
382
+ };
383
+ return /* @__PURE__ */ jsx2("div", {
384
+ onMouseDown: (event) => {
385
+ if (disabled)
386
+ return;
387
+ dragging.current = true;
388
+ changeAt(event);
389
+ },
390
+ onMouseMove: (event) => {
391
+ if (!disabled && dragging.current)
392
+ changeAt(event);
393
+ },
394
+ onMouseUp: (event) => {
395
+ if (!disabled && dragging.current)
396
+ changeAt(event);
397
+ dragging.current = false;
398
+ },
399
+ style: { touchAction: "none" },
400
+ children
401
+ });
402
+ }
403
+ // src/features/color/utils/resolveOklchColor.ts
404
+ function resolveOklchColor(target, hue) {
405
+ const formatted = formatHex({ mode: "oklch", l: target.lightness, c: target.chroma, h: hue });
406
+ if (!formatted)
407
+ throw new Error("The supplied OKLCH target cannot be represented as a hex color.");
408
+ return parseHexColorOrThrow(formatted);
409
+ }
410
+
411
+ // src/features/color/ColorSpectrumSlider.tsx
412
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
413
+ var SPECTRUM_WIDTH = 280;
414
+ var SPECTRUM_HUES = [0, 60, 120, 180, 240, 300, 360];
415
+ function ColorSpectrumSlider({
416
+ disabled,
417
+ hue,
418
+ label = "Hue",
419
+ onChange
420
+ }) {
421
+ const { theme } = useZoraTheme2();
422
+ const [trackWidth, setTrackWidth] = React3.useState(SPECTRUM_WIDTH);
423
+ const gradientId = `color-spectrum-${React3.useId().replaceAll(":", "")}`;
424
+ const changeAt = (locationX) => {
425
+ if (!disabled)
426
+ onChange(Math.max(0, Math.min(360, locationX / trackWidth * 360)));
427
+ };
428
+ return /* @__PURE__ */ jsxs2(View2, {
429
+ gap: "xxs",
430
+ width: "100%",
431
+ children: [
432
+ /* @__PURE__ */ jsxs2(View2, {
433
+ direction: "row",
434
+ justify: "space-between",
435
+ children: [
436
+ /* @__PURE__ */ jsx3(Text2, {
437
+ variant: "label",
438
+ children: label
439
+ }),
440
+ /* @__PURE__ */ jsx3(Text2, {
441
+ variant: "label",
442
+ children: `${Math.round(hue)}°`
443
+ })
444
+ ]
445
+ }),
446
+ /* @__PURE__ */ jsx3(ColorHorizontalPointerProxy, {
447
+ disabled,
448
+ onChange: changeAt,
449
+ width: SPECTRUM_WIDTH,
450
+ children: /* @__PURE__ */ jsxs2(Svg, {
451
+ accessibilityLabel: `${label} spectrum`,
452
+ height: 36,
453
+ onLayout: (event) => setTrackWidth(Math.max(1, event.nativeEvent.layout.width)),
454
+ viewBox: `0 0 ${SPECTRUM_WIDTH} 36`,
455
+ width: "100%",
456
+ children: [
457
+ /* @__PURE__ */ jsx3(Defs, {
458
+ children: /* @__PURE__ */ jsx3(LinearGradient, {
459
+ id: gradientId,
460
+ x1: "0",
461
+ x2: "1",
462
+ y1: "0",
463
+ y2: "0",
464
+ children: SPECTRUM_HUES.map((stopHue, index) => /* @__PURE__ */ jsx3(Stop, {
465
+ offset: String(index / (SPECTRUM_HUES.length - 1)),
466
+ stopColor: resolveOklchColor({ lightness: 0.65, chroma: 0.2 }, stopHue)
467
+ }, stopHue))
468
+ })
469
+ }),
470
+ /* @__PURE__ */ jsx3(Rect, {
471
+ fill: `url(#${gradientId})`,
472
+ height: 12,
473
+ rx: 6,
474
+ width: SPECTRUM_WIDTH,
475
+ y: 12
476
+ }),
477
+ /* @__PURE__ */ jsx3(Circle, {
478
+ cx: hue / 360 * SPECTRUM_WIDTH,
479
+ cy: 18,
480
+ fill: "white",
481
+ r: 10,
482
+ stroke: theme.semantics.content.default,
483
+ strokeWidth: 2
484
+ }),
485
+ /* @__PURE__ */ jsx3(Rect, {
486
+ fill: "transparent",
487
+ height: 36,
488
+ onResponderGrant: (event) => changeAt(event.nativeEvent.locationX),
489
+ onResponderMove: (event) => changeAt(event.nativeEvent.locationX),
490
+ onResponderRelease: (event) => changeAt(event.nativeEvent.locationX),
491
+ onStartShouldSetResponder: () => !disabled,
492
+ width: SPECTRUM_WIDTH
493
+ })
494
+ ]
495
+ })
496
+ })
497
+ ]
498
+ });
499
+ }
500
+
501
+ // src/features/color/utils/resolveColorAtHue.ts
502
+ var toOklch = converter_default("oklch");
503
+ function resolveColorAtHue(color, hue) {
504
+ const parsed = toOklch(color);
505
+ if (!parsed || typeof parsed.l !== "number" || typeof parsed.c !== "number")
506
+ return color;
507
+ const formatted = formatHex({ mode: "oklch", l: parsed.l, c: parsed.c, h: hue });
508
+ return formatted ? parseHexColorOrThrow(formatted) : color;
509
+ }
510
+
511
+ // src/features/color/utils/resolveColorHue.ts
512
+ var toOklch2 = converter_default("oklch");
513
+ function resolveColorHue(color) {
514
+ const parsed = toOklch2(color);
515
+ return typeof parsed?.h === "number" ? parsed.h : 0;
516
+ }
517
+
518
+ // src/features/color/ColorHueScale.tsx
519
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
520
+ var ColorHueScale2 = withZoraThemeScope(ColorHueScaleInner);
521
+ function ColorHueScaleInner({
522
+ themeId: _themeId,
523
+ mode: _mode,
524
+ inverted: _inverted,
525
+ interactionPolicy,
526
+ value,
527
+ onChange,
528
+ testID
529
+ }) {
530
+ const { theme } = useZoraTheme2();
531
+ const { swatch } = generateColorSwatch(value);
532
+ const swatches = Object.entries(swatch);
533
+ return /* @__PURE__ */ jsxs3(View2, {
534
+ gap: "m",
535
+ testID,
536
+ children: [
537
+ /* @__PURE__ */ jsx4(ColorSpectrumSlider, {
538
+ disabled: interactionPolicy === "passive",
539
+ hue: resolveColorHue(value),
540
+ onChange: (nextHue) => onChange(resolveColorAtHue(value, nextHue))
541
+ }),
542
+ /* @__PURE__ */ jsx4(Text2, {
543
+ variant: "label",
544
+ children: "Intensity"
545
+ }),
546
+ /* @__PURE__ */ jsx4(View2, {
547
+ accessibilityLabel: "Color scale previews; choose a preview as the next 500 base color",
548
+ direction: "row",
549
+ gap: "xs",
550
+ wrap: "wrap",
551
+ children: swatches.map(([step, color]) => /* @__PURE__ */ jsx4(Pressable, {
552
+ accessibilityLabel: Number(step) === 500 ? `Current editable base color 500: ${color}` : `Use generated ${step} preview ${color} as the next base color 500`,
553
+ bg: color,
554
+ borderColor: theme.semantics.border.default,
555
+ borderWidth: Number(step) === 500 ? 3 : 1,
556
+ disabled: interactionPolicy === "passive",
557
+ height: 48,
558
+ onPress: () => onChange(color),
559
+ radius: "s",
560
+ width: "18%",
561
+ children: /* @__PURE__ */ jsx4(Text2, {
562
+ align: "center",
563
+ variant: "caption",
564
+ children: step
565
+ })
566
+ }, step))
567
+ }),
568
+ /* @__PURE__ */ jsx4(ColorHexField, {
569
+ disabled: interactionPolicy === "passive",
570
+ onChange,
571
+ value
572
+ }, value)
573
+ ]
574
+ });
575
+ }
576
+ // src/features/color/ColorPicker.tsx
577
+ import { Pressable as Pressable2 } from "@ankhorage/surface/web";
578
+ import React6 from "react";
579
+ import { View as NativeView } from "react-native-web";
580
+
581
+ // src/features/color/ColorWheel.tsx
582
+ import React5 from "react";
583
+
584
+ // src/features/color/ColorWheelKeyboardProxy.web.tsx
585
+ import { jsx as jsx5 } from "react/jsx-runtime";
586
+ function ColorWheelKeyboardProxy({
587
+ children,
588
+ chroma,
589
+ disabled,
590
+ hue,
591
+ maxChroma = 0.2,
592
+ onChange
593
+ }) {
594
+ return /* @__PURE__ */ jsx5("div", {
595
+ "aria-label": `Color wheel, hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`,
596
+ "aria-valuemax": 360,
597
+ "aria-valuemin": 0,
598
+ "aria-valuenow": Math.round(hue),
599
+ "aria-valuetext": `Hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`,
600
+ "aria-disabled": disabled,
601
+ onKeyDown: (event) => {
602
+ const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma, maxChroma);
603
+ if (!nextValue || disabled)
604
+ return;
605
+ event.preventDefault();
606
+ onChange(nextValue.hue, nextValue.chroma);
607
+ },
608
+ role: "slider",
609
+ tabIndex: disabled ? -1 : 0,
610
+ children
611
+ });
612
+ }
613
+ function resolveKeyboardWheelValue(key, hue, chroma, maxChroma) {
614
+ if (key === "ArrowLeft")
615
+ return { chroma, hue: normalizeHue(hue - 5) };
616
+ if (key === "ArrowRight")
617
+ return { chroma, hue: normalizeHue(hue + 5) };
618
+ if (key === "ArrowDown")
619
+ return { chroma: Math.max(0, chroma - 0.02), hue };
620
+ if (key === "ArrowUp")
621
+ return { chroma: Math.min(maxChroma, chroma + 0.02), hue };
622
+ return;
623
+ }
624
+ function normalizeHue(hue) {
625
+ return hue < 0 ? hue + 360 : hue >= 360 ? hue - 360 : hue;
626
+ }
627
+
628
+ // src/features/color/ColorWheelPointerProxy.web.tsx
629
+ import React4 from "react";
630
+ import { jsx as jsx6 } from "react/jsx-runtime";
631
+ function ColorWheelPointerProxy({
632
+ children,
633
+ disabled,
634
+ height,
635
+ onChange,
636
+ renderedSize: _renderedSize,
637
+ width
638
+ }) {
639
+ const dragging = React4.useRef(false);
640
+ const changeAt = (event) => {
641
+ const target = event.currentTarget;
642
+ const rect = target.getBoundingClientRect();
643
+ onChange((event.clientX - rect.left) / rect.width * width, (event.clientY - rect.top) / rect.height * height);
644
+ };
645
+ return /* @__PURE__ */ jsx6("div", {
646
+ onPointerDown: (event) => {
647
+ if (disabled)
648
+ return;
649
+ dragging.current = true;
650
+ event.currentTarget.setPointerCapture(event.pointerId);
651
+ changeAt(event);
652
+ },
653
+ onPointerMove: (event) => {
654
+ if (!disabled && dragging.current)
655
+ changeAt(event);
656
+ },
657
+ onPointerUp: (event) => {
658
+ if (!disabled && dragging.current)
659
+ changeAt(event);
660
+ dragging.current = false;
661
+ },
662
+ onPointerCancel: () => {
663
+ dragging.current = false;
664
+ },
665
+ style: { touchAction: "none" },
666
+ children
667
+ });
668
+ }
669
+
670
+ // src/features/color/utils/resolveWheelColorComponents.ts
671
+ var toOklch3 = converter_default("oklch");
672
+ function resolveWheelColorComponents(color) {
673
+ const parsed = toOklch3(color);
674
+ return {
675
+ chroma: typeof parsed?.c === "number" ? parsed.c : 0,
676
+ lightness: typeof parsed?.l === "number" ? parsed.l : 0.65
677
+ };
678
+ }
679
+
680
+ // src/features/color/utils/resolveWheelColor.ts
681
+ function resolveWheelColor(color, x, y, center, radius, maxChroma, lightness = resolveWheelColorComponents(color).lightness) {
682
+ const deltaX = x - center;
683
+ const deltaY = y - center;
684
+ const distance = Math.min(Math.hypot(deltaX, deltaY), radius);
685
+ const hue = normalizeHue2(Math.atan2(deltaY, deltaX) * 180 / Math.PI + 90);
686
+ const chroma = distance / radius * maxChroma;
687
+ return resolveOklchColor({ lightness, chroma }, hue);
688
+ }
689
+ function normalizeHue2(hue) {
690
+ return hue < 0 ? hue + 360 : hue;
691
+ }
692
+
693
+ // src/features/color/ColorWheel.tsx
694
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
695
+ var VIEWBOX = 1000;
696
+ var CENTER = VIEWBOX / 2;
697
+ var RADIUS = 480;
698
+ var SEGMENTS = 720;
699
+ var MAX_CHROMA = 0.2;
700
+ var ColorWheel2 = withZoraThemeScope(ColorWheelInner);
701
+ function ColorWheelInner({
702
+ themeId: _themeId,
703
+ mode: _mode,
704
+ inverted: _inverted,
705
+ interactionPolicy,
706
+ value,
707
+ harmony = null,
708
+ toneTarget,
709
+ onChange,
710
+ size = 340,
711
+ testID
712
+ }) {
713
+ const hue = resolveColorHue(value);
714
+ const { chroma, lightness } = resolveWheelColorComponents(value);
715
+ const targetLightness = toneTarget?.lightness ?? lightness;
716
+ const maximumChroma = toneTarget?.chroma ?? MAX_CHROMA;
717
+ const primaryPoint = pointFor(hue, Math.min(1, chroma / maximumChroma));
718
+ const harmonyRoles = harmony ? generateHarmonyRoleColors(value, harmony).colors : [];
719
+ const harmonyPoints = harmonyRoles.map((role) => ({
720
+ color: role.hex,
721
+ ...pointFor(role.hueDegrees, Math.min(1, resolveWheelColorComponents(role.hex).chroma / maximumChroma))
722
+ }));
723
+ const gradientId = `color-wheel-${React5.useId().replaceAll(":", "")}`;
724
+ const changeAt = (x, y) => {
725
+ if (interactionPolicy !== "passive")
726
+ onChange({
727
+ color: resolveWheelColor(value, x, y, CENTER, RADIUS, maximumChroma, targetLightness),
728
+ harmony
729
+ });
730
+ };
731
+ return /* @__PURE__ */ jsx7(ColorWheelKeyboardProxy, {
732
+ chroma,
733
+ disabled: interactionPolicy === "passive",
734
+ hue,
735
+ maxChroma: maximumChroma,
736
+ onChange: (nextHue, nextChroma) => onChange({
737
+ color: resolveOklchColor({ chroma: nextChroma, lightness: targetLightness }, nextHue),
738
+ harmony
739
+ }),
740
+ children: /* @__PURE__ */ jsx7(ColorWheelPointerProxy, {
741
+ disabled: interactionPolicy === "passive",
742
+ height: VIEWBOX,
743
+ onChange: changeAt,
744
+ renderedSize: size,
745
+ width: VIEWBOX,
746
+ children: /* @__PURE__ */ jsxs4(Svg, {
747
+ accessibilityLabel: "Color wheel",
748
+ height: size,
749
+ testID,
750
+ viewBox: `0 0 ${VIEWBOX} ${VIEWBOX}`,
751
+ width: size,
752
+ children: [
753
+ /* @__PURE__ */ jsx7(Defs, {
754
+ children: segments(targetLightness, maximumChroma).map((segment) => /* @__PURE__ */ jsxs4(RadialGradient, {
755
+ cx: CENTER,
756
+ cy: CENTER,
757
+ gradientUnits: "userSpaceOnUse",
758
+ id: `${gradientId}-${segment.hue}`,
759
+ r: RADIUS,
760
+ children: [
761
+ /* @__PURE__ */ jsx7(Stop, {
762
+ offset: "0",
763
+ stopColor: segment.centerColor
764
+ }),
765
+ /* @__PURE__ */ jsx7(Stop, {
766
+ offset: "1",
767
+ stopColor: segment.color
768
+ })
769
+ ]
770
+ }, segment.hue))
771
+ }),
772
+ segments(targetLightness, maximumChroma).map((segment) => /* @__PURE__ */ jsx7(Path, {
773
+ d: segment.path,
774
+ fill: `url(#${gradientId}-${segment.hue})`
775
+ }, segment.hue)),
776
+ harmonyPoints.length >= 3 ? /* @__PURE__ */ jsx7(Polygon, {
777
+ fill: "none",
778
+ points: harmonyPoints.map((point) => `${point.x},${point.y}`).join(" "),
779
+ stroke: "white",
780
+ strokeWidth: 6
781
+ }) : linesFor(harmonyPoints, primaryPoint, "white"),
782
+ harmonyPoints.filter((point) => point.color !== value).map((point) => /* @__PURE__ */ jsx7(Circle, {
783
+ cx: point.x,
784
+ cy: point.y,
785
+ fill: point.color,
786
+ stroke: "white",
787
+ strokeWidth: 6,
788
+ r: 26
789
+ }, `${point.x}-${point.y}`)),
790
+ /* @__PURE__ */ jsx7(Circle, {
791
+ cx: primaryPoint.x,
792
+ cy: primaryPoint.y,
793
+ fill: value,
794
+ r: 36,
795
+ stroke: "white",
796
+ strokeWidth: 12
797
+ }),
798
+ /* @__PURE__ */ jsx7(Circle, {
799
+ cx: primaryPoint.x,
800
+ cy: primaryPoint.y,
801
+ fill: "none",
802
+ r: 42,
803
+ stroke: "white",
804
+ strokeWidth: 6
805
+ })
806
+ ]
807
+ })
808
+ })
809
+ });
810
+ }
811
+ function segments(lightness, maximumChroma) {
812
+ return Array.from({ length: SEGMENTS }, (_, index) => {
813
+ const hue = index * 360 / SEGMENTS;
814
+ return {
815
+ centerColor: resolveOklchColor({ chroma: 0, lightness }, hue),
816
+ color: resolveOklchColor({ chroma: maximumChroma, lightness }, hue),
817
+ hue,
818
+ path: segmentPath(hue, hue + 360 / SEGMENTS)
819
+ };
820
+ });
821
+ }
822
+ function segmentPath(start, end) {
823
+ const startPoint = pointFor(start);
824
+ const endPoint = pointFor(end);
825
+ return `M ${CENTER} ${CENTER} L ${startPoint.x} ${startPoint.y} A ${RADIUS} ${RADIUS} 0 0 1 ${endPoint.x} ${endPoint.y} Z`;
826
+ }
827
+ function pointFor(hue, ratio = 1) {
828
+ const radians = (hue - 90) * Math.PI / 180;
829
+ return {
830
+ x: CENTER + RADIUS * ratio * Math.cos(radians),
831
+ y: CENTER + RADIUS * ratio * Math.sin(radians)
832
+ };
833
+ }
834
+ function linesFor(points, primary, stroke) {
835
+ return points.slice(1).reduce(({ lines, previous }, point) => ({
836
+ lines: [
837
+ ...lines,
838
+ /* @__PURE__ */ jsx7(Line, {
839
+ stroke,
840
+ strokeWidth: 6,
841
+ x1: previous.x,
842
+ x2: point.x,
843
+ y1: previous.y,
844
+ y2: point.y
845
+ }, `${previous.x}-${previous.y}-${point.x}-${point.y}`)
846
+ ],
847
+ previous: point
848
+ }), { lines: [], previous: points.at(0) ?? primary }).lines;
849
+ }
850
+
851
+ // src/features/color/resolveColorPickerGeometry.ts
852
+ var MINIMUM_WIDTH = 360;
853
+ var REFERENCE_WIDTH = 560;
854
+ function resolveColorPickerGeometry(input) {
855
+ const availableWidth = Math.min(input.width ?? REFERENCE_WIDTH, input.hostWidth ?? REFERENCE_WIDTH);
856
+ const availableHeight = Math.min(input.height ?? Number.POSITIVE_INFINITY, input.hostHeight ?? Number.POSITIVE_INFINITY);
857
+ const minimum = resolveGeometryAtWidth(MINIMUM_WIDTH, input.showTabs);
858
+ const maximum = resolveGeometryAtWidth(Math.max(MINIMUM_WIDTH, availableWidth), input.showTabs);
859
+ const resolved = resolveLargestGeometry(maximum, availableHeight, input.showTabs);
860
+ return {
861
+ ...resolved,
862
+ insufficientSpace: availableWidth < MINIMUM_WIDTH || availableHeight < minimum.height,
863
+ minimumHeight: minimum.height,
864
+ minimumWidth: MINIMUM_WIDTH
865
+ };
866
+ }
867
+ function resolveGeometryAtWidth(width, showTabs) {
868
+ const progress = Math.max(0, Math.min(1, (width - MINIMUM_WIDTH) / (REFERENCE_WIDTH - MINIMUM_WIDTH)));
869
+ const padding = interpolate(12, 24, progress);
870
+ const rail = interpolate(104, 150, progress);
871
+ const gap = interpolate(12, 20, progress);
872
+ const scale = interpolate(0.75, 1, progress);
873
+ const border = 1;
874
+ const stage = width - border * 2 - padding * 2 - rail - gap;
875
+ const headerHeight = 48 * scale;
876
+ const tabHeight = showTabs ? 48 * scale : 0;
877
+ const cardGap = 16 * scale;
878
+ const cardHeight = 52 * scale;
879
+ const settingsHeight = cardHeight * 2 + cardGap;
880
+ const mainHeight = Math.max(stage, settingsHeight);
881
+ const infoLineHeight = 20 * scale;
882
+ const mainGap = 16 * scale;
883
+ const footerGap = 10 * scale;
884
+ const footerHeight = 52 * scale;
885
+ const footerInset = 12 * scale;
886
+ const height = border * 2 + padding + headerHeight + mainGap + tabHeight + (showTabs ? mainGap : 0) + mainHeight + mainGap + infoLineHeight + footerGap + 1 + footerGap + footerHeight + footerInset;
887
+ return {
888
+ border,
889
+ cardGap,
890
+ cardHeight,
891
+ footerGap,
892
+ footerHeight,
893
+ footerInset,
894
+ gap,
895
+ headerHeight,
896
+ height,
897
+ infoLineHeight,
898
+ mainGap,
899
+ padding,
900
+ rail,
901
+ scale,
902
+ settingsHeight,
903
+ stage,
904
+ tabHeight,
905
+ width
906
+ };
907
+ }
908
+ function resolveLargestGeometry(maximum, height, showTabs) {
909
+ if (!Number.isFinite(height) || maximum.height <= height)
910
+ return maximum;
911
+ const minimum = resolveGeometryAtWidth(MINIMUM_WIDTH, showTabs);
912
+ if (height < minimum.height)
913
+ return minimum;
914
+ let lower = MINIMUM_WIDTH;
915
+ let upper = maximum.width;
916
+ for (let iteration = 0;iteration < 20; iteration += 1) {
917
+ const midpoint = (lower + upper) / 2;
918
+ if (resolveGeometryAtWidth(midpoint, showTabs).height <= height)
919
+ lower = midpoint;
920
+ else
921
+ upper = midpoint;
922
+ }
923
+ return resolveGeometryAtWidth(lower, showTabs);
924
+ }
925
+ function interpolate(minimum, reference, progress) {
926
+ return minimum + (reference - minimum) * progress;
927
+ }
928
+
929
+ // src/features/color/ColorPicker.tsx
930
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
931
+ var DEFAULT_TABS = ["grid", "wheel"];
932
+ var ColorPicker2 = withZoraThemeScope(ColorPickerInner);
933
+ function ColorPickerInner({
934
+ themeId: _themeId,
935
+ mode: _mode,
936
+ inverted: _inverted,
937
+ tabs = DEFAULT_TABS,
938
+ primaryColor,
939
+ harmony,
940
+ tone,
941
+ tones = [],
942
+ width = 560,
943
+ height,
944
+ infoLine,
945
+ onInsufficientSpaceChange,
946
+ activeTab,
947
+ onValueChange,
948
+ onActiveTabChange,
949
+ onDismiss,
950
+ hideTabListWhenSingle = true,
951
+ wheel,
952
+ interactionPolicy,
953
+ testID
954
+ }) {
955
+ const { theme } = useZoraTheme2();
956
+ const [hostBounds, setHostBounds] = React6.useState();
957
+ const enabledTabs = resolveEnabledTabs(tabs);
958
+ const firstTab = enabledTabs.at(0);
959
+ if (!firstTab)
960
+ throw new Error("ColorPicker requires at least one tab.");
961
+ const [uncontrolledTab, setUncontrolledTab] = React6.useState(firstTab);
962
+ const resolvedTab = activeTab && enabledTabs.includes(activeTab) ? activeTab : enabledTabs.includes(uncontrolledTab) ? uncontrolledTab : firstTab;
963
+ const geometry = resolveColorPickerGeometry({
964
+ height,
965
+ hostHeight: hostBounds && hostBounds.height > 0 ? hostBounds.height : undefined,
966
+ hostWidth: hostBounds && hostBounds.width > 0 ? hostBounds.width : undefined,
967
+ showTabs: enabledTabs.length > 1 || !hideTabListWhenSingle,
968
+ width
969
+ });
970
+ const selectedTone = tones.find((entry) => entry.id === tone);
971
+ const emit = (next) => onValueChange({
972
+ primaryColor: next.primaryColor ?? primaryColor,
973
+ ...Object.hasOwn(next, "harmony") ? { harmony: next.harmony } : harmony ? { harmony } : {},
974
+ ...Object.hasOwn(next, "tone") ? { tone: next.tone } : tone ? { tone } : {}
975
+ });
976
+ const settings = (children) => /* @__PURE__ */ jsx8(PickerRow, {
977
+ geometry,
978
+ tone,
979
+ tones,
980
+ harmony,
981
+ interactionPolicy,
982
+ onHarmonyChange: (next) => emit({ harmony: next }),
983
+ onToneChange: (next) => emit({ tone: next }),
984
+ children
985
+ });
986
+ React6.useEffect(() => {
987
+ if (activeTab && activeTab !== resolvedTab)
988
+ onActiveTabChange?.(resolvedTab);
989
+ }, [activeTab, onActiveTabChange, resolvedTab]);
990
+ React6.useEffect(() => {
991
+ onInsufficientSpaceChange?.(geometry.insufficientSpace);
992
+ }, [geometry.insufficientSpace, onInsufficientSpaceChange]);
993
+ return /* @__PURE__ */ jsx8(NativeView, {
994
+ onLayout: (event) => setHostBounds({
995
+ height: event.nativeEvent.layout.height,
996
+ width: event.nativeEvent.layout.width
997
+ }),
998
+ style: {
999
+ alignSelf: "stretch",
1000
+ flexShrink: 1,
1001
+ height: height ?? "100%",
1002
+ maxHeight: "100%",
1003
+ maxWidth: "100%",
1004
+ width: "100%"
1005
+ },
1006
+ children: !geometry.insufficientSpace ? /* @__PURE__ */ jsx8(View2, {
1007
+ alignSelf: "center",
1008
+ borderColor: theme.semantics.action.primary.base,
1009
+ borderWidth: geometry.border,
1010
+ radius: "l",
1011
+ testID,
1012
+ width: geometry.width,
1013
+ children: /* @__PURE__ */ jsx8(Gradient2, {
1014
+ colors: [theme.semantics.surface.raised, theme.semantics.neutral.surface],
1015
+ end: { x: 0, y: 1 },
1016
+ radius: "l",
1017
+ start: { x: 0, y: 0 },
1018
+ children: /* @__PURE__ */ jsxs5(View2, {
1019
+ gap: geometry.footerGap,
1020
+ pb: geometry.footerInset,
1021
+ pt: geometry.padding,
1022
+ px: geometry.padding,
1023
+ children: [
1024
+ /* @__PURE__ */ jsxs5(View2, {
1025
+ gap: geometry.mainGap,
1026
+ children: [
1027
+ /* @__PURE__ */ jsxs5(View2, {
1028
+ align: "center",
1029
+ direction: "row",
1030
+ justify: "space-between",
1031
+ minHeight: geometry.headerHeight,
1032
+ children: [
1033
+ /* @__PURE__ */ jsx8(Heading2, {
1034
+ level: 2,
1035
+ children: "Color"
1036
+ }),
1037
+ /* @__PURE__ */ jsxs5(View2, {
1038
+ align: "center",
1039
+ direction: "row",
1040
+ gap: "s",
1041
+ children: [
1042
+ /* @__PURE__ */ jsx8(View2, {
1043
+ bg: primaryColor,
1044
+ borderColor: theme.semantics.border.default,
1045
+ borderWidth: 1,
1046
+ height: 36 * geometry.scale,
1047
+ radius: "s",
1048
+ width: 52 * geometry.scale
1049
+ }),
1050
+ onDismiss ? /* @__PURE__ */ jsx8(IconButton2, {
1051
+ iconName: "close",
1052
+ label: "Close color picker",
1053
+ onPress: onDismiss
1054
+ }) : null
1055
+ ]
1056
+ })
1057
+ ]
1058
+ }),
1059
+ enabledTabs.length > 1 || !hideTabListWhenSingle ? /* @__PURE__ */ jsx8(ColorPickerTabSelector, {
1060
+ activeTab: resolvedTab,
1061
+ geometry,
1062
+ interactionPolicy,
1063
+ tabs: enabledTabs,
1064
+ onChange: (next) => {
1065
+ setUncontrolledTab(next);
1066
+ onActiveTabChange?.(next);
1067
+ }
1068
+ }) : null,
1069
+ resolvedTab === "grid" ? settings(/* @__PURE__ */ jsx8(ColorGrid, {
1070
+ disabled: interactionPolicy === "passive",
1071
+ harmony,
1072
+ onSelect: (color) => emit({ primaryColor: color }),
1073
+ palette: resolvePalette(selectedTone, primaryColor, harmony),
1074
+ primaryIndicatorColor: theme.semantics.action.primary.base,
1075
+ selectionBorderColor: theme.semantics.content.default,
1076
+ selected: primaryColor,
1077
+ size: geometry.stage
1078
+ })) : settings(/* @__PURE__ */ jsx8(ColorWheel2, {
1079
+ ...wheel,
1080
+ harmony: harmony ?? null,
1081
+ interactionPolicy,
1082
+ onChange: (next) => emit({ primaryColor: next.color, harmony: next.harmony ?? undefined }),
1083
+ size: geometry.stage,
1084
+ toneTarget: selectedTone?.accentTarget,
1085
+ value: primaryColor
1086
+ })),
1087
+ /* @__PURE__ */ jsx8(View2, {
1088
+ height: geometry.infoLineHeight,
1089
+ justify: "center",
1090
+ children: infoLine ? /* @__PURE__ */ jsx8(Text2, {
1091
+ accessibilityLabel: infoLine,
1092
+ numberOfLines: 1,
1093
+ variant: "caption",
1094
+ children: infoLine
1095
+ }) : null
1096
+ })
1097
+ ]
1098
+ }),
1099
+ /* @__PURE__ */ jsxs5(View2, {
1100
+ gap: geometry.footerGap,
1101
+ children: [
1102
+ /* @__PURE__ */ jsx8(Divider2, {}),
1103
+ /* @__PURE__ */ jsx8(View2, {
1104
+ height: geometry.footerHeight,
1105
+ justify: "center",
1106
+ children: /* @__PURE__ */ jsx8(ColorHexField, {
1107
+ disabled: interactionPolicy === "passive",
1108
+ onChange: (color) => emit({ primaryColor: color }),
1109
+ value: primaryColor
1110
+ })
1111
+ })
1112
+ ]
1113
+ })
1114
+ ]
1115
+ })
1116
+ })
1117
+ }) : /* @__PURE__ */ jsx8(View2, {
1118
+ accessibilityLabel: "Color picker needs more space",
1119
+ testID: testID ? `${testID}-insufficient-space` : undefined
1120
+ })
1121
+ });
1122
+ }
1123
+ function ColorPickerTabSelector({
1124
+ activeTab,
1125
+ geometry,
1126
+ interactionPolicy,
1127
+ tabs,
1128
+ onChange
1129
+ }) {
1130
+ const { theme } = useZoraTheme2();
1131
+ return /* @__PURE__ */ jsx8(View2, {
1132
+ borderColor: theme.semantics.border.default,
1133
+ borderWidth: 1,
1134
+ direction: "row",
1135
+ overflow: "hidden",
1136
+ radius: "m",
1137
+ children: tabs.map((tab) => {
1138
+ const selected = tab === activeTab;
1139
+ return /* @__PURE__ */ jsx8(Pressable2, {
1140
+ accessibilityLabel: `${tab === "grid" ? "Grid" : "Wheel"} color picker tab`,
1141
+ accessibilityRole: "tab",
1142
+ accessibilityState: { selected },
1143
+ disabled: interactionPolicy === "passive",
1144
+ onPress: () => onChange(tab),
1145
+ style: { flex: 1 },
1146
+ children: /* @__PURE__ */ jsxs5(View2, {
1147
+ align: "center",
1148
+ bg: selected ? theme.semantics.action.primary.base : "transparent",
1149
+ direction: "row",
1150
+ gap: "xs",
1151
+ height: geometry.tabHeight - geometry.border * 2,
1152
+ justify: "center",
1153
+ radius: "s",
1154
+ children: [
1155
+ /* @__PURE__ */ jsx8(Icon2, {
1156
+ color: selected ? theme.semantics.action.primary.onSolidText : undefined,
1157
+ name: tab === "grid" ? "grid" : "color-palette",
1158
+ size: 16 * geometry.scale
1159
+ }),
1160
+ /* @__PURE__ */ jsx8(Text2, {
1161
+ style: selected ? { color: theme.semantics.action.primary.onSolidText } : undefined,
1162
+ variant: "label",
1163
+ weight: "medium",
1164
+ children: tab === "grid" ? "Grid" : "Wheel"
1165
+ })
1166
+ ]
1167
+ })
1168
+ }, tab);
1169
+ })
1170
+ });
1171
+ }
1172
+ function PickerRow({
1173
+ children,
1174
+ geometry,
1175
+ tone,
1176
+ tones,
1177
+ harmony,
1178
+ interactionPolicy,
1179
+ onToneChange,
1180
+ onHarmonyChange
1181
+ }) {
1182
+ return /* @__PURE__ */ jsxs5(View2, {
1183
+ align: "flex-start",
1184
+ direction: "row",
1185
+ gap: geometry.gap,
1186
+ children: [
1187
+ /* @__PURE__ */ jsxs5(View2, {
1188
+ gap: geometry.cardGap,
1189
+ width: geometry.rail,
1190
+ children: [
1191
+ /* @__PURE__ */ jsx8(SettingCard, {
1192
+ geometry,
1193
+ icon: "diamond",
1194
+ interactionPolicy,
1195
+ label: "Tone",
1196
+ onClear: tone ? () => onToneChange(undefined) : undefined,
1197
+ children: /* @__PURE__ */ jsx8(Select2, {
1198
+ compact: true,
1199
+ interactionPolicy,
1200
+ onValueChange: onToneChange,
1201
+ options: resolveToneOptions(tones),
1202
+ placeholder: "Any tone",
1203
+ value: tone
1204
+ })
1205
+ }),
1206
+ /* @__PURE__ */ jsx8(SettingCard, {
1207
+ geometry,
1208
+ icon: "color-palette",
1209
+ interactionPolicy,
1210
+ label: "Harmony",
1211
+ onClear: harmony ? () => onHarmonyChange(undefined) : undefined,
1212
+ children: /* @__PURE__ */ jsx8(Select2, {
1213
+ compact: true,
1214
+ interactionPolicy,
1215
+ onValueChange: onHarmonyChange,
1216
+ options: COLOR_HARMONY_CATALOG.map((entry) => ({
1217
+ label: entry.label,
1218
+ value: entry.id
1219
+ })),
1220
+ placeholder: "None",
1221
+ value: harmony
1222
+ })
1223
+ })
1224
+ ]
1225
+ }),
1226
+ children
1227
+ ]
1228
+ });
1229
+ }
1230
+ function SettingCard({
1231
+ children,
1232
+ geometry,
1233
+ icon,
1234
+ interactionPolicy,
1235
+ label,
1236
+ onClear
1237
+ }) {
1238
+ return /* @__PURE__ */ jsxs5(Card2, {
1239
+ compact: true,
1240
+ minHeight: geometry.cardHeight,
1241
+ padding: "s",
1242
+ radius: "m",
1243
+ tone: "subtle",
1244
+ children: [
1245
+ /* @__PURE__ */ jsxs5(View2, {
1246
+ align: "center",
1247
+ direction: "row",
1248
+ gap: "xs",
1249
+ justify: "space-between",
1250
+ children: [
1251
+ /* @__PURE__ */ jsxs5(View2, {
1252
+ align: "center",
1253
+ direction: "row",
1254
+ gap: "xs",
1255
+ children: [
1256
+ /* @__PURE__ */ jsx8(Icon2, {
1257
+ name: icon,
1258
+ size: 20 * geometry.scale
1259
+ }),
1260
+ /* @__PURE__ */ jsx8(Text2, {
1261
+ numberOfLines: 1,
1262
+ variant: "label",
1263
+ weight: "medium",
1264
+ children: label
1265
+ })
1266
+ ]
1267
+ }),
1268
+ onClear ? /* @__PURE__ */ jsx8(IconButton2, {
1269
+ disabled: interactionPolicy === "passive",
1270
+ iconName: "close",
1271
+ label: `Clear ${label}`,
1272
+ onPress: onClear,
1273
+ size: "s"
1274
+ }) : null
1275
+ ]
1276
+ }),
1277
+ children
1278
+ ]
1279
+ });
1280
+ }
1281
+ function ColorGrid({
1282
+ palette,
1283
+ primaryIndicatorColor,
1284
+ selectionBorderColor,
1285
+ selected,
1286
+ size,
1287
+ onSelect,
1288
+ disabled = false,
1289
+ harmony
1290
+ }) {
1291
+ const gap = Math.max(3, Math.round(size / 68));
1292
+ const cell = (size - 7 * gap) / 8;
1293
+ const harmonyColors = new Set(harmony ? generateHarmonyRoleColors(selected, harmony).colors.map((role) => role.hex) : []);
1294
+ return /* @__PURE__ */ jsx8(View2, {
1295
+ accessibilityLabel: "Color grid",
1296
+ direction: "row",
1297
+ gap,
1298
+ width: size,
1299
+ wrap: "wrap",
1300
+ children: palette.map((color) => /* @__PURE__ */ jsx8(Pressable2, {
1301
+ accessibilityLabel: `Select ${color}`,
1302
+ bg: color,
1303
+ borderColor: color === selected ? selectionBorderColor : harmonyColors.has(color) ? primaryIndicatorColor : "transparent",
1304
+ borderWidth: color === selected ? 3 : harmonyColors.has(color) ? 1 : 0,
1305
+ disabled,
1306
+ height: cell,
1307
+ onPress: () => onSelect(color),
1308
+ radius: "s",
1309
+ width: cell
1310
+ }, color))
1311
+ });
1312
+ }
1313
+ function resolvePalette(tone, primaryColor, harmony) {
1314
+ const target = tone?.accentTarget;
1315
+ const candidates = Array.from({ length: 64 }, (_, index) => resolveOklchColor({
1316
+ chroma: target?.chroma ?? 0.08 + index % 8 * 0.018,
1317
+ lightness: target?.lightness ?? 0.35 + Math.floor(index / 8) * 0.065
1318
+ }, index * 137.508 % 360));
1319
+ const roleColors = harmony ? generateHarmonyRoleColors(primaryColor, harmony).colors.map((role) => role.hex) : [];
1320
+ return Array.from(new Set([primaryColor, ...roleColors, ...candidates])).slice(0, 64);
1321
+ }
1322
+ function resolveToneOptions(tones) {
1323
+ const accentCounts = new Map;
1324
+ for (const tone of tones) {
1325
+ const accent = tone.accent.trim().toLocaleLowerCase();
1326
+ accentCounts.set(accent, (accentCounts.get(accent) ?? 0) + 1);
1327
+ }
1328
+ return tones.map((tone) => ({
1329
+ label: (accentCounts.get(tone.accent.trim().toLocaleLowerCase()) ?? 0) > 1 ? `${tone.accent} · ${resolveToneQualifier(tone)}` : tone.accent,
1330
+ value: tone.id
1331
+ }));
1332
+ }
1333
+ function resolveToneQualifier(tone) {
1334
+ const normalizedAccent = tone.accent.trim().toLocaleLowerCase().replaceAll(" ", "-");
1335
+ const qualifier = tone.id.replace(new RegExp(`^${escapeRegExp(normalizedAccent)}-on-`, "i"), "").replaceAll("-", " ");
1336
+ return qualifier.replace(/\b\w/g, (character) => character.toLocaleUpperCase());
1337
+ }
1338
+ function escapeRegExp(value) {
1339
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1340
+ }
1341
+ function resolveEnabledTabs(tabs) {
1342
+ if (tabs.length === 0)
1343
+ throw new Error("ColorPicker requires at least one tab.");
1344
+ if (tabs.some((tab) => !isColorPickerTab(tab)))
1345
+ throw new Error("ColorPicker supports only Grid and Wheel tabs.");
1346
+ return tabs;
1347
+ }
1348
+ function isColorPickerTab(value) {
1349
+ return value === "grid" || value === "wheel";
1350
+ }
1351
+ // src/features/color/ColorTone.tsx
1352
+ import { Button, Pressable as Pressable3 } from "@ankhorage/surface/web";
1353
+ import React7 from "react";
1354
+ import { jsx as jsx9, jsxs as jsxs6, Fragment } from "react/jsx-runtime";
1355
+ var MAX_TONE_COLORS = 4;
1356
+ var TONE_MAP_WIDTH = 280;
1357
+ var TONE_MAP_HEIGHT = 220;
1358
+ var TONE_MAX_CHROMA = 0.2;
1359
+ var ColorTone2 = withZoraThemeScope(ColorToneInner);
1360
+ function ColorToneInner({
1361
+ themeId: _themeId,
1362
+ mode: _mode,
1363
+ inverted: _inverted,
1364
+ interactionPolicy,
1365
+ tones,
1366
+ selectionMode = "single",
1367
+ value,
1368
+ onChange,
1369
+ testID
1370
+ }) {
1371
+ const { theme } = useZoraTheme2();
1372
+ const [editingColorIndex, setEditingColorIndex] = React7.useState(0);
1373
+ const selectedTone = tones.find((tone) => tone.id === value?.toneId);
1374
+ const colors = value ? selectionMode === "single" ? value.colors.slice(0, 1) : value.colors.slice(0, MAX_TONE_COLORS) : [];
1375
+ const currentEditingColorIndex = Math.min(editingColorIndex, Math.max(0, colors.length - 1));
1376
+ const selectedColor = colors.at(currentEditingColorIndex);
1377
+ const selectTone = (tone) => {
1378
+ const hue = selectedColor ? resolveColorHue(selectedColor) : 0;
1379
+ setEditingColorIndex(0);
1380
+ onChange({ toneId: tone.id, colors: [resolveOklchColor(tone.accentTarget, hue)] });
1381
+ };
1382
+ return /* @__PURE__ */ jsxs6(View2, {
1383
+ gap: "m",
1384
+ testID,
1385
+ children: [
1386
+ /* @__PURE__ */ jsxs6(View2, {
1387
+ gap: "xs",
1388
+ children: [
1389
+ /* @__PURE__ */ jsx9(Text2, {
1390
+ variant: "label",
1391
+ children: "Tone"
1392
+ }),
1393
+ /* @__PURE__ */ jsx9(Text2, {
1394
+ emphasis: "muted",
1395
+ variant: "caption",
1396
+ children: "Choose a catalog tone"
1397
+ })
1398
+ ]
1399
+ }),
1400
+ /* @__PURE__ */ jsx9(View2, {
1401
+ direction: "row",
1402
+ gap: "s",
1403
+ wrap: "wrap",
1404
+ children: tones.map((tone) => {
1405
+ const selected = value?.toneId === tone.id;
1406
+ const color = selected && selectedColor ? selectedColor : resolveOklchColor(tone.accentTarget, 0);
1407
+ return /* @__PURE__ */ jsx9(Pressable3, {
1408
+ accessibilityLabel: tone.accent,
1409
+ accessibilityRole: "radio",
1410
+ accessibilityState: { checked: selected },
1411
+ bg: color,
1412
+ borderColor: theme.semantics.border.default,
1413
+ borderWidth: selected ? 3 : 1,
1414
+ disabled: interactionPolicy === "passive",
1415
+ height: 56,
1416
+ onPress: () => selectTone(tone),
1417
+ radius: "m",
1418
+ width: 56,
1419
+ children: /* @__PURE__ */ jsx9(Text2, {
1420
+ align: "center",
1421
+ variant: "caption",
1422
+ children: tone.accent
1423
+ })
1424
+ }, tone.id);
1425
+ })
1426
+ }),
1427
+ selectedTone && selectedColor && value ? /* @__PURE__ */ jsxs6(Fragment, {
1428
+ children: [
1429
+ /* @__PURE__ */ jsx9(ColorToneMap, {
1430
+ color: selectedColor,
1431
+ disabled: interactionPolicy === "passive",
1432
+ onChange: (lightness, chroma) => onChange({
1433
+ toneId: selectedTone.id,
1434
+ colors: colors.map((entry, index) => index === currentEditingColorIndex ? resolveOklchColor({ chroma, lightness }, resolveColorHue(entry)) : entry)
1435
+ })
1436
+ }),
1437
+ /* @__PURE__ */ jsxs6(View2, {
1438
+ direction: "row",
1439
+ gap: "xs",
1440
+ wrap: "wrap",
1441
+ children: [
1442
+ colors.map((color, index) => /* @__PURE__ */ jsx9(Pressable3, {
1443
+ accessibilityLabel: `Selected ${selectedTone.accent} color ${index + 1}: ${color}`,
1444
+ accessibilityRole: "radio",
1445
+ accessibilityState: { checked: currentEditingColorIndex === index },
1446
+ bg: color,
1447
+ borderColor: theme.semantics.border.default,
1448
+ borderWidth: currentEditingColorIndex === index ? 3 : 1,
1449
+ disabled: interactionPolicy === "passive",
1450
+ height: 44,
1451
+ onPress: () => setEditingColorIndex(index),
1452
+ radius: "m",
1453
+ width: 44
1454
+ }, `${color}-${index}`)),
1455
+ selectionMode === "multiple" ? /* @__PURE__ */ jsx9(Button, {
1456
+ disabled: interactionPolicy === "passive" || colors.length >= MAX_TONE_COLORS,
1457
+ onPress: () => {
1458
+ setEditingColorIndex(colors.length);
1459
+ onChange({
1460
+ toneId: selectedTone.id,
1461
+ colors: [...colors, resolveOklchColor(selectedTone.accentTarget, 0)]
1462
+ });
1463
+ },
1464
+ children: "Add color"
1465
+ }) : null,
1466
+ selectionMode === "multiple" && colors.length > 1 ? /* @__PURE__ */ jsx9(Button, {
1467
+ disabled: interactionPolicy === "passive",
1468
+ onPress: () => {
1469
+ const nextColors = colors.filter((_, index) => index !== currentEditingColorIndex);
1470
+ setEditingColorIndex(Math.min(currentEditingColorIndex, nextColors.length - 1));
1471
+ onChange({ toneId: selectedTone.id, colors: nextColors });
1472
+ },
1473
+ children: "Remove color"
1474
+ }) : null
1475
+ ]
1476
+ }),
1477
+ /* @__PURE__ */ jsx9(ColorSpectrumSlider, {
1478
+ disabled: interactionPolicy === "passive",
1479
+ hue: resolveColorHue(selectedColor),
1480
+ onChange: (nextHue) => onChange({
1481
+ toneId: selectedTone.id,
1482
+ colors: colors.map((entry, index) => index === currentEditingColorIndex ? resolveOklchColor(selectedTone.accentTarget, nextHue) : entry)
1483
+ })
1484
+ }),
1485
+ /* @__PURE__ */ jsx9(ColorHexField, {
1486
+ disabled: interactionPolicy === "passive",
1487
+ onChange: (color) => onChange({
1488
+ toneId: selectedTone.id,
1489
+ colors: colors.map((entry, index) => index === currentEditingColorIndex ? color : entry)
1490
+ }),
1491
+ value: selectedColor
1492
+ }, selectedColor)
1493
+ ]
1494
+ }) : null
1495
+ ]
1496
+ });
1497
+ }
1498
+ function ColorToneMap({
1499
+ color,
1500
+ disabled,
1501
+ onChange
1502
+ }) {
1503
+ const hue = resolveColorHue(color);
1504
+ const { chroma, lightness } = resolveWheelColorComponents(color);
1505
+ const gradientId = `color-tone-${React7.useId().replaceAll(":", "")}`;
1506
+ const changeAt = (x, y) => {
1507
+ if (disabled)
1508
+ return;
1509
+ onChange(Math.max(0, Math.min(1, 1 - y / TONE_MAP_HEIGHT)), Math.max(0, Math.min(TONE_MAX_CHROMA, x / TONE_MAP_WIDTH * TONE_MAX_CHROMA)));
1510
+ };
1511
+ return /* @__PURE__ */ jsx9(ColorWheelPointerProxy, {
1512
+ disabled,
1513
+ height: TONE_MAP_HEIGHT,
1514
+ onChange: changeAt,
1515
+ width: TONE_MAP_WIDTH,
1516
+ children: /* @__PURE__ */ jsxs6(Svg, {
1517
+ accessibilityLabel: "Tone color plane",
1518
+ height: TONE_MAP_HEIGHT,
1519
+ width: TONE_MAP_WIDTH,
1520
+ children: [
1521
+ /* @__PURE__ */ jsxs6(Defs, {
1522
+ children: [
1523
+ /* @__PURE__ */ jsxs6(LinearGradient, {
1524
+ id: `${gradientId}-white`,
1525
+ x1: "0",
1526
+ x2: "1",
1527
+ y1: "0",
1528
+ y2: "0",
1529
+ children: [
1530
+ /* @__PURE__ */ jsx9(Stop, {
1531
+ offset: "0",
1532
+ stopColor: "white"
1533
+ }),
1534
+ /* @__PURE__ */ jsx9(Stop, {
1535
+ offset: "1",
1536
+ stopColor: resolveOklchColor({ chroma: TONE_MAX_CHROMA, lightness: 0.65 }, hue)
1537
+ })
1538
+ ]
1539
+ }),
1540
+ /* @__PURE__ */ jsxs6(LinearGradient, {
1541
+ id: `${gradientId}-black`,
1542
+ x1: "0",
1543
+ x2: "0",
1544
+ y1: "0",
1545
+ y2: "1",
1546
+ children: [
1547
+ /* @__PURE__ */ jsx9(Stop, {
1548
+ offset: "0",
1549
+ stopColor: "transparent"
1550
+ }),
1551
+ /* @__PURE__ */ jsx9(Stop, {
1552
+ offset: "1",
1553
+ stopColor: "black"
1554
+ })
1555
+ ]
1556
+ })
1557
+ ]
1558
+ }),
1559
+ /* @__PURE__ */ jsx9(Rect, {
1560
+ fill: `url(#${gradientId}-white)`,
1561
+ height: TONE_MAP_HEIGHT,
1562
+ width: TONE_MAP_WIDTH
1563
+ }),
1564
+ /* @__PURE__ */ jsx9(Rect, {
1565
+ fill: `url(#${gradientId}-black)`,
1566
+ height: TONE_MAP_HEIGHT,
1567
+ width: TONE_MAP_WIDTH
1568
+ }),
1569
+ /* @__PURE__ */ jsx9(Circle, {
1570
+ cx: chroma / TONE_MAX_CHROMA * TONE_MAP_WIDTH,
1571
+ cy: (1 - lightness) * TONE_MAP_HEIGHT,
1572
+ fill: "none",
1573
+ r: 10,
1574
+ stroke: "white",
1575
+ strokeWidth: 3
1576
+ }),
1577
+ /* @__PURE__ */ jsx9(Rect, {
1578
+ fill: "transparent",
1579
+ height: TONE_MAP_HEIGHT,
1580
+ onResponderGrant: (event) => changeAt(event.nativeEvent.locationX, event.nativeEvent.locationY),
1581
+ onResponderMove: (event) => changeAt(event.nativeEvent.locationX, event.nativeEvent.locationY),
1582
+ onResponderRelease: (event) => changeAt(event.nativeEvent.locationX, event.nativeEvent.locationY),
1583
+ onStartShouldSetResponder: () => !disabled,
1584
+ width: TONE_MAP_WIDTH
1585
+ })
1586
+ ]
1587
+ })
1588
+ });
1589
+ }
1590
+ export { ColorHueScale2, ColorWheel2, ColorPicker2, ColorTone2 };