@gemx-dev/heatmap-react 0.0.5 → 3.5.6

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 (145) hide show
  1. package/package.json +4 -5
  2. package/dist/base.css +0 -622
  3. package/dist/esm/components/ContentHeader.d.ts +0 -4
  4. package/dist/esm/components/ContentHeader.d.ts.map +0 -1
  5. package/dist/esm/components/DomPanel.d.ts +0 -2
  6. package/dist/esm/components/DomPanel.d.ts.map +0 -1
  7. package/dist/esm/components/GraphView.d.ts +0 -9
  8. package/dist/esm/components/GraphView.d.ts.map +0 -1
  9. package/dist/esm/components/HeatmapGraphView.d.ts +0 -9
  10. package/dist/esm/components/HeatmapGraphView.d.ts.map +0 -1
  11. package/dist/esm/components/HeatmapLayout/ContentHeader.d.ts +0 -4
  12. package/dist/esm/components/HeatmapLayout/ContentHeader.d.ts.map +0 -1
  13. package/dist/esm/components/HeatmapLayout/HeatmapLayout.d.ts +0 -7
  14. package/dist/esm/components/HeatmapLayout/HeatmapLayout.d.ts.map +0 -1
  15. package/dist/esm/components/HeatmapLayout/LeftSidebar.d.ts +0 -4
  16. package/dist/esm/components/HeatmapLayout/LeftSidebar.d.ts.map +0 -1
  17. package/dist/esm/components/HeatmapLayout/ReplayControls.d.ts +0 -2
  18. package/dist/esm/components/HeatmapLayout/ReplayControls.d.ts.map +0 -1
  19. package/dist/esm/components/HeatmapLayout/VizDomContainer.d.ts +0 -2
  20. package/dist/esm/components/HeatmapLayout/VizDomContainer.d.ts.map +0 -1
  21. package/dist/esm/components/HeatmapLayout/VizDomRenderer.d.ts +0 -6
  22. package/dist/esm/components/HeatmapLayout/VizDomRenderer.d.ts.map +0 -1
  23. package/dist/esm/components/HeatmapLayout/WrapperLayout.d.ts +0 -7
  24. package/dist/esm/components/HeatmapLayout/WrapperLayout.d.ts.map +0 -1
  25. package/dist/esm/components/HeatmapLayout/WrapperPreview.d.ts +0 -4
  26. package/dist/esm/components/HeatmapLayout/WrapperPreview.d.ts.map +0 -1
  27. package/dist/esm/components/HeatmapLayout/index.d.ts +0 -2
  28. package/dist/esm/components/HeatmapLayout/index.d.ts.map +0 -1
  29. package/dist/esm/components/HeatmapLayout.d.ts +0 -7
  30. package/dist/esm/components/HeatmapLayout.d.ts.map +0 -1
  31. package/dist/esm/components/LeftSidebar.d.ts +0 -4
  32. package/dist/esm/components/LeftSidebar.d.ts.map +0 -1
  33. package/dist/esm/components/Test.d.ts +0 -121
  34. package/dist/esm/components/Test.d.ts.map +0 -1
  35. package/dist/esm/components/VisualizeDom.d.ts +0 -2
  36. package/dist/esm/components/VisualizeDom.d.ts.map +0 -1
  37. package/dist/esm/components/VizDomContainer.d.ts +0 -2
  38. package/dist/esm/components/VizDomContainer.d.ts.map +0 -1
  39. package/dist/esm/components/VizDomRenderer.d.ts +0 -2
  40. package/dist/esm/components/VizDomRenderer.d.ts.map +0 -1
  41. package/dist/esm/components/WrapperLayout.d.ts +0 -7
  42. package/dist/esm/components/WrapperLayout.d.ts.map +0 -1
  43. package/dist/esm/components/WrapperPreview.d.ts +0 -4
  44. package/dist/esm/components/WrapperPreview.d.ts.map +0 -1
  45. package/dist/esm/components/index.d.ts +0 -4
  46. package/dist/esm/components/index.d.ts.map +0 -1
  47. package/dist/esm/configs/index.d.ts +0 -9
  48. package/dist/esm/configs/index.d.ts.map +0 -1
  49. package/dist/esm/contexts/HeatmapProvider.d.ts +0 -18
  50. package/dist/esm/contexts/HeatmapProvider.d.ts.map +0 -1
  51. package/dist/esm/hooks/index.d.ts +0 -2
  52. package/dist/esm/hooks/index.d.ts.map +0 -1
  53. package/dist/esm/hooks/useHeatmapByMode.d.ts +0 -6
  54. package/dist/esm/hooks/useHeatmapByMode.d.ts.map +0 -1
  55. package/dist/esm/hooks/useHeatmapRender.d.ts +0 -6
  56. package/dist/esm/hooks/useHeatmapRender.d.ts.map +0 -1
  57. package/dist/esm/hooks/useHeatmapScale.d.ts +0 -28
  58. package/dist/esm/hooks/useHeatmapScale.d.ts.map +0 -1
  59. package/dist/esm/hooks/useReplayRender.d.ts +0 -9
  60. package/dist/esm/hooks/useReplayRender.d.ts.map +0 -1
  61. package/dist/esm/index.d.ts +0 -4
  62. package/dist/esm/index.d.ts.map +0 -1
  63. package/dist/esm/index.js +0 -1072
  64. package/dist/esm/index.mjs +0 -1072
  65. package/dist/esm/stores/data.d.ts +0 -21
  66. package/dist/esm/stores/data.d.ts.map +0 -1
  67. package/dist/esm/stores/index.d.ts +0 -2
  68. package/dist/esm/stores/index.d.ts.map +0 -1
  69. package/dist/esm/types/clarity.types.d.ts +0 -36
  70. package/dist/esm/types/clarity.types.d.ts.map +0 -1
  71. package/dist/esm/types/index.d.ts +0 -3
  72. package/dist/esm/types/index.d.ts.map +0 -1
  73. package/dist/esm/ui/BoxStack/BoxStack.d.ts +0 -56
  74. package/dist/esm/ui/BoxStack/BoxStack.d.ts.map +0 -1
  75. package/dist/esm/ui/BoxStack/index.d.ts +0 -2
  76. package/dist/esm/ui/BoxStack/index.d.ts.map +0 -1
  77. package/dist/esm/ui/index.d.ts +0 -2
  78. package/dist/esm/ui/index.d.ts.map +0 -1
  79. package/dist/esm/utils/device.d.ts +0 -2
  80. package/dist/esm/utils/device.d.ts.map +0 -1
  81. package/dist/esm/utils/retry.d.ts +0 -2
  82. package/dist/esm/utils/retry.d.ts.map +0 -1
  83. package/dist/esm/utils/sort.d.ts +0 -3
  84. package/dist/esm/utils/sort.d.ts.map +0 -1
  85. package/dist/umd/components/GraphView.d.ts +0 -9
  86. package/dist/umd/components/GraphView.d.ts.map +0 -1
  87. package/dist/umd/components/HeatmapGraphView.d.ts +0 -9
  88. package/dist/umd/components/HeatmapGraphView.d.ts.map +0 -1
  89. package/dist/umd/components/HeatmapLayout/ContentHeader.d.ts +0 -4
  90. package/dist/umd/components/HeatmapLayout/ContentHeader.d.ts.map +0 -1
  91. package/dist/umd/components/HeatmapLayout/HeatmapLayout.d.ts +0 -7
  92. package/dist/umd/components/HeatmapLayout/HeatmapLayout.d.ts.map +0 -1
  93. package/dist/umd/components/HeatmapLayout/LeftSidebar.d.ts +0 -4
  94. package/dist/umd/components/HeatmapLayout/LeftSidebar.d.ts.map +0 -1
  95. package/dist/umd/components/HeatmapLayout/ReplayControls.d.ts +0 -2
  96. package/dist/umd/components/HeatmapLayout/ReplayControls.d.ts.map +0 -1
  97. package/dist/umd/components/HeatmapLayout/VizDomContainer.d.ts +0 -2
  98. package/dist/umd/components/HeatmapLayout/VizDomContainer.d.ts.map +0 -1
  99. package/dist/umd/components/HeatmapLayout/VizDomRenderer.d.ts +0 -6
  100. package/dist/umd/components/HeatmapLayout/VizDomRenderer.d.ts.map +0 -1
  101. package/dist/umd/components/HeatmapLayout/WrapperLayout.d.ts +0 -7
  102. package/dist/umd/components/HeatmapLayout/WrapperLayout.d.ts.map +0 -1
  103. package/dist/umd/components/HeatmapLayout/WrapperPreview.d.ts +0 -4
  104. package/dist/umd/components/HeatmapLayout/WrapperPreview.d.ts.map +0 -1
  105. package/dist/umd/components/HeatmapLayout/index.d.ts +0 -2
  106. package/dist/umd/components/HeatmapLayout/index.d.ts.map +0 -1
  107. package/dist/umd/components/Test.d.ts +0 -121
  108. package/dist/umd/components/Test.d.ts.map +0 -1
  109. package/dist/umd/components/index.d.ts +0 -4
  110. package/dist/umd/components/index.d.ts.map +0 -1
  111. package/dist/umd/configs/index.d.ts +0 -9
  112. package/dist/umd/configs/index.d.ts.map +0 -1
  113. package/dist/umd/contexts/HeatmapProvider.d.ts +0 -18
  114. package/dist/umd/contexts/HeatmapProvider.d.ts.map +0 -1
  115. package/dist/umd/hooks/index.d.ts +0 -2
  116. package/dist/umd/hooks/index.d.ts.map +0 -1
  117. package/dist/umd/hooks/useHeatmapByMode.d.ts +0 -6
  118. package/dist/umd/hooks/useHeatmapByMode.d.ts.map +0 -1
  119. package/dist/umd/hooks/useHeatmapRender.d.ts +0 -6
  120. package/dist/umd/hooks/useHeatmapRender.d.ts.map +0 -1
  121. package/dist/umd/hooks/useHeatmapScale.d.ts +0 -28
  122. package/dist/umd/hooks/useHeatmapScale.d.ts.map +0 -1
  123. package/dist/umd/hooks/useReplayRender.d.ts +0 -9
  124. package/dist/umd/hooks/useReplayRender.d.ts.map +0 -1
  125. package/dist/umd/index.d.ts +0 -4
  126. package/dist/umd/index.d.ts.map +0 -1
  127. package/dist/umd/index.js +0 -10
  128. package/dist/umd/stores/data.d.ts +0 -21
  129. package/dist/umd/stores/data.d.ts.map +0 -1
  130. package/dist/umd/stores/index.d.ts +0 -2
  131. package/dist/umd/stores/index.d.ts.map +0 -1
  132. package/dist/umd/types/index.d.ts +0 -3
  133. package/dist/umd/types/index.d.ts.map +0 -1
  134. package/dist/umd/ui/BoxStack/BoxStack.d.ts +0 -56
  135. package/dist/umd/ui/BoxStack/BoxStack.d.ts.map +0 -1
  136. package/dist/umd/ui/BoxStack/index.d.ts +0 -2
  137. package/dist/umd/ui/BoxStack/index.d.ts.map +0 -1
  138. package/dist/umd/ui/index.d.ts +0 -2
  139. package/dist/umd/ui/index.d.ts.map +0 -1
  140. package/dist/umd/utils/device.d.ts +0 -2
  141. package/dist/umd/utils/device.d.ts.map +0 -1
  142. package/dist/umd/utils/retry.d.ts +0 -2
  143. package/dist/umd/utils/retry.d.ts.map +0 -1
  144. package/dist/umd/utils/sort.d.ts +0 -3
  145. package/dist/umd/utils/sort.d.ts.map +0 -1
@@ -1,1072 +0,0 @@
1
- "use client"
2
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
- import { useNodesState, ReactFlow, Controls, Background } from '@xyflow/react';
4
- import require$$0, { useEffect, useMemo, useRef, useCallback, useState } from 'react';
5
- import { Visualizer } from '@gemx-dev/clarity-visualize';
6
-
7
- const initialNodes = { id: '1', position: { x: 0, y: 0 }, data: { label: '1' } };
8
- const GraphView = ({ children, width, height }) => {
9
- const [nodes, setNodes, onNodesChange] = useNodesState([
10
- {
11
- ...initialNodes,
12
- width: width,
13
- height: height,
14
- },
15
- ]);
16
- const CustomNode = () => {
17
- return jsx(Fragment, { children: children });
18
- };
19
- const nodeTypes = {
20
- default: CustomNode,
21
- };
22
- useEffect(() => {
23
- if (!width)
24
- return;
25
- setNodes((prev) => {
26
- const node = prev.find((node) => node.id === '1');
27
- const newNode = {
28
- ...node,
29
- measured: { height: height, width: width },
30
- height: height,
31
- width: width,
32
- };
33
- return [newNode];
34
- });
35
- }, [width, height, setNodes]);
36
- return (jsxs(ReactFlow, { nodes: nodes, nodeTypes: nodeTypes, onNodesChange: onNodesChange, debug: true, minZoom: 0.5, maxZoom: 2, fitView: true, children: [jsx(Controls, {}), jsx(Background, {})] }));
37
- };
38
-
39
- const BoxStack = ({ children, ...props }) => {
40
- const id = props.id;
41
- const flexDirection = props.flexDirection;
42
- const overflow = props.overflow || 'hidden';
43
- const position = props.position || 'relative';
44
- const flex = props.flex || 'none';
45
- const justifyContent = props.justifyContent;
46
- const alignItems = props.alignItems;
47
- const style = props.style || {};
48
- const gap = props.gap || 0;
49
- const height = props.height || 'auto';
50
- const styleGap = useMemo(() => {
51
- switch (flexDirection) {
52
- case 'row':
53
- return {
54
- columnGap: gap,
55
- };
56
- case 'column':
57
- return {
58
- rowGap: gap,
59
- };
60
- }
61
- }, [gap, flexDirection]);
62
- const styleProps = {
63
- display: 'flex',
64
- flexDirection,
65
- overflow,
66
- position,
67
- flex,
68
- justifyContent,
69
- alignItems,
70
- height,
71
- ...styleGap,
72
- ...style,
73
- };
74
- return (jsx("div", { id: id, style: styleProps, children: children }));
75
- };
76
-
77
- const ContentHeader = ({ children }) => {
78
- return (jsx(BoxStack, { id: "gx-hm-content-header", flexDirection: "row", alignItems: "center", overflow: "auto", children: children }));
79
- };
80
-
81
- const createStoreImpl = (createState) => {
82
- let state;
83
- const listeners = /* @__PURE__ */ new Set();
84
- const setState = (partial, replace) => {
85
- const nextState = typeof partial === "function" ? partial(state) : partial;
86
- if (!Object.is(nextState, state)) {
87
- const previousState = state;
88
- state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
89
- listeners.forEach((listener) => listener(state, previousState));
90
- }
91
- };
92
- const getState = () => state;
93
- const getInitialState = () => initialState;
94
- const subscribe = (listener) => {
95
- listeners.add(listener);
96
- return () => listeners.delete(listener);
97
- };
98
- const destroy = () => {
99
- if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production") {
100
- console.warn(
101
- "[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."
102
- );
103
- }
104
- listeners.clear();
105
- };
106
- const api = { setState, getState, getInitialState, subscribe, destroy };
107
- const initialState = state = createState(setState, getState, api);
108
- return api;
109
- };
110
- const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
111
-
112
- function getDefaultExportFromCjs (x) {
113
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
114
- }
115
-
116
- var withSelector = {exports: {}};
117
-
118
- var withSelector_production = {};
119
-
120
- var shim = {exports: {}};
121
-
122
- var useSyncExternalStoreShim_production = {};
123
-
124
- /**
125
- * @license React
126
- * use-sync-external-store-shim.production.js
127
- *
128
- * Copyright (c) Meta Platforms, Inc. and affiliates.
129
- *
130
- * This source code is licensed under the MIT license found in the
131
- * LICENSE file in the root directory of this source tree.
132
- */
133
-
134
- var hasRequiredUseSyncExternalStoreShim_production;
135
-
136
- function requireUseSyncExternalStoreShim_production () {
137
- if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
138
- hasRequiredUseSyncExternalStoreShim_production = 1;
139
- var React = require$$0;
140
- function is(x, y) {
141
- return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
142
- }
143
- var objectIs = "function" === typeof Object.is ? Object.is : is,
144
- useState = React.useState,
145
- useEffect = React.useEffect,
146
- useLayoutEffect = React.useLayoutEffect,
147
- useDebugValue = React.useDebugValue;
148
- function useSyncExternalStore$2(subscribe, getSnapshot) {
149
- var value = getSnapshot(),
150
- _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),
151
- inst = _useState[0].inst,
152
- forceUpdate = _useState[1];
153
- useLayoutEffect(
154
- function () {
155
- inst.value = value;
156
- inst.getSnapshot = getSnapshot;
157
- checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
158
- },
159
- [subscribe, value, getSnapshot]
160
- );
161
- useEffect(
162
- function () {
163
- checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
164
- return subscribe(function () {
165
- checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
166
- });
167
- },
168
- [subscribe]
169
- );
170
- useDebugValue(value);
171
- return value;
172
- }
173
- function checkIfSnapshotChanged(inst) {
174
- var latestGetSnapshot = inst.getSnapshot;
175
- inst = inst.value;
176
- try {
177
- var nextValue = latestGetSnapshot();
178
- return !objectIs(inst, nextValue);
179
- } catch (error) {
180
- return !0;
181
- }
182
- }
183
- function useSyncExternalStore$1(subscribe, getSnapshot) {
184
- return getSnapshot();
185
- }
186
- var shim =
187
- "undefined" === typeof window ||
188
- "undefined" === typeof window.document ||
189
- "undefined" === typeof window.document.createElement
190
- ? useSyncExternalStore$1
191
- : useSyncExternalStore$2;
192
- useSyncExternalStoreShim_production.useSyncExternalStore =
193
- void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
194
- return useSyncExternalStoreShim_production;
195
- }
196
-
197
- var useSyncExternalStoreShim_development = {};
198
-
199
- /**
200
- * @license React
201
- * use-sync-external-store-shim.development.js
202
- *
203
- * Copyright (c) Meta Platforms, Inc. and affiliates.
204
- *
205
- * This source code is licensed under the MIT license found in the
206
- * LICENSE file in the root directory of this source tree.
207
- */
208
-
209
- var hasRequiredUseSyncExternalStoreShim_development;
210
-
211
- function requireUseSyncExternalStoreShim_development () {
212
- if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
213
- hasRequiredUseSyncExternalStoreShim_development = 1;
214
- "production" !== process.env.NODE_ENV &&
215
- (function () {
216
- function is(x, y) {
217
- return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
218
- }
219
- function useSyncExternalStore$2(subscribe, getSnapshot) {
220
- didWarnOld18Alpha ||
221
- void 0 === React.startTransition ||
222
- ((didWarnOld18Alpha = !0),
223
- console.error(
224
- "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
225
- ));
226
- var value = getSnapshot();
227
- if (!didWarnUncachedGetSnapshot) {
228
- var cachedValue = getSnapshot();
229
- objectIs(value, cachedValue) ||
230
- (console.error(
231
- "The result of getSnapshot should be cached to avoid an infinite loop"
232
- ),
233
- (didWarnUncachedGetSnapshot = !0));
234
- }
235
- cachedValue = useState({
236
- inst: { value: value, getSnapshot: getSnapshot }
237
- });
238
- var inst = cachedValue[0].inst,
239
- forceUpdate = cachedValue[1];
240
- useLayoutEffect(
241
- function () {
242
- inst.value = value;
243
- inst.getSnapshot = getSnapshot;
244
- checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
245
- },
246
- [subscribe, value, getSnapshot]
247
- );
248
- useEffect(
249
- function () {
250
- checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
251
- return subscribe(function () {
252
- checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
253
- });
254
- },
255
- [subscribe]
256
- );
257
- useDebugValue(value);
258
- return value;
259
- }
260
- function checkIfSnapshotChanged(inst) {
261
- var latestGetSnapshot = inst.getSnapshot;
262
- inst = inst.value;
263
- try {
264
- var nextValue = latestGetSnapshot();
265
- return !objectIs(inst, nextValue);
266
- } catch (error) {
267
- return !0;
268
- }
269
- }
270
- function useSyncExternalStore$1(subscribe, getSnapshot) {
271
- return getSnapshot();
272
- }
273
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
274
- "function" ===
275
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
276
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
277
- var React = require$$0,
278
- objectIs = "function" === typeof Object.is ? Object.is : is,
279
- useState = React.useState,
280
- useEffect = React.useEffect,
281
- useLayoutEffect = React.useLayoutEffect,
282
- useDebugValue = React.useDebugValue,
283
- didWarnOld18Alpha = !1,
284
- didWarnUncachedGetSnapshot = !1,
285
- shim =
286
- "undefined" === typeof window ||
287
- "undefined" === typeof window.document ||
288
- "undefined" === typeof window.document.createElement
289
- ? useSyncExternalStore$1
290
- : useSyncExternalStore$2;
291
- useSyncExternalStoreShim_development.useSyncExternalStore =
292
- void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
293
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
294
- "function" ===
295
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
296
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
297
- })();
298
- return useSyncExternalStoreShim_development;
299
- }
300
-
301
- var hasRequiredShim;
302
-
303
- function requireShim () {
304
- if (hasRequiredShim) return shim.exports;
305
- hasRequiredShim = 1;
306
-
307
- if (process.env.NODE_ENV === 'production') {
308
- shim.exports = requireUseSyncExternalStoreShim_production();
309
- } else {
310
- shim.exports = requireUseSyncExternalStoreShim_development();
311
- }
312
- return shim.exports;
313
- }
314
-
315
- /**
316
- * @license React
317
- * use-sync-external-store-shim/with-selector.production.js
318
- *
319
- * Copyright (c) Meta Platforms, Inc. and affiliates.
320
- *
321
- * This source code is licensed under the MIT license found in the
322
- * LICENSE file in the root directory of this source tree.
323
- */
324
-
325
- var hasRequiredWithSelector_production;
326
-
327
- function requireWithSelector_production () {
328
- if (hasRequiredWithSelector_production) return withSelector_production;
329
- hasRequiredWithSelector_production = 1;
330
- var React = require$$0,
331
- shim = requireShim();
332
- function is(x, y) {
333
- return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
334
- }
335
- var objectIs = "function" === typeof Object.is ? Object.is : is,
336
- useSyncExternalStore = shim.useSyncExternalStore,
337
- useRef = React.useRef,
338
- useEffect = React.useEffect,
339
- useMemo = React.useMemo,
340
- useDebugValue = React.useDebugValue;
341
- withSelector_production.useSyncExternalStoreWithSelector = function (
342
- subscribe,
343
- getSnapshot,
344
- getServerSnapshot,
345
- selector,
346
- isEqual
347
- ) {
348
- var instRef = useRef(null);
349
- if (null === instRef.current) {
350
- var inst = { hasValue: !1, value: null };
351
- instRef.current = inst;
352
- } else inst = instRef.current;
353
- instRef = useMemo(
354
- function () {
355
- function memoizedSelector(nextSnapshot) {
356
- if (!hasMemo) {
357
- hasMemo = !0;
358
- memoizedSnapshot = nextSnapshot;
359
- nextSnapshot = selector(nextSnapshot);
360
- if (void 0 !== isEqual && inst.hasValue) {
361
- var currentSelection = inst.value;
362
- if (isEqual(currentSelection, nextSnapshot))
363
- return (memoizedSelection = currentSelection);
364
- }
365
- return (memoizedSelection = nextSnapshot);
366
- }
367
- currentSelection = memoizedSelection;
368
- if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
369
- var nextSelection = selector(nextSnapshot);
370
- if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
371
- return (memoizedSnapshot = nextSnapshot), currentSelection;
372
- memoizedSnapshot = nextSnapshot;
373
- return (memoizedSelection = nextSelection);
374
- }
375
- var hasMemo = !1,
376
- memoizedSnapshot,
377
- memoizedSelection,
378
- maybeGetServerSnapshot =
379
- void 0 === getServerSnapshot ? null : getServerSnapshot;
380
- return [
381
- function () {
382
- return memoizedSelector(getSnapshot());
383
- },
384
- null === maybeGetServerSnapshot
385
- ? void 0
386
- : function () {
387
- return memoizedSelector(maybeGetServerSnapshot());
388
- }
389
- ];
390
- },
391
- [getSnapshot, getServerSnapshot, selector, isEqual]
392
- );
393
- var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
394
- useEffect(
395
- function () {
396
- inst.hasValue = !0;
397
- inst.value = value;
398
- },
399
- [value]
400
- );
401
- useDebugValue(value);
402
- return value;
403
- };
404
- return withSelector_production;
405
- }
406
-
407
- var withSelector_development = {};
408
-
409
- /**
410
- * @license React
411
- * use-sync-external-store-shim/with-selector.development.js
412
- *
413
- * Copyright (c) Meta Platforms, Inc. and affiliates.
414
- *
415
- * This source code is licensed under the MIT license found in the
416
- * LICENSE file in the root directory of this source tree.
417
- */
418
-
419
- var hasRequiredWithSelector_development;
420
-
421
- function requireWithSelector_development () {
422
- if (hasRequiredWithSelector_development) return withSelector_development;
423
- hasRequiredWithSelector_development = 1;
424
- "production" !== process.env.NODE_ENV &&
425
- (function () {
426
- function is(x, y) {
427
- return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
428
- }
429
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
430
- "function" ===
431
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
432
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
433
- var React = require$$0,
434
- shim = requireShim(),
435
- objectIs = "function" === typeof Object.is ? Object.is : is,
436
- useSyncExternalStore = shim.useSyncExternalStore,
437
- useRef = React.useRef,
438
- useEffect = React.useEffect,
439
- useMemo = React.useMemo,
440
- useDebugValue = React.useDebugValue;
441
- withSelector_development.useSyncExternalStoreWithSelector = function (
442
- subscribe,
443
- getSnapshot,
444
- getServerSnapshot,
445
- selector,
446
- isEqual
447
- ) {
448
- var instRef = useRef(null);
449
- if (null === instRef.current) {
450
- var inst = { hasValue: !1, value: null };
451
- instRef.current = inst;
452
- } else inst = instRef.current;
453
- instRef = useMemo(
454
- function () {
455
- function memoizedSelector(nextSnapshot) {
456
- if (!hasMemo) {
457
- hasMemo = !0;
458
- memoizedSnapshot = nextSnapshot;
459
- nextSnapshot = selector(nextSnapshot);
460
- if (void 0 !== isEqual && inst.hasValue) {
461
- var currentSelection = inst.value;
462
- if (isEqual(currentSelection, nextSnapshot))
463
- return (memoizedSelection = currentSelection);
464
- }
465
- return (memoizedSelection = nextSnapshot);
466
- }
467
- currentSelection = memoizedSelection;
468
- if (objectIs(memoizedSnapshot, nextSnapshot))
469
- return currentSelection;
470
- var nextSelection = selector(nextSnapshot);
471
- if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
472
- return (memoizedSnapshot = nextSnapshot), currentSelection;
473
- memoizedSnapshot = nextSnapshot;
474
- return (memoizedSelection = nextSelection);
475
- }
476
- var hasMemo = !1,
477
- memoizedSnapshot,
478
- memoizedSelection,
479
- maybeGetServerSnapshot =
480
- void 0 === getServerSnapshot ? null : getServerSnapshot;
481
- return [
482
- function () {
483
- return memoizedSelector(getSnapshot());
484
- },
485
- null === maybeGetServerSnapshot
486
- ? void 0
487
- : function () {
488
- return memoizedSelector(maybeGetServerSnapshot());
489
- }
490
- ];
491
- },
492
- [getSnapshot, getServerSnapshot, selector, isEqual]
493
- );
494
- var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
495
- useEffect(
496
- function () {
497
- inst.hasValue = !0;
498
- inst.value = value;
499
- },
500
- [value]
501
- );
502
- useDebugValue(value);
503
- return value;
504
- };
505
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
506
- "function" ===
507
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
508
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
509
- })();
510
- return withSelector_development;
511
- }
512
-
513
- if (process.env.NODE_ENV === 'production') {
514
- withSelector.exports = requireWithSelector_production();
515
- } else {
516
- withSelector.exports = requireWithSelector_development();
517
- }
518
-
519
- var withSelectorExports = withSelector.exports;
520
- var useSyncExternalStoreExports = /*@__PURE__*/getDefaultExportFromCjs(withSelectorExports);
521
-
522
- const { useDebugValue } = require$$0;
523
- const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;
524
- let didWarnAboutEqualityFn = false;
525
- const identity = (arg) => arg;
526
- function useStore(api, selector = identity, equalityFn) {
527
- if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && equalityFn && !didWarnAboutEqualityFn) {
528
- console.warn(
529
- "[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"
530
- );
531
- didWarnAboutEqualityFn = true;
532
- }
533
- const slice = useSyncExternalStoreWithSelector(
534
- api.subscribe,
535
- api.getState,
536
- api.getServerState || api.getInitialState,
537
- selector,
538
- equalityFn
539
- );
540
- useDebugValue(slice);
541
- return slice;
542
- }
543
- const createImpl = (createState) => {
544
- if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && typeof createState !== "function") {
545
- console.warn(
546
- "[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`."
547
- );
548
- }
549
- const api = typeof createState === "function" ? createStore(createState) : createState;
550
- const useBoundStore = (selector, equalityFn) => useStore(api, selector, equalityFn);
551
- Object.assign(useBoundStore, api);
552
- return useBoundStore;
553
- };
554
- const create = (createState) => createState ? createImpl(createState) : createImpl;
555
-
556
- const useHeatmapDataStore = create()((set, get) => ({
557
- data: undefined,
558
- config: undefined,
559
- state: {
560
- hideSidebar: false,
561
- },
562
- setData: (data) => set({ data }),
563
- setExtraData: (extraData) => set({ extraData: { ...get().extraData, ...extraData } }),
564
- setState: (state) => set({ state: { ...get().state, ...state } }),
565
- setConfig: (config) => set({ config }),
566
- }));
567
-
568
- const SIDEBAR_WIDTH = 280;
569
- const LeftSidebar = ({ children }) => {
570
- const isHideSidebar = useHeatmapDataStore((state) => state.state.hideSidebar);
571
- if (isHideSidebar) {
572
- return null;
573
- }
574
- return (jsx("div", { className: "gx-hm-sidebar", style: {
575
- height: '100%',
576
- display: 'flex',
577
- ...(isHideSidebar
578
- ? {
579
- width: '0',
580
- transform: 'translateX(-100%)',
581
- visibility: 'hidden',
582
- }
583
- : { width: `${SIDEBAR_WIDTH}px` }),
584
- }, children: jsx("div", { className: "gx-hm-sidebar-wrapper", style: { height: '100%', width: `${SIDEBAR_WIDTH}px` }, children: children }) }));
585
- };
586
-
587
- const HEATMAP_CONFIG = {
588
- paddingBlock: 0,
589
- };
590
- const HEATMAP_STYLE = {
591
- wrapper: {
592
- padding: `${HEATMAP_CONFIG.paddingBlock}px 0`,
593
- },
594
- };
595
-
596
- function isMobileDevice(userAgent) {
597
- if (!userAgent)
598
- return false;
599
- return /android|webos|iphone|ipad|ipod|blackberry|windows phone|opera mini|iemobile|mobile|silk|fennec|bada|tizen|symbian|nokia|palmsource|meego|sailfish|kindle|playbook|bb10|rim/i.test(userAgent);
600
- }
601
-
602
- const useHeatmapRender = () => {
603
- const data = useHeatmapDataStore((state) => state.data);
604
- const setExtraData = useHeatmapDataStore((state) => state.setExtraData);
605
- const visualizerRef = useRef(null);
606
- const iframeRef = useRef(null);
607
- // Initialize visualizer for heatmap
608
- const initializeVisualizer = useCallback((envelope, userAgent) => {
609
- const iframe = iframeRef.current;
610
- if (!iframe?.contentWindow)
611
- return null;
612
- const visualizer = new Visualizer();
613
- const mobile = isMobileDevice(userAgent);
614
- visualizer.setup(iframe.contentWindow, {
615
- version: envelope.version,
616
- onresize: (width, height) => {
617
- setExtraData({ width, height });
618
- },
619
- mobile,
620
- vNext: true,
621
- locale: 'en-us',
622
- });
623
- return visualizer;
624
- }, [setExtraData]);
625
- // Process and render heatmap HTML
626
- const renderHeatmap = useCallback(async (payloads) => {
627
- if (!payloads || payloads.length === 0)
628
- return;
629
- let visualizer = visualizerRef.current;
630
- for (const decoded of payloads) {
631
- // Initialize on first sequence
632
- if (decoded.envelope.sequence === 1) {
633
- const userAgent = decoded.dimension?.[0]?.data[0]?.[0] || '';
634
- visualizer = initializeVisualizer(decoded.envelope, userAgent);
635
- if (!visualizer)
636
- return;
637
- visualizerRef.current = visualizer;
638
- }
639
- if (!visualizer)
640
- continue;
641
- // Merge and process DOM
642
- const merged = visualizer.merge([decoded]);
643
- visualizer.dom(merged.dom);
644
- }
645
- // Render static HTML
646
- if (visualizer && iframeRef.current?.contentWindow) {
647
- await visualizer.html(payloads, iframeRef.current.contentWindow);
648
- }
649
- }, [initializeVisualizer]);
650
- // Main effect: Render heatmap when data changes
651
- useEffect(() => {
652
- if (!data || data.length === 0)
653
- return;
654
- renderHeatmap(data);
655
- // Cleanup
656
- return () => {
657
- visualizerRef.current = null;
658
- };
659
- }, [data, renderHeatmap]);
660
- return {
661
- iframeRef,
662
- };
663
- };
664
-
665
- function sortEvents(a, b) {
666
- return a.time - b.time;
667
- }
668
-
669
- const useReplayRender = () => {
670
- const data = useHeatmapDataStore((state) => state.data);
671
- const setExtraData = useHeatmapDataStore((state) => state.setExtraData);
672
- const visualizerRef = useRef(null);
673
- const iframeRef = useRef(null);
674
- const eventsRef = useRef([]);
675
- const animationFrameRef = useRef(null);
676
- const isPlayingRef = useRef(false);
677
- // Initialize visualizer for replay
678
- const initializeVisualizer = useCallback((envelope, userAgent) => {
679
- const iframe = iframeRef.current;
680
- if (!iframe?.contentWindow)
681
- return null;
682
- // Clear previous events
683
- eventsRef.current = [];
684
- const visualizer = new Visualizer();
685
- const mobile = isMobileDevice(userAgent);
686
- visualizer.setup(iframe.contentWindow, {
687
- version: envelope.version,
688
- onresize: (width, height) => {
689
- setExtraData({ width, height });
690
- },
691
- mobile,
692
- vNext: true,
693
- locale: 'en-us',
694
- });
695
- return visualizer;
696
- }, [setExtraData]);
697
- // Animation loop for replay
698
- const replayLoop = useCallback(() => {
699
- if (!isPlayingRef.current)
700
- return;
701
- const events = eventsRef.current;
702
- const visualizer = visualizerRef.current;
703
- if (!visualizer || events.length === 0) {
704
- animationFrameRef.current = requestAnimationFrame(replayLoop);
705
- return;
706
- }
707
- const event = events[0];
708
- const end = event.time + 16; // 60FPS => 16ms per frame
709
- let index = 0;
710
- // Get events within current frame
711
- while (events[index] && events[index].time < end) {
712
- index++;
713
- }
714
- // Render events for this frame
715
- if (index > 0) {
716
- visualizer.render(events.splice(0, index));
717
- }
718
- animationFrameRef.current = requestAnimationFrame(replayLoop);
719
- }, []);
720
- // Start replay
721
- const startReplay = useCallback(async (payloads) => {
722
- if (!payloads || payloads.length === 0)
723
- return;
724
- let visualizer = visualizerRef.current;
725
- for (const decoded of payloads) {
726
- // Initialize on first sequence
727
- if (decoded.envelope.sequence === 1) {
728
- const userAgent = decoded.dimension?.[0]?.data[0]?.[0] || '';
729
- visualizer = initializeVisualizer(decoded.envelope, userAgent);
730
- if (!visualizer)
731
- return;
732
- visualizerRef.current = visualizer;
733
- }
734
- if (!visualizer)
735
- continue;
736
- // Merge events and DOM
737
- const merged = visualizer.merge([decoded]);
738
- eventsRef.current = eventsRef.current.concat(merged.events).sort(sortEvents);
739
- visualizer.dom(merged.dom);
740
- }
741
- // Render HTML
742
- if (visualizer && iframeRef.current?.contentWindow) {
743
- await visualizer.html(payloads, iframeRef.current.contentWindow);
744
- }
745
- // Auto-start replay
746
- isPlayingRef.current = true;
747
- animationFrameRef.current = requestAnimationFrame(replayLoop);
748
- }, [initializeVisualizer, replayLoop]);
749
- // Play control
750
- const play = useCallback(() => {
751
- if (!isPlayingRef.current) {
752
- isPlayingRef.current = true;
753
- animationFrameRef.current = requestAnimationFrame(replayLoop);
754
- }
755
- }, [replayLoop]);
756
- // Pause control
757
- const pause = useCallback(() => {
758
- isPlayingRef.current = false;
759
- if (animationFrameRef.current) {
760
- cancelAnimationFrame(animationFrameRef.current);
761
- animationFrameRef.current = null;
762
- }
763
- }, []);
764
- // Main effect: Start replay when data changes
765
- useEffect(() => {
766
- if (!data || data.length === 0)
767
- return;
768
- startReplay(data);
769
- // Cleanup
770
- return () => {
771
- isPlayingRef.current = false;
772
- if (animationFrameRef.current) {
773
- cancelAnimationFrame(animationFrameRef.current);
774
- animationFrameRef.current = null;
775
- }
776
- eventsRef.current = [];
777
- visualizerRef.current = null;
778
- };
779
- }, [data, startReplay]);
780
- return {
781
- iframeRef,
782
- isPlaying: isPlayingRef.current,
783
- play,
784
- pause,
785
- };
786
- };
787
-
788
- const useHeatmapByMode = (mode) => {
789
- const heatmapResult = useMemo(() => {
790
- switch (mode) {
791
- case 'heatmap':
792
- return useHeatmapRender;
793
- case 'replay':
794
- return useReplayRender;
795
- }
796
- }, [mode]);
797
- return heatmapResult();
798
- };
799
-
800
- const useHeatmapScale = (props) => {
801
- const { wrapperRef, iframeRef, config } = props;
802
- const containerResizeObserverRef = useRef(null);
803
- const iframeResizeObserverRef = useRef(null);
804
- // Container dimensions (scrollable parent)
805
- const [containerWidth, setContainerWidth] = useState(0);
806
- const [containerHeight, setContainerHeight] = useState(0);
807
- // Content dimensions from heatmap data
808
- const [contentWidth, setContentWidth] = useState(0);
809
- const [contentHeight, setContentHeight] = useState(0);
810
- // Iframe body actual height (from ResizeObserver)
811
- const [iframeHeight, setIframeHeight] = useState(0);
812
- // Scale ratio
813
- const [scale, setScale] = useState(1);
814
- // Initialize content dimensions from heatmap data
815
- useEffect(() => {
816
- if (config?.width && config?.height) {
817
- setContentWidth(config.width);
818
- setContentHeight(config.height);
819
- // Set initial iframe body height
820
- setIframeHeight(config.height);
821
- }
822
- }, [config?.width, config?.height]);
823
- // Update container dimensions
824
- const updateContainerDimensions = useCallback(() => {
825
- const scrollContainer = wrapperRef.current?.parentElement?.parentElement;
826
- if (scrollContainer) {
827
- setContainerWidth(scrollContainer.clientWidth);
828
- setContainerHeight(scrollContainer.clientHeight);
829
- }
830
- }, [wrapperRef]);
831
- // Setup ResizeObserver for container
832
- useEffect(() => {
833
- const scrollContainer = wrapperRef.current?.parentElement?.parentElement;
834
- if (!scrollContainer || typeof window.ResizeObserver === 'undefined') {
835
- return;
836
- }
837
- containerResizeObserverRef.current = new ResizeObserver(() => {
838
- updateContainerDimensions();
839
- });
840
- containerResizeObserverRef.current.observe(scrollContainer);
841
- updateContainerDimensions();
842
- return () => {
843
- if (containerResizeObserverRef.current && scrollContainer) {
844
- containerResizeObserverRef.current.unobserve(scrollContainer);
845
- }
846
- };
847
- }, [wrapperRef, updateContainerDimensions]);
848
- // Setup ResizeObserver and MutationObserver for iframe body
849
- useEffect(() => {
850
- const iframe = iframeRef.current;
851
- if (!iframe) {
852
- return;
853
- }
854
- let mutationObserver = null;
855
- const updateIframeHeight = () => {
856
- try {
857
- const iframeDocument = iframe.contentDocument;
858
- const iframeBody = iframeDocument?.body;
859
- if (!iframeBody) {
860
- return;
861
- }
862
- const bodyHeight = Math.max(iframeBody.scrollHeight, iframeBody.offsetHeight, iframeBody.clientHeight);
863
- if (bodyHeight > 0) {
864
- setIframeHeight(bodyHeight);
865
- }
866
- }
867
- catch (error) {
868
- console.warn('Cannot measure iframe content:', error);
869
- }
870
- };
871
- const setupIframeObserver = () => {
872
- try {
873
- const iframeDocument = iframe.contentDocument;
874
- const iframeBody = iframeDocument?.body;
875
- if (!iframeBody) {
876
- return;
877
- }
878
- // ResizeObserver for size changes
879
- if (typeof window.ResizeObserver !== 'undefined') {
880
- if (iframeResizeObserverRef.current) {
881
- iframeResizeObserverRef.current.disconnect();
882
- }
883
- iframeResizeObserverRef.current = new ResizeObserver(() => {
884
- updateIframeHeight();
885
- });
886
- iframeResizeObserverRef.current.observe(iframeBody);
887
- }
888
- // MutationObserver for DOM changes
889
- if (typeof window.MutationObserver !== 'undefined') {
890
- mutationObserver = new MutationObserver(() => {
891
- updateIframeHeight();
892
- });
893
- mutationObserver.observe(iframeBody, {
894
- childList: true, // Watch for added/removed nodes
895
- subtree: true, // Watch entire subtree
896
- attributes: true, // Watch attribute changes
897
- characterData: true, // Watch text content changes
898
- });
899
- }
900
- // Initial measurement
901
- updateIframeHeight();
902
- }
903
- catch (error) {
904
- console.warn('Cannot access iframe content:', error);
905
- }
906
- };
907
- if (iframe.contentDocument?.readyState === 'complete') {
908
- setupIframeObserver();
909
- }
910
- else {
911
- iframe.addEventListener('load', setupIframeObserver, { once: true });
912
- }
913
- return () => {
914
- if (iframeResizeObserverRef.current) {
915
- iframeResizeObserverRef.current.disconnect();
916
- }
917
- if (mutationObserver) {
918
- mutationObserver.disconnect();
919
- }
920
- iframe.removeEventListener('load', setupIframeObserver);
921
- };
922
- }, [iframeRef]);
923
- // Calculate scale based on container width and content width
924
- useEffect(() => {
925
- if (containerWidth > 0 && contentWidth > 0) {
926
- const availableWidth = containerWidth - HEATMAP_CONFIG['paddingBlock'] * 2;
927
- const calculatedScale = Math.min(availableWidth / contentWidth, 1);
928
- setScale(calculatedScale);
929
- }
930
- }, [containerWidth, contentWidth]);
931
- // Sync scroll position from container to iframe
932
- const handleScroll = useCallback((scrollTop) => {
933
- const iframe = iframeRef.current;
934
- if (!iframe || scale <= 0)
935
- return;
936
- try {
937
- const iframeWindow = iframe.contentWindow;
938
- const iframeDocument = iframe.contentDocument;
939
- if (iframeWindow && iframeDocument) {
940
- const iframeScrollTop = scrollTop / scale;
941
- iframeRef.current && (iframeRef.current.style.top = `${iframeScrollTop}px`);
942
- }
943
- }
944
- catch (error) {
945
- console.warn('Cannot sync scroll to iframe:', error);
946
- }
947
- }, [iframeRef, scale]);
948
- return {
949
- containerWidth,
950
- containerHeight,
951
- contentWidth,
952
- contentHeight,
953
- iframeHeight,
954
- scale,
955
- scaledWidth: contentWidth * scale,
956
- scaledHeight: iframeHeight * scale,
957
- handleScroll,
958
- };
959
- };
960
-
961
- const ReplayControls = () => {
962
- const replayResult = useReplayRender();
963
- return (jsxs("div", { style: {
964
- position: 'absolute',
965
- bottom: 20,
966
- left: '50%',
967
- transform: 'translateX(-50%)',
968
- display: 'flex',
969
- gap: 10,
970
- backgroundColor: 'rgba(0, 0, 0, 0.7)',
971
- padding: '10px 20px',
972
- borderRadius: 8,
973
- }, children: [jsx("button", { onClick: replayResult.play, style: {
974
- padding: '8px 16px',
975
- backgroundColor: '#4CAF50',
976
- color: 'white',
977
- border: 'none',
978
- borderRadius: 4,
979
- cursor: 'pointer',
980
- }, children: "Play" }), jsx("button", { onClick: replayResult.pause, style: {
981
- padding: '8px 16px',
982
- backgroundColor: '#f44336',
983
- color: 'white',
984
- border: 'none',
985
- borderRadius: 4,
986
- cursor: 'pointer',
987
- }, children: "Pause" })] }));
988
- };
989
-
990
- const VizDomRenderer = ({ mode = 'heatmap' }) => {
991
- const config = useHeatmapDataStore((state) => state.config);
992
- const wrapperRef = useRef(null);
993
- const visualRef = useRef(null);
994
- const { iframeRef } = useHeatmapByMode(mode);
995
- const { contentWidth, iframeHeight, scale, scaledHeight, handleScroll } = useHeatmapScale({
996
- wrapperRef,
997
- iframeRef,
998
- config,
999
- });
1000
- const onScroll = (e) => {
1001
- const scrollTop = e.currentTarget.scrollTop;
1002
- handleScroll(scrollTop);
1003
- };
1004
- return (jsxs("div", { ref: visualRef, className: "gx-hm-visual", onScroll: onScroll, style: {
1005
- overflow: 'hidden auto',
1006
- display: 'flex',
1007
- position: 'relative',
1008
- justifyContent: 'center',
1009
- flex: 1,
1010
- backgroundColor: '#fff',
1011
- }, children: [jsx("div", { className: "gx-hm-visual-unscaled", style: {
1012
- width: '100%',
1013
- display: 'flex',
1014
- justifyContent: 'center',
1015
- alignItems: 'flex-start',
1016
- height: scaledHeight > 0 ? `${scaledHeight + HEATMAP_CONFIG['paddingBlock']}px` : 'auto',
1017
- padding: HEATMAP_STYLE['wrapper']['padding'],
1018
- }, children: jsx("div", { className: "gx-hm-wrapper", ref: wrapperRef, style: {
1019
- width: contentWidth,
1020
- height: iframeHeight,
1021
- transform: `scale(${scale})`,
1022
- transformOrigin: 'top center',
1023
- }, children: jsx("iframe", { ref: iframeRef, id: "clarity-iframe", title: "Clarity Session Replay", sandbox: "allow-same-origin allow-scripts", width: contentWidth, height: iframeHeight, style: {
1024
- border: 'none',
1025
- display: 'block',
1026
- width: `${contentWidth}px`,
1027
- height: `${iframeHeight}px`,
1028
- } }) }) }), mode === 'replay' && jsx(ReplayControls, {})] }));
1029
- };
1030
-
1031
- const VizDomContainer = () => {
1032
- return (jsx(BoxStack, { id: "gx-hm-viz-container", flexDirection: "column", flex: "1 1 auto", overflow: "auto", children: jsx(BoxStack, { id: "gx-hm-content", flexDirection: "column", flex: "1 1 auto", overflow: "hidden", style: {
1033
- // margin: '0px 16px 0px 12px',
1034
- borderRadius: '8px 8px 0 0',
1035
- minWidth: '394px',
1036
- }, children: jsx(VizDomRenderer, {}) }) }));
1037
- };
1038
-
1039
- const WrapperPreview = ({ children }) => {
1040
- return (jsxs("div", { className: "gx-hm-container", style: { display: 'flex', overflowY: 'hidden', flex: '1', position: 'relative' }, children: [jsx(LeftSidebar, { children: children }), jsx(VizDomContainer, {})] }));
1041
- };
1042
-
1043
- const WrapperLayout = ({ header, sidebar }) => {
1044
- return (jsxs(BoxStack, { id: "gx-hm-layout", flexDirection: "column", flex: "1", children: [jsx(ContentHeader, { children: header }), jsx(WrapperPreview, { children: sidebar })] }));
1045
- };
1046
-
1047
- const HeatmapLayout = ({ header, sidebar }) => {
1048
- return (jsx(BoxStack, { id: "gx-hm-project", flexDirection: "column", flex: "1", height: "100%", children: jsx(BoxStack, { id: "gx-hm-project-content", flexDirection: "column", flex: "1", children: jsx("div", { style: {
1049
- minHeight: '100%',
1050
- display: 'flex',
1051
- }, children: jsx(WrapperLayout, { header: header, sidebar: sidebar }) }) }) }));
1052
- };
1053
-
1054
- var PanelContent;
1055
- (function (PanelContent) {
1056
- PanelContent["Sessions"] = "Sessions";
1057
- PanelContent["Timeline"] = "Timeline";
1058
- PanelContent["Area"] = "Area";
1059
- PanelContent["Click"] = "Click";
1060
- PanelContent["Scroll"] = "Scroll";
1061
- PanelContent["Attention"] = "Attention";
1062
- })(PanelContent || (PanelContent = {}));
1063
- var ErrorType;
1064
- (function (ErrorType) {
1065
- ErrorType["NoResults"] = "NoResults";
1066
- ErrorType["NoClicks"] = "NoClicks";
1067
- ErrorType["NoScroll"] = "NoScroll";
1068
- ErrorType["ServerError"] = "ServerError";
1069
- ErrorType["DataError"] = "DataError";
1070
- })(ErrorType || (ErrorType = {}));
1071
-
1072
- export { GraphView, HeatmapLayout, useHeatmapDataStore };