@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,106 +0,0 @@
1
- 'use client';
2
- import { useRef, useCallback } from 'react';
3
- import { TIMING } from './animationConstants';
4
- import type { IPositionCaptureAPI, IFLIPDelta, IPositionCaptureOptions } from './types';
5
-
6
- const DEFAULT_MIN_DELTA_PX = TIMING.MIN_DELTA_PX;
7
-
8
- /**
9
- * Hook for capturing element positions and calculating FLIP deltas.
10
- * Extracted from the WAAPI animation system's position capture logic.
11
- *
12
- * @param getElements - Function that returns the current element map
13
- * @param options - Optional configuration (e.g. minimum delta threshold)
14
- * @returns Position capture API with capture, delta calculation, and cache
15
- *
16
- * @example
17
- * ```tsx
18
- * const registry = useElementRegistry();
19
- * const positions = usePositionCapture(registry.getAll);
20
- *
21
- * // Before layout change:
22
- * const before = positions.capture();
23
- *
24
- * // After layout change:
25
- * const after = positions.capture();
26
- * const deltas = positions.calculateDeltas(before, after);
27
- * ```
28
- */
29
- export function usePositionCapture(
30
- getElements: () => Map<string, HTMLElement>,
31
- options?: IPositionCaptureOptions
32
- ): IPositionCaptureAPI {
33
- const lastCaptureRef = useRef<Map<string, DOMRect>>(new Map());
34
- const minDeltaPx = options?.minDeltaPx ?? DEFAULT_MIN_DELTA_PX;
35
-
36
- const capture = useCallback((excludeIds?: Set<string>): Map<string, DOMRect> => {
37
- const positions = new Map<string, DOMRect>();
38
- const elements = getElements();
39
-
40
- elements.forEach((el, id) => {
41
- if (excludeIds?.has(id)) return;
42
-
43
- const rect = el.getBoundingClientRect();
44
- if (rect.width > 0 && rect.height > 0) {
45
- positions.set(id, rect);
46
- }
47
- });
48
-
49
- lastCaptureRef.current = positions;
50
- return positions;
51
- }, [getElements]);
52
-
53
- const getPosition = useCallback((id: string): DOMRect | undefined => {
54
- return lastCaptureRef.current.get(id);
55
- }, []);
56
-
57
- const calculateDeltas = useCallback((
58
- before: Map<string, DOMRect>,
59
- after: Map<string, DOMRect>
60
- ): Map<string, IFLIPDelta> => {
61
- const deltas = new Map<string, IFLIPDelta>();
62
-
63
- after.forEach((newRect, id) => {
64
- const prevRect = before.get(id);
65
- if (!prevRect) return;
66
-
67
- const deltaX = prevRect.left - newRect.left;
68
- const deltaY = prevRect.top - newRect.top;
69
- const deltaWidth = prevRect.width - newRect.width;
70
- const deltaHeight = prevRect.height - newRect.height;
71
-
72
- const isSignificant =
73
- Math.abs(deltaX) >= minDeltaPx ||
74
- Math.abs(deltaY) >= minDeltaPx ||
75
- Math.abs(deltaWidth) >= minDeltaPx ||
76
- Math.abs(deltaHeight) >= minDeltaPx;
77
-
78
- deltas.set(id, {
79
- id,
80
- deltaX,
81
- deltaY,
82
- deltaWidth,
83
- deltaHeight,
84
- isSignificant
85
- });
86
- });
87
-
88
- return deltas;
89
- }, [minDeltaPx]);
90
-
91
- const getLastCapture = useCallback((): Map<string, DOMRect> => {
92
- return new Map(lastCaptureRef.current);
93
- }, []);
94
-
95
- const clear = useCallback(() => {
96
- lastCaptureRef.current.clear();
97
- }, []);
98
-
99
- return {
100
- capture,
101
- getPosition,
102
- calculateDeltas,
103
- getLastCapture,
104
- clear
105
- };
106
- }
@@ -1,139 +0,0 @@
1
- /**
2
- * WAAPI Animation Primitives
3
- *
4
- * Lightweight, performant React animation components built on the Web Animations API (WAAPI).
5
- *
6
- * @example
7
- * ```tsx
8
- * import { SlidingNumber, SlidingText, Reorder, Morph } from '@mks2508/mks-ui/react/primitives/waapi';
9
- * ```
10
- */
11
-
12
- // ============================================================
13
- // Core — FLIP animation infrastructure
14
- // ============================================================
15
-
16
- // Constants (SSOT)
17
- export {
18
- TIMING,
19
- TRANSFORMS,
20
- EFFECTS,
21
- EASINGS,
22
- RESPONSIVE_CONFIGS,
23
- ANIMATION_CONFIGS,
24
- ANIMATION_DEFAULTS,
25
- PRESETS,
26
- getResponsiveDuration,
27
- getResponsiveStagger,
28
- } from './core';
29
-
30
- // Core hooks
31
- export { useElementRegistry } from './core';
32
- export { usePositionCapture } from './core';
33
- export { useFLIPAnimation } from './core';
34
- export { useAnimationOrchestrator } from './core';
35
-
36
- // Core types
37
- export type {
38
- IFLIPDelta,
39
- IAnimationTiming,
40
- IPositionRect,
41
- IElementRegistryAPI,
42
- IElementRegistryCallbacks,
43
- IPositionCaptureAPI,
44
- IPositionCaptureOptions,
45
- IFLIPAnimationAPI,
46
- IFLIPAnimationOptions,
47
- IExitOptions,
48
- IEnterOptions,
49
- IAnimationOrchestratorConfig,
50
- IAnimationOrchestratorAPI,
51
- IOrchestratorState,
52
- IAnimationEvent,
53
- FLIPBehavior,
54
- ExitPositionStrategy,
55
- AnimationPhase,
56
- } from './core';
57
-
58
- // ============================================================
59
- // SlidingNumber - Animated number transitions
60
- // ============================================================
61
- export { SlidingNumber } from './SlidingNumber';
62
- export type {
63
- ISlidingNumberProps,
64
- IFormatOptions,
65
- } from './SlidingNumber/SlidingNumber.types';
66
-
67
- // ============================================================
68
- // SlidingText - Character/word text animations
69
- // ============================================================
70
- export { SlidingText } from './SlidingText';
71
- export type { ISlidingTextProps } from './SlidingText/SlidingText.types';
72
-
73
- // ============================================================
74
- // Reorder - FLIP list reordering
75
- // ============================================================
76
- export { Reorder } from './Reorder';
77
- export type {
78
- IReorderProps,
79
- ReorderLayout,
80
- DurationConfig,
81
- StaggerConfig,
82
- IUseReorderReturn,
83
- IUseReorderConfig,
84
- IReorderItemState,
85
- IReorderContextValue,
86
- IUseReorderPresenceConfig,
87
- IUseReorderPresenceReturn,
88
- } from './Reorder/Reorder.types';
89
- export { useReorder } from './Reorder/useReorder';
90
- export { useReorderPresence } from './Reorder/useReorderPresence';
91
- export { calculateSeparatorCoordination, shouldShowSeparator } from './Reorder/utils/separatorCoordination';
92
-
93
- // ============================================================
94
- // Morph - Morphing animations
95
- // ============================================================
96
- export { Morph } from './Morph';
97
- export type {
98
- IMorphProps,
99
- IMorphContextValue,
100
- IUseMorphConfig,
101
- IUseMorphReturn,
102
- MorphTechnique,
103
- IFLIPClipPathOptions,
104
- IFLIPClipPathAPI,
105
- ICSSGridMorphOptions,
106
- ICSSGridMorphAPI,
107
- IViewTransitionsOptions,
108
- IViewTransitionsAPI,
109
- } from './Morph/Morph.types';
110
- export { useMorph } from './Morph/useMorph';
111
- export { useMorphContext } from './Morph/MorphContext';
112
-
113
- // Morph techniques (individual)
114
- export { useFLIPClipPath } from './Morph/techniques/useFLIPClipPath';
115
- export { useCSSGridMorph } from './Morph/techniques/useCSSGridMorph';
116
- export { useViewTransitions } from './Morph/techniques/useViewTransitions';
117
-
118
- // ============================================================
119
- // Gooey — SVG-based shape morphing (filter + parametric path)
120
- // ============================================================
121
-
122
- export {
123
- GooeyFilter,
124
- GooeyCanvas,
125
- MorphPath,
126
- useMorphPath,
127
- GOOEY_DEFAULTS,
128
- computeBlur,
129
- buildColorMatrixValues,
130
- buildFilterString,
131
- morphPathDown,
132
- morphPathUp,
133
- } from './Gooey';
134
- export type {
135
- IGooeyFilterProps,
136
- IGooeyCanvasProps,
137
- IMorphPathProps,
138
- IUseMorphPathOptions,
139
- } from './Gooey';
@@ -1,369 +0,0 @@
1
- /* ============================================
2
- WAAPI Animation Primitives - CSS-First Architecture
3
-
4
- RESPONSIBILITIES:
5
- - CSS: Structure, final states, accessibility
6
- - WAAPI: Dynamic animations, FLIP, timing
7
-
8
- GOLDEN RULE: CSS does NOT animate what WAAPI controls
9
- ============================================ */
10
-
11
- /* ============================================
12
- CSS Variables for WAAPI Animations
13
- These can be overridden by consumers
14
- ============================================ */
15
- :root {
16
- /* Timing */
17
- --waapi-duration-enter: 200ms;
18
- --waapi-duration-exit: 180ms;
19
- --waapi-duration-collapse: 200ms;
20
- --waapi-duration-flip: 300ms;
21
- --waapi-stagger-enter: 15ms;
22
- --waapi-stagger-exit: 0ms;
23
-
24
- /* Transforms */
25
- --waapi-offset-y-enter: 8px;
26
- --waapi-offset-y-exit: -8px;
27
- --waapi-offset-x: 16px;
28
- --waapi-scale-exit: 0.85;
29
-
30
- /* Effects */
31
- --waapi-blur-enter: 4px;
32
- --waapi-blur-exit: 2px;
33
-
34
- /* Easings */
35
- --waapi-ease-enter: cubic-bezier(0.33, 1, 0.68, 1);
36
- --waapi-ease-exit: cubic-bezier(0.32, 0, 0.67, 0);
37
- --waapi-ease-collapse: cubic-bezier(0.42, 0, 0.58, 1);
38
- --waapi-ease-flip: cubic-bezier(0.2, 0, 0.2, 1);
39
- }
40
-
41
- /* ===========================================
42
- REORDER CONTAINER
43
- =========================================== */
44
- .waapi-reorder-container {
45
- position: relative;
46
- }
47
-
48
- /* ===========================================
49
- REORDER ITEM - Base State
50
- [data-reorder-state] marks elements controlled by the orchestrator
51
- =========================================== */
52
- [data-reorder-state] {
53
- position: relative;
54
- will-change: transform, opacity;
55
- }
56
-
57
- /* ===========================================
58
- STATE: IDLE (Default)
59
- Normal state after animation completes
60
- =========================================== */
61
- [data-reorder-state="idle"] {
62
- opacity: 1;
63
- transform: none;
64
- will-change: auto;
65
- }
66
-
67
- /* ===========================================
68
- STATE: ENTERING
69
- CSS: Starts HIDDEN - WAAPI animates to visible
70
- Prevents flicker - element is hidden BEFORE JS runs
71
- =========================================== */
72
- [data-reorder-state="entering"] {
73
- opacity: 0;
74
- transform: translateY(-8px) scale(0.95);
75
- }
76
-
77
- /* ===========================================
78
- STATE: EXITING
79
- WAAPI controls opacity and transform
80
- =========================================== */
81
- [data-reorder-state="exiting"] {
82
- pointer-events: none;
83
- }
84
-
85
- /* Exit position variant: absolute-fixed */
86
- [data-reorder-state="exiting"][data-exit-position="absolute"] {
87
- position: absolute;
88
- }
89
-
90
- /* Exit position variant: in-place */
91
- [data-reorder-state="exiting"][data-exit-position="in-place"] {
92
- position: relative;
93
- }
94
-
95
- /* ===========================================
96
- STATE: FLIPPING
97
- WAAPI controls the translate3d FLIP
98
- =========================================== */
99
- [data-reorder-state="flipping"] {
100
- /* WAAPI manages the FLIP transform */
101
- }
102
-
103
- /* ===========================================
104
- STATE: COMPLETED (Post-Animation)
105
- CSS handles final state, no animation needed
106
- =========================================== */
107
- [data-reorder-state="completed"] {
108
- position: absolute !important;
109
- opacity: 0 !important;
110
- pointer-events: none !important;
111
- visibility: hidden;
112
- width: 0;
113
- height: 0;
114
- overflow: hidden;
115
- }
116
-
117
- /* ===========================================
118
- SEPARATOR STATES
119
- =========================================== */
120
- [data-separator-state] {
121
- display: inline;
122
- white-space: pre;
123
- will-change: transform, opacity;
124
- }
125
-
126
- [data-separator-state="idle"] {
127
- /* Normal */
128
- }
129
-
130
- [data-separator-state="exiting"] {
131
- pointer-events: none;
132
- }
133
-
134
- [data-separator-state="completed"] {
135
- opacity: 0;
136
- position: absolute;
137
- pointer-events: none;
138
- width: 0;
139
- overflow: hidden;
140
- }
141
-
142
- /* ===========================================
143
- FLIP BEHAVIOR VARIANTS
144
- Controls which elements participate in FLIP
145
- =========================================== */
146
- [data-flip-behavior="all"] {
147
- /* Default: all siblings do FLIP */
148
- }
149
-
150
- [data-flip-behavior="siblings-after"] {
151
- /* Only siblings after the exiting item */
152
- }
153
-
154
- [data-flip-behavior="none"] {
155
- /* This item does not participate in FLIP */
156
- }
157
-
158
- /* ===========================================
159
- STAGGER INDEX (Progressive Enhancement)
160
- Chrome 138+, Safari TP 226+ support sibling-index()
161
- =========================================== */
162
- @supports (animation-delay: calc(sibling-index() * 1ms)) {
163
- [data-reorder-state="entering"] {
164
- --waapi-stagger-index: sibling-index();
165
- }
166
- }
167
-
168
- /* Fallback: use data-reorder-index set by JS */
169
- [data-reorder-index] {
170
- /* JS sets this for stagger calculation fallback */
171
- }
172
-
173
- /* ===========================================
174
- LEGACY CLASS SUPPORT
175
- Compatibility with existing components
176
- =========================================== */
177
-
178
- /* Token wrapper - FLIP-ready container */
179
- .waapi-token-wrapper {
180
- display: inline-flex;
181
- align-items: center;
182
- }
183
-
184
- .waapi-token-wrapper.exit-completed,
185
- .waapi-token-wrapper[data-reorder-state="completed"] {
186
- position: absolute !important;
187
- opacity: 0 !important;
188
- pointer-events: none !important;
189
- }
190
-
191
- /* Token separator - WAAPI handles animations */
192
- .waapi-token-separator {
193
- display: inline !important;
194
- white-space: pre;
195
- margin-left: 0.25em;
196
- will-change: transform, opacity;
197
- }
198
-
199
- .waapi-token-separator.exit-coordinated {
200
- /* Intentionally empty - WAAPI handles animation */
201
- }
202
-
203
- .waapi-token-separator.flip-active {
204
- will-change: transform;
205
- }
206
-
207
- .waapi-token-separator.exit-completed {
208
- opacity: 0;
209
- position: absolute;
210
- pointer-events: none;
211
- width: 0;
212
- overflow: hidden;
213
- }
214
-
215
- /* Token overflow indicator */
216
- .waapi-token-overflow {
217
- display: inline-flex;
218
- align-items: center;
219
- white-space: nowrap;
220
- }
221
-
222
- /* SlidingText container */
223
- .waapi-sliding-text-container {
224
- display: inline-flex;
225
- overflow: visible;
226
- vertical-align: bottom;
227
- will-change: width;
228
- }
229
-
230
- .waapi-sliding-text-content {
231
- display: inline-flex;
232
- white-space: pre;
233
- }
234
-
235
- /* SlidingText token */
236
- .waapi-sliding-text-token {
237
- display: inline-block;
238
- will-change: transform, opacity, filter;
239
- backface-visibility: hidden;
240
- font-weight: 500;
241
- }
242
-
243
- .waapi-sliding-text-token.enter-from {
244
- opacity: 0;
245
- filter: blur(var(--blur-amount, 4px));
246
- }
247
-
248
- .waapi-sliding-text-token.enter-to {
249
- opacity: 1;
250
- transform: translate(0, 0);
251
- filter: blur(0);
252
- }
253
-
254
- .waapi-sliding-text-token.exit-active {
255
- opacity: 0;
256
- filter: blur(var(--blur-amount, 4px));
257
- }
258
-
259
- /* Direction variants */
260
- .waapi-direction-vertical .waapi-sliding-text-token.enter-from {
261
- transform: translateY(var(--offset, 8px));
262
- }
263
-
264
- .waapi-direction-vertical .waapi-sliding-text-token.exit-active {
265
- transform: translateY(calc(var(--offset, 8px) * -1));
266
- }
267
-
268
- .waapi-direction-horizontal .waapi-sliding-text-token.enter-from {
269
- transform: translateX(var(--offset, 16px));
270
- }
271
-
272
- .waapi-direction-horizontal .waapi-sliding-text-token.exit-active {
273
- transform: translateX(calc(var(--offset, 16px) * -1));
274
- }
275
-
276
- /* AnimatedTokens container */
277
- .waapi-animated-tokens-container {
278
- display: flex;
279
- flex-wrap: wrap;
280
- align-items: center;
281
- gap: 0;
282
- }
283
-
284
- .waapi-animated-tokens-container.waapi-animated-tokens-container--inline {
285
- display: inline-flex;
286
- flex-wrap: nowrap;
287
- overflow: hidden;
288
- text-overflow: ellipsis;
289
- white-space: nowrap;
290
- }
291
-
292
- /* Placeholder styling */
293
- .waapi-token-placeholder {
294
- color: var(--muted-foreground, #888) !important;
295
- font-style: italic;
296
- }
297
-
298
- /* Sliding Number Styles */
299
- .waapi-sliding-number {
300
- display: inline-flex;
301
- align-items: center;
302
- font-variant-numeric: tabular-nums;
303
- }
304
-
305
- /* ===========================================
306
- ACCESSIBILITY - Reduced Motion
307
- =========================================== */
308
- @media (prefers-reduced-motion: reduce) {
309
- [data-reorder-state],
310
- [data-separator-state],
311
- .waapi-token-separator,
312
- .waapi-sliding-text-token,
313
- .waapi-token-wrapper {
314
- will-change: auto;
315
- transition: none !important;
316
- animation: none !important;
317
- }
318
- }
319
-
320
- /* ===========================================
321
- ACCESSIBILITY - High Contrast
322
- =========================================== */
323
- @media (prefers-contrast: high) {
324
- .waapi-sliding-text-token.enter-from,
325
- .waapi-sliding-text-token.exit-active {
326
- filter: none;
327
- }
328
- }
329
-
330
- /* ===========================================
331
- MOBILE - Performance Optimization
332
- =========================================== */
333
- @media (max-width: 768px) {
334
- .waapi-token-wrapper,
335
- [data-reorder-state] {
336
- transform: translateZ(0);
337
- backface-visibility: hidden;
338
- perspective: 1000px;
339
- }
340
- }
341
-
342
- /* ===========================================
343
- PRINT - Disable animations, show content
344
- =========================================== */
345
- @media print {
346
- .waapi-animated-tokens-container,
347
- .waapi-sliding-text-container,
348
- .waapi-token-separator,
349
- .waapi-token-wrapper,
350
- [data-reorder-state],
351
- [data-separator-state] {
352
- transition: none !important;
353
- animation: none !important;
354
- transform: none !important;
355
- opacity: 1 !important;
356
- }
357
-
358
- .waapi-token-separator.exit-completed,
359
- .waapi-token-wrapper.exit-completed,
360
- [data-reorder-state="completed"],
361
- [data-separator-state="completed"] {
362
- position: static !important;
363
- opacity: 1 !important;
364
- pointer-events: auto !important;
365
- visibility: visible !important;
366
- width: auto !important;
367
- height: auto !important;
368
- }
369
- }
@@ -1,72 +0,0 @@
1
- /**
2
- * Style slots and CVA variants for the Accordion component.
3
- *
4
- * Defines the visual regions (slots) and variant-based styling
5
- * using Class Variance Authority (CVA).
6
- *
7
- * @module @mks2508/mks-ui/react/ui/Accordion/Accordion.styles
8
- */
9
-
10
- import { cva, type VariantProps } from 'class-variance-authority';
11
-
12
- import type { StyleSlots } from '@/core/types';
13
- import type { AccordionSlot } from './Accordion.types';
14
-
15
- /**
16
- * Default Tailwind classes for each visual region of the Accordion.
17
- *
18
- * @example
19
- * ```typescript
20
- * import { AccordionStyles } from '@mks2508/mks-ui';
21
- *
22
- * // Access individual slot defaults
23
- * console.log(AccordionStyles.root); // base root classes
24
- * console.log(AccordionStyles.trigger); // base trigger classes
25
- * ```
26
- */
27
- export const AccordionStyles: StyleSlots<AccordionSlot> = {
28
- root: 'flex flex-col',
29
- item: 'border-b border-border',
30
- header: 'flex',
31
- trigger:
32
- 'flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-panel-open]>svg]:rotate-180',
33
- panel: 'overflow-hidden text-sm',
34
- };
35
-
36
- /**
37
- * CVA variants for the Accordion root element.
38
- *
39
- * Provides `default` and `bordered` visual variants that control
40
- * the overall appearance of the accordion container.
41
- *
42
- * @example
43
- * ```typescript
44
- * import { accordionVariants } from '@mks2508/mks-ui';
45
- *
46
- * // Get class string for bordered variant
47
- * const classes = accordionVariants({ variant: 'bordered' });
48
- * ```
49
- */
50
- export const accordionVariants = cva(AccordionStyles.root, {
51
- variants: {
52
- /**
53
- * Visual variant of the accordion container.
54
- *
55
- * - `default` - Standard accordion with bottom borders on items.
56
- * - `bordered` - Accordion with a visible outer border and rounded corners.
57
- */
58
- variant: {
59
- default: '',
60
- bordered: 'rounded-lg border border-border',
61
- },
62
- },
63
- defaultVariants: {
64
- variant: 'default',
65
- },
66
- });
67
-
68
- /**
69
- * Variant props extracted from {@link accordionVariants}.
70
- * Use this to type-check the `variant` prop on the Accordion root.
71
- */
72
- export type AccordionVariantProps = VariantProps<typeof accordionVariants>;