@mks2508/mks-ui 0.5.4 → 0.5.8

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 (262) hide show
  1. package/dist/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts +23 -4
  2. package/dist/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts.map +1 -1
  3. package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts +2 -2
  4. package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts.map +1 -1
  5. package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.js +292 -31
  6. package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.d.ts +7 -0
  7. package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.d.ts.map +1 -1
  8. package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.js +6 -1
  9. package/dist/react-ui/ui/DynamicToggle/{DynamicToggle-Cm6-VceQ.css → DynamicToggle-DJLwEkHr.css} +116 -51
  10. package/dist/react-ui/ui/DynamicToggle/DynamicToggle.css +116 -51
  11. package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts +1 -0
  12. package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts.map +1 -1
  13. package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.js +9 -3
  14. package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts +61 -31
  15. package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts.map +1 -1
  16. package/dist/react-ui/ui/DynamicToggle/index.d.ts +9 -3
  17. package/dist/react-ui/ui/DynamicToggle/index.d.ts.map +1 -1
  18. package/dist/react-ui/ui/DynamicToggle/index.js +68 -37
  19. package/package.json +52 -13
  20. package/src/assets/react.svg +0 -1
  21. package/src/core/index.ts +0 -7
  22. package/src/core/types.ts +0 -82
  23. package/src/css.d.ts +0 -7
  24. package/src/index.css +0 -129
  25. package/src/index.ts +0 -29
  26. package/src/react-ui/blocks/Terminal/ResttyAdapter.ts +0 -278
  27. package/src/react-ui/blocks/Terminal/Terminal.adapter.ts +0 -97
  28. package/src/react-ui/blocks/Terminal/Terminal.theme.restty.ts +0 -155
  29. package/src/react-ui/blocks/Terminal/Terminal.theme.ts +0 -80
  30. package/src/react-ui/blocks/Terminal/Terminal.types.ts +0 -438
  31. package/src/react-ui/blocks/Terminal/TerminalDisplay.styles.ts +0 -38
  32. package/src/react-ui/blocks/Terminal/TerminalDisplay.tsx +0 -254
  33. package/src/react-ui/blocks/Terminal/TerminalDisplay.types.ts +0 -73
  34. package/src/react-ui/blocks/Terminal/TerminalPanel.tsx +0 -269
  35. package/src/react-ui/blocks/Terminal/TerminalRestty.tsx +0 -326
  36. package/src/react-ui/blocks/Terminal/TerminalXterm.tsx +0 -230
  37. package/src/react-ui/blocks/Terminal/XTermAdapter.ts +0 -163
  38. package/src/react-ui/blocks/Terminal/chrome.ts +0 -25
  39. package/src/react-ui/blocks/Terminal/components/LogLineBadges.tsx +0 -316
  40. package/src/react-ui/blocks/Terminal/components/SpecializedSyntaxHighlighter.tsx +0 -218
  41. package/src/react-ui/blocks/Terminal/components/SyntaxHighlight.tsx +0 -386
  42. package/src/react-ui/blocks/Terminal/components/TerminalLogBadge.tsx +0 -67
  43. package/src/react-ui/blocks/Terminal/components/index.ts +0 -10
  44. package/src/react-ui/blocks/Terminal/display.ts +0 -46
  45. package/src/react-ui/blocks/Terminal/hooks/index.ts +0 -22
  46. package/src/react-ui/blocks/Terminal/hooks/useTerminalSettings.ts +0 -229
  47. package/src/react-ui/blocks/Terminal/hooks/useTerminalWebSocket.ts +0 -292
  48. package/src/react-ui/blocks/Terminal/index.ts +0 -111
  49. package/src/react-ui/blocks/Terminal/panel/LogLinesViewer.tsx +0 -330
  50. package/src/react-ui/blocks/Terminal/panel/TerminalDebugPanel.tsx +0 -242
  51. package/src/react-ui/blocks/Terminal/panel/TerminalFilterDropdown.tsx +0 -202
  52. package/src/react-ui/blocks/Terminal/panel/TerminalFilterTabs.tsx +0 -140
  53. package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.tsx +0 -68
  54. package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.types.ts +0 -85
  55. package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelRestty.tsx +0 -383
  56. package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelXterm.tsx +0 -439
  57. package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.tsx +0 -550
  58. package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.types.ts +0 -259
  59. package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.styles.ts +0 -75
  60. package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.tsx +0 -266
  61. package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.ts +0 -82
  62. package/src/react-ui/blocks/Terminal/panel/TerminalPanelFooter.tsx +0 -112
  63. package/src/react-ui/blocks/Terminal/panel/TerminalPanelHeader.tsx +0 -178
  64. package/src/react-ui/blocks/Terminal/panel/TerminalPanelToolbar.tsx +0 -203
  65. package/src/react-ui/blocks/Terminal/panel/TerminalSessionControl.tsx +0 -252
  66. package/src/react-ui/blocks/Terminal/panel/TerminalSessionTabs.tsx +0 -334
  67. package/src/react-ui/blocks/Terminal/panel/TerminalSettingsPopover.tsx +0 -261
  68. package/src/react-ui/blocks/Terminal/panel/TerminalThemeSelector.tsx +0 -248
  69. package/src/react-ui/blocks/Terminal/panel/index.ts +0 -72
  70. package/src/react-ui/blocks/Terminal/panel/terminal-filter-dropdown.module.css +0 -59
  71. package/src/react-ui/blocks/Terminal/panel/terminal-session-tabs.module.css +0 -59
  72. package/src/react-ui/blocks/Terminal/parsing/BadgeFormatter.ts +0 -180
  73. package/src/react-ui/blocks/Terminal/parsing/HttpLogParser.ts +0 -248
  74. package/src/react-ui/blocks/Terminal/parsing/LogParser.types.ts +0 -283
  75. package/src/react-ui/blocks/Terminal/parsing/LogParserService.ts +0 -686
  76. package/src/react-ui/blocks/Terminal/parsing/MultilineAggregator.ts +0 -466
  77. package/src/react-ui/blocks/Terminal/parsing/PersistentLogBuffer.ts +0 -343
  78. package/src/react-ui/blocks/Terminal/parsing/SyntaxHighlighter.ts +0 -167
  79. package/src/react-ui/blocks/Terminal/parsing/TableParser.ts +0 -348
  80. package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiColorMapper.ts +0 -251
  81. package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiParser.ts +0 -390
  82. package/src/react-ui/blocks/Terminal/parsing/ansi/ansi.constants.ts +0 -320
  83. package/src/react-ui/blocks/Terminal/parsing/ansi/index.ts +0 -20
  84. package/src/react-ui/blocks/Terminal/parsing/index.ts +0 -69
  85. package/src/react-ui/blocks/Terminal/parsing/levels/LogLevel.types.ts +0 -68
  86. package/src/react-ui/blocks/Terminal/parsing/levels/LogLevelDetector.ts +0 -436
  87. package/src/react-ui/blocks/Terminal/parsing/levels/index.ts +0 -14
  88. package/src/react-ui/blocks/index.ts +0 -11
  89. package/src/react-ui/components/MorphingPopover/MorphingPopover.types.ts +0 -49
  90. package/src/react-ui/components/MorphingPopover/index.tsx +0 -186
  91. package/src/react-ui/components/MorphingPopover/morphing-popover.module.css +0 -153
  92. package/src/react-ui/components/index.ts +0 -9
  93. package/src/react-ui/hooks/Animation/UseAutoHeight.tsx +0 -123
  94. package/src/react-ui/hooks/DOM/UseIsInView.tsx +0 -44
  95. package/src/react-ui/hooks/Formatting/UseListFormat.ts +0 -134
  96. package/src/react-ui/hooks/State/UseControlledState.tsx +0 -57
  97. package/src/react-ui/hooks/State/UseDataState.tsx +0 -76
  98. package/src/react-ui/hooks/index.ts +0 -20
  99. package/src/react-ui/icons/index.ts +0 -12
  100. package/src/react-ui/icons/lucide-animated/activity.tsx +0 -109
  101. package/src/react-ui/icons/lucide-animated/arrow-down-to-line.tsx +0 -51
  102. package/src/react-ui/icons/lucide-animated/arrow-up.tsx +0 -50
  103. package/src/react-ui/icons/lucide-animated/bell-electric.tsx +0 -124
  104. package/src/react-ui/icons/lucide-animated/bell.tsx +0 -93
  105. package/src/react-ui/icons/lucide-animated/bot.tsx +0 -122
  106. package/src/react-ui/icons/lucide-animated/box.tsx +0 -117
  107. package/src/react-ui/icons/lucide-animated/check.tsx +0 -21
  108. package/src/react-ui/icons/lucide-animated/circle-check.tsx +0 -107
  109. package/src/react-ui/icons/lucide-animated/delete.tsx +0 -133
  110. package/src/react-ui/icons/lucide-animated/download.tsx +0 -99
  111. package/src/react-ui/icons/lucide-animated/edit-2.tsx +0 -21
  112. package/src/react-ui/icons/lucide-animated/globe.tsx +0 -23
  113. package/src/react-ui/icons/lucide-animated/home.tsx +0 -103
  114. package/src/react-ui/icons/lucide-animated/index.ts +0 -38
  115. package/src/react-ui/icons/lucide-animated/layers.tsx +0 -23
  116. package/src/react-ui/icons/lucide-animated/layout-panel-top.tsx +0 -143
  117. package/src/react-ui/icons/lucide-animated/list.tsx +0 -54
  118. package/src/react-ui/icons/lucide-animated/package.tsx +0 -24
  119. package/src/react-ui/icons/lucide-animated/palette.tsx +0 -25
  120. package/src/react-ui/icons/lucide-animated/plus.tsx +0 -92
  121. package/src/react-ui/icons/lucide-animated/refresh-cw.tsx +0 -24
  122. package/src/react-ui/icons/lucide-animated/rocket.tsx +0 -24
  123. package/src/react-ui/icons/lucide-animated/save.tsx +0 -23
  124. package/src/react-ui/icons/lucide-animated/search.tsx +0 -94
  125. package/src/react-ui/icons/lucide-animated/settings.tsx +0 -92
  126. package/src/react-ui/icons/lucide-animated/terminal.tsx +0 -46
  127. package/src/react-ui/icons/lucide-animated/trash-2.tsx +0 -25
  128. package/src/react-ui/icons/lucide-animated/trending-down.tsx +0 -151
  129. package/src/react-ui/icons/lucide-animated/trending-up.tsx +0 -150
  130. package/src/react-ui/icons/lucide-animated/type.tsx +0 -23
  131. package/src/react-ui/icons/lucide-animated/upload.tsx +0 -23
  132. package/src/react-ui/icons/lucide-animated/x.tsx +0 -102
  133. package/src/react-ui/index.ts +0 -30
  134. package/src/react-ui/lib/get-strict-context.tsx +0 -56
  135. package/src/react-ui/lib/icon-wrapper.tsx +0 -70
  136. package/src/react-ui/lib/index.ts +0 -9
  137. package/src/react-ui/lib/utils.ts +0 -24
  138. package/src/react-ui/primitives/AutoHeight/index.tsx +0 -74
  139. package/src/react-ui/primitives/CountingNumber/index.tsx +0 -147
  140. package/src/react-ui/primitives/Highlight/Highlight.types.ts +0 -136
  141. package/src/react-ui/primitives/Highlight/index.tsx +0 -577
  142. package/src/react-ui/primitives/Slot/index.tsx +0 -128
  143. package/src/react-ui/primitives/index.ts +0 -16
  144. package/src/react-ui/primitives/waapi/Gooey/Gooey.types.ts +0 -123
  145. package/src/react-ui/primitives/waapi/Gooey/GooeyCanvas.tsx +0 -80
  146. package/src/react-ui/primitives/waapi/Gooey/GooeyFilter.tsx +0 -77
  147. package/src/react-ui/primitives/waapi/Gooey/MorphPath.tsx +0 -58
  148. package/src/react-ui/primitives/waapi/Gooey/gooey-utils.ts +0 -244
  149. package/src/react-ui/primitives/waapi/Gooey/index.ts +0 -50
  150. package/src/react-ui/primitives/waapi/Gooey/useMorphPath.ts +0 -48
  151. package/src/react-ui/primitives/waapi/Morph/Morph.types.ts +0 -106
  152. package/src/react-ui/primitives/waapi/Morph/MorphContext.tsx +0 -21
  153. package/src/react-ui/primitives/waapi/Morph/index.tsx +0 -56
  154. package/src/react-ui/primitives/waapi/Morph/techniques/index.ts +0 -12
  155. package/src/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.ts +0 -89
  156. package/src/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.ts +0 -176
  157. package/src/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.ts +0 -87
  158. package/src/react-ui/primitives/waapi/Morph/useMorph.ts +0 -101
  159. package/src/react-ui/primitives/waapi/Reorder/Reorder.types.ts +0 -177
  160. package/src/react-ui/primitives/waapi/Reorder/index.tsx +0 -260
  161. package/src/react-ui/primitives/waapi/Reorder/useReorder.ts +0 -47
  162. package/src/react-ui/primitives/waapi/Reorder/useReorderPresence.ts +0 -209
  163. package/src/react-ui/primitives/waapi/Reorder/utils/separatorCoordination.ts +0 -104
  164. package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.ts +0 -14
  165. package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.types.ts +0 -84
  166. package/src/react-ui/primitives/waapi/SlidingNumber/index.tsx +0 -474
  167. package/src/react-ui/primitives/waapi/SlidingText/SlidingText.styles.ts +0 -32
  168. package/src/react-ui/primitives/waapi/SlidingText/SlidingText.types.ts +0 -69
  169. package/src/react-ui/primitives/waapi/SlidingText/index.tsx +0 -140
  170. package/src/react-ui/primitives/waapi/core/animationConstants.ts +0 -215
  171. package/src/react-ui/primitives/waapi/core/index.ts +0 -53
  172. package/src/react-ui/primitives/waapi/core/types.ts +0 -200
  173. package/src/react-ui/primitives/waapi/core/useAnimationOrchestrator.ts +0 -430
  174. package/src/react-ui/primitives/waapi/core/useElementRegistry.ts +0 -81
  175. package/src/react-ui/primitives/waapi/core/useFLIPAnimation.ts +0 -138
  176. package/src/react-ui/primitives/waapi/core/usePositionCapture.ts +0 -106
  177. package/src/react-ui/primitives/waapi/index.ts +0 -139
  178. package/src/react-ui/styles/animations.css +0 -369
  179. package/src/react-ui/ui/Accordion/Accordion.styles.ts +0 -72
  180. package/src/react-ui/ui/Accordion/Accordion.types.ts +0 -199
  181. package/src/react-ui/ui/Accordion/index.tsx +0 -362
  182. package/src/react-ui/ui/AlertDialog/AlertDialog.styles.ts +0 -38
  183. package/src/react-ui/ui/AlertDialog/AlertDialog.types.ts +0 -296
  184. package/src/react-ui/ui/AlertDialog/index.tsx +0 -540
  185. package/src/react-ui/ui/Badge/Badge.styles.ts +0 -43
  186. package/src/react-ui/ui/Badge/Badge.types.ts +0 -26
  187. package/src/react-ui/ui/Badge/index.tsx +0 -34
  188. package/src/react-ui/ui/Button/Button.styles.ts +0 -57
  189. package/src/react-ui/ui/Button/Button.types.ts +0 -63
  190. package/src/react-ui/ui/Button/index.tsx +0 -155
  191. package/src/react-ui/ui/Card/Card.styles.ts +0 -32
  192. package/src/react-ui/ui/Card/Card.types.ts +0 -39
  193. package/src/react-ui/ui/Card/index.tsx +0 -130
  194. package/src/react-ui/ui/Checkbox/Checkbox.styles.ts +0 -40
  195. package/src/react-ui/ui/Checkbox/Checkbox.types.ts +0 -98
  196. package/src/react-ui/ui/Checkbox/index.tsx +0 -233
  197. package/src/react-ui/ui/Combobox/Combobox.styles.ts +0 -34
  198. package/src/react-ui/ui/Combobox/Combobox.types.ts +0 -89
  199. package/src/react-ui/ui/Combobox/index.tsx +0 -331
  200. package/src/react-ui/ui/CornerBracket/CornerBracket.styles.ts +0 -38
  201. package/src/react-ui/ui/CornerBracket/CornerBracket.types.ts +0 -15
  202. package/src/react-ui/ui/CornerBracket/index.tsx +0 -49
  203. package/src/react-ui/ui/DataCard/DataCard.styles.ts +0 -94
  204. package/src/react-ui/ui/DataCard/DataCard.types.ts +0 -125
  205. package/src/react-ui/ui/DataCard/index.tsx +0 -340
  206. package/src/react-ui/ui/Dialog/Dialog.styles.ts +0 -59
  207. package/src/react-ui/ui/Dialog/Dialog.types.ts +0 -284
  208. package/src/react-ui/ui/Dialog/index.tsx +0 -452
  209. package/src/react-ui/ui/DropdownMenu/DropdownMenu.styles.ts +0 -35
  210. package/src/react-ui/ui/DropdownMenu/DropdownMenu.types.ts +0 -81
  211. package/src/react-ui/ui/DropdownMenu/index.tsx +0 -300
  212. package/src/react-ui/ui/DynamicToggle/DynamicToggle.css +0 -303
  213. package/src/react-ui/ui/DynamicToggle/DynamicToggle.styles.ts +0 -85
  214. package/src/react-ui/ui/DynamicToggle/DynamicToggle.types.ts +0 -174
  215. package/src/react-ui/ui/DynamicToggle/index.tsx +0 -294
  216. package/src/react-ui/ui/DynamicToggle/prototype-v7.html +0 -615
  217. package/src/react-ui/ui/DynamicToggle/prototype.html +0 -419
  218. package/src/react-ui/ui/Field/Field.styles.ts +0 -47
  219. package/src/react-ui/ui/Field/Field.types.ts +0 -60
  220. package/src/react-ui/ui/Field/index.tsx +0 -254
  221. package/src/react-ui/ui/Input/Input.styles.ts +0 -11
  222. package/src/react-ui/ui/Input/Input.types.ts +0 -10
  223. package/src/react-ui/ui/Input/index.tsx +0 -32
  224. package/src/react-ui/ui/InputGroup/InputGroup.styles.ts +0 -53
  225. package/src/react-ui/ui/InputGroup/InputGroup.types.ts +0 -44
  226. package/src/react-ui/ui/InputGroup/index.tsx +0 -149
  227. package/src/react-ui/ui/Label/Label.styles.ts +0 -10
  228. package/src/react-ui/ui/Label/Label.types.ts +0 -9
  229. package/src/react-ui/ui/Label/index.tsx +0 -27
  230. package/src/react-ui/ui/Menu/Menu.styles.ts +0 -71
  231. package/src/react-ui/ui/Menu/Menu.types.ts +0 -425
  232. package/src/react-ui/ui/Menu/index.tsx +0 -900
  233. package/src/react-ui/ui/Popover/Popover.styles.ts +0 -55
  234. package/src/react-ui/ui/Popover/Popover.types.ts +0 -261
  235. package/src/react-ui/ui/Popover/index.tsx +0 -422
  236. package/src/react-ui/ui/Progress/Progress.styles.ts +0 -36
  237. package/src/react-ui/ui/Progress/Progress.types.ts +0 -162
  238. package/src/react-ui/ui/Progress/index.tsx +0 -254
  239. package/src/react-ui/ui/Select/Select.styles.ts +0 -30
  240. package/src/react-ui/ui/Select/Select.types.ts +0 -51
  241. package/src/react-ui/ui/Select/index.tsx +0 -225
  242. package/src/react-ui/ui/Separator/Separator.styles.ts +0 -10
  243. package/src/react-ui/ui/Separator/Separator.types.ts +0 -10
  244. package/src/react-ui/ui/Separator/index.tsx +0 -37
  245. package/src/react-ui/ui/Switch/Switch.styles.ts +0 -50
  246. package/src/react-ui/ui/Switch/Switch.types.ts +0 -155
  247. package/src/react-ui/ui/Switch/index.tsx +0 -253
  248. package/src/react-ui/ui/Tabs/Tabs.css +0 -39
  249. package/src/react-ui/ui/Tabs/Tabs.styles.ts +0 -148
  250. package/src/react-ui/ui/Tabs/Tabs.types.ts +0 -255
  251. package/src/react-ui/ui/Tabs/index.tsx +0 -529
  252. package/src/react-ui/ui/TextFlow/TextFlow.styles.ts +0 -36
  253. package/src/react-ui/ui/TextFlow/TextFlow.types.ts +0 -118
  254. package/src/react-ui/ui/TextFlow/index.tsx +0 -276
  255. package/src/react-ui/ui/Textarea/Textarea.styles.ts +0 -10
  256. package/src/react-ui/ui/Textarea/Textarea.types.ts +0 -9
  257. package/src/react-ui/ui/Textarea/index.tsx +0 -27
  258. package/src/react-ui/ui/Tooltip/Tooltip.styles.ts +0 -43
  259. package/src/react-ui/ui/Tooltip/Tooltip.types.ts +0 -253
  260. package/src/react-ui/ui/Tooltip/index.tsx +0 -394
  261. package/src/react-ui/ui/index.ts +0 -41
  262. package/src/types/css-modules.d.ts +0 -18
@@ -1,104 +0,0 @@
1
- /**
2
- * Utility functions for separator animation coordination.
3
- *
4
- * When a token exits, determines which separators should animate:
5
- * 1. The exiting token's own separator (if it has one)
6
- * 2. If the exiting token is the last visible, the previous token's separator
7
- *
8
- * @module primitives/waapi/Reorder/utils/separatorCoordination
9
- */
10
-
11
- /**
12
- * Calculate which separator IDs should animate along with an exiting item.
13
- *
14
- * Logic:
15
- * - If the exiting item is NOT the last in the list, animate its own separator
16
- * - If the exiting item IS the last in the list, animate the previous item's separator
17
- * (because the previous item will become the new last and shouldn't have a separator)
18
- *
19
- * @param exitingId - The ID of the item being removed
20
- * @param currentKeys - Set of all current (non-exiting) item keys
21
- * @param exitingIds - Set of all currently exiting item IDs
22
- * @param orderedKeys - Array of keys in render order
23
- * @returns Array of separator IDs to animate
24
- *
25
- * @example
26
- * ```ts
27
- * // Items: [A, B, C, D] with separators after A, B, C
28
- * // Removing C (not last):
29
- * calculateSeparatorCoordination('C', {'A','B','D'}, {'C'}, ['A','B','C','D'])
30
- * // Returns: ['C'] - animate C's separator
31
- *
32
- * // Removing D (last item):
33
- * calculateSeparatorCoordination('D', {'A','B','C'}, {'D'}, ['A','B','C','D'])
34
- * // Returns: ['C'] - animate C's separator (C becomes new last)
35
- * ```
36
- */
37
- export function calculateSeparatorCoordination(
38
- exitingId: string,
39
- currentKeys: Set<string>,
40
- exitingIds: Set<string>,
41
- orderedKeys: string[]
42
- ): string[] {
43
- const additionalSeparators: string[] = [];
44
-
45
- const visibleKeys = orderedKeys.filter(
46
- key => currentKeys.has(key) || exitingIds.has(key)
47
- );
48
-
49
- const indexInVisible = visibleKeys.indexOf(exitingId);
50
- if (indexInVisible === -1) {
51
- return additionalSeparators;
52
- }
53
-
54
- const isLastVisible = indexInVisible === visibleKeys.length - 1;
55
- const isNotLastVisible = indexInVisible < visibleKeys.length - 1;
56
-
57
- if (isNotLastVisible) {
58
- additionalSeparators.push(exitingId);
59
- }
60
-
61
- if (isLastVisible && indexInVisible > 0) {
62
- const previousKey = visibleKeys[indexInVisible - 1];
63
- if (previousKey && !exitingIds.has(previousKey)) {
64
- additionalSeparators.push(previousKey);
65
- }
66
- }
67
-
68
- return additionalSeparators;
69
- }
70
-
71
- /**
72
- * Determine if a separator should be visible based on position and animation state.
73
- *
74
- * @param _tokenId - The token ID to check (unused, kept for API compatibility)
75
- * @param tokenIndex - Index of the token in the visible list
76
- * @param totalVisible - Total number of visible tokens
77
- * @param separatorPhase - Current animation phase of the separator
78
- * @returns Whether the separator should be rendered
79
- */
80
- export function shouldShowSeparator(
81
- _tokenId: string,
82
- tokenIndex: number,
83
- totalVisible: number,
84
- separatorPhase?: 'idle' | 'exit-coordinated' | 'flip-coordinated' | 'completed'
85
- ): boolean {
86
- if (tokenIndex >= totalVisible - 1) {
87
- return false;
88
- }
89
-
90
- if (!separatorPhase) {
91
- return true;
92
- }
93
-
94
- switch (separatorPhase) {
95
- case 'idle':
96
- case 'exit-coordinated':
97
- case 'flip-coordinated':
98
- return true;
99
- case 'completed':
100
- return false;
101
- default:
102
- return true;
103
- }
104
- }
@@ -1,14 +0,0 @@
1
- import { cva, type VariantProps } from 'class-variance-authority';
2
- import type { StyleSlots } from '@/core/types';
3
-
4
- /**
5
- * Style slots for SlidingNumber component
6
- */
7
- export type SlidingNumberSlot = 'root';
8
-
9
- /**
10
- * Base styles for SlidingNumber component
11
- */
12
- export const slidingNumberBaseStyles: StyleSlots<SlidingNumberSlot> = {
13
- root: 'waapi-sliding-number',
14
- };
@@ -1,84 +0,0 @@
1
- /**
2
- * Format options for number display using Intl.NumberFormat
3
- */
4
- export interface IFormatOptions {
5
- /** Number formatting style */
6
- style?: 'decimal' | 'currency' | 'percent';
7
- /** Currency code (required when style is 'currency') */
8
- currency?: string;
9
- /** Locale for formatting (e.g., 'en-US', 'es-ES') */
10
- locale?: string;
11
- /** Minimum fraction digits */
12
- minimumFractionDigits?: number;
13
- /** Maximum fraction digits */
14
- maximumFractionDigits?: number;
15
- /** Whether to use grouping separators */
16
- useGrouping?: boolean;
17
- }
18
-
19
- /**
20
- * Props for SlidingNumber component
21
- *
22
- * Animated number transitions with format preservation using WAAPI slot-machine-style animation.
23
- *
24
- * @example
25
- * ```tsx
26
- * // Basic counter
27
- * <SlidingNumber value={1234} duration={700} />
28
- *
29
- * // Currency
30
- * <SlidingNumber
31
- * value={99.99}
32
- * format={{ style: 'currency', currency: 'USD' }}
33
- * />
34
- *
35
- * // With motion blur
36
- * <SlidingNumber value={500} motionBlur={true} digitHeight={60} />
37
- * ```
38
- */
39
- export interface ISlidingNumberProps {
40
- /** The numeric value to display */
41
- value: number;
42
-
43
- /** Animation duration in milliseconds */
44
- duration?: number;
45
-
46
- /** Font size for the number display */
47
- fontSize?: string;
48
-
49
- /** Font weight for the number display */
50
- fontWeight?: string;
51
-
52
- /** Text color */
53
- color?: string;
54
-
55
- /** Height of each digit row in pixels */
56
- digitHeight?: number;
57
-
58
- /** Delay between digit animations in milliseconds */
59
- stagger?: number;
60
-
61
- /** Enable motion blur effect during animation */
62
- motionBlur?: boolean;
63
-
64
- /** Number formatting options */
65
- format?: IFormatOptions;
66
-
67
- /**
68
- * Animation direction trend
69
- * - 1: Always animate upward (increasing)
70
- * - -1: Always animate downward (decreasing)
71
- * - 0: Auto (shorter path)
72
- */
73
- trend?: -1 | 0 | 1;
74
-
75
- /** Physics-based animation configuration */
76
- animationConfig?: {
77
- /** Overshoot amount (higher = more bounce) */
78
- overshoot?: number;
79
- /** Mass of the animated object */
80
- mass?: number;
81
- /** Spring stiffness */
82
- stiffness?: number;
83
- };
84
- }
@@ -1,474 +0,0 @@
1
- "use client";
2
-
3
- import React, { useEffect, useRef, useMemo, useLayoutEffect } from 'react';
4
- import type { ISlidingNumberProps, IFormatOptions } from './SlidingNumber.types';
5
- import { cn } from '@/react-ui/lib/utils';
6
-
7
- /**
8
- * SlidingNumber - Animated number transitions with format preservation
9
- *
10
- * Uses WAAPI slot-machine-style animation with optional motion blur.
11
- * Supports Intl.NumberFormat for currency, percentage, and decimal formatting.
12
- *
13
- * @example
14
- * ```tsx
15
- * // Basic counter
16
- * <SlidingNumber value={1234} />
17
- *
18
- * // Currency with animation
19
- * <SlidingNumber
20
- * value={99.99}
21
- * format={{ style: 'currency', currency: 'USD' }}
22
- * duration={700}
23
- * />
24
- *
25
- * // Percentage
26
- * <SlidingNumber
27
- * value={75.5}
28
- * format={{ style: 'percent' }}
29
- * />
30
- * ```
31
- */
32
- export const SlidingNumber = ({
33
- value,
34
- duration = 700,
35
- fontSize = '3rem',
36
- fontWeight = '700',
37
- color = '#000',
38
- digitHeight = 60,
39
- stagger = 30,
40
- motionBlur = true,
41
- format,
42
- trend = 0,
43
- animationConfig,
44
- }: ISlidingNumberProps): React.ReactElement => {
45
- const computedEasing = useMemo(() => {
46
- if (animationConfig) {
47
- const { overshoot = 1, stiffness = 1, mass = 1 } = animationConfig;
48
- const p1 = 0.34 * stiffness;
49
- const p2 = 1 + 0.56 * overshoot;
50
- const p3 = 0.64 / mass;
51
- return `cubic-bezier(${Math.min(p1, 1).toFixed(2)}, ${Math.min(p2, 2).toFixed(2)}, ${Math.min(p3, 1).toFixed(2)}, 1)`;
52
- }
53
- return 'cubic-bezier(0.34, 1.56, 0.64, 1)';
54
- }, [animationConfig]);
55
-
56
- const currentChars = useMemo(() => parseNumberToChars(value, format), [value, format]);
57
- const prevKeysRef = useRef<Set<string>>(new Set());
58
- const isFirstRenderRef = useRef(true);
59
-
60
- const enteringKeys = useMemo(() => {
61
- if (isFirstRenderRef.current) return new Set<string>();
62
- const entering = new Set<string>();
63
- currentChars.forEach((c) => {
64
- if (!prevKeysRef.current.has(c.key)) {
65
- entering.add(c.key);
66
- }
67
- });
68
- return entering;
69
- }, [currentChars]);
70
-
71
- useEffect(() => {
72
- isFirstRenderRef.current = false;
73
- prevKeysRef.current = new Set(currentChars.map((c) => c.key));
74
- }, [currentChars]);
75
-
76
- const getDelay = (position: number) => {
77
- const absPos = Math.abs(position);
78
- return (absPos - 1) * stagger;
79
- };
80
-
81
- return (
82
- <div
83
- className={cn('waapi-sliding-number')}
84
- style={{
85
- display: 'inline-flex',
86
- alignItems: 'center',
87
- fontSize,
88
- fontWeight,
89
- color,
90
- fontVariantNumeric: 'tabular-nums',
91
- fontFamily: 'system-ui, -apple-system, sans-serif',
92
- overflow: 'hidden',
93
- }}
94
- >
95
- {currentChars.map((item) => {
96
- const isEntering = enteringKeys.has(item.key);
97
-
98
- if (item.isDigit) {
99
- return (
100
- <Digit
101
- key={item.key}
102
- digit={Number.parseInt(item.char)}
103
- duration={duration}
104
- digitHeight={digitHeight}
105
- delay={getDelay(item.position)}
106
- motionBlur={motionBlur}
107
- easing={computedEasing}
108
- isEntering={isEntering}
109
- trend={trend}
110
- />
111
- );
112
- }
113
-
114
- return (
115
- <Symbol key={item.key} char={item.char} isEntering={isEntering} duration={duration} easing={computedEasing} />
116
- );
117
- })}
118
- </div>
119
- );
120
- };
121
-
122
- SlidingNumber.displayName = 'SlidingNumber';
123
-
124
- // ============================================================================
125
- // Types
126
- // ============================================================================
127
-
128
- interface ICharItem {
129
- char: string;
130
- key: string;
131
- isDigit: boolean;
132
- position: number;
133
- }
134
-
135
- interface IDigitProps {
136
- digit: number;
137
- duration: number;
138
- digitHeight: number;
139
- delay: number;
140
- motionBlur: boolean;
141
- easing: string;
142
- isEntering: boolean;
143
- trend: -1 | 0 | 1;
144
- }
145
-
146
- interface ISymbolProps {
147
- char: string;
148
- isEntering: boolean;
149
- duration: number;
150
- easing: string;
151
- }
152
-
153
- // ============================================================================
154
- // Utilities
155
- // ============================================================================
156
-
157
- function parseNumberToChars(value: number, format?: IFormatOptions): ICharItem[] {
158
- const locale = format?.locale || 'en-US';
159
- const options: Intl.NumberFormatOptions = {
160
- style: format?.style || 'decimal',
161
- minimumFractionDigits: format?.minimumFractionDigits,
162
- maximumFractionDigits: format?.maximumFractionDigits,
163
- useGrouping: format?.useGrouping ?? true,
164
- };
165
-
166
- if (format?.style === 'currency' && format?.currency) {
167
- options.currency = format.currency;
168
- }
169
-
170
- const formatter = new Intl.NumberFormat(locale, options);
171
- const parts = formatter.formatToParts(value);
172
-
173
- const result: ICharItem[] = [];
174
-
175
- let integerDigitCount = 0;
176
- parts.forEach((part) => {
177
- if (part.type === 'integer') {
178
- integerDigitCount += part.value.length;
179
- }
180
- });
181
-
182
- let integerIndex = integerDigitCount;
183
- let fractionIndex = 0;
184
- let groupCount = 0;
185
-
186
- parts.forEach((part, partIdx) => {
187
- if (part.type === 'integer') {
188
- for (const char of part.value) {
189
- result.push({
190
- char,
191
- key: `int-${integerIndex}`,
192
- isDigit: true,
193
- position: integerIndex,
194
- });
195
- integerIndex--;
196
- }
197
- } else if (part.type === 'fraction') {
198
- for (const char of part.value) {
199
- fractionIndex++;
200
- result.push({
201
- char,
202
- key: `frac-${fractionIndex}`,
203
- isDigit: true,
204
- position: -fractionIndex,
205
- });
206
- }
207
- } else if (part.type === 'decimal') {
208
- result.push({ char: part.value, key: 'decimal', isDigit: false, position: 0 });
209
- } else if (part.type === 'group') {
210
- groupCount++;
211
- result.push({ char: part.value, key: `group-${groupCount}`, isDigit: false, position: 0 });
212
- } else if (part.type === 'currency') {
213
- result.push({ char: part.value, key: `currency-${partIdx}`, isDigit: false, position: 0 });
214
- } else if (part.type === 'percentSign') {
215
- result.push({ char: part.value, key: 'percent', isDigit: false, position: 0 });
216
- } else {
217
- result.push({ char: part.value, key: `symbol-${partIdx}`, isDigit: false, position: 0 });
218
- }
219
- });
220
-
221
- return result;
222
- }
223
-
224
- // ============================================================================
225
- // Symbol Component (non-digit characters)
226
- // ============================================================================
227
-
228
- function Symbol({ char, isEntering, duration, easing }: ISymbolProps) {
229
- const ref = useRef<HTMLSpanElement>(null);
230
- const hasAnimatedRef = useRef(false);
231
-
232
- useLayoutEffect(() => {
233
- if (!ref.current || !isEntering || hasAnimatedRef.current) return;
234
- hasAnimatedRef.current = true;
235
-
236
- ref.current.animate(
237
- [
238
- { opacity: 0, transform: 'scale(0.8)' },
239
- { opacity: 1, transform: 'scale(1)' },
240
- ],
241
- {
242
- duration: duration * 0.3,
243
- easing,
244
- fill: 'forwards',
245
- }
246
- );
247
- }, [isEntering, duration, easing]);
248
-
249
- return (
250
- <span
251
- ref={ref}
252
- style={{
253
- display: 'inline-block',
254
- whiteSpace: 'pre',
255
- opacity: isEntering ? 0 : 1,
256
- }}
257
- >
258
- {char}
259
- </span>
260
- );
261
- }
262
-
263
- // ============================================================================
264
- // Digit Component (animated numbers)
265
- // ============================================================================
266
-
267
- function Digit({ digit, duration, digitHeight, delay, motionBlur, easing, isEntering, trend }: IDigitProps) {
268
- const columnRef = useRef<HTMLDivElement>(null);
269
- const containerRef = useRef<HTMLDivElement>(null);
270
- const animationRef = useRef<Animation | null>(null);
271
- const filterId = useRef(`blur-${Math.random().toString(36).slice(2, 9)}`).current;
272
-
273
- const currentOffsetRef = useRef<number | null>(null);
274
- const targetDigitRef = useRef(digit);
275
- const hasInitializedRef = useRef(false);
276
-
277
- const sequence = useMemo(() => {
278
- const seq: number[] = [];
279
- for (let cycle = -1; cycle <= 1; cycle++) {
280
- for (let d = 0; d <= 9; d++) {
281
- seq.push(d);
282
- }
283
- }
284
- return seq;
285
- }, []);
286
-
287
- useLayoutEffect(() => {
288
- if (!hasInitializedRef.current) {
289
- hasInitializedRef.current = true;
290
- const offset = -(digit + 10) * digitHeight;
291
- currentOffsetRef.current = offset;
292
- targetDigitRef.current = digit;
293
-
294
- if (columnRef.current) {
295
- columnRef.current.style.transform = `translateY(${offset}px)`;
296
- }
297
- }
298
- }, [digit, digitHeight]);
299
-
300
- useLayoutEffect(() => {
301
- if (!containerRef.current || !isEntering) return;
302
-
303
- containerRef.current.animate(
304
- [
305
- { opacity: 0, transform: 'scale(0.5) translateY(-20px)' },
306
- { opacity: 1, transform: 'scale(1) translateY(0)' },
307
- ],
308
- {
309
- duration: duration * 0.4,
310
- easing,
311
- fill: 'forwards',
312
- }
313
- );
314
- }, [isEntering, duration, easing]);
315
-
316
- useEffect(() => {
317
- targetDigitRef.current = digit;
318
-
319
- if (!hasInitializedRef.current) return;
320
-
321
- const currentDigit =
322
- currentOffsetRef.current !== null
323
- ? (((Math.round(-currentOffsetRef.current / digitHeight) - 10) % 10) + 10) % 10
324
- : digit;
325
-
326
- if (digit === currentDigit && currentOffsetRef.current !== null) {
327
- return;
328
- }
329
-
330
- animateToDigit(digit);
331
- }, [digit, digitHeight]);
332
-
333
- const animateToDigit = (target: number) => {
334
- if (!columnRef.current || !containerRef.current) return;
335
-
336
- if (animationRef.current) {
337
- const computedStyle = getComputedStyle(columnRef.current);
338
- const matrix = new DOMMatrix(computedStyle.transform);
339
- currentOffsetRef.current = matrix.m42;
340
- animationRef.current.cancel();
341
- animationRef.current = null;
342
- columnRef.current.style.transform = `translateY(${currentOffsetRef.current}px)`;
343
- }
344
-
345
- const rawIndex = currentOffsetRef.current !== null ? -currentOffsetRef.current / digitHeight : target + 10;
346
-
347
- const currentDigitFromOffset = (((Math.round(rawIndex) - 10) % 10) + 10) % 10;
348
- const from = currentDigitFromOffset;
349
-
350
- if (target === from && currentOffsetRef.current !== null) {
351
- const normalizedOffset = -(target + 10) * digitHeight;
352
- if (columnRef.current) {
353
- const currentAnim = animationRef.current as Animation | null;
354
- if (currentAnim) {
355
- currentAnim.cancel();
356
- }
357
- columnRef.current.style.transform = `translateY(${normalizedOffset}px)`;
358
- }
359
- currentOffsetRef.current = normalizedOffset;
360
- return;
361
- }
362
-
363
- let diff: number;
364
- if (trend === 1) {
365
- diff = target >= from ? target - from : 10 - from + target;
366
- } else if (trend === -1) {
367
- diff = target <= from ? target - from : target - from - 10;
368
- } else {
369
- diff = target - from;
370
- if (diff > 5) diff -= 10;
371
- else if (diff < -5) diff += 10;
372
- }
373
-
374
- const startOffset = currentOffsetRef.current ?? -(from + 10) * digitHeight;
375
- const endOffset = startOffset - diff * digitHeight;
376
-
377
- const blurEl = document.getElementById(filterId)?.querySelector('feGaussianBlur');
378
- if (motionBlur && blurEl) {
379
- const intensity = Math.min(Math.abs(diff) * 1.2, 6);
380
- blurEl.setAttribute('stdDeviation', `0,${intensity}`);
381
- containerRef.current.style.filter = `url(#${filterId})`;
382
- }
383
-
384
- const anim = columnRef.current.animate(
385
- [{ transform: `translateY(${startOffset}px)` }, { transform: `translateY(${endOffset}px)` }],
386
- {
387
- duration,
388
- delay,
389
- easing,
390
- fill: 'forwards',
391
- }
392
- );
393
-
394
- animationRef.current = anim;
395
-
396
- anim.onfinish = () => {
397
- const normalizedOffset = -(target + 10) * digitHeight;
398
- if (columnRef.current) {
399
- anim.cancel();
400
- columnRef.current.style.transform = `translateY(${normalizedOffset}px)`;
401
- }
402
- currentOffsetRef.current = normalizedOffset;
403
-
404
- if (containerRef.current) {
405
- containerRef.current.style.filter = 'none';
406
- }
407
- if (blurEl) {
408
- blurEl.setAttribute('stdDeviation', '0,0');
409
- }
410
-
411
- animationRef.current = null;
412
-
413
- if (targetDigitRef.current !== target) {
414
- requestAnimationFrame(() => {
415
- animateToDigit(targetDigitRef.current);
416
- });
417
- }
418
- };
419
-
420
- anim.oncancel = () => {
421
- animationRef.current = null;
422
- };
423
- };
424
-
425
- return (
426
- <>
427
- <svg style={{ position: 'absolute', width: 0, height: 0 }} aria-hidden="true">
428
- <defs>
429
- <filter id={filterId}>
430
- <feGaussianBlur in="SourceGraphic" stdDeviation="0,0" />
431
- </filter>
432
- </defs>
433
- </svg>
434
-
435
- <div
436
- ref={containerRef}
437
- style={{
438
- position: 'relative',
439
- height: `${digitHeight}px`,
440
- overflow: 'hidden',
441
- width: '0.65em',
442
- textAlign: 'center',
443
- opacity: isEntering ? 0 : 1,
444
- }}
445
- >
446
- <div
447
- ref={columnRef}
448
- style={{
449
- position: 'absolute',
450
- left: 0,
451
- right: 0,
452
- willChange: 'transform',
453
- }}
454
- >
455
- {sequence.map((d, i) => (
456
- <div
457
- key={i}
458
- style={{
459
- height: `${digitHeight}px`,
460
- display: 'flex',
461
- alignItems: 'center',
462
- justifyContent: 'center',
463
- }}
464
- >
465
- {d}
466
- </div>
467
- ))}
468
- </div>
469
- </div>
470
- </>
471
- );
472
- }
473
-
474
- export type { ISlidingNumberProps, IFormatOptions };
@@ -1,32 +0,0 @@
1
- import type { StyleSlots } from '@/core/types';
2
-
3
- /**
4
- * Style slots for SlidingText component
5
- */
6
- export type SlidingTextSlot = 'root' | 'content' | 'token';
7
-
8
- /**
9
- * Base styles for SlidingText component
10
- */
11
- export const slidingTextBaseStyles: StyleSlots<SlidingTextSlot> = {
12
- root: 'waapi-sliding-text-container',
13
- content: 'waapi-sliding-text-content',
14
- token: 'waapi-sliding-text-token',
15
- };
16
-
17
- /**
18
- * CSS classes for animation states
19
- */
20
- export const slidingTextAnimationClasses = {
21
- enterFrom: 'enter-from',
22
- enterTo: 'enter-to',
23
- exitActive: 'exit-active',
24
- } as const;
25
-
26
- /**
27
- * CSS classes for direction variants
28
- */
29
- export const slidingTextDirectionClasses = {
30
- vertical: 'waapi-direction-vertical',
31
- horizontal: 'waapi-direction-horizontal',
32
- } as const;