jazz-tools 0.19.1 → 0.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +63 -63
- package/CHANGELOG.md +21 -0
- package/dist/{chunk-NCNM6UDZ.js → chunk-JPWM4CS2.js} +4 -2
- package/dist/{chunk-NCNM6UDZ.js.map → chunk-JPWM4CS2.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/inspector/{custom-element-QESCMFY7.js → custom-element-3JAYHXWQ.js} +1134 -464
- package/dist/inspector/custom-element-3JAYHXWQ.js.map +1 -0
- package/dist/inspector/index.js +1104 -434
- 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/permissions.d.ts +3 -0
- package/dist/inspector/utils/permissions.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/testing.js +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/dist/tools/implementation/zodSchema/unionUtils.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 +889 -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/permissions.ts +10 -0
- package/src/inspector/utils/transactions-changes.ts +98 -0
- package/src/inspector/viewer/co-map-view.tsx +324 -0
- package/src/inspector/viewer/co-value-editor.tsx +164 -0
- package/src/inspector/viewer/grid-view.tsx +140 -10
- package/src/inspector/viewer/history-view.tsx +19 -119
- 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/implementation/zodSchema/unionUtils.ts +3 -4
- 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,81 @@ 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
|
|
|
1431
|
+
// src/inspector/utils/permissions.ts
|
|
1432
|
+
function isWriter(role) {
|
|
1433
|
+
return role === "writer" || role === "admin" || role === "manager" || role === "writeOnly";
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1153
1436
|
// src/inspector/viewer/grid-view.tsx
|
|
1154
|
-
import { Fragment as Fragment4, jsx as
|
|
1437
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1155
1438
|
function GridItem({
|
|
1156
1439
|
entry,
|
|
1157
1440
|
onNavigate,
|
|
1158
|
-
node
|
|
1441
|
+
node,
|
|
1442
|
+
coValue
|
|
1159
1443
|
}) {
|
|
1160
1444
|
const [key, value] = entry;
|
|
1161
1445
|
const isCoValue = isCoId(value);
|
|
1162
|
-
const
|
|
1446
|
+
const [isEditing, setIsEditing] = useState6(false);
|
|
1447
|
+
const handleEditClick = (e) => {
|
|
1448
|
+
e.stopPropagation();
|
|
1449
|
+
setIsEditing(true);
|
|
1450
|
+
};
|
|
1451
|
+
const handleCancel = () => {
|
|
1452
|
+
setIsEditing(false);
|
|
1453
|
+
};
|
|
1454
|
+
const handleDelete = (e) => {
|
|
1455
|
+
e.stopPropagation();
|
|
1456
|
+
if (confirm(`Are you sure you want to delete the property "${key}"?`)) {
|
|
1457
|
+
coValue?.core.makeTransaction(
|
|
1458
|
+
[
|
|
1459
|
+
{
|
|
1460
|
+
op: "del",
|
|
1461
|
+
key
|
|
1462
|
+
}
|
|
1463
|
+
],
|
|
1464
|
+
"private"
|
|
1465
|
+
);
|
|
1466
|
+
}
|
|
1467
|
+
};
|
|
1468
|
+
if (isEditing) {
|
|
1469
|
+
return /* @__PURE__ */ jsxs10(
|
|
1470
|
+
Card,
|
|
1471
|
+
{
|
|
1472
|
+
style: {
|
|
1473
|
+
backgroundColor: "var(--j-foreground)",
|
|
1474
|
+
borderColor: "var(--j-foreground)"
|
|
1475
|
+
},
|
|
1476
|
+
children: [
|
|
1477
|
+
/* @__PURE__ */ jsx22(CardHeader, { children: /* @__PURE__ */ jsx22("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: isCoValue ? /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1478
|
+
/* @__PURE__ */ jsx22(Text, { strong: true, children: key }),
|
|
1479
|
+
/* @__PURE__ */ jsx22(Badge, { children: /* @__PURE__ */ jsx22(ResolveIcon, { coId: value, node }) })
|
|
1480
|
+
] }) : /* @__PURE__ */ jsx22(Text, { strong: true, children: key }) }) }),
|
|
1481
|
+
/* @__PURE__ */ jsx22(CardBody, { style: { wordBreak: "break-word" }, children: /* @__PURE__ */ jsx22(
|
|
1482
|
+
CoValueEditor,
|
|
1483
|
+
{
|
|
1484
|
+
node,
|
|
1485
|
+
property: key,
|
|
1486
|
+
value,
|
|
1487
|
+
coValue,
|
|
1488
|
+
onCancel: handleCancel
|
|
1489
|
+
}
|
|
1490
|
+
) })
|
|
1491
|
+
]
|
|
1492
|
+
}
|
|
1493
|
+
);
|
|
1494
|
+
}
|
|
1495
|
+
const cardProps = isCoValue ? {
|
|
1163
1496
|
onClick: () => onNavigate([{ coId: value, name: key }]),
|
|
1164
1497
|
as: "button"
|
|
1165
1498
|
} : {
|
|
@@ -1168,12 +1501,34 @@ function GridItem({
|
|
|
1168
1501
|
borderColor: "var(--j-foreground)"
|
|
1169
1502
|
}
|
|
1170
1503
|
};
|
|
1171
|
-
return /* @__PURE__ */
|
|
1172
|
-
/* @__PURE__ */
|
|
1173
|
-
/* @__PURE__ */
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1504
|
+
return /* @__PURE__ */ jsxs10(Card, { ...cardProps, children: [
|
|
1505
|
+
/* @__PURE__ */ jsxs10(CardHeader, { children: [
|
|
1506
|
+
/* @__PURE__ */ jsx22("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: isCoValue ? /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1507
|
+
/* @__PURE__ */ jsx22(Text, { strong: true, children: key }),
|
|
1508
|
+
/* @__PURE__ */ jsx22(Badge, { children: /* @__PURE__ */ jsx22(ResolveIcon, { coId: value, node }) })
|
|
1509
|
+
] }) : /* @__PURE__ */ jsx22(Text, { strong: true, children: key }) }),
|
|
1510
|
+
coValue && isWriter(coValue.group.myRole()) && /* @__PURE__ */ jsxs10(ActionButtons, { children: [
|
|
1511
|
+
/* @__PURE__ */ jsx22(
|
|
1512
|
+
EditButton,
|
|
1513
|
+
{
|
|
1514
|
+
onClick: handleEditClick,
|
|
1515
|
+
type: "button",
|
|
1516
|
+
"aria-label": "Edit",
|
|
1517
|
+
children: /* @__PURE__ */ jsx22(Icon, { name: "edit", size: "sm" })
|
|
1518
|
+
}
|
|
1519
|
+
),
|
|
1520
|
+
/* @__PURE__ */ jsx22(
|
|
1521
|
+
DeleteButton,
|
|
1522
|
+
{
|
|
1523
|
+
onClick: handleDelete,
|
|
1524
|
+
type: "button",
|
|
1525
|
+
"aria-label": "Delete",
|
|
1526
|
+
children: /* @__PURE__ */ jsx22(Icon, { name: "delete", size: "sm" })
|
|
1527
|
+
}
|
|
1528
|
+
)
|
|
1529
|
+
] })
|
|
1530
|
+
] }),
|
|
1531
|
+
/* @__PURE__ */ jsx22(CardBody, { style: { wordBreak: "break-word" }, children: isCoValue ? /* @__PURE__ */ jsx22(CoMapPreview, { coId: value, node }) : /* @__PURE__ */ jsx22(
|
|
1177
1532
|
ValueRenderer,
|
|
1178
1533
|
{
|
|
1179
1534
|
json: value,
|
|
@@ -1187,28 +1542,67 @@ function GridItem({
|
|
|
1187
1542
|
function GridView({
|
|
1188
1543
|
data,
|
|
1189
1544
|
onNavigate,
|
|
1190
|
-
node
|
|
1545
|
+
node,
|
|
1546
|
+
coValue
|
|
1191
1547
|
}) {
|
|
1192
1548
|
const entries = Object.entries(data);
|
|
1193
|
-
return /* @__PURE__ */
|
|
1549
|
+
return /* @__PURE__ */ jsx22(Grid, { cols: entries.length === 1 ? 1 : 3, children: entries.map((entry, childIndex) => /* @__PURE__ */ jsx22(
|
|
1194
1550
|
GridItem,
|
|
1195
1551
|
{
|
|
1196
1552
|
entry,
|
|
1197
1553
|
onNavigate,
|
|
1198
|
-
node
|
|
1554
|
+
node,
|
|
1555
|
+
coValue
|
|
1199
1556
|
},
|
|
1200
1557
|
childIndex
|
|
1201
1558
|
)) });
|
|
1202
1559
|
}
|
|
1560
|
+
var EditButton = styled14("button")`
|
|
1561
|
+
display: inline-flex;
|
|
1562
|
+
align-items: center;
|
|
1563
|
+
justify-content: center;
|
|
1564
|
+
padding: 0.25rem;
|
|
1565
|
+
border: none;
|
|
1566
|
+
background: transparent;
|
|
1567
|
+
cursor: pointer;
|
|
1568
|
+
color: var(--j-text-color);
|
|
1569
|
+
border-radius: var(--j-radius-sm);
|
|
1570
|
+
transition: background-color 0.2s;
|
|
1571
|
+
|
|
1572
|
+
&:hover {
|
|
1573
|
+
background-color: var(--j-foreground);
|
|
1574
|
+
}
|
|
1575
|
+
`;
|
|
1576
|
+
var DeleteButton = styled14("button")`
|
|
1577
|
+
display: inline-flex;
|
|
1578
|
+
align-items: center;
|
|
1579
|
+
justify-content: center;
|
|
1580
|
+
padding: 0.25rem;
|
|
1581
|
+
border: none;
|
|
1582
|
+
background: transparent;
|
|
1583
|
+
cursor: pointer;
|
|
1584
|
+
color: var(--j-text-color);
|
|
1585
|
+
border-radius: var(--j-radius-sm);
|
|
1586
|
+
transition: background-color 0.2s;
|
|
1587
|
+
|
|
1588
|
+
&:hover {
|
|
1589
|
+
background-color: var(--j-foreground);
|
|
1590
|
+
}
|
|
1591
|
+
`;
|
|
1592
|
+
var ActionButtons = styled14("div")`
|
|
1593
|
+
display: flex;
|
|
1594
|
+
align-items: center;
|
|
1595
|
+
gap: 0.25rem;
|
|
1596
|
+
`;
|
|
1203
1597
|
|
|
1204
1598
|
// src/inspector/viewer/raw-data-card.tsx
|
|
1205
|
-
import { useEffect as useEffect7, useState as
|
|
1599
|
+
import { useEffect as useEffect7, useState as useState9 } from "react";
|
|
1206
1600
|
|
|
1207
1601
|
// src/inspector/ui/modal.tsx
|
|
1208
|
-
import { styled as
|
|
1602
|
+
import { styled as styled15 } from "goober";
|
|
1209
1603
|
import { forwardRef as forwardRef3, useEffect as useEffect4, useRef } from "react";
|
|
1210
|
-
import { jsx as
|
|
1211
|
-
var ModalContent =
|
|
1604
|
+
import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1605
|
+
var ModalContent = styled15("dialog")`
|
|
1212
1606
|
background-color: var(--j-background);
|
|
1213
1607
|
border-radius: var(--j-radius-lg);
|
|
1214
1608
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
|
@@ -1219,26 +1613,26 @@ var ModalContent = styled12("dialog")`
|
|
|
1219
1613
|
&::backdrop {
|
|
1220
1614
|
background-color: rgba(0, 0, 0, 0.7);
|
|
1221
1615
|
}
|
|
1222
|
-
|
|
1616
|
+
|
|
1223
1617
|
`;
|
|
1224
|
-
var ModalHeader =
|
|
1618
|
+
var ModalHeader = styled15("div")`
|
|
1225
1619
|
display: flex;
|
|
1226
1620
|
justify-content: space-between;
|
|
1227
1621
|
align-items: flex-start;
|
|
1228
1622
|
padding: 1.5rem 1.5rem 0 1.5rem;
|
|
1229
1623
|
gap: 1rem;
|
|
1230
1624
|
`;
|
|
1231
|
-
var ModalBody =
|
|
1625
|
+
var ModalBody = styled15("div")`
|
|
1232
1626
|
padding: 1rem 1.5rem;
|
|
1233
1627
|
flex: 1;
|
|
1234
1628
|
`;
|
|
1235
|
-
var ModalFooter =
|
|
1629
|
+
var ModalFooter = styled15("div")`
|
|
1236
1630
|
display: flex;
|
|
1237
1631
|
justify-content: flex-end;
|
|
1238
1632
|
gap: 0.75rem;
|
|
1239
1633
|
padding: 0 1.5rem 1.5rem 1.5rem;
|
|
1240
1634
|
`;
|
|
1241
|
-
var CloseButton =
|
|
1635
|
+
var CloseButton = styled15("button")`
|
|
1242
1636
|
background: none;
|
|
1243
1637
|
border: none;
|
|
1244
1638
|
cursor: pointer;
|
|
@@ -1252,11 +1646,11 @@ var CloseButton = styled12("button")`
|
|
|
1252
1646
|
justify-content: center;
|
|
1253
1647
|
min-width: 2rem;
|
|
1254
1648
|
min-height: 2rem;
|
|
1255
|
-
|
|
1649
|
+
|
|
1256
1650
|
&:hover {
|
|
1257
1651
|
background-color: var(--j-foreground);
|
|
1258
1652
|
}
|
|
1259
|
-
|
|
1653
|
+
|
|
1260
1654
|
&:focus-visible {
|
|
1261
1655
|
outline: 2px solid var(--j-border-focus);
|
|
1262
1656
|
outline-offset: 2px;
|
|
@@ -1294,7 +1688,7 @@ var Modal = forwardRef3(
|
|
|
1294
1688
|
onClose();
|
|
1295
1689
|
};
|
|
1296
1690
|
if (!isOpen) return null;
|
|
1297
|
-
return /* @__PURE__ */
|
|
1691
|
+
return /* @__PURE__ */ jsxs11(
|
|
1298
1692
|
ModalContent,
|
|
1299
1693
|
{
|
|
1300
1694
|
ref: ref || modalRef,
|
|
@@ -1303,90 +1697,36 @@ var Modal = forwardRef3(
|
|
|
1303
1697
|
"aria-labelledby": "modal-heading",
|
|
1304
1698
|
onClose,
|
|
1305
1699
|
children: [
|
|
1306
|
-
/* @__PURE__ */
|
|
1307
|
-
/* @__PURE__ */
|
|
1308
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ jsxs11(ModalHeader, { children: [
|
|
1701
|
+
/* @__PURE__ */ jsx23(Heading, { id: "modal-heading", children: heading }),
|
|
1702
|
+
/* @__PURE__ */ jsx23(CloseButton, { onClick: onClose, "aria-label": "Close modal", type: "button", children: "\xD7" })
|
|
1309
1703
|
] }),
|
|
1310
|
-
/* @__PURE__ */
|
|
1311
|
-
text && /* @__PURE__ */
|
|
1704
|
+
/* @__PURE__ */ jsxs11(ModalBody, { children: [
|
|
1705
|
+
text && /* @__PURE__ */ jsx23("p", { style: { margin: "0 0 1rem 0", color: "var(--j-text-color)" }, children: text }),
|
|
1312
1706
|
children
|
|
1313
1707
|
] }),
|
|
1314
|
-
showButtons && /* @__PURE__ */
|
|
1315
|
-
/* @__PURE__ */
|
|
1316
|
-
/* @__PURE__ */
|
|
1708
|
+
showButtons && /* @__PURE__ */ jsxs11(ModalFooter, { children: [
|
|
1709
|
+
/* @__PURE__ */ jsx23(Button, { variant: "secondary", onClick: handleCancel, children: cancelText }),
|
|
1710
|
+
/* @__PURE__ */ jsx23(Button, { variant: "primary", onClick: handleConfirm, children: confirmText })
|
|
1317
1711
|
] })
|
|
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);
|
|
1712
|
+
]
|
|
1713
|
+
}
|
|
1714
|
+
);
|
|
1364
1715
|
}
|
|
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
|
-
}
|
|
1716
|
+
);
|
|
1717
|
+
Modal.displayName = "Modal";
|
|
1378
1718
|
|
|
1379
1719
|
// src/inspector/ui/data-table.tsx
|
|
1380
|
-
import { useEffect as useEffect5, useMemo, useState as
|
|
1720
|
+
import { useEffect as useEffect5, useMemo, useState as useState7 } from "react";
|
|
1381
1721
|
|
|
1382
1722
|
// src/inspector/ui/table.tsx
|
|
1383
|
-
import { styled as
|
|
1723
|
+
import { styled as styled16 } from "goober";
|
|
1384
1724
|
import React4 from "react";
|
|
1385
|
-
import { jsx as
|
|
1386
|
-
var StyledTable =
|
|
1725
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1726
|
+
var StyledTable = styled16("table")`
|
|
1387
1727
|
width: 100%;
|
|
1388
1728
|
`;
|
|
1389
|
-
var StyledThead =
|
|
1729
|
+
var StyledThead = styled16("thead")`
|
|
1390
1730
|
text-align: left;
|
|
1391
1731
|
border-bottom: 1px solid var(--j-border-color);
|
|
1392
1732
|
background-color: var(--j-neutral-100);
|
|
@@ -1395,7 +1735,7 @@ var StyledThead = styled14("thead")`
|
|
|
1395
1735
|
background-color: var(--j-neutral-925);
|
|
1396
1736
|
}
|
|
1397
1737
|
`;
|
|
1398
|
-
var StyledTbody =
|
|
1738
|
+
var StyledTbody = styled16("tbody")`
|
|
1399
1739
|
tr {
|
|
1400
1740
|
border-bottom: 1px solid var(--j-border-color);
|
|
1401
1741
|
|
|
@@ -1404,23 +1744,23 @@ var StyledTbody = styled14("tbody")`
|
|
|
1404
1744
|
}
|
|
1405
1745
|
}
|
|
1406
1746
|
`;
|
|
1407
|
-
var StyledTh =
|
|
1747
|
+
var StyledTh = styled16("th")`
|
|
1408
1748
|
font-weight: 500;
|
|
1409
1749
|
padding: 0.5rem 0.75rem;
|
|
1410
1750
|
color: var(--j-text-color-strong);
|
|
1411
1751
|
`;
|
|
1412
|
-
var StyledTd =
|
|
1752
|
+
var StyledTd = styled16("td")`
|
|
1413
1753
|
padding: 0.5rem 0.75rem;
|
|
1414
1754
|
`;
|
|
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__ */
|
|
1755
|
+
var Table = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx24(StyledTable, { ref, ...props, children }));
|
|
1756
|
+
var TableHead = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx24(StyledThead, { ref, ...props, children }));
|
|
1757
|
+
var TableBody = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx24(StyledTbody, { ref, ...props, children }));
|
|
1758
|
+
var TableRow = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx24("tr", { ref, ...props, children }));
|
|
1759
|
+
var TableHeader = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx24(StyledTh, { ref, ...props, children }));
|
|
1760
|
+
var TableCell = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx24(StyledTd, { ref, ...props, children }));
|
|
1421
1761
|
|
|
1422
1762
|
// src/inspector/ui/data-table.tsx
|
|
1423
|
-
import { Fragment as Fragment5, jsx as
|
|
1763
|
+
import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1424
1764
|
function DataTable({
|
|
1425
1765
|
columns,
|
|
1426
1766
|
data,
|
|
@@ -1429,9 +1769,9 @@ function DataTable({
|
|
|
1429
1769
|
getRowKey,
|
|
1430
1770
|
emptyMessage = "No data available"
|
|
1431
1771
|
}) {
|
|
1432
|
-
const [currentPage, setCurrentPage] =
|
|
1433
|
-
const [sortConfig, setSortConfig] =
|
|
1434
|
-
const [filters, setFilters] =
|
|
1772
|
+
const [currentPage, setCurrentPage] = useState7(1);
|
|
1773
|
+
const [sortConfig, setSortConfig] = useState7(initialSort);
|
|
1774
|
+
const [filters, setFilters] = useState7({});
|
|
1435
1775
|
const filteredData = useMemo(() => {
|
|
1436
1776
|
return data.filter((row) => {
|
|
1437
1777
|
return Object.entries(filters).every(([columnId, filterValue]) => {
|
|
@@ -1490,9 +1830,9 @@ function DataTable({
|
|
|
1490
1830
|
const handlePageChange = (page) => {
|
|
1491
1831
|
setCurrentPage(Math.max(1, Math.min(page, totalPages)));
|
|
1492
1832
|
};
|
|
1493
|
-
return /* @__PURE__ */
|
|
1494
|
-
/* @__PURE__ */
|
|
1495
|
-
/* @__PURE__ */
|
|
1833
|
+
return /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
1834
|
+
/* @__PURE__ */ jsxs12(Table, { children: [
|
|
1835
|
+
/* @__PURE__ */ jsx25(TableHead, { children: /* @__PURE__ */ jsx25(TableRow, { children: columns.map((column) => /* @__PURE__ */ jsx25(TableHeader, { children: /* @__PURE__ */ jsxs12(
|
|
1496
1836
|
"div",
|
|
1497
1837
|
{
|
|
1498
1838
|
style: {
|
|
@@ -1503,8 +1843,8 @@ function DataTable({
|
|
|
1503
1843
|
},
|
|
1504
1844
|
onClick: () => handleSort(column.id),
|
|
1505
1845
|
children: [
|
|
1506
|
-
/* @__PURE__ */
|
|
1507
|
-
column.sortable && /* @__PURE__ */
|
|
1846
|
+
/* @__PURE__ */ jsx25("span", { children: column.header }),
|
|
1847
|
+
column.sortable && /* @__PURE__ */ jsx25(
|
|
1508
1848
|
"span",
|
|
1509
1849
|
{
|
|
1510
1850
|
style: {
|
|
@@ -1517,8 +1857,8 @@ function DataTable({
|
|
|
1517
1857
|
]
|
|
1518
1858
|
}
|
|
1519
1859
|
) }, column.id)) }) }),
|
|
1520
|
-
/* @__PURE__ */
|
|
1521
|
-
columns.some((column) => column.filterable) && /* @__PURE__ */
|
|
1860
|
+
/* @__PURE__ */ jsxs12(TableBody, { children: [
|
|
1861
|
+
columns.some((column) => column.filterable) && /* @__PURE__ */ jsx25(TableRow, { children: columns.map((column) => /* @__PURE__ */ jsx25(TableCell, { children: column.filterable && /* @__PURE__ */ jsx25(
|
|
1522
1862
|
Input,
|
|
1523
1863
|
{
|
|
1524
1864
|
label: "Filter",
|
|
@@ -1530,7 +1870,7 @@ function DataTable({
|
|
|
1530
1870
|
onClick: (e) => e.stopPropagation()
|
|
1531
1871
|
}
|
|
1532
1872
|
) }, column.id)) }),
|
|
1533
|
-
paginatedData.length === 0 ? /* @__PURE__ */
|
|
1873
|
+
paginatedData.length === 0 ? /* @__PURE__ */ jsx25(TableRow, { children: /* @__PURE__ */ jsx25(TableCell, { colSpan: columns.length, children: /* @__PURE__ */ jsx25(
|
|
1534
1874
|
"div",
|
|
1535
1875
|
{
|
|
1536
1876
|
style: {
|
|
@@ -1540,10 +1880,10 @@ function DataTable({
|
|
|
1540
1880
|
},
|
|
1541
1881
|
children: emptyMessage
|
|
1542
1882
|
}
|
|
1543
|
-
) }) }) : paginatedData.map((row, index) => /* @__PURE__ */
|
|
1883
|
+
) }) }) : 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
1884
|
] })
|
|
1545
1885
|
] }),
|
|
1546
|
-
showPagination && /* @__PURE__ */
|
|
1886
|
+
showPagination && /* @__PURE__ */ jsxs12(
|
|
1547
1887
|
"div",
|
|
1548
1888
|
{
|
|
1549
1889
|
style: {
|
|
@@ -1554,7 +1894,7 @@ function DataTable({
|
|
|
1554
1894
|
padding: "8px 0"
|
|
1555
1895
|
},
|
|
1556
1896
|
children: [
|
|
1557
|
-
/* @__PURE__ */
|
|
1897
|
+
/* @__PURE__ */ jsxs12("div", { style: { fontSize: "14px", opacity: 0.7 }, children: [
|
|
1558
1898
|
"Showing ",
|
|
1559
1899
|
startIndex + 1,
|
|
1560
1900
|
" to ",
|
|
@@ -1565,8 +1905,8 @@ function DataTable({
|
|
|
1565
1905
|
" entries",
|
|
1566
1906
|
Object.keys(filters).some((key) => filters[key]) && ` (filtered from ${data.length})`
|
|
1567
1907
|
] }),
|
|
1568
|
-
/* @__PURE__ */
|
|
1569
|
-
/* @__PURE__ */
|
|
1908
|
+
/* @__PURE__ */ jsxs12("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
|
|
1909
|
+
/* @__PURE__ */ jsx25(
|
|
1570
1910
|
Button,
|
|
1571
1911
|
{
|
|
1572
1912
|
variant: "secondary",
|
|
@@ -1575,7 +1915,7 @@ function DataTable({
|
|
|
1575
1915
|
children: "\xAB\xAB"
|
|
1576
1916
|
}
|
|
1577
1917
|
),
|
|
1578
|
-
/* @__PURE__ */
|
|
1918
|
+
/* @__PURE__ */ jsx25(
|
|
1579
1919
|
Button,
|
|
1580
1920
|
{
|
|
1581
1921
|
variant: "secondary",
|
|
@@ -1584,13 +1924,13 @@ function DataTable({
|
|
|
1584
1924
|
children: "\xAB"
|
|
1585
1925
|
}
|
|
1586
1926
|
),
|
|
1587
|
-
/* @__PURE__ */
|
|
1927
|
+
/* @__PURE__ */ jsxs12("span", { style: { fontSize: "14px" }, children: [
|
|
1588
1928
|
"Page ",
|
|
1589
1929
|
currentPage,
|
|
1590
1930
|
" of ",
|
|
1591
1931
|
totalPages
|
|
1592
1932
|
] }),
|
|
1593
|
-
/* @__PURE__ */
|
|
1933
|
+
/* @__PURE__ */ jsx25(
|
|
1594
1934
|
Button,
|
|
1595
1935
|
{
|
|
1596
1936
|
variant: "secondary",
|
|
@@ -1599,7 +1939,7 @@ function DataTable({
|
|
|
1599
1939
|
children: "\xBB"
|
|
1600
1940
|
}
|
|
1601
1941
|
),
|
|
1602
|
-
/* @__PURE__ */
|
|
1942
|
+
/* @__PURE__ */ jsx25(
|
|
1603
1943
|
Button,
|
|
1604
1944
|
{
|
|
1605
1945
|
variant: "secondary",
|
|
@@ -1616,18 +1956,18 @@ function DataTable({
|
|
|
1616
1956
|
}
|
|
1617
1957
|
|
|
1618
1958
|
// src/inspector/ui/accordion.tsx
|
|
1619
|
-
import { styled as
|
|
1620
|
-
import { useEffect as useEffect6, useState as
|
|
1621
|
-
import { jsx as
|
|
1959
|
+
import { styled as styled17 } from "goober";
|
|
1960
|
+
import { useEffect as useEffect6, useState as useState8 } from "react";
|
|
1961
|
+
import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1622
1962
|
function Accordion({ title, children, storageKey }) {
|
|
1623
1963
|
const [open, setOpen] = useStoragedState(storageKey, false);
|
|
1624
|
-
return /* @__PURE__ */
|
|
1964
|
+
return /* @__PURE__ */ jsxs13(
|
|
1625
1965
|
"details",
|
|
1626
1966
|
{
|
|
1627
1967
|
open,
|
|
1628
1968
|
style: { display: "flex", flexDirection: "column", gap: "1rem" },
|
|
1629
1969
|
children: [
|
|
1630
|
-
/* @__PURE__ */
|
|
1970
|
+
/* @__PURE__ */ jsx26(
|
|
1631
1971
|
StyledSummary,
|
|
1632
1972
|
{
|
|
1633
1973
|
onClick: (e) => {
|
|
@@ -1643,7 +1983,7 @@ function Accordion({ title, children, storageKey }) {
|
|
|
1643
1983
|
);
|
|
1644
1984
|
}
|
|
1645
1985
|
function useStoragedState(key, defaultValue) {
|
|
1646
|
-
const [state, setState] =
|
|
1986
|
+
const [state, setState] = useState8(() => {
|
|
1647
1987
|
if (typeof window === "undefined") return defaultValue;
|
|
1648
1988
|
const stored = localStorage.getItem(key);
|
|
1649
1989
|
return stored ? JSON.parse(stored) : defaultValue;
|
|
@@ -1653,7 +1993,7 @@ function useStoragedState(key, defaultValue) {
|
|
|
1653
1993
|
}, [state]);
|
|
1654
1994
|
return [state, setState];
|
|
1655
1995
|
}
|
|
1656
|
-
var StyledSummary =
|
|
1996
|
+
var StyledSummary = styled17("summary")`
|
|
1657
1997
|
font-size: 1.125rem;
|
|
1658
1998
|
cursor: pointer;
|
|
1659
1999
|
font-weight: 500;
|
|
@@ -1661,9 +2001,9 @@ var StyledSummary = styled15("summary")`
|
|
|
1661
2001
|
`;
|
|
1662
2002
|
|
|
1663
2003
|
// src/inspector/viewer/raw-data-card.tsx
|
|
1664
|
-
import { jsx as
|
|
2004
|
+
import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1665
2005
|
function CopyButton({ data }) {
|
|
1666
|
-
const [copyCount, setCopyCount] =
|
|
2006
|
+
const [copyCount, setCopyCount] = useState9(0);
|
|
1667
2007
|
const copied = copyCount > 0;
|
|
1668
2008
|
const stringifiedData = JSON.stringify(data);
|
|
1669
2009
|
useEffect7(() => {
|
|
@@ -1674,7 +2014,7 @@ function CopyButton({ data }) {
|
|
|
1674
2014
|
};
|
|
1675
2015
|
}
|
|
1676
2016
|
}, [copyCount]);
|
|
1677
|
-
return /* @__PURE__ */
|
|
2017
|
+
return /* @__PURE__ */ jsx27(
|
|
1678
2018
|
Button,
|
|
1679
2019
|
{
|
|
1680
2020
|
style: {
|
|
@@ -1693,14 +2033,14 @@ function CopyButton({ data }) {
|
|
|
1693
2033
|
);
|
|
1694
2034
|
}
|
|
1695
2035
|
function RawDataCard({ data }) {
|
|
1696
|
-
return /* @__PURE__ */
|
|
1697
|
-
/* @__PURE__ */
|
|
1698
|
-
/* @__PURE__ */
|
|
2036
|
+
return /* @__PURE__ */ jsx27(Accordion, { title: "Raw data", storageKey: "jazz-inspector-show-raw-data", children: /* @__PURE__ */ jsxs14(Card, { style: { position: "relative" }, children: [
|
|
2037
|
+
/* @__PURE__ */ jsx27(CardHeader, { children: /* @__PURE__ */ jsx27(CopyButton, { data }) }),
|
|
2038
|
+
/* @__PURE__ */ jsx27(CardBody, { children: /* @__PURE__ */ jsx27(ValueRenderer, { json: data }) })
|
|
1699
2039
|
] }) });
|
|
1700
2040
|
}
|
|
1701
2041
|
|
|
1702
2042
|
// src/inspector/viewer/account-view.tsx
|
|
1703
|
-
import { Fragment as Fragment6, jsx as
|
|
2043
|
+
import { Fragment as Fragment6, jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1704
2044
|
function AccountView({
|
|
1705
2045
|
data,
|
|
1706
2046
|
onNavigate,
|
|
@@ -1712,25 +2052,25 @@ function AccountView({
|
|
|
1712
2052
|
delete readableData[key];
|
|
1713
2053
|
}
|
|
1714
2054
|
}
|
|
1715
|
-
return /* @__PURE__ */
|
|
1716
|
-
/* @__PURE__ */
|
|
1717
|
-
/* @__PURE__ */
|
|
2055
|
+
return /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
2056
|
+
/* @__PURE__ */ jsx28(GridView, { data: readableData, onNavigate, node }),
|
|
2057
|
+
/* @__PURE__ */ jsx28(RawDataCard, { data })
|
|
1718
2058
|
] });
|
|
1719
2059
|
}
|
|
1720
2060
|
|
|
1721
2061
|
// src/inspector/viewer/co-plain-text-view.tsx
|
|
1722
|
-
import { Fragment as Fragment7, jsx as
|
|
2062
|
+
import { Fragment as Fragment7, jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1723
2063
|
function CoPlainTextView({ data }) {
|
|
1724
2064
|
if (!data) return;
|
|
1725
|
-
return /* @__PURE__ */
|
|
1726
|
-
/* @__PURE__ */
|
|
1727
|
-
/* @__PURE__ */
|
|
2065
|
+
return /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
2066
|
+
/* @__PURE__ */ jsx29("p", { children: Object.values(data).join("") }),
|
|
2067
|
+
/* @__PURE__ */ jsx29(RawDataCard, { data })
|
|
1728
2068
|
] });
|
|
1729
2069
|
}
|
|
1730
2070
|
|
|
1731
2071
|
// src/inspector/viewer/group-view.tsx
|
|
1732
|
-
import { useState as
|
|
1733
|
-
import { Fragment as Fragment8, jsx as
|
|
2072
|
+
import { useState as useState10 } from "react";
|
|
2073
|
+
import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1734
2074
|
function partitionMembers(data) {
|
|
1735
2075
|
const everyone = Object.entries(data).filter(([key]) => key === "everyone").map(([key, value]) => ({
|
|
1736
2076
|
id: key,
|
|
@@ -1758,7 +2098,7 @@ function GroupView({
|
|
|
1758
2098
|
onNavigate,
|
|
1759
2099
|
node
|
|
1760
2100
|
}) {
|
|
1761
|
-
const [addMemberType, setAddMemberType] =
|
|
2101
|
+
const [addMemberType, setAddMemberType] = useState10(null);
|
|
1762
2102
|
const { everyone, members, parentGroups, childGroups } = partitionMembers(
|
|
1763
2103
|
data
|
|
1764
2104
|
);
|
|
@@ -1837,28 +2177,28 @@ function GroupView({
|
|
|
1837
2177
|
alert(`Failed to add ${addMemberType}: ${error.message}`);
|
|
1838
2178
|
}
|
|
1839
2179
|
};
|
|
1840
|
-
return /* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */
|
|
1842
|
-
/* @__PURE__ */
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
/* @__PURE__ */
|
|
1845
|
-
/* @__PURE__ */
|
|
2180
|
+
return /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
2181
|
+
/* @__PURE__ */ jsxs17(Table, { children: [
|
|
2182
|
+
/* @__PURE__ */ jsx30(TableHead, { children: /* @__PURE__ */ jsxs17(TableRow, { children: [
|
|
2183
|
+
/* @__PURE__ */ jsx30(TableHeader, { children: "Member" }),
|
|
2184
|
+
/* @__PURE__ */ jsx30(TableHeader, { children: "Permission" }),
|
|
2185
|
+
/* @__PURE__ */ jsx30(TableHeader, {})
|
|
1846
2186
|
] }) }),
|
|
1847
|
-
/* @__PURE__ */
|
|
1848
|
-
everyone.map((member) => /* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
1850
|
-
/* @__PURE__ */
|
|
1851
|
-
/* @__PURE__ */
|
|
2187
|
+
/* @__PURE__ */ jsxs17(TableBody, { children: [
|
|
2188
|
+
everyone.map((member) => /* @__PURE__ */ jsxs17(TableRow, { children: [
|
|
2189
|
+
/* @__PURE__ */ jsx30(TableCell, { children: member.id }),
|
|
2190
|
+
/* @__PURE__ */ jsx30(TableCell, { children: member.role }),
|
|
2191
|
+
/* @__PURE__ */ jsx30(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ jsx30(
|
|
1852
2192
|
Button,
|
|
1853
2193
|
{
|
|
1854
2194
|
variant: "secondary",
|
|
1855
2195
|
onClick: () => onRemoveMember(member.id),
|
|
1856
|
-
children: /* @__PURE__ */
|
|
2196
|
+
children: /* @__PURE__ */ jsx30(Icon, { name: "delete" })
|
|
1857
2197
|
}
|
|
1858
2198
|
) })
|
|
1859
2199
|
] }, member.id)),
|
|
1860
|
-
members.map((member) => /* @__PURE__ */
|
|
1861
|
-
/* @__PURE__ */
|
|
2200
|
+
members.map((member) => /* @__PURE__ */ jsxs17(TableRow, { children: [
|
|
2201
|
+
/* @__PURE__ */ jsx30(TableCell, { children: /* @__PURE__ */ jsx30(
|
|
1862
2202
|
AccountOrGroupText,
|
|
1863
2203
|
{
|
|
1864
2204
|
coId: member.id,
|
|
@@ -1869,18 +2209,18 @@ function GroupView({
|
|
|
1869
2209
|
}
|
|
1870
2210
|
}
|
|
1871
2211
|
) }),
|
|
1872
|
-
/* @__PURE__ */
|
|
1873
|
-
/* @__PURE__ */
|
|
2212
|
+
/* @__PURE__ */ jsx30(TableCell, { children: member.role }),
|
|
2213
|
+
/* @__PURE__ */ jsx30(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ jsx30(
|
|
1874
2214
|
Button,
|
|
1875
2215
|
{
|
|
1876
2216
|
variant: "secondary",
|
|
1877
2217
|
onClick: () => onRemoveMember(member.id),
|
|
1878
|
-
children: /* @__PURE__ */
|
|
2218
|
+
children: /* @__PURE__ */ jsx30(Icon, { name: "delete" })
|
|
1879
2219
|
}
|
|
1880
2220
|
) })
|
|
1881
2221
|
] }, member.id)),
|
|
1882
|
-
parentGroups.map((group) => /* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
2222
|
+
parentGroups.map((group) => /* @__PURE__ */ jsxs17(TableRow, { children: [
|
|
2223
|
+
/* @__PURE__ */ jsx30(TableCell, { children: /* @__PURE__ */ jsx30(
|
|
1884
2224
|
AccountOrGroupText,
|
|
1885
2225
|
{
|
|
1886
2226
|
coId: group.id,
|
|
@@ -1891,19 +2231,19 @@ function GroupView({
|
|
|
1891
2231
|
}
|
|
1892
2232
|
}
|
|
1893
2233
|
) }),
|
|
1894
|
-
/* @__PURE__ */
|
|
1895
|
-
/* @__PURE__ */
|
|
2234
|
+
/* @__PURE__ */ jsx30(TableCell, { children: group.role }),
|
|
2235
|
+
/* @__PURE__ */ jsx30(TableCell, { children: group.role !== "revoked" && /* @__PURE__ */ jsx30(
|
|
1896
2236
|
Button,
|
|
1897
2237
|
{
|
|
1898
2238
|
variant: "secondary",
|
|
1899
2239
|
onClick: () => onRemoveGroup(group.id),
|
|
1900
|
-
children: /* @__PURE__ */
|
|
2240
|
+
children: /* @__PURE__ */ jsx30(Icon, { name: "delete" })
|
|
1901
2241
|
}
|
|
1902
2242
|
) })
|
|
1903
2243
|
] }, group.id))
|
|
1904
2244
|
] })
|
|
1905
2245
|
] }),
|
|
1906
|
-
/* @__PURE__ */
|
|
2246
|
+
/* @__PURE__ */ jsxs17(
|
|
1907
2247
|
"div",
|
|
1908
2248
|
{
|
|
1909
2249
|
style: {
|
|
@@ -1913,14 +2253,14 @@ function GroupView({
|
|
|
1913
2253
|
marginTop: "1rem"
|
|
1914
2254
|
},
|
|
1915
2255
|
children: [
|
|
1916
|
-
/* @__PURE__ */
|
|
1917
|
-
/* @__PURE__ */
|
|
2256
|
+
/* @__PURE__ */ jsx30(Button, { variant: "primary", onClick: () => setAddMemberType("account"), children: "Add Account" }),
|
|
2257
|
+
/* @__PURE__ */ jsx30(Button, { variant: "primary", onClick: () => setAddMemberType("group"), children: "Add Group" })
|
|
1918
2258
|
]
|
|
1919
2259
|
}
|
|
1920
2260
|
),
|
|
1921
|
-
childGroups.length > 0 && /* @__PURE__ */
|
|
1922
|
-
/* @__PURE__ */
|
|
1923
|
-
/* @__PURE__ */
|
|
2261
|
+
childGroups.length > 0 && /* @__PURE__ */ jsxs17(Table, { children: [
|
|
2262
|
+
/* @__PURE__ */ jsx30(TableHead, { children: /* @__PURE__ */ jsx30(TableRow, { children: /* @__PURE__ */ jsx30(TableHeader, { children: "Member of" }) }) }),
|
|
2263
|
+
/* @__PURE__ */ jsx30(TableBody, { children: childGroups.map((group) => /* @__PURE__ */ jsx30(TableRow, { children: /* @__PURE__ */ jsx30(TableCell, { children: /* @__PURE__ */ jsx30(
|
|
1924
2264
|
AccountOrGroupText,
|
|
1925
2265
|
{
|
|
1926
2266
|
coId: group.id,
|
|
@@ -1932,20 +2272,20 @@ function GroupView({
|
|
|
1932
2272
|
}
|
|
1933
2273
|
) }) }, group.id)) })
|
|
1934
2274
|
] }),
|
|
1935
|
-
/* @__PURE__ */
|
|
1936
|
-
/* @__PURE__ */
|
|
2275
|
+
/* @__PURE__ */ jsx30(RawDataCard, { data }),
|
|
2276
|
+
/* @__PURE__ */ jsx30(
|
|
1937
2277
|
Modal,
|
|
1938
2278
|
{
|
|
1939
2279
|
isOpen: addMemberType !== null,
|
|
1940
2280
|
onClose: () => setAddMemberType(null),
|
|
1941
2281
|
heading: addMemberType === "account" ? "Add Account" : "Add Group",
|
|
1942
2282
|
showButtons: false,
|
|
1943
|
-
children: /* @__PURE__ */
|
|
2283
|
+
children: /* @__PURE__ */ jsx30("form", { onSubmit: handleAddMemberSubmit, children: /* @__PURE__ */ jsxs17(
|
|
1944
2284
|
"div",
|
|
1945
2285
|
{
|
|
1946
2286
|
style: { display: "flex", flexDirection: "column", gap: "1rem" },
|
|
1947
2287
|
children: [
|
|
1948
|
-
/* @__PURE__ */
|
|
2288
|
+
/* @__PURE__ */ jsx30(
|
|
1949
2289
|
Input,
|
|
1950
2290
|
{
|
|
1951
2291
|
name: "memberId",
|
|
@@ -1954,13 +2294,13 @@ function GroupView({
|
|
|
1954
2294
|
required: true
|
|
1955
2295
|
}
|
|
1956
2296
|
),
|
|
1957
|
-
/* @__PURE__ */
|
|
1958
|
-
/* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */
|
|
1960
|
-
/* @__PURE__ */
|
|
1961
|
-
addMemberType === "account" ? /* @__PURE__ */
|
|
2297
|
+
/* @__PURE__ */ jsxs17(Select, { name: "role", label: "Role", children: [
|
|
2298
|
+
/* @__PURE__ */ jsx30("option", { value: "reader", children: "Reader" }),
|
|
2299
|
+
/* @__PURE__ */ jsx30("option", { value: "writer", children: "Writer" }),
|
|
2300
|
+
/* @__PURE__ */ jsx30("option", { value: "admin", children: "Admin" }),
|
|
2301
|
+
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
2302
|
] }),
|
|
1963
|
-
/* @__PURE__ */
|
|
2303
|
+
/* @__PURE__ */ jsxs17(
|
|
1964
2304
|
"div",
|
|
1965
2305
|
{
|
|
1966
2306
|
style: {
|
|
@@ -1970,7 +2310,7 @@ function GroupView({
|
|
|
1970
2310
|
marginTop: "0.5rem"
|
|
1971
2311
|
},
|
|
1972
2312
|
children: [
|
|
1973
|
-
/* @__PURE__ */
|
|
2313
|
+
/* @__PURE__ */ jsx30(
|
|
1974
2314
|
Button,
|
|
1975
2315
|
{
|
|
1976
2316
|
type: "button",
|
|
@@ -1979,7 +2319,7 @@ function GroupView({
|
|
|
1979
2319
|
children: "Cancel"
|
|
1980
2320
|
}
|
|
1981
2321
|
),
|
|
1982
|
-
/* @__PURE__ */
|
|
2322
|
+
/* @__PURE__ */ jsx30(Button, { type: "submit", variant: "primary", children: "Add" })
|
|
1983
2323
|
]
|
|
1984
2324
|
}
|
|
1985
2325
|
)
|
|
@@ -1992,7 +2332,7 @@ function GroupView({
|
|
|
1992
2332
|
}
|
|
1993
2333
|
|
|
1994
2334
|
// src/inspector/viewer/role-display.tsx
|
|
1995
|
-
import { jsxs as
|
|
2335
|
+
import { jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1996
2336
|
function RoleDisplay({
|
|
1997
2337
|
node,
|
|
1998
2338
|
value
|
|
@@ -2011,24 +2351,24 @@ function RoleDisplay({
|
|
|
2011
2351
|
} else {
|
|
2012
2352
|
role = "unauthorized";
|
|
2013
2353
|
}
|
|
2014
|
-
return /* @__PURE__ */
|
|
2354
|
+
return /* @__PURE__ */ jsxs18(Text, { children: [
|
|
2015
2355
|
"Role: ",
|
|
2016
2356
|
role
|
|
2017
2357
|
] });
|
|
2018
2358
|
}
|
|
2019
2359
|
|
|
2020
2360
|
// 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 =
|
|
2361
|
+
import { styled as styled18 } from "goober";
|
|
2362
|
+
import { useMemo as useMemo2, useState as useState11 } from "react";
|
|
2363
|
+
import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2364
|
+
var PaginationContainer = styled18("div")`
|
|
2025
2365
|
padding: 1rem 0;
|
|
2026
2366
|
display: flex;
|
|
2027
2367
|
align-items: center;
|
|
2028
2368
|
justify-content: space-between;
|
|
2029
2369
|
gap: 0.5rem;
|
|
2030
2370
|
`;
|
|
2031
|
-
var RedTooltip =
|
|
2371
|
+
var RedTooltip = styled18("span")`
|
|
2032
2372
|
position:relative; /* making the .tooltip span a container for the tooltip text */
|
|
2033
2373
|
border-bottom:1px dashed #000; /* little indicater to indicate it's hoverable */
|
|
2034
2374
|
|
|
@@ -2065,7 +2405,7 @@ function CoValuesTableView({
|
|
|
2065
2405
|
onNavigate,
|
|
2066
2406
|
onRemove
|
|
2067
2407
|
}) {
|
|
2068
|
-
const [visibleRowsCount, setVisibleRowsCount] =
|
|
2408
|
+
const [visibleRowsCount, setVisibleRowsCount] = useState11(10);
|
|
2069
2409
|
const [coIdArray, visibleRows] = useMemo2(() => {
|
|
2070
2410
|
const coIdArray2 = Array.isArray(data) ? data : Object.values(data).every((k) => typeof k === "string" && isCoId(k)) ? Object.values(data).map((k) => k) : [];
|
|
2071
2411
|
const visibleRows2 = coIdArray2.slice(0, visibleRowsCount);
|
|
@@ -2074,10 +2414,10 @@ function CoValuesTableView({
|
|
|
2074
2414
|
const resolvedRows = useResolvedCoValues(visibleRows, node);
|
|
2075
2415
|
const hasMore = visibleRowsCount < coIdArray.length;
|
|
2076
2416
|
if (!coIdArray.length) {
|
|
2077
|
-
return /* @__PURE__ */
|
|
2417
|
+
return /* @__PURE__ */ jsx31("div", { children: "No data to display" });
|
|
2078
2418
|
}
|
|
2079
2419
|
if (resolvedRows.length === 0) {
|
|
2080
|
-
return /* @__PURE__ */
|
|
2420
|
+
return /* @__PURE__ */ jsx31("div", { children: "Loading..." });
|
|
2081
2421
|
}
|
|
2082
2422
|
const keys = Array.from(
|
|
2083
2423
|
new Set(
|
|
@@ -2087,15 +2427,15 @@ function CoValuesTableView({
|
|
|
2087
2427
|
const loadMore = () => {
|
|
2088
2428
|
setVisibleRowsCount((prevVisibleRows) => prevVisibleRows + 10);
|
|
2089
2429
|
};
|
|
2090
|
-
return /* @__PURE__ */
|
|
2091
|
-
/* @__PURE__ */
|
|
2092
|
-
/* @__PURE__ */
|
|
2093
|
-
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */
|
|
2094
|
-
onRemove && /* @__PURE__ */
|
|
2430
|
+
return /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
2431
|
+
/* @__PURE__ */ jsxs19(Table, { children: [
|
|
2432
|
+
/* @__PURE__ */ jsx31(TableHead, { children: /* @__PURE__ */ jsxs19(TableRow, { children: [
|
|
2433
|
+
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */ jsx31(TableHeader, { children: key }, key)),
|
|
2434
|
+
onRemove && /* @__PURE__ */ jsx31(TableHeader, {})
|
|
2095
2435
|
] }) }),
|
|
2096
|
-
/* @__PURE__ */
|
|
2097
|
-
/* @__PURE__ */
|
|
2098
|
-
/* @__PURE__ */
|
|
2436
|
+
/* @__PURE__ */ jsx31(TableBody, { children: resolvedRows.slice(0, visibleRowsCount).map((item, index) => /* @__PURE__ */ jsxs19(TableRow, { children: [
|
|
2437
|
+
/* @__PURE__ */ jsx31(TableCell, { children: /* @__PURE__ */ jsx31(Text, { mono: true, children: item.snapshot === "unavailable" ? /* @__PURE__ */ jsxs19(RedTooltip, { "data-text": "Unavailable", children: [
|
|
2438
|
+
/* @__PURE__ */ jsx31(
|
|
2099
2439
|
Icon,
|
|
2100
2440
|
{
|
|
2101
2441
|
name: "caution",
|
|
@@ -2108,7 +2448,7 @@ function CoValuesTableView({
|
|
|
2108
2448
|
),
|
|
2109
2449
|
visibleRows[index]
|
|
2110
2450
|
] }) : visibleRows[index] }) }),
|
|
2111
|
-
keys.map((key) => /* @__PURE__ */
|
|
2451
|
+
keys.map((key) => /* @__PURE__ */ jsx31(TableCell, { children: item.snapshot !== "unavailable" && /* @__PURE__ */ jsx31(
|
|
2112
2452
|
ValueRenderer,
|
|
2113
2453
|
{
|
|
2114
2454
|
json: item.snapshot[key],
|
|
@@ -2129,7 +2469,7 @@ function CoValuesTableView({
|
|
|
2129
2469
|
}
|
|
2130
2470
|
}
|
|
2131
2471
|
) }, key)),
|
|
2132
|
-
/* @__PURE__ */
|
|
2472
|
+
/* @__PURE__ */ jsx31(TableCell, { children: /* @__PURE__ */ jsx31(
|
|
2133
2473
|
Button,
|
|
2134
2474
|
{
|
|
2135
2475
|
variant: "secondary",
|
|
@@ -2142,18 +2482,18 @@ function CoValuesTableView({
|
|
|
2142
2482
|
children: "View"
|
|
2143
2483
|
}
|
|
2144
2484
|
) }),
|
|
2145
|
-
onRemove && /* @__PURE__ */
|
|
2485
|
+
onRemove && /* @__PURE__ */ jsx31(TableCell, { children: /* @__PURE__ */ jsx31(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
2146
2486
|
] }, index)) })
|
|
2147
2487
|
] }),
|
|
2148
|
-
/* @__PURE__ */
|
|
2149
|
-
/* @__PURE__ */
|
|
2488
|
+
/* @__PURE__ */ jsxs19(PaginationContainer, { children: [
|
|
2489
|
+
/* @__PURE__ */ jsxs19(Text, { muted: true, small: true, children: [
|
|
2150
2490
|
"Showing ",
|
|
2151
2491
|
Math.min(visibleRowsCount, coIdArray.length),
|
|
2152
2492
|
" of",
|
|
2153
2493
|
" ",
|
|
2154
2494
|
coIdArray.length
|
|
2155
2495
|
] }),
|
|
2156
|
-
hasMore && /* @__PURE__ */
|
|
2496
|
+
hasMore && /* @__PURE__ */ jsx31(Button, { variant: "secondary", onClick: loadMore, children: "Load more" })
|
|
2157
2497
|
] })
|
|
2158
2498
|
] });
|
|
2159
2499
|
}
|
|
@@ -2167,7 +2507,7 @@ function TableView({
|
|
|
2167
2507
|
return Array.isArray(data) && data.every((k) => isCoId(k));
|
|
2168
2508
|
}, [data]);
|
|
2169
2509
|
if (isListOfCoValues) {
|
|
2170
|
-
return /* @__PURE__ */
|
|
2510
|
+
return /* @__PURE__ */ jsx31(
|
|
2171
2511
|
CoValuesTableView,
|
|
2172
2512
|
{
|
|
2173
2513
|
data,
|
|
@@ -2177,24 +2517,67 @@ function TableView({
|
|
|
2177
2517
|
}
|
|
2178
2518
|
);
|
|
2179
2519
|
}
|
|
2180
|
-
return /* @__PURE__ */
|
|
2181
|
-
/* @__PURE__ */
|
|
2182
|
-
/* @__PURE__ */
|
|
2183
|
-
/* @__PURE__ */
|
|
2184
|
-
onRemove && /* @__PURE__ */
|
|
2520
|
+
return /* @__PURE__ */ jsxs19(Table, { children: [
|
|
2521
|
+
/* @__PURE__ */ jsx31(TableHead, { children: /* @__PURE__ */ jsxs19(TableRow, { children: [
|
|
2522
|
+
/* @__PURE__ */ jsx31(TableHeader, { style: { width: "5rem" }, children: "Index" }),
|
|
2523
|
+
/* @__PURE__ */ jsx31(TableHeader, { children: "Value" }),
|
|
2524
|
+
onRemove && /* @__PURE__ */ jsx31(TableHeader, { children: "Action" })
|
|
2185
2525
|
] }) }),
|
|
2186
|
-
/* @__PURE__ */
|
|
2187
|
-
/* @__PURE__ */
|
|
2188
|
-
/* @__PURE__ */
|
|
2189
|
-
onRemove && /* @__PURE__ */
|
|
2526
|
+
/* @__PURE__ */ jsx31(TableBody, { children: Array.isArray(data) && data?.map((value, index) => /* @__PURE__ */ jsxs19(TableRow, { children: [
|
|
2527
|
+
/* @__PURE__ */ jsx31(TableCell, { children: /* @__PURE__ */ jsx31(Text, { mono: true, children: index }) }),
|
|
2528
|
+
/* @__PURE__ */ jsx31(TableCell, { children: /* @__PURE__ */ jsx31(ValueRenderer, { json: value }) }),
|
|
2529
|
+
onRemove && /* @__PURE__ */ jsx31(TableCell, { children: /* @__PURE__ */ jsx31(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
2190
2530
|
] }, index)) })
|
|
2191
2531
|
] });
|
|
2192
2532
|
}
|
|
2193
2533
|
|
|
2194
2534
|
// src/inspector/viewer/history-view.tsx
|
|
2195
2535
|
import { useMemo as useMemo3 } from "react";
|
|
2196
|
-
import { styled as
|
|
2197
|
-
|
|
2536
|
+
import { styled as styled19 } from "goober";
|
|
2537
|
+
|
|
2538
|
+
// src/inspector/utils/transactions-changes.ts
|
|
2539
|
+
var isGroupExtension = (change) => {
|
|
2540
|
+
return change?.op === "set" && change?.value === "extend";
|
|
2541
|
+
};
|
|
2542
|
+
var isGroupExtendRevocation = (change) => {
|
|
2543
|
+
return change?.op === "set" && change?.value === "revoked";
|
|
2544
|
+
};
|
|
2545
|
+
var isGroupPromotion = (change) => {
|
|
2546
|
+
return change?.op === "set" && change?.key.startsWith("parent_co_");
|
|
2547
|
+
};
|
|
2548
|
+
var isUserPromotion = (change) => {
|
|
2549
|
+
return change?.op === "set" && (isCoId(change?.key) || change?.key === "everyone");
|
|
2550
|
+
};
|
|
2551
|
+
var isKeyRevelation = (change) => {
|
|
2552
|
+
return change?.op === "set" && change?.key.includes("_for_");
|
|
2553
|
+
};
|
|
2554
|
+
var isPropertySet = (change) => {
|
|
2555
|
+
return change?.op === "set" && "key" in change && "value" in change;
|
|
2556
|
+
};
|
|
2557
|
+
var isPropertyDeletion = (change) => {
|
|
2558
|
+
return change?.op === "del" && "key" in change;
|
|
2559
|
+
};
|
|
2560
|
+
var isItemAppend = (change) => {
|
|
2561
|
+
return change?.op === "app" && "after" in change && "value" in change;
|
|
2562
|
+
};
|
|
2563
|
+
var isItemPrepend = (change) => {
|
|
2564
|
+
return change?.op === "pre" && "before" in change && "value" in change;
|
|
2565
|
+
};
|
|
2566
|
+
var isItemDeletion = (change) => {
|
|
2567
|
+
return change?.op === "del" && "insertion" in change;
|
|
2568
|
+
};
|
|
2569
|
+
var isStreamStart = (change) => {
|
|
2570
|
+
return change?.type === "start" && "mimeType" in change;
|
|
2571
|
+
};
|
|
2572
|
+
var isStreamChunk = (change) => {
|
|
2573
|
+
return change?.type === "chunk" && "chunk" in change;
|
|
2574
|
+
};
|
|
2575
|
+
var isStreamEnd = (change) => {
|
|
2576
|
+
return change?.type === "end";
|
|
2577
|
+
};
|
|
2578
|
+
|
|
2579
|
+
// src/inspector/viewer/history-view.tsx
|
|
2580
|
+
import { Fragment as Fragment10, jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2198
2581
|
function HistoryView({
|
|
2199
2582
|
coValue,
|
|
2200
2583
|
node
|
|
@@ -2207,8 +2590,8 @@ function HistoryView({
|
|
|
2207
2590
|
{
|
|
2208
2591
|
id: "author",
|
|
2209
2592
|
header: "Author",
|
|
2210
|
-
accessor: (row) => /* @__PURE__ */
|
|
2211
|
-
row.isValid || /* @__PURE__ */
|
|
2593
|
+
accessor: (row) => /* @__PURE__ */ jsxs20(Fragment10, { children: [
|
|
2594
|
+
row.isValid || /* @__PURE__ */ jsx32(RedTooltip2, { "data-text": "This transaction is invalid and is not used", children: /* @__PURE__ */ jsx32(
|
|
2212
2595
|
Icon,
|
|
2213
2596
|
{
|
|
2214
2597
|
name: "caution",
|
|
@@ -2221,7 +2604,7 @@ function HistoryView({
|
|
|
2221
2604
|
}
|
|
2222
2605
|
}
|
|
2223
2606
|
) }),
|
|
2224
|
-
row.author.startsWith("co_") ? /* @__PURE__ */
|
|
2607
|
+
row.author.startsWith("co_") ? /* @__PURE__ */ jsx32(
|
|
2225
2608
|
AccountOrGroupText,
|
|
2226
2609
|
{
|
|
2227
2610
|
coId: row.author,
|
|
@@ -2240,9 +2623,9 @@ function HistoryView({
|
|
|
2240
2623
|
header: "Action",
|
|
2241
2624
|
accessor: (row) => {
|
|
2242
2625
|
if (row.isValid) return row.action;
|
|
2243
|
-
return /* @__PURE__ */
|
|
2626
|
+
return /* @__PURE__ */ jsxs20(Fragment10, { children: [
|
|
2244
2627
|
row.action,
|
|
2245
|
-
/* @__PURE__ */
|
|
2628
|
+
/* @__PURE__ */ jsxs20("span", { style: { color: "red", display: "block" }, children: [
|
|
2246
2629
|
"Invalid transaction: ",
|
|
2247
2630
|
row.validationErrorMessage
|
|
2248
2631
|
] })
|
|
@@ -2261,7 +2644,7 @@ function HistoryView({
|
|
|
2261
2644
|
sortFn: (a, b) => a.timestamp.getTime() - b.timestamp.getTime()
|
|
2262
2645
|
}
|
|
2263
2646
|
];
|
|
2264
|
-
return /* @__PURE__ */
|
|
2647
|
+
return /* @__PURE__ */ jsx32(Accordion, { title: "CoValue history", storageKey: "jazz-inspector-show-history", children: /* @__PURE__ */ jsx32(
|
|
2265
2648
|
DataTable,
|
|
2266
2649
|
{
|
|
2267
2650
|
columns,
|
|
@@ -2277,7 +2660,9 @@ function getTransactionChanges(tx, coValue) {
|
|
|
2277
2660
|
if (tx.isValid === false && tx.tx.privacy === "private") {
|
|
2278
2661
|
const readKey = coValue.core.getReadKey(tx.tx.keyUsed);
|
|
2279
2662
|
if (!readKey) {
|
|
2280
|
-
|
|
2663
|
+
return [
|
|
2664
|
+
`Unable to decrypt transaction: read key ${tx.tx.keyUsed} not found.`
|
|
2665
|
+
];
|
|
2281
2666
|
}
|
|
2282
2667
|
return coValue.core.verified.decryptTransaction(
|
|
2283
2668
|
tx.txID.sessionID,
|
|
@@ -2372,46 +2757,7 @@ var findListChange = (opId, coValue) => {
|
|
|
2372
2757
|
(tx) => tx.txID.sessionID === opId.sessionID && tx.txID.txIndex === opId.txIndex
|
|
2373
2758
|
)?.changes?.[opId.changeIdx];
|
|
2374
2759
|
};
|
|
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")`
|
|
2760
|
+
var RedTooltip2 = styled19("span")`
|
|
2415
2761
|
position:relative; /* making the .tooltip span a container for the tooltip text */
|
|
2416
2762
|
border-bottom:1px dashed #000; /* little indicater to indicate it's hoverable */
|
|
2417
2763
|
|
|
@@ -2443,12 +2789,325 @@ var RedTooltip2 = styled17("span")`
|
|
|
2443
2789
|
}
|
|
2444
2790
|
`;
|
|
2445
2791
|
|
|
2792
|
+
// src/inspector/viewer/co-map-view.tsx
|
|
2793
|
+
import { useState as useState12, useMemo as useMemo4 } from "react";
|
|
2794
|
+
import { styled as styled20 } from "goober";
|
|
2795
|
+
|
|
2796
|
+
// src/inspector/utils/history.ts
|
|
2797
|
+
function restoreCoMapToTimestamp(coValue, timestamp, removeUnknownProperties) {
|
|
2798
|
+
const myRole = coValue.group.myRole();
|
|
2799
|
+
if (myRole === void 0 || !["admin", "manager", "writer", "writerOnly"].includes(myRole)) {
|
|
2800
|
+
return;
|
|
2801
|
+
}
|
|
2802
|
+
const newCoValue = coValue.atTime(timestamp).toJSON();
|
|
2803
|
+
const oldCoValue = coValue.toJSON();
|
|
2804
|
+
if (newCoValue === null) return;
|
|
2805
|
+
let changes = [];
|
|
2806
|
+
if (removeUnknownProperties) {
|
|
2807
|
+
for (const key in oldCoValue) {
|
|
2808
|
+
if (!(key in newCoValue)) {
|
|
2809
|
+
changes.push({
|
|
2810
|
+
op: "del",
|
|
2811
|
+
key
|
|
2812
|
+
});
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
for (const key in newCoValue) {
|
|
2817
|
+
if (newCoValue[key] !== oldCoValue[key]) {
|
|
2818
|
+
changes.push({
|
|
2819
|
+
op: "set",
|
|
2820
|
+
key,
|
|
2821
|
+
value: newCoValue[key]
|
|
2822
|
+
});
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
if (changes.length > 0) {
|
|
2826
|
+
coValue.core.makeTransaction(changes, "private");
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
|
|
2830
|
+
// src/inspector/viewer/co-map-view.tsx
|
|
2831
|
+
import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2832
|
+
function CoMapView({
|
|
2833
|
+
coValue,
|
|
2834
|
+
data,
|
|
2835
|
+
node,
|
|
2836
|
+
onNavigate
|
|
2837
|
+
}) {
|
|
2838
|
+
return /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
2839
|
+
/* @__PURE__ */ jsx33(
|
|
2840
|
+
GridView,
|
|
2841
|
+
{
|
|
2842
|
+
data,
|
|
2843
|
+
onNavigate,
|
|
2844
|
+
node,
|
|
2845
|
+
coValue
|
|
2846
|
+
}
|
|
2847
|
+
),
|
|
2848
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
2849
|
+
/* @__PURE__ */ jsx33(
|
|
2850
|
+
AddPropertyModal,
|
|
2851
|
+
{
|
|
2852
|
+
disabled: !isWriter(coValue.group.myRole()),
|
|
2853
|
+
coValue,
|
|
2854
|
+
node
|
|
2855
|
+
}
|
|
2856
|
+
),
|
|
2857
|
+
" ",
|
|
2858
|
+
/* @__PURE__ */ jsx33(RestoreSnapshotModal, { coValue })
|
|
2859
|
+
] })
|
|
2860
|
+
] });
|
|
2861
|
+
}
|
|
2862
|
+
function AddPropertyModal({
|
|
2863
|
+
coValue,
|
|
2864
|
+
node,
|
|
2865
|
+
disabled
|
|
2866
|
+
}) {
|
|
2867
|
+
const [isAddPropertyModalOpen, setIsAddPropertyModalOpen] = useState12(false);
|
|
2868
|
+
const [propertyName, setPropertyName] = useState12("");
|
|
2869
|
+
const openAddPropertyModal = () => {
|
|
2870
|
+
setIsAddPropertyModalOpen(true);
|
|
2871
|
+
setPropertyName("");
|
|
2872
|
+
};
|
|
2873
|
+
const handleCancel = () => {
|
|
2874
|
+
setIsAddPropertyModalOpen(false);
|
|
2875
|
+
setPropertyName("");
|
|
2876
|
+
};
|
|
2877
|
+
return /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
2878
|
+
/* @__PURE__ */ jsx33(
|
|
2879
|
+
Button,
|
|
2880
|
+
{
|
|
2881
|
+
title: "Add Property",
|
|
2882
|
+
variant: "secondary",
|
|
2883
|
+
disabled,
|
|
2884
|
+
onClick: openAddPropertyModal,
|
|
2885
|
+
children: /* @__PURE__ */ jsx33(Icon, { name: "add" })
|
|
2886
|
+
}
|
|
2887
|
+
),
|
|
2888
|
+
/* @__PURE__ */ jsxs21(
|
|
2889
|
+
Modal,
|
|
2890
|
+
{
|
|
2891
|
+
isOpen: isAddPropertyModalOpen,
|
|
2892
|
+
onClose: handleCancel,
|
|
2893
|
+
heading: "Add Property",
|
|
2894
|
+
showButtons: false,
|
|
2895
|
+
children: [
|
|
2896
|
+
/* @__PURE__ */ jsx33(
|
|
2897
|
+
Input,
|
|
2898
|
+
{
|
|
2899
|
+
label: "Property Name",
|
|
2900
|
+
value: propertyName,
|
|
2901
|
+
onChange: (e) => setPropertyName(e.target.value),
|
|
2902
|
+
placeholder: "Enter property name"
|
|
2903
|
+
}
|
|
2904
|
+
),
|
|
2905
|
+
propertyName && /* @__PURE__ */ jsx33(EditorContainer, { children: /* @__PURE__ */ jsx33(
|
|
2906
|
+
CoValueEditor,
|
|
2907
|
+
{
|
|
2908
|
+
node,
|
|
2909
|
+
property: propertyName,
|
|
2910
|
+
value: void 0,
|
|
2911
|
+
coValue,
|
|
2912
|
+
onCancel: handleCancel
|
|
2913
|
+
}
|
|
2914
|
+
) })
|
|
2915
|
+
]
|
|
2916
|
+
}
|
|
2917
|
+
)
|
|
2918
|
+
] });
|
|
2919
|
+
}
|
|
2920
|
+
function RestoreSnapshotModal({ coValue }) {
|
|
2921
|
+
const [isRestoreModalOpen, setIsRestoreModalOpen] = useState12(false);
|
|
2922
|
+
const [selectedIndex, setSelectedIndex] = useState12(-1);
|
|
2923
|
+
const [removeUnknownProperties, setRemoveUnknownProperties] = useState12(false);
|
|
2924
|
+
const timestamps = useMemo4(
|
|
2925
|
+
() => coValue.core.verifiedTransactions.map((tx) => tx.madeAt),
|
|
2926
|
+
[coValue.core.verifiedTransactions.length]
|
|
2927
|
+
);
|
|
2928
|
+
const coMapAtSelectedIndex = useMemo4(() => {
|
|
2929
|
+
if (selectedIndex === -1) return null;
|
|
2930
|
+
return coValue.atTime(timestamps[selectedIndex]).toJSON();
|
|
2931
|
+
}, [coValue, timestamps, selectedIndex]);
|
|
2932
|
+
const openRestoreModal = () => {
|
|
2933
|
+
setIsRestoreModalOpen(true);
|
|
2934
|
+
setSelectedIndex(timestamps.length - 1);
|
|
2935
|
+
};
|
|
2936
|
+
const handleRestore = () => {
|
|
2937
|
+
if (timestamps.length < 2) return;
|
|
2938
|
+
if (timestamps.length === 0) return;
|
|
2939
|
+
const selectedTimestamp = timestamps[selectedIndex];
|
|
2940
|
+
if (selectedTimestamp === void 0) return;
|
|
2941
|
+
restoreCoMapToTimestamp(
|
|
2942
|
+
coValue,
|
|
2943
|
+
selectedTimestamp,
|
|
2944
|
+
removeUnknownProperties
|
|
2945
|
+
);
|
|
2946
|
+
setIsRestoreModalOpen(false);
|
|
2947
|
+
};
|
|
2948
|
+
const handleClose = () => {
|
|
2949
|
+
setIsRestoreModalOpen(false);
|
|
2950
|
+
};
|
|
2951
|
+
const canRestore = isWriter(coValue.group.myRole());
|
|
2952
|
+
return /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
2953
|
+
/* @__PURE__ */ jsx33(Button, { title: "Timeline", variant: "secondary", onClick: openRestoreModal, children: /* @__PURE__ */ jsx33(Icon, { name: "history" }) }),
|
|
2954
|
+
/* @__PURE__ */ jsxs21(
|
|
2955
|
+
Modal,
|
|
2956
|
+
{
|
|
2957
|
+
isOpen: isRestoreModalOpen,
|
|
2958
|
+
onClose: handleClose,
|
|
2959
|
+
heading: "Timeline",
|
|
2960
|
+
confirmText: "Restore",
|
|
2961
|
+
cancelText: "Cancel",
|
|
2962
|
+
onConfirm: handleRestore,
|
|
2963
|
+
onCancel: handleClose,
|
|
2964
|
+
showButtons: timestamps.length > 1 && canRestore,
|
|
2965
|
+
children: [
|
|
2966
|
+
timestamps.length > 1 && /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
2967
|
+
/* @__PURE__ */ jsxs21(RangeContainer, { children: [
|
|
2968
|
+
/* @__PURE__ */ jsx33(RangeLabel, { children: "Select Timestamp" }),
|
|
2969
|
+
/* @__PURE__ */ jsx33(
|
|
2970
|
+
RangeInput,
|
|
2971
|
+
{
|
|
2972
|
+
type: "range",
|
|
2973
|
+
min: 0,
|
|
2974
|
+
max: Math.max(0, timestamps.length - 1),
|
|
2975
|
+
value: selectedIndex,
|
|
2976
|
+
onChange: (e) => setSelectedIndex(Number(e.target.value)),
|
|
2977
|
+
disabled: timestamps.length === 0
|
|
2978
|
+
}
|
|
2979
|
+
),
|
|
2980
|
+
/* @__PURE__ */ jsx33(TimestampDisplay, { children: timestamps[selectedIndex] !== void 0 ? new Date(timestamps[selectedIndex]).toISOString() : "No timestamps available" })
|
|
2981
|
+
] }),
|
|
2982
|
+
canRestore && /* @__PURE__ */ jsxs21(CheckboxContainer, { children: [
|
|
2983
|
+
/* @__PURE__ */ jsx33(
|
|
2984
|
+
CheckboxInput,
|
|
2985
|
+
{
|
|
2986
|
+
type: "checkbox",
|
|
2987
|
+
id: "remove-unknown-properties",
|
|
2988
|
+
checked: removeUnknownProperties,
|
|
2989
|
+
onChange: (e) => setRemoveUnknownProperties(e.target.checked)
|
|
2990
|
+
}
|
|
2991
|
+
),
|
|
2992
|
+
/* @__PURE__ */ jsx33(CheckboxLabel, { htmlFor: "remove-unknown-properties", children: "Remove unknown properties (properties that don't exist in the selected snapshot)" })
|
|
2993
|
+
] })
|
|
2994
|
+
] }),
|
|
2995
|
+
timestamps.length > 0 && timestamps[selectedIndex] !== void 0 && /* @__PURE__ */ jsxs21(PreviewSection, { children: [
|
|
2996
|
+
/* @__PURE__ */ jsx33(PreviewLabel, { children: "State at that time:" }),
|
|
2997
|
+
/* @__PURE__ */ jsx33(PreviewPre, { children: JSON.stringify(coMapAtSelectedIndex, null, 2) })
|
|
2998
|
+
] }),
|
|
2999
|
+
timestamps.length < 2 && /* @__PURE__ */ jsx33("div", { style: { color: "var(--j-text-color)" }, children: "At least 2 timestamps are required to restore a snapshot." })
|
|
3000
|
+
]
|
|
3001
|
+
}
|
|
3002
|
+
)
|
|
3003
|
+
] });
|
|
3004
|
+
}
|
|
3005
|
+
var PreviewSection = styled20("div")`
|
|
3006
|
+
margin-top: 1.5rem;
|
|
3007
|
+
`;
|
|
3008
|
+
var PreviewLabel = styled20("div")`
|
|
3009
|
+
font-weight: 500;
|
|
3010
|
+
margin-bottom: 0.5rem;
|
|
3011
|
+
color: var(--j-text-color-strong);
|
|
3012
|
+
`;
|
|
3013
|
+
var PreviewPre = styled20("pre")`
|
|
3014
|
+
background-color: var(--j-foreground);
|
|
3015
|
+
border: 1px solid var(--j-border-color);
|
|
3016
|
+
border-radius: var(--j-radius-md);
|
|
3017
|
+
padding: 1rem;
|
|
3018
|
+
overflow-x: auto;
|
|
3019
|
+
font-size: 0.875rem;
|
|
3020
|
+
max-height: 400px;
|
|
3021
|
+
overflow-y: auto;
|
|
3022
|
+
color: var(--j-text-color);
|
|
3023
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
3024
|
+
`;
|
|
3025
|
+
var RangeContainer = styled20("div")`
|
|
3026
|
+
display: flex;
|
|
3027
|
+
flex-direction: column;
|
|
3028
|
+
gap: 0.75rem;
|
|
3029
|
+
`;
|
|
3030
|
+
var RangeLabel = styled20("label")`
|
|
3031
|
+
font-weight: 500;
|
|
3032
|
+
color: var(--j-text-color-strong);
|
|
3033
|
+
font-size: 0.875rem;
|
|
3034
|
+
`;
|
|
3035
|
+
var RangeInput = styled20("input")`
|
|
3036
|
+
width: 100%;
|
|
3037
|
+
height: 0.5rem;
|
|
3038
|
+
border-radius: var(--j-radius-sm);
|
|
3039
|
+
outline: none;
|
|
3040
|
+
-webkit-appearance: none;
|
|
3041
|
+
appearance: none;
|
|
3042
|
+
background: var(--j-foreground);
|
|
3043
|
+
cursor: pointer;
|
|
3044
|
+
|
|
3045
|
+
&::-webkit-slider-thumb {
|
|
3046
|
+
-webkit-appearance: none;
|
|
3047
|
+
appearance: none;
|
|
3048
|
+
width: 1.25rem;
|
|
3049
|
+
height: 1.25rem;
|
|
3050
|
+
border-radius: 50%;
|
|
3051
|
+
background: var(--j-primary-color);
|
|
3052
|
+
cursor: pointer;
|
|
3053
|
+
border: 2px solid var(--j-background);
|
|
3054
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
3055
|
+
}
|
|
3056
|
+
|
|
3057
|
+
&::-moz-range-thumb {
|
|
3058
|
+
width: 1.25rem;
|
|
3059
|
+
height: 1.25rem;
|
|
3060
|
+
border-radius: 50%;
|
|
3061
|
+
background: var(--j-primary-color);
|
|
3062
|
+
cursor: pointer;
|
|
3063
|
+
border: 2px solid var(--j-background);
|
|
3064
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
3065
|
+
}
|
|
3066
|
+
|
|
3067
|
+
&:disabled {
|
|
3068
|
+
opacity: 0.5;
|
|
3069
|
+
cursor: not-allowed;
|
|
3070
|
+
}
|
|
3071
|
+
`;
|
|
3072
|
+
var TimestampDisplay = styled20("div")`
|
|
3073
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
3074
|
+
font-size: 0.875rem;
|
|
3075
|
+
color: var(--j-text-color);
|
|
3076
|
+
padding: 0.5rem;
|
|
3077
|
+
background-color: var(--j-foreground);
|
|
3078
|
+
border: 1px solid var(--j-border-color);
|
|
3079
|
+
border-radius: var(--j-radius-md);
|
|
3080
|
+
text-align: center;
|
|
3081
|
+
`;
|
|
3082
|
+
var CheckboxContainer = styled20("div")`
|
|
3083
|
+
display: flex;
|
|
3084
|
+
align-items: flex-start;
|
|
3085
|
+
gap: 0.5rem;
|
|
3086
|
+
margin-top: 1rem;
|
|
3087
|
+
`;
|
|
3088
|
+
var CheckboxInput = styled20("input")`
|
|
3089
|
+
width: 1rem;
|
|
3090
|
+
height: 1rem;
|
|
3091
|
+
margin-top: 0.125rem;
|
|
3092
|
+
cursor: pointer;
|
|
3093
|
+
accent-color: var(--j-primary-color);
|
|
3094
|
+
`;
|
|
3095
|
+
var CheckboxLabel = styled20("label")`
|
|
3096
|
+
font-size: 0.875rem;
|
|
3097
|
+
color: var(--j-text-color);
|
|
3098
|
+
cursor: pointer;
|
|
3099
|
+
line-height: 1.25rem;
|
|
3100
|
+
`;
|
|
3101
|
+
var EditorContainer = styled20("div")`
|
|
3102
|
+
margin-top: 1rem;
|
|
3103
|
+
`;
|
|
3104
|
+
|
|
2446
3105
|
// src/inspector/viewer/page.tsx
|
|
2447
|
-
import { Fragment as
|
|
3106
|
+
import { Fragment as Fragment12, jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2448
3107
|
var BasePageContainer = React5.forwardRef(
|
|
2449
|
-
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */
|
|
3108
|
+
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ jsx34("div", { ref, ...rest })
|
|
2450
3109
|
);
|
|
2451
|
-
var PageContainer =
|
|
3110
|
+
var PageContainer = styled21(BasePageContainer)`
|
|
2452
3111
|
position: absolute;
|
|
2453
3112
|
z-index: 10;
|
|
2454
3113
|
inset: 0;
|
|
@@ -2456,36 +3115,36 @@ var PageContainer = styled18(BasePageContainer)`
|
|
|
2456
3115
|
height: 100%;
|
|
2457
3116
|
padding: 0 0.75rem;
|
|
2458
3117
|
`;
|
|
2459
|
-
var BackButton =
|
|
3118
|
+
var BackButton = styled21("div")`
|
|
2460
3119
|
position: absolute;
|
|
2461
3120
|
left: 0;
|
|
2462
3121
|
right: 0;
|
|
2463
3122
|
top: 0;
|
|
2464
3123
|
height: 2.5rem;
|
|
2465
3124
|
`;
|
|
2466
|
-
var HeaderContainer =
|
|
3125
|
+
var HeaderContainer = styled21("div")`
|
|
2467
3126
|
display: flex;
|
|
2468
3127
|
justify-content: space-between;
|
|
2469
3128
|
align-items: center;
|
|
2470
3129
|
margin-bottom: 1rem;
|
|
2471
3130
|
`;
|
|
2472
|
-
var TitleContainer =
|
|
3131
|
+
var TitleContainer = styled21("div")`
|
|
2473
3132
|
display: flex;
|
|
2474
3133
|
align-items: center;
|
|
2475
3134
|
gap: 0.75rem;
|
|
2476
3135
|
`;
|
|
2477
|
-
var Title =
|
|
3136
|
+
var Title = styled21(Heading)`
|
|
2478
3137
|
display: flex;
|
|
2479
3138
|
flex-direction: column;
|
|
2480
3139
|
align-items: flex-start;
|
|
2481
3140
|
gap: 0.25rem;
|
|
2482
3141
|
`;
|
|
2483
|
-
var BadgeContainer =
|
|
3142
|
+
var BadgeContainer = styled21("div")`
|
|
2484
3143
|
display: flex;
|
|
2485
3144
|
align-items: center;
|
|
2486
3145
|
gap: 0.75rem;
|
|
2487
3146
|
`;
|
|
2488
|
-
var ContentContainer =
|
|
3147
|
+
var ContentContainer = styled21("div")`
|
|
2489
3148
|
overflow: auto;
|
|
2490
3149
|
display: flex;
|
|
2491
3150
|
flex-direction: column;
|
|
@@ -2506,7 +3165,7 @@ function View(props) {
|
|
|
2506
3165
|
const { node, onNavigate } = props;
|
|
2507
3166
|
if (!snapshot || snapshot === "unavailable") return;
|
|
2508
3167
|
if (type === "costream") {
|
|
2509
|
-
return /* @__PURE__ */
|
|
3168
|
+
return /* @__PURE__ */ jsx34(
|
|
2510
3169
|
CoStreamView,
|
|
2511
3170
|
{
|
|
2512
3171
|
data: snapshot,
|
|
@@ -2517,7 +3176,7 @@ function View(props) {
|
|
|
2517
3176
|
);
|
|
2518
3177
|
}
|
|
2519
3178
|
if (extendedType === "group") {
|
|
2520
|
-
return /* @__PURE__ */
|
|
3179
|
+
return /* @__PURE__ */ jsx34(
|
|
2521
3180
|
GroupView,
|
|
2522
3181
|
{
|
|
2523
3182
|
coValue: value,
|
|
@@ -2528,10 +3187,10 @@ function View(props) {
|
|
|
2528
3187
|
);
|
|
2529
3188
|
}
|
|
2530
3189
|
if (extendedType === "account") {
|
|
2531
|
-
return /* @__PURE__ */
|
|
3190
|
+
return /* @__PURE__ */ jsx34(AccountView, { data: snapshot, node, onNavigate });
|
|
2532
3191
|
}
|
|
2533
3192
|
if (type === "coplaintext") {
|
|
2534
|
-
return /* @__PURE__ */
|
|
3193
|
+
return /* @__PURE__ */ jsx34(CoPlainTextView, { data: snapshot });
|
|
2535
3194
|
}
|
|
2536
3195
|
if (type === "colist") {
|
|
2537
3196
|
const handleRemove = (index) => {
|
|
@@ -2540,7 +3199,7 @@ function View(props) {
|
|
|
2540
3199
|
list.delete(index);
|
|
2541
3200
|
}
|
|
2542
3201
|
};
|
|
2543
|
-
return /* @__PURE__ */
|
|
3202
|
+
return /* @__PURE__ */ jsx34(
|
|
2544
3203
|
TableView,
|
|
2545
3204
|
{
|
|
2546
3205
|
data: snapshot,
|
|
@@ -2551,9 +3210,20 @@ function View(props) {
|
|
|
2551
3210
|
);
|
|
2552
3211
|
}
|
|
2553
3212
|
if (extendedType === "record") {
|
|
2554
|
-
return /* @__PURE__ */
|
|
3213
|
+
return /* @__PURE__ */ jsx34(TableView, { data: snapshot, node, onNavigate });
|
|
3214
|
+
}
|
|
3215
|
+
if (type === "comap") {
|
|
3216
|
+
return /* @__PURE__ */ jsx34(
|
|
3217
|
+
CoMapView,
|
|
3218
|
+
{
|
|
3219
|
+
coValue: value,
|
|
3220
|
+
data: snapshot,
|
|
3221
|
+
node,
|
|
3222
|
+
onNavigate
|
|
3223
|
+
}
|
|
3224
|
+
);
|
|
2555
3225
|
}
|
|
2556
|
-
return /* @__PURE__ */
|
|
3226
|
+
return /* @__PURE__ */ jsx34(GridView, { data: snapshot, onNavigate, node });
|
|
2557
3227
|
}
|
|
2558
3228
|
function Page(props) {
|
|
2559
3229
|
const {
|
|
@@ -2569,13 +3239,13 @@ function Page(props) {
|
|
|
2569
3239
|
const coValue = useResolvedCoValue(coId, node);
|
|
2570
3240
|
const { value, snapshot, type, extendedType } = coValue;
|
|
2571
3241
|
if (snapshot === "unavailable") {
|
|
2572
|
-
return /* @__PURE__ */
|
|
3242
|
+
return /* @__PURE__ */ jsx34("div", { style, children: "Data unavailable" });
|
|
2573
3243
|
}
|
|
2574
3244
|
if (!snapshot) {
|
|
2575
|
-
return /* @__PURE__ */
|
|
3245
|
+
return /* @__PURE__ */ jsx34("div", { style });
|
|
2576
3246
|
}
|
|
2577
|
-
return /* @__PURE__ */
|
|
2578
|
-
!isTopLevel && /* @__PURE__ */
|
|
3247
|
+
return /* @__PURE__ */ jsxs22(PageContainer, { style, className, isTopLevel, children: [
|
|
3248
|
+
!isTopLevel && /* @__PURE__ */ jsx34(
|
|
2579
3249
|
BackButton,
|
|
2580
3250
|
{
|
|
2581
3251
|
"aria-label": "Back",
|
|
@@ -2585,27 +3255,27 @@ function Page(props) {
|
|
|
2585
3255
|
"aria-hidden": "true"
|
|
2586
3256
|
}
|
|
2587
3257
|
),
|
|
2588
|
-
/* @__PURE__ */
|
|
2589
|
-
/* @__PURE__ */
|
|
3258
|
+
/* @__PURE__ */ jsx34(HeaderContainer, { children: /* @__PURE__ */ jsxs22(TitleContainer, { children: [
|
|
3259
|
+
/* @__PURE__ */ jsx34(Title, { children: /* @__PURE__ */ jsxs22("span", { children: [
|
|
2590
3260
|
name,
|
|
2591
|
-
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */
|
|
3261
|
+
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */ jsxs22("span", { style: { color: "#57534e", fontWeight: 500 }, children: [
|
|
2592
3262
|
" ",
|
|
2593
3263
|
snapshot.name
|
|
2594
3264
|
] }) : null
|
|
2595
3265
|
] }) }),
|
|
2596
|
-
/* @__PURE__ */
|
|
2597
|
-
/* @__PURE__ */
|
|
2598
|
-
/* @__PURE__ */
|
|
3266
|
+
/* @__PURE__ */ jsxs22(BadgeContainer, { children: [
|
|
3267
|
+
/* @__PURE__ */ jsx34(Badge, { children: type && /* @__PURE__ */ jsx34(TypeIcon, { type, extendedType }) }),
|
|
3268
|
+
/* @__PURE__ */ jsx34(Badge, { children: coId })
|
|
2599
3269
|
] })
|
|
2600
3270
|
] }) }),
|
|
2601
|
-
/* @__PURE__ */
|
|
2602
|
-
/* @__PURE__ */
|
|
2603
|
-
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */
|
|
2604
|
-
/* @__PURE__ */
|
|
2605
|
-
/* @__PURE__ */
|
|
3271
|
+
/* @__PURE__ */ jsxs22(ContentContainer, { children: [
|
|
3272
|
+
/* @__PURE__ */ jsx34(View, { ...props, coValue }),
|
|
3273
|
+
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */ jsxs22(Fragment12, { children: [
|
|
3274
|
+
/* @__PURE__ */ jsx34(RoleDisplay, { node, value }),
|
|
3275
|
+
/* @__PURE__ */ jsxs22(Text, { muted: true, children: [
|
|
2606
3276
|
"Owned by",
|
|
2607
3277
|
" ",
|
|
2608
|
-
/* @__PURE__ */
|
|
3278
|
+
/* @__PURE__ */ jsx34(
|
|
2609
3279
|
AccountOrGroupText,
|
|
2610
3280
|
{
|
|
2611
3281
|
coId: value.group.id,
|
|
@@ -2618,15 +3288,15 @@ function Page(props) {
|
|
|
2618
3288
|
)
|
|
2619
3289
|
] })
|
|
2620
3290
|
] }),
|
|
2621
|
-
value && /* @__PURE__ */
|
|
3291
|
+
value && /* @__PURE__ */ jsx34(HistoryView, { coValue: value, node })
|
|
2622
3292
|
] })
|
|
2623
3293
|
] });
|
|
2624
3294
|
}
|
|
2625
3295
|
|
|
2626
3296
|
// src/inspector/ui/error-boundary.tsx
|
|
2627
3297
|
import React6 from "react";
|
|
2628
|
-
import { styled as
|
|
2629
|
-
import { jsx as
|
|
3298
|
+
import { styled as styled22 } from "goober";
|
|
3299
|
+
import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2630
3300
|
var ErrorBoundary = class extends React6.Component {
|
|
2631
3301
|
constructor(props) {
|
|
2632
3302
|
super(props);
|
|
@@ -2640,24 +3310,24 @@ var ErrorBoundary = class extends React6.Component {
|
|
|
2640
3310
|
}
|
|
2641
3311
|
render() {
|
|
2642
3312
|
if (this.state.hasError) {
|
|
2643
|
-
return /* @__PURE__ */
|
|
2644
|
-
/* @__PURE__ */
|
|
2645
|
-
/* @__PURE__ */
|
|
2646
|
-
/* @__PURE__ */
|
|
3313
|
+
return /* @__PURE__ */ jsxs23("div", { style: { padding: "1rem" }, children: [
|
|
3314
|
+
/* @__PURE__ */ jsx35(StyledHeading2, { children: this.props.title }),
|
|
3315
|
+
/* @__PURE__ */ jsx35(Text, { mono: true, style: { marginTop: "0.5rem", color: "#ef4444" }, children: this.state.error?.message || "An unexpected error occurred" }),
|
|
3316
|
+
/* @__PURE__ */ jsx35("pre", { style: { paddingLeft: "1rem", color: "#ef4444" }, children: this.state.error?.stack })
|
|
2647
3317
|
] });
|
|
2648
3318
|
}
|
|
2649
3319
|
return this.props.children;
|
|
2650
3320
|
}
|
|
2651
3321
|
};
|
|
2652
|
-
var StyledHeading2 =
|
|
3322
|
+
var StyledHeading2 = styled22("h1")`
|
|
2653
3323
|
font-size: 1.125rem;
|
|
2654
3324
|
font-weight: 500;
|
|
2655
3325
|
color: var(--j-text-color-strong);
|
|
2656
3326
|
`;
|
|
2657
3327
|
|
|
2658
3328
|
// src/inspector/viewer/page-stack.tsx
|
|
2659
|
-
import { Fragment as
|
|
2660
|
-
var PageStackContainer =
|
|
3329
|
+
import { Fragment as Fragment13, jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3330
|
+
var PageStackContainer = styled23("div")`
|
|
2661
3331
|
position: relative;
|
|
2662
3332
|
padding: 0 0.75rem;
|
|
2663
3333
|
overflow-y: auto;
|
|
@@ -2674,9 +3344,9 @@ function PageStack({
|
|
|
2674
3344
|
}) {
|
|
2675
3345
|
const page = path[path.length - 1];
|
|
2676
3346
|
const index = path.length - 1;
|
|
2677
|
-
return /* @__PURE__ */
|
|
3347
|
+
return /* @__PURE__ */ jsx36(Fragment13, { children: /* @__PURE__ */ jsxs24(PageStackContainer, { children: [
|
|
2678
3348
|
children,
|
|
2679
|
-
node && page && /* @__PURE__ */
|
|
3349
|
+
node && page && /* @__PURE__ */ jsx36(ErrorBoundary, { title: "An error occurred while rendering this CoValue", children: /* @__PURE__ */ jsx36(
|
|
2680
3350
|
Page,
|
|
2681
3351
|
{
|
|
2682
3352
|
coId: page.coId,
|
|
@@ -2691,10 +3361,10 @@ function PageStack({
|
|
|
2691
3361
|
}
|
|
2692
3362
|
|
|
2693
3363
|
// src/inspector/viewer/use-page-path.ts
|
|
2694
|
-
import { useCallback, useEffect as useEffect8, useState as
|
|
3364
|
+
import { useCallback, useEffect as useEffect8, useState as useState13 } from "react";
|
|
2695
3365
|
var STORAGE_KEY = "jazz-inspector-paths";
|
|
2696
3366
|
function usePagePath(defaultPath) {
|
|
2697
|
-
const [path, setPath] =
|
|
3367
|
+
const [path, setPath] = useState13(() => {
|
|
2698
3368
|
if (typeof window === "undefined") return [];
|
|
2699
3369
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
2700
3370
|
if (stored) {
|
|
@@ -2748,8 +3418,8 @@ function usePagePath(defaultPath) {
|
|
|
2748
3418
|
}
|
|
2749
3419
|
|
|
2750
3420
|
// src/inspector/ui/global-styles.tsx
|
|
2751
|
-
import { styled as
|
|
2752
|
-
var GlobalStyles =
|
|
3421
|
+
import { styled as styled24 } from "goober";
|
|
3422
|
+
var GlobalStyles = styled24("div")`
|
|
2753
3423
|
/* Colors */
|
|
2754
3424
|
--j-primary-color: #146AFF;
|
|
2755
3425
|
--j-link-color: var(--j-primary-color);
|
|
@@ -2823,9 +3493,9 @@ var GlobalStyles = styled21("div")`
|
|
|
2823
3493
|
`;
|
|
2824
3494
|
|
|
2825
3495
|
// src/inspector/viewer/inspector-button.tsx
|
|
2826
|
-
import { styled as
|
|
2827
|
-
import { jsx as
|
|
2828
|
-
var StyledInspectorButton =
|
|
3496
|
+
import { styled as styled25 } from "goober";
|
|
3497
|
+
import { jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3498
|
+
var StyledInspectorButton = styled25("button")`
|
|
2829
3499
|
position: fixed;
|
|
2830
3500
|
width: 2.5rem;
|
|
2831
3501
|
height: 2.5rem;
|
|
@@ -2856,7 +3526,7 @@ var StyledInspectorButton = styled22("button")`
|
|
|
2856
3526
|
}
|
|
2857
3527
|
}}
|
|
2858
3528
|
`;
|
|
2859
|
-
var JazzIcon =
|
|
3529
|
+
var JazzIcon = styled25("svg")`
|
|
2860
3530
|
width: 100%;
|
|
2861
3531
|
height: auto;
|
|
2862
3532
|
position: relative;
|
|
@@ -2867,8 +3537,8 @@ function InspectorButton({
|
|
|
2867
3537
|
position = "right",
|
|
2868
3538
|
...buttonProps
|
|
2869
3539
|
}) {
|
|
2870
|
-
return /* @__PURE__ */
|
|
2871
|
-
/* @__PURE__ */
|
|
3540
|
+
return /* @__PURE__ */ jsxs25(StyledInspectorButton, { position, ...buttonProps, children: [
|
|
3541
|
+
/* @__PURE__ */ jsx37(
|
|
2872
3542
|
JazzIcon,
|
|
2873
3543
|
{
|
|
2874
3544
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2876,7 +3546,7 @@ function InspectorButton({
|
|
|
2876
3546
|
height: "115",
|
|
2877
3547
|
viewBox: "0 0 119 115",
|
|
2878
3548
|
fill: "none",
|
|
2879
|
-
children: /* @__PURE__ */
|
|
3549
|
+
children: /* @__PURE__ */ jsx37(
|
|
2880
3550
|
"path",
|
|
2881
3551
|
{
|
|
2882
3552
|
fillRule: "evenodd",
|
|
@@ -2887,7 +3557,7 @@ function InspectorButton({
|
|
|
2887
3557
|
)
|
|
2888
3558
|
}
|
|
2889
3559
|
),
|
|
2890
|
-
/* @__PURE__ */
|
|
3560
|
+
/* @__PURE__ */ jsx37(
|
|
2891
3561
|
"span",
|
|
2892
3562
|
{
|
|
2893
3563
|
style: {
|
|
@@ -2908,10 +3578,10 @@ function InspectorButton({
|
|
|
2908
3578
|
}
|
|
2909
3579
|
|
|
2910
3580
|
// src/inspector/viewer/use-open-inspector.ts
|
|
2911
|
-
import { useEffect as useEffect9, useState as
|
|
3581
|
+
import { useEffect as useEffect9, useState as useState14 } from "react";
|
|
2912
3582
|
var STORAGE_KEY2 = "jazz-inspector-open";
|
|
2913
3583
|
function useOpenInspector() {
|
|
2914
|
-
const [open, setOpen] =
|
|
3584
|
+
const [open, setOpen] = useState14(() => {
|
|
2915
3585
|
if (typeof window === "undefined") return false;
|
|
2916
3586
|
const stored = localStorage.getItem(STORAGE_KEY2);
|
|
2917
3587
|
return stored ? JSON.parse(stored) : false;
|
|
@@ -2923,15 +3593,15 @@ function useOpenInspector() {
|
|
|
2923
3593
|
}
|
|
2924
3594
|
|
|
2925
3595
|
// src/inspector/viewer/delete-local-data.tsx
|
|
2926
|
-
import { useState as
|
|
2927
|
-
import { Fragment as
|
|
3596
|
+
import { useState as useState15 } from "react";
|
|
3597
|
+
import { Fragment as Fragment14, jsx as jsx38, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2928
3598
|
var DELETE_LOCAL_DATA_STRING = "delete my local data";
|
|
2929
3599
|
function DeleteLocalData() {
|
|
2930
|
-
const [showDeleteModal, setShowDeleteModal] =
|
|
2931
|
-
const [confirmDeleteString, setConfirmDeleteString] =
|
|
2932
|
-
return /* @__PURE__ */
|
|
2933
|
-
/* @__PURE__ */
|
|
2934
|
-
/* @__PURE__ */
|
|
3600
|
+
const [showDeleteModal, setShowDeleteModal] = useState15(false);
|
|
3601
|
+
const [confirmDeleteString, setConfirmDeleteString] = useState15("");
|
|
3602
|
+
return /* @__PURE__ */ jsxs26(Fragment14, { children: [
|
|
3603
|
+
/* @__PURE__ */ jsx38(Button, { variant: "destructive", onClick: () => setShowDeleteModal(true), children: "Delete my local data" }),
|
|
3604
|
+
/* @__PURE__ */ jsxs26(
|
|
2935
3605
|
Modal,
|
|
2936
3606
|
{
|
|
2937
3607
|
isOpen: showDeleteModal,
|
|
@@ -2939,7 +3609,7 @@ function DeleteLocalData() {
|
|
|
2939
3609
|
heading: "Delete Local Data",
|
|
2940
3610
|
showButtons: false,
|
|
2941
3611
|
children: [
|
|
2942
|
-
/* @__PURE__ */
|
|
3612
|
+
/* @__PURE__ */ jsxs26(
|
|
2943
3613
|
"div",
|
|
2944
3614
|
{
|
|
2945
3615
|
style: {
|
|
@@ -2950,33 +3620,33 @@ function DeleteLocalData() {
|
|
|
2950
3620
|
gap: "0.5rem"
|
|
2951
3621
|
},
|
|
2952
3622
|
children: [
|
|
2953
|
-
/* @__PURE__ */
|
|
3623
|
+
/* @__PURE__ */ jsxs26("p", { children: [
|
|
2954
3624
|
"This action ",
|
|
2955
|
-
/* @__PURE__ */
|
|
3625
|
+
/* @__PURE__ */ jsx38("strong", { children: "cannot" }),
|
|
2956
3626
|
" be undone."
|
|
2957
3627
|
] }),
|
|
2958
|
-
/* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ jsxs26("p", { children: [
|
|
2959
3629
|
"Be aware that the following data will be",
|
|
2960
3630
|
" ",
|
|
2961
|
-
/* @__PURE__ */
|
|
3631
|
+
/* @__PURE__ */ jsx38("strong", { children: "permanently" }),
|
|
2962
3632
|
" deleted:"
|
|
2963
3633
|
] }),
|
|
2964
|
-
/* @__PURE__ */
|
|
2965
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ jsxs26("ul", { style: { listStyleType: "disc", paddingLeft: "1rem" }, children: [
|
|
3635
|
+
/* @__PURE__ */ jsxs26("li", { children: [
|
|
2966
3636
|
"Unsynced data for ",
|
|
2967
|
-
/* @__PURE__ */
|
|
3637
|
+
/* @__PURE__ */ jsx38("strong", { children: "all apps" }),
|
|
2968
3638
|
" on",
|
|
2969
3639
|
" ",
|
|
2970
|
-
/* @__PURE__ */
|
|
3640
|
+
/* @__PURE__ */ jsx38("code", { children: window.location.origin })
|
|
2971
3641
|
] }),
|
|
2972
|
-
/* @__PURE__ */
|
|
2973
|
-
/* @__PURE__ */
|
|
3642
|
+
/* @__PURE__ */ jsx38("li", { children: "Accounts" }),
|
|
3643
|
+
/* @__PURE__ */ jsx38("li", { children: "Logged in sessions" })
|
|
2974
3644
|
] }),
|
|
2975
|
-
/* @__PURE__ */
|
|
3645
|
+
/* @__PURE__ */ jsx38("p", {})
|
|
2976
3646
|
]
|
|
2977
3647
|
}
|
|
2978
3648
|
),
|
|
2979
|
-
/* @__PURE__ */
|
|
3649
|
+
/* @__PURE__ */ jsx38(
|
|
2980
3650
|
Input,
|
|
2981
3651
|
{
|
|
2982
3652
|
label: `Type "${DELETE_LOCAL_DATA_STRING}" to confirm`,
|
|
@@ -2987,7 +3657,7 @@ function DeleteLocalData() {
|
|
|
2987
3657
|
}
|
|
2988
3658
|
}
|
|
2989
3659
|
),
|
|
2990
|
-
/* @__PURE__ */
|
|
3660
|
+
/* @__PURE__ */ jsx38(
|
|
2991
3661
|
"p",
|
|
2992
3662
|
{
|
|
2993
3663
|
style: {
|
|
@@ -2997,14 +3667,14 @@ function DeleteLocalData() {
|
|
|
2997
3667
|
flexDirection: "column",
|
|
2998
3668
|
gap: "0.5rem"
|
|
2999
3669
|
},
|
|
3000
|
-
children: /* @__PURE__ */
|
|
3670
|
+
children: /* @__PURE__ */ jsxs26("small", { children: [
|
|
3001
3671
|
"Data synced to a sync server will ",
|
|
3002
|
-
/* @__PURE__ */
|
|
3672
|
+
/* @__PURE__ */ jsx38("strong", { children: "not" }),
|
|
3003
3673
|
" be deleted, and will be synced when you log in again."
|
|
3004
3674
|
] })
|
|
3005
3675
|
}
|
|
3006
3676
|
),
|
|
3007
|
-
/* @__PURE__ */
|
|
3677
|
+
/* @__PURE__ */ jsxs26(
|
|
3008
3678
|
"div",
|
|
3009
3679
|
{
|
|
3010
3680
|
style: {
|
|
@@ -3014,8 +3684,8 @@ function DeleteLocalData() {
|
|
|
3014
3684
|
gap: "0.5rem"
|
|
3015
3685
|
},
|
|
3016
3686
|
children: [
|
|
3017
|
-
/* @__PURE__ */
|
|
3018
|
-
/* @__PURE__ */
|
|
3687
|
+
/* @__PURE__ */ jsx38(Button, { variant: "secondary", onClick: () => setShowDeleteModal(false), children: "Cancel" }),
|
|
3688
|
+
/* @__PURE__ */ jsx38(
|
|
3019
3689
|
Button,
|
|
3020
3690
|
{
|
|
3021
3691
|
variant: "destructive",
|
|
@@ -3042,8 +3712,8 @@ function DeleteLocalData() {
|
|
|
3042
3712
|
}
|
|
3043
3713
|
|
|
3044
3714
|
// src/inspector/viewer/new-app.tsx
|
|
3045
|
-
import { Fragment as
|
|
3046
|
-
var InspectorContainer =
|
|
3715
|
+
import { Fragment as Fragment15, jsx as jsx39, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3716
|
+
var InspectorContainer = styled26("div")`
|
|
3047
3717
|
position: fixed;
|
|
3048
3718
|
height: 50vh;
|
|
3049
3719
|
max-height: 800px;
|
|
@@ -3060,17 +3730,17 @@ var InspectorContainer = styled23("div")`
|
|
|
3060
3730
|
background-color: var(--j-background);
|
|
3061
3731
|
}
|
|
3062
3732
|
`;
|
|
3063
|
-
var HeaderContainer2 =
|
|
3733
|
+
var HeaderContainer2 = styled26("div")`
|
|
3064
3734
|
display: flex;
|
|
3065
3735
|
align-items: center;
|
|
3066
3736
|
gap: 1rem;
|
|
3067
3737
|
padding: 0 0.75rem;
|
|
3068
3738
|
margin: 0.75rem 0;
|
|
3069
3739
|
`;
|
|
3070
|
-
var Form =
|
|
3740
|
+
var Form = styled26("form")`
|
|
3071
3741
|
width: 24rem;
|
|
3072
3742
|
`;
|
|
3073
|
-
var InitialForm =
|
|
3743
|
+
var InitialForm = styled26("form")`
|
|
3074
3744
|
display: flex;
|
|
3075
3745
|
flex-direction: column;
|
|
3076
3746
|
position: relative;
|
|
@@ -3082,7 +3752,7 @@ var InitialForm = styled23("form")`
|
|
|
3082
3752
|
max-width: 24rem;
|
|
3083
3753
|
margin: 0 auto;
|
|
3084
3754
|
`;
|
|
3085
|
-
var OrText =
|
|
3755
|
+
var OrText = styled26("p")`
|
|
3086
3756
|
text-align: center;
|
|
3087
3757
|
`;
|
|
3088
3758
|
function JazzInspectorInternal({
|
|
@@ -3091,7 +3761,7 @@ function JazzInspectorInternal({
|
|
|
3091
3761
|
accountId
|
|
3092
3762
|
}) {
|
|
3093
3763
|
const [open, setOpen] = useOpenInspector();
|
|
3094
|
-
const [coValueId, setCoValueId] =
|
|
3764
|
+
const [coValueId, setCoValueId] = useState16("");
|
|
3095
3765
|
const { path, addPages, goToIndex, goBack, setPage } = usePagePath();
|
|
3096
3766
|
const handleCoValueIdSubmit = (e) => {
|
|
3097
3767
|
e.preventDefault();
|
|
@@ -3101,12 +3771,12 @@ function JazzInspectorInternal({
|
|
|
3101
3771
|
setCoValueId("");
|
|
3102
3772
|
};
|
|
3103
3773
|
if (!open) {
|
|
3104
|
-
return /* @__PURE__ */
|
|
3774
|
+
return /* @__PURE__ */ jsx39(InspectorButton, { position, onClick: () => setOpen(true) });
|
|
3105
3775
|
}
|
|
3106
|
-
return /* @__PURE__ */
|
|
3107
|
-
/* @__PURE__ */
|
|
3108
|
-
/* @__PURE__ */
|
|
3109
|
-
path.length !== 0 && /* @__PURE__ */
|
|
3776
|
+
return /* @__PURE__ */ jsxs27(InspectorContainer, { as: GlobalStyles, style: { zIndex: 999 }, children: [
|
|
3777
|
+
/* @__PURE__ */ jsxs27(HeaderContainer2, { children: [
|
|
3778
|
+
/* @__PURE__ */ jsx39(Breadcrumbs, { path, onBreadcrumbClick: goToIndex }),
|
|
3779
|
+
path.length !== 0 && /* @__PURE__ */ jsx39(Form, { onSubmit: handleCoValueIdSubmit, children: /* @__PURE__ */ jsx39(
|
|
3110
3780
|
Input,
|
|
3111
3781
|
{
|
|
3112
3782
|
label: "CoValue ID",
|
|
@@ -3117,24 +3787,24 @@ function JazzInspectorInternal({
|
|
|
3117
3787
|
onChange: (e) => setCoValueId(e.target.value)
|
|
3118
3788
|
}
|
|
3119
3789
|
) }),
|
|
3120
|
-
/* @__PURE__ */
|
|
3121
|
-
/* @__PURE__ */
|
|
3790
|
+
/* @__PURE__ */ jsx39(DeleteLocalData, {}),
|
|
3791
|
+
/* @__PURE__ */ jsx39(Button, { variant: "plain", type: "button", onClick: () => setOpen(false), children: "Close" })
|
|
3122
3792
|
] }),
|
|
3123
|
-
/* @__PURE__ */
|
|
3793
|
+
/* @__PURE__ */ jsx39(
|
|
3124
3794
|
PageStack,
|
|
3125
3795
|
{
|
|
3126
3796
|
path,
|
|
3127
3797
|
node: localNode,
|
|
3128
3798
|
goBack,
|
|
3129
3799
|
addPages,
|
|
3130
|
-
children: path.length <= 0 && /* @__PURE__ */
|
|
3800
|
+
children: path.length <= 0 && /* @__PURE__ */ jsxs27(
|
|
3131
3801
|
InitialForm,
|
|
3132
3802
|
{
|
|
3133
3803
|
onSubmit: handleCoValueIdSubmit,
|
|
3134
3804
|
"aria-hidden": path.length !== 0,
|
|
3135
3805
|
children: [
|
|
3136
|
-
/* @__PURE__ */
|
|
3137
|
-
/* @__PURE__ */
|
|
3806
|
+
/* @__PURE__ */ jsx39(Heading, { children: "Jazz CoValue Inspector" }),
|
|
3807
|
+
/* @__PURE__ */ jsx39(
|
|
3138
3808
|
Input,
|
|
3139
3809
|
{
|
|
3140
3810
|
label: "CoValue ID",
|
|
@@ -3145,10 +3815,10 @@ function JazzInspectorInternal({
|
|
|
3145
3815
|
onChange: (e) => setCoValueId(e.target.value)
|
|
3146
3816
|
}
|
|
3147
3817
|
),
|
|
3148
|
-
/* @__PURE__ */
|
|
3149
|
-
accountId && /* @__PURE__ */
|
|
3150
|
-
/* @__PURE__ */
|
|
3151
|
-
/* @__PURE__ */
|
|
3818
|
+
/* @__PURE__ */ jsx39(Button, { type: "submit", variant: "primary", children: "Inspect CoValue" }),
|
|
3819
|
+
accountId && /* @__PURE__ */ jsxs27(Fragment15, { children: [
|
|
3820
|
+
/* @__PURE__ */ jsx39(OrText, { children: "or" }),
|
|
3821
|
+
/* @__PURE__ */ jsx39(
|
|
3152
3822
|
Button,
|
|
3153
3823
|
{
|
|
3154
3824
|
variant: "secondary",
|
|
@@ -3171,12 +3841,12 @@ function JazzInspectorInternal({
|
|
|
3171
3841
|
// src/inspector/index.tsx
|
|
3172
3842
|
import { setup } from "goober";
|
|
3173
3843
|
import { useJazzContext } from "jazz-tools/react-core";
|
|
3174
|
-
import { jsx as
|
|
3844
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
3175
3845
|
function JazzInspector({ position = "right" }) {
|
|
3176
3846
|
const context = useJazzContext();
|
|
3177
3847
|
const localNode = context.node;
|
|
3178
3848
|
const me = "me" in context ? context.me : void 0;
|
|
3179
|
-
return /* @__PURE__ */
|
|
3849
|
+
return /* @__PURE__ */ jsx40(
|
|
3180
3850
|
JazzInspectorInternal,
|
|
3181
3851
|
{
|
|
3182
3852
|
position,
|