jazz-tools 0.19.1 → 0.19.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/.turbo/turbo-build.log +48 -48
- package/CHANGELOG.md +11 -0
- package/dist/inspector/{custom-element-QESCMFY7.js → custom-element-ABVPHX53.js} +1118 -465
- package/dist/inspector/custom-element-ABVPHX53.js.map +1 -0
- package/dist/inspector/index.js +1090 -437
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/register-custom-element.js +1 -1
- package/dist/inspector/tests/utils/history.test.d.ts +2 -0
- package/dist/inspector/tests/utils/history.test.d.ts.map +1 -0
- package/dist/inspector/tests/viewer/co-value-editor.test.d.ts +2 -0
- package/dist/inspector/tests/viewer/co-value-editor.test.d.ts.map +1 -0
- package/dist/inspector/tests/viewer/comap-view.test.d.ts +2 -0
- package/dist/inspector/tests/viewer/comap-view.test.d.ts.map +1 -0
- package/dist/inspector/ui/icon.d.ts +6 -0
- package/dist/inspector/ui/icon.d.ts.map +1 -1
- package/dist/inspector/ui/icons/add-icon.d.ts +2 -0
- package/dist/inspector/ui/icons/add-icon.d.ts.map +1 -0
- package/dist/inspector/ui/icons/edit-icon.d.ts +2 -0
- package/dist/inspector/ui/icons/edit-icon.d.ts.map +1 -0
- package/dist/inspector/ui/icons/history.d.ts +2 -0
- package/dist/inspector/ui/icons/history.d.ts.map +1 -0
- package/dist/inspector/utils/history.d.ts +3 -0
- package/dist/inspector/utils/history.d.ts.map +1 -0
- package/dist/inspector/utils/transactions-changes.d.ts +38 -0
- package/dist/inspector/utils/transactions-changes.d.ts.map +1 -0
- package/dist/inspector/viewer/co-map-view.d.ts +9 -0
- package/dist/inspector/viewer/co-map-view.d.ts.map +1 -0
- package/dist/inspector/viewer/co-value-editor.d.ts +10 -0
- package/dist/inspector/viewer/co-value-editor.d.ts.map +1 -0
- package/dist/inspector/viewer/grid-view.d.ts +3 -2
- package/dist/inspector/viewer/grid-view.d.ts.map +1 -1
- package/dist/inspector/viewer/history-view.d.ts.map +1 -1
- package/dist/inspector/viewer/page.d.ts.map +1 -1
- package/dist/tools/coValues/CoFieldInit.d.ts +2 -1
- package/dist/tools/coValues/CoFieldInit.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/typeConverters/CoFieldSchemaInit.d.ts +3 -2
- package/dist/tools/implementation/zodSchema/typeConverters/CoFieldSchemaInit.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/inspector/tests/utils/history.test.ts +401 -0
- package/src/inspector/tests/viewer/co-value-editor.test.tsx +903 -0
- package/src/inspector/tests/viewer/comap-view.test.tsx +581 -0
- package/src/inspector/ui/icon.tsx +6 -0
- package/src/inspector/ui/icons/add-icon.tsx +21 -0
- package/src/inspector/ui/icons/edit-icon.tsx +17 -0
- package/src/inspector/ui/icons/history.tsx +28 -0
- package/src/inspector/ui/modal.tsx +3 -3
- package/src/inspector/utils/history.ts +49 -0
- package/src/inspector/utils/transactions-changes.ts +98 -0
- package/src/inspector/viewer/co-map-view.tsx +312 -0
- package/src/inspector/viewer/co-value-editor.tsx +164 -0
- package/src/inspector/viewer/grid-view.tsx +139 -10
- package/src/inspector/viewer/history-view.tsx +16 -118
- package/src/inspector/viewer/page.tsx +13 -0
- package/src/react-core/tests/usePassPhraseAuth.test.ts +1 -1
- package/src/tools/coValues/CoFieldInit.ts +6 -3
- package/src/tools/implementation/zodSchema/typeConverters/CoFieldSchemaInit.ts +12 -7
- package/src/tools/tests/coVector.test.ts +43 -0
- package/dist/inspector/custom-element-QESCMFY7.js.map +0 -1
package/dist/inspector/index.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import React8 from "react";
|
|
5
5
|
|
|
6
6
|
// src/inspector/viewer/new-app.tsx
|
|
7
|
-
import { styled as
|
|
8
|
-
import { useState as
|
|
7
|
+
import { styled as styled26 } from "goober";
|
|
8
|
+
import { useState as useState16 } from "react";
|
|
9
9
|
|
|
10
10
|
// src/inspector/ui/button.tsx
|
|
11
11
|
import { styled } from "goober";
|
|
@@ -180,10 +180,10 @@ var Breadcrumbs = ({
|
|
|
180
180
|
};
|
|
181
181
|
|
|
182
182
|
// src/inspector/viewer/page-stack.tsx
|
|
183
|
-
import { styled as
|
|
183
|
+
import { styled as styled23 } from "goober";
|
|
184
184
|
|
|
185
185
|
// src/inspector/viewer/page.tsx
|
|
186
|
-
import { styled as
|
|
186
|
+
import { styled as styled21 } from "goober";
|
|
187
187
|
import React5 from "react";
|
|
188
188
|
|
|
189
189
|
// src/inspector/ui/badge.tsx
|
|
@@ -681,6 +681,10 @@ function AccountOrGroupText({
|
|
|
681
681
|
return /* @__PURE__ */ jsx8(Fragment2, { children: displayText });
|
|
682
682
|
}
|
|
683
683
|
|
|
684
|
+
// src/inspector/viewer/grid-view.tsx
|
|
685
|
+
import { useState as useState6 } from "react";
|
|
686
|
+
import { styled as styled14 } from "goober";
|
|
687
|
+
|
|
684
688
|
// src/inspector/viewer/type-icon.tsx
|
|
685
689
|
import { styled as styled8 } from "goober";
|
|
686
690
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
@@ -799,10 +803,30 @@ function DeleteIcon(props) {
|
|
|
799
803
|
);
|
|
800
804
|
}
|
|
801
805
|
|
|
802
|
-
// src/inspector/ui/icons/
|
|
806
|
+
// src/inspector/ui/icons/edit-icon.tsx
|
|
803
807
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
804
|
-
function
|
|
808
|
+
function EditIcon(props) {
|
|
805
809
|
return /* @__PURE__ */ jsx13(
|
|
810
|
+
"svg",
|
|
811
|
+
{
|
|
812
|
+
...props,
|
|
813
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
814
|
+
width: "24",
|
|
815
|
+
height: "24",
|
|
816
|
+
viewBox: "0 0 24 24",
|
|
817
|
+
fill: "none",
|
|
818
|
+
stroke: "currentColor",
|
|
819
|
+
strokeLinejoin: "round",
|
|
820
|
+
className: "lucide lucide-edit lucide-pencil",
|
|
821
|
+
children: /* @__PURE__ */ jsx13("path", { d: "M13.2942 7.95881C13.5533 7.63559 13.5013 7.16358 13.178 6.90453C12.8548 6.64549 12.3828 6.6975 12.1238 7.02072L13.2942 7.95881ZM6.811 14.8488L7.37903 15.3385C7.38489 15.3317 7.39062 15.3248 7.39623 15.3178L6.811 14.8488ZM6.64 15.2668L5.89146 15.2179L5.8908 15.2321L6.64 15.2668ZM6.5 18.2898L5.7508 18.2551C5.74908 18.2923 5.75013 18.3296 5.75396 18.3667L6.5 18.2898ZM7.287 18.9768L7.31152 19.7264C7.36154 19.7247 7.41126 19.7181 7.45996 19.7065L7.287 18.9768ZM10.287 18.2658L10.46 18.9956L10.4716 18.9927L10.287 18.2658ZM10.672 18.0218L11.2506 18.4991L11.2571 18.491L10.672 18.0218ZM17.2971 10.959C17.5562 10.6358 17.5043 10.1638 17.1812 9.90466C16.8581 9.64552 16.386 9.69742 16.1269 10.0206L17.2971 10.959ZM12.1269 7.02052C11.8678 7.34365 11.9196 7.81568 12.2428 8.07484C12.5659 8.33399 13.0379 8.28213 13.2971 7.95901L12.1269 7.02052ZM14.3 5.50976L14.8851 5.97901C14.8949 5.96672 14.9044 5.95412 14.9135 5.94123L14.3 5.50976ZM15.929 5.18976L16.4088 4.61332C16.3849 4.59344 16.3598 4.57507 16.3337 4.5583L15.929 5.18976ZM18.166 7.05176L18.6968 6.52192C18.6805 6.50561 18.6635 6.49007 18.6458 6.47532L18.166 7.05176ZM18.5029 7.87264L19.2529 7.87676V7.87676L18.5029 7.87264ZM18.157 8.68976L17.632 8.15412C17.6108 8.17496 17.5908 8.19704 17.5721 8.22025L18.157 8.68976ZM16.1271 10.0203C15.8678 10.3433 15.9195 10.8153 16.2425 11.0746C16.5655 11.3339 17.0376 11.2823 17.2969 10.9593L16.1271 10.0203ZM13.4537 7.37862C13.3923 6.96898 13.0105 6.68666 12.6009 6.74805C12.1912 6.80943 11.9089 7.19127 11.9703 7.60091L13.4537 7.37862ZM16.813 11.2329C17.2234 11.1772 17.5109 10.7992 17.4552 10.3888C17.3994 9.97834 17.0215 9.69082 16.611 9.74659L16.813 11.2329ZM12.1238 7.02072L6.22577 14.3797L7.39623 15.3178L13.2942 7.95881L12.1238 7.02072ZM6.24297 14.359C6.03561 14.5995 5.91226 14.9011 5.89159 15.218L7.38841 15.3156C7.38786 15.324 7.38457 15.3321 7.37903 15.3385L6.24297 14.359ZM5.8908 15.2321L5.7508 18.2551L7.2492 18.3245L7.3892 15.3015L5.8908 15.2321ZM5.75396 18.3667C5.83563 19.1586 6.51588 19.7524 7.31152 19.7264L7.26248 18.2272C7.25928 18.2273 7.25771 18.2268 7.25669 18.2264C7.25526 18.2259 7.25337 18.2249 7.25144 18.2232C7.2495 18.2215 7.24825 18.2198 7.24754 18.2185C7.24703 18.2175 7.24637 18.216 7.24604 18.2128L5.75396 18.3667ZM7.45996 19.7065L10.46 18.9955L10.114 17.536L7.11404 18.247L7.45996 19.7065ZM10.4716 18.9927C10.7771 18.9151 11.05 18.7422 11.2506 18.499L10.0934 17.5445C10.0958 17.5417 10.0989 17.5397 10.1024 17.5388L10.4716 18.9927ZM11.2571 18.491L17.2971 10.959L16.1269 10.0206L10.0869 17.5526L11.2571 18.491ZM13.2971 7.95901L14.8851 5.97901L13.7149 5.04052L12.1269 7.02052L13.2971 7.95901ZM14.9135 5.94123C15.0521 5.74411 15.3214 5.6912 15.5243 5.82123L16.3337 4.5583C15.4544 3.99484 14.2873 4.2241 13.6865 5.0783L14.9135 5.94123ZM15.4492 5.7662L17.6862 7.6282L18.6458 6.47532L16.4088 4.61332L15.4492 5.7662ZM17.6352 7.58161C17.7111 7.6577 17.7535 7.761 17.7529 7.86852L19.2529 7.87676C19.2557 7.36905 19.0555 6.88127 18.6968 6.52192L17.6352 7.58161ZM17.7529 7.86852C17.7524 7.97604 17.7088 8.07886 17.632 8.15412L18.682 9.22541C19.0446 8.87002 19.2501 8.38447 19.2529 7.87676L17.7529 7.86852ZM17.5721 8.22025L16.1271 10.0203L17.2969 10.9593L18.7419 9.15928L17.5721 8.22025ZM11.9703 7.60091C12.3196 9.93221 14.4771 11.5503 16.813 11.2329L16.611 9.74659C15.0881 9.95352 13.6815 8.89855 13.4537 7.37862L11.9703 7.60091Z" })
|
|
822
|
+
}
|
|
823
|
+
);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
// src/inspector/ui/icons/link-icon.tsx
|
|
827
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
828
|
+
function LinkIcon(props) {
|
|
829
|
+
return /* @__PURE__ */ jsx14(
|
|
806
830
|
"svg",
|
|
807
831
|
{
|
|
808
832
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -811,7 +835,7 @@ function LinkIcon(props) {
|
|
|
811
835
|
strokeWidth: 1.5,
|
|
812
836
|
stroke: "currentColor",
|
|
813
837
|
...props,
|
|
814
|
-
children: /* @__PURE__ */
|
|
838
|
+
children: /* @__PURE__ */ jsx14(
|
|
815
839
|
"path",
|
|
816
840
|
{
|
|
817
841
|
strokeLinecap: "round",
|
|
@@ -823,13 +847,82 @@ function LinkIcon(props) {
|
|
|
823
847
|
);
|
|
824
848
|
}
|
|
825
849
|
|
|
850
|
+
// src/inspector/ui/icons/history.tsx
|
|
851
|
+
import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
852
|
+
function HistoryIcon(props) {
|
|
853
|
+
return /* @__PURE__ */ jsxs6(
|
|
854
|
+
"svg",
|
|
855
|
+
{
|
|
856
|
+
...props,
|
|
857
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
858
|
+
width: "24",
|
|
859
|
+
height: "24",
|
|
860
|
+
viewBox: "0 0 24 24",
|
|
861
|
+
fill: "none",
|
|
862
|
+
stroke: "currentColor",
|
|
863
|
+
strokeLinejoin: "round",
|
|
864
|
+
className: "lucide lucide-trash-icon lucide-trash",
|
|
865
|
+
children: [
|
|
866
|
+
/* @__PURE__ */ jsx15(
|
|
867
|
+
"path",
|
|
868
|
+
{
|
|
869
|
+
d: "M5.52786 16.7023C6.6602 18.2608 8.3169 19.3584 10.1936 19.7934C12.0703 20.2284 14.0409 19.9716 15.7434 19.0701C17.446 18.1687 18.766 16.6832 19.4611 14.8865C20.1562 13.0898 20.1796 11.1027 19.527 9.29011C18.8745 7.47756 17.5898 5.96135 15.909 5.02005C14.2282 4.07875 12.2641 3.77558 10.3777 4.16623C8.49129 4.55689 6.80919 5.61514 5.64045 7.14656C4.47171 8.67797 3.89482 10.5797 4.01579 12.5023M4.01579 12.5023L2.51579 11.0023M4.01579 12.5023L5.51579 11.0023",
|
|
870
|
+
strokeWidth: "2",
|
|
871
|
+
strokeLinecap: "round",
|
|
872
|
+
strokeLinejoin: "round"
|
|
873
|
+
}
|
|
874
|
+
),
|
|
875
|
+
/* @__PURE__ */ jsx15(
|
|
876
|
+
"path",
|
|
877
|
+
{
|
|
878
|
+
d: "M12 8V12L15 15",
|
|
879
|
+
strokeWidth: "2",
|
|
880
|
+
strokeLinecap: "round",
|
|
881
|
+
strokeLinejoin: "round"
|
|
882
|
+
}
|
|
883
|
+
)
|
|
884
|
+
]
|
|
885
|
+
}
|
|
886
|
+
);
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
// src/inspector/ui/icons/add-icon.tsx
|
|
890
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
891
|
+
function AddIcon(props) {
|
|
892
|
+
return /* @__PURE__ */ jsx16(
|
|
893
|
+
"svg",
|
|
894
|
+
{
|
|
895
|
+
...props,
|
|
896
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
897
|
+
width: "24",
|
|
898
|
+
height: "24",
|
|
899
|
+
viewBox: "0 0 24 24",
|
|
900
|
+
fill: "none",
|
|
901
|
+
stroke: "currentColor",
|
|
902
|
+
strokeLinejoin: "round",
|
|
903
|
+
children: /* @__PURE__ */ jsx16(
|
|
904
|
+
"path",
|
|
905
|
+
{
|
|
906
|
+
d: "M4 12H20M12 4V20",
|
|
907
|
+
"stroke-width": "2",
|
|
908
|
+
"stroke-linecap": "round",
|
|
909
|
+
"stroke-linejoin": "round"
|
|
910
|
+
}
|
|
911
|
+
)
|
|
912
|
+
}
|
|
913
|
+
);
|
|
914
|
+
}
|
|
915
|
+
|
|
826
916
|
// src/inspector/ui/icon.tsx
|
|
827
|
-
import { jsx as
|
|
917
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
828
918
|
var icons = {
|
|
829
919
|
caution: CautionIcon,
|
|
830
920
|
chevronDown: ChevronDownIcon,
|
|
831
921
|
delete: DeleteIcon,
|
|
832
|
-
|
|
922
|
+
edit: EditIcon,
|
|
923
|
+
link: LinkIcon,
|
|
924
|
+
history: HistoryIcon,
|
|
925
|
+
add: AddIcon
|
|
833
926
|
};
|
|
834
927
|
var sizes = {
|
|
835
928
|
"2xs": 14,
|
|
@@ -873,7 +966,7 @@ function Icon({
|
|
|
873
966
|
throw new Error(`Icon not found: ${name}`);
|
|
874
967
|
}
|
|
875
968
|
const IconComponent = icons?.hasOwnProperty(name) ? icons[name] : icon;
|
|
876
|
-
return /* @__PURE__ */
|
|
969
|
+
return /* @__PURE__ */ jsx17(
|
|
877
970
|
IconComponent,
|
|
878
971
|
{
|
|
879
972
|
"aria-hidden": "true",
|
|
@@ -886,7 +979,7 @@ function Icon({
|
|
|
886
979
|
}
|
|
887
980
|
|
|
888
981
|
// src/inspector/viewer/value-renderer.tsx
|
|
889
|
-
import { Fragment as Fragment3, jsx as
|
|
982
|
+
import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
890
983
|
var LinkContainer = styled9("span")`
|
|
891
984
|
display: inline-flex;
|
|
892
985
|
gap: 0.25rem;
|
|
@@ -950,18 +1043,18 @@ function ValueRenderer({
|
|
|
950
1043
|
}) {
|
|
951
1044
|
const [isExpanded, setIsExpanded] = useState4(false);
|
|
952
1045
|
if (typeof json === "undefined" || json === void 0) {
|
|
953
|
-
return /* @__PURE__ */
|
|
1046
|
+
return /* @__PURE__ */ jsx18(Text, { muted: true, children: "undefined" });
|
|
954
1047
|
}
|
|
955
1048
|
if (json === null) {
|
|
956
|
-
return /* @__PURE__ */
|
|
1049
|
+
return /* @__PURE__ */ jsx18(Text, { muted: true, children: "null" });
|
|
957
1050
|
}
|
|
958
1051
|
if (typeof json === "string" && isCoId(json)) {
|
|
959
|
-
const content = /* @__PURE__ */
|
|
1052
|
+
const content = /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
960
1053
|
json,
|
|
961
|
-
onCoIDClick && /* @__PURE__ */
|
|
1054
|
+
onCoIDClick && /* @__PURE__ */ jsx18(Icon, { name: "link" })
|
|
962
1055
|
] });
|
|
963
1056
|
if (onCoIDClick) {
|
|
964
|
-
return /* @__PURE__ */
|
|
1057
|
+
return /* @__PURE__ */ jsx18(
|
|
965
1058
|
Button,
|
|
966
1059
|
{
|
|
967
1060
|
variant: "link",
|
|
@@ -972,35 +1065,35 @@ function ValueRenderer({
|
|
|
972
1065
|
}
|
|
973
1066
|
);
|
|
974
1067
|
}
|
|
975
|
-
return /* @__PURE__ */
|
|
1068
|
+
return /* @__PURE__ */ jsx18(LinkContainer, { children: content });
|
|
976
1069
|
}
|
|
977
1070
|
if (typeof json === "string") {
|
|
978
|
-
return /* @__PURE__ */
|
|
1071
|
+
return /* @__PURE__ */ jsx18(Text, { children: json });
|
|
979
1072
|
}
|
|
980
1073
|
if (typeof json === "number") {
|
|
981
|
-
return /* @__PURE__ */
|
|
1074
|
+
return /* @__PURE__ */ jsx18(Text, { mono: true, children: json });
|
|
982
1075
|
}
|
|
983
1076
|
if (typeof json === "boolean") {
|
|
984
|
-
return /* @__PURE__ */
|
|
1077
|
+
return /* @__PURE__ */ jsx18(BooleanText, { value: json, children: json.toString() });
|
|
985
1078
|
}
|
|
986
1079
|
const longJson = JSON.stringify(json, null, 2);
|
|
987
1080
|
const shortJson = longJson.split("\n").slice(0, compact ? 3 : 8).join("\n");
|
|
988
1081
|
const hasDifference = longJson !== shortJson;
|
|
989
1082
|
if (typeof json === "object") {
|
|
990
|
-
return /* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
1083
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1084
|
+
/* @__PURE__ */ jsx18("p", { children: Array.isArray(json) ? /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
992
1085
|
"Array (",
|
|
993
1086
|
json.length,
|
|
994
1087
|
")"
|
|
995
|
-
] }) : /* @__PURE__ */
|
|
996
|
-
/* @__PURE__ */
|
|
1088
|
+
] }) : /* @__PURE__ */ jsx18(Fragment3, { children: "Object" }) }),
|
|
1089
|
+
/* @__PURE__ */ jsxs7(ObjectContent, { children: [
|
|
997
1090
|
isExpanded ? longJson : shortJson,
|
|
998
1091
|
hasDifference && !isExpanded ? "\n ..." : null
|
|
999
1092
|
] }),
|
|
1000
|
-
!compact && hasDifference ? /* @__PURE__ */
|
|
1093
|
+
!compact && hasDifference ? /* @__PURE__ */ jsx18(Button, { variant: "link", onClick: () => setIsExpanded(!isExpanded), children: isExpanded ? "Show less" : "Show more" }) : null
|
|
1001
1094
|
] });
|
|
1002
1095
|
}
|
|
1003
|
-
return /* @__PURE__ */
|
|
1096
|
+
return /* @__PURE__ */ jsx18("span", { children: String(json) });
|
|
1004
1097
|
}
|
|
1005
1098
|
var CoMapPreview = ({
|
|
1006
1099
|
coId,
|
|
@@ -1012,7 +1105,7 @@ var CoMapPreview = ({
|
|
|
1012
1105
|
node
|
|
1013
1106
|
);
|
|
1014
1107
|
if (!snapshot) {
|
|
1015
|
-
return /* @__PURE__ */
|
|
1108
|
+
return /* @__PURE__ */ jsx18(
|
|
1016
1109
|
"div",
|
|
1017
1110
|
{
|
|
1018
1111
|
style: {
|
|
@@ -1027,15 +1120,15 @@ var CoMapPreview = ({
|
|
|
1027
1120
|
);
|
|
1028
1121
|
}
|
|
1029
1122
|
if (snapshot === "unavailable" && !value) {
|
|
1030
|
-
return /* @__PURE__ */
|
|
1123
|
+
return /* @__PURE__ */ jsx18(Text, { inline: true, muted: true, children: "Unavailable" });
|
|
1031
1124
|
}
|
|
1032
1125
|
if (type === "coplaintext") {
|
|
1033
|
-
return /* @__PURE__ */
|
|
1126
|
+
return /* @__PURE__ */ jsx18(Fragment3, { children: value.toString() });
|
|
1034
1127
|
}
|
|
1035
1128
|
if (extendedType === "image" && isBrowserImage(snapshot)) {
|
|
1036
|
-
return /* @__PURE__ */
|
|
1037
|
-
/* @__PURE__ */
|
|
1038
|
-
/* @__PURE__ */
|
|
1129
|
+
return /* @__PURE__ */ jsxs7(ImagePreviewContainer2, { children: [
|
|
1130
|
+
/* @__PURE__ */ jsx18(PreviewImage, { src: snapshot.placeholderDataURL }),
|
|
1131
|
+
/* @__PURE__ */ jsxs7(Text, { inline: true, small: true, muted: true, children: [
|
|
1039
1132
|
snapshot.originalSize[0],
|
|
1040
1133
|
" x ",
|
|
1041
1134
|
snapshot.originalSize[1]
|
|
@@ -1043,10 +1136,10 @@ var CoMapPreview = ({
|
|
|
1043
1136
|
] });
|
|
1044
1137
|
}
|
|
1045
1138
|
if (extendedType === "record") {
|
|
1046
|
-
return /* @__PURE__ */
|
|
1139
|
+
return /* @__PURE__ */ jsxs7(RecordText, { children: [
|
|
1047
1140
|
"Record",
|
|
1048
1141
|
" ",
|
|
1049
|
-
/* @__PURE__ */
|
|
1142
|
+
/* @__PURE__ */ jsxs7(Text, { inline: true, muted: true, children: [
|
|
1050
1143
|
"(",
|
|
1051
1144
|
Object.keys(snapshot).length,
|
|
1052
1145
|
")"
|
|
@@ -1054,10 +1147,10 @@ var CoMapPreview = ({
|
|
|
1054
1147
|
] });
|
|
1055
1148
|
}
|
|
1056
1149
|
if (type === "colist") {
|
|
1057
|
-
return /* @__PURE__ */
|
|
1150
|
+
return /* @__PURE__ */ jsxs7(ListText, { children: [
|
|
1058
1151
|
"List",
|
|
1059
1152
|
" ",
|
|
1060
|
-
/* @__PURE__ */
|
|
1153
|
+
/* @__PURE__ */ jsxs7(Text, { inline: true, muted: true, children: [
|
|
1061
1154
|
"(",
|
|
1062
1155
|
snapshot.length,
|
|
1063
1156
|
")"
|
|
@@ -1068,24 +1161,209 @@ var CoMapPreview = ({
|
|
|
1068
1161
|
const limitedProperties = extendedType === "account" ? properties.filter(
|
|
1069
1162
|
([key]) => !key.startsWith("key_z") && !key.startsWith("sealer_z") && key !== "readKey"
|
|
1070
1163
|
).slice(0, limit) : properties.slice(0, limit);
|
|
1071
|
-
return /* @__PURE__ */
|
|
1072
|
-
/* @__PURE__ */
|
|
1073
|
-
/* @__PURE__ */
|
|
1164
|
+
return /* @__PURE__ */ jsxs7(PreviewContainer, { children: [
|
|
1165
|
+
/* @__PURE__ */ jsx18(PreviewGrid, { children: limitedProperties.map(([key, value2]) => /* @__PURE__ */ jsxs7(React3.Fragment, { children: [
|
|
1166
|
+
/* @__PURE__ */ jsxs7(Text, { strong: true, children: [
|
|
1074
1167
|
key,
|
|
1075
1168
|
": "
|
|
1076
1169
|
] }),
|
|
1077
|
-
/* @__PURE__ */
|
|
1170
|
+
/* @__PURE__ */ jsx18(ValueRenderer, { compact: true, json: value2 })
|
|
1078
1171
|
] }, key)) }),
|
|
1079
|
-
properties.length > limit && /* @__PURE__ */
|
|
1172
|
+
properties.length > limit && /* @__PURE__ */ jsxs7(PreviewMoreText, { muted: true, small: true, children: [
|
|
1080
1173
|
properties.length - limit,
|
|
1081
1174
|
" more"
|
|
1082
1175
|
] })
|
|
1083
1176
|
] });
|
|
1084
1177
|
};
|
|
1085
1178
|
|
|
1086
|
-
// src/inspector/
|
|
1179
|
+
// src/inspector/viewer/co-value-editor.tsx
|
|
1180
|
+
import { useState as useState5 } from "react";
|
|
1181
|
+
import { styled as styled11 } from "goober";
|
|
1182
|
+
|
|
1183
|
+
// src/inspector/ui/select.tsx
|
|
1087
1184
|
import { styled as styled10 } from "goober";
|
|
1088
|
-
|
|
1185
|
+
import { useId as useId2 } from "react";
|
|
1186
|
+
import { jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1187
|
+
var SelectContainer = styled10("div")`
|
|
1188
|
+
display: grid;
|
|
1189
|
+
gap: 0.25rem;
|
|
1190
|
+
`;
|
|
1191
|
+
var SelectWrapper = styled10("div")`
|
|
1192
|
+
position: relative;
|
|
1193
|
+
display: flex;
|
|
1194
|
+
align-items: center;
|
|
1195
|
+
`;
|
|
1196
|
+
var StyledSelect = styled10("select")`
|
|
1197
|
+
width: 100%;
|
|
1198
|
+
border-radius: var(--j-radius-md);
|
|
1199
|
+
border: 1px solid var(--j-border-color);
|
|
1200
|
+
padding: 0.5rem 0.875rem 0.5rem 0.875rem;
|
|
1201
|
+
padding-right: 2rem;
|
|
1202
|
+
box-shadow: var(--j-shadow-sm);
|
|
1203
|
+
font-weight: 500;
|
|
1204
|
+
color: var(--j-text-color-strong);
|
|
1205
|
+
appearance: none;
|
|
1206
|
+
overflow: hidden;
|
|
1207
|
+
text-overflow: ellipsis;
|
|
1208
|
+
white-space: nowrap;
|
|
1209
|
+
|
|
1210
|
+
@media (prefers-color-scheme: dark) {
|
|
1211
|
+
background-color: var(--j-foreground);
|
|
1212
|
+
}
|
|
1213
|
+
`;
|
|
1214
|
+
var SelectIcon = styled10("span")`
|
|
1215
|
+
position: absolute;
|
|
1216
|
+
right: 0.5em;
|
|
1217
|
+
color: var(--j-neutral-400);
|
|
1218
|
+
pointer-events: none;
|
|
1219
|
+
|
|
1220
|
+
@media (prefers-color-scheme: dark) {
|
|
1221
|
+
color: var(--j-neutral-900);
|
|
1222
|
+
}
|
|
1223
|
+
`;
|
|
1224
|
+
function Select(props) {
|
|
1225
|
+
const { label, hideLabel, id: customId, className, ...selectProps } = props;
|
|
1226
|
+
const generatedId = useId2();
|
|
1227
|
+
const id = customId || generatedId;
|
|
1228
|
+
return /* @__PURE__ */ jsxs8(SelectContainer, { className, children: [
|
|
1229
|
+
/* @__PURE__ */ jsx19("label", { htmlFor: id, className: hideLabel ? "j-sr-only" : "", children: label }),
|
|
1230
|
+
/* @__PURE__ */ jsxs8(SelectWrapper, { children: [
|
|
1231
|
+
/* @__PURE__ */ jsx19(StyledSelect, { ...selectProps, id, children: props.children }),
|
|
1232
|
+
/* @__PURE__ */ jsx19(SelectIcon, { children: /* @__PURE__ */ jsx19(Icon, { name: "chevronDown", size: "sm" }) })
|
|
1233
|
+
] })
|
|
1234
|
+
] });
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
// src/inspector/viewer/co-value-editor.tsx
|
|
1238
|
+
import { jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1239
|
+
function CoValueEditor({
|
|
1240
|
+
node,
|
|
1241
|
+
property,
|
|
1242
|
+
value,
|
|
1243
|
+
coValue,
|
|
1244
|
+
onCancel
|
|
1245
|
+
}) {
|
|
1246
|
+
const getInitialType = () => {
|
|
1247
|
+
if (value === null) return "null";
|
|
1248
|
+
if (value === void 0) return "undefined";
|
|
1249
|
+
if (typeof value === "number") return "number";
|
|
1250
|
+
if (typeof value === "string") return "string";
|
|
1251
|
+
if (typeof value === "boolean") return value ? "true" : "false";
|
|
1252
|
+
if (typeof value === "object") return "object";
|
|
1253
|
+
return "undefined";
|
|
1254
|
+
};
|
|
1255
|
+
const [selectedType, setSelectedType] = useState5(getInitialType());
|
|
1256
|
+
const [editValue, setEditValue] = useState5(
|
|
1257
|
+
value === void 0 || value === null ? "" : typeof value === "object" ? JSON.stringify(value, null, 2) : String(value)
|
|
1258
|
+
);
|
|
1259
|
+
const handleSubmit = (e) => {
|
|
1260
|
+
e.preventDefault();
|
|
1261
|
+
e.stopPropagation();
|
|
1262
|
+
let newValue;
|
|
1263
|
+
switch (selectedType) {
|
|
1264
|
+
case "null":
|
|
1265
|
+
newValue = null;
|
|
1266
|
+
break;
|
|
1267
|
+
case "undefined":
|
|
1268
|
+
newValue = void 0;
|
|
1269
|
+
break;
|
|
1270
|
+
case "true":
|
|
1271
|
+
newValue = true;
|
|
1272
|
+
break;
|
|
1273
|
+
case "false":
|
|
1274
|
+
newValue = false;
|
|
1275
|
+
break;
|
|
1276
|
+
case "number":
|
|
1277
|
+
newValue = parseFloat(editValue);
|
|
1278
|
+
break;
|
|
1279
|
+
case "string":
|
|
1280
|
+
newValue = editValue;
|
|
1281
|
+
break;
|
|
1282
|
+
case "object":
|
|
1283
|
+
newValue = JSON.parse(editValue);
|
|
1284
|
+
break;
|
|
1285
|
+
default:
|
|
1286
|
+
throw new Error(`Invalid type: ${selectedType}`);
|
|
1287
|
+
}
|
|
1288
|
+
coValue.core.makeTransaction(
|
|
1289
|
+
[
|
|
1290
|
+
{
|
|
1291
|
+
op: "set",
|
|
1292
|
+
key: property,
|
|
1293
|
+
value: newValue
|
|
1294
|
+
}
|
|
1295
|
+
],
|
|
1296
|
+
"private"
|
|
1297
|
+
);
|
|
1298
|
+
onCancel();
|
|
1299
|
+
};
|
|
1300
|
+
const showTextarea = selectedType === "number" || selectedType === "string" || selectedType === "object";
|
|
1301
|
+
return /* @__PURE__ */ jsxs9(EditForm, { onSubmit: handleSubmit, children: [
|
|
1302
|
+
/* @__PURE__ */ jsxs9(
|
|
1303
|
+
Select,
|
|
1304
|
+
{
|
|
1305
|
+
label: "Type",
|
|
1306
|
+
value: selectedType,
|
|
1307
|
+
onChange: (e) => {
|
|
1308
|
+
setSelectedType(e.target.value);
|
|
1309
|
+
},
|
|
1310
|
+
onClick: (e) => e.stopPropagation(),
|
|
1311
|
+
children: [
|
|
1312
|
+
/* @__PURE__ */ jsx20("option", { value: "number", children: "number" }),
|
|
1313
|
+
/* @__PURE__ */ jsx20("option", { value: "string", children: "string" }),
|
|
1314
|
+
/* @__PURE__ */ jsx20("option", { value: "true", children: "true" }),
|
|
1315
|
+
/* @__PURE__ */ jsx20("option", { value: "false", children: "false" }),
|
|
1316
|
+
/* @__PURE__ */ jsx20("option", { value: "object", children: "object" }),
|
|
1317
|
+
/* @__PURE__ */ jsx20("option", { value: "null", children: "null" }),
|
|
1318
|
+
/* @__PURE__ */ jsx20("option", { value: "undefined", children: "undefined" })
|
|
1319
|
+
]
|
|
1320
|
+
}
|
|
1321
|
+
),
|
|
1322
|
+
showTextarea && /* @__PURE__ */ jsx20(
|
|
1323
|
+
StyledTextarea,
|
|
1324
|
+
{
|
|
1325
|
+
value: editValue,
|
|
1326
|
+
onChange: (e) => setEditValue(e.target.value),
|
|
1327
|
+
onClick: (e) => e.stopPropagation()
|
|
1328
|
+
}
|
|
1329
|
+
),
|
|
1330
|
+
/* @__PURE__ */ jsxs9(FormActions, { children: [
|
|
1331
|
+
/* @__PURE__ */ jsx20(Button, { type: "button", variant: "secondary", onClick: onCancel, children: "Cancel" }),
|
|
1332
|
+
/* @__PURE__ */ jsx20(Button, { type: "submit", variant: "primary", children: "Submit" })
|
|
1333
|
+
] })
|
|
1334
|
+
] });
|
|
1335
|
+
}
|
|
1336
|
+
var EditForm = styled11("form")`
|
|
1337
|
+
display: flex;
|
|
1338
|
+
flex-direction: column;
|
|
1339
|
+
gap: 0.75rem;
|
|
1340
|
+
`;
|
|
1341
|
+
var StyledTextarea = styled11("textarea")`
|
|
1342
|
+
width: 100%;
|
|
1343
|
+
min-height: 120px;
|
|
1344
|
+
border-radius: var(--j-radius-md);
|
|
1345
|
+
border: 1px solid var(--j-border-color);
|
|
1346
|
+
padding: 0.5rem 0.875rem;
|
|
1347
|
+
box-shadow: var(--j-shadow-sm);
|
|
1348
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
1349
|
+
font-size: 0.875rem;
|
|
1350
|
+
background-color: white;
|
|
1351
|
+
color: var(--j-text-color-strong);
|
|
1352
|
+
resize: vertical;
|
|
1353
|
+
|
|
1354
|
+
@media (prefers-color-scheme: dark) {
|
|
1355
|
+
background-color: var(--j-foreground);
|
|
1356
|
+
}
|
|
1357
|
+
`;
|
|
1358
|
+
var FormActions = styled11("div")`
|
|
1359
|
+
display: flex;
|
|
1360
|
+
gap: 0.5rem;
|
|
1361
|
+
justify-content: flex-end;
|
|
1362
|
+
`;
|
|
1363
|
+
|
|
1364
|
+
// src/inspector/ui/card.tsx
|
|
1365
|
+
import { styled as styled12 } from "goober";
|
|
1366
|
+
var Card = styled12("div")`
|
|
1089
1367
|
background-color: var(--j-background);
|
|
1090
1368
|
border-radius: var(--j-radius-lg);
|
|
1091
1369
|
box-shadow: var(--j-shadow-sm);
|
|
@@ -1097,19 +1375,19 @@ var Card = styled10("div")`
|
|
|
1097
1375
|
flex-direction: column;
|
|
1098
1376
|
gap: 0.5rem;
|
|
1099
1377
|
`;
|
|
1100
|
-
var CardHeader =
|
|
1378
|
+
var CardHeader = styled12("div")`
|
|
1101
1379
|
display: flex;
|
|
1102
1380
|
justify-content: space-between;
|
|
1103
1381
|
align-items: center;
|
|
1104
1382
|
`;
|
|
1105
|
-
var CardBody =
|
|
1383
|
+
var CardBody = styled12("div")`
|
|
1106
1384
|
flex: 1;
|
|
1107
1385
|
`;
|
|
1108
1386
|
|
|
1109
1387
|
// src/inspector/ui/grid.tsx
|
|
1110
|
-
import { styled as
|
|
1111
|
-
import { jsx as
|
|
1112
|
-
var GridThreeColumns =
|
|
1388
|
+
import { styled as styled13 } from "goober";
|
|
1389
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1390
|
+
var GridThreeColumns = styled13("div")`
|
|
1113
1391
|
display: grid;
|
|
1114
1392
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
1115
1393
|
gap: 1rem;
|
|
@@ -1122,7 +1400,7 @@ var GridThreeColumns = styled11("div")`
|
|
|
1122
1400
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
1123
1401
|
}
|
|
1124
1402
|
`;
|
|
1125
|
-
var GridTwoColumns =
|
|
1403
|
+
var GridTwoColumns = styled13("div")`
|
|
1126
1404
|
display: grid;
|
|
1127
1405
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
1128
1406
|
gap: 1rem;
|
|
@@ -1131,7 +1409,7 @@ var GridTwoColumns = styled11("div")`
|
|
|
1131
1409
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1132
1410
|
}
|
|
1133
1411
|
`;
|
|
1134
|
-
var GridOneColumn =
|
|
1412
|
+
var GridOneColumn = styled13("div")`
|
|
1135
1413
|
display: grid;
|
|
1136
1414
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
1137
1415
|
gap: 1rem;
|
|
@@ -1140,26 +1418,76 @@ function Grid(props) {
|
|
|
1140
1418
|
const { cols, children, ...rest } = props;
|
|
1141
1419
|
switch (cols) {
|
|
1142
1420
|
case 1:
|
|
1143
|
-
return /* @__PURE__ */
|
|
1421
|
+
return /* @__PURE__ */ jsx21(GridOneColumn, { ...rest, children });
|
|
1144
1422
|
case 2:
|
|
1145
|
-
return /* @__PURE__ */
|
|
1423
|
+
return /* @__PURE__ */ jsx21(GridTwoColumns, { ...rest, children });
|
|
1146
1424
|
case 3:
|
|
1147
|
-
return /* @__PURE__ */
|
|
1425
|
+
return /* @__PURE__ */ jsx21(GridThreeColumns, { ...rest, children });
|
|
1148
1426
|
default:
|
|
1149
1427
|
throw new Error(`Invalid number of columns: ${cols}`);
|
|
1150
1428
|
}
|
|
1151
1429
|
}
|
|
1152
1430
|
|
|
1153
1431
|
// src/inspector/viewer/grid-view.tsx
|
|
1154
|
-
import { Fragment as Fragment4, jsx as
|
|
1432
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1155
1433
|
function GridItem({
|
|
1156
1434
|
entry,
|
|
1157
1435
|
onNavigate,
|
|
1158
|
-
node
|
|
1436
|
+
node,
|
|
1437
|
+
coValue
|
|
1159
1438
|
}) {
|
|
1160
1439
|
const [key, value] = entry;
|
|
1161
1440
|
const isCoValue = isCoId(value);
|
|
1162
|
-
const
|
|
1441
|
+
const [isEditing, setIsEditing] = useState6(false);
|
|
1442
|
+
const handleEditClick = (e) => {
|
|
1443
|
+
e.stopPropagation();
|
|
1444
|
+
setIsEditing(true);
|
|
1445
|
+
};
|
|
1446
|
+
const handleCancel = () => {
|
|
1447
|
+
setIsEditing(false);
|
|
1448
|
+
};
|
|
1449
|
+
const handleDelete = (e) => {
|
|
1450
|
+
e.stopPropagation();
|
|
1451
|
+
if (confirm(`Are you sure you want to delete the property "${key}"?`)) {
|
|
1452
|
+
coValue?.core.makeTransaction(
|
|
1453
|
+
[
|
|
1454
|
+
{
|
|
1455
|
+
op: "del",
|
|
1456
|
+
key
|
|
1457
|
+
}
|
|
1458
|
+
],
|
|
1459
|
+
"private"
|
|
1460
|
+
);
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1463
|
+
if (isEditing) {
|
|
1464
|
+
return /* @__PURE__ */ jsxs10(
|
|
1465
|
+
Card,
|
|
1466
|
+
{
|
|
1467
|
+
style: {
|
|
1468
|
+
backgroundColor: "var(--j-foreground)",
|
|
1469
|
+
borderColor: "var(--j-foreground)"
|
|
1470
|
+
},
|
|
1471
|
+
children: [
|
|
1472
|
+
/* @__PURE__ */ jsx22(CardHeader, { children: /* @__PURE__ */ jsx22("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: isCoValue ? /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1473
|
+
/* @__PURE__ */ jsx22(Text, { strong: true, children: key }),
|
|
1474
|
+
/* @__PURE__ */ jsx22(Badge, { children: /* @__PURE__ */ jsx22(ResolveIcon, { coId: value, node }) })
|
|
1475
|
+
] }) : /* @__PURE__ */ jsx22(Text, { strong: true, children: key }) }) }),
|
|
1476
|
+
/* @__PURE__ */ jsx22(CardBody, { style: { wordBreak: "break-word" }, children: /* @__PURE__ */ jsx22(
|
|
1477
|
+
CoValueEditor,
|
|
1478
|
+
{
|
|
1479
|
+
node,
|
|
1480
|
+
property: key,
|
|
1481
|
+
value,
|
|
1482
|
+
coValue,
|
|
1483
|
+
onCancel: handleCancel
|
|
1484
|
+
}
|
|
1485
|
+
) })
|
|
1486
|
+
]
|
|
1487
|
+
}
|
|
1488
|
+
);
|
|
1489
|
+
}
|
|
1490
|
+
const cardProps = isCoValue ? {
|
|
1163
1491
|
onClick: () => onNavigate([{ coId: value, name: key }]),
|
|
1164
1492
|
as: "button"
|
|
1165
1493
|
} : {
|
|
@@ -1168,12 +1496,34 @@ function GridItem({
|
|
|
1168
1496
|
borderColor: "var(--j-foreground)"
|
|
1169
1497
|
}
|
|
1170
1498
|
};
|
|
1171
|
-
return /* @__PURE__ */
|
|
1172
|
-
/* @__PURE__ */
|
|
1173
|
-
/* @__PURE__ */
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1499
|
+
return /* @__PURE__ */ jsxs10(Card, { ...cardProps, children: [
|
|
1500
|
+
/* @__PURE__ */ jsxs10(CardHeader, { children: [
|
|
1501
|
+
/* @__PURE__ */ jsx22("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: isCoValue ? /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1502
|
+
/* @__PURE__ */ jsx22(Text, { strong: true, children: key }),
|
|
1503
|
+
/* @__PURE__ */ jsx22(Badge, { children: /* @__PURE__ */ jsx22(ResolveIcon, { coId: value, node }) })
|
|
1504
|
+
] }) : /* @__PURE__ */ jsx22(Text, { strong: true, children: key }) }),
|
|
1505
|
+
coValue && /* @__PURE__ */ jsxs10(ActionButtons, { children: [
|
|
1506
|
+
/* @__PURE__ */ jsx22(
|
|
1507
|
+
EditButton,
|
|
1508
|
+
{
|
|
1509
|
+
onClick: handleEditClick,
|
|
1510
|
+
type: "button",
|
|
1511
|
+
"aria-label": "Edit",
|
|
1512
|
+
children: /* @__PURE__ */ jsx22(Icon, { name: "edit", size: "sm" })
|
|
1513
|
+
}
|
|
1514
|
+
),
|
|
1515
|
+
/* @__PURE__ */ jsx22(
|
|
1516
|
+
DeleteButton,
|
|
1517
|
+
{
|
|
1518
|
+
onClick: handleDelete,
|
|
1519
|
+
type: "button",
|
|
1520
|
+
"aria-label": "Delete",
|
|
1521
|
+
children: /* @__PURE__ */ jsx22(Icon, { name: "delete", size: "sm" })
|
|
1522
|
+
}
|
|
1523
|
+
)
|
|
1524
|
+
] })
|
|
1525
|
+
] }),
|
|
1526
|
+
/* @__PURE__ */ jsx22(CardBody, { style: { wordBreak: "break-word" }, children: isCoValue ? /* @__PURE__ */ jsx22(CoMapPreview, { coId: value, node }) : /* @__PURE__ */ jsx22(
|
|
1177
1527
|
ValueRenderer,
|
|
1178
1528
|
{
|
|
1179
1529
|
json: value,
|
|
@@ -1187,28 +1537,67 @@ function GridItem({
|
|
|
1187
1537
|
function GridView({
|
|
1188
1538
|
data,
|
|
1189
1539
|
onNavigate,
|
|
1190
|
-
node
|
|
1540
|
+
node,
|
|
1541
|
+
coValue
|
|
1191
1542
|
}) {
|
|
1192
1543
|
const entries = Object.entries(data);
|
|
1193
|
-
return /* @__PURE__ */
|
|
1544
|
+
return /* @__PURE__ */ jsx22(Grid, { cols: entries.length === 1 ? 1 : 3, children: entries.map((entry, childIndex) => /* @__PURE__ */ jsx22(
|
|
1194
1545
|
GridItem,
|
|
1195
1546
|
{
|
|
1196
1547
|
entry,
|
|
1197
1548
|
onNavigate,
|
|
1198
|
-
node
|
|
1549
|
+
node,
|
|
1550
|
+
coValue
|
|
1199
1551
|
},
|
|
1200
1552
|
childIndex
|
|
1201
1553
|
)) });
|
|
1202
1554
|
}
|
|
1555
|
+
var EditButton = styled14("button")`
|
|
1556
|
+
display: inline-flex;
|
|
1557
|
+
align-items: center;
|
|
1558
|
+
justify-content: center;
|
|
1559
|
+
padding: 0.25rem;
|
|
1560
|
+
border: none;
|
|
1561
|
+
background: transparent;
|
|
1562
|
+
cursor: pointer;
|
|
1563
|
+
color: var(--j-text-color);
|
|
1564
|
+
border-radius: var(--j-radius-sm);
|
|
1565
|
+
transition: background-color 0.2s;
|
|
1566
|
+
|
|
1567
|
+
&:hover {
|
|
1568
|
+
background-color: var(--j-foreground);
|
|
1569
|
+
}
|
|
1570
|
+
`;
|
|
1571
|
+
var DeleteButton = styled14("button")`
|
|
1572
|
+
display: inline-flex;
|
|
1573
|
+
align-items: center;
|
|
1574
|
+
justify-content: center;
|
|
1575
|
+
padding: 0.25rem;
|
|
1576
|
+
border: none;
|
|
1577
|
+
background: transparent;
|
|
1578
|
+
cursor: pointer;
|
|
1579
|
+
color: var(--j-text-color);
|
|
1580
|
+
border-radius: var(--j-radius-sm);
|
|
1581
|
+
transition: background-color 0.2s;
|
|
1582
|
+
|
|
1583
|
+
&:hover {
|
|
1584
|
+
background-color: var(--j-foreground);
|
|
1585
|
+
}
|
|
1586
|
+
`;
|
|
1587
|
+
var ActionButtons = styled14("div")`
|
|
1588
|
+
display: flex;
|
|
1589
|
+
align-items: center;
|
|
1590
|
+
gap: 0.25rem;
|
|
1591
|
+
`;
|
|
1203
1592
|
|
|
1204
1593
|
// src/inspector/viewer/raw-data-card.tsx
|
|
1205
|
-
import { useEffect as useEffect7, useState as
|
|
1594
|
+
import { useEffect as useEffect7, useState as useState9 } from "react";
|
|
1206
1595
|
|
|
1207
1596
|
// src/inspector/ui/modal.tsx
|
|
1208
|
-
import { styled as
|
|
1597
|
+
import { styled as styled15 } from "goober";
|
|
1209
1598
|
import { forwardRef as forwardRef3, useEffect as useEffect4, useRef } from "react";
|
|
1210
|
-
import { jsx as
|
|
1211
|
-
var ModalContent =
|
|
1599
|
+
import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1600
|
+
var ModalContent = styled15("dialog")`
|
|
1212
1601
|
background-color: var(--j-background);
|
|
1213
1602
|
border-radius: var(--j-radius-lg);
|
|
1214
1603
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
|
@@ -1219,26 +1608,26 @@ var ModalContent = styled12("dialog")`
|
|
|
1219
1608
|
&::backdrop {
|
|
1220
1609
|
background-color: rgba(0, 0, 0, 0.7);
|
|
1221
1610
|
}
|
|
1222
|
-
|
|
1611
|
+
|
|
1223
1612
|
`;
|
|
1224
|
-
var ModalHeader =
|
|
1613
|
+
var ModalHeader = styled15("div")`
|
|
1225
1614
|
display: flex;
|
|
1226
1615
|
justify-content: space-between;
|
|
1227
1616
|
align-items: flex-start;
|
|
1228
1617
|
padding: 1.5rem 1.5rem 0 1.5rem;
|
|
1229
1618
|
gap: 1rem;
|
|
1230
1619
|
`;
|
|
1231
|
-
var ModalBody =
|
|
1620
|
+
var ModalBody = styled15("div")`
|
|
1232
1621
|
padding: 1rem 1.5rem;
|
|
1233
1622
|
flex: 1;
|
|
1234
1623
|
`;
|
|
1235
|
-
var ModalFooter =
|
|
1624
|
+
var ModalFooter = styled15("div")`
|
|
1236
1625
|
display: flex;
|
|
1237
1626
|
justify-content: flex-end;
|
|
1238
1627
|
gap: 0.75rem;
|
|
1239
1628
|
padding: 0 1.5rem 1.5rem 1.5rem;
|
|
1240
1629
|
`;
|
|
1241
|
-
var CloseButton =
|
|
1630
|
+
var CloseButton = styled15("button")`
|
|
1242
1631
|
background: none;
|
|
1243
1632
|
border: none;
|
|
1244
1633
|
cursor: pointer;
|
|
@@ -1252,11 +1641,11 @@ var CloseButton = styled12("button")`
|
|
|
1252
1641
|
justify-content: center;
|
|
1253
1642
|
min-width: 2rem;
|
|
1254
1643
|
min-height: 2rem;
|
|
1255
|
-
|
|
1644
|
+
|
|
1256
1645
|
&:hover {
|
|
1257
1646
|
background-color: var(--j-foreground);
|
|
1258
1647
|
}
|
|
1259
|
-
|
|
1648
|
+
|
|
1260
1649
|
&:focus-visible {
|
|
1261
1650
|
outline: 2px solid var(--j-border-focus);
|
|
1262
1651
|
outline-offset: 2px;
|
|
@@ -1294,7 +1683,7 @@ var Modal = forwardRef3(
|
|
|
1294
1683
|
onClose();
|
|
1295
1684
|
};
|
|
1296
1685
|
if (!isOpen) return null;
|
|
1297
|
-
return /* @__PURE__ */
|
|
1686
|
+
return /* @__PURE__ */ jsxs11(
|
|
1298
1687
|
ModalContent,
|
|
1299
1688
|
{
|
|
1300
1689
|
ref: ref || modalRef,
|
|
@@ -1303,90 +1692,36 @@ var Modal = forwardRef3(
|
|
|
1303
1692
|
"aria-labelledby": "modal-heading",
|
|
1304
1693
|
onClose,
|
|
1305
1694
|
children: [
|
|
1306
|
-
/* @__PURE__ */
|
|
1307
|
-
/* @__PURE__ */
|
|
1308
|
-
/* @__PURE__ */
|
|
1309
|
-
] }),
|
|
1310
|
-
/* @__PURE__ */
|
|
1311
|
-
text && /* @__PURE__ */
|
|
1312
|
-
children
|
|
1313
|
-
] }),
|
|
1314
|
-
showButtons && /* @__PURE__ */
|
|
1315
|
-
/* @__PURE__ */
|
|
1316
|
-
/* @__PURE__ */
|
|
1317
|
-
] })
|
|
1318
|
-
]
|
|
1319
|
-
}
|
|
1320
|
-
);
|
|
1321
|
-
}
|
|
1322
|
-
);
|
|
1323
|
-
Modal.displayName = "Modal";
|
|
1324
|
-
|
|
1325
|
-
// src/inspector/ui/select.tsx
|
|
1326
|
-
import { styled as styled13 } from "goober";
|
|
1327
|
-
import { useId as useId2 } from "react";
|
|
1328
|
-
import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1329
|
-
var SelectContainer = styled13("div")`
|
|
1330
|
-
display: grid;
|
|
1331
|
-
gap: 0.25rem;
|
|
1332
|
-
`;
|
|
1333
|
-
var SelectWrapper = styled13("div")`
|
|
1334
|
-
position: relative;
|
|
1335
|
-
display: flex;
|
|
1336
|
-
align-items: center;
|
|
1337
|
-
`;
|
|
1338
|
-
var StyledSelect = styled13("select")`
|
|
1339
|
-
width: 100%;
|
|
1340
|
-
border-radius: var(--j-radius-md);
|
|
1341
|
-
border: 1px solid var(--j-border-color);
|
|
1342
|
-
padding: 0.5rem 0.875rem 0.5rem 0.875rem;
|
|
1343
|
-
padding-right: 2rem;
|
|
1344
|
-
box-shadow: var(--j-shadow-sm);
|
|
1345
|
-
font-weight: 500;
|
|
1346
|
-
color: var(--j-text-color-strong);
|
|
1347
|
-
appearance: none;
|
|
1348
|
-
overflow: hidden;
|
|
1349
|
-
text-overflow: ellipsis;
|
|
1350
|
-
white-space: nowrap;
|
|
1351
|
-
|
|
1352
|
-
@media (prefers-color-scheme: dark) {
|
|
1353
|
-
background-color: var(--j-foreground);
|
|
1354
|
-
}
|
|
1355
|
-
`;
|
|
1356
|
-
var SelectIcon = styled13("span")`
|
|
1357
|
-
position: absolute;
|
|
1358
|
-
right: 0.5em;
|
|
1359
|
-
color: var(--j-neutral-400);
|
|
1360
|
-
pointer-events: none;
|
|
1361
|
-
|
|
1362
|
-
@media (prefers-color-scheme: dark) {
|
|
1363
|
-
color: var(--j-neutral-900);
|
|
1695
|
+
/* @__PURE__ */ jsxs11(ModalHeader, { children: [
|
|
1696
|
+
/* @__PURE__ */ jsx23(Heading, { id: "modal-heading", children: heading }),
|
|
1697
|
+
/* @__PURE__ */ jsx23(CloseButton, { onClick: onClose, "aria-label": "Close modal", type: "button", children: "\xD7" })
|
|
1698
|
+
] }),
|
|
1699
|
+
/* @__PURE__ */ jsxs11(ModalBody, { children: [
|
|
1700
|
+
text && /* @__PURE__ */ jsx23("p", { style: { margin: "0 0 1rem 0", color: "var(--j-text-color)" }, children: text }),
|
|
1701
|
+
children
|
|
1702
|
+
] }),
|
|
1703
|
+
showButtons && /* @__PURE__ */ jsxs11(ModalFooter, { children: [
|
|
1704
|
+
/* @__PURE__ */ jsx23(Button, { variant: "secondary", onClick: handleCancel, children: cancelText }),
|
|
1705
|
+
/* @__PURE__ */ jsx23(Button, { variant: "primary", onClick: handleConfirm, children: confirmText })
|
|
1706
|
+
] })
|
|
1707
|
+
]
|
|
1708
|
+
}
|
|
1709
|
+
);
|
|
1364
1710
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
const { label, hideLabel, id: customId, className, ...selectProps } = props;
|
|
1368
|
-
const generatedId = useId2();
|
|
1369
|
-
const id = customId || generatedId;
|
|
1370
|
-
return /* @__PURE__ */ jsxs9(SelectContainer, { className, children: [
|
|
1371
|
-
/* @__PURE__ */ jsx19("label", { htmlFor: id, className: hideLabel ? "j-sr-only" : "", children: label }),
|
|
1372
|
-
/* @__PURE__ */ jsxs9(SelectWrapper, { children: [
|
|
1373
|
-
/* @__PURE__ */ jsx19(StyledSelect, { ...selectProps, id, children: props.children }),
|
|
1374
|
-
/* @__PURE__ */ jsx19(SelectIcon, { children: /* @__PURE__ */ jsx19(Icon, { name: "chevronDown", size: "sm" }) })
|
|
1375
|
-
] })
|
|
1376
|
-
] });
|
|
1377
|
-
}
|
|
1711
|
+
);
|
|
1712
|
+
Modal.displayName = "Modal";
|
|
1378
1713
|
|
|
1379
1714
|
// src/inspector/ui/data-table.tsx
|
|
1380
|
-
import { useEffect as useEffect5, useMemo, useState as
|
|
1715
|
+
import { useEffect as useEffect5, useMemo, useState as useState7 } from "react";
|
|
1381
1716
|
|
|
1382
1717
|
// src/inspector/ui/table.tsx
|
|
1383
|
-
import { styled as
|
|
1718
|
+
import { styled as styled16 } from "goober";
|
|
1384
1719
|
import React4 from "react";
|
|
1385
|
-
import { jsx as
|
|
1386
|
-
var StyledTable =
|
|
1720
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1721
|
+
var StyledTable = styled16("table")`
|
|
1387
1722
|
width: 100%;
|
|
1388
1723
|
`;
|
|
1389
|
-
var StyledThead =
|
|
1724
|
+
var StyledThead = styled16("thead")`
|
|
1390
1725
|
text-align: left;
|
|
1391
1726
|
border-bottom: 1px solid var(--j-border-color);
|
|
1392
1727
|
background-color: var(--j-neutral-100);
|
|
@@ -1395,7 +1730,7 @@ var StyledThead = styled14("thead")`
|
|
|
1395
1730
|
background-color: var(--j-neutral-925);
|
|
1396
1731
|
}
|
|
1397
1732
|
`;
|
|
1398
|
-
var StyledTbody =
|
|
1733
|
+
var StyledTbody = styled16("tbody")`
|
|
1399
1734
|
tr {
|
|
1400
1735
|
border-bottom: 1px solid var(--j-border-color);
|
|
1401
1736
|
|
|
@@ -1404,23 +1739,23 @@ var StyledTbody = styled14("tbody")`
|
|
|
1404
1739
|
}
|
|
1405
1740
|
}
|
|
1406
1741
|
`;
|
|
1407
|
-
var StyledTh =
|
|
1742
|
+
var StyledTh = styled16("th")`
|
|
1408
1743
|
font-weight: 500;
|
|
1409
1744
|
padding: 0.5rem 0.75rem;
|
|
1410
1745
|
color: var(--j-text-color-strong);
|
|
1411
1746
|
`;
|
|
1412
|
-
var StyledTd =
|
|
1747
|
+
var StyledTd = styled16("td")`
|
|
1413
1748
|
padding: 0.5rem 0.75rem;
|
|
1414
1749
|
`;
|
|
1415
|
-
var Table = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */
|
|
1416
|
-
var TableHead = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */
|
|
1417
|
-
var TableBody = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */
|
|
1418
|
-
var TableRow = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */
|
|
1419
|
-
var TableHeader = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */
|
|
1420
|
-
var TableCell = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */
|
|
1750
|
+
var Table = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx24(StyledTable, { ref, ...props, children }));
|
|
1751
|
+
var TableHead = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx24(StyledThead, { ref, ...props, children }));
|
|
1752
|
+
var TableBody = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx24(StyledTbody, { ref, ...props, children }));
|
|
1753
|
+
var TableRow = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx24("tr", { ref, ...props, children }));
|
|
1754
|
+
var TableHeader = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx24(StyledTh, { ref, ...props, children }));
|
|
1755
|
+
var TableCell = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx24(StyledTd, { ref, ...props, children }));
|
|
1421
1756
|
|
|
1422
1757
|
// src/inspector/ui/data-table.tsx
|
|
1423
|
-
import { Fragment as Fragment5, jsx as
|
|
1758
|
+
import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1424
1759
|
function DataTable({
|
|
1425
1760
|
columns,
|
|
1426
1761
|
data,
|
|
@@ -1429,9 +1764,9 @@ function DataTable({
|
|
|
1429
1764
|
getRowKey,
|
|
1430
1765
|
emptyMessage = "No data available"
|
|
1431
1766
|
}) {
|
|
1432
|
-
const [currentPage, setCurrentPage] =
|
|
1433
|
-
const [sortConfig, setSortConfig] =
|
|
1434
|
-
const [filters, setFilters] =
|
|
1767
|
+
const [currentPage, setCurrentPage] = useState7(1);
|
|
1768
|
+
const [sortConfig, setSortConfig] = useState7(initialSort);
|
|
1769
|
+
const [filters, setFilters] = useState7({});
|
|
1435
1770
|
const filteredData = useMemo(() => {
|
|
1436
1771
|
return data.filter((row) => {
|
|
1437
1772
|
return Object.entries(filters).every(([columnId, filterValue]) => {
|
|
@@ -1490,9 +1825,9 @@ function DataTable({
|
|
|
1490
1825
|
const handlePageChange = (page) => {
|
|
1491
1826
|
setCurrentPage(Math.max(1, Math.min(page, totalPages)));
|
|
1492
1827
|
};
|
|
1493
|
-
return /* @__PURE__ */
|
|
1494
|
-
/* @__PURE__ */
|
|
1495
|
-
/* @__PURE__ */
|
|
1828
|
+
return /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
1829
|
+
/* @__PURE__ */ jsxs12(Table, { children: [
|
|
1830
|
+
/* @__PURE__ */ jsx25(TableHead, { children: /* @__PURE__ */ jsx25(TableRow, { children: columns.map((column) => /* @__PURE__ */ jsx25(TableHeader, { children: /* @__PURE__ */ jsxs12(
|
|
1496
1831
|
"div",
|
|
1497
1832
|
{
|
|
1498
1833
|
style: {
|
|
@@ -1503,8 +1838,8 @@ function DataTable({
|
|
|
1503
1838
|
},
|
|
1504
1839
|
onClick: () => handleSort(column.id),
|
|
1505
1840
|
children: [
|
|
1506
|
-
/* @__PURE__ */
|
|
1507
|
-
column.sortable && /* @__PURE__ */
|
|
1841
|
+
/* @__PURE__ */ jsx25("span", { children: column.header }),
|
|
1842
|
+
column.sortable && /* @__PURE__ */ jsx25(
|
|
1508
1843
|
"span",
|
|
1509
1844
|
{
|
|
1510
1845
|
style: {
|
|
@@ -1517,8 +1852,8 @@ function DataTable({
|
|
|
1517
1852
|
]
|
|
1518
1853
|
}
|
|
1519
1854
|
) }, column.id)) }) }),
|
|
1520
|
-
/* @__PURE__ */
|
|
1521
|
-
columns.some((column) => column.filterable) && /* @__PURE__ */
|
|
1855
|
+
/* @__PURE__ */ jsxs12(TableBody, { children: [
|
|
1856
|
+
columns.some((column) => column.filterable) && /* @__PURE__ */ jsx25(TableRow, { children: columns.map((column) => /* @__PURE__ */ jsx25(TableCell, { children: column.filterable && /* @__PURE__ */ jsx25(
|
|
1522
1857
|
Input,
|
|
1523
1858
|
{
|
|
1524
1859
|
label: "Filter",
|
|
@@ -1530,7 +1865,7 @@ function DataTable({
|
|
|
1530
1865
|
onClick: (e) => e.stopPropagation()
|
|
1531
1866
|
}
|
|
1532
1867
|
) }, column.id)) }),
|
|
1533
|
-
paginatedData.length === 0 ? /* @__PURE__ */
|
|
1868
|
+
paginatedData.length === 0 ? /* @__PURE__ */ jsx25(TableRow, { children: /* @__PURE__ */ jsx25(TableCell, { colSpan: columns.length, children: /* @__PURE__ */ jsx25(
|
|
1534
1869
|
"div",
|
|
1535
1870
|
{
|
|
1536
1871
|
style: {
|
|
@@ -1540,10 +1875,10 @@ function DataTable({
|
|
|
1540
1875
|
},
|
|
1541
1876
|
children: emptyMessage
|
|
1542
1877
|
}
|
|
1543
|
-
) }) }) : paginatedData.map((row, index) => /* @__PURE__ */
|
|
1878
|
+
) }) }) : paginatedData.map((row, index) => /* @__PURE__ */ jsx25(TableRow, { children: columns.map((column) => /* @__PURE__ */ jsx25(TableCell, { children: column.accessor(row) }, column.id)) }, getRowKey(row, startIndex + index)))
|
|
1544
1879
|
] })
|
|
1545
1880
|
] }),
|
|
1546
|
-
showPagination && /* @__PURE__ */
|
|
1881
|
+
showPagination && /* @__PURE__ */ jsxs12(
|
|
1547
1882
|
"div",
|
|
1548
1883
|
{
|
|
1549
1884
|
style: {
|
|
@@ -1554,7 +1889,7 @@ function DataTable({
|
|
|
1554
1889
|
padding: "8px 0"
|
|
1555
1890
|
},
|
|
1556
1891
|
children: [
|
|
1557
|
-
/* @__PURE__ */
|
|
1892
|
+
/* @__PURE__ */ jsxs12("div", { style: { fontSize: "14px", opacity: 0.7 }, children: [
|
|
1558
1893
|
"Showing ",
|
|
1559
1894
|
startIndex + 1,
|
|
1560
1895
|
" to ",
|
|
@@ -1565,8 +1900,8 @@ function DataTable({
|
|
|
1565
1900
|
" entries",
|
|
1566
1901
|
Object.keys(filters).some((key) => filters[key]) && ` (filtered from ${data.length})`
|
|
1567
1902
|
] }),
|
|
1568
|
-
/* @__PURE__ */
|
|
1569
|
-
/* @__PURE__ */
|
|
1903
|
+
/* @__PURE__ */ jsxs12("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
|
|
1904
|
+
/* @__PURE__ */ jsx25(
|
|
1570
1905
|
Button,
|
|
1571
1906
|
{
|
|
1572
1907
|
variant: "secondary",
|
|
@@ -1575,7 +1910,7 @@ function DataTable({
|
|
|
1575
1910
|
children: "\xAB\xAB"
|
|
1576
1911
|
}
|
|
1577
1912
|
),
|
|
1578
|
-
/* @__PURE__ */
|
|
1913
|
+
/* @__PURE__ */ jsx25(
|
|
1579
1914
|
Button,
|
|
1580
1915
|
{
|
|
1581
1916
|
variant: "secondary",
|
|
@@ -1584,13 +1919,13 @@ function DataTable({
|
|
|
1584
1919
|
children: "\xAB"
|
|
1585
1920
|
}
|
|
1586
1921
|
),
|
|
1587
|
-
/* @__PURE__ */
|
|
1922
|
+
/* @__PURE__ */ jsxs12("span", { style: { fontSize: "14px" }, children: [
|
|
1588
1923
|
"Page ",
|
|
1589
1924
|
currentPage,
|
|
1590
1925
|
" of ",
|
|
1591
1926
|
totalPages
|
|
1592
1927
|
] }),
|
|
1593
|
-
/* @__PURE__ */
|
|
1928
|
+
/* @__PURE__ */ jsx25(
|
|
1594
1929
|
Button,
|
|
1595
1930
|
{
|
|
1596
1931
|
variant: "secondary",
|
|
@@ -1599,7 +1934,7 @@ function DataTable({
|
|
|
1599
1934
|
children: "\xBB"
|
|
1600
1935
|
}
|
|
1601
1936
|
),
|
|
1602
|
-
/* @__PURE__ */
|
|
1937
|
+
/* @__PURE__ */ jsx25(
|
|
1603
1938
|
Button,
|
|
1604
1939
|
{
|
|
1605
1940
|
variant: "secondary",
|
|
@@ -1616,18 +1951,18 @@ function DataTable({
|
|
|
1616
1951
|
}
|
|
1617
1952
|
|
|
1618
1953
|
// src/inspector/ui/accordion.tsx
|
|
1619
|
-
import { styled as
|
|
1620
|
-
import { useEffect as useEffect6, useState as
|
|
1621
|
-
import { jsx as
|
|
1954
|
+
import { styled as styled17 } from "goober";
|
|
1955
|
+
import { useEffect as useEffect6, useState as useState8 } from "react";
|
|
1956
|
+
import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1622
1957
|
function Accordion({ title, children, storageKey }) {
|
|
1623
1958
|
const [open, setOpen] = useStoragedState(storageKey, false);
|
|
1624
|
-
return /* @__PURE__ */
|
|
1959
|
+
return /* @__PURE__ */ jsxs13(
|
|
1625
1960
|
"details",
|
|
1626
1961
|
{
|
|
1627
1962
|
open,
|
|
1628
1963
|
style: { display: "flex", flexDirection: "column", gap: "1rem" },
|
|
1629
1964
|
children: [
|
|
1630
|
-
/* @__PURE__ */
|
|
1965
|
+
/* @__PURE__ */ jsx26(
|
|
1631
1966
|
StyledSummary,
|
|
1632
1967
|
{
|
|
1633
1968
|
onClick: (e) => {
|
|
@@ -1643,7 +1978,7 @@ function Accordion({ title, children, storageKey }) {
|
|
|
1643
1978
|
);
|
|
1644
1979
|
}
|
|
1645
1980
|
function useStoragedState(key, defaultValue) {
|
|
1646
|
-
const [state, setState] =
|
|
1981
|
+
const [state, setState] = useState8(() => {
|
|
1647
1982
|
if (typeof window === "undefined") return defaultValue;
|
|
1648
1983
|
const stored = localStorage.getItem(key);
|
|
1649
1984
|
return stored ? JSON.parse(stored) : defaultValue;
|
|
@@ -1653,7 +1988,7 @@ function useStoragedState(key, defaultValue) {
|
|
|
1653
1988
|
}, [state]);
|
|
1654
1989
|
return [state, setState];
|
|
1655
1990
|
}
|
|
1656
|
-
var StyledSummary =
|
|
1991
|
+
var StyledSummary = styled17("summary")`
|
|
1657
1992
|
font-size: 1.125rem;
|
|
1658
1993
|
cursor: pointer;
|
|
1659
1994
|
font-weight: 500;
|
|
@@ -1661,9 +1996,9 @@ var StyledSummary = styled15("summary")`
|
|
|
1661
1996
|
`;
|
|
1662
1997
|
|
|
1663
1998
|
// src/inspector/viewer/raw-data-card.tsx
|
|
1664
|
-
import { jsx as
|
|
1999
|
+
import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1665
2000
|
function CopyButton({ data }) {
|
|
1666
|
-
const [copyCount, setCopyCount] =
|
|
2001
|
+
const [copyCount, setCopyCount] = useState9(0);
|
|
1667
2002
|
const copied = copyCount > 0;
|
|
1668
2003
|
const stringifiedData = JSON.stringify(data);
|
|
1669
2004
|
useEffect7(() => {
|
|
@@ -1674,7 +2009,7 @@ function CopyButton({ data }) {
|
|
|
1674
2009
|
};
|
|
1675
2010
|
}
|
|
1676
2011
|
}, [copyCount]);
|
|
1677
|
-
return /* @__PURE__ */
|
|
2012
|
+
return /* @__PURE__ */ jsx27(
|
|
1678
2013
|
Button,
|
|
1679
2014
|
{
|
|
1680
2015
|
style: {
|
|
@@ -1693,14 +2028,14 @@ function CopyButton({ data }) {
|
|
|
1693
2028
|
);
|
|
1694
2029
|
}
|
|
1695
2030
|
function RawDataCard({ data }) {
|
|
1696
|
-
return /* @__PURE__ */
|
|
1697
|
-
/* @__PURE__ */
|
|
1698
|
-
/* @__PURE__ */
|
|
2031
|
+
return /* @__PURE__ */ jsx27(Accordion, { title: "Raw data", storageKey: "jazz-inspector-show-raw-data", children: /* @__PURE__ */ jsxs14(Card, { style: { position: "relative" }, children: [
|
|
2032
|
+
/* @__PURE__ */ jsx27(CardHeader, { children: /* @__PURE__ */ jsx27(CopyButton, { data }) }),
|
|
2033
|
+
/* @__PURE__ */ jsx27(CardBody, { children: /* @__PURE__ */ jsx27(ValueRenderer, { json: data }) })
|
|
1699
2034
|
] }) });
|
|
1700
2035
|
}
|
|
1701
2036
|
|
|
1702
2037
|
// src/inspector/viewer/account-view.tsx
|
|
1703
|
-
import { Fragment as Fragment6, jsx as
|
|
2038
|
+
import { Fragment as Fragment6, jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1704
2039
|
function AccountView({
|
|
1705
2040
|
data,
|
|
1706
2041
|
onNavigate,
|
|
@@ -1712,25 +2047,25 @@ function AccountView({
|
|
|
1712
2047
|
delete readableData[key];
|
|
1713
2048
|
}
|
|
1714
2049
|
}
|
|
1715
|
-
return /* @__PURE__ */
|
|
1716
|
-
/* @__PURE__ */
|
|
1717
|
-
/* @__PURE__ */
|
|
2050
|
+
return /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
2051
|
+
/* @__PURE__ */ jsx28(GridView, { data: readableData, onNavigate, node }),
|
|
2052
|
+
/* @__PURE__ */ jsx28(RawDataCard, { data })
|
|
1718
2053
|
] });
|
|
1719
2054
|
}
|
|
1720
2055
|
|
|
1721
2056
|
// src/inspector/viewer/co-plain-text-view.tsx
|
|
1722
|
-
import { Fragment as Fragment7, jsx as
|
|
2057
|
+
import { Fragment as Fragment7, jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1723
2058
|
function CoPlainTextView({ data }) {
|
|
1724
2059
|
if (!data) return;
|
|
1725
|
-
return /* @__PURE__ */
|
|
1726
|
-
/* @__PURE__ */
|
|
1727
|
-
/* @__PURE__ */
|
|
2060
|
+
return /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
2061
|
+
/* @__PURE__ */ jsx29("p", { children: Object.values(data).join("") }),
|
|
2062
|
+
/* @__PURE__ */ jsx29(RawDataCard, { data })
|
|
1728
2063
|
] });
|
|
1729
2064
|
}
|
|
1730
2065
|
|
|
1731
2066
|
// src/inspector/viewer/group-view.tsx
|
|
1732
|
-
import { useState as
|
|
1733
|
-
import { Fragment as Fragment8, jsx as
|
|
2067
|
+
import { useState as useState10 } from "react";
|
|
2068
|
+
import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1734
2069
|
function partitionMembers(data) {
|
|
1735
2070
|
const everyone = Object.entries(data).filter(([key]) => key === "everyone").map(([key, value]) => ({
|
|
1736
2071
|
id: key,
|
|
@@ -1758,7 +2093,7 @@ function GroupView({
|
|
|
1758
2093
|
onNavigate,
|
|
1759
2094
|
node
|
|
1760
2095
|
}) {
|
|
1761
|
-
const [addMemberType, setAddMemberType] =
|
|
2096
|
+
const [addMemberType, setAddMemberType] = useState10(null);
|
|
1762
2097
|
const { everyone, members, parentGroups, childGroups } = partitionMembers(
|
|
1763
2098
|
data
|
|
1764
2099
|
);
|
|
@@ -1837,28 +2172,28 @@ function GroupView({
|
|
|
1837
2172
|
alert(`Failed to add ${addMemberType}: ${error.message}`);
|
|
1838
2173
|
}
|
|
1839
2174
|
};
|
|
1840
|
-
return /* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */
|
|
1842
|
-
/* @__PURE__ */
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
/* @__PURE__ */
|
|
1845
|
-
/* @__PURE__ */
|
|
2175
|
+
return /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
2176
|
+
/* @__PURE__ */ jsxs17(Table, { children: [
|
|
2177
|
+
/* @__PURE__ */ jsx30(TableHead, { children: /* @__PURE__ */ jsxs17(TableRow, { children: [
|
|
2178
|
+
/* @__PURE__ */ jsx30(TableHeader, { children: "Member" }),
|
|
2179
|
+
/* @__PURE__ */ jsx30(TableHeader, { children: "Permission" }),
|
|
2180
|
+
/* @__PURE__ */ jsx30(TableHeader, {})
|
|
1846
2181
|
] }) }),
|
|
1847
|
-
/* @__PURE__ */
|
|
1848
|
-
everyone.map((member) => /* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
1850
|
-
/* @__PURE__ */
|
|
1851
|
-
/* @__PURE__ */
|
|
2182
|
+
/* @__PURE__ */ jsxs17(TableBody, { children: [
|
|
2183
|
+
everyone.map((member) => /* @__PURE__ */ jsxs17(TableRow, { children: [
|
|
2184
|
+
/* @__PURE__ */ jsx30(TableCell, { children: member.id }),
|
|
2185
|
+
/* @__PURE__ */ jsx30(TableCell, { children: member.role }),
|
|
2186
|
+
/* @__PURE__ */ jsx30(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ jsx30(
|
|
1852
2187
|
Button,
|
|
1853
2188
|
{
|
|
1854
2189
|
variant: "secondary",
|
|
1855
2190
|
onClick: () => onRemoveMember(member.id),
|
|
1856
|
-
children: /* @__PURE__ */
|
|
2191
|
+
children: /* @__PURE__ */ jsx30(Icon, { name: "delete" })
|
|
1857
2192
|
}
|
|
1858
2193
|
) })
|
|
1859
2194
|
] }, member.id)),
|
|
1860
|
-
members.map((member) => /* @__PURE__ */
|
|
1861
|
-
/* @__PURE__ */
|
|
2195
|
+
members.map((member) => /* @__PURE__ */ jsxs17(TableRow, { children: [
|
|
2196
|
+
/* @__PURE__ */ jsx30(TableCell, { children: /* @__PURE__ */ jsx30(
|
|
1862
2197
|
AccountOrGroupText,
|
|
1863
2198
|
{
|
|
1864
2199
|
coId: member.id,
|
|
@@ -1869,18 +2204,18 @@ function GroupView({
|
|
|
1869
2204
|
}
|
|
1870
2205
|
}
|
|
1871
2206
|
) }),
|
|
1872
|
-
/* @__PURE__ */
|
|
1873
|
-
/* @__PURE__ */
|
|
2207
|
+
/* @__PURE__ */ jsx30(TableCell, { children: member.role }),
|
|
2208
|
+
/* @__PURE__ */ jsx30(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ jsx30(
|
|
1874
2209
|
Button,
|
|
1875
2210
|
{
|
|
1876
2211
|
variant: "secondary",
|
|
1877
2212
|
onClick: () => onRemoveMember(member.id),
|
|
1878
|
-
children: /* @__PURE__ */
|
|
2213
|
+
children: /* @__PURE__ */ jsx30(Icon, { name: "delete" })
|
|
1879
2214
|
}
|
|
1880
2215
|
) })
|
|
1881
2216
|
] }, member.id)),
|
|
1882
|
-
parentGroups.map((group) => /* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
2217
|
+
parentGroups.map((group) => /* @__PURE__ */ jsxs17(TableRow, { children: [
|
|
2218
|
+
/* @__PURE__ */ jsx30(TableCell, { children: /* @__PURE__ */ jsx30(
|
|
1884
2219
|
AccountOrGroupText,
|
|
1885
2220
|
{
|
|
1886
2221
|
coId: group.id,
|
|
@@ -1891,19 +2226,19 @@ function GroupView({
|
|
|
1891
2226
|
}
|
|
1892
2227
|
}
|
|
1893
2228
|
) }),
|
|
1894
|
-
/* @__PURE__ */
|
|
1895
|
-
/* @__PURE__ */
|
|
2229
|
+
/* @__PURE__ */ jsx30(TableCell, { children: group.role }),
|
|
2230
|
+
/* @__PURE__ */ jsx30(TableCell, { children: group.role !== "revoked" && /* @__PURE__ */ jsx30(
|
|
1896
2231
|
Button,
|
|
1897
2232
|
{
|
|
1898
2233
|
variant: "secondary",
|
|
1899
2234
|
onClick: () => onRemoveGroup(group.id),
|
|
1900
|
-
children: /* @__PURE__ */
|
|
2235
|
+
children: /* @__PURE__ */ jsx30(Icon, { name: "delete" })
|
|
1901
2236
|
}
|
|
1902
2237
|
) })
|
|
1903
2238
|
] }, group.id))
|
|
1904
2239
|
] })
|
|
1905
2240
|
] }),
|
|
1906
|
-
/* @__PURE__ */
|
|
2241
|
+
/* @__PURE__ */ jsxs17(
|
|
1907
2242
|
"div",
|
|
1908
2243
|
{
|
|
1909
2244
|
style: {
|
|
@@ -1913,14 +2248,14 @@ function GroupView({
|
|
|
1913
2248
|
marginTop: "1rem"
|
|
1914
2249
|
},
|
|
1915
2250
|
children: [
|
|
1916
|
-
/* @__PURE__ */
|
|
1917
|
-
/* @__PURE__ */
|
|
2251
|
+
/* @__PURE__ */ jsx30(Button, { variant: "primary", onClick: () => setAddMemberType("account"), children: "Add Account" }),
|
|
2252
|
+
/* @__PURE__ */ jsx30(Button, { variant: "primary", onClick: () => setAddMemberType("group"), children: "Add Group" })
|
|
1918
2253
|
]
|
|
1919
2254
|
}
|
|
1920
2255
|
),
|
|
1921
|
-
childGroups.length > 0 && /* @__PURE__ */
|
|
1922
|
-
/* @__PURE__ */
|
|
1923
|
-
/* @__PURE__ */
|
|
2256
|
+
childGroups.length > 0 && /* @__PURE__ */ jsxs17(Table, { children: [
|
|
2257
|
+
/* @__PURE__ */ jsx30(TableHead, { children: /* @__PURE__ */ jsx30(TableRow, { children: /* @__PURE__ */ jsx30(TableHeader, { children: "Member of" }) }) }),
|
|
2258
|
+
/* @__PURE__ */ jsx30(TableBody, { children: childGroups.map((group) => /* @__PURE__ */ jsx30(TableRow, { children: /* @__PURE__ */ jsx30(TableCell, { children: /* @__PURE__ */ jsx30(
|
|
1924
2259
|
AccountOrGroupText,
|
|
1925
2260
|
{
|
|
1926
2261
|
coId: group.id,
|
|
@@ -1932,20 +2267,20 @@ function GroupView({
|
|
|
1932
2267
|
}
|
|
1933
2268
|
) }) }, group.id)) })
|
|
1934
2269
|
] }),
|
|
1935
|
-
/* @__PURE__ */
|
|
1936
|
-
/* @__PURE__ */
|
|
2270
|
+
/* @__PURE__ */ jsx30(RawDataCard, { data }),
|
|
2271
|
+
/* @__PURE__ */ jsx30(
|
|
1937
2272
|
Modal,
|
|
1938
2273
|
{
|
|
1939
2274
|
isOpen: addMemberType !== null,
|
|
1940
2275
|
onClose: () => setAddMemberType(null),
|
|
1941
2276
|
heading: addMemberType === "account" ? "Add Account" : "Add Group",
|
|
1942
2277
|
showButtons: false,
|
|
1943
|
-
children: /* @__PURE__ */
|
|
2278
|
+
children: /* @__PURE__ */ jsx30("form", { onSubmit: handleAddMemberSubmit, children: /* @__PURE__ */ jsxs17(
|
|
1944
2279
|
"div",
|
|
1945
2280
|
{
|
|
1946
2281
|
style: { display: "flex", flexDirection: "column", gap: "1rem" },
|
|
1947
2282
|
children: [
|
|
1948
|
-
/* @__PURE__ */
|
|
2283
|
+
/* @__PURE__ */ jsx30(
|
|
1949
2284
|
Input,
|
|
1950
2285
|
{
|
|
1951
2286
|
name: "memberId",
|
|
@@ -1954,13 +2289,13 @@ function GroupView({
|
|
|
1954
2289
|
required: true
|
|
1955
2290
|
}
|
|
1956
2291
|
),
|
|
1957
|
-
/* @__PURE__ */
|
|
1958
|
-
/* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */
|
|
1960
|
-
/* @__PURE__ */
|
|
1961
|
-
addMemberType === "account" ? /* @__PURE__ */
|
|
2292
|
+
/* @__PURE__ */ jsxs17(Select, { name: "role", label: "Role", children: [
|
|
2293
|
+
/* @__PURE__ */ jsx30("option", { value: "reader", children: "Reader" }),
|
|
2294
|
+
/* @__PURE__ */ jsx30("option", { value: "writer", children: "Writer" }),
|
|
2295
|
+
/* @__PURE__ */ jsx30("option", { value: "admin", children: "Admin" }),
|
|
2296
|
+
addMemberType === "account" ? /* @__PURE__ */ jsx30(Fragment8, { children: /* @__PURE__ */ jsx30("option", { value: "writeOnly", children: "Write Only" }) }) : /* @__PURE__ */ jsx30(Fragment8, { children: /* @__PURE__ */ jsx30("option", { value: "inherit", children: "Inherit" }) })
|
|
1962
2297
|
] }),
|
|
1963
|
-
/* @__PURE__ */
|
|
2298
|
+
/* @__PURE__ */ jsxs17(
|
|
1964
2299
|
"div",
|
|
1965
2300
|
{
|
|
1966
2301
|
style: {
|
|
@@ -1970,7 +2305,7 @@ function GroupView({
|
|
|
1970
2305
|
marginTop: "0.5rem"
|
|
1971
2306
|
},
|
|
1972
2307
|
children: [
|
|
1973
|
-
/* @__PURE__ */
|
|
2308
|
+
/* @__PURE__ */ jsx30(
|
|
1974
2309
|
Button,
|
|
1975
2310
|
{
|
|
1976
2311
|
type: "button",
|
|
@@ -1979,7 +2314,7 @@ function GroupView({
|
|
|
1979
2314
|
children: "Cancel"
|
|
1980
2315
|
}
|
|
1981
2316
|
),
|
|
1982
|
-
/* @__PURE__ */
|
|
2317
|
+
/* @__PURE__ */ jsx30(Button, { type: "submit", variant: "primary", children: "Add" })
|
|
1983
2318
|
]
|
|
1984
2319
|
}
|
|
1985
2320
|
)
|
|
@@ -1992,7 +2327,7 @@ function GroupView({
|
|
|
1992
2327
|
}
|
|
1993
2328
|
|
|
1994
2329
|
// src/inspector/viewer/role-display.tsx
|
|
1995
|
-
import { jsxs as
|
|
2330
|
+
import { jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1996
2331
|
function RoleDisplay({
|
|
1997
2332
|
node,
|
|
1998
2333
|
value
|
|
@@ -2011,24 +2346,24 @@ function RoleDisplay({
|
|
|
2011
2346
|
} else {
|
|
2012
2347
|
role = "unauthorized";
|
|
2013
2348
|
}
|
|
2014
|
-
return /* @__PURE__ */
|
|
2349
|
+
return /* @__PURE__ */ jsxs18(Text, { children: [
|
|
2015
2350
|
"Role: ",
|
|
2016
2351
|
role
|
|
2017
2352
|
] });
|
|
2018
2353
|
}
|
|
2019
2354
|
|
|
2020
2355
|
// src/inspector/viewer/table-viewer.tsx
|
|
2021
|
-
import { styled as
|
|
2022
|
-
import { useMemo as useMemo2, useState as
|
|
2023
|
-
import { Fragment as Fragment9, jsx as
|
|
2024
|
-
var PaginationContainer =
|
|
2356
|
+
import { styled as styled18 } from "goober";
|
|
2357
|
+
import { useMemo as useMemo2, useState as useState11 } from "react";
|
|
2358
|
+
import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2359
|
+
var PaginationContainer = styled18("div")`
|
|
2025
2360
|
padding: 1rem 0;
|
|
2026
2361
|
display: flex;
|
|
2027
2362
|
align-items: center;
|
|
2028
2363
|
justify-content: space-between;
|
|
2029
2364
|
gap: 0.5rem;
|
|
2030
2365
|
`;
|
|
2031
|
-
var RedTooltip =
|
|
2366
|
+
var RedTooltip = styled18("span")`
|
|
2032
2367
|
position:relative; /* making the .tooltip span a container for the tooltip text */
|
|
2033
2368
|
border-bottom:1px dashed #000; /* little indicater to indicate it's hoverable */
|
|
2034
2369
|
|
|
@@ -2065,7 +2400,7 @@ function CoValuesTableView({
|
|
|
2065
2400
|
onNavigate,
|
|
2066
2401
|
onRemove
|
|
2067
2402
|
}) {
|
|
2068
|
-
const [visibleRowsCount, setVisibleRowsCount] =
|
|
2403
|
+
const [visibleRowsCount, setVisibleRowsCount] = useState11(10);
|
|
2069
2404
|
const [coIdArray, visibleRows] = useMemo2(() => {
|
|
2070
2405
|
const coIdArray2 = Array.isArray(data) ? data : Object.values(data).every((k) => typeof k === "string" && isCoId(k)) ? Object.values(data).map((k) => k) : [];
|
|
2071
2406
|
const visibleRows2 = coIdArray2.slice(0, visibleRowsCount);
|
|
@@ -2074,10 +2409,10 @@ function CoValuesTableView({
|
|
|
2074
2409
|
const resolvedRows = useResolvedCoValues(visibleRows, node);
|
|
2075
2410
|
const hasMore = visibleRowsCount < coIdArray.length;
|
|
2076
2411
|
if (!coIdArray.length) {
|
|
2077
|
-
return /* @__PURE__ */
|
|
2412
|
+
return /* @__PURE__ */ jsx31("div", { children: "No data to display" });
|
|
2078
2413
|
}
|
|
2079
2414
|
if (resolvedRows.length === 0) {
|
|
2080
|
-
return /* @__PURE__ */
|
|
2415
|
+
return /* @__PURE__ */ jsx31("div", { children: "Loading..." });
|
|
2081
2416
|
}
|
|
2082
2417
|
const keys = Array.from(
|
|
2083
2418
|
new Set(
|
|
@@ -2087,15 +2422,15 @@ function CoValuesTableView({
|
|
|
2087
2422
|
const loadMore = () => {
|
|
2088
2423
|
setVisibleRowsCount((prevVisibleRows) => prevVisibleRows + 10);
|
|
2089
2424
|
};
|
|
2090
|
-
return /* @__PURE__ */
|
|
2091
|
-
/* @__PURE__ */
|
|
2092
|
-
/* @__PURE__ */
|
|
2093
|
-
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */
|
|
2094
|
-
onRemove && /* @__PURE__ */
|
|
2425
|
+
return /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
2426
|
+
/* @__PURE__ */ jsxs19(Table, { children: [
|
|
2427
|
+
/* @__PURE__ */ jsx31(TableHead, { children: /* @__PURE__ */ jsxs19(TableRow, { children: [
|
|
2428
|
+
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */ jsx31(TableHeader, { children: key }, key)),
|
|
2429
|
+
onRemove && /* @__PURE__ */ jsx31(TableHeader, {})
|
|
2095
2430
|
] }) }),
|
|
2096
|
-
/* @__PURE__ */
|
|
2097
|
-
/* @__PURE__ */
|
|
2098
|
-
/* @__PURE__ */
|
|
2431
|
+
/* @__PURE__ */ jsx31(TableBody, { children: resolvedRows.slice(0, visibleRowsCount).map((item, index) => /* @__PURE__ */ jsxs19(TableRow, { children: [
|
|
2432
|
+
/* @__PURE__ */ jsx31(TableCell, { children: /* @__PURE__ */ jsx31(Text, { mono: true, children: item.snapshot === "unavailable" ? /* @__PURE__ */ jsxs19(RedTooltip, { "data-text": "Unavailable", children: [
|
|
2433
|
+
/* @__PURE__ */ jsx31(
|
|
2099
2434
|
Icon,
|
|
2100
2435
|
{
|
|
2101
2436
|
name: "caution",
|
|
@@ -2108,7 +2443,7 @@ function CoValuesTableView({
|
|
|
2108
2443
|
),
|
|
2109
2444
|
visibleRows[index]
|
|
2110
2445
|
] }) : visibleRows[index] }) }),
|
|
2111
|
-
keys.map((key) => /* @__PURE__ */
|
|
2446
|
+
keys.map((key) => /* @__PURE__ */ jsx31(TableCell, { children: item.snapshot !== "unavailable" && /* @__PURE__ */ jsx31(
|
|
2112
2447
|
ValueRenderer,
|
|
2113
2448
|
{
|
|
2114
2449
|
json: item.snapshot[key],
|
|
@@ -2129,7 +2464,7 @@ function CoValuesTableView({
|
|
|
2129
2464
|
}
|
|
2130
2465
|
}
|
|
2131
2466
|
) }, key)),
|
|
2132
|
-
/* @__PURE__ */
|
|
2467
|
+
/* @__PURE__ */ jsx31(TableCell, { children: /* @__PURE__ */ jsx31(
|
|
2133
2468
|
Button,
|
|
2134
2469
|
{
|
|
2135
2470
|
variant: "secondary",
|
|
@@ -2142,18 +2477,18 @@ function CoValuesTableView({
|
|
|
2142
2477
|
children: "View"
|
|
2143
2478
|
}
|
|
2144
2479
|
) }),
|
|
2145
|
-
onRemove && /* @__PURE__ */
|
|
2480
|
+
onRemove && /* @__PURE__ */ jsx31(TableCell, { children: /* @__PURE__ */ jsx31(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
2146
2481
|
] }, index)) })
|
|
2147
2482
|
] }),
|
|
2148
|
-
/* @__PURE__ */
|
|
2149
|
-
/* @__PURE__ */
|
|
2483
|
+
/* @__PURE__ */ jsxs19(PaginationContainer, { children: [
|
|
2484
|
+
/* @__PURE__ */ jsxs19(Text, { muted: true, small: true, children: [
|
|
2150
2485
|
"Showing ",
|
|
2151
2486
|
Math.min(visibleRowsCount, coIdArray.length),
|
|
2152
2487
|
" of",
|
|
2153
2488
|
" ",
|
|
2154
2489
|
coIdArray.length
|
|
2155
2490
|
] }),
|
|
2156
|
-
hasMore && /* @__PURE__ */
|
|
2491
|
+
hasMore && /* @__PURE__ */ jsx31(Button, { variant: "secondary", onClick: loadMore, children: "Load more" })
|
|
2157
2492
|
] })
|
|
2158
2493
|
] });
|
|
2159
2494
|
}
|
|
@@ -2167,7 +2502,7 @@ function TableView({
|
|
|
2167
2502
|
return Array.isArray(data) && data.every((k) => isCoId(k));
|
|
2168
2503
|
}, [data]);
|
|
2169
2504
|
if (isListOfCoValues) {
|
|
2170
|
-
return /* @__PURE__ */
|
|
2505
|
+
return /* @__PURE__ */ jsx31(
|
|
2171
2506
|
CoValuesTableView,
|
|
2172
2507
|
{
|
|
2173
2508
|
data,
|
|
@@ -2177,24 +2512,67 @@ function TableView({
|
|
|
2177
2512
|
}
|
|
2178
2513
|
);
|
|
2179
2514
|
}
|
|
2180
|
-
return /* @__PURE__ */
|
|
2181
|
-
/* @__PURE__ */
|
|
2182
|
-
/* @__PURE__ */
|
|
2183
|
-
/* @__PURE__ */
|
|
2184
|
-
onRemove && /* @__PURE__ */
|
|
2515
|
+
return /* @__PURE__ */ jsxs19(Table, { children: [
|
|
2516
|
+
/* @__PURE__ */ jsx31(TableHead, { children: /* @__PURE__ */ jsxs19(TableRow, { children: [
|
|
2517
|
+
/* @__PURE__ */ jsx31(TableHeader, { style: { width: "5rem" }, children: "Index" }),
|
|
2518
|
+
/* @__PURE__ */ jsx31(TableHeader, { children: "Value" }),
|
|
2519
|
+
onRemove && /* @__PURE__ */ jsx31(TableHeader, { children: "Action" })
|
|
2185
2520
|
] }) }),
|
|
2186
|
-
/* @__PURE__ */
|
|
2187
|
-
/* @__PURE__ */
|
|
2188
|
-
/* @__PURE__ */
|
|
2189
|
-
onRemove && /* @__PURE__ */
|
|
2521
|
+
/* @__PURE__ */ jsx31(TableBody, { children: Array.isArray(data) && data?.map((value, index) => /* @__PURE__ */ jsxs19(TableRow, { children: [
|
|
2522
|
+
/* @__PURE__ */ jsx31(TableCell, { children: /* @__PURE__ */ jsx31(Text, { mono: true, children: index }) }),
|
|
2523
|
+
/* @__PURE__ */ jsx31(TableCell, { children: /* @__PURE__ */ jsx31(ValueRenderer, { json: value }) }),
|
|
2524
|
+
onRemove && /* @__PURE__ */ jsx31(TableCell, { children: /* @__PURE__ */ jsx31(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
2190
2525
|
] }, index)) })
|
|
2191
2526
|
] });
|
|
2192
2527
|
}
|
|
2193
2528
|
|
|
2194
2529
|
// src/inspector/viewer/history-view.tsx
|
|
2195
2530
|
import { useMemo as useMemo3 } from "react";
|
|
2196
|
-
import { styled as
|
|
2197
|
-
|
|
2531
|
+
import { styled as styled19 } from "goober";
|
|
2532
|
+
|
|
2533
|
+
// src/inspector/utils/transactions-changes.ts
|
|
2534
|
+
var isGroupExtension = (change) => {
|
|
2535
|
+
return change?.op === "set" && change?.value === "extend";
|
|
2536
|
+
};
|
|
2537
|
+
var isGroupExtendRevocation = (change) => {
|
|
2538
|
+
return change?.op === "set" && change?.value === "revoked";
|
|
2539
|
+
};
|
|
2540
|
+
var isGroupPromotion = (change) => {
|
|
2541
|
+
return change?.op === "set" && change?.key.startsWith("parent_co_");
|
|
2542
|
+
};
|
|
2543
|
+
var isUserPromotion = (change) => {
|
|
2544
|
+
return change?.op === "set" && (isCoId(change?.key) || change?.key === "everyone");
|
|
2545
|
+
};
|
|
2546
|
+
var isKeyRevelation = (change) => {
|
|
2547
|
+
return change?.op === "set" && change?.key.includes("_for_");
|
|
2548
|
+
};
|
|
2549
|
+
var isPropertySet = (change) => {
|
|
2550
|
+
return change?.op === "set" && "key" in change && "value" in change;
|
|
2551
|
+
};
|
|
2552
|
+
var isPropertyDeletion = (change) => {
|
|
2553
|
+
return change?.op === "del" && "key" in change;
|
|
2554
|
+
};
|
|
2555
|
+
var isItemAppend = (change) => {
|
|
2556
|
+
return change?.op === "app" && "after" in change && "value" in change;
|
|
2557
|
+
};
|
|
2558
|
+
var isItemPrepend = (change) => {
|
|
2559
|
+
return change?.op === "pre" && "before" in change && "value" in change;
|
|
2560
|
+
};
|
|
2561
|
+
var isItemDeletion = (change) => {
|
|
2562
|
+
return change?.op === "del" && "insertion" in change;
|
|
2563
|
+
};
|
|
2564
|
+
var isStreamStart = (change) => {
|
|
2565
|
+
return change?.type === "start" && "mimeType" in change;
|
|
2566
|
+
};
|
|
2567
|
+
var isStreamChunk = (change) => {
|
|
2568
|
+
return change?.type === "chunk" && "chunk" in change;
|
|
2569
|
+
};
|
|
2570
|
+
var isStreamEnd = (change) => {
|
|
2571
|
+
return change?.type === "end";
|
|
2572
|
+
};
|
|
2573
|
+
|
|
2574
|
+
// src/inspector/viewer/history-view.tsx
|
|
2575
|
+
import { Fragment as Fragment10, jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2198
2576
|
function HistoryView({
|
|
2199
2577
|
coValue,
|
|
2200
2578
|
node
|
|
@@ -2207,8 +2585,8 @@ function HistoryView({
|
|
|
2207
2585
|
{
|
|
2208
2586
|
id: "author",
|
|
2209
2587
|
header: "Author",
|
|
2210
|
-
accessor: (row) => /* @__PURE__ */
|
|
2211
|
-
row.isValid || /* @__PURE__ */
|
|
2588
|
+
accessor: (row) => /* @__PURE__ */ jsxs20(Fragment10, { children: [
|
|
2589
|
+
row.isValid || /* @__PURE__ */ jsx32(RedTooltip2, { "data-text": "This transaction is invalid and is not used", children: /* @__PURE__ */ jsx32(
|
|
2212
2590
|
Icon,
|
|
2213
2591
|
{
|
|
2214
2592
|
name: "caution",
|
|
@@ -2221,7 +2599,7 @@ function HistoryView({
|
|
|
2221
2599
|
}
|
|
2222
2600
|
}
|
|
2223
2601
|
) }),
|
|
2224
|
-
row.author.startsWith("co_") ? /* @__PURE__ */
|
|
2602
|
+
row.author.startsWith("co_") ? /* @__PURE__ */ jsx32(
|
|
2225
2603
|
AccountOrGroupText,
|
|
2226
2604
|
{
|
|
2227
2605
|
coId: row.author,
|
|
@@ -2240,9 +2618,9 @@ function HistoryView({
|
|
|
2240
2618
|
header: "Action",
|
|
2241
2619
|
accessor: (row) => {
|
|
2242
2620
|
if (row.isValid) return row.action;
|
|
2243
|
-
return /* @__PURE__ */
|
|
2621
|
+
return /* @__PURE__ */ jsxs20(Fragment10, { children: [
|
|
2244
2622
|
row.action,
|
|
2245
|
-
/* @__PURE__ */
|
|
2623
|
+
/* @__PURE__ */ jsxs20("span", { style: { color: "red", display: "block" }, children: [
|
|
2246
2624
|
"Invalid transaction: ",
|
|
2247
2625
|
row.validationErrorMessage
|
|
2248
2626
|
] })
|
|
@@ -2261,7 +2639,7 @@ function HistoryView({
|
|
|
2261
2639
|
sortFn: (a, b) => a.timestamp.getTime() - b.timestamp.getTime()
|
|
2262
2640
|
}
|
|
2263
2641
|
];
|
|
2264
|
-
return /* @__PURE__ */
|
|
2642
|
+
return /* @__PURE__ */ jsx32(Accordion, { title: "CoValue history", storageKey: "jazz-inspector-show-history", children: /* @__PURE__ */ jsx32(
|
|
2265
2643
|
DataTable,
|
|
2266
2644
|
{
|
|
2267
2645
|
columns,
|
|
@@ -2372,46 +2750,7 @@ var findListChange = (opId, coValue) => {
|
|
|
2372
2750
|
(tx) => tx.txID.sessionID === opId.sessionID && tx.txID.txIndex === opId.txIndex
|
|
2373
2751
|
)?.changes?.[opId.changeIdx];
|
|
2374
2752
|
};
|
|
2375
|
-
var
|
|
2376
|
-
return change?.op === "set" && change?.value === "extend";
|
|
2377
|
-
};
|
|
2378
|
-
var isGroupExtendRevocation = (change) => {
|
|
2379
|
-
return change?.op === "set" && change?.value === "revoked";
|
|
2380
|
-
};
|
|
2381
|
-
var isGroupPromotion = (change) => {
|
|
2382
|
-
return change?.op === "set" && change?.key.startsWith("parent_co_");
|
|
2383
|
-
};
|
|
2384
|
-
var isUserPromotion = (change) => {
|
|
2385
|
-
return change?.op === "set" && (isCoId(change?.key) || change?.key === "everyone");
|
|
2386
|
-
};
|
|
2387
|
-
var isKeyRevelation = (change) => {
|
|
2388
|
-
return change?.op === "set" && change?.key.includes("_for_");
|
|
2389
|
-
};
|
|
2390
|
-
var isPropertySet = (change) => {
|
|
2391
|
-
return change?.op === "set" && "key" in change && "value" in change;
|
|
2392
|
-
};
|
|
2393
|
-
var isPropertyDeletion = (change) => {
|
|
2394
|
-
return change?.op === "del" && "key" in change;
|
|
2395
|
-
};
|
|
2396
|
-
var isItemAppend = (change) => {
|
|
2397
|
-
return change?.op === "app" && "after" in change && "value" in change;
|
|
2398
|
-
};
|
|
2399
|
-
var isItemPrepend = (change) => {
|
|
2400
|
-
return change?.op === "pre" && "before" in change && "value" in change;
|
|
2401
|
-
};
|
|
2402
|
-
var isItemDeletion = (change) => {
|
|
2403
|
-
return change?.op === "del" && "insertion" in change;
|
|
2404
|
-
};
|
|
2405
|
-
var isStreamStart = (change) => {
|
|
2406
|
-
return change?.type === "start" && "mimeType" in change;
|
|
2407
|
-
};
|
|
2408
|
-
var isStreamChunk = (change) => {
|
|
2409
|
-
return change?.type === "chunk" && "chunk" in change;
|
|
2410
|
-
};
|
|
2411
|
-
var isStreamEnd = (change) => {
|
|
2412
|
-
return change?.type === "end";
|
|
2413
|
-
};
|
|
2414
|
-
var RedTooltip2 = styled17("span")`
|
|
2753
|
+
var RedTooltip2 = styled19("span")`
|
|
2415
2754
|
position:relative; /* making the .tooltip span a container for the tooltip text */
|
|
2416
2755
|
border-bottom:1px dashed #000; /* little indicater to indicate it's hoverable */
|
|
2417
2756
|
|
|
@@ -2443,12 +2782,315 @@ var RedTooltip2 = styled17("span")`
|
|
|
2443
2782
|
}
|
|
2444
2783
|
`;
|
|
2445
2784
|
|
|
2785
|
+
// src/inspector/viewer/co-map-view.tsx
|
|
2786
|
+
import { useState as useState12, useMemo as useMemo4 } from "react";
|
|
2787
|
+
import { styled as styled20 } from "goober";
|
|
2788
|
+
|
|
2789
|
+
// src/inspector/utils/history.ts
|
|
2790
|
+
function restoreCoMapToTimestamp(coValue, timestamp, removeUnknownProperties) {
|
|
2791
|
+
const myRole = coValue.group.myRole();
|
|
2792
|
+
if (myRole === void 0 || !["admin", "manager", "writer", "writerOnly"].includes(myRole)) {
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
const newCoValue = coValue.atTime(timestamp).toJSON();
|
|
2796
|
+
const oldCoValue = coValue.toJSON();
|
|
2797
|
+
if (newCoValue === null) return;
|
|
2798
|
+
let changes = [];
|
|
2799
|
+
if (removeUnknownProperties) {
|
|
2800
|
+
for (const key in oldCoValue) {
|
|
2801
|
+
if (!(key in newCoValue)) {
|
|
2802
|
+
changes.push({
|
|
2803
|
+
op: "del",
|
|
2804
|
+
key
|
|
2805
|
+
});
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
for (const key in newCoValue) {
|
|
2810
|
+
if (newCoValue[key] !== oldCoValue[key]) {
|
|
2811
|
+
changes.push({
|
|
2812
|
+
op: "set",
|
|
2813
|
+
key,
|
|
2814
|
+
value: newCoValue[key]
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
if (changes.length > 0) {
|
|
2819
|
+
coValue.core.makeTransaction(changes, "private");
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2823
|
+
// src/inspector/viewer/co-map-view.tsx
|
|
2824
|
+
import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2825
|
+
function CoMapView({
|
|
2826
|
+
coValue,
|
|
2827
|
+
data,
|
|
2828
|
+
node,
|
|
2829
|
+
onNavigate
|
|
2830
|
+
}) {
|
|
2831
|
+
return /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
2832
|
+
/* @__PURE__ */ jsx33(
|
|
2833
|
+
GridView,
|
|
2834
|
+
{
|
|
2835
|
+
data,
|
|
2836
|
+
onNavigate,
|
|
2837
|
+
node,
|
|
2838
|
+
coValue
|
|
2839
|
+
}
|
|
2840
|
+
),
|
|
2841
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
2842
|
+
/* @__PURE__ */ jsx33(AddPropertyModal, { coValue, node }),
|
|
2843
|
+
" ",
|
|
2844
|
+
/* @__PURE__ */ jsx33(RestoreSnapshotModal, { coValue })
|
|
2845
|
+
] })
|
|
2846
|
+
] });
|
|
2847
|
+
}
|
|
2848
|
+
function AddPropertyModal({
|
|
2849
|
+
coValue,
|
|
2850
|
+
node
|
|
2851
|
+
}) {
|
|
2852
|
+
const [isAddPropertyModalOpen, setIsAddPropertyModalOpen] = useState12(false);
|
|
2853
|
+
const [propertyName, setPropertyName] = useState12("");
|
|
2854
|
+
const openAddPropertyModal = () => {
|
|
2855
|
+
setIsAddPropertyModalOpen(true);
|
|
2856
|
+
setPropertyName("");
|
|
2857
|
+
};
|
|
2858
|
+
const handleCancel = () => {
|
|
2859
|
+
setIsAddPropertyModalOpen(false);
|
|
2860
|
+
setPropertyName("");
|
|
2861
|
+
};
|
|
2862
|
+
return /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
2863
|
+
/* @__PURE__ */ jsx33(
|
|
2864
|
+
Button,
|
|
2865
|
+
{
|
|
2866
|
+
title: "Add Property",
|
|
2867
|
+
variant: "secondary",
|
|
2868
|
+
onClick: openAddPropertyModal,
|
|
2869
|
+
children: /* @__PURE__ */ jsx33(Icon, { name: "edit" })
|
|
2870
|
+
}
|
|
2871
|
+
),
|
|
2872
|
+
/* @__PURE__ */ jsxs21(
|
|
2873
|
+
Modal,
|
|
2874
|
+
{
|
|
2875
|
+
isOpen: isAddPropertyModalOpen,
|
|
2876
|
+
onClose: handleCancel,
|
|
2877
|
+
heading: "Add Property",
|
|
2878
|
+
showButtons: false,
|
|
2879
|
+
children: [
|
|
2880
|
+
/* @__PURE__ */ jsx33(
|
|
2881
|
+
Input,
|
|
2882
|
+
{
|
|
2883
|
+
label: "Property Name",
|
|
2884
|
+
value: propertyName,
|
|
2885
|
+
onChange: (e) => setPropertyName(e.target.value),
|
|
2886
|
+
placeholder: "Enter property name"
|
|
2887
|
+
}
|
|
2888
|
+
),
|
|
2889
|
+
propertyName && /* @__PURE__ */ jsx33(EditorContainer, { children: /* @__PURE__ */ jsx33(
|
|
2890
|
+
CoValueEditor,
|
|
2891
|
+
{
|
|
2892
|
+
node,
|
|
2893
|
+
property: propertyName,
|
|
2894
|
+
value: void 0,
|
|
2895
|
+
coValue,
|
|
2896
|
+
onCancel: handleCancel
|
|
2897
|
+
}
|
|
2898
|
+
) })
|
|
2899
|
+
]
|
|
2900
|
+
}
|
|
2901
|
+
)
|
|
2902
|
+
] });
|
|
2903
|
+
}
|
|
2904
|
+
function RestoreSnapshotModal({ coValue }) {
|
|
2905
|
+
const [isRestoreModalOpen, setIsRestoreModalOpen] = useState12(false);
|
|
2906
|
+
const [selectedIndex, setSelectedIndex] = useState12(-1);
|
|
2907
|
+
const [removeUnknownProperties, setRemoveUnknownProperties] = useState12(false);
|
|
2908
|
+
const timestamps = useMemo4(
|
|
2909
|
+
() => coValue.core.verifiedTransactions.map((tx) => tx.madeAt),
|
|
2910
|
+
[coValue.core.verifiedTransactions.length]
|
|
2911
|
+
);
|
|
2912
|
+
const coMapAtSelectedIndex = useMemo4(() => {
|
|
2913
|
+
if (selectedIndex === -1) return null;
|
|
2914
|
+
return coValue.atTime(timestamps[selectedIndex]).toJSON();
|
|
2915
|
+
}, [coValue, timestamps, selectedIndex]);
|
|
2916
|
+
const openRestoreModal = () => {
|
|
2917
|
+
setIsRestoreModalOpen(true);
|
|
2918
|
+
setSelectedIndex(timestamps.length - 1);
|
|
2919
|
+
};
|
|
2920
|
+
const handleRestore = () => {
|
|
2921
|
+
if (timestamps.length < 2) return;
|
|
2922
|
+
if (timestamps.length === 0) return;
|
|
2923
|
+
const selectedTimestamp = timestamps[selectedIndex];
|
|
2924
|
+
if (selectedTimestamp === void 0) return;
|
|
2925
|
+
restoreCoMapToTimestamp(
|
|
2926
|
+
coValue,
|
|
2927
|
+
selectedTimestamp,
|
|
2928
|
+
removeUnknownProperties
|
|
2929
|
+
);
|
|
2930
|
+
setIsRestoreModalOpen(false);
|
|
2931
|
+
};
|
|
2932
|
+
const handleClose = () => {
|
|
2933
|
+
setIsRestoreModalOpen(false);
|
|
2934
|
+
};
|
|
2935
|
+
return /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
2936
|
+
/* @__PURE__ */ jsx33(Button, { title: "Timeline", variant: "secondary", onClick: openRestoreModal, children: /* @__PURE__ */ jsx33(Icon, { name: "history" }) }),
|
|
2937
|
+
/* @__PURE__ */ jsxs21(
|
|
2938
|
+
Modal,
|
|
2939
|
+
{
|
|
2940
|
+
isOpen: isRestoreModalOpen,
|
|
2941
|
+
onClose: handleClose,
|
|
2942
|
+
heading: "Timeline",
|
|
2943
|
+
confirmText: "Restore",
|
|
2944
|
+
cancelText: "Cancel",
|
|
2945
|
+
onConfirm: handleRestore,
|
|
2946
|
+
onCancel: handleClose,
|
|
2947
|
+
showButtons: timestamps.length > 1,
|
|
2948
|
+
children: [
|
|
2949
|
+
timestamps.length > 1 && /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
2950
|
+
/* @__PURE__ */ jsxs21(RangeContainer, { children: [
|
|
2951
|
+
/* @__PURE__ */ jsx33(RangeLabel, { children: "Select Timestamp" }),
|
|
2952
|
+
/* @__PURE__ */ jsx33(
|
|
2953
|
+
RangeInput,
|
|
2954
|
+
{
|
|
2955
|
+
type: "range",
|
|
2956
|
+
min: 0,
|
|
2957
|
+
max: Math.max(0, timestamps.length - 1),
|
|
2958
|
+
value: selectedIndex,
|
|
2959
|
+
onChange: (e) => setSelectedIndex(Number(e.target.value)),
|
|
2960
|
+
disabled: timestamps.length === 0
|
|
2961
|
+
}
|
|
2962
|
+
),
|
|
2963
|
+
/* @__PURE__ */ jsx33(TimestampDisplay, { children: timestamps[selectedIndex] !== void 0 ? new Date(timestamps[selectedIndex]).toISOString() : "No timestamps available" })
|
|
2964
|
+
] }),
|
|
2965
|
+
/* @__PURE__ */ jsxs21(CheckboxContainer, { children: [
|
|
2966
|
+
/* @__PURE__ */ jsx33(
|
|
2967
|
+
CheckboxInput,
|
|
2968
|
+
{
|
|
2969
|
+
type: "checkbox",
|
|
2970
|
+
id: "remove-unknown-properties",
|
|
2971
|
+
checked: removeUnknownProperties,
|
|
2972
|
+
onChange: (e) => setRemoveUnknownProperties(e.target.checked)
|
|
2973
|
+
}
|
|
2974
|
+
),
|
|
2975
|
+
/* @__PURE__ */ jsx33(CheckboxLabel, { htmlFor: "remove-unknown-properties", children: "Remove unknown properties (properties that don't exist in the selected snapshot)" })
|
|
2976
|
+
] })
|
|
2977
|
+
] }),
|
|
2978
|
+
timestamps.length > 0 && timestamps[selectedIndex] !== void 0 && /* @__PURE__ */ jsxs21(PreviewSection, { children: [
|
|
2979
|
+
/* @__PURE__ */ jsx33(PreviewLabel, { children: "State at that time:" }),
|
|
2980
|
+
/* @__PURE__ */ jsx33(PreviewPre, { children: JSON.stringify(coMapAtSelectedIndex, null, 2) })
|
|
2981
|
+
] }),
|
|
2982
|
+
timestamps.length < 2 && /* @__PURE__ */ jsx33("div", { style: { color: "var(--j-text-color)" }, children: "At least 2 timestamps are required to restore a snapshot." })
|
|
2983
|
+
]
|
|
2984
|
+
}
|
|
2985
|
+
)
|
|
2986
|
+
] });
|
|
2987
|
+
}
|
|
2988
|
+
var PreviewSection = styled20("div")`
|
|
2989
|
+
margin-top: 1.5rem;
|
|
2990
|
+
`;
|
|
2991
|
+
var PreviewLabel = styled20("div")`
|
|
2992
|
+
font-weight: 500;
|
|
2993
|
+
margin-bottom: 0.5rem;
|
|
2994
|
+
color: var(--j-text-color-strong);
|
|
2995
|
+
`;
|
|
2996
|
+
var PreviewPre = styled20("pre")`
|
|
2997
|
+
background-color: var(--j-foreground);
|
|
2998
|
+
border: 1px solid var(--j-border-color);
|
|
2999
|
+
border-radius: var(--j-radius-md);
|
|
3000
|
+
padding: 1rem;
|
|
3001
|
+
overflow-x: auto;
|
|
3002
|
+
font-size: 0.875rem;
|
|
3003
|
+
max-height: 400px;
|
|
3004
|
+
overflow-y: auto;
|
|
3005
|
+
color: var(--j-text-color);
|
|
3006
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
3007
|
+
`;
|
|
3008
|
+
var RangeContainer = styled20("div")`
|
|
3009
|
+
display: flex;
|
|
3010
|
+
flex-direction: column;
|
|
3011
|
+
gap: 0.75rem;
|
|
3012
|
+
`;
|
|
3013
|
+
var RangeLabel = styled20("label")`
|
|
3014
|
+
font-weight: 500;
|
|
3015
|
+
color: var(--j-text-color-strong);
|
|
3016
|
+
font-size: 0.875rem;
|
|
3017
|
+
`;
|
|
3018
|
+
var RangeInput = styled20("input")`
|
|
3019
|
+
width: 100%;
|
|
3020
|
+
height: 0.5rem;
|
|
3021
|
+
border-radius: var(--j-radius-sm);
|
|
3022
|
+
outline: none;
|
|
3023
|
+
-webkit-appearance: none;
|
|
3024
|
+
appearance: none;
|
|
3025
|
+
background: var(--j-foreground);
|
|
3026
|
+
cursor: pointer;
|
|
3027
|
+
|
|
3028
|
+
&::-webkit-slider-thumb {
|
|
3029
|
+
-webkit-appearance: none;
|
|
3030
|
+
appearance: none;
|
|
3031
|
+
width: 1.25rem;
|
|
3032
|
+
height: 1.25rem;
|
|
3033
|
+
border-radius: 50%;
|
|
3034
|
+
background: var(--j-primary-color);
|
|
3035
|
+
cursor: pointer;
|
|
3036
|
+
border: 2px solid var(--j-background);
|
|
3037
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
&::-moz-range-thumb {
|
|
3041
|
+
width: 1.25rem;
|
|
3042
|
+
height: 1.25rem;
|
|
3043
|
+
border-radius: 50%;
|
|
3044
|
+
background: var(--j-primary-color);
|
|
3045
|
+
cursor: pointer;
|
|
3046
|
+
border: 2px solid var(--j-background);
|
|
3047
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
3048
|
+
}
|
|
3049
|
+
|
|
3050
|
+
&:disabled {
|
|
3051
|
+
opacity: 0.5;
|
|
3052
|
+
cursor: not-allowed;
|
|
3053
|
+
}
|
|
3054
|
+
`;
|
|
3055
|
+
var TimestampDisplay = styled20("div")`
|
|
3056
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
3057
|
+
font-size: 0.875rem;
|
|
3058
|
+
color: var(--j-text-color);
|
|
3059
|
+
padding: 0.5rem;
|
|
3060
|
+
background-color: var(--j-foreground);
|
|
3061
|
+
border: 1px solid var(--j-border-color);
|
|
3062
|
+
border-radius: var(--j-radius-md);
|
|
3063
|
+
text-align: center;
|
|
3064
|
+
`;
|
|
3065
|
+
var CheckboxContainer = styled20("div")`
|
|
3066
|
+
display: flex;
|
|
3067
|
+
align-items: flex-start;
|
|
3068
|
+
gap: 0.5rem;
|
|
3069
|
+
margin-top: 1rem;
|
|
3070
|
+
`;
|
|
3071
|
+
var CheckboxInput = styled20("input")`
|
|
3072
|
+
width: 1rem;
|
|
3073
|
+
height: 1rem;
|
|
3074
|
+
margin-top: 0.125rem;
|
|
3075
|
+
cursor: pointer;
|
|
3076
|
+
accent-color: var(--j-primary-color);
|
|
3077
|
+
`;
|
|
3078
|
+
var CheckboxLabel = styled20("label")`
|
|
3079
|
+
font-size: 0.875rem;
|
|
3080
|
+
color: var(--j-text-color);
|
|
3081
|
+
cursor: pointer;
|
|
3082
|
+
line-height: 1.25rem;
|
|
3083
|
+
`;
|
|
3084
|
+
var EditorContainer = styled20("div")`
|
|
3085
|
+
margin-top: 1rem;
|
|
3086
|
+
`;
|
|
3087
|
+
|
|
2446
3088
|
// src/inspector/viewer/page.tsx
|
|
2447
|
-
import { Fragment as
|
|
3089
|
+
import { Fragment as Fragment12, jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2448
3090
|
var BasePageContainer = React5.forwardRef(
|
|
2449
|
-
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */
|
|
3091
|
+
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ jsx34("div", { ref, ...rest })
|
|
2450
3092
|
);
|
|
2451
|
-
var PageContainer =
|
|
3093
|
+
var PageContainer = styled21(BasePageContainer)`
|
|
2452
3094
|
position: absolute;
|
|
2453
3095
|
z-index: 10;
|
|
2454
3096
|
inset: 0;
|
|
@@ -2456,36 +3098,36 @@ var PageContainer = styled18(BasePageContainer)`
|
|
|
2456
3098
|
height: 100%;
|
|
2457
3099
|
padding: 0 0.75rem;
|
|
2458
3100
|
`;
|
|
2459
|
-
var BackButton =
|
|
3101
|
+
var BackButton = styled21("div")`
|
|
2460
3102
|
position: absolute;
|
|
2461
3103
|
left: 0;
|
|
2462
3104
|
right: 0;
|
|
2463
3105
|
top: 0;
|
|
2464
3106
|
height: 2.5rem;
|
|
2465
3107
|
`;
|
|
2466
|
-
var HeaderContainer =
|
|
3108
|
+
var HeaderContainer = styled21("div")`
|
|
2467
3109
|
display: flex;
|
|
2468
3110
|
justify-content: space-between;
|
|
2469
3111
|
align-items: center;
|
|
2470
3112
|
margin-bottom: 1rem;
|
|
2471
3113
|
`;
|
|
2472
|
-
var TitleContainer =
|
|
3114
|
+
var TitleContainer = styled21("div")`
|
|
2473
3115
|
display: flex;
|
|
2474
3116
|
align-items: center;
|
|
2475
3117
|
gap: 0.75rem;
|
|
2476
3118
|
`;
|
|
2477
|
-
var Title =
|
|
3119
|
+
var Title = styled21(Heading)`
|
|
2478
3120
|
display: flex;
|
|
2479
3121
|
flex-direction: column;
|
|
2480
3122
|
align-items: flex-start;
|
|
2481
3123
|
gap: 0.25rem;
|
|
2482
3124
|
`;
|
|
2483
|
-
var BadgeContainer =
|
|
3125
|
+
var BadgeContainer = styled21("div")`
|
|
2484
3126
|
display: flex;
|
|
2485
3127
|
align-items: center;
|
|
2486
3128
|
gap: 0.75rem;
|
|
2487
3129
|
`;
|
|
2488
|
-
var ContentContainer =
|
|
3130
|
+
var ContentContainer = styled21("div")`
|
|
2489
3131
|
overflow: auto;
|
|
2490
3132
|
display: flex;
|
|
2491
3133
|
flex-direction: column;
|
|
@@ -2506,7 +3148,7 @@ function View(props) {
|
|
|
2506
3148
|
const { node, onNavigate } = props;
|
|
2507
3149
|
if (!snapshot || snapshot === "unavailable") return;
|
|
2508
3150
|
if (type === "costream") {
|
|
2509
|
-
return /* @__PURE__ */
|
|
3151
|
+
return /* @__PURE__ */ jsx34(
|
|
2510
3152
|
CoStreamView,
|
|
2511
3153
|
{
|
|
2512
3154
|
data: snapshot,
|
|
@@ -2517,7 +3159,7 @@ function View(props) {
|
|
|
2517
3159
|
);
|
|
2518
3160
|
}
|
|
2519
3161
|
if (extendedType === "group") {
|
|
2520
|
-
return /* @__PURE__ */
|
|
3162
|
+
return /* @__PURE__ */ jsx34(
|
|
2521
3163
|
GroupView,
|
|
2522
3164
|
{
|
|
2523
3165
|
coValue: value,
|
|
@@ -2528,10 +3170,10 @@ function View(props) {
|
|
|
2528
3170
|
);
|
|
2529
3171
|
}
|
|
2530
3172
|
if (extendedType === "account") {
|
|
2531
|
-
return /* @__PURE__ */
|
|
3173
|
+
return /* @__PURE__ */ jsx34(AccountView, { data: snapshot, node, onNavigate });
|
|
2532
3174
|
}
|
|
2533
3175
|
if (type === "coplaintext") {
|
|
2534
|
-
return /* @__PURE__ */
|
|
3176
|
+
return /* @__PURE__ */ jsx34(CoPlainTextView, { data: snapshot });
|
|
2535
3177
|
}
|
|
2536
3178
|
if (type === "colist") {
|
|
2537
3179
|
const handleRemove = (index) => {
|
|
@@ -2540,7 +3182,7 @@ function View(props) {
|
|
|
2540
3182
|
list.delete(index);
|
|
2541
3183
|
}
|
|
2542
3184
|
};
|
|
2543
|
-
return /* @__PURE__ */
|
|
3185
|
+
return /* @__PURE__ */ jsx34(
|
|
2544
3186
|
TableView,
|
|
2545
3187
|
{
|
|
2546
3188
|
data: snapshot,
|
|
@@ -2551,9 +3193,20 @@ function View(props) {
|
|
|
2551
3193
|
);
|
|
2552
3194
|
}
|
|
2553
3195
|
if (extendedType === "record") {
|
|
2554
|
-
return /* @__PURE__ */
|
|
3196
|
+
return /* @__PURE__ */ jsx34(TableView, { data: snapshot, node, onNavigate });
|
|
3197
|
+
}
|
|
3198
|
+
if (type === "comap") {
|
|
3199
|
+
return /* @__PURE__ */ jsx34(
|
|
3200
|
+
CoMapView,
|
|
3201
|
+
{
|
|
3202
|
+
coValue: value,
|
|
3203
|
+
data: snapshot,
|
|
3204
|
+
node,
|
|
3205
|
+
onNavigate
|
|
3206
|
+
}
|
|
3207
|
+
);
|
|
2555
3208
|
}
|
|
2556
|
-
return /* @__PURE__ */
|
|
3209
|
+
return /* @__PURE__ */ jsx34(GridView, { data: snapshot, onNavigate, node });
|
|
2557
3210
|
}
|
|
2558
3211
|
function Page(props) {
|
|
2559
3212
|
const {
|
|
@@ -2569,13 +3222,13 @@ function Page(props) {
|
|
|
2569
3222
|
const coValue = useResolvedCoValue(coId, node);
|
|
2570
3223
|
const { value, snapshot, type, extendedType } = coValue;
|
|
2571
3224
|
if (snapshot === "unavailable") {
|
|
2572
|
-
return /* @__PURE__ */
|
|
3225
|
+
return /* @__PURE__ */ jsx34("div", { style, children: "Data unavailable" });
|
|
2573
3226
|
}
|
|
2574
3227
|
if (!snapshot) {
|
|
2575
|
-
return /* @__PURE__ */
|
|
3228
|
+
return /* @__PURE__ */ jsx34("div", { style });
|
|
2576
3229
|
}
|
|
2577
|
-
return /* @__PURE__ */
|
|
2578
|
-
!isTopLevel && /* @__PURE__ */
|
|
3230
|
+
return /* @__PURE__ */ jsxs22(PageContainer, { style, className, isTopLevel, children: [
|
|
3231
|
+
!isTopLevel && /* @__PURE__ */ jsx34(
|
|
2579
3232
|
BackButton,
|
|
2580
3233
|
{
|
|
2581
3234
|
"aria-label": "Back",
|
|
@@ -2585,27 +3238,27 @@ function Page(props) {
|
|
|
2585
3238
|
"aria-hidden": "true"
|
|
2586
3239
|
}
|
|
2587
3240
|
),
|
|
2588
|
-
/* @__PURE__ */
|
|
2589
|
-
/* @__PURE__ */
|
|
3241
|
+
/* @__PURE__ */ jsx34(HeaderContainer, { children: /* @__PURE__ */ jsxs22(TitleContainer, { children: [
|
|
3242
|
+
/* @__PURE__ */ jsx34(Title, { children: /* @__PURE__ */ jsxs22("span", { children: [
|
|
2590
3243
|
name,
|
|
2591
|
-
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */
|
|
3244
|
+
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */ jsxs22("span", { style: { color: "#57534e", fontWeight: 500 }, children: [
|
|
2592
3245
|
" ",
|
|
2593
3246
|
snapshot.name
|
|
2594
3247
|
] }) : null
|
|
2595
3248
|
] }) }),
|
|
2596
|
-
/* @__PURE__ */
|
|
2597
|
-
/* @__PURE__ */
|
|
2598
|
-
/* @__PURE__ */
|
|
3249
|
+
/* @__PURE__ */ jsxs22(BadgeContainer, { children: [
|
|
3250
|
+
/* @__PURE__ */ jsx34(Badge, { children: type && /* @__PURE__ */ jsx34(TypeIcon, { type, extendedType }) }),
|
|
3251
|
+
/* @__PURE__ */ jsx34(Badge, { children: coId })
|
|
2599
3252
|
] })
|
|
2600
3253
|
] }) }),
|
|
2601
|
-
/* @__PURE__ */
|
|
2602
|
-
/* @__PURE__ */
|
|
2603
|
-
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */
|
|
2604
|
-
/* @__PURE__ */
|
|
2605
|
-
/* @__PURE__ */
|
|
3254
|
+
/* @__PURE__ */ jsxs22(ContentContainer, { children: [
|
|
3255
|
+
/* @__PURE__ */ jsx34(View, { ...props, coValue }),
|
|
3256
|
+
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */ jsxs22(Fragment12, { children: [
|
|
3257
|
+
/* @__PURE__ */ jsx34(RoleDisplay, { node, value }),
|
|
3258
|
+
/* @__PURE__ */ jsxs22(Text, { muted: true, children: [
|
|
2606
3259
|
"Owned by",
|
|
2607
3260
|
" ",
|
|
2608
|
-
/* @__PURE__ */
|
|
3261
|
+
/* @__PURE__ */ jsx34(
|
|
2609
3262
|
AccountOrGroupText,
|
|
2610
3263
|
{
|
|
2611
3264
|
coId: value.group.id,
|
|
@@ -2618,15 +3271,15 @@ function Page(props) {
|
|
|
2618
3271
|
)
|
|
2619
3272
|
] })
|
|
2620
3273
|
] }),
|
|
2621
|
-
value && /* @__PURE__ */
|
|
3274
|
+
value && /* @__PURE__ */ jsx34(HistoryView, { coValue: value, node })
|
|
2622
3275
|
] })
|
|
2623
3276
|
] });
|
|
2624
3277
|
}
|
|
2625
3278
|
|
|
2626
3279
|
// src/inspector/ui/error-boundary.tsx
|
|
2627
3280
|
import React6 from "react";
|
|
2628
|
-
import { styled as
|
|
2629
|
-
import { jsx as
|
|
3281
|
+
import { styled as styled22 } from "goober";
|
|
3282
|
+
import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2630
3283
|
var ErrorBoundary = class extends React6.Component {
|
|
2631
3284
|
constructor(props) {
|
|
2632
3285
|
super(props);
|
|
@@ -2640,24 +3293,24 @@ var ErrorBoundary = class extends React6.Component {
|
|
|
2640
3293
|
}
|
|
2641
3294
|
render() {
|
|
2642
3295
|
if (this.state.hasError) {
|
|
2643
|
-
return /* @__PURE__ */
|
|
2644
|
-
/* @__PURE__ */
|
|
2645
|
-
/* @__PURE__ */
|
|
2646
|
-
/* @__PURE__ */
|
|
3296
|
+
return /* @__PURE__ */ jsxs23("div", { style: { padding: "1rem" }, children: [
|
|
3297
|
+
/* @__PURE__ */ jsx35(StyledHeading2, { children: this.props.title }),
|
|
3298
|
+
/* @__PURE__ */ jsx35(Text, { mono: true, style: { marginTop: "0.5rem", color: "#ef4444" }, children: this.state.error?.message || "An unexpected error occurred" }),
|
|
3299
|
+
/* @__PURE__ */ jsx35("pre", { style: { paddingLeft: "1rem", color: "#ef4444" }, children: this.state.error?.stack })
|
|
2647
3300
|
] });
|
|
2648
3301
|
}
|
|
2649
3302
|
return this.props.children;
|
|
2650
3303
|
}
|
|
2651
3304
|
};
|
|
2652
|
-
var StyledHeading2 =
|
|
3305
|
+
var StyledHeading2 = styled22("h1")`
|
|
2653
3306
|
font-size: 1.125rem;
|
|
2654
3307
|
font-weight: 500;
|
|
2655
3308
|
color: var(--j-text-color-strong);
|
|
2656
3309
|
`;
|
|
2657
3310
|
|
|
2658
3311
|
// src/inspector/viewer/page-stack.tsx
|
|
2659
|
-
import { Fragment as
|
|
2660
|
-
var PageStackContainer =
|
|
3312
|
+
import { Fragment as Fragment13, jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3313
|
+
var PageStackContainer = styled23("div")`
|
|
2661
3314
|
position: relative;
|
|
2662
3315
|
padding: 0 0.75rem;
|
|
2663
3316
|
overflow-y: auto;
|
|
@@ -2674,9 +3327,9 @@ function PageStack({
|
|
|
2674
3327
|
}) {
|
|
2675
3328
|
const page = path[path.length - 1];
|
|
2676
3329
|
const index = path.length - 1;
|
|
2677
|
-
return /* @__PURE__ */
|
|
3330
|
+
return /* @__PURE__ */ jsx36(Fragment13, { children: /* @__PURE__ */ jsxs24(PageStackContainer, { children: [
|
|
2678
3331
|
children,
|
|
2679
|
-
node && page && /* @__PURE__ */
|
|
3332
|
+
node && page && /* @__PURE__ */ jsx36(ErrorBoundary, { title: "An error occurred while rendering this CoValue", children: /* @__PURE__ */ jsx36(
|
|
2680
3333
|
Page,
|
|
2681
3334
|
{
|
|
2682
3335
|
coId: page.coId,
|
|
@@ -2691,10 +3344,10 @@ function PageStack({
|
|
|
2691
3344
|
}
|
|
2692
3345
|
|
|
2693
3346
|
// src/inspector/viewer/use-page-path.ts
|
|
2694
|
-
import { useCallback, useEffect as useEffect8, useState as
|
|
3347
|
+
import { useCallback, useEffect as useEffect8, useState as useState13 } from "react";
|
|
2695
3348
|
var STORAGE_KEY = "jazz-inspector-paths";
|
|
2696
3349
|
function usePagePath(defaultPath) {
|
|
2697
|
-
const [path, setPath] =
|
|
3350
|
+
const [path, setPath] = useState13(() => {
|
|
2698
3351
|
if (typeof window === "undefined") return [];
|
|
2699
3352
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
2700
3353
|
if (stored) {
|
|
@@ -2748,8 +3401,8 @@ function usePagePath(defaultPath) {
|
|
|
2748
3401
|
}
|
|
2749
3402
|
|
|
2750
3403
|
// src/inspector/ui/global-styles.tsx
|
|
2751
|
-
import { styled as
|
|
2752
|
-
var GlobalStyles =
|
|
3404
|
+
import { styled as styled24 } from "goober";
|
|
3405
|
+
var GlobalStyles = styled24("div")`
|
|
2753
3406
|
/* Colors */
|
|
2754
3407
|
--j-primary-color: #146AFF;
|
|
2755
3408
|
--j-link-color: var(--j-primary-color);
|
|
@@ -2823,9 +3476,9 @@ var GlobalStyles = styled21("div")`
|
|
|
2823
3476
|
`;
|
|
2824
3477
|
|
|
2825
3478
|
// src/inspector/viewer/inspector-button.tsx
|
|
2826
|
-
import { styled as
|
|
2827
|
-
import { jsx as
|
|
2828
|
-
var StyledInspectorButton =
|
|
3479
|
+
import { styled as styled25 } from "goober";
|
|
3480
|
+
import { jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3481
|
+
var StyledInspectorButton = styled25("button")`
|
|
2829
3482
|
position: fixed;
|
|
2830
3483
|
width: 2.5rem;
|
|
2831
3484
|
height: 2.5rem;
|
|
@@ -2856,7 +3509,7 @@ var StyledInspectorButton = styled22("button")`
|
|
|
2856
3509
|
}
|
|
2857
3510
|
}}
|
|
2858
3511
|
`;
|
|
2859
|
-
var JazzIcon =
|
|
3512
|
+
var JazzIcon = styled25("svg")`
|
|
2860
3513
|
width: 100%;
|
|
2861
3514
|
height: auto;
|
|
2862
3515
|
position: relative;
|
|
@@ -2867,8 +3520,8 @@ function InspectorButton({
|
|
|
2867
3520
|
position = "right",
|
|
2868
3521
|
...buttonProps
|
|
2869
3522
|
}) {
|
|
2870
|
-
return /* @__PURE__ */
|
|
2871
|
-
/* @__PURE__ */
|
|
3523
|
+
return /* @__PURE__ */ jsxs25(StyledInspectorButton, { position, ...buttonProps, children: [
|
|
3524
|
+
/* @__PURE__ */ jsx37(
|
|
2872
3525
|
JazzIcon,
|
|
2873
3526
|
{
|
|
2874
3527
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2876,7 +3529,7 @@ function InspectorButton({
|
|
|
2876
3529
|
height: "115",
|
|
2877
3530
|
viewBox: "0 0 119 115",
|
|
2878
3531
|
fill: "none",
|
|
2879
|
-
children: /* @__PURE__ */
|
|
3532
|
+
children: /* @__PURE__ */ jsx37(
|
|
2880
3533
|
"path",
|
|
2881
3534
|
{
|
|
2882
3535
|
fillRule: "evenodd",
|
|
@@ -2887,7 +3540,7 @@ function InspectorButton({
|
|
|
2887
3540
|
)
|
|
2888
3541
|
}
|
|
2889
3542
|
),
|
|
2890
|
-
/* @__PURE__ */
|
|
3543
|
+
/* @__PURE__ */ jsx37(
|
|
2891
3544
|
"span",
|
|
2892
3545
|
{
|
|
2893
3546
|
style: {
|
|
@@ -2908,10 +3561,10 @@ function InspectorButton({
|
|
|
2908
3561
|
}
|
|
2909
3562
|
|
|
2910
3563
|
// src/inspector/viewer/use-open-inspector.ts
|
|
2911
|
-
import { useEffect as useEffect9, useState as
|
|
3564
|
+
import { useEffect as useEffect9, useState as useState14 } from "react";
|
|
2912
3565
|
var STORAGE_KEY2 = "jazz-inspector-open";
|
|
2913
3566
|
function useOpenInspector() {
|
|
2914
|
-
const [open, setOpen] =
|
|
3567
|
+
const [open, setOpen] = useState14(() => {
|
|
2915
3568
|
if (typeof window === "undefined") return false;
|
|
2916
3569
|
const stored = localStorage.getItem(STORAGE_KEY2);
|
|
2917
3570
|
return stored ? JSON.parse(stored) : false;
|
|
@@ -2923,15 +3576,15 @@ function useOpenInspector() {
|
|
|
2923
3576
|
}
|
|
2924
3577
|
|
|
2925
3578
|
// src/inspector/viewer/delete-local-data.tsx
|
|
2926
|
-
import { useState as
|
|
2927
|
-
import { Fragment as
|
|
3579
|
+
import { useState as useState15 } from "react";
|
|
3580
|
+
import { Fragment as Fragment14, jsx as jsx38, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2928
3581
|
var DELETE_LOCAL_DATA_STRING = "delete my local data";
|
|
2929
3582
|
function DeleteLocalData() {
|
|
2930
|
-
const [showDeleteModal, setShowDeleteModal] =
|
|
2931
|
-
const [confirmDeleteString, setConfirmDeleteString] =
|
|
2932
|
-
return /* @__PURE__ */
|
|
2933
|
-
/* @__PURE__ */
|
|
2934
|
-
/* @__PURE__ */
|
|
3583
|
+
const [showDeleteModal, setShowDeleteModal] = useState15(false);
|
|
3584
|
+
const [confirmDeleteString, setConfirmDeleteString] = useState15("");
|
|
3585
|
+
return /* @__PURE__ */ jsxs26(Fragment14, { children: [
|
|
3586
|
+
/* @__PURE__ */ jsx38(Button, { variant: "destructive", onClick: () => setShowDeleteModal(true), children: "Delete my local data" }),
|
|
3587
|
+
/* @__PURE__ */ jsxs26(
|
|
2935
3588
|
Modal,
|
|
2936
3589
|
{
|
|
2937
3590
|
isOpen: showDeleteModal,
|
|
@@ -2939,7 +3592,7 @@ function DeleteLocalData() {
|
|
|
2939
3592
|
heading: "Delete Local Data",
|
|
2940
3593
|
showButtons: false,
|
|
2941
3594
|
children: [
|
|
2942
|
-
/* @__PURE__ */
|
|
3595
|
+
/* @__PURE__ */ jsxs26(
|
|
2943
3596
|
"div",
|
|
2944
3597
|
{
|
|
2945
3598
|
style: {
|
|
@@ -2950,33 +3603,33 @@ function DeleteLocalData() {
|
|
|
2950
3603
|
gap: "0.5rem"
|
|
2951
3604
|
},
|
|
2952
3605
|
children: [
|
|
2953
|
-
/* @__PURE__ */
|
|
3606
|
+
/* @__PURE__ */ jsxs26("p", { children: [
|
|
2954
3607
|
"This action ",
|
|
2955
|
-
/* @__PURE__ */
|
|
3608
|
+
/* @__PURE__ */ jsx38("strong", { children: "cannot" }),
|
|
2956
3609
|
" be undone."
|
|
2957
3610
|
] }),
|
|
2958
|
-
/* @__PURE__ */
|
|
3611
|
+
/* @__PURE__ */ jsxs26("p", { children: [
|
|
2959
3612
|
"Be aware that the following data will be",
|
|
2960
3613
|
" ",
|
|
2961
|
-
/* @__PURE__ */
|
|
3614
|
+
/* @__PURE__ */ jsx38("strong", { children: "permanently" }),
|
|
2962
3615
|
" deleted:"
|
|
2963
3616
|
] }),
|
|
2964
|
-
/* @__PURE__ */
|
|
2965
|
-
/* @__PURE__ */
|
|
3617
|
+
/* @__PURE__ */ jsxs26("ul", { style: { listStyleType: "disc", paddingLeft: "1rem" }, children: [
|
|
3618
|
+
/* @__PURE__ */ jsxs26("li", { children: [
|
|
2966
3619
|
"Unsynced data for ",
|
|
2967
|
-
/* @__PURE__ */
|
|
3620
|
+
/* @__PURE__ */ jsx38("strong", { children: "all apps" }),
|
|
2968
3621
|
" on",
|
|
2969
3622
|
" ",
|
|
2970
|
-
/* @__PURE__ */
|
|
3623
|
+
/* @__PURE__ */ jsx38("code", { children: window.location.origin })
|
|
2971
3624
|
] }),
|
|
2972
|
-
/* @__PURE__ */
|
|
2973
|
-
/* @__PURE__ */
|
|
3625
|
+
/* @__PURE__ */ jsx38("li", { children: "Accounts" }),
|
|
3626
|
+
/* @__PURE__ */ jsx38("li", { children: "Logged in sessions" })
|
|
2974
3627
|
] }),
|
|
2975
|
-
/* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ jsx38("p", {})
|
|
2976
3629
|
]
|
|
2977
3630
|
}
|
|
2978
3631
|
),
|
|
2979
|
-
/* @__PURE__ */
|
|
3632
|
+
/* @__PURE__ */ jsx38(
|
|
2980
3633
|
Input,
|
|
2981
3634
|
{
|
|
2982
3635
|
label: `Type "${DELETE_LOCAL_DATA_STRING}" to confirm`,
|
|
@@ -2987,7 +3640,7 @@ function DeleteLocalData() {
|
|
|
2987
3640
|
}
|
|
2988
3641
|
}
|
|
2989
3642
|
),
|
|
2990
|
-
/* @__PURE__ */
|
|
3643
|
+
/* @__PURE__ */ jsx38(
|
|
2991
3644
|
"p",
|
|
2992
3645
|
{
|
|
2993
3646
|
style: {
|
|
@@ -2997,14 +3650,14 @@ function DeleteLocalData() {
|
|
|
2997
3650
|
flexDirection: "column",
|
|
2998
3651
|
gap: "0.5rem"
|
|
2999
3652
|
},
|
|
3000
|
-
children: /* @__PURE__ */
|
|
3653
|
+
children: /* @__PURE__ */ jsxs26("small", { children: [
|
|
3001
3654
|
"Data synced to a sync server will ",
|
|
3002
|
-
/* @__PURE__ */
|
|
3655
|
+
/* @__PURE__ */ jsx38("strong", { children: "not" }),
|
|
3003
3656
|
" be deleted, and will be synced when you log in again."
|
|
3004
3657
|
] })
|
|
3005
3658
|
}
|
|
3006
3659
|
),
|
|
3007
|
-
/* @__PURE__ */
|
|
3660
|
+
/* @__PURE__ */ jsxs26(
|
|
3008
3661
|
"div",
|
|
3009
3662
|
{
|
|
3010
3663
|
style: {
|
|
@@ -3014,8 +3667,8 @@ function DeleteLocalData() {
|
|
|
3014
3667
|
gap: "0.5rem"
|
|
3015
3668
|
},
|
|
3016
3669
|
children: [
|
|
3017
|
-
/* @__PURE__ */
|
|
3018
|
-
/* @__PURE__ */
|
|
3670
|
+
/* @__PURE__ */ jsx38(Button, { variant: "secondary", onClick: () => setShowDeleteModal(false), children: "Cancel" }),
|
|
3671
|
+
/* @__PURE__ */ jsx38(
|
|
3019
3672
|
Button,
|
|
3020
3673
|
{
|
|
3021
3674
|
variant: "destructive",
|
|
@@ -3042,8 +3695,8 @@ function DeleteLocalData() {
|
|
|
3042
3695
|
}
|
|
3043
3696
|
|
|
3044
3697
|
// src/inspector/viewer/new-app.tsx
|
|
3045
|
-
import { Fragment as
|
|
3046
|
-
var InspectorContainer =
|
|
3698
|
+
import { Fragment as Fragment15, jsx as jsx39, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3699
|
+
var InspectorContainer = styled26("div")`
|
|
3047
3700
|
position: fixed;
|
|
3048
3701
|
height: 50vh;
|
|
3049
3702
|
max-height: 800px;
|
|
@@ -3060,17 +3713,17 @@ var InspectorContainer = styled23("div")`
|
|
|
3060
3713
|
background-color: var(--j-background);
|
|
3061
3714
|
}
|
|
3062
3715
|
`;
|
|
3063
|
-
var HeaderContainer2 =
|
|
3716
|
+
var HeaderContainer2 = styled26("div")`
|
|
3064
3717
|
display: flex;
|
|
3065
3718
|
align-items: center;
|
|
3066
3719
|
gap: 1rem;
|
|
3067
3720
|
padding: 0 0.75rem;
|
|
3068
3721
|
margin: 0.75rem 0;
|
|
3069
3722
|
`;
|
|
3070
|
-
var Form =
|
|
3723
|
+
var Form = styled26("form")`
|
|
3071
3724
|
width: 24rem;
|
|
3072
3725
|
`;
|
|
3073
|
-
var InitialForm =
|
|
3726
|
+
var InitialForm = styled26("form")`
|
|
3074
3727
|
display: flex;
|
|
3075
3728
|
flex-direction: column;
|
|
3076
3729
|
position: relative;
|
|
@@ -3082,7 +3735,7 @@ var InitialForm = styled23("form")`
|
|
|
3082
3735
|
max-width: 24rem;
|
|
3083
3736
|
margin: 0 auto;
|
|
3084
3737
|
`;
|
|
3085
|
-
var OrText =
|
|
3738
|
+
var OrText = styled26("p")`
|
|
3086
3739
|
text-align: center;
|
|
3087
3740
|
`;
|
|
3088
3741
|
function JazzInspectorInternal({
|
|
@@ -3091,7 +3744,7 @@ function JazzInspectorInternal({
|
|
|
3091
3744
|
accountId
|
|
3092
3745
|
}) {
|
|
3093
3746
|
const [open, setOpen] = useOpenInspector();
|
|
3094
|
-
const [coValueId, setCoValueId] =
|
|
3747
|
+
const [coValueId, setCoValueId] = useState16("");
|
|
3095
3748
|
const { path, addPages, goToIndex, goBack, setPage } = usePagePath();
|
|
3096
3749
|
const handleCoValueIdSubmit = (e) => {
|
|
3097
3750
|
e.preventDefault();
|
|
@@ -3101,12 +3754,12 @@ function JazzInspectorInternal({
|
|
|
3101
3754
|
setCoValueId("");
|
|
3102
3755
|
};
|
|
3103
3756
|
if (!open) {
|
|
3104
|
-
return /* @__PURE__ */
|
|
3757
|
+
return /* @__PURE__ */ jsx39(InspectorButton, { position, onClick: () => setOpen(true) });
|
|
3105
3758
|
}
|
|
3106
|
-
return /* @__PURE__ */
|
|
3107
|
-
/* @__PURE__ */
|
|
3108
|
-
/* @__PURE__ */
|
|
3109
|
-
path.length !== 0 && /* @__PURE__ */
|
|
3759
|
+
return /* @__PURE__ */ jsxs27(InspectorContainer, { as: GlobalStyles, style: { zIndex: 999 }, children: [
|
|
3760
|
+
/* @__PURE__ */ jsxs27(HeaderContainer2, { children: [
|
|
3761
|
+
/* @__PURE__ */ jsx39(Breadcrumbs, { path, onBreadcrumbClick: goToIndex }),
|
|
3762
|
+
path.length !== 0 && /* @__PURE__ */ jsx39(Form, { onSubmit: handleCoValueIdSubmit, children: /* @__PURE__ */ jsx39(
|
|
3110
3763
|
Input,
|
|
3111
3764
|
{
|
|
3112
3765
|
label: "CoValue ID",
|
|
@@ -3117,24 +3770,24 @@ function JazzInspectorInternal({
|
|
|
3117
3770
|
onChange: (e) => setCoValueId(e.target.value)
|
|
3118
3771
|
}
|
|
3119
3772
|
) }),
|
|
3120
|
-
/* @__PURE__ */
|
|
3121
|
-
/* @__PURE__ */
|
|
3773
|
+
/* @__PURE__ */ jsx39(DeleteLocalData, {}),
|
|
3774
|
+
/* @__PURE__ */ jsx39(Button, { variant: "plain", type: "button", onClick: () => setOpen(false), children: "Close" })
|
|
3122
3775
|
] }),
|
|
3123
|
-
/* @__PURE__ */
|
|
3776
|
+
/* @__PURE__ */ jsx39(
|
|
3124
3777
|
PageStack,
|
|
3125
3778
|
{
|
|
3126
3779
|
path,
|
|
3127
3780
|
node: localNode,
|
|
3128
3781
|
goBack,
|
|
3129
3782
|
addPages,
|
|
3130
|
-
children: path.length <= 0 && /* @__PURE__ */
|
|
3783
|
+
children: path.length <= 0 && /* @__PURE__ */ jsxs27(
|
|
3131
3784
|
InitialForm,
|
|
3132
3785
|
{
|
|
3133
3786
|
onSubmit: handleCoValueIdSubmit,
|
|
3134
3787
|
"aria-hidden": path.length !== 0,
|
|
3135
3788
|
children: [
|
|
3136
|
-
/* @__PURE__ */
|
|
3137
|
-
/* @__PURE__ */
|
|
3789
|
+
/* @__PURE__ */ jsx39(Heading, { children: "Jazz CoValue Inspector" }),
|
|
3790
|
+
/* @__PURE__ */ jsx39(
|
|
3138
3791
|
Input,
|
|
3139
3792
|
{
|
|
3140
3793
|
label: "CoValue ID",
|
|
@@ -3145,10 +3798,10 @@ function JazzInspectorInternal({
|
|
|
3145
3798
|
onChange: (e) => setCoValueId(e.target.value)
|
|
3146
3799
|
}
|
|
3147
3800
|
),
|
|
3148
|
-
/* @__PURE__ */
|
|
3149
|
-
accountId && /* @__PURE__ */
|
|
3150
|
-
/* @__PURE__ */
|
|
3151
|
-
/* @__PURE__ */
|
|
3801
|
+
/* @__PURE__ */ jsx39(Button, { type: "submit", variant: "primary", children: "Inspect CoValue" }),
|
|
3802
|
+
accountId && /* @__PURE__ */ jsxs27(Fragment15, { children: [
|
|
3803
|
+
/* @__PURE__ */ jsx39(OrText, { children: "or" }),
|
|
3804
|
+
/* @__PURE__ */ jsx39(
|
|
3152
3805
|
Button,
|
|
3153
3806
|
{
|
|
3154
3807
|
variant: "secondary",
|
|
@@ -3171,12 +3824,12 @@ function JazzInspectorInternal({
|
|
|
3171
3824
|
// src/inspector/index.tsx
|
|
3172
3825
|
import { setup } from "goober";
|
|
3173
3826
|
import { useJazzContext } from "jazz-tools/react-core";
|
|
3174
|
-
import { jsx as
|
|
3827
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
3175
3828
|
function JazzInspector({ position = "right" }) {
|
|
3176
3829
|
const context = useJazzContext();
|
|
3177
3830
|
const localNode = context.node;
|
|
3178
3831
|
const me = "me" in context ? context.me : void 0;
|
|
3179
|
-
return /* @__PURE__ */
|
|
3832
|
+
return /* @__PURE__ */ jsx40(
|
|
3180
3833
|
JazzInspectorInternal,
|
|
3181
3834
|
{
|
|
3182
3835
|
position,
|