atom.io 0.33.11 → 0.33.12
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/dist/react/index.js +2 -43
- package/dist/react/index.js.map +1 -1
- package/dist/react-devtools/index.css +86 -30
- package/dist/react-devtools/index.css.map +1 -1
- package/dist/react-devtools/index.d.ts +3 -0
- package/dist/react-devtools/index.d.ts.map +1 -1
- package/dist/react-devtools/index.js +174 -93
- package/dist/react-devtools/index.js.map +1 -1
- package/dist/use-o-BrXc7Qro.js +47 -0
- package/dist/use-o-BrXc7Qro.js.map +1 -0
- package/package.json +1 -1
- package/src/react-devtools/Button.tsx +1 -1
- package/src/react-devtools/devtools.css +86 -30
- package/src/react-devtools/json-editor/default-components.tsx +4 -1
- package/src/react-devtools/json-editor/editors-by-type/array-editor.tsx +80 -23
- package/src/react-devtools/json-editor/editors-by-type/object-editor.tsx +94 -16
- package/src/react-devtools/json-editor/json-editor-internal.tsx +105 -55
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { useI, useO } from "../use-o-BrXc7Qro.js";
|
|
1
2
|
import { IMPLICIT, become, createAtomFamily, createStandaloneAtom, findInStore } from "atom.io/internal";
|
|
2
3
|
import { JSON_DEFAULTS, fromEntries, isJson, stringifyJson, toEntries } from "atom.io/json";
|
|
3
4
|
import { getState, redo, undo } from "atom.io";
|
|
4
5
|
import { Component, Fragment, createContext, forwardRef, useContext, useId, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
5
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { StoreContext, useI, useO } from "atom.io/react";
|
|
7
|
+
import { StoreContext, useI as useI$1, useO as useO$1 } from "atom.io/react";
|
|
7
8
|
import { LayoutGroup, motion } from "motion/react";
|
|
8
9
|
import { attachIntrospectionStates, discoverType, jsonRefinery, prettyJson, primitiveRefinery } from "atom.io/introspection";
|
|
9
10
|
import { persistSync } from "atom.io/web";
|
|
@@ -18,7 +19,10 @@ const OpenClose = ({ isOpen, setIsOpen, disabled, testid }) => {
|
|
|
18
19
|
setIsOpen((prev) => !prev);
|
|
19
20
|
},
|
|
20
21
|
disabled,
|
|
21
|
-
children: "
|
|
22
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
23
|
+
className: "json_editor_icon json_editor_carat",
|
|
24
|
+
children: "▶"
|
|
25
|
+
})
|
|
22
26
|
});
|
|
23
27
|
};
|
|
24
28
|
const button = { OpenClose };
|
|
@@ -140,7 +144,11 @@ const DEFAULT_JSON_EDITOR_COMPONENTS = {
|
|
|
140
144
|
}),
|
|
141
145
|
DeleteIcon: () => /* @__PURE__ */ jsx("span", {
|
|
142
146
|
className: "json_editor_icon json_editor_delete",
|
|
143
|
-
children: "
|
|
147
|
+
children: "×"
|
|
148
|
+
}),
|
|
149
|
+
AddIcon: () => /* @__PURE__ */ jsx("span", {
|
|
150
|
+
className: "json_editor_icon json_editor_add",
|
|
151
|
+
children: "+"
|
|
144
152
|
}),
|
|
145
153
|
MissingPropertyWrapper: ({ children, testid }) => /* @__PURE__ */ jsx("span", {
|
|
146
154
|
className: "json_editor_missing_property",
|
|
@@ -154,6 +162,46 @@ const DEFAULT_JSON_EDITOR_COMPONENTS = {
|
|
|
154
162
|
})
|
|
155
163
|
};
|
|
156
164
|
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/react-devtools/store.ts
|
|
167
|
+
function attachDevtoolsStates(store) {
|
|
168
|
+
const introspectionStates = attachIntrospectionStates(store);
|
|
169
|
+
const devtoolsAreOpenState = createStandaloneAtom(store, {
|
|
170
|
+
key: `🔍 Devtools Are Open`,
|
|
171
|
+
default: true,
|
|
172
|
+
effects: typeof window === `undefined` ? [] : [persistSync(window.localStorage, JSON, `🔍 Devtools Are Open`)]
|
|
173
|
+
});
|
|
174
|
+
const devtoolsViewSelectionState = createStandaloneAtom(store, {
|
|
175
|
+
key: `🔍 Devtools View Selection`,
|
|
176
|
+
default: `atoms`,
|
|
177
|
+
effects: typeof window === `undefined` ? [] : [persistSync(window.localStorage, JSON, `🔍 Devtools View`)]
|
|
178
|
+
});
|
|
179
|
+
const devtoolsViewOptionsState = createStandaloneAtom(store, {
|
|
180
|
+
key: `🔍 Devtools View Options`,
|
|
181
|
+
default: [
|
|
182
|
+
`atoms`,
|
|
183
|
+
`selectors`,
|
|
184
|
+
`transactions`,
|
|
185
|
+
`timelines`
|
|
186
|
+
],
|
|
187
|
+
effects: typeof window === `undefined` ? [] : [persistSync(window.localStorage, JSON, `🔍 Devtools View Options`)]
|
|
188
|
+
});
|
|
189
|
+
const viewIsOpenAtoms = createAtomFamily(store, {
|
|
190
|
+
key: `🔍 Devtools View Is Open`,
|
|
191
|
+
default: false,
|
|
192
|
+
effects: (key) => typeof window === `undefined` ? [] : [persistSync(window.localStorage, JSON, key + `:view-is-open`)]
|
|
193
|
+
});
|
|
194
|
+
return {
|
|
195
|
+
...introspectionStates,
|
|
196
|
+
devtoolsAreOpenState,
|
|
197
|
+
devtoolsViewSelectionState,
|
|
198
|
+
devtoolsViewOptionsState,
|
|
199
|
+
viewIsOpenAtoms,
|
|
200
|
+
store
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
const DevtoolsContext = createContext(attachDevtoolsStates(IMPLICIT.STORE));
|
|
204
|
+
|
|
157
205
|
//#endregion
|
|
158
206
|
//#region src/react-devtools/elastic-input/ElasticInput.tsx
|
|
159
207
|
const ElasticInput = forwardRef(function ElasticInputFC(props, ref) {
|
|
@@ -361,7 +409,7 @@ const NonJsonEditor = ({ data, testid }) => {
|
|
|
361
409
|
|
|
362
410
|
//#endregion
|
|
363
411
|
//#region src/react-devtools/json-editor/json-editor-internal.tsx
|
|
364
|
-
const JsonEditor_INTERNAL = ({ data, set, name, rename, remove, recast, path = [], isReadonly = () => false, isHidden = () => false, className, style,
|
|
412
|
+
const JsonEditor_INTERNAL = ({ data, set, name, rename, remove, recast, path = [], isReadonly = () => false, isHidden = () => false, className, style, Components, isOpen, setIsOpen, testid }) => {
|
|
365
413
|
const dataIsJson = isJson(data);
|
|
366
414
|
const refined = jsonRefinery.refine(data) ?? {
|
|
367
415
|
type: `non-json`,
|
|
@@ -369,11 +417,12 @@ const JsonEditor_INTERNAL = ({ data, set, name, rename, remove, recast, path = [
|
|
|
369
417
|
};
|
|
370
418
|
const SubEditor = dataIsJson ? SubEditors[refined.type] : NonJsonEditor;
|
|
371
419
|
const disabled = isReadonly(path);
|
|
420
|
+
const dataIsTree = refined.type === `array` || refined.type === `object`;
|
|
372
421
|
return isHidden(path) ? null : /* @__PURE__ */ jsx(Components.ErrorBoundary, { children: /* @__PURE__ */ jsxs(Components.EditorWrapper, {
|
|
373
422
|
className,
|
|
374
423
|
style,
|
|
375
424
|
testid,
|
|
376
|
-
children: [
|
|
425
|
+
children: [/* @__PURE__ */ jsxs("header", { children: [
|
|
377
426
|
remove ? /* @__PURE__ */ jsx(Components.Button, {
|
|
378
427
|
disabled,
|
|
379
428
|
onClick: () => {
|
|
@@ -382,16 +431,34 @@ const JsonEditor_INTERNAL = ({ data, set, name, rename, remove, recast, path = [
|
|
|
382
431
|
testid: `${testid}-delete`,
|
|
383
432
|
children: /* @__PURE__ */ jsx(Components.DeleteIcon, {})
|
|
384
433
|
}) : null,
|
|
385
|
-
|
|
434
|
+
dataIsTree && isOpen !== void 0 && setIsOpen ? /* @__PURE__ */ jsx(button.OpenClose, {
|
|
435
|
+
isOpen,
|
|
436
|
+
testid: `${testid}-open-close`,
|
|
437
|
+
setIsOpen
|
|
438
|
+
}) : null,
|
|
386
439
|
rename && /* @__PURE__ */ jsx(Components.KeyWrapper, { children: /* @__PURE__ */ jsx(ElasticInput, {
|
|
387
440
|
value: name,
|
|
388
|
-
onChange:
|
|
441
|
+
onChange: (e) => {
|
|
389
442
|
rename(e.target.value);
|
|
390
443
|
},
|
|
391
444
|
disabled,
|
|
392
445
|
"data-testid": `${testid}-rename`
|
|
393
446
|
}) }),
|
|
394
|
-
/* @__PURE__ */ jsx(
|
|
447
|
+
dataIsTree ? /* @__PURE__ */ jsxs(Fragment$1, { children: [recast ? /* @__PURE__ */ jsx("select", {
|
|
448
|
+
onChange: (e) => {
|
|
449
|
+
recast(e.target.value);
|
|
450
|
+
},
|
|
451
|
+
value: refined.type,
|
|
452
|
+
disabled,
|
|
453
|
+
"data-testid": `${testid}-recast`,
|
|
454
|
+
children: Object.keys(SubEditors).map((type) => /* @__PURE__ */ jsx("option", {
|
|
455
|
+
value: type,
|
|
456
|
+
children: type
|
|
457
|
+
}, type))
|
|
458
|
+
}) : null, isOpen !== void 0 && setIsOpen ? /* @__PURE__ */ jsx("span", {
|
|
459
|
+
className: "json_viewer",
|
|
460
|
+
children: JSON.stringify(data)
|
|
461
|
+
}) : null] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SubEditor, {
|
|
395
462
|
data: refined.data,
|
|
396
463
|
set,
|
|
397
464
|
remove,
|
|
@@ -401,8 +468,7 @@ const JsonEditor_INTERNAL = ({ data, set, name, rename, remove, recast, path = [
|
|
|
401
468
|
isHidden,
|
|
402
469
|
Components,
|
|
403
470
|
testid
|
|
404
|
-
}),
|
|
405
|
-
recast && dataIsJson ? /* @__PURE__ */ jsx("select", {
|
|
471
|
+
}), recast && dataIsJson ? /* @__PURE__ */ jsx("select", {
|
|
406
472
|
onChange: disabled ? void 0 : (e) => {
|
|
407
473
|
recast(e.target.value);
|
|
408
474
|
},
|
|
@@ -413,8 +479,18 @@ const JsonEditor_INTERNAL = ({ data, set, name, rename, remove, recast, path = [
|
|
|
413
479
|
value: type,
|
|
414
480
|
children: type
|
|
415
481
|
}, type))
|
|
416
|
-
}) : null
|
|
417
|
-
]
|
|
482
|
+
}) : null] })
|
|
483
|
+
] }), dataIsTree && isOpen !== false ? /* @__PURE__ */ jsx(SubEditor, {
|
|
484
|
+
data: refined.data,
|
|
485
|
+
set,
|
|
486
|
+
remove,
|
|
487
|
+
rename,
|
|
488
|
+
path,
|
|
489
|
+
isReadonly,
|
|
490
|
+
isHidden,
|
|
491
|
+
Components,
|
|
492
|
+
testid
|
|
493
|
+
}) : null]
|
|
418
494
|
}) });
|
|
419
495
|
};
|
|
420
496
|
|
|
@@ -673,7 +749,28 @@ const makePropertySorter = (data, set, sortFn) => () => {
|
|
|
673
749
|
|
|
674
750
|
//#endregion
|
|
675
751
|
//#region src/react-devtools/json-editor/editors-by-type/array-editor.tsx
|
|
752
|
+
const ArrayElement = ({ path, isReadonly, isHidden, data, set, remove, recast, Components, testid, viewIsOpenAtom }) => {
|
|
753
|
+
const index = path[path.length - 1];
|
|
754
|
+
const viewIsOpen = useO$1(viewIsOpenAtom);
|
|
755
|
+
const setViewIsOpen = useI$1(viewIsOpenAtom);
|
|
756
|
+
return /* @__PURE__ */ jsx(JsonEditor_INTERNAL, {
|
|
757
|
+
path,
|
|
758
|
+
name: `${index}`,
|
|
759
|
+
isReadonly,
|
|
760
|
+
isHidden,
|
|
761
|
+
data,
|
|
762
|
+
set,
|
|
763
|
+
remove,
|
|
764
|
+
recast,
|
|
765
|
+
className: "json_editor_element",
|
|
766
|
+
Components,
|
|
767
|
+
isOpen: viewIsOpen,
|
|
768
|
+
setIsOpen: setViewIsOpen,
|
|
769
|
+
testid: `${testid}-element-${index}`
|
|
770
|
+
});
|
|
771
|
+
};
|
|
676
772
|
const ArrayEditor = ({ path = [], isReadonly = () => false, isHidden = () => false, data, set, Components, testid }) => {
|
|
773
|
+
const { viewIsOpenAtoms, store } = useContext(DevtoolsContext);
|
|
677
774
|
const disabled = isReadonly(path);
|
|
678
775
|
const setElement = makeElementSetters(data, set);
|
|
679
776
|
const removeElement = makePropertyRemovers(data, set);
|
|
@@ -681,22 +778,23 @@ const ArrayEditor = ({ path = [], isReadonly = () => false, isHidden = () => fal
|
|
|
681
778
|
return /* @__PURE__ */ jsxs(Components.ArrayWrapper, { children: [/* @__PURE__ */ jsx("div", {
|
|
682
779
|
className: `json_editor_elements${disabled ? ` readonly` : ``}`,
|
|
683
780
|
children: data.map((element, index) => {
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
781
|
+
const elementPath = [...path, index];
|
|
782
|
+
const pathKey = elementPath.join(`,`);
|
|
783
|
+
const viewIsOpenAtom = findInStore(store, viewIsOpenAtoms, `${testid}__${pathKey}`);
|
|
784
|
+
return /* @__PURE__ */ jsx(ArrayElement, {
|
|
785
|
+
path: elementPath,
|
|
688
786
|
isReadonly,
|
|
689
787
|
isHidden,
|
|
690
788
|
data: element,
|
|
691
789
|
set: setElement[index],
|
|
692
790
|
remove: removeElement[index],
|
|
693
791
|
recast: recastElement[index],
|
|
694
|
-
className: "json_editor_element",
|
|
695
792
|
Components,
|
|
696
|
-
testid
|
|
697
|
-
|
|
793
|
+
testid,
|
|
794
|
+
viewIsOpenAtom
|
|
795
|
+
}, pathKey);
|
|
698
796
|
})
|
|
699
|
-
}),
|
|
797
|
+
}), /* @__PURE__ */ jsx(Components.Button, {
|
|
700
798
|
testid: `${testid}-add-element`,
|
|
701
799
|
disabled,
|
|
702
800
|
onClick: () => {
|
|
@@ -705,13 +803,35 @@ const ArrayEditor = ({ path = [], isReadonly = () => false, isHidden = () => fal
|
|
|
705
803
|
return newData;
|
|
706
804
|
});
|
|
707
805
|
},
|
|
708
|
-
children:
|
|
806
|
+
children: /* @__PURE__ */ jsx(Components.AddIcon, {})
|
|
709
807
|
})] });
|
|
710
808
|
};
|
|
711
809
|
|
|
712
810
|
//#endregion
|
|
713
811
|
//#region src/react-devtools/json-editor/editors-by-type/object-editor.tsx
|
|
812
|
+
const ObjectProperty = ({ path, isReadonly, isHidden, data, set, rename, remove, recast, Components, testid, viewIsOpenAtom }) => {
|
|
813
|
+
const key = path[path.length - 1];
|
|
814
|
+
const viewIsOpen = useO(viewIsOpenAtom);
|
|
815
|
+
const setViewIsOpen = useI(viewIsOpenAtom);
|
|
816
|
+
return /* @__PURE__ */ jsx(JsonEditor_INTERNAL, {
|
|
817
|
+
path,
|
|
818
|
+
name: `${key}`,
|
|
819
|
+
isReadonly,
|
|
820
|
+
isHidden,
|
|
821
|
+
data,
|
|
822
|
+
set,
|
|
823
|
+
rename,
|
|
824
|
+
remove,
|
|
825
|
+
recast,
|
|
826
|
+
className: "json_editor_property",
|
|
827
|
+
Components,
|
|
828
|
+
isOpen: viewIsOpen,
|
|
829
|
+
setIsOpen: setViewIsOpen,
|
|
830
|
+
testid: `${testid}-property-${key}`
|
|
831
|
+
});
|
|
832
|
+
};
|
|
714
833
|
const ObjectEditor = ({ path = [], isReadonly = () => false, isHidden = () => false, data, set, Components, testid }) => {
|
|
834
|
+
const { viewIsOpenAtoms, store } = useContext(DevtoolsContext);
|
|
715
835
|
const disabled = isReadonly(path);
|
|
716
836
|
const stableKeyMap = useRef(Object.keys(data).reduce((acc, key) => {
|
|
717
837
|
acc[key] = key;
|
|
@@ -727,11 +847,12 @@ const ObjectEditor = ({ path = [], isReadonly = () => false, isHidden = () => fa
|
|
|
727
847
|
className: `json_editor_properties${disabled ? ` readonly` : ``}`,
|
|
728
848
|
children: Object.keys(data).map((key) => {
|
|
729
849
|
const originalKey = stableKeyMap.current[key];
|
|
730
|
-
const
|
|
731
|
-
const
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
850
|
+
const propertyPath = [...path, key];
|
|
851
|
+
const originalPropertyPath = [...path, originalKey];
|
|
852
|
+
const stablePathKey = originalPropertyPath.join(`.`);
|
|
853
|
+
const viewIsOpenAtom = findInStore(store, viewIsOpenAtoms, `${testid}__${stablePathKey}`);
|
|
854
|
+
return /* @__PURE__ */ jsx(ObjectProperty, {
|
|
855
|
+
path: propertyPath,
|
|
735
856
|
isReadonly,
|
|
736
857
|
isHidden,
|
|
737
858
|
data: data[key],
|
|
@@ -739,10 +860,10 @@ const ObjectEditor = ({ path = [], isReadonly = () => false, isHidden = () => fa
|
|
|
739
860
|
rename: renameProperty[key],
|
|
740
861
|
remove: removeProperty[key],
|
|
741
862
|
recast: recastProperty[key],
|
|
742
|
-
className: "json_editor_property",
|
|
743
863
|
Components,
|
|
744
|
-
testid
|
|
745
|
-
|
|
864
|
+
testid,
|
|
865
|
+
viewIsOpenAtom
|
|
866
|
+
}, stablePathKey);
|
|
746
867
|
})
|
|
747
868
|
}), disabled ? null : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Components.Button, {
|
|
748
869
|
disabled,
|
|
@@ -750,7 +871,7 @@ const ObjectEditor = ({ path = [], isReadonly = () => false, isHidden = () => fa
|
|
|
750
871
|
onClick: () => {
|
|
751
872
|
makePropertyAdder(`new_property`, `string`)();
|
|
752
873
|
},
|
|
753
|
-
children:
|
|
874
|
+
children: /* @__PURE__ */ jsx(Components.AddIcon, {})
|
|
754
875
|
}), /* @__PURE__ */ jsx(Components.Button, {
|
|
755
876
|
testid: `${testid}-sort-properties`,
|
|
756
877
|
onClick: () => {
|
|
@@ -827,8 +948,8 @@ const JsonEditor = ({ data, set, name, rename, remove, isReadonly = () => false,
|
|
|
827
948
|
//#endregion
|
|
828
949
|
//#region src/react-devtools/StateEditor.tsx
|
|
829
950
|
const StateEditor = ({ token }) => {
|
|
830
|
-
const set = useI(token);
|
|
831
|
-
const data = useO(token);
|
|
951
|
+
const set = useI$1(token);
|
|
952
|
+
const data = useO$1(token);
|
|
832
953
|
return /* @__PURE__ */ jsx(JsonEditor, {
|
|
833
954
|
testid: `${token.key}-state-editor`,
|
|
834
955
|
data,
|
|
@@ -836,7 +957,7 @@ const StateEditor = ({ token }) => {
|
|
|
836
957
|
});
|
|
837
958
|
};
|
|
838
959
|
const ReadonlySelectorViewer = ({ token }) => {
|
|
839
|
-
const data = useO(token);
|
|
960
|
+
const data = useO$1(token);
|
|
840
961
|
return /* @__PURE__ */ jsx(JsonEditor, {
|
|
841
962
|
testid: `${token.key}-state-editor`,
|
|
842
963
|
data,
|
|
@@ -855,53 +976,13 @@ const StoreEditor = ({ token }) => {
|
|
|
855
976
|
}
|
|
856
977
|
};
|
|
857
978
|
|
|
858
|
-
//#endregion
|
|
859
|
-
//#region src/react-devtools/store.ts
|
|
860
|
-
function attachDevtoolsStates(store) {
|
|
861
|
-
const introspectionStates = attachIntrospectionStates(store);
|
|
862
|
-
const devtoolsAreOpenState = createStandaloneAtom(store, {
|
|
863
|
-
key: `🔍 Devtools Are Open`,
|
|
864
|
-
default: true,
|
|
865
|
-
effects: typeof window === `undefined` ? [] : [persistSync(window.localStorage, JSON, `🔍 Devtools Are Open`)]
|
|
866
|
-
});
|
|
867
|
-
const devtoolsViewSelectionState = createStandaloneAtom(store, {
|
|
868
|
-
key: `🔍 Devtools View Selection`,
|
|
869
|
-
default: `atoms`,
|
|
870
|
-
effects: typeof window === `undefined` ? [] : [persistSync(window.localStorage, JSON, `🔍 Devtools View`)]
|
|
871
|
-
});
|
|
872
|
-
const devtoolsViewOptionsState = createStandaloneAtom(store, {
|
|
873
|
-
key: `🔍 Devtools View Options`,
|
|
874
|
-
default: [
|
|
875
|
-
`atoms`,
|
|
876
|
-
`selectors`,
|
|
877
|
-
`transactions`,
|
|
878
|
-
`timelines`
|
|
879
|
-
],
|
|
880
|
-
effects: typeof window === `undefined` ? [] : [persistSync(window.localStorage, JSON, `🔍 Devtools View Options`)]
|
|
881
|
-
});
|
|
882
|
-
const viewIsOpenAtoms = createAtomFamily(store, {
|
|
883
|
-
key: `🔍 Devtools View Is Open`,
|
|
884
|
-
default: false,
|
|
885
|
-
effects: (key) => typeof window === `undefined` ? [] : [persistSync(window.localStorage, JSON, key + `:view-is-open`)]
|
|
886
|
-
});
|
|
887
|
-
return {
|
|
888
|
-
...introspectionStates,
|
|
889
|
-
devtoolsAreOpenState,
|
|
890
|
-
devtoolsViewSelectionState,
|
|
891
|
-
devtoolsViewOptionsState,
|
|
892
|
-
viewIsOpenAtoms,
|
|
893
|
-
store
|
|
894
|
-
};
|
|
895
|
-
}
|
|
896
|
-
const DevtoolsContext = createContext(attachDevtoolsStates(IMPLICIT.STORE));
|
|
897
|
-
|
|
898
979
|
//#endregion
|
|
899
980
|
//#region src/react-devtools/StateIndex.tsx
|
|
900
981
|
const StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
|
|
901
|
-
const setIsOpen = useI(isOpenState);
|
|
902
|
-
const isOpen = useO(isOpenState);
|
|
903
|
-
const state = useO(node);
|
|
904
|
-
const stateTypeLoadable = useO(typeState);
|
|
982
|
+
const setIsOpen = useI$1(isOpenState);
|
|
983
|
+
const isOpen = useO$1(isOpenState);
|
|
984
|
+
const state = useO$1(node);
|
|
985
|
+
const stateTypeLoadable = useO$1(typeState);
|
|
905
986
|
const stateType = stateTypeLoadable instanceof Promise ? `Promise` : stateTypeLoadable;
|
|
906
987
|
const isPrimitive = Boolean(primitiveRefinery.refine(state));
|
|
907
988
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("header", { children: [
|
|
@@ -934,8 +1015,8 @@ const StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
|
|
|
934
1015
|
] }), isOpen && !isPrimitive ? /* @__PURE__ */ jsx("main", { children: /* @__PURE__ */ jsx(StoreEditor, { token: node }) }) : null] });
|
|
935
1016
|
};
|
|
936
1017
|
const StateIndexTreeNode = ({ node, isOpenState }) => {
|
|
937
|
-
const setIsOpen = useI(isOpenState);
|
|
938
|
-
const isOpen = useO(isOpenState);
|
|
1018
|
+
const setIsOpen = useI$1(isOpenState);
|
|
1019
|
+
const isOpen = useO$1(isOpenState);
|
|
939
1020
|
const { typeSelectors, viewIsOpenAtoms, store } = useContext(DevtoolsContext);
|
|
940
1021
|
for (const [key, childNode] of node.familyMembers) {
|
|
941
1022
|
findInStore(store, viewIsOpenAtoms, key);
|
|
@@ -969,7 +1050,7 @@ const StateIndexNode = ({ node, isOpenState, typeState }) => {
|
|
|
969
1050
|
});
|
|
970
1051
|
};
|
|
971
1052
|
const StateIndex = ({ tokenIndex }) => {
|
|
972
|
-
const tokenIds = useO(tokenIndex);
|
|
1053
|
+
const tokenIds = useO$1(tokenIndex);
|
|
973
1054
|
const { typeSelectors, viewIsOpenAtoms, store } = useContext(DevtoolsContext);
|
|
974
1055
|
console.log(tokenIds);
|
|
975
1056
|
return /* @__PURE__ */ jsx("article", {
|
|
@@ -1132,9 +1213,9 @@ const YouAreHere = () => {
|
|
|
1132
1213
|
});
|
|
1133
1214
|
};
|
|
1134
1215
|
const TimelineLog = ({ token, isOpenState, timelineState }) => {
|
|
1135
|
-
const timeline = useO(timelineState);
|
|
1136
|
-
const isOpen = useO(isOpenState);
|
|
1137
|
-
const setIsOpen = useI(isOpenState);
|
|
1216
|
+
const timeline = useO$1(timelineState);
|
|
1217
|
+
const isOpen = useO$1(isOpenState);
|
|
1218
|
+
const setIsOpen = useI$1(isOpenState);
|
|
1138
1219
|
return /* @__PURE__ */ jsxs("section", {
|
|
1139
1220
|
className: "node timeline_log",
|
|
1140
1221
|
"data-testid": `timeline-${token.key}`,
|
|
@@ -1182,7 +1263,7 @@ const TimelineLog = ({ token, isOpenState, timelineState }) => {
|
|
|
1182
1263
|
};
|
|
1183
1264
|
const TimelineIndex = () => {
|
|
1184
1265
|
const { timelineIndex, timelineSelectors, viewIsOpenAtoms, store } = useContext(DevtoolsContext);
|
|
1185
|
-
const tokenIds = useO(timelineIndex);
|
|
1266
|
+
const tokenIds = useO$1(timelineIndex);
|
|
1186
1267
|
return /* @__PURE__ */ jsx("article", {
|
|
1187
1268
|
className: "index timeline_index",
|
|
1188
1269
|
"data-testid": "timeline-index",
|
|
@@ -1199,9 +1280,9 @@ const TimelineIndex = () => {
|
|
|
1199
1280
|
//#endregion
|
|
1200
1281
|
//#region src/react-devtools/TransactionIndex.tsx
|
|
1201
1282
|
const TransactionLog = ({ token, isOpenState, logState }) => {
|
|
1202
|
-
const log = useO(logState);
|
|
1203
|
-
const isOpen = useO(isOpenState);
|
|
1204
|
-
const setIsOpen = useI(isOpenState);
|
|
1283
|
+
const log = useO$1(logState);
|
|
1284
|
+
const isOpen = useO$1(isOpenState);
|
|
1285
|
+
const setIsOpen = useI$1(isOpenState);
|
|
1205
1286
|
return /* @__PURE__ */ jsxs("section", {
|
|
1206
1287
|
className: "node transaction_log",
|
|
1207
1288
|
"data-testid": `transaction-${token.key}`,
|
|
@@ -1224,7 +1305,7 @@ const TransactionLog = ({ token, isOpenState, logState }) => {
|
|
|
1224
1305
|
};
|
|
1225
1306
|
const TransactionIndex = () => {
|
|
1226
1307
|
const { transactionIndex, transactionLogSelectors, viewIsOpenAtoms, store } = useContext(DevtoolsContext);
|
|
1227
|
-
const tokenIds = useO(transactionIndex);
|
|
1308
|
+
const tokenIds = useO$1(transactionIndex);
|
|
1228
1309
|
return /* @__PURE__ */ jsx("article", {
|
|
1229
1310
|
className: "index transaction_index",
|
|
1230
1311
|
"data-testid": "transaction-index",
|
|
@@ -1250,11 +1331,11 @@ const AtomIODevtools = () => {
|
|
|
1250
1331
|
const AtomIODevtoolsInternal = () => {
|
|
1251
1332
|
const constraintsRef = useRef(null);
|
|
1252
1333
|
const { atomIndex, selectorIndex, devtoolsAreOpenState, devtoolsViewSelectionState, devtoolsViewOptionsState } = useContext(DevtoolsContext);
|
|
1253
|
-
const setDevtoolsAreOpen = useI(devtoolsAreOpenState);
|
|
1254
|
-
const devtoolsAreOpen = useO(devtoolsAreOpenState);
|
|
1255
|
-
const setDevtoolsView = useI(devtoolsViewSelectionState);
|
|
1256
|
-
const devtoolsView = useO(devtoolsViewSelectionState);
|
|
1257
|
-
const devtoolsViewOptions = useO(devtoolsViewOptionsState);
|
|
1334
|
+
const setDevtoolsAreOpen = useI$1(devtoolsAreOpenState);
|
|
1335
|
+
const devtoolsAreOpen = useO$1(devtoolsAreOpenState);
|
|
1336
|
+
const setDevtoolsView = useI$1(devtoolsViewSelectionState);
|
|
1337
|
+
const devtoolsView = useO$1(devtoolsViewSelectionState);
|
|
1338
|
+
const devtoolsViewOptions = useO$1(devtoolsViewOptionsState);
|
|
1258
1339
|
const mouseHasMoved = useRef(false);
|
|
1259
1340
|
return /* @__PURE__ */ jsxs("span", {
|
|
1260
1341
|
style: {
|