react-state-inspector-devtools 1.0.3 → 1.1.2
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/README.md +57 -90
- package/dist/index.css +156 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +612 -264
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +598 -250
- package/dist/index.mjs.map +1 -1
- package/package.json +32 -40
package/dist/index.mjs
CHANGED
|
@@ -189,7 +189,7 @@ function useComponentLabel(label) {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
// src/StateInspectorUI.tsx
|
|
192
|
-
import { useEffect as useEffect4, useMemo as useMemo3, useRef as useRef2, useState as
|
|
192
|
+
import { useEffect as useEffect4, useMemo as useMemo3, useRef as useRef2, useState as useState4 } from "react";
|
|
193
193
|
import { createPortal } from "react-dom";
|
|
194
194
|
|
|
195
195
|
// src/ui/constants.ts
|
|
@@ -248,38 +248,73 @@ function safeStringify(v) {
|
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
// src/ui/icons/DevtoolsIcon.tsx
|
|
252
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
253
|
+
var DevtoolsIcon = (props) => {
|
|
254
|
+
return /* @__PURE__ */ jsxs(
|
|
255
|
+
"svg",
|
|
256
|
+
{
|
|
257
|
+
width: "12",
|
|
258
|
+
height: "12",
|
|
259
|
+
viewBox: "0 0 12 12",
|
|
260
|
+
fill: "none",
|
|
261
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
262
|
+
...props,
|
|
263
|
+
children: [
|
|
264
|
+
/* @__PURE__ */ jsx2("g", { clipPath: "url(#clip0_1_13)", children: /* @__PURE__ */ jsx2(
|
|
265
|
+
"path",
|
|
266
|
+
{
|
|
267
|
+
d: "M2 7.00002C1.90538 7.00034 1.81262 6.97381 1.73248 6.92351C1.65234 6.87321 1.58812 6.8012 1.54727 6.71585C1.50643 6.6305 1.49065 6.53531 1.50175 6.44135C1.51285 6.34739 1.55039 6.2585 1.61 6.18502L6.56 1.08502C6.59713 1.04216 6.64773 1.0132 6.70349 1.00289C6.75925 0.992575 6.81686 1.00153 6.86687 1.02827C6.91687 1.05502 6.95629 1.09797 6.97867 1.15007C7.00104 1.20218 7.00504 1.26034 6.99 1.31502L6.03 4.32502C6.00169 4.40078 5.99219 4.48228 6.0023 4.56252C6.01241 4.64277 6.04183 4.71936 6.08805 4.78573C6.13426 4.85211 6.19589 4.90628 6.26764 4.9436C6.33939 4.98092 6.41912 5.00028 6.5 5.00002H10C10.0946 4.9997 10.1874 5.02623 10.2675 5.07653C10.3477 5.12683 10.4119 5.19884 10.4527 5.28419C10.4936 5.36954 10.5094 5.46473 10.4983 5.55869C10.4871 5.65266 10.4496 5.74154 10.39 5.81502L5.44 10.915C5.40287 10.9579 5.35227 10.9868 5.29651 10.9972C5.24075 11.0075 5.18314 10.9985 5.13313 10.9718C5.08313 10.945 5.04371 10.9021 5.02133 10.85C4.99896 10.7979 4.99496 10.7397 5.01 10.685L5.97 7.67502C5.99831 7.59926 6.00781 7.51776 5.9977 7.43752C5.98759 7.35727 5.95817 7.28068 5.91195 7.21431C5.86574 7.14793 5.80411 7.09376 5.73236 7.05644C5.66061 7.01912 5.58088 6.99976 5.5 7.00002H2Z",
|
|
268
|
+
fill: "inherit",
|
|
269
|
+
stroke: "inherit",
|
|
270
|
+
strokeLinecap: "round",
|
|
271
|
+
strokeLinejoin: "round"
|
|
272
|
+
}
|
|
273
|
+
) }),
|
|
274
|
+
/* @__PURE__ */ jsx2("defs", { children: /* @__PURE__ */ jsx2("clipPath", { id: "clip0_1_13", children: /* @__PURE__ */ jsx2("rect", { width: "12", height: "12", fill: "white" }) }) })
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
};
|
|
279
|
+
var DevtoolsIcon_default = DevtoolsIcon;
|
|
280
|
+
|
|
251
281
|
// src/ui/components/FloatingButton.tsx
|
|
252
|
-
import { jsx as
|
|
253
|
-
function FloatingButton({ onClick }) {
|
|
254
|
-
return /* @__PURE__ */
|
|
282
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
283
|
+
function FloatingButton({ onClick, isActive }) {
|
|
284
|
+
return /* @__PURE__ */ jsx3(
|
|
255
285
|
"button",
|
|
256
286
|
{
|
|
287
|
+
"data-rsi-floating-button": true,
|
|
257
288
|
title: "State Inspector (\u2318\u21E7I / Ctrl\u21E7I)",
|
|
258
289
|
onClick,
|
|
259
290
|
style: {
|
|
260
291
|
position: "fixed",
|
|
261
292
|
right: 16,
|
|
262
293
|
bottom: 16,
|
|
263
|
-
width:
|
|
264
|
-
height:
|
|
265
|
-
borderRadius:
|
|
294
|
+
width: 48,
|
|
295
|
+
height: 48,
|
|
296
|
+
borderRadius: 24,
|
|
266
297
|
border: "none",
|
|
267
|
-
background: "#111",
|
|
298
|
+
background: isActive ? "#155DFC" : "#111",
|
|
268
299
|
color: "#fff",
|
|
269
300
|
cursor: "pointer",
|
|
270
|
-
zIndex: 999999
|
|
301
|
+
zIndex: 999999,
|
|
302
|
+
padding: 0,
|
|
303
|
+
display: "flex",
|
|
304
|
+
alignItems: "center",
|
|
305
|
+
justifyContent: "center"
|
|
271
306
|
},
|
|
272
307
|
"aria-label": "Toggle State Inspector",
|
|
273
|
-
children: "
|
|
308
|
+
children: /* @__PURE__ */ jsx3(DevtoolsIcon_default, { fill: isActive ? "#FFF" : void 0, stroke: "#FFF", height: 20, width: 20 })
|
|
274
309
|
}
|
|
275
310
|
);
|
|
276
311
|
}
|
|
277
312
|
|
|
278
313
|
// src/ui/components/DockPreviewOverlay.tsx
|
|
279
|
-
import { jsx as
|
|
314
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
280
315
|
function DockPreviewOverlay({ preview }) {
|
|
281
316
|
if (!preview) return null;
|
|
282
|
-
return /* @__PURE__ */
|
|
317
|
+
return /* @__PURE__ */ jsx4(
|
|
283
318
|
"div",
|
|
284
319
|
{
|
|
285
320
|
style: {
|
|
@@ -288,26 +323,66 @@ function DockPreviewOverlay({ preview }) {
|
|
|
288
323
|
pointerEvents: "none",
|
|
289
324
|
zIndex: 999998
|
|
290
325
|
},
|
|
291
|
-
children: /* @__PURE__ */
|
|
326
|
+
children: /* @__PURE__ */ jsx4("div", { style: previewRectStyle(preview) })
|
|
292
327
|
}
|
|
293
328
|
);
|
|
294
329
|
}
|
|
295
330
|
|
|
296
331
|
// src/ui/components/ResizeHandle.tsx
|
|
297
|
-
import { jsx as
|
|
298
|
-
|
|
299
|
-
|
|
332
|
+
import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
|
|
333
|
+
var EDGE_SIZE = 6;
|
|
334
|
+
var CORNER_SIZE = 12;
|
|
335
|
+
var handleConfigs = {
|
|
336
|
+
// Edges
|
|
337
|
+
top: { top: 0, left: CORNER_SIZE, right: CORNER_SIZE, height: EDGE_SIZE, cursor: "ns-resize" },
|
|
338
|
+
bottom: {
|
|
339
|
+
bottom: 0,
|
|
340
|
+
left: CORNER_SIZE,
|
|
341
|
+
right: CORNER_SIZE,
|
|
342
|
+
height: EDGE_SIZE,
|
|
343
|
+
cursor: "ns-resize"
|
|
344
|
+
},
|
|
345
|
+
left: { left: 0, top: CORNER_SIZE, bottom: CORNER_SIZE, width: EDGE_SIZE, cursor: "ew-resize" },
|
|
346
|
+
right: { right: 0, top: CORNER_SIZE, bottom: CORNER_SIZE, width: EDGE_SIZE, cursor: "ew-resize" },
|
|
347
|
+
// Corners
|
|
348
|
+
"top-left": { top: 0, left: 0, width: CORNER_SIZE, height: CORNER_SIZE, cursor: "nwse-resize" },
|
|
349
|
+
"top-right": { top: 0, right: 0, width: CORNER_SIZE, height: CORNER_SIZE, cursor: "nesw-resize" },
|
|
350
|
+
"bottom-left": {
|
|
351
|
+
bottom: 0,
|
|
352
|
+
left: 0,
|
|
353
|
+
width: CORNER_SIZE,
|
|
354
|
+
height: CORNER_SIZE,
|
|
355
|
+
cursor: "nesw-resize"
|
|
356
|
+
},
|
|
357
|
+
"bottom-right": {
|
|
358
|
+
bottom: 0,
|
|
359
|
+
right: 0,
|
|
360
|
+
width: CORNER_SIZE,
|
|
361
|
+
height: CORNER_SIZE,
|
|
362
|
+
cursor: "nwse-resize"
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
function Handle({
|
|
366
|
+
direction,
|
|
367
|
+
onResize
|
|
368
|
+
}) {
|
|
369
|
+
const config = handleConfigs[direction];
|
|
370
|
+
return /* @__PURE__ */ jsx5(
|
|
300
371
|
"div",
|
|
301
372
|
{
|
|
302
373
|
onPointerDown: (e) => {
|
|
374
|
+
e.stopPropagation();
|
|
303
375
|
const startX = e.clientX;
|
|
304
376
|
const startY = e.clientY;
|
|
305
377
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
306
378
|
const onMove = (ev) => {
|
|
307
|
-
onResize(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
379
|
+
onResize(
|
|
380
|
+
{
|
|
381
|
+
dx: ev.clientX - startX,
|
|
382
|
+
dy: ev.clientY - startY
|
|
383
|
+
},
|
|
384
|
+
direction
|
|
385
|
+
);
|
|
311
386
|
};
|
|
312
387
|
const onUp = () => {
|
|
313
388
|
window.removeEventListener("pointermove", onMove);
|
|
@@ -318,24 +393,38 @@ function ResizeHandle({ onResize }) {
|
|
|
318
393
|
},
|
|
319
394
|
style: {
|
|
320
395
|
position: "absolute",
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
396
|
+
top: config.top,
|
|
397
|
+
right: config.right,
|
|
398
|
+
bottom: config.bottom,
|
|
399
|
+
left: config.left,
|
|
400
|
+
width: config.width,
|
|
401
|
+
height: config.height,
|
|
402
|
+
cursor: config.cursor,
|
|
403
|
+
background: "transparent",
|
|
404
|
+
zIndex: 10
|
|
329
405
|
}
|
|
330
406
|
}
|
|
331
407
|
);
|
|
332
408
|
}
|
|
409
|
+
var directions = [
|
|
410
|
+
"top",
|
|
411
|
+
"right",
|
|
412
|
+
"bottom",
|
|
413
|
+
"left",
|
|
414
|
+
"top-left",
|
|
415
|
+
"top-right",
|
|
416
|
+
"bottom-left",
|
|
417
|
+
"bottom-right"
|
|
418
|
+
];
|
|
419
|
+
function ResizeHandle({ onResize }) {
|
|
420
|
+
return /* @__PURE__ */ jsx5(Fragment, { children: directions.map((dir) => /* @__PURE__ */ jsx5(Handle, { direction: dir, onResize }, dir)) });
|
|
421
|
+
}
|
|
333
422
|
|
|
334
423
|
// src/ui/components/SidebarResizer.tsx
|
|
335
|
-
import { jsx as
|
|
424
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
336
425
|
function SidebarResizer({ leftWidth, onWidthChange, hidden }) {
|
|
337
426
|
if (hidden) return null;
|
|
338
|
-
return /* @__PURE__ */
|
|
427
|
+
return /* @__PURE__ */ jsx6(
|
|
339
428
|
"div",
|
|
340
429
|
{
|
|
341
430
|
onPointerDown: (e) => {
|
|
@@ -368,67 +457,131 @@ function SidebarResizer({ leftWidth, onWidthChange, hidden }) {
|
|
|
368
457
|
}
|
|
369
458
|
|
|
370
459
|
// src/ui/components/DragHandle.tsx
|
|
371
|
-
import {
|
|
460
|
+
import { useState as useState2 } from "react";
|
|
461
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
372
462
|
function DragHandle({ children, onDragStart, onDragEnd, style }) {
|
|
373
|
-
|
|
463
|
+
const [isDragging, setIsDragging] = useState2(false);
|
|
464
|
+
return /* @__PURE__ */ jsx7(
|
|
374
465
|
"div",
|
|
375
466
|
{
|
|
376
|
-
style: { cursor: "grab", userSelect: "none", ...style },
|
|
377
|
-
onPointerDown:
|
|
378
|
-
|
|
467
|
+
style: { cursor: isDragging ? "grabbing" : "grab", userSelect: "none", ...style },
|
|
468
|
+
onPointerDown: (e) => {
|
|
469
|
+
const target = e.target;
|
|
470
|
+
try {
|
|
471
|
+
if (target && typeof target.closest === "function" && target.closest('button, input, textarea, a, [role="button"], [data-no-drag]')) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
} catch (e2) {
|
|
475
|
+
console.error(e2);
|
|
476
|
+
}
|
|
477
|
+
setIsDragging(true);
|
|
478
|
+
onDragStart(e);
|
|
479
|
+
},
|
|
480
|
+
onPointerUp: () => {
|
|
481
|
+
if (isDragging) {
|
|
482
|
+
setIsDragging(false);
|
|
483
|
+
onDragEnd();
|
|
484
|
+
}
|
|
485
|
+
},
|
|
379
486
|
children
|
|
380
487
|
}
|
|
381
488
|
);
|
|
382
489
|
}
|
|
383
490
|
|
|
491
|
+
// src/ui/styles.ts
|
|
492
|
+
var inputStyle = {
|
|
493
|
+
padding: "8px 10px",
|
|
494
|
+
borderRadius: 4,
|
|
495
|
+
border: "none",
|
|
496
|
+
background: "#18181B",
|
|
497
|
+
color: "#fff",
|
|
498
|
+
minWidth: 120
|
|
499
|
+
};
|
|
500
|
+
var cardStyle = {
|
|
501
|
+
border: "1px solid rgba(39, 39, 42, 0.30)",
|
|
502
|
+
borderRadius: 12,
|
|
503
|
+
padding: 10
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
// src/ui/components/SearchInput.tsx
|
|
507
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
508
|
+
function SearchInput({ value, onChange, inputRef }) {
|
|
509
|
+
return /* @__PURE__ */ jsx8(
|
|
510
|
+
"input",
|
|
511
|
+
{
|
|
512
|
+
value,
|
|
513
|
+
onChange: (e) => onChange(e.target.value),
|
|
514
|
+
placeholder: "Filter\u2026",
|
|
515
|
+
ref: inputRef,
|
|
516
|
+
style: {
|
|
517
|
+
...inputStyle,
|
|
518
|
+
outline: "none"
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
|
|
384
524
|
// src/ui/components/ComponentList.tsx
|
|
385
|
-
import { jsx as
|
|
525
|
+
import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
386
526
|
function ComponentList({
|
|
387
527
|
components,
|
|
388
528
|
selectedId,
|
|
389
529
|
onSelect,
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
530
|
+
hidden,
|
|
531
|
+
query,
|
|
532
|
+
onQueryChange,
|
|
533
|
+
searchRef
|
|
394
534
|
}) {
|
|
395
535
|
if (hidden) return null;
|
|
396
|
-
return /* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
398
|
-
|
|
536
|
+
return /* @__PURE__ */ jsxs2("div", { style: { padding: 4, boxSizing: "border-box", backgroundColor: "#09090B" }, children: [
|
|
537
|
+
/* @__PURE__ */ jsx9(
|
|
538
|
+
"div",
|
|
399
539
|
{
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
540
|
+
style: {
|
|
541
|
+
display: "flex",
|
|
542
|
+
flexDirection: "column",
|
|
543
|
+
paddingTop: 4,
|
|
544
|
+
paddingBottom: 8,
|
|
545
|
+
paddingLeft: 4,
|
|
546
|
+
paddingRight: 4
|
|
547
|
+
},
|
|
548
|
+
children: /* @__PURE__ */ jsx9(SearchInput, { value: query, onChange: onQueryChange, inputRef: searchRef })
|
|
407
549
|
}
|
|
408
550
|
),
|
|
409
|
-
/* @__PURE__ */
|
|
551
|
+
/* @__PURE__ */ jsx9("div", { style: { display: "flex", flexDirection: "column", gap: 2, overflow: "auto", flex: 1 }, children: components.map((c) => {
|
|
410
552
|
const active = c.id === selectedId;
|
|
411
|
-
return /* @__PURE__ */
|
|
553
|
+
return /* @__PURE__ */ jsxs2(
|
|
412
554
|
"button",
|
|
413
555
|
{
|
|
414
556
|
id: `rsi-comp-${c.id}`,
|
|
415
557
|
onClick: () => onSelect(c.id),
|
|
416
558
|
style: {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
cursor: "pointer",
|
|
424
|
-
flex: "none"
|
|
559
|
+
display: "flex",
|
|
560
|
+
justifyContent: "space-between",
|
|
561
|
+
alignItems: "center",
|
|
562
|
+
padding: 8,
|
|
563
|
+
backgroundColor: active ? "#27272A" : "transparent",
|
|
564
|
+
border: "none"
|
|
425
565
|
},
|
|
426
566
|
children: [
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
-
/* @__PURE__ */
|
|
429
|
-
"
|
|
430
|
-
|
|
431
|
-
|
|
567
|
+
/* @__PURE__ */ jsx9("div", { style: { fontWeight: 500, fontSize: 12, color: active ? "#fff" : "#9F9FA9" }, children: c.label }),
|
|
568
|
+
/* @__PURE__ */ jsx9(
|
|
569
|
+
"div",
|
|
570
|
+
{
|
|
571
|
+
style: {
|
|
572
|
+
fontSize: 9,
|
|
573
|
+
height: 16,
|
|
574
|
+
width: 16,
|
|
575
|
+
color: "#D4D4D8",
|
|
576
|
+
display: "flex",
|
|
577
|
+
alignItems: "center",
|
|
578
|
+
justifyContent: "center",
|
|
579
|
+
borderRadius: 8,
|
|
580
|
+
backgroundColor: "#3F3F47"
|
|
581
|
+
},
|
|
582
|
+
children: c.stateKeys.length
|
|
583
|
+
}
|
|
584
|
+
)
|
|
432
585
|
]
|
|
433
586
|
},
|
|
434
587
|
c.id
|
|
@@ -438,17 +591,14 @@ function ComponentList({
|
|
|
438
591
|
}
|
|
439
592
|
|
|
440
593
|
// src/ui/components/StatePanelHeader.tsx
|
|
441
|
-
import { jsx as
|
|
594
|
+
import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
442
595
|
function StatePanelHeader({
|
|
443
596
|
selectedLabel,
|
|
444
597
|
leftCollapsed,
|
|
445
|
-
onToggleCollapse
|
|
446
|
-
onClose,
|
|
447
|
-
onDragStart,
|
|
448
|
-
onDragEnd
|
|
598
|
+
onToggleCollapse
|
|
449
599
|
}) {
|
|
450
|
-
return /* @__PURE__ */
|
|
451
|
-
/* @__PURE__ */
|
|
600
|
+
return /* @__PURE__ */ jsxs3("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
601
|
+
/* @__PURE__ */ jsx10(
|
|
452
602
|
"button",
|
|
453
603
|
{
|
|
454
604
|
onClick: (e) => {
|
|
@@ -470,77 +620,16 @@ function StatePanelHeader({
|
|
|
470
620
|
children: leftCollapsed ? "\xBB" : "\xAB"
|
|
471
621
|
}
|
|
472
622
|
),
|
|
473
|
-
/* @__PURE__ */
|
|
474
|
-
DragHandle,
|
|
475
|
-
{
|
|
476
|
-
onDragStart,
|
|
477
|
-
onDragEnd,
|
|
478
|
-
style: { display: "flex", flexDirection: "column", flex: 1 },
|
|
479
|
-
children: [
|
|
480
|
-
/* @__PURE__ */ jsx8("h4", { style: { margin: 0 }, children: "State" }),
|
|
481
|
-
/* @__PURE__ */ jsx8("div", { style: { fontSize: 12, opacity: 0.7 }, children: selectedLabel ?? "No selection" })
|
|
482
|
-
]
|
|
483
|
-
}
|
|
484
|
-
),
|
|
485
|
-
/* @__PURE__ */ jsx8(
|
|
486
|
-
"button",
|
|
487
|
-
{
|
|
488
|
-
onClick: onClose,
|
|
489
|
-
style: {
|
|
490
|
-
background: "transparent",
|
|
491
|
-
color: "#fff",
|
|
492
|
-
border: "1px solid #333",
|
|
493
|
-
borderRadius: 10,
|
|
494
|
-
padding: "6px 10px",
|
|
495
|
-
cursor: "pointer",
|
|
496
|
-
fontSize: 12,
|
|
497
|
-
marginLeft: "auto"
|
|
498
|
-
},
|
|
499
|
-
children: "Close"
|
|
500
|
-
}
|
|
501
|
-
)
|
|
623
|
+
/* @__PURE__ */ jsx10("h4", { style: { margin: 0 }, children: selectedLabel ?? "No selection" })
|
|
502
624
|
] });
|
|
503
625
|
}
|
|
504
626
|
|
|
505
|
-
// src/ui/styles.ts
|
|
506
|
-
var inputStyle = {
|
|
507
|
-
padding: "8px 10px",
|
|
508
|
-
borderRadius: 10,
|
|
509
|
-
border: "1px solid #333",
|
|
510
|
-
background: "#111",
|
|
511
|
-
color: "#fff"
|
|
512
|
-
};
|
|
513
|
-
var cardStyle = {
|
|
514
|
-
border: "1px solid #333",
|
|
515
|
-
borderRadius: 12,
|
|
516
|
-
padding: 10
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
// src/ui/components/SearchInput.tsx
|
|
520
|
-
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
521
|
-
function SearchInput({ value, onChange, inputRef }) {
|
|
522
|
-
return /* @__PURE__ */ jsx9(
|
|
523
|
-
"input",
|
|
524
|
-
{
|
|
525
|
-
value,
|
|
526
|
-
onChange: (e) => onChange(e.target.value),
|
|
527
|
-
placeholder: "Search components / state keys\u2026",
|
|
528
|
-
ref: inputRef,
|
|
529
|
-
style: {
|
|
530
|
-
...inputStyle,
|
|
531
|
-
marginTop: 10,
|
|
532
|
-
outline: "none"
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
627
|
// src/ui/components/JsonEditor.tsx
|
|
539
|
-
import { useEffect as useEffect3, useState as
|
|
540
|
-
import { jsx as
|
|
628
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
629
|
+
import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
541
630
|
function JsonEditor({ initial, onValidJson }) {
|
|
542
|
-
const [raw, setRaw] =
|
|
543
|
-
const [error, setError] =
|
|
631
|
+
const [raw, setRaw] = useState3(initial);
|
|
632
|
+
const [error, setError] = useState3(null);
|
|
544
633
|
useEffect3(() => {
|
|
545
634
|
setRaw(initial);
|
|
546
635
|
}, [initial]);
|
|
@@ -555,8 +644,8 @@ function JsonEditor({ initial, onValidJson }) {
|
|
|
555
644
|
setError("Invalid JSON");
|
|
556
645
|
}
|
|
557
646
|
};
|
|
558
|
-
return /* @__PURE__ */
|
|
559
|
-
/* @__PURE__ */
|
|
647
|
+
return /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gap: 6 }, children: [
|
|
648
|
+
/* @__PURE__ */ jsx11(
|
|
560
649
|
"textarea",
|
|
561
650
|
{
|
|
562
651
|
value: raw,
|
|
@@ -570,16 +659,16 @@ function JsonEditor({ initial, onValidJson }) {
|
|
|
570
659
|
}
|
|
571
660
|
}
|
|
572
661
|
),
|
|
573
|
-
error && /* @__PURE__ */
|
|
662
|
+
error && /* @__PURE__ */ jsx11("div", { style: { fontSize: 12, color: "#ff6b6b" }, children: error })
|
|
574
663
|
] });
|
|
575
664
|
}
|
|
576
665
|
|
|
577
666
|
// src/ui/components/StateEditor.tsx
|
|
578
|
-
import { jsx as
|
|
667
|
+
import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
579
668
|
function StateEditor({ value, meta, onChange }) {
|
|
580
669
|
if (meta?.type === "boolean" || typeof value === "boolean") {
|
|
581
|
-
return /* @__PURE__ */
|
|
582
|
-
/* @__PURE__ */
|
|
670
|
+
return /* @__PURE__ */ jsxs5("label", { style: { display: "flex", gap: 10, alignItems: "center" }, children: [
|
|
671
|
+
/* @__PURE__ */ jsx12(
|
|
583
672
|
"input",
|
|
584
673
|
{
|
|
585
674
|
type: "checkbox",
|
|
@@ -587,26 +676,29 @@ function StateEditor({ value, meta, onChange }) {
|
|
|
587
676
|
onChange: (e) => onChange(e.target.checked)
|
|
588
677
|
}
|
|
589
678
|
),
|
|
590
|
-
/* @__PURE__ */
|
|
679
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: 13, opacity: 0.8 }, children: String(Boolean(value)) })
|
|
591
680
|
] });
|
|
592
681
|
}
|
|
593
682
|
if (meta?.type === "select" && Array.isArray(meta.options)) {
|
|
594
683
|
const current = typeof value === "string" ? value : String(value ?? "");
|
|
595
|
-
return /* @__PURE__ */
|
|
684
|
+
return /* @__PURE__ */ jsx12(
|
|
596
685
|
"select",
|
|
597
686
|
{
|
|
598
687
|
value: current,
|
|
599
688
|
onChange: (e) => onChange(e.target.value),
|
|
600
|
-
style:
|
|
689
|
+
style: {
|
|
690
|
+
...inputStyle,
|
|
691
|
+
minWidth: 120
|
|
692
|
+
},
|
|
601
693
|
children: meta.options.map((opt) => {
|
|
602
694
|
const o = isOptionObject(opt) ? opt : { label: String(opt), value: String(opt) };
|
|
603
|
-
return /* @__PURE__ */
|
|
695
|
+
return /* @__PURE__ */ jsx12("option", { value: o.value, children: o.label }, o.value);
|
|
604
696
|
})
|
|
605
697
|
}
|
|
606
698
|
);
|
|
607
699
|
}
|
|
608
700
|
if (meta?.type === "number") {
|
|
609
|
-
return /* @__PURE__ */
|
|
701
|
+
return /* @__PURE__ */ jsx12(
|
|
610
702
|
"input",
|
|
611
703
|
{
|
|
612
704
|
type: "number",
|
|
@@ -620,9 +712,9 @@ function StateEditor({ value, meta, onChange }) {
|
|
|
620
712
|
);
|
|
621
713
|
}
|
|
622
714
|
if (meta?.type === "json" || value && typeof value === "object") {
|
|
623
|
-
return /* @__PURE__ */
|
|
715
|
+
return /* @__PURE__ */ jsx12(JsonEditor, { initial: safeStringify(value), onValidJson: onChange });
|
|
624
716
|
}
|
|
625
|
-
return /* @__PURE__ */
|
|
717
|
+
return /* @__PURE__ */ jsx12(
|
|
626
718
|
"input",
|
|
627
719
|
{
|
|
628
720
|
type: "text",
|
|
@@ -635,23 +727,35 @@ function StateEditor({ value, meta, onChange }) {
|
|
|
635
727
|
}
|
|
636
728
|
|
|
637
729
|
// src/ui/components/StateCard.tsx
|
|
638
|
-
import { jsx as
|
|
730
|
+
import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
639
731
|
function StateCard({ state }) {
|
|
640
|
-
return /* @__PURE__ */
|
|
732
|
+
return /* @__PURE__ */ jsxs6(
|
|
641
733
|
"div",
|
|
642
734
|
{
|
|
643
735
|
style: {
|
|
644
736
|
...cardStyle,
|
|
645
737
|
display: "flex",
|
|
646
|
-
flexDirection: "
|
|
738
|
+
flexDirection: "row",
|
|
739
|
+
justifyContent: "space-between",
|
|
647
740
|
gap: 8
|
|
648
741
|
},
|
|
649
742
|
children: [
|
|
650
|
-
/* @__PURE__ */
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
743
|
+
/* @__PURE__ */ jsxs6(
|
|
744
|
+
"div",
|
|
745
|
+
{
|
|
746
|
+
style: {
|
|
747
|
+
display: "flex",
|
|
748
|
+
flexDirection: "column",
|
|
749
|
+
justifyContent: "space-between",
|
|
750
|
+
gap: 1
|
|
751
|
+
},
|
|
752
|
+
children: [
|
|
753
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 14 }, children: state.key }),
|
|
754
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 12, color: "#52525C", textTransform: "uppercase" }, children: state.meta?.type ?? "auto" })
|
|
755
|
+
]
|
|
756
|
+
}
|
|
757
|
+
),
|
|
758
|
+
/* @__PURE__ */ jsx13(
|
|
655
759
|
StateEditor,
|
|
656
760
|
{
|
|
657
761
|
value: state.value,
|
|
@@ -665,60 +769,258 @@ function StateCard({ state }) {
|
|
|
665
769
|
}
|
|
666
770
|
|
|
667
771
|
// src/ui/components/StateEditorPanel.tsx
|
|
668
|
-
import { jsx as
|
|
772
|
+
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
669
773
|
function StateEditorPanel({
|
|
670
774
|
selected,
|
|
671
|
-
query,
|
|
672
|
-
onQueryChange,
|
|
673
|
-
searchRef,
|
|
674
775
|
leftCollapsed,
|
|
675
|
-
onToggleCollapse
|
|
676
|
-
onClose,
|
|
677
|
-
onDragStart,
|
|
678
|
-
onDragEnd
|
|
776
|
+
onToggleCollapse
|
|
679
777
|
}) {
|
|
680
|
-
return /* @__PURE__ */
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
{
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
778
|
+
return /* @__PURE__ */ jsxs7(
|
|
779
|
+
"div",
|
|
780
|
+
{
|
|
781
|
+
style: {
|
|
782
|
+
padding: 12,
|
|
783
|
+
overflow: "auto",
|
|
784
|
+
display: "flex",
|
|
785
|
+
flexDirection: "column",
|
|
786
|
+
boxSizing: "border-box",
|
|
787
|
+
backgroundColor: "#0C0C0E"
|
|
788
|
+
},
|
|
789
|
+
children: [
|
|
790
|
+
/* @__PURE__ */ jsx14(
|
|
791
|
+
StatePanelHeader,
|
|
792
|
+
{
|
|
793
|
+
selectedLabel: selected?.label ?? null,
|
|
794
|
+
leftCollapsed,
|
|
795
|
+
onToggleCollapse
|
|
796
|
+
}
|
|
797
|
+
),
|
|
798
|
+
/* @__PURE__ */ jsxs7("div", { style: { marginTop: 12, display: "grid", gap: 10 }, children: [
|
|
799
|
+
selected && selected.states.size === 0 && /* @__PURE__ */ jsx14("div", { style: { fontSize: 13, opacity: 0.7 }, children: "This component has no inspectable state." }),
|
|
800
|
+
!selected && /* @__PURE__ */ jsx14("div", { style: { opacity: 0.7, fontSize: 13 }, children: "No component selected." }),
|
|
801
|
+
selected && Array.from(selected.states.values()).map((s) => /* @__PURE__ */ jsx14(StateCard, { state: s }, s.key))
|
|
802
|
+
] })
|
|
803
|
+
]
|
|
804
|
+
}
|
|
805
|
+
);
|
|
706
806
|
}
|
|
707
807
|
|
|
808
|
+
// src/ui/icons/DragIcon.tsx
|
|
809
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
810
|
+
var DragIcon = (props) => {
|
|
811
|
+
return /* @__PURE__ */ jsxs8(
|
|
812
|
+
"svg",
|
|
813
|
+
{
|
|
814
|
+
width: "16",
|
|
815
|
+
height: "16",
|
|
816
|
+
viewBox: "0 0 16 16",
|
|
817
|
+
fill: "none",
|
|
818
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
819
|
+
...props,
|
|
820
|
+
children: [
|
|
821
|
+
/* @__PURE__ */ jsx15(
|
|
822
|
+
"path",
|
|
823
|
+
{
|
|
824
|
+
d: "M7.99998 6.66665C8.36817 6.66665 8.66665 6.36817 8.66665 5.99998C8.66665 5.63179 8.36817 5.33331 7.99998 5.33331C7.63179 5.33331 7.33331 5.63179 7.33331 5.99998C7.33331 6.36817 7.63179 6.66665 7.99998 6.66665Z",
|
|
825
|
+
stroke: "#3F3F46",
|
|
826
|
+
strokeWidth: 1.33333,
|
|
827
|
+
strokeLinecap: "round",
|
|
828
|
+
strokeLinejoin: "round"
|
|
829
|
+
}
|
|
830
|
+
),
|
|
831
|
+
/* @__PURE__ */ jsx15(
|
|
832
|
+
"path",
|
|
833
|
+
{
|
|
834
|
+
d: "M12.6667 6.66665C13.0349 6.66665 13.3333 6.36817 13.3333 5.99998C13.3333 5.63179 13.0349 5.33331 12.6667 5.33331C12.2985 5.33331 12 5.63179 12 5.99998C12 6.36817 12.2985 6.66665 12.6667 6.66665Z",
|
|
835
|
+
stroke: "#3F3F46",
|
|
836
|
+
strokeWidth: 1.33333,
|
|
837
|
+
strokeLinecap: "round",
|
|
838
|
+
strokeLinejoin: "round"
|
|
839
|
+
}
|
|
840
|
+
),
|
|
841
|
+
/* @__PURE__ */ jsx15(
|
|
842
|
+
"path",
|
|
843
|
+
{
|
|
844
|
+
d: "M3.33335 6.66665C3.70154 6.66665 4.00002 6.36817 4.00002 5.99998C4.00002 5.63179 3.70154 5.33331 3.33335 5.33331C2.96516 5.33331 2.66669 5.63179 2.66669 5.99998C2.66669 6.36817 2.96516 6.66665 3.33335 6.66665Z",
|
|
845
|
+
stroke: "#3F3F46",
|
|
846
|
+
strokeWidth: 1.33333,
|
|
847
|
+
strokeLinecap: "round",
|
|
848
|
+
strokeLinejoin: "round"
|
|
849
|
+
}
|
|
850
|
+
),
|
|
851
|
+
/* @__PURE__ */ jsx15(
|
|
852
|
+
"path",
|
|
853
|
+
{
|
|
854
|
+
d: "M7.99998 10.6666C8.36817 10.6666 8.66665 10.3682 8.66665 9.99998C8.66665 9.63179 8.36817 9.33331 7.99998 9.33331C7.63179 9.33331 7.33331 9.63179 7.33331 9.99998C7.33331 10.3682 7.63179 10.6666 7.99998 10.6666Z",
|
|
855
|
+
stroke: "#3F3F46",
|
|
856
|
+
strokeWidth: 1.33333,
|
|
857
|
+
strokeLinecap: "round",
|
|
858
|
+
strokeLinejoin: "round"
|
|
859
|
+
}
|
|
860
|
+
),
|
|
861
|
+
/* @__PURE__ */ jsx15(
|
|
862
|
+
"path",
|
|
863
|
+
{
|
|
864
|
+
d: "M12.6667 10.6666C13.0349 10.6666 13.3333 10.3682 13.3333 9.99998C13.3333 9.63179 13.0349 9.33331 12.6667 9.33331C12.2985 9.33331 12 9.63179 12 9.99998C12 10.3682 12.2985 10.6666 12.6667 10.6666Z",
|
|
865
|
+
stroke: "#3F3F46",
|
|
866
|
+
strokeWidth: 1.33333,
|
|
867
|
+
strokeLinecap: "round",
|
|
868
|
+
strokeLinejoin: "round"
|
|
869
|
+
}
|
|
870
|
+
),
|
|
871
|
+
/* @__PURE__ */ jsx15(
|
|
872
|
+
"path",
|
|
873
|
+
{
|
|
874
|
+
d: "M3.33335 10.6666C3.70154 10.6666 4.00002 10.3682 4.00002 9.99998C4.00002 9.63179 3.70154 9.33331 3.33335 9.33331C2.96516 9.33331 2.66669 9.63179 2.66669 9.99998C2.66669 10.3682 2.96516 10.6666 3.33335 10.6666Z",
|
|
875
|
+
stroke: "#3F3F46",
|
|
876
|
+
strokeWidth: 1.33333,
|
|
877
|
+
strokeLinecap: "round",
|
|
878
|
+
strokeLinejoin: "round"
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
);
|
|
884
|
+
};
|
|
885
|
+
var DragIcon_default = DragIcon;
|
|
886
|
+
|
|
887
|
+
// src/ui/icons/CloseIcon.tsx
|
|
888
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
889
|
+
var CloseIcon = (props) => {
|
|
890
|
+
return /* @__PURE__ */ jsxs9(
|
|
891
|
+
"svg",
|
|
892
|
+
{
|
|
893
|
+
width: "14",
|
|
894
|
+
height: "14",
|
|
895
|
+
viewBox: "0 0 14 14",
|
|
896
|
+
fill: "none",
|
|
897
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
898
|
+
...props,
|
|
899
|
+
children: [
|
|
900
|
+
/* @__PURE__ */ jsx16(
|
|
901
|
+
"path",
|
|
902
|
+
{
|
|
903
|
+
d: "M10.5 3.5L3.5 10.5",
|
|
904
|
+
stroke: "#71717B",
|
|
905
|
+
strokeWidth: 1.16667,
|
|
906
|
+
strokeLinecap: "round",
|
|
907
|
+
strokeLinejoin: "round"
|
|
908
|
+
}
|
|
909
|
+
),
|
|
910
|
+
/* @__PURE__ */ jsx16(
|
|
911
|
+
"path",
|
|
912
|
+
{
|
|
913
|
+
d: "M3.5 3.5L10.5 10.5",
|
|
914
|
+
stroke: "#71717B",
|
|
915
|
+
strokeWidth: 1.16667,
|
|
916
|
+
strokeLinecap: "round",
|
|
917
|
+
strokeLinejoin: "round"
|
|
918
|
+
}
|
|
919
|
+
)
|
|
920
|
+
]
|
|
921
|
+
}
|
|
922
|
+
);
|
|
923
|
+
};
|
|
924
|
+
var CloseIcon_default = CloseIcon;
|
|
925
|
+
|
|
926
|
+
// src/ui/components/DockHeader.tsx
|
|
927
|
+
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
928
|
+
var DockHeader = ({ setOpen, handleDragStart, handleDragEnd }) => {
|
|
929
|
+
return /* @__PURE__ */ jsx17(DragHandle, { onDragStart: handleDragStart, onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsxs10(
|
|
930
|
+
"div",
|
|
931
|
+
{
|
|
932
|
+
style: {
|
|
933
|
+
height: 40,
|
|
934
|
+
width: "100%",
|
|
935
|
+
padding: "9.5px 12px",
|
|
936
|
+
boxSizing: "border-box",
|
|
937
|
+
borderBottom: "1px solid rgba(39, 39, 42, 0.5)",
|
|
938
|
+
display: "flex",
|
|
939
|
+
flexDirection: "row",
|
|
940
|
+
backgroundColor: "rgba(24, 24, 27, 0.5)"
|
|
941
|
+
},
|
|
942
|
+
children: [
|
|
943
|
+
/* @__PURE__ */ jsx17(
|
|
944
|
+
"div",
|
|
945
|
+
{
|
|
946
|
+
style: {
|
|
947
|
+
width: 20,
|
|
948
|
+
height: 20,
|
|
949
|
+
display: "flex",
|
|
950
|
+
alignItems: "center",
|
|
951
|
+
justifyContent: "center",
|
|
952
|
+
marginRight: 8,
|
|
953
|
+
backgroundColor: "#27272A",
|
|
954
|
+
borderRadius: 4
|
|
955
|
+
},
|
|
956
|
+
children: /* @__PURE__ */ jsx17(DevtoolsIcon_default, { fill: "#9F9FA9", stroke: "#9F9FA9", height: 12, width: 12 })
|
|
957
|
+
}
|
|
958
|
+
),
|
|
959
|
+
/* @__PURE__ */ jsx17(
|
|
960
|
+
"span",
|
|
961
|
+
{
|
|
962
|
+
style: {
|
|
963
|
+
fontSize: 12,
|
|
964
|
+
fontWeight: 500,
|
|
965
|
+
color: "#E4E4E7"
|
|
966
|
+
},
|
|
967
|
+
children: "React Inspector"
|
|
968
|
+
}
|
|
969
|
+
),
|
|
970
|
+
/* @__PURE__ */ jsxs10(
|
|
971
|
+
"div",
|
|
972
|
+
{
|
|
973
|
+
style: {
|
|
974
|
+
marginLeft: "auto",
|
|
975
|
+
display: "flex",
|
|
976
|
+
flexDirection: "row",
|
|
977
|
+
gap: 16,
|
|
978
|
+
alignItems: "center"
|
|
979
|
+
},
|
|
980
|
+
children: [
|
|
981
|
+
/* @__PURE__ */ jsx17(DragIcon_default, {}),
|
|
982
|
+
/* @__PURE__ */ jsx17(
|
|
983
|
+
"div",
|
|
984
|
+
{
|
|
985
|
+
"data-no-drag": true,
|
|
986
|
+
style: {
|
|
987
|
+
cursor: "pointer",
|
|
988
|
+
width: 20,
|
|
989
|
+
height: 20,
|
|
990
|
+
display: "flex",
|
|
991
|
+
alignItems: "center",
|
|
992
|
+
justifyContent: "center"
|
|
993
|
+
},
|
|
994
|
+
onClick: (e) => {
|
|
995
|
+
e.stopPropagation();
|
|
996
|
+
setOpen(false);
|
|
997
|
+
},
|
|
998
|
+
children: /* @__PURE__ */ jsx17(CloseIcon_default, {})
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
]
|
|
1002
|
+
}
|
|
1003
|
+
)
|
|
1004
|
+
]
|
|
1005
|
+
}
|
|
1006
|
+
) });
|
|
1007
|
+
};
|
|
1008
|
+
var DockHeader_default = DockHeader;
|
|
1009
|
+
|
|
708
1010
|
// src/StateInspectorUI.tsx
|
|
709
|
-
import { Fragment, jsx as
|
|
1011
|
+
import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
710
1012
|
function StateInspectorUI() {
|
|
711
1013
|
const store = useInspectorStore();
|
|
712
|
-
const [query, setQuery] =
|
|
713
|
-
const [leftCollapsed, setLeftCollapsed] =
|
|
714
|
-
const [layout, setLayout] =
|
|
715
|
-
const [preview, setPreview] =
|
|
716
|
-
const [isTransitioning, setIsTransitioning] =
|
|
717
|
-
const [open, setOpen] =
|
|
718
|
-
const [selectedId, setSelectedId] =
|
|
719
|
-
const [tick, force] =
|
|
1014
|
+
const [query, setQuery] = useState4("");
|
|
1015
|
+
const [leftCollapsed, setLeftCollapsed] = useState4(false);
|
|
1016
|
+
const [layout, setLayout] = useState4("floating");
|
|
1017
|
+
const [preview, setPreview] = useState4(null);
|
|
1018
|
+
const [isTransitioning, setIsTransitioning] = useState4(false);
|
|
1019
|
+
const [open, setOpen] = useState4(false);
|
|
1020
|
+
const [selectedId, setSelectedId] = useState4(null);
|
|
1021
|
+
const [tick, force] = useState4(0);
|
|
720
1022
|
const searchRef = useRef2(null);
|
|
721
|
-
const [pos, setPos] =
|
|
1023
|
+
const [pos, setPos] = useState4(() => {
|
|
722
1024
|
try {
|
|
723
1025
|
const raw = localStorage.getItem(LS_KEY);
|
|
724
1026
|
return raw ? JSON.parse(raw) : { right: 16, bottom: 72 };
|
|
@@ -726,7 +1028,7 @@ function StateInspectorUI() {
|
|
|
726
1028
|
return { right: 16, bottom: 72 };
|
|
727
1029
|
}
|
|
728
1030
|
});
|
|
729
|
-
const [leftWidth, setLeftWidth] =
|
|
1031
|
+
const [leftWidth, setLeftWidth] = useState4(() => {
|
|
730
1032
|
try {
|
|
731
1033
|
const raw = localStorage.getItem(LS_LEFT_W);
|
|
732
1034
|
return raw ? Number(raw) : 280;
|
|
@@ -734,7 +1036,7 @@ function StateInspectorUI() {
|
|
|
734
1036
|
return 280;
|
|
735
1037
|
}
|
|
736
1038
|
});
|
|
737
|
-
const [size, setSize] =
|
|
1039
|
+
const [size, setSize] = useState4(() => {
|
|
738
1040
|
try {
|
|
739
1041
|
const raw = localStorage.getItem(LS_SIZE);
|
|
740
1042
|
return raw ? JSON.parse(raw) : { width: 720, height: 420 };
|
|
@@ -774,15 +1076,12 @@ function StateInspectorUI() {
|
|
|
774
1076
|
const shouldCollapse = leftWidth <= 200 || (size.width ?? 720) - leftWidth < 320;
|
|
775
1077
|
setLeftCollapsed(shouldCollapse);
|
|
776
1078
|
}, [leftWidth, size.width]);
|
|
777
|
-
console.log("Store", store);
|
|
778
1079
|
useEffect4(() => store.subscribe(() => force((x) => x + 1)), [store]);
|
|
779
1080
|
const snapshot = useMemo3(() => store.getSnapshot(), [store, tick]);
|
|
780
|
-
console.log("Snapshot", snapshot);
|
|
781
1081
|
const components = useMemo3(
|
|
782
1082
|
() => snapshot.components.filter((c) => c.mounted),
|
|
783
1083
|
[snapshot.components]
|
|
784
1084
|
);
|
|
785
|
-
console.log(components);
|
|
786
1085
|
const q = query.trim().toLowerCase();
|
|
787
1086
|
const filtered = useMemo3(
|
|
788
1087
|
() => q ? components.filter((c) => {
|
|
@@ -792,7 +1091,6 @@ function StateInspectorUI() {
|
|
|
792
1091
|
}) : components,
|
|
793
1092
|
[q, components]
|
|
794
1093
|
);
|
|
795
|
-
console.log(filtered);
|
|
796
1094
|
useEffect4(() => {
|
|
797
1095
|
if (!open) return;
|
|
798
1096
|
if (components.length === 0) {
|
|
@@ -892,20 +1190,56 @@ function StateInspectorUI() {
|
|
|
892
1190
|
window.addEventListener("pointermove", onMove);
|
|
893
1191
|
window.addEventListener("pointerup", onUp);
|
|
894
1192
|
};
|
|
895
|
-
const handlePanelResize = (startSize) => (delta) => {
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
1193
|
+
const handlePanelResize = (startSize, startPos) => (delta, direction) => {
|
|
1194
|
+
const isLeft = direction === "left" || direction.endsWith("left");
|
|
1195
|
+
const isTop = direction === "top" || direction.startsWith("top");
|
|
1196
|
+
const isHorizontal = direction !== "top" && direction !== "bottom";
|
|
1197
|
+
const isVertical = direction !== "left" && direction !== "right";
|
|
1198
|
+
const currentWidth = startSize.width ?? 720;
|
|
1199
|
+
const currentHeight = startSize.height ?? 420;
|
|
1200
|
+
let newWidth = currentWidth;
|
|
1201
|
+
let newHeight = currentHeight;
|
|
1202
|
+
if (isHorizontal) {
|
|
1203
|
+
if (isLeft) {
|
|
1204
|
+
newWidth = Math.min(window.innerWidth - 16, Math.max(480, currentWidth - delta.dx));
|
|
1205
|
+
} else {
|
|
1206
|
+
newWidth = Math.min(window.innerWidth - 16, Math.max(480, currentWidth + delta.dx));
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
if (isVertical) {
|
|
1210
|
+
if (isTop) {
|
|
1211
|
+
newHeight = Math.min(window.innerHeight - 120, Math.max(280, currentHeight - delta.dy));
|
|
1212
|
+
} else {
|
|
1213
|
+
newHeight = Math.min(window.innerHeight - 120, Math.max(280, currentHeight + delta.dy));
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
setSize({ width: newWidth, height: newHeight });
|
|
1217
|
+
const newPos = { ...startPos };
|
|
1218
|
+
if (isLeft && startPos.left !== void 0) {
|
|
1219
|
+
const widthDelta = newWidth - currentWidth;
|
|
1220
|
+
newPos.left = Math.max(8, startPos.left - widthDelta);
|
|
1221
|
+
} else if (isLeft && startPos.right !== void 0) {
|
|
1222
|
+
const widthDelta = newWidth - currentWidth;
|
|
1223
|
+
newPos.right = Math.max(8, startPos.right - widthDelta);
|
|
1224
|
+
}
|
|
1225
|
+
if (isTop && startPos.top !== void 0) {
|
|
1226
|
+
const heightDelta = newHeight - currentHeight;
|
|
1227
|
+
newPos.top = Math.max(8, startPos.top - heightDelta);
|
|
1228
|
+
} else if (isTop && startPos.bottom !== void 0) {
|
|
1229
|
+
const heightDelta = newHeight - currentHeight;
|
|
1230
|
+
newPos.bottom = Math.max(8, startPos.bottom - heightDelta);
|
|
1231
|
+
}
|
|
1232
|
+
setPos(newPos);
|
|
900
1233
|
};
|
|
901
1234
|
if (!store.enabled) return null;
|
|
902
1235
|
return createPortal(
|
|
903
|
-
/* @__PURE__ */
|
|
904
|
-
/* @__PURE__ */
|
|
905
|
-
/* @__PURE__ */
|
|
906
|
-
open && /* @__PURE__ */
|
|
1236
|
+
/* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
1237
|
+
/* @__PURE__ */ jsx18(FloatingButton, { onClick: () => setOpen((o) => !o), isActive: open }),
|
|
1238
|
+
/* @__PURE__ */ jsx18(DockPreviewOverlay, { preview }),
|
|
1239
|
+
open && /* @__PURE__ */ jsxs11(
|
|
907
1240
|
"div",
|
|
908
1241
|
{
|
|
1242
|
+
"data-rsi-root": true,
|
|
909
1243
|
style: {
|
|
910
1244
|
position: "fixed",
|
|
911
1245
|
left: pos.left,
|
|
@@ -921,45 +1255,59 @@ function StateInspectorUI() {
|
|
|
921
1255
|
borderRadius: 12,
|
|
922
1256
|
border: "1px solid #333",
|
|
923
1257
|
zIndex: 999999,
|
|
924
|
-
display: "grid",
|
|
925
|
-
gridTemplateColumns: leftCollapsed ? "auto" : `${leftWidth}px 14px auto`,
|
|
926
1258
|
overflow: "hidden",
|
|
927
|
-
transition: isTransitioning ? "all 0.3s ease" : "none"
|
|
1259
|
+
transition: isTransitioning ? "all 0.3s ease" : "none",
|
|
1260
|
+
display: "flex",
|
|
1261
|
+
flexDirection: "column"
|
|
928
1262
|
},
|
|
929
1263
|
children: [
|
|
930
|
-
/* @__PURE__ */
|
|
931
|
-
|
|
932
|
-
ComponentList,
|
|
933
|
-
{
|
|
934
|
-
components: filtered,
|
|
935
|
-
selectedId,
|
|
936
|
-
onSelect: setSelectedId,
|
|
937
|
-
onDragStart: handleDragStart,
|
|
938
|
-
onDragEnd: handleDragEnd,
|
|
939
|
-
height: size.height,
|
|
940
|
-
hidden: leftCollapsed
|
|
941
|
-
}
|
|
942
|
-
),
|
|
943
|
-
/* @__PURE__ */ jsx14(
|
|
944
|
-
SidebarResizer,
|
|
1264
|
+
/* @__PURE__ */ jsx18(
|
|
1265
|
+
DockHeader_default,
|
|
945
1266
|
{
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1267
|
+
setOpen,
|
|
1268
|
+
handleDragStart,
|
|
1269
|
+
handleDragEnd
|
|
949
1270
|
}
|
|
950
1271
|
),
|
|
951
|
-
/* @__PURE__ */
|
|
952
|
-
|
|
1272
|
+
/* @__PURE__ */ jsxs11(
|
|
1273
|
+
"div",
|
|
953
1274
|
{
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1275
|
+
style: {
|
|
1276
|
+
display: "grid",
|
|
1277
|
+
gridTemplateColumns: leftCollapsed ? "auto" : `${leftWidth}px 14px auto`,
|
|
1278
|
+
height: "100%"
|
|
1279
|
+
},
|
|
1280
|
+
children: [
|
|
1281
|
+
/* @__PURE__ */ jsx18(ResizeHandle, { onResize: handlePanelResize(size, pos) }),
|
|
1282
|
+
/* @__PURE__ */ jsx18(
|
|
1283
|
+
ComponentList,
|
|
1284
|
+
{
|
|
1285
|
+
query,
|
|
1286
|
+
onQueryChange: setQuery,
|
|
1287
|
+
searchRef,
|
|
1288
|
+
components: filtered,
|
|
1289
|
+
selectedId,
|
|
1290
|
+
onSelect: setSelectedId,
|
|
1291
|
+
hidden: leftCollapsed
|
|
1292
|
+
}
|
|
1293
|
+
),
|
|
1294
|
+
/* @__PURE__ */ jsx18(
|
|
1295
|
+
SidebarResizer,
|
|
1296
|
+
{
|
|
1297
|
+
leftWidth,
|
|
1298
|
+
onWidthChange: setLeftWidth,
|
|
1299
|
+
hidden: leftCollapsed
|
|
1300
|
+
}
|
|
1301
|
+
),
|
|
1302
|
+
/* @__PURE__ */ jsx18(
|
|
1303
|
+
StateEditorPanel,
|
|
1304
|
+
{
|
|
1305
|
+
selected,
|
|
1306
|
+
leftCollapsed,
|
|
1307
|
+
onToggleCollapse: () => setLeftCollapsed((v) => !v)
|
|
1308
|
+
}
|
|
1309
|
+
)
|
|
1310
|
+
]
|
|
963
1311
|
}
|
|
964
1312
|
)
|
|
965
1313
|
]
|