@dudousxd/nestjs-catalog-react 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/LICENSE-bklit +21 -0
  2. package/README.md +282 -0
  3. package/dist/AccessConsole.d.ts +40 -0
  4. package/dist/AccessConsole.js +160 -0
  5. package/dist/CatalogManager.d.ts +12 -0
  6. package/dist/CatalogManager.js +123 -0
  7. package/dist/ConnectionPanel.d.ts +41 -0
  8. package/dist/ConnectionPanel.js +228 -0
  9. package/dist/CoverageLedger.d.ts +16 -0
  10. package/dist/CoverageLedger.js +16 -0
  11. package/dist/DashboardBoard.d.ts +10 -0
  12. package/dist/DashboardBoard.js +206 -0
  13. package/dist/EditableField.d.ts +18 -0
  14. package/dist/EditableField.js +61 -0
  15. package/dist/FlowView.d.ts +13 -0
  16. package/dist/FlowView.js +93 -0
  17. package/dist/GovernanceTimeline.d.ts +16 -0
  18. package/dist/GovernanceTimeline.js +93 -0
  19. package/dist/ObjectExplorer.d.ts +9 -0
  20. package/dist/ObjectExplorer.js +153 -0
  21. package/dist/PipelineConsole.d.ts +20 -0
  22. package/dist/PipelineConsole.js +272 -0
  23. package/dist/QueryConsole.d.ts +11 -0
  24. package/dist/QueryConsole.js +144 -0
  25. package/dist/SavedQueryPanel.d.ts +16 -0
  26. package/dist/SavedQueryPanel.js +78 -0
  27. package/dist/TraceExplorer.d.ts +54 -0
  28. package/dist/TraceExplorer.js +342 -0
  29. package/dist/TransformEditor.d.ts +23 -0
  30. package/dist/TransformEditor.js +129 -0
  31. package/dist/WorkflowCanvas.d.ts +24 -0
  32. package/dist/WorkflowCanvas.js +701 -0
  33. package/dist/charts/bklit/animation.d.ts +19 -0
  34. package/dist/charts/bklit/animation.js +28 -0
  35. package/dist/charts/bklit/area-chart-loading.d.ts +33 -0
  36. package/dist/charts/bklit/area-chart-loading.js +30 -0
  37. package/dist/charts/bklit/area-chart.d.ts +47 -0
  38. package/dist/charts/bklit/area-chart.js +65 -0
  39. package/dist/charts/bklit/area-gradient-defs.d.ts +28 -0
  40. package/dist/charts/bklit/area-gradient-defs.js +23 -0
  41. package/dist/charts/bklit/area.d.ts +75 -0
  42. package/dist/charts/bklit/area.js +112 -0
  43. package/dist/charts/bklit/bar-chart-loading.d.ts +16 -0
  44. package/dist/charts/bklit/bar-chart-loading.js +22 -0
  45. package/dist/charts/bklit/bar-chart.d.ts +54 -0
  46. package/dist/charts/bklit/bar-chart.js +440 -0
  47. package/dist/charts/bklit/bar-depth-geometry.d.ts +41 -0
  48. package/dist/charts/bklit/bar-depth-geometry.js +46 -0
  49. package/dist/charts/bklit/bar-squares-layout.d.ts +36 -0
  50. package/dist/charts/bklit/bar-squares-layout.js +46 -0
  51. package/dist/charts/bklit/bar-squares.d.ts +48 -0
  52. package/dist/charts/bklit/bar-squares.js +206 -0
  53. package/dist/charts/bklit/bar-x-axis.d.ts +13 -0
  54. package/dist/charts/bklit/bar-x-axis.js +81 -0
  55. package/dist/charts/bklit/bar-y-axis.d.ts +11 -0
  56. package/dist/charts/bklit/bar-y-axis.js +72 -0
  57. package/dist/charts/bklit/bar.d.ts +40 -0
  58. package/dist/charts/bklit/bar.js +207 -0
  59. package/dist/charts/bklit/chart-child-passthrough.d.ts +25 -0
  60. package/dist/charts/bklit/chart-child-passthrough.js +82 -0
  61. package/dist/charts/bklit/chart-config-context.d.ts +34 -0
  62. package/dist/charts/bklit/chart-config-context.js +55 -0
  63. package/dist/charts/bklit/chart-context.d.ts +207 -0
  64. package/dist/charts/bklit/chart-context.js +200 -0
  65. package/dist/charts/bklit/chart-defs.d.ts +21 -0
  66. package/dist/charts/bklit/chart-defs.js +57 -0
  67. package/dist/charts/bklit/chart-formatters.d.ts +16 -0
  68. package/dist/charts/bklit/chart-formatters.js +26 -0
  69. package/dist/charts/bklit/chart-legend-hover.d.ts +21 -0
  70. package/dist/charts/bklit/chart-legend-hover.js +26 -0
  71. package/dist/charts/bklit/chart-loading-label.d.ts +9 -0
  72. package/dist/charts/bklit/chart-loading-label.js +29 -0
  73. package/dist/charts/bklit/chart-phase.d.ts +39 -0
  74. package/dist/charts/bklit/chart-phase.js +20 -0
  75. package/dist/charts/bklit/chart-reveal-clip.d.ts +32 -0
  76. package/dist/charts/bklit/chart-reveal-clip.js +23 -0
  77. package/dist/charts/bklit/dash-tail-stroke.d.ts +17 -0
  78. package/dist/charts/bklit/dash-tail-stroke.js +21 -0
  79. package/dist/charts/bklit/decimate-time-series.d.ts +18 -0
  80. package/dist/charts/bklit/decimate-time-series.js +120 -0
  81. package/dist/charts/bklit/fade-edges.d.ts +42 -0
  82. package/dist/charts/bklit/fade-edges.js +34 -0
  83. package/dist/charts/bklit/filter-data-by-x-domain.d.ts +13 -0
  84. package/dist/charts/bklit/filter-data-by-x-domain.js +50 -0
  85. package/dist/charts/bklit/generate-chart-skeleton-data.d.ts +24 -0
  86. package/dist/charts/bklit/generate-chart-skeleton-data.js +33 -0
  87. package/dist/charts/bklit/grid.d.ts +57 -0
  88. package/dist/charts/bklit/grid.js +88 -0
  89. package/dist/charts/bklit/highlight-segment-bounds.d.ts +26 -0
  90. package/dist/charts/bklit/highlight-segment-bounds.js +35 -0
  91. package/dist/charts/bklit/highlight-segment.d.ts +30 -0
  92. package/dist/charts/bklit/highlight-segment.js +22 -0
  93. package/dist/charts/bklit/indicator-fade.d.ts +23 -0
  94. package/dist/charts/bklit/indicator-fade.js +41 -0
  95. package/dist/charts/bklit/line-chart-loading.d.ts +33 -0
  96. package/dist/charts/bklit/line-chart-loading.js +30 -0
  97. package/dist/charts/bklit/line-chart.d.ts +45 -0
  98. package/dist/charts/bklit/line-chart.js +99 -0
  99. package/dist/charts/bklit/line-loading-pulse.d.ts +19 -0
  100. package/dist/charts/bklit/line-loading-pulse.js +132 -0
  101. package/dist/charts/bklit/line-loading-timing.d.ts +18 -0
  102. package/dist/charts/bklit/line-loading-timing.js +18 -0
  103. package/dist/charts/bklit/line-series-terminal-marker.d.ts +15 -0
  104. package/dist/charts/bklit/line-series-terminal-marker.js +54 -0
  105. package/dist/charts/bklit/line.d.ts +63 -0
  106. package/dist/charts/bklit/line.js +104 -0
  107. package/dist/charts/bklit/loading-sweep.d.ts +65 -0
  108. package/dist/charts/bklit/loading-sweep.js +182 -0
  109. package/dist/charts/bklit/motion-utils.d.ts +17 -0
  110. package/dist/charts/bklit/motion-utils.js +27 -0
  111. package/dist/charts/bklit/path-stroke-utils.d.ts +28 -0
  112. package/dist/charts/bklit/path-stroke-utils.js +64 -0
  113. package/dist/charts/bklit/pattern-area.d.ts +20 -0
  114. package/dist/charts/bklit/pattern-area.js +27 -0
  115. package/dist/charts/bklit/pattern-preset.d.ts +34 -0
  116. package/dist/charts/bklit/pattern-preset.js +82 -0
  117. package/dist/charts/bklit/projection-config.d.ts +19 -0
  118. package/dist/charts/bklit/projection-config.js +88 -0
  119. package/dist/charts/bklit/projection-line-end-marker.d.ts +14 -0
  120. package/dist/charts/bklit/projection-line-end-marker.js +35 -0
  121. package/dist/charts/bklit/projection-line.d.ts +39 -0
  122. package/dist/charts/bklit/projection-line.js +87 -0
  123. package/dist/charts/bklit/projection-utils.d.ts +54 -0
  124. package/dist/charts/bklit/projection-utils.js +252 -0
  125. package/dist/charts/bklit/reference-area-config.d.ts +18 -0
  126. package/dist/charts/bklit/reference-area-config.js +47 -0
  127. package/dist/charts/bklit/reference-area-registration-context.d.ts +7 -0
  128. package/dist/charts/bklit/reference-area-registration-context.js +15 -0
  129. package/dist/charts/bklit/series-bar-layout.d.ts +26 -0
  130. package/dist/charts/bklit/series-bar-layout.js +39 -0
  131. package/dist/charts/bklit/series-dash-tail-overlay.d.ts +16 -0
  132. package/dist/charts/bklit/series-dash-tail-overlay.js +47 -0
  133. package/dist/charts/bklit/series-highlight-layer.d.ts +31 -0
  134. package/dist/charts/bklit/series-highlight-layer.js +20 -0
  135. package/dist/charts/bklit/series-hover-dim.d.ts +28 -0
  136. package/dist/charts/bklit/series-hover-dim.js +34 -0
  137. package/dist/charts/bklit/series-markers.d.ts +13 -0
  138. package/dist/charts/bklit/series-markers.js +106 -0
  139. package/dist/charts/bklit/series-path-utils.d.ts +18 -0
  140. package/dist/charts/bklit/series-path-utils.js +68 -0
  141. package/dist/charts/bklit/series-point-marker.d.ts +47 -0
  142. package/dist/charts/bklit/series-point-marker.js +47 -0
  143. package/dist/charts/bklit/static-chart-preview-context.d.ts +15 -0
  144. package/dist/charts/bklit/static-chart-preview-context.js +20 -0
  145. package/dist/charts/bklit/time-series-chart-shell.d.ts +46 -0
  146. package/dist/charts/bklit/time-series-chart-shell.js +398 -0
  147. package/dist/charts/bklit/tooltip/chart-tooltip.d.ts +75 -0
  148. package/dist/charts/bklit/tooltip/chart-tooltip.js +158 -0
  149. package/dist/charts/bklit/tooltip/date-ticker.d.ts +10 -0
  150. package/dist/charts/bklit/tooltip/date-ticker.js +85 -0
  151. package/dist/charts/bklit/tooltip/index.d.ts +15 -0
  152. package/dist/charts/bklit/tooltip/index.js +15 -0
  153. package/dist/charts/bklit/tooltip/tooltip-box.d.ts +56 -0
  154. package/dist/charts/bklit/tooltip/tooltip-box.js +122 -0
  155. package/dist/charts/bklit/tooltip/tooltip-content.d.ts +26 -0
  156. package/dist/charts/bklit/tooltip/tooltip-content.js +8 -0
  157. package/dist/charts/bklit/tooltip/tooltip-dot.d.ts +27 -0
  158. package/dist/charts/bklit/tooltip/tooltip-dot.js +62 -0
  159. package/dist/charts/bklit/tooltip/tooltip-indicator.d.ts +44 -0
  160. package/dist/charts/bklit/tooltip/tooltip-indicator.js +73 -0
  161. package/dist/charts/bklit/use-animated-series-path.d.ts +18 -0
  162. package/dist/charts/bklit/use-animated-series-path.js +101 -0
  163. package/dist/charts/bklit/use-animated-y-domains.d.ts +13 -0
  164. package/dist/charts/bklit/use-animated-y-domains.js +158 -0
  165. package/dist/charts/bklit/use-chart-interaction.d.ts +40 -0
  166. package/dist/charts/bklit/use-chart-interaction.js +252 -0
  167. package/dist/charts/bklit/use-chart-phase-orchestrator.d.ts +22 -0
  168. package/dist/charts/bklit/use-chart-phase-orchestrator.js +147 -0
  169. package/dist/charts/bklit/use-enter-complete.d.ts +16 -0
  170. package/dist/charts/bklit/use-enter-complete.js +22 -0
  171. package/dist/charts/bklit/use-grid-shimmer.d.ts +15 -0
  172. package/dist/charts/bklit/use-grid-shimmer.js +71 -0
  173. package/dist/charts/bklit/use-highlight-segment.d.ts +22 -0
  174. package/dist/charts/bklit/use-highlight-segment.js +42 -0
  175. package/dist/charts/bklit/use-mount-progress.d.ts +12 -0
  176. package/dist/charts/bklit/use-mount-progress.js +30 -0
  177. package/dist/charts/bklit/use-scheduled-tooltip.d.ts +8 -0
  178. package/dist/charts/bklit/use-scheduled-tooltip.js +84 -0
  179. package/dist/charts/bklit/visx-pattern.d.ts +27 -0
  180. package/dist/charts/bklit/visx-pattern.js +28 -0
  181. package/dist/charts/bklit/x-axis.d.ts +26 -0
  182. package/dist/charts/bklit/x-axis.js +423 -0
  183. package/dist/charts/bklit/y-axis-scales.d.ts +34 -0
  184. package/dist/charts/bklit/y-axis-scales.js +80 -0
  185. package/dist/charts/bklit/y-axis-ticks.d.ts +20 -0
  186. package/dist/charts/bklit/y-axis-ticks.js +32 -0
  187. package/dist/charts/bklit/y-domain-utils.d.ts +26 -0
  188. package/dist/charts/bklit/y-domain-utils.js +96 -0
  189. package/dist/charts/bklit.d.ts +2 -0
  190. package/dist/charts/bklit.js +90 -0
  191. package/dist/charts/components/shimmering-text.d.ts +31 -0
  192. package/dist/charts/components/shimmering-text.js +39 -0
  193. package/dist/charts/css.d.ts +35 -0
  194. package/dist/charts/css.js +64 -0
  195. package/dist/charts/recharts.d.ts +28 -0
  196. package/dist/charts/recharts.js +48 -0
  197. package/dist/charts/registry.d.ts +34 -0
  198. package/dist/charts/registry.js +60 -0
  199. package/dist/charts/skeleton.d.ts +55 -0
  200. package/dist/charts/skeleton.js +66 -0
  201. package/dist/cn.d.ts +10 -0
  202. package/dist/cn.js +13 -0
  203. package/dist/context.d.ts +346 -0
  204. package/dist/context.js +95 -0
  205. package/dist/index.d.ts +30 -0
  206. package/dist/index.js +65 -0
  207. package/dist/routes.d.ts +70 -0
  208. package/dist/routes.js +73 -0
  209. package/dist/source-fields.d.ts +111 -0
  210. package/dist/source-fields.js +204 -0
  211. package/dist/ui/chart.d.ts +54 -0
  212. package/dist/ui/chart.js +122 -0
  213. package/dist/ui/dialog.d.ts +27 -0
  214. package/dist/ui/dialog.js +24 -0
  215. package/dist/ui/field.d.ts +29 -0
  216. package/dist/ui/field.js +31 -0
  217. package/dist/ui/select.d.ts +42 -0
  218. package/dist/ui/select.js +30 -0
  219. package/dist/ui/sheet.d.ts +38 -0
  220. package/dist/ui/sheet.js +37 -0
  221. package/dist/ui/switch.d.ts +17 -0
  222. package/dist/ui/switch.js +14 -0
  223. package/dist/ui/tabs.d.ts +30 -0
  224. package/dist/ui/tabs.js +36 -0
  225. package/dist/ui/tooltip.d.ts +37 -0
  226. package/dist/ui/tooltip.js +43 -0
  227. package/dist/workflow/graph.d.ts +112 -0
  228. package/dist/workflow/graph.js +297 -0
  229. package/dist/workflow/index.d.ts +16 -0
  230. package/dist/workflow/index.js +16 -0
  231. package/dist/workflow/model.d.ts +151 -0
  232. package/dist/workflow/model.js +97 -0
  233. package/dist/workflow/name.d.ts +28 -0
  234. package/dist/workflow/name.js +28 -0
  235. package/dist/workflow/nodes.d.ts +40 -0
  236. package/dist/workflow/nodes.js +86 -0
  237. package/dist/workflow/validate.d.ts +104 -0
  238. package/dist/workflow/validate.js +199 -0
  239. package/package.json +148 -0
@@ -0,0 +1,13 @@
1
+ import type { ChartPhase } from './chart-phase';
2
+ import { type YDomain } from './y-domain-utils';
3
+ export interface UseAnimatedYDomainsOptions {
4
+ enabled: boolean;
5
+ durationMs: number;
6
+ chartPhase: ChartPhase;
7
+ skeletonByAxis: Record<string, YDomain>;
8
+ targetByAxis: Record<string, YDomain>;
9
+ onSettled?: () => void;
10
+ /** When true, tweens y-domains on target changes while the chart is in the ready phase (e.g. brush zoom). */
11
+ tweenOnTargetChange?: boolean;
12
+ }
13
+ export declare function useAnimatedYDomains({ enabled, durationMs, chartPhase, skeletonByAxis, targetByAxis, onSettled, tweenOnTargetChange, }: UseAnimatedYDomainsOptions): Record<string, YDomain>;
@@ -0,0 +1,158 @@
1
+ 'use client';
2
+ /**
3
+ * Vendored from bklit-ui — https://github.com/bklit/bklit-ui
4
+ * Copyright (c) 2026 uixmat. Released under the MIT licence; the full text is in
5
+ * LICENSE-bklit at the root of this package.
6
+ *
7
+ * Local change: the `@/lib/utils` import was repointed at this package's own
8
+ * `cn`, which is the same function. Nothing else is modified, so re-syncing
9
+ * with upstream stays a diff rather than a merge.
10
+ */
11
+ import { animate, useReducedMotion } from 'motion/react';
12
+ import { useEffect, useRef, useState } from 'react';
13
+ import { LINE_LOADING_PULSE_EASE } from './line-loading-timing';
14
+ import { domainsEqual, isYDomainTweenPhase, resolveAnimatedYDestinationDomains, shouldTweenYDomain, } from './y-domain-utils';
15
+ function lerpDomain(from, to, progress) {
16
+ return [from[0] + (to[0] - from[0]) * progress, from[1] + (to[1] - from[1]) * progress];
17
+ }
18
+ function snapDomains(domains, setAnimatedByAxis, animatedRef) {
19
+ if (domainsEqual(animatedRef.current, domains)) {
20
+ return;
21
+ }
22
+ setAnimatedByAxis(domains);
23
+ animatedRef.current = domains;
24
+ }
25
+ function tweenDomains({ destination, durationMs, enabled, reducedMotion, animatedRef, setAnimatedByAxis, onSettled, }) {
26
+ if (domainsEqual(animatedRef.current, destination)) {
27
+ onSettled?.();
28
+ return;
29
+ }
30
+ if (!enabled || reducedMotion) {
31
+ snapDomains(destination, setAnimatedByAxis, animatedRef);
32
+ onSettled?.();
33
+ return;
34
+ }
35
+ const axisIds = Object.keys(destination);
36
+ const fromSnapshot = animatedRef.current;
37
+ let needsTween = false;
38
+ for (const axisId of axisIds) {
39
+ const from = fromSnapshot[axisId] ?? destination[axisId] ?? [0, 100];
40
+ const to = destination[axisId] ?? from;
41
+ if (shouldTweenYDomain(from, to)) {
42
+ needsTween = true;
43
+ break;
44
+ }
45
+ }
46
+ if (!needsTween) {
47
+ snapDomains(destination, setAnimatedByAxis, animatedRef);
48
+ onSettled?.();
49
+ return;
50
+ }
51
+ const fromByAxis = {};
52
+ for (const axisId of axisIds) {
53
+ fromByAxis[axisId] = fromSnapshot[axisId] ?? destination[axisId] ?? [0, 100];
54
+ }
55
+ const control = animate(0, 1, {
56
+ duration: durationMs / 1000,
57
+ ease: [...LINE_LOADING_PULSE_EASE],
58
+ onUpdate: (progress) => {
59
+ const next = {};
60
+ for (const axisId of axisIds) {
61
+ const from = fromByAxis[axisId] ?? destination[axisId] ?? [0, 100];
62
+ const to = destination[axisId] ?? from;
63
+ next[axisId] = shouldTweenYDomain(from, to) ? lerpDomain(from, to, progress) : to;
64
+ }
65
+ animatedRef.current = next;
66
+ setAnimatedByAxis(next);
67
+ },
68
+ onComplete: () => {
69
+ snapDomains(destination, setAnimatedByAxis, animatedRef);
70
+ onSettled?.();
71
+ },
72
+ });
73
+ return control;
74
+ }
75
+ export function useAnimatedYDomains({ enabled, durationMs, chartPhase, skeletonByAxis, targetByAxis, onSettled, tweenOnTargetChange = false, }) {
76
+ const reducedMotion = useReducedMotion();
77
+ const destinationByAxis = resolveAnimatedYDestinationDomains(chartPhase, skeletonByAxis, targetByAxis);
78
+ const destinationRef = useRef(destinationByAxis);
79
+ destinationRef.current = destinationByAxis;
80
+ const skeletonRef = useRef(skeletonByAxis);
81
+ skeletonRef.current = skeletonByAxis;
82
+ const targetRef = useRef(targetByAxis);
83
+ targetRef.current = targetByAxis;
84
+ const [animatedByAxis, setAnimatedByAxis] = useState(destinationByAxis);
85
+ const animatedRef = useRef(animatedByAxis);
86
+ const prevPhaseRef = useRef(chartPhase);
87
+ const onSettledRef = useRef(onSettled);
88
+ onSettledRef.current = onSettled;
89
+ useEffect(() => {
90
+ animatedRef.current = animatedByAxis;
91
+ }, [animatedByAxis]);
92
+ useEffect(() => {
93
+ if (prevPhaseRef.current === chartPhase) {
94
+ return;
95
+ }
96
+ prevPhaseRef.current = chartPhase;
97
+ const settle = () => {
98
+ onSettledRef.current?.();
99
+ };
100
+ // Keep grid spacing frozen while the series exits the viewport.
101
+ if (chartPhase === 'exiting') {
102
+ snapDomains(skeletonRef.current, setAnimatedByAxis, animatedRef);
103
+ return;
104
+ }
105
+ if (chartPhase === 'exitingReady') {
106
+ snapDomains(targetRef.current, setAnimatedByAxis, animatedRef);
107
+ return;
108
+ }
109
+ if (chartPhase === 'loading') {
110
+ snapDomains(skeletonRef.current, setAnimatedByAxis, animatedRef);
111
+ return;
112
+ }
113
+ if (chartPhase === 'revealing' || chartPhase === 'ready') {
114
+ snapDomains(targetRef.current, setAnimatedByAxis, animatedRef);
115
+ return;
116
+ }
117
+ if (!isYDomainTweenPhase(chartPhase)) {
118
+ return;
119
+ }
120
+ const control = tweenDomains({
121
+ destination: destinationRef.current,
122
+ durationMs,
123
+ enabled,
124
+ reducedMotion,
125
+ animatedRef,
126
+ setAnimatedByAxis,
127
+ onSettled: settle,
128
+ });
129
+ return () => control?.stop();
130
+ }, [chartPhase, durationMs, enabled, reducedMotion]);
131
+ const targetSignature = JSON.stringify(targetByAxis);
132
+ const prevTargetSignatureRef = useRef(targetSignature);
133
+ useEffect(() => {
134
+ const inLivePhase = chartPhase === 'ready' || chartPhase === 'revealing';
135
+ if (!inLivePhase) {
136
+ prevTargetSignatureRef.current = targetSignature;
137
+ return;
138
+ }
139
+ if (prevTargetSignatureRef.current === targetSignature) {
140
+ return;
141
+ }
142
+ prevTargetSignatureRef.current = targetSignature;
143
+ if (tweenOnTargetChange && chartPhase === 'ready') {
144
+ const control = tweenDomains({
145
+ destination: targetRef.current,
146
+ durationMs,
147
+ enabled,
148
+ reducedMotion,
149
+ animatedRef,
150
+ setAnimatedByAxis,
151
+ onSettled: () => onSettledRef.current?.(),
152
+ });
153
+ return () => control?.stop();
154
+ }
155
+ snapDomains(targetRef.current, setAnimatedByAxis, animatedRef);
156
+ }, [chartPhase, durationMs, enabled, reducedMotion, targetSignature, tweenOnTargetChange]);
157
+ return animatedByAxis;
158
+ }
@@ -0,0 +1,40 @@
1
+ import type { scaleLinear, scaleTime } from '@visx/scale';
2
+ import type { LineConfig, Margin, TooltipData } from './chart-context';
3
+ type ScaleTime = ReturnType<typeof scaleTime<number>>;
4
+ type ScaleLinear = ReturnType<typeof scaleLinear<number>>;
5
+ export interface ChartSelection {
6
+ startX: number;
7
+ endX: number;
8
+ startIndex: number;
9
+ endIndex: number;
10
+ active: boolean;
11
+ }
12
+ interface UseChartInteractionParams {
13
+ xScale: ScaleTime;
14
+ yScale: ScaleLinear;
15
+ yScales: Record<string, ScaleLinear>;
16
+ data: Record<string, unknown>[];
17
+ lines: LineConfig[];
18
+ margin: Margin;
19
+ xAccessor: (d: Record<string, unknown>) => Date;
20
+ bisectDate: (data: Record<string, unknown>[], date: Date, lo: number) => number;
21
+ canInteract: boolean;
22
+ }
23
+ interface ChartInteractionResult {
24
+ tooltipData: TooltipData | null;
25
+ setTooltipData: React.Dispatch<React.SetStateAction<TooltipData | null>>;
26
+ selection: ChartSelection | null;
27
+ clearSelection: () => void;
28
+ interactionHandlers: {
29
+ onMouseMove?: (event: React.MouseEvent<SVGGElement>) => void;
30
+ onMouseLeave?: () => void;
31
+ onMouseDown?: (event: React.MouseEvent<SVGGElement>) => void;
32
+ onMouseUp?: () => void;
33
+ onTouchStart?: (event: React.TouchEvent<SVGGElement>) => void;
34
+ onTouchMove?: (event: React.TouchEvent<SVGGElement>) => void;
35
+ onTouchEnd?: () => void;
36
+ };
37
+ interactionStyle: React.CSSProperties;
38
+ }
39
+ export declare function useChartInteraction({ xScale, yScale, yScales, data, lines, margin, xAccessor, bisectDate, canInteract, }: UseChartInteractionParams): ChartInteractionResult;
40
+ export {};
@@ -0,0 +1,252 @@
1
+ 'use client';
2
+ /**
3
+ * Vendored from bklit-ui — https://github.com/bklit/bklit-ui
4
+ * Copyright (c) 2026 uixmat. Released under the MIT licence; the full text is in
5
+ * LICENSE-bklit at the root of this package.
6
+ *
7
+ * Local change: the `@/lib/utils` import was repointed at this package's own
8
+ * `cn`, which is the same function. Nothing else is modified, so re-syncing
9
+ * with upstream stays a diff rather than a merge.
10
+ */
11
+ import { localPoint } from '@visx/event';
12
+ import { useCallback, useEffect, useRef, useState } from 'react';
13
+ import { useScheduledTooltip } from './use-scheduled-tooltip';
14
+ import { normalizeYAxisId } from './y-axis-scales';
15
+ export function useChartInteraction({ xScale, yScale, yScales, data, lines, margin, xAccessor, bisectDate, canInteract, }) {
16
+ const [selection, setSelection] = useState(null);
17
+ const { tooltipData, setTooltipData, scheduleTooltip, clearTooltip, resetTooltipDedupe } = useScheduledTooltip();
18
+ const isDraggingRef = useRef(false);
19
+ const dragStartXRef = useRef(0);
20
+ const lastHoveredXRef = useRef(null);
21
+ const resolveTooltipFromX = useCallback((pixelX) => {
22
+ const x0 = xScale.invert(pixelX);
23
+ const index = bisectDate(data, x0, 1);
24
+ const d0 = data[index - 1];
25
+ const d1 = data[index];
26
+ if (!d0) {
27
+ return null;
28
+ }
29
+ let d = d0;
30
+ let finalIndex = index - 1;
31
+ if (d1) {
32
+ const d0Time = xAccessor(d0).getTime();
33
+ const d1Time = xAccessor(d1).getTime();
34
+ if (x0.getTime() - d0Time > d1Time - x0.getTime()) {
35
+ d = d1;
36
+ finalIndex = index;
37
+ }
38
+ }
39
+ const yPositions = {};
40
+ for (const line of lines) {
41
+ const value = d[line.dataKey];
42
+ if (typeof value === 'number') {
43
+ const axisScale = yScales[normalizeYAxisId(line.yAxisId)] ?? yScale;
44
+ yPositions[line.dataKey] = axisScale(value) ?? 0;
45
+ }
46
+ }
47
+ return {
48
+ point: d,
49
+ index: finalIndex,
50
+ x: xScale(xAccessor(d)) ?? 0,
51
+ yPositions,
52
+ };
53
+ }, [xScale, yScale, yScales, data, lines, xAccessor, bisectDate]);
54
+ const resolveIndexFromX = useCallback((pixelX) => {
55
+ const x0 = xScale.invert(pixelX);
56
+ const index = bisectDate(data, x0, 1);
57
+ const d0 = data[index - 1];
58
+ const d1 = data[index];
59
+ if (!d0) {
60
+ return 0;
61
+ }
62
+ if (d1) {
63
+ const d0Time = xAccessor(d0).getTime();
64
+ const d1Time = xAccessor(d1).getTime();
65
+ if (x0.getTime() - d0Time > d1Time - x0.getTime()) {
66
+ return index;
67
+ }
68
+ }
69
+ return index - 1;
70
+ }, [xScale, data, xAccessor, bisectDate]);
71
+ const getChartX = useCallback((event, touchIndex = 0) => {
72
+ let point = null;
73
+ if ('touches' in event) {
74
+ const touch = event.touches[touchIndex];
75
+ if (!touch) {
76
+ return null;
77
+ }
78
+ const svg = event.currentTarget.ownerSVGElement;
79
+ if (!svg) {
80
+ return null;
81
+ }
82
+ point = localPoint(svg, touch);
83
+ }
84
+ else {
85
+ point = localPoint(event);
86
+ }
87
+ if (!point) {
88
+ return null;
89
+ }
90
+ return point.x - margin.left;
91
+ }, [margin.left]);
92
+ const handleMouseMove = useCallback((event) => {
93
+ const chartX = getChartX(event);
94
+ if (chartX === null) {
95
+ return;
96
+ }
97
+ if (isDraggingRef.current) {
98
+ const startX = Math.min(dragStartXRef.current, chartX);
99
+ const endX = Math.max(dragStartXRef.current, chartX);
100
+ setSelection({
101
+ startX,
102
+ endX,
103
+ startIndex: resolveIndexFromX(startX),
104
+ endIndex: resolveIndexFromX(endX),
105
+ active: true,
106
+ });
107
+ return;
108
+ }
109
+ lastHoveredXRef.current = chartX;
110
+ const tooltip = resolveTooltipFromX(chartX);
111
+ if (tooltip) {
112
+ scheduleTooltip(tooltip);
113
+ }
114
+ }, [getChartX, resolveTooltipFromX, resolveIndexFromX, scheduleTooltip]);
115
+ const handleMouseLeave = useCallback(() => {
116
+ lastHoveredXRef.current = null;
117
+ clearTooltip();
118
+ if (isDraggingRef.current) {
119
+ isDraggingRef.current = false;
120
+ }
121
+ setSelection(null);
122
+ }, [clearTooltip]);
123
+ const handleMouseDown = useCallback((event) => {
124
+ const chartX = getChartX(event);
125
+ if (chartX === null) {
126
+ return;
127
+ }
128
+ isDraggingRef.current = true;
129
+ dragStartXRef.current = chartX;
130
+ clearTooltip();
131
+ setSelection(null);
132
+ }, [getChartX, clearTooltip]);
133
+ const handleMouseUp = useCallback(() => {
134
+ if (isDraggingRef.current) {
135
+ isDraggingRef.current = false;
136
+ }
137
+ setSelection(null);
138
+ }, []);
139
+ const handleTouchStart = useCallback((event) => {
140
+ if (event.touches.length === 1) {
141
+ event.preventDefault();
142
+ const chartX = getChartX(event, 0);
143
+ if (chartX === null) {
144
+ return;
145
+ }
146
+ lastHoveredXRef.current = chartX;
147
+ const tooltip = resolveTooltipFromX(chartX);
148
+ if (tooltip) {
149
+ scheduleTooltip(tooltip);
150
+ }
151
+ }
152
+ else if (event.touches.length === 2) {
153
+ event.preventDefault();
154
+ resetTooltipDedupe();
155
+ clearTooltip();
156
+ const x0 = getChartX(event, 0);
157
+ const x1 = getChartX(event, 1);
158
+ if (x0 === null || x1 === null) {
159
+ return;
160
+ }
161
+ const startX = Math.min(x0, x1);
162
+ const endX = Math.max(x0, x1);
163
+ setSelection({
164
+ startX,
165
+ endX,
166
+ startIndex: resolveIndexFromX(startX),
167
+ endIndex: resolveIndexFromX(endX),
168
+ active: true,
169
+ });
170
+ }
171
+ }, [
172
+ getChartX,
173
+ resolveTooltipFromX,
174
+ resolveIndexFromX,
175
+ scheduleTooltip,
176
+ resetTooltipDedupe,
177
+ clearTooltip,
178
+ ]);
179
+ const handleTouchMove = useCallback((event) => {
180
+ if (event.touches.length === 1) {
181
+ event.preventDefault();
182
+ const chartX = getChartX(event, 0);
183
+ if (chartX === null) {
184
+ return;
185
+ }
186
+ lastHoveredXRef.current = chartX;
187
+ const tooltip = resolveTooltipFromX(chartX);
188
+ if (tooltip) {
189
+ scheduleTooltip(tooltip);
190
+ }
191
+ }
192
+ else if (event.touches.length === 2) {
193
+ event.preventDefault();
194
+ const x0 = getChartX(event, 0);
195
+ const x1 = getChartX(event, 1);
196
+ if (x0 === null || x1 === null) {
197
+ return;
198
+ }
199
+ const startX = Math.min(x0, x1);
200
+ const endX = Math.max(x0, x1);
201
+ setSelection({
202
+ startX,
203
+ endX,
204
+ startIndex: resolveIndexFromX(startX),
205
+ endIndex: resolveIndexFromX(endX),
206
+ active: true,
207
+ });
208
+ }
209
+ }, [getChartX, resolveTooltipFromX, resolveIndexFromX, scheduleTooltip]);
210
+ const handleTouchEnd = useCallback(() => {
211
+ clearTooltip();
212
+ setSelection(null);
213
+ }, [clearTooltip]);
214
+ const clearSelection = useCallback(() => {
215
+ setSelection(null);
216
+ }, []);
217
+ // Re-anchor tooltip/crosshair when x-scale or visible data changes (e.g. brush zoom commit).
218
+ useEffect(() => {
219
+ if (!canInteract || lastHoveredXRef.current === null) {
220
+ return;
221
+ }
222
+ const tooltip = resolveTooltipFromX(lastHoveredXRef.current);
223
+ if (tooltip) {
224
+ scheduleTooltip(tooltip, `${tooltip.index}:${Math.round(tooltip.x)}`);
225
+ return;
226
+ }
227
+ clearTooltip();
228
+ }, [canInteract, clearTooltip, resolveTooltipFromX, scheduleTooltip]);
229
+ const interactionHandlers = canInteract
230
+ ? {
231
+ onMouseMove: handleMouseMove,
232
+ onMouseLeave: handleMouseLeave,
233
+ onMouseDown: handleMouseDown,
234
+ onMouseUp: handleMouseUp,
235
+ onTouchStart: handleTouchStart,
236
+ onTouchMove: handleTouchMove,
237
+ onTouchEnd: handleTouchEnd,
238
+ }
239
+ : {};
240
+ const interactionStyle = {
241
+ cursor: canInteract ? 'crosshair' : 'default',
242
+ touchAction: 'none',
243
+ };
244
+ return {
245
+ tooltipData,
246
+ setTooltipData,
247
+ selection,
248
+ clearSelection,
249
+ interactionHandlers,
250
+ interactionStyle,
251
+ };
252
+ }
@@ -0,0 +1,22 @@
1
+ import { type ChartPhase, type ChartStatus } from './chart-phase';
2
+ export interface UseChartPhaseOrchestratorOptions {
3
+ chartStatus: ChartStatus;
4
+ targetData: Record<string, unknown>[];
5
+ skeletonData: Record<string, unknown>[];
6
+ animationDuration: number;
7
+ yDomainTweenDuration: number;
8
+ /** Signature of motion URL state — replays clip reveal in Studio. */
9
+ revealSignature?: string;
10
+ /** Skip mount/signature enter reveal (static docs previews). */
11
+ skipEnterReveal?: boolean;
12
+ }
13
+ export declare function useChartPhaseOrchestrator({ chartStatus, targetData, skeletonData, animationDuration, yDomainTweenDuration, revealSignature, skipEnterReveal, }: UseChartPhaseOrchestratorOptions): {
14
+ chartPhase: ChartPhase;
15
+ plotData: Record<string, unknown>[];
16
+ revealEpoch: number;
17
+ concealEpoch: number;
18
+ isLoaded: boolean;
19
+ notifyLoadingPulseComplete: () => void;
20
+ notifyRevealConcealComplete: () => void;
21
+ notifyYDomainTweenComplete: () => void;
22
+ };
@@ -0,0 +1,147 @@
1
+ 'use client';
2
+ /**
3
+ * Vendored from bklit-ui — https://github.com/bklit/bklit-ui
4
+ * Copyright (c) 2026 uixmat. Released under the MIT licence; the full text is in
5
+ * LICENSE-bklit at the root of this package.
6
+ *
7
+ * Local change: the `@/lib/utils` import was repointed at this package's own
8
+ * `cn`, which is the same function. Nothing else is modified, so re-syncing
9
+ * with upstream stays a diff rather than a merge.
10
+ */
11
+ import { useCallback, useEffect, useRef, useState } from 'react';
12
+ import { resolveRestingChartPhase } from './chart-phase';
13
+ export function useChartPhaseOrchestrator({ chartStatus, targetData, skeletonData, animationDuration, yDomainTweenDuration, revealSignature = '', skipEnterReveal = false, }) {
14
+ const [chartPhase, setChartPhase] = useState(() => resolveRestingChartPhase(chartStatus));
15
+ const [plotData, setPlotData] = useState(() => chartStatus === 'loading' ? skeletonData : targetData);
16
+ const [revealEpoch, setRevealEpoch] = useState(0);
17
+ const [concealEpoch, setConcealEpoch] = useState(0);
18
+ const [isLoaded, setIsLoaded] = useState(() => chartStatus === 'ready');
19
+ const prevStatusRef = useRef(chartStatus);
20
+ const phaseRef = useRef(chartPhase);
21
+ phaseRef.current = chartPhase;
22
+ // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: status transition branches for animation durations
23
+ useEffect(() => {
24
+ const prevStatus = prevStatusRef.current;
25
+ if (prevStatus === chartStatus) {
26
+ return;
27
+ }
28
+ prevStatusRef.current = chartStatus;
29
+ if (chartStatus === 'ready' && prevStatus === 'loading') {
30
+ setIsLoaded(false);
31
+ if (animationDuration <= 0) {
32
+ if (yDomainTweenDuration <= 0) {
33
+ setPlotData(targetData);
34
+ setChartPhase('revealing');
35
+ }
36
+ else {
37
+ setChartPhase('gridTweenReady');
38
+ }
39
+ }
40
+ else {
41
+ setChartPhase('exiting');
42
+ }
43
+ return;
44
+ }
45
+ if (chartStatus === 'loading' && prevStatus === 'ready') {
46
+ setIsLoaded(false);
47
+ if (animationDuration <= 0) {
48
+ if (yDomainTweenDuration <= 0) {
49
+ setPlotData(skeletonData);
50
+ setChartPhase('loading');
51
+ }
52
+ else {
53
+ setChartPhase('gridTweenLoading');
54
+ }
55
+ }
56
+ else {
57
+ setConcealEpoch((epoch) => epoch + 1);
58
+ setChartPhase('exitingReady');
59
+ }
60
+ }
61
+ }, [animationDuration, chartStatus, skeletonData, targetData, yDomainTweenDuration]);
62
+ // biome-ignore lint/correctness/useExhaustiveDependencies: revealSignature replays enter
63
+ useEffect(() => {
64
+ if (skipEnterReveal) {
65
+ return;
66
+ }
67
+ if (chartStatus !== 'ready') {
68
+ return;
69
+ }
70
+ if (phaseRef.current !== 'ready') {
71
+ return;
72
+ }
73
+ setChartPhase('revealing');
74
+ setIsLoaded(false);
75
+ }, [animationDuration, chartStatus, revealSignature, skipEnterReveal]);
76
+ useEffect(() => {
77
+ switch (chartPhase) {
78
+ case 'loading':
79
+ if (chartStatus === 'loading') {
80
+ setPlotData(skeletonData);
81
+ }
82
+ break;
83
+ case 'exiting':
84
+ setPlotData(skeletonData);
85
+ break;
86
+ case 'exitingReady':
87
+ case 'gridTweenLoading':
88
+ case 'gridTweenReady':
89
+ case 'revealing':
90
+ case 'ready':
91
+ setPlotData(targetData);
92
+ break;
93
+ default:
94
+ break;
95
+ }
96
+ }, [chartPhase, chartStatus, skeletonData, targetData]);
97
+ /** Loading pulse exit finished — tween grid to ready spacing next. */
98
+ const notifyLoadingPulseComplete = useCallback(() => {
99
+ if (phaseRef.current !== 'exiting') {
100
+ return;
101
+ }
102
+ setChartPhase('gridTweenReady');
103
+ }, []);
104
+ /** Ready series conceal finished — tween grid to loading spacing next. */
105
+ const notifyRevealConcealComplete = useCallback(() => {
106
+ if (phaseRef.current !== 'exitingReady') {
107
+ return;
108
+ }
109
+ setChartPhase('gridTweenLoading');
110
+ }, []);
111
+ /** Grid tween finished — enter the next resting phase. */
112
+ const notifyYDomainTweenComplete = useCallback(() => {
113
+ if (phaseRef.current === 'gridTweenLoading') {
114
+ setChartPhase('loading');
115
+ return;
116
+ }
117
+ if (phaseRef.current === 'gridTweenReady') {
118
+ setChartPhase('revealing');
119
+ }
120
+ }, []);
121
+ useEffect(() => {
122
+ if (chartPhase !== 'revealing') {
123
+ return;
124
+ }
125
+ setRevealEpoch((epoch) => epoch + 1);
126
+ if (animationDuration <= 0) {
127
+ setChartPhase('ready');
128
+ setIsLoaded(true);
129
+ return;
130
+ }
131
+ const timer = window.setTimeout(() => {
132
+ setChartPhase('ready');
133
+ setIsLoaded(true);
134
+ }, animationDuration);
135
+ return () => window.clearTimeout(timer);
136
+ }, [animationDuration, chartPhase]);
137
+ return {
138
+ chartPhase,
139
+ plotData,
140
+ revealEpoch,
141
+ concealEpoch,
142
+ isLoaded,
143
+ notifyLoadingPulseComplete,
144
+ notifyRevealConcealComplete,
145
+ notifyYDomainTweenComplete,
146
+ };
147
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Vendored from bklit-ui — https://github.com/bklit/bklit-ui
3
+ * Copyright (c) 2026 uixmat. Released under the MIT licence; the full text is in
4
+ * LICENSE-bklit at the root of this package.
5
+ *
6
+ * Local change: the `@/lib/utils` import was repointed at this package's own
7
+ * `cn`, which is the same function. Nothing else is modified, so re-syncing
8
+ * with upstream stays a diff rather than a merge.
9
+ */
10
+ import type { MotionValue } from 'motion/react';
11
+ /**
12
+ * Returns true once a mount-progress MotionValue reaches 1.
13
+ * Use to swap animated MotionValue-driven props for static values after
14
+ * enter completes — drops per-frame subscriptions during pan/hover.
15
+ */
16
+ export declare function useEnterComplete(mountProgress: MotionValue<number>): boolean;
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+ import { useEffect, useState } from 'react';
3
+ /**
4
+ * Returns true once a mount-progress MotionValue reaches 1.
5
+ * Use to swap animated MotionValue-driven props for static values after
6
+ * enter completes — drops per-frame subscriptions during pan/hover.
7
+ */
8
+ export function useEnterComplete(mountProgress) {
9
+ const [complete, setComplete] = useState(() => mountProgress.get() >= 1);
10
+ useEffect(() => {
11
+ if (mountProgress.get() >= 1) {
12
+ setComplete(true);
13
+ return;
14
+ }
15
+ return mountProgress.on('change', (value) => {
16
+ if (value >= 1) {
17
+ setComplete(true);
18
+ }
19
+ });
20
+ }, [mountProgress]);
21
+ return complete;
22
+ }
@@ -0,0 +1,15 @@
1
+ export interface UseGridShimmerOptions {
2
+ innerWidth: number;
3
+ shimmer: boolean;
4
+ shimmerLength: number;
5
+ shimmerSpeed: number;
6
+ shimmerSync: boolean;
7
+ /** When false, shimmer animation is paused (e.g. during exit transition). */
8
+ active: boolean;
9
+ /** Run a single synced sweep (loading → ready handoff). */
10
+ oneShot?: boolean;
11
+ }
12
+ export declare function useGridShimmer({ innerWidth, shimmer, shimmerLength, shimmerSpeed, shimmerSync, active, oneShot, }: UseGridShimmerOptions): {
13
+ shimmerEnabled: boolean;
14
+ shimmerTransform: import("motion/react").MotionValue<string>;
15
+ };