@mks2508/mks-ui 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/react-ui/hooks/Animation/UseAutoHeight.js +7 -7
  2. package/dist/react-ui/hooks/DOM/UseIsInView.js +3 -3
  3. package/dist/react-ui/hooks/Formatting/UseListFormat.d.ts +49 -0
  4. package/dist/react-ui/hooks/Formatting/UseListFormat.d.ts.map +1 -0
  5. package/dist/react-ui/hooks/Formatting/UseListFormat.js +105 -0
  6. package/dist/react-ui/hooks/State/UseControlledState.js +4 -4
  7. package/dist/react-ui/hooks/State/UseDataState.js +5 -5
  8. package/dist/react-ui/hooks/index.d.ts +2 -0
  9. package/dist/react-ui/hooks/index.d.ts.map +1 -1
  10. package/dist/react-ui/hooks/index.js +1 -0
  11. package/dist/react-ui/index.js +22 -2
  12. package/dist/react-ui/lib/get-strict-context.js +3 -3
  13. package/dist/react-ui/primitives/CountingNumber/index.js +3 -3
  14. package/dist/react-ui/primitives/Highlight/index.js +26 -26
  15. package/dist/react-ui/primitives/Slot/index.js +3 -3
  16. package/dist/react-ui/primitives/index.d.ts +1 -0
  17. package/dist/react-ui/primitives/index.d.ts.map +1 -1
  18. package/dist/react-ui/primitives/index.js +18 -0
  19. package/dist/react-ui/primitives/waapi/Morph/Morph.types.d.ts +76 -0
  20. package/dist/react-ui/primitives/waapi/Morph/Morph.types.d.ts.map +1 -0
  21. package/dist/react-ui/primitives/waapi/Morph/MorphContext.d.ts +11 -0
  22. package/dist/react-ui/primitives/waapi/Morph/MorphContext.d.ts.map +1 -0
  23. package/dist/react-ui/primitives/waapi/Morph/MorphContext.js +19 -0
  24. package/dist/react-ui/primitives/waapi/Morph/index.d.ts +23 -0
  25. package/dist/react-ui/primitives/waapi/Morph/index.d.ts.map +1 -0
  26. package/dist/react-ui/primitives/waapi/Morph/index.js +45 -0
  27. package/dist/react-ui/primitives/waapi/Morph/techniques/index.d.ts +12 -0
  28. package/dist/react-ui/primitives/waapi/Morph/techniques/index.d.ts.map +1 -0
  29. package/dist/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.d.ts +38 -0
  30. package/dist/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.d.ts.map +1 -0
  31. package/dist/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.js +78 -0
  32. package/dist/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.d.ts +23 -0
  33. package/dist/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.d.ts.map +1 -0
  34. package/dist/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.js +140 -0
  35. package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.d.ts +28 -0
  36. package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.d.ts.map +1 -0
  37. package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.js +77 -0
  38. package/dist/react-ui/primitives/waapi/Morph/useMorph.d.ts +27 -0
  39. package/dist/react-ui/primitives/waapi/Morph/useMorph.d.ts.map +1 -0
  40. package/dist/react-ui/primitives/waapi/Morph/useMorph.js +86 -0
  41. package/dist/react-ui/primitives/waapi/Reorder/Reorder.types.d.ts +168 -0
  42. package/dist/react-ui/primitives/waapi/Reorder/Reorder.types.d.ts.map +1 -0
  43. package/dist/react-ui/primitives/waapi/Reorder/index.d.ts +25 -0
  44. package/dist/react-ui/primitives/waapi/Reorder/index.d.ts.map +1 -0
  45. package/dist/react-ui/primitives/waapi/Reorder/index.js +186 -0
  46. package/dist/react-ui/primitives/waapi/Reorder/useReorder.d.ts +26 -0
  47. package/dist/react-ui/primitives/waapi/Reorder/useReorder.d.ts.map +1 -0
  48. package/dist/react-ui/primitives/waapi/Reorder/useReorder.js +48 -0
  49. package/dist/react-ui/primitives/waapi/Reorder/useReorderPresence.d.ts +33 -0
  50. package/dist/react-ui/primitives/waapi/Reorder/useReorderPresence.d.ts.map +1 -0
  51. package/dist/react-ui/primitives/waapi/Reorder/useReorderPresence.js +137 -0
  52. package/dist/react-ui/primitives/waapi/Reorder/utils/separatorCoordination.d.ts +47 -0
  53. package/dist/react-ui/primitives/waapi/Reorder/utils/separatorCoordination.d.ts.map +1 -0
  54. package/dist/react-ui/primitives/waapi/Reorder/utils/separatorCoordination.js +72 -0
  55. package/dist/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.d.ts +10 -0
  56. package/dist/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.d.ts.map +1 -0
  57. package/dist/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.types.d.ts +74 -0
  58. package/dist/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.types.d.ts.map +1 -0
  59. package/dist/react-ui/primitives/waapi/SlidingNumber/index.d.ts +33 -0
  60. package/dist/react-ui/primitives/waapi/SlidingNumber/index.d.ts.map +1 -0
  61. package/dist/react-ui/primitives/waapi/SlidingNumber/index.js +354 -0
  62. package/dist/react-ui/primitives/waapi/SlidingText/SlidingText.styles.d.ts +25 -0
  63. package/dist/react-ui/primitives/waapi/SlidingText/SlidingText.styles.d.ts.map +1 -0
  64. package/dist/react-ui/primitives/waapi/SlidingText/SlidingText.types.d.ts +57 -0
  65. package/dist/react-ui/primitives/waapi/SlidingText/SlidingText.types.d.ts.map +1 -0
  66. package/dist/react-ui/primitives/waapi/SlidingText/index.d.ts +26 -0
  67. package/dist/react-ui/primitives/waapi/SlidingText/index.d.ts.map +1 -0
  68. package/dist/react-ui/primitives/waapi/SlidingText/index.js +105 -0
  69. package/dist/react-ui/primitives/waapi/core/animationConstants.d.ts +156 -0
  70. package/dist/react-ui/primitives/waapi/core/animationConstants.d.ts.map +1 -0
  71. package/dist/react-ui/primitives/waapi/core/animationConstants.js +180 -0
  72. package/dist/react-ui/primitives/waapi/core/index.d.ts +16 -0
  73. package/dist/react-ui/primitives/waapi/core/index.d.ts.map +1 -0
  74. package/dist/react-ui/primitives/waapi/core/index.js +5 -0
  75. package/dist/react-ui/primitives/waapi/core/types.d.ts +143 -0
  76. package/dist/react-ui/primitives/waapi/core/types.d.ts.map +1 -0
  77. package/dist/react-ui/primitives/waapi/core/useAnimationOrchestrator.d.ts +32 -0
  78. package/dist/react-ui/primitives/waapi/core/useAnimationOrchestrator.d.ts.map +1 -0
  79. package/dist/react-ui/primitives/waapi/core/useAnimationOrchestrator.js +322 -0
  80. package/dist/react-ui/primitives/waapi/core/useElementRegistry.d.ts +21 -0
  81. package/dist/react-ui/primitives/waapi/core/useElementRegistry.d.ts.map +1 -0
  82. package/dist/react-ui/primitives/waapi/core/useElementRegistry.js +65 -0
  83. package/dist/react-ui/primitives/waapi/core/useFLIPAnimation.d.ts +20 -0
  84. package/dist/react-ui/primitives/waapi/core/useFLIPAnimation.d.ts.map +1 -0
  85. package/dist/react-ui/primitives/waapi/core/useFLIPAnimation.js +99 -0
  86. package/dist/react-ui/primitives/waapi/core/usePositionCapture.d.ts +24 -0
  87. package/dist/react-ui/primitives/waapi/core/usePositionCapture.d.ts.map +1 -0
  88. package/dist/react-ui/primitives/waapi/core/usePositionCapture.js +75 -0
  89. package/dist/react-ui/primitives/waapi/index.d.ts +33 -0
  90. package/dist/react-ui/primitives/waapi/index.d.ts.map +1 -0
  91. package/dist/react-ui/primitives/waapi/index.js +18 -0
  92. package/dist/react-ui/ui/Accordion/index.js +3 -3
  93. package/dist/react-ui/ui/Button/index.js +8 -8
  94. package/dist/react-ui/ui/Combobox/index.js +2 -2
  95. package/dist/react-ui/ui/DataCard/DataCard.styles.d.ts +35 -0
  96. package/dist/react-ui/ui/DataCard/DataCard.styles.d.ts.map +1 -0
  97. package/dist/react-ui/ui/DataCard/DataCard.styles.js +114 -0
  98. package/dist/react-ui/ui/DataCard/DataCard.types.d.ts +135 -0
  99. package/dist/react-ui/ui/DataCard/DataCard.types.d.ts.map +1 -0
  100. package/dist/react-ui/ui/DataCard/index.d.ts +129 -0
  101. package/dist/react-ui/ui/DataCard/index.d.ts.map +1 -0
  102. package/dist/react-ui/ui/DataCard/index.js +276 -0
  103. package/dist/react-ui/ui/Menu/index.js +2 -2
  104. package/dist/react-ui/ui/Switch/index.js +3 -3
  105. package/dist/react-ui/ui/Tabs/index.js +3 -3
  106. package/dist/react-ui/ui/TextFlow/TextFlow.styles.d.ts +16 -0
  107. package/dist/react-ui/ui/TextFlow/TextFlow.styles.d.ts.map +1 -0
  108. package/dist/react-ui/ui/TextFlow/TextFlow.types.d.ts +101 -0
  109. package/dist/react-ui/ui/TextFlow/TextFlow.types.d.ts.map +1 -0
  110. package/dist/react-ui/ui/TextFlow/index.d.ts +26 -0
  111. package/dist/react-ui/ui/TextFlow/index.d.ts.map +1 -0
  112. package/dist/react-ui/ui/TextFlow/index.js +187 -0
  113. package/dist/react-ui/ui/index.d.ts +2 -1
  114. package/dist/react-ui/ui/index.d.ts.map +1 -1
  115. package/dist/react-ui/ui/index.js +3 -1
  116. package/package.json +6 -2
  117. package/src/react-ui/hooks/Formatting/UseListFormat.ts +134 -0
  118. package/src/react-ui/hooks/index.ts +3 -0
  119. package/src/react-ui/primitives/index.ts +3 -0
  120. package/src/react-ui/primitives/waapi/Morph/Morph.types.ts +106 -0
  121. package/src/react-ui/primitives/waapi/Morph/MorphContext.tsx +21 -0
  122. package/src/react-ui/primitives/waapi/Morph/index.tsx +56 -0
  123. package/src/react-ui/primitives/waapi/Morph/techniques/index.ts +12 -0
  124. package/src/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.ts +88 -0
  125. package/src/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.ts +175 -0
  126. package/src/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.ts +86 -0
  127. package/src/react-ui/primitives/waapi/Morph/useMorph.ts +100 -0
  128. package/src/react-ui/primitives/waapi/Reorder/Reorder.types.ts +177 -0
  129. package/src/react-ui/primitives/waapi/Reorder/index.tsx +260 -0
  130. package/src/react-ui/primitives/waapi/Reorder/useReorder.ts +46 -0
  131. package/src/react-ui/primitives/waapi/Reorder/useReorderPresence.ts +208 -0
  132. package/src/react-ui/primitives/waapi/Reorder/utils/separatorCoordination.ts +104 -0
  133. package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.ts +14 -0
  134. package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.types.ts +84 -0
  135. package/src/react-ui/primitives/waapi/SlidingNumber/index.tsx +474 -0
  136. package/src/react-ui/primitives/waapi/SlidingText/SlidingText.styles.ts +32 -0
  137. package/src/react-ui/primitives/waapi/SlidingText/SlidingText.types.ts +69 -0
  138. package/src/react-ui/primitives/waapi/SlidingText/index.tsx +140 -0
  139. package/src/react-ui/primitives/waapi/core/animationConstants.ts +215 -0
  140. package/src/react-ui/primitives/waapi/core/index.ts +53 -0
  141. package/src/react-ui/primitives/waapi/core/types.ts +200 -0
  142. package/src/react-ui/primitives/waapi/core/useAnimationOrchestrator.ts +429 -0
  143. package/src/react-ui/primitives/waapi/core/useElementRegistry.ts +80 -0
  144. package/src/react-ui/primitives/waapi/core/useFLIPAnimation.ts +137 -0
  145. package/src/react-ui/primitives/waapi/core/usePositionCapture.ts +105 -0
  146. package/src/react-ui/primitives/waapi/index.ts +116 -0
  147. package/src/react-ui/styles/animations.css +369 -0
  148. package/src/react-ui/ui/DataCard/DataCard.styles.ts +150 -0
  149. package/src/react-ui/ui/DataCard/DataCard.types.ts +146 -0
  150. package/src/react-ui/ui/DataCard/index.tsx +406 -0
  151. package/src/react-ui/ui/TextFlow/TextFlow.styles.ts +36 -0
  152. package/src/react-ui/ui/TextFlow/TextFlow.types.ts +118 -0
  153. package/src/react-ui/ui/TextFlow/index.tsx +276 -0
  154. package/src/react-ui/ui/index.ts +4 -1
  155. /package/dist/react-ui/components/MorphingPopover/{morphing-popover.module-CgbYV_HS.css → morphing-popover.module-BycNI8nU.css} +0 -0
@@ -0,0 +1,105 @@
1
+ import { useRef, useCallback } from 'react';
2
+ import { TIMING } from './animationConstants';
3
+ import type { IPositionCaptureAPI, IFLIPDelta, IPositionCaptureOptions } from './types';
4
+
5
+ const DEFAULT_MIN_DELTA_PX = TIMING.MIN_DELTA_PX;
6
+
7
+ /**
8
+ * Hook for capturing element positions and calculating FLIP deltas.
9
+ * Extracted from the WAAPI animation system's position capture logic.
10
+ *
11
+ * @param getElements - Function that returns the current element map
12
+ * @param options - Optional configuration (e.g. minimum delta threshold)
13
+ * @returns Position capture API with capture, delta calculation, and cache
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * const registry = useElementRegistry();
18
+ * const positions = usePositionCapture(registry.getAll);
19
+ *
20
+ * // Before layout change:
21
+ * const before = positions.capture();
22
+ *
23
+ * // After layout change:
24
+ * const after = positions.capture();
25
+ * const deltas = positions.calculateDeltas(before, after);
26
+ * ```
27
+ */
28
+ export function usePositionCapture(
29
+ getElements: () => Map<string, HTMLElement>,
30
+ options?: IPositionCaptureOptions
31
+ ): IPositionCaptureAPI {
32
+ const lastCaptureRef = useRef<Map<string, DOMRect>>(new Map());
33
+ const minDeltaPx = options?.minDeltaPx ?? DEFAULT_MIN_DELTA_PX;
34
+
35
+ const capture = useCallback((excludeIds?: Set<string>): Map<string, DOMRect> => {
36
+ const positions = new Map<string, DOMRect>();
37
+ const elements = getElements();
38
+
39
+ elements.forEach((el, id) => {
40
+ if (excludeIds?.has(id)) return;
41
+
42
+ const rect = el.getBoundingClientRect();
43
+ if (rect.width > 0 && rect.height > 0) {
44
+ positions.set(id, rect);
45
+ }
46
+ });
47
+
48
+ lastCaptureRef.current = positions;
49
+ return positions;
50
+ }, [getElements]);
51
+
52
+ const getPosition = useCallback((id: string): DOMRect | undefined => {
53
+ return lastCaptureRef.current.get(id);
54
+ }, []);
55
+
56
+ const calculateDeltas = useCallback((
57
+ before: Map<string, DOMRect>,
58
+ after: Map<string, DOMRect>
59
+ ): Map<string, IFLIPDelta> => {
60
+ const deltas = new Map<string, IFLIPDelta>();
61
+
62
+ after.forEach((newRect, id) => {
63
+ const prevRect = before.get(id);
64
+ if (!prevRect) return;
65
+
66
+ const deltaX = prevRect.left - newRect.left;
67
+ const deltaY = prevRect.top - newRect.top;
68
+ const deltaWidth = prevRect.width - newRect.width;
69
+ const deltaHeight = prevRect.height - newRect.height;
70
+
71
+ const isSignificant =
72
+ Math.abs(deltaX) >= minDeltaPx ||
73
+ Math.abs(deltaY) >= minDeltaPx ||
74
+ Math.abs(deltaWidth) >= minDeltaPx ||
75
+ Math.abs(deltaHeight) >= minDeltaPx;
76
+
77
+ deltas.set(id, {
78
+ id,
79
+ deltaX,
80
+ deltaY,
81
+ deltaWidth,
82
+ deltaHeight,
83
+ isSignificant
84
+ });
85
+ });
86
+
87
+ return deltas;
88
+ }, [minDeltaPx]);
89
+
90
+ const getLastCapture = useCallback((): Map<string, DOMRect> => {
91
+ return new Map(lastCaptureRef.current);
92
+ }, []);
93
+
94
+ const clear = useCallback(() => {
95
+ lastCaptureRef.current.clear();
96
+ }, []);
97
+
98
+ return {
99
+ capture,
100
+ getPosition,
101
+ calculateDeltas,
102
+ getLastCapture,
103
+ clear
104
+ };
105
+ }
@@ -0,0 +1,116 @@
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';
@@ -0,0 +1,369 @@
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
+ }