@hrnec06/react_utils 1.2.2 → 1.2.3
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.
- package/package.json +4 -2
- package/src/debugger/Debugger.tsx +67 -63
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hrnec06/react_utils",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "A debugger component for react.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/index.tsx"
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/react": "^19.1.8",
|
|
24
|
+
"@types/react-dom": "^19.2.3",
|
|
24
25
|
"tsup": "^8.5.0",
|
|
25
26
|
"typescript": "^5.8.3"
|
|
26
27
|
},
|
|
@@ -28,7 +29,8 @@
|
|
|
28
29
|
"@hrnec06/util": "^1.4.14",
|
|
29
30
|
"clsx": "^2.1.1",
|
|
30
31
|
"lucide-react": "^0.525.0",
|
|
31
|
-
"react": "^19.1.0"
|
|
32
|
+
"react": "^19.1.0",
|
|
33
|
+
"react-dom": "^19.2.3"
|
|
32
34
|
},
|
|
33
35
|
"scripts": {
|
|
34
36
|
"dev": "tsup src/index.tsx --format cjs,esm --dts --watch"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { minmax, Nullable, Vector2 } from "@hrnec06/util";
|
|
2
2
|
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
3
4
|
import {DebuggerContext} from "./DebuggerContext";
|
|
4
5
|
import clsx from "clsx";
|
|
5
6
|
import ResizeBorder from "./DebuggerWindowResize";
|
|
@@ -226,76 +227,79 @@ export default function Debug({
|
|
|
226
227
|
setScrollProgress(p => minmax(p + addProgress, 0, 1));
|
|
227
228
|
}
|
|
228
229
|
|
|
229
|
-
return (
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
<div
|
|
261
|
-
className={clsx(
|
|
262
|
-
"absolute font-jetbrains pointer-events-auto",
|
|
263
|
-
size === 'tiny' && 'text-xs',
|
|
264
|
-
size === 'normal' && 'text-sm',
|
|
265
|
-
size === 'big' && 'text-base'
|
|
266
|
-
)}
|
|
267
|
-
style={{
|
|
268
|
-
left: finalPosition[0],
|
|
269
|
-
top: finalPosition[1],
|
|
270
|
-
width: windowSize[0],
|
|
271
|
-
height: windowSize[1],
|
|
272
|
-
}}
|
|
273
|
-
>
|
|
274
|
-
<ResizeBorder />
|
|
275
|
-
|
|
230
|
+
return createPortal(
|
|
231
|
+
(
|
|
232
|
+
<DebuggerContext.Provider
|
|
233
|
+
value={{
|
|
234
|
+
paths: {
|
|
235
|
+
exclude: excludePaths ?? [],
|
|
236
|
+
open: openPaths ?? []
|
|
237
|
+
},
|
|
238
|
+
options: {
|
|
239
|
+
compactArrays: compactArrays,
|
|
240
|
+
autoHeight: autoHeight,
|
|
241
|
+
openRoot: openRoot
|
|
242
|
+
},
|
|
243
|
+
window: {
|
|
244
|
+
resize: setWindowSize,
|
|
245
|
+
size: windowSize
|
|
246
|
+
},
|
|
247
|
+
placement: {
|
|
248
|
+
reposition: setPosition,
|
|
249
|
+
position: position
|
|
250
|
+
},
|
|
251
|
+
event: {
|
|
252
|
+
expand: handleExpandChange
|
|
253
|
+
},
|
|
254
|
+
scroll: {
|
|
255
|
+
setProgress: setScrollProgress,
|
|
256
|
+
progress: scrollProgress,
|
|
257
|
+
isScrollable: isScrollable
|
|
258
|
+
}
|
|
259
|
+
}}
|
|
260
|
+
>
|
|
261
|
+
<div className="fixed pointer-events-none w-full h-full left-0 top-0 overflow-hidden z-999999">
|
|
276
262
|
<div
|
|
277
|
-
|
|
278
|
-
|
|
263
|
+
className={clsx(
|
|
264
|
+
"absolute font-jetbrains pointer-events-auto",
|
|
265
|
+
size === 'tiny' && 'text-xs',
|
|
266
|
+
size === 'normal' && 'text-sm',
|
|
267
|
+
size === 'big' && 'text-base'
|
|
268
|
+
)}
|
|
269
|
+
style={{
|
|
270
|
+
left: finalPosition[0],
|
|
271
|
+
top: finalPosition[1],
|
|
272
|
+
width: windowSize[0],
|
|
273
|
+
height: windowSize[1],
|
|
274
|
+
}}
|
|
279
275
|
>
|
|
276
|
+
<ResizeBorder />
|
|
277
|
+
|
|
280
278
|
<div
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
className=" cursor-grab w-full"
|
|
284
|
-
style={{
|
|
285
|
-
transform: `translateY(${-(scrollProgress * scrollHeight)}px)`
|
|
286
|
-
}}
|
|
279
|
+
onWheel={handleWheel}
|
|
280
|
+
className="bg-[#1f1f1f] shadow-lg rounded-md border border-[#4b4b4b] w-full h-full overflow-hidden flex"
|
|
287
281
|
>
|
|
288
|
-
<div
|
|
289
|
-
|
|
282
|
+
<div
|
|
283
|
+
ref={containerRef}
|
|
284
|
+
onMouseDown={handleMouseDown}
|
|
285
|
+
className=" cursor-grab w-full"
|
|
286
|
+
style={{
|
|
287
|
+
transform: `translateY(${-(scrollProgress * scrollHeight)}px)`
|
|
288
|
+
}}
|
|
289
|
+
>
|
|
290
|
+
<div className="p-3 pl-5">
|
|
291
|
+
<ParseValue value={value} />
|
|
292
|
+
</div>
|
|
290
293
|
</div>
|
|
294
|
+
<ScrollBar
|
|
295
|
+
containerHeight={containerHeight}
|
|
296
|
+
scrollHeight={scrollHeight}
|
|
297
|
+
/>
|
|
291
298
|
</div>
|
|
292
|
-
<ScrollBar
|
|
293
|
-
containerHeight={containerHeight}
|
|
294
|
-
scrollHeight={scrollHeight}
|
|
295
|
-
/>
|
|
296
299
|
</div>
|
|
297
300
|
</div>
|
|
298
|
-
</
|
|
299
|
-
|
|
301
|
+
</DebuggerContext.Provider>
|
|
302
|
+
),
|
|
303
|
+
document.body
|
|
300
304
|
);
|
|
301
305
|
}
|