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
|
@@ -31782,14 +31782,14 @@ var require_jsx_runtime = __commonJS({
|
|
|
31782
31782
|
});
|
|
31783
31783
|
|
|
31784
31784
|
// src/inspector/custom-element.tsx
|
|
31785
|
-
var
|
|
31785
|
+
var import_react27 = __toESM(require_react(), 1);
|
|
31786
31786
|
var import_client = __toESM(require_client(), 1);
|
|
31787
31787
|
import { setup } from "goober";
|
|
31788
31788
|
import { Account } from "jazz-tools";
|
|
31789
31789
|
|
|
31790
31790
|
// src/inspector/viewer/new-app.tsx
|
|
31791
|
-
var
|
|
31792
|
-
import { styled as
|
|
31791
|
+
var import_react26 = __toESM(require_react(), 1);
|
|
31792
|
+
import { styled as styled26 } from "goober";
|
|
31793
31793
|
|
|
31794
31794
|
// src/inspector/ui/button.tsx
|
|
31795
31795
|
var import_react = __toESM(require_react(), 1);
|
|
@@ -31964,11 +31964,11 @@ var Breadcrumbs = ({
|
|
|
31964
31964
|
};
|
|
31965
31965
|
|
|
31966
31966
|
// src/inspector/viewer/page-stack.tsx
|
|
31967
|
-
import { styled as
|
|
31967
|
+
import { styled as styled23 } from "goober";
|
|
31968
31968
|
|
|
31969
31969
|
// src/inspector/viewer/page.tsx
|
|
31970
|
-
var
|
|
31971
|
-
import { styled as
|
|
31970
|
+
var import_react21 = __toESM(require_react(), 1);
|
|
31971
|
+
import { styled as styled21 } from "goober";
|
|
31972
31972
|
|
|
31973
31973
|
// src/inspector/ui/badge.tsx
|
|
31974
31974
|
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -32465,6 +32465,10 @@ function AccountOrGroupText({
|
|
|
32465
32465
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: displayText });
|
|
32466
32466
|
}
|
|
32467
32467
|
|
|
32468
|
+
// src/inspector/viewer/grid-view.tsx
|
|
32469
|
+
var import_react11 = __toESM(require_react(), 1);
|
|
32470
|
+
import { styled as styled14 } from "goober";
|
|
32471
|
+
|
|
32468
32472
|
// src/inspector/viewer/type-icon.tsx
|
|
32469
32473
|
import { styled as styled8 } from "goober";
|
|
32470
32474
|
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -32583,10 +32587,30 @@ function DeleteIcon(props) {
|
|
|
32583
32587
|
);
|
|
32584
32588
|
}
|
|
32585
32589
|
|
|
32586
|
-
// src/inspector/ui/icons/
|
|
32590
|
+
// src/inspector/ui/icons/edit-icon.tsx
|
|
32587
32591
|
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
|
|
32588
|
-
function
|
|
32592
|
+
function EditIcon(props) {
|
|
32589
32593
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
32594
|
+
"svg",
|
|
32595
|
+
{
|
|
32596
|
+
...props,
|
|
32597
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
32598
|
+
width: "24",
|
|
32599
|
+
height: "24",
|
|
32600
|
+
viewBox: "0 0 24 24",
|
|
32601
|
+
fill: "none",
|
|
32602
|
+
stroke: "currentColor",
|
|
32603
|
+
strokeLinejoin: "round",
|
|
32604
|
+
className: "lucide lucide-edit lucide-pencil",
|
|
32605
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" })
|
|
32606
|
+
}
|
|
32607
|
+
);
|
|
32608
|
+
}
|
|
32609
|
+
|
|
32610
|
+
// src/inspector/ui/icons/link-icon.tsx
|
|
32611
|
+
var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
|
|
32612
|
+
function LinkIcon(props) {
|
|
32613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
32590
32614
|
"svg",
|
|
32591
32615
|
{
|
|
32592
32616
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -32595,7 +32619,7 @@ function LinkIcon(props) {
|
|
|
32595
32619
|
strokeWidth: 1.5,
|
|
32596
32620
|
stroke: "currentColor",
|
|
32597
32621
|
...props,
|
|
32598
|
-
children: /* @__PURE__ */ (0,
|
|
32622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
32599
32623
|
"path",
|
|
32600
32624
|
{
|
|
32601
32625
|
strokeLinecap: "round",
|
|
@@ -32607,13 +32631,82 @@ function LinkIcon(props) {
|
|
|
32607
32631
|
);
|
|
32608
32632
|
}
|
|
32609
32633
|
|
|
32634
|
+
// src/inspector/ui/icons/history.tsx
|
|
32635
|
+
var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
|
|
32636
|
+
function HistoryIcon(props) {
|
|
32637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
32638
|
+
"svg",
|
|
32639
|
+
{
|
|
32640
|
+
...props,
|
|
32641
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
32642
|
+
width: "24",
|
|
32643
|
+
height: "24",
|
|
32644
|
+
viewBox: "0 0 24 24",
|
|
32645
|
+
fill: "none",
|
|
32646
|
+
stroke: "currentColor",
|
|
32647
|
+
strokeLinejoin: "round",
|
|
32648
|
+
className: "lucide lucide-trash-icon lucide-trash",
|
|
32649
|
+
children: [
|
|
32650
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
32651
|
+
"path",
|
|
32652
|
+
{
|
|
32653
|
+
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",
|
|
32654
|
+
strokeWidth: "2",
|
|
32655
|
+
strokeLinecap: "round",
|
|
32656
|
+
strokeLinejoin: "round"
|
|
32657
|
+
}
|
|
32658
|
+
),
|
|
32659
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
32660
|
+
"path",
|
|
32661
|
+
{
|
|
32662
|
+
d: "M12 8V12L15 15",
|
|
32663
|
+
strokeWidth: "2",
|
|
32664
|
+
strokeLinecap: "round",
|
|
32665
|
+
strokeLinejoin: "round"
|
|
32666
|
+
}
|
|
32667
|
+
)
|
|
32668
|
+
]
|
|
32669
|
+
}
|
|
32670
|
+
);
|
|
32671
|
+
}
|
|
32672
|
+
|
|
32673
|
+
// src/inspector/ui/icons/add-icon.tsx
|
|
32674
|
+
var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
|
|
32675
|
+
function AddIcon(props) {
|
|
32676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
32677
|
+
"svg",
|
|
32678
|
+
{
|
|
32679
|
+
...props,
|
|
32680
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
32681
|
+
width: "24",
|
|
32682
|
+
height: "24",
|
|
32683
|
+
viewBox: "0 0 24 24",
|
|
32684
|
+
fill: "none",
|
|
32685
|
+
stroke: "currentColor",
|
|
32686
|
+
strokeLinejoin: "round",
|
|
32687
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
32688
|
+
"path",
|
|
32689
|
+
{
|
|
32690
|
+
d: "M4 12H20M12 4V20",
|
|
32691
|
+
"stroke-width": "2",
|
|
32692
|
+
"stroke-linecap": "round",
|
|
32693
|
+
"stroke-linejoin": "round"
|
|
32694
|
+
}
|
|
32695
|
+
)
|
|
32696
|
+
}
|
|
32697
|
+
);
|
|
32698
|
+
}
|
|
32699
|
+
|
|
32610
32700
|
// src/inspector/ui/icon.tsx
|
|
32611
|
-
var
|
|
32701
|
+
var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
|
|
32612
32702
|
var icons = {
|
|
32613
32703
|
caution: CautionIcon,
|
|
32614
32704
|
chevronDown: ChevronDownIcon,
|
|
32615
32705
|
delete: DeleteIcon,
|
|
32616
|
-
|
|
32706
|
+
edit: EditIcon,
|
|
32707
|
+
link: LinkIcon,
|
|
32708
|
+
history: HistoryIcon,
|
|
32709
|
+
add: AddIcon
|
|
32617
32710
|
};
|
|
32618
32711
|
var sizes = {
|
|
32619
32712
|
"2xs": 14,
|
|
@@ -32657,7 +32750,7 @@ function Icon({
|
|
|
32657
32750
|
throw new Error(`Icon not found: ${name}`);
|
|
32658
32751
|
}
|
|
32659
32752
|
const IconComponent = icons?.hasOwnProperty(name) ? icons[name] : icon;
|
|
32660
|
-
return /* @__PURE__ */ (0,
|
|
32753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
32661
32754
|
IconComponent,
|
|
32662
32755
|
{
|
|
32663
32756
|
"aria-hidden": "true",
|
|
@@ -32670,7 +32763,7 @@ function Icon({
|
|
|
32670
32763
|
}
|
|
32671
32764
|
|
|
32672
32765
|
// src/inspector/viewer/value-renderer.tsx
|
|
32673
|
-
var
|
|
32766
|
+
var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
|
|
32674
32767
|
var LinkContainer = styled9("span")`
|
|
32675
32768
|
display: inline-flex;
|
|
32676
32769
|
gap: 0.25rem;
|
|
@@ -32734,18 +32827,18 @@ function ValueRenderer({
|
|
|
32734
32827
|
}) {
|
|
32735
32828
|
const [isExpanded, setIsExpanded] = (0, import_react8.useState)(false);
|
|
32736
32829
|
if (typeof json === "undefined" || json === void 0) {
|
|
32737
|
-
return /* @__PURE__ */ (0,
|
|
32830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { muted: true, children: "undefined" });
|
|
32738
32831
|
}
|
|
32739
32832
|
if (json === null) {
|
|
32740
|
-
return /* @__PURE__ */ (0,
|
|
32833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { muted: true, children: "null" });
|
|
32741
32834
|
}
|
|
32742
32835
|
if (typeof json === "string" && isCoId(json)) {
|
|
32743
|
-
const content = /* @__PURE__ */ (0,
|
|
32836
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
32744
32837
|
json,
|
|
32745
|
-
onCoIDClick && /* @__PURE__ */ (0,
|
|
32838
|
+
onCoIDClick && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { name: "link" })
|
|
32746
32839
|
] });
|
|
32747
32840
|
if (onCoIDClick) {
|
|
32748
|
-
return /* @__PURE__ */ (0,
|
|
32841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
32749
32842
|
Button,
|
|
32750
32843
|
{
|
|
32751
32844
|
variant: "link",
|
|
@@ -32756,35 +32849,35 @@ function ValueRenderer({
|
|
|
32756
32849
|
}
|
|
32757
32850
|
);
|
|
32758
32851
|
}
|
|
32759
|
-
return /* @__PURE__ */ (0,
|
|
32852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LinkContainer, { children: content });
|
|
32760
32853
|
}
|
|
32761
32854
|
if (typeof json === "string") {
|
|
32762
|
-
return /* @__PURE__ */ (0,
|
|
32855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: json });
|
|
32763
32856
|
}
|
|
32764
32857
|
if (typeof json === "number") {
|
|
32765
|
-
return /* @__PURE__ */ (0,
|
|
32858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { mono: true, children: json });
|
|
32766
32859
|
}
|
|
32767
32860
|
if (typeof json === "boolean") {
|
|
32768
|
-
return /* @__PURE__ */ (0,
|
|
32861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BooleanText, { value: json, children: json.toString() });
|
|
32769
32862
|
}
|
|
32770
32863
|
const longJson = JSON.stringify(json, null, 2);
|
|
32771
32864
|
const shortJson = longJson.split("\n").slice(0, compact ? 3 : 8).join("\n");
|
|
32772
32865
|
const hasDifference = longJson !== shortJson;
|
|
32773
32866
|
if (typeof json === "object") {
|
|
32774
|
-
return /* @__PURE__ */ (0,
|
|
32775
|
-
/* @__PURE__ */ (0,
|
|
32867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
32868
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: Array.isArray(json) ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
32776
32869
|
"Array (",
|
|
32777
32870
|
json.length,
|
|
32778
32871
|
")"
|
|
32779
|
-
] }) : /* @__PURE__ */ (0,
|
|
32780
|
-
/* @__PURE__ */ (0,
|
|
32872
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: "Object" }) }),
|
|
32873
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ObjectContent, { children: [
|
|
32781
32874
|
isExpanded ? longJson : shortJson,
|
|
32782
32875
|
hasDifference && !isExpanded ? "\n ..." : null
|
|
32783
32876
|
] }),
|
|
32784
|
-
!compact && hasDifference ? /* @__PURE__ */ (0,
|
|
32877
|
+
!compact && hasDifference ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "link", onClick: () => setIsExpanded(!isExpanded), children: isExpanded ? "Show less" : "Show more" }) : null
|
|
32785
32878
|
] });
|
|
32786
32879
|
}
|
|
32787
|
-
return /* @__PURE__ */ (0,
|
|
32880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: String(json) });
|
|
32788
32881
|
}
|
|
32789
32882
|
var CoMapPreview = ({
|
|
32790
32883
|
coId,
|
|
@@ -32796,7 +32889,7 @@ var CoMapPreview = ({
|
|
|
32796
32889
|
node
|
|
32797
32890
|
);
|
|
32798
32891
|
if (!snapshot) {
|
|
32799
|
-
return /* @__PURE__ */ (0,
|
|
32892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
32800
32893
|
"div",
|
|
32801
32894
|
{
|
|
32802
32895
|
style: {
|
|
@@ -32811,15 +32904,15 @@ var CoMapPreview = ({
|
|
|
32811
32904
|
);
|
|
32812
32905
|
}
|
|
32813
32906
|
if (snapshot === "unavailable" && !value) {
|
|
32814
|
-
return /* @__PURE__ */ (0,
|
|
32907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { inline: true, muted: true, children: "Unavailable" });
|
|
32815
32908
|
}
|
|
32816
32909
|
if (type === "coplaintext") {
|
|
32817
|
-
return /* @__PURE__ */ (0,
|
|
32910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: value.toString() });
|
|
32818
32911
|
}
|
|
32819
32912
|
if (extendedType === "image" && isBrowserImage(snapshot)) {
|
|
32820
|
-
return /* @__PURE__ */ (0,
|
|
32821
|
-
/* @__PURE__ */ (0,
|
|
32822
|
-
/* @__PURE__ */ (0,
|
|
32913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ImagePreviewContainer2, { children: [
|
|
32914
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PreviewImage, { src: snapshot.placeholderDataURL }),
|
|
32915
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Text, { inline: true, small: true, muted: true, children: [
|
|
32823
32916
|
snapshot.originalSize[0],
|
|
32824
32917
|
" x ",
|
|
32825
32918
|
snapshot.originalSize[1]
|
|
@@ -32827,10 +32920,10 @@ var CoMapPreview = ({
|
|
|
32827
32920
|
] });
|
|
32828
32921
|
}
|
|
32829
32922
|
if (extendedType === "record") {
|
|
32830
|
-
return /* @__PURE__ */ (0,
|
|
32923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(RecordText, { children: [
|
|
32831
32924
|
"Record",
|
|
32832
32925
|
" ",
|
|
32833
|
-
/* @__PURE__ */ (0,
|
|
32926
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Text, { inline: true, muted: true, children: [
|
|
32834
32927
|
"(",
|
|
32835
32928
|
Object.keys(snapshot).length,
|
|
32836
32929
|
")"
|
|
@@ -32838,10 +32931,10 @@ var CoMapPreview = ({
|
|
|
32838
32931
|
] });
|
|
32839
32932
|
}
|
|
32840
32933
|
if (type === "colist") {
|
|
32841
|
-
return /* @__PURE__ */ (0,
|
|
32934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ListText, { children: [
|
|
32842
32935
|
"List",
|
|
32843
32936
|
" ",
|
|
32844
|
-
/* @__PURE__ */ (0,
|
|
32937
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Text, { inline: true, muted: true, children: [
|
|
32845
32938
|
"(",
|
|
32846
32939
|
snapshot.length,
|
|
32847
32940
|
")"
|
|
@@ -32852,24 +32945,209 @@ var CoMapPreview = ({
|
|
|
32852
32945
|
const limitedProperties = extendedType === "account" ? properties.filter(
|
|
32853
32946
|
([key]) => !key.startsWith("key_z") && !key.startsWith("sealer_z") && key !== "readKey"
|
|
32854
32947
|
).slice(0, limit) : properties.slice(0, limit);
|
|
32855
|
-
return /* @__PURE__ */ (0,
|
|
32856
|
-
/* @__PURE__ */ (0,
|
|
32857
|
-
/* @__PURE__ */ (0,
|
|
32948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(PreviewContainer, { children: [
|
|
32949
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PreviewGrid, { children: limitedProperties.map(([key, value2]) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react8.default.Fragment, { children: [
|
|
32950
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Text, { strong: true, children: [
|
|
32858
32951
|
key,
|
|
32859
32952
|
": "
|
|
32860
32953
|
] }),
|
|
32861
|
-
/* @__PURE__ */ (0,
|
|
32954
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ValueRenderer, { compact: true, json: value2 })
|
|
32862
32955
|
] }, key)) }),
|
|
32863
|
-
properties.length > limit && /* @__PURE__ */ (0,
|
|
32956
|
+
properties.length > limit && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(PreviewMoreText, { muted: true, small: true, children: [
|
|
32864
32957
|
properties.length - limit,
|
|
32865
32958
|
" more"
|
|
32866
32959
|
] })
|
|
32867
32960
|
] });
|
|
32868
32961
|
};
|
|
32869
32962
|
|
|
32870
|
-
// src/inspector/
|
|
32963
|
+
// src/inspector/viewer/co-value-editor.tsx
|
|
32964
|
+
var import_react10 = __toESM(require_react(), 1);
|
|
32965
|
+
import { styled as styled11 } from "goober";
|
|
32966
|
+
|
|
32967
|
+
// src/inspector/ui/select.tsx
|
|
32968
|
+
var import_react9 = __toESM(require_react(), 1);
|
|
32871
32969
|
import { styled as styled10 } from "goober";
|
|
32872
|
-
var
|
|
32970
|
+
var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
|
|
32971
|
+
var SelectContainer = styled10("div")`
|
|
32972
|
+
display: grid;
|
|
32973
|
+
gap: 0.25rem;
|
|
32974
|
+
`;
|
|
32975
|
+
var SelectWrapper = styled10("div")`
|
|
32976
|
+
position: relative;
|
|
32977
|
+
display: flex;
|
|
32978
|
+
align-items: center;
|
|
32979
|
+
`;
|
|
32980
|
+
var StyledSelect = styled10("select")`
|
|
32981
|
+
width: 100%;
|
|
32982
|
+
border-radius: var(--j-radius-md);
|
|
32983
|
+
border: 1px solid var(--j-border-color);
|
|
32984
|
+
padding: 0.5rem 0.875rem 0.5rem 0.875rem;
|
|
32985
|
+
padding-right: 2rem;
|
|
32986
|
+
box-shadow: var(--j-shadow-sm);
|
|
32987
|
+
font-weight: 500;
|
|
32988
|
+
color: var(--j-text-color-strong);
|
|
32989
|
+
appearance: none;
|
|
32990
|
+
overflow: hidden;
|
|
32991
|
+
text-overflow: ellipsis;
|
|
32992
|
+
white-space: nowrap;
|
|
32993
|
+
|
|
32994
|
+
@media (prefers-color-scheme: dark) {
|
|
32995
|
+
background-color: var(--j-foreground);
|
|
32996
|
+
}
|
|
32997
|
+
`;
|
|
32998
|
+
var SelectIcon = styled10("span")`
|
|
32999
|
+
position: absolute;
|
|
33000
|
+
right: 0.5em;
|
|
33001
|
+
color: var(--j-neutral-400);
|
|
33002
|
+
pointer-events: none;
|
|
33003
|
+
|
|
33004
|
+
@media (prefers-color-scheme: dark) {
|
|
33005
|
+
color: var(--j-neutral-900);
|
|
33006
|
+
}
|
|
33007
|
+
`;
|
|
33008
|
+
function Select(props) {
|
|
33009
|
+
const { label, hideLabel, id: customId, className, ...selectProps } = props;
|
|
33010
|
+
const generatedId = (0, import_react9.useId)();
|
|
33011
|
+
const id = customId || generatedId;
|
|
33012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(SelectContainer, { className, children: [
|
|
33013
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { htmlFor: id, className: hideLabel ? "j-sr-only" : "", children: label }),
|
|
33014
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(SelectWrapper, { children: [
|
|
33015
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StyledSelect, { ...selectProps, id, children: props.children }),
|
|
33016
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SelectIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "chevronDown", size: "sm" }) })
|
|
33017
|
+
] })
|
|
33018
|
+
] });
|
|
33019
|
+
}
|
|
33020
|
+
|
|
33021
|
+
// src/inspector/viewer/co-value-editor.tsx
|
|
33022
|
+
var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
|
|
33023
|
+
function CoValueEditor({
|
|
33024
|
+
node,
|
|
33025
|
+
property,
|
|
33026
|
+
value,
|
|
33027
|
+
coValue,
|
|
33028
|
+
onCancel
|
|
33029
|
+
}) {
|
|
33030
|
+
const getInitialType = () => {
|
|
33031
|
+
if (value === null) return "null";
|
|
33032
|
+
if (value === void 0) return "undefined";
|
|
33033
|
+
if (typeof value === "number") return "number";
|
|
33034
|
+
if (typeof value === "string") return "string";
|
|
33035
|
+
if (typeof value === "boolean") return value ? "true" : "false";
|
|
33036
|
+
if (typeof value === "object") return "object";
|
|
33037
|
+
return "undefined";
|
|
33038
|
+
};
|
|
33039
|
+
const [selectedType, setSelectedType] = (0, import_react10.useState)(getInitialType());
|
|
33040
|
+
const [editValue, setEditValue] = (0, import_react10.useState)(
|
|
33041
|
+
value === void 0 || value === null ? "" : typeof value === "object" ? JSON.stringify(value, null, 2) : String(value)
|
|
33042
|
+
);
|
|
33043
|
+
const handleSubmit = (e) => {
|
|
33044
|
+
e.preventDefault();
|
|
33045
|
+
e.stopPropagation();
|
|
33046
|
+
let newValue;
|
|
33047
|
+
switch (selectedType) {
|
|
33048
|
+
case "null":
|
|
33049
|
+
newValue = null;
|
|
33050
|
+
break;
|
|
33051
|
+
case "undefined":
|
|
33052
|
+
newValue = void 0;
|
|
33053
|
+
break;
|
|
33054
|
+
case "true":
|
|
33055
|
+
newValue = true;
|
|
33056
|
+
break;
|
|
33057
|
+
case "false":
|
|
33058
|
+
newValue = false;
|
|
33059
|
+
break;
|
|
33060
|
+
case "number":
|
|
33061
|
+
newValue = parseFloat(editValue);
|
|
33062
|
+
break;
|
|
33063
|
+
case "string":
|
|
33064
|
+
newValue = editValue;
|
|
33065
|
+
break;
|
|
33066
|
+
case "object":
|
|
33067
|
+
newValue = JSON.parse(editValue);
|
|
33068
|
+
break;
|
|
33069
|
+
default:
|
|
33070
|
+
throw new Error(`Invalid type: ${selectedType}`);
|
|
33071
|
+
}
|
|
33072
|
+
coValue.core.makeTransaction(
|
|
33073
|
+
[
|
|
33074
|
+
{
|
|
33075
|
+
op: "set",
|
|
33076
|
+
key: property,
|
|
33077
|
+
value: newValue
|
|
33078
|
+
}
|
|
33079
|
+
],
|
|
33080
|
+
"private"
|
|
33081
|
+
);
|
|
33082
|
+
onCancel();
|
|
33083
|
+
};
|
|
33084
|
+
const showTextarea = selectedType === "number" || selectedType === "string" || selectedType === "object";
|
|
33085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(EditForm, { onSubmit: handleSubmit, children: [
|
|
33086
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
33087
|
+
Select,
|
|
33088
|
+
{
|
|
33089
|
+
label: "Type",
|
|
33090
|
+
value: selectedType,
|
|
33091
|
+
onChange: (e) => {
|
|
33092
|
+
setSelectedType(e.target.value);
|
|
33093
|
+
},
|
|
33094
|
+
onClick: (e) => e.stopPropagation(),
|
|
33095
|
+
children: [
|
|
33096
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "number", children: "number" }),
|
|
33097
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "string", children: "string" }),
|
|
33098
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "true", children: "true" }),
|
|
33099
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "false", children: "false" }),
|
|
33100
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "object", children: "object" }),
|
|
33101
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "null", children: "null" }),
|
|
33102
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "undefined", children: "undefined" })
|
|
33103
|
+
]
|
|
33104
|
+
}
|
|
33105
|
+
),
|
|
33106
|
+
showTextarea && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
33107
|
+
StyledTextarea,
|
|
33108
|
+
{
|
|
33109
|
+
value: editValue,
|
|
33110
|
+
onChange: (e) => setEditValue(e.target.value),
|
|
33111
|
+
onClick: (e) => e.stopPropagation()
|
|
33112
|
+
}
|
|
33113
|
+
),
|
|
33114
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(FormActions, { children: [
|
|
33115
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { type: "button", variant: "secondary", onClick: onCancel, children: "Cancel" }),
|
|
33116
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { type: "submit", variant: "primary", children: "Submit" })
|
|
33117
|
+
] })
|
|
33118
|
+
] });
|
|
33119
|
+
}
|
|
33120
|
+
var EditForm = styled11("form")`
|
|
33121
|
+
display: flex;
|
|
33122
|
+
flex-direction: column;
|
|
33123
|
+
gap: 0.75rem;
|
|
33124
|
+
`;
|
|
33125
|
+
var StyledTextarea = styled11("textarea")`
|
|
33126
|
+
width: 100%;
|
|
33127
|
+
min-height: 120px;
|
|
33128
|
+
border-radius: var(--j-radius-md);
|
|
33129
|
+
border: 1px solid var(--j-border-color);
|
|
33130
|
+
padding: 0.5rem 0.875rem;
|
|
33131
|
+
box-shadow: var(--j-shadow-sm);
|
|
33132
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
33133
|
+
font-size: 0.875rem;
|
|
33134
|
+
background-color: white;
|
|
33135
|
+
color: var(--j-text-color-strong);
|
|
33136
|
+
resize: vertical;
|
|
33137
|
+
|
|
33138
|
+
@media (prefers-color-scheme: dark) {
|
|
33139
|
+
background-color: var(--j-foreground);
|
|
33140
|
+
}
|
|
33141
|
+
`;
|
|
33142
|
+
var FormActions = styled11("div")`
|
|
33143
|
+
display: flex;
|
|
33144
|
+
gap: 0.5rem;
|
|
33145
|
+
justify-content: flex-end;
|
|
33146
|
+
`;
|
|
33147
|
+
|
|
33148
|
+
// src/inspector/ui/card.tsx
|
|
33149
|
+
import { styled as styled12 } from "goober";
|
|
33150
|
+
var Card = styled12("div")`
|
|
32873
33151
|
background-color: var(--j-background);
|
|
32874
33152
|
border-radius: var(--j-radius-lg);
|
|
32875
33153
|
box-shadow: var(--j-shadow-sm);
|
|
@@ -32881,19 +33159,19 @@ var Card = styled10("div")`
|
|
|
32881
33159
|
flex-direction: column;
|
|
32882
33160
|
gap: 0.5rem;
|
|
32883
33161
|
`;
|
|
32884
|
-
var CardHeader =
|
|
33162
|
+
var CardHeader = styled12("div")`
|
|
32885
33163
|
display: flex;
|
|
32886
33164
|
justify-content: space-between;
|
|
32887
33165
|
align-items: center;
|
|
32888
33166
|
`;
|
|
32889
|
-
var CardBody =
|
|
33167
|
+
var CardBody = styled12("div")`
|
|
32890
33168
|
flex: 1;
|
|
32891
33169
|
`;
|
|
32892
33170
|
|
|
32893
33171
|
// src/inspector/ui/grid.tsx
|
|
32894
|
-
var
|
|
32895
|
-
import { styled as
|
|
32896
|
-
var GridThreeColumns =
|
|
33172
|
+
var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
|
|
33173
|
+
import { styled as styled13 } from "goober";
|
|
33174
|
+
var GridThreeColumns = styled13("div")`
|
|
32897
33175
|
display: grid;
|
|
32898
33176
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
32899
33177
|
gap: 1rem;
|
|
@@ -32906,7 +33184,7 @@ var GridThreeColumns = styled11("div")`
|
|
|
32906
33184
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
32907
33185
|
}
|
|
32908
33186
|
`;
|
|
32909
|
-
var GridTwoColumns =
|
|
33187
|
+
var GridTwoColumns = styled13("div")`
|
|
32910
33188
|
display: grid;
|
|
32911
33189
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
32912
33190
|
gap: 1rem;
|
|
@@ -32915,7 +33193,7 @@ var GridTwoColumns = styled11("div")`
|
|
|
32915
33193
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
32916
33194
|
}
|
|
32917
33195
|
`;
|
|
32918
|
-
var GridOneColumn =
|
|
33196
|
+
var GridOneColumn = styled13("div")`
|
|
32919
33197
|
display: grid;
|
|
32920
33198
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
32921
33199
|
gap: 1rem;
|
|
@@ -32924,26 +33202,81 @@ function Grid(props) {
|
|
|
32924
33202
|
const { cols, children, ...rest } = props;
|
|
32925
33203
|
switch (cols) {
|
|
32926
33204
|
case 1:
|
|
32927
|
-
return /* @__PURE__ */ (0,
|
|
33205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridOneColumn, { ...rest, children });
|
|
32928
33206
|
case 2:
|
|
32929
|
-
return /* @__PURE__ */ (0,
|
|
33207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridTwoColumns, { ...rest, children });
|
|
32930
33208
|
case 3:
|
|
32931
|
-
return /* @__PURE__ */ (0,
|
|
33209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridThreeColumns, { ...rest, children });
|
|
32932
33210
|
default:
|
|
32933
33211
|
throw new Error(`Invalid number of columns: ${cols}`);
|
|
32934
33212
|
}
|
|
32935
33213
|
}
|
|
32936
33214
|
|
|
33215
|
+
// src/inspector/utils/permissions.ts
|
|
33216
|
+
function isWriter(role) {
|
|
33217
|
+
return role === "writer" || role === "admin" || role === "manager" || role === "writeOnly";
|
|
33218
|
+
}
|
|
33219
|
+
|
|
32937
33220
|
// src/inspector/viewer/grid-view.tsx
|
|
32938
|
-
var
|
|
33221
|
+
var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
|
|
32939
33222
|
function GridItem({
|
|
32940
33223
|
entry,
|
|
32941
33224
|
onNavigate,
|
|
32942
|
-
node
|
|
33225
|
+
node,
|
|
33226
|
+
coValue
|
|
32943
33227
|
}) {
|
|
32944
33228
|
const [key, value] = entry;
|
|
32945
33229
|
const isCoValue = isCoId(value);
|
|
32946
|
-
const
|
|
33230
|
+
const [isEditing, setIsEditing] = (0, import_react11.useState)(false);
|
|
33231
|
+
const handleEditClick = (e) => {
|
|
33232
|
+
e.stopPropagation();
|
|
33233
|
+
setIsEditing(true);
|
|
33234
|
+
};
|
|
33235
|
+
const handleCancel = () => {
|
|
33236
|
+
setIsEditing(false);
|
|
33237
|
+
};
|
|
33238
|
+
const handleDelete = (e) => {
|
|
33239
|
+
e.stopPropagation();
|
|
33240
|
+
if (confirm(`Are you sure you want to delete the property "${key}"?`)) {
|
|
33241
|
+
coValue?.core.makeTransaction(
|
|
33242
|
+
[
|
|
33243
|
+
{
|
|
33244
|
+
op: "del",
|
|
33245
|
+
key
|
|
33246
|
+
}
|
|
33247
|
+
],
|
|
33248
|
+
"private"
|
|
33249
|
+
);
|
|
33250
|
+
}
|
|
33251
|
+
};
|
|
33252
|
+
if (isEditing) {
|
|
33253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
33254
|
+
Card,
|
|
33255
|
+
{
|
|
33256
|
+
style: {
|
|
33257
|
+
backgroundColor: "var(--j-foreground)",
|
|
33258
|
+
borderColor: "var(--j-foreground)"
|
|
33259
|
+
},
|
|
33260
|
+
children: [
|
|
33261
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: isCoValue ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
33262
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { strong: true, children: key }),
|
|
33263
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Badge, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ResolveIcon, { coId: value, node }) })
|
|
33264
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { strong: true, children: key }) }) }),
|
|
33265
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardBody, { style: { wordBreak: "break-word" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
33266
|
+
CoValueEditor,
|
|
33267
|
+
{
|
|
33268
|
+
node,
|
|
33269
|
+
property: key,
|
|
33270
|
+
value,
|
|
33271
|
+
coValue,
|
|
33272
|
+
onCancel: handleCancel
|
|
33273
|
+
}
|
|
33274
|
+
) })
|
|
33275
|
+
]
|
|
33276
|
+
}
|
|
33277
|
+
);
|
|
33278
|
+
}
|
|
33279
|
+
const cardProps = isCoValue ? {
|
|
32947
33280
|
onClick: () => onNavigate([{ coId: value, name: key }]),
|
|
32948
33281
|
as: "button"
|
|
32949
33282
|
} : {
|
|
@@ -32952,12 +33285,34 @@ function GridItem({
|
|
|
32952
33285
|
borderColor: "var(--j-foreground)"
|
|
32953
33286
|
}
|
|
32954
33287
|
};
|
|
32955
|
-
return /* @__PURE__ */ (0,
|
|
32956
|
-
/* @__PURE__ */ (0,
|
|
32957
|
-
/* @__PURE__ */ (0,
|
|
32958
|
-
|
|
32959
|
-
|
|
32960
|
-
|
|
33288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Card, { ...cardProps, children: [
|
|
33289
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(CardHeader, { children: [
|
|
33290
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: isCoValue ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
33291
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { strong: true, children: key }),
|
|
33292
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Badge, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ResolveIcon, { coId: value, node }) })
|
|
33293
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { strong: true, children: key }) }),
|
|
33294
|
+
coValue && isWriter(coValue.group.myRole()) && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ActionButtons, { children: [
|
|
33295
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
33296
|
+
EditButton,
|
|
33297
|
+
{
|
|
33298
|
+
onClick: handleEditClick,
|
|
33299
|
+
type: "button",
|
|
33300
|
+
"aria-label": "Edit",
|
|
33301
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "edit", size: "sm" })
|
|
33302
|
+
}
|
|
33303
|
+
),
|
|
33304
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
33305
|
+
DeleteButton,
|
|
33306
|
+
{
|
|
33307
|
+
onClick: handleDelete,
|
|
33308
|
+
type: "button",
|
|
33309
|
+
"aria-label": "Delete",
|
|
33310
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "delete", size: "sm" })
|
|
33311
|
+
}
|
|
33312
|
+
)
|
|
33313
|
+
] })
|
|
33314
|
+
] }),
|
|
33315
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardBody, { style: { wordBreak: "break-word" }, children: isCoValue ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CoMapPreview, { coId: value, node }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
32961
33316
|
ValueRenderer,
|
|
32962
33317
|
{
|
|
32963
33318
|
json: value,
|
|
@@ -32971,58 +33326,97 @@ function GridItem({
|
|
|
32971
33326
|
function GridView({
|
|
32972
33327
|
data,
|
|
32973
33328
|
onNavigate,
|
|
32974
|
-
node
|
|
33329
|
+
node,
|
|
33330
|
+
coValue
|
|
32975
33331
|
}) {
|
|
32976
33332
|
const entries = Object.entries(data);
|
|
32977
|
-
return /* @__PURE__ */ (0,
|
|
33333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Grid, { cols: entries.length === 1 ? 1 : 3, children: entries.map((entry, childIndex) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
32978
33334
|
GridItem,
|
|
32979
33335
|
{
|
|
32980
33336
|
entry,
|
|
32981
33337
|
onNavigate,
|
|
32982
|
-
node
|
|
33338
|
+
node,
|
|
33339
|
+
coValue
|
|
32983
33340
|
},
|
|
32984
33341
|
childIndex
|
|
32985
33342
|
)) });
|
|
32986
33343
|
}
|
|
33344
|
+
var EditButton = styled14("button")`
|
|
33345
|
+
display: inline-flex;
|
|
33346
|
+
align-items: center;
|
|
33347
|
+
justify-content: center;
|
|
33348
|
+
padding: 0.25rem;
|
|
33349
|
+
border: none;
|
|
33350
|
+
background: transparent;
|
|
33351
|
+
cursor: pointer;
|
|
33352
|
+
color: var(--j-text-color);
|
|
33353
|
+
border-radius: var(--j-radius-sm);
|
|
33354
|
+
transition: background-color 0.2s;
|
|
32987
33355
|
|
|
32988
|
-
|
|
32989
|
-
var
|
|
32990
|
-
|
|
32991
|
-
|
|
32992
|
-
var
|
|
32993
|
-
|
|
32994
|
-
|
|
32995
|
-
|
|
32996
|
-
|
|
32997
|
-
border
|
|
32998
|
-
|
|
32999
|
-
|
|
33356
|
+
&:hover {
|
|
33357
|
+
background-color: var(--j-foreground);
|
|
33358
|
+
}
|
|
33359
|
+
`;
|
|
33360
|
+
var DeleteButton = styled14("button")`
|
|
33361
|
+
display: inline-flex;
|
|
33362
|
+
align-items: center;
|
|
33363
|
+
justify-content: center;
|
|
33364
|
+
padding: 0.25rem;
|
|
33365
|
+
border: none;
|
|
33366
|
+
background: transparent;
|
|
33367
|
+
cursor: pointer;
|
|
33368
|
+
color: var(--j-text-color);
|
|
33369
|
+
border-radius: var(--j-radius-sm);
|
|
33370
|
+
transition: background-color 0.2s;
|
|
33371
|
+
|
|
33372
|
+
&:hover {
|
|
33373
|
+
background-color: var(--j-foreground);
|
|
33374
|
+
}
|
|
33375
|
+
`;
|
|
33376
|
+
var ActionButtons = styled14("div")`
|
|
33377
|
+
display: flex;
|
|
33378
|
+
align-items: center;
|
|
33379
|
+
gap: 0.25rem;
|
|
33380
|
+
`;
|
|
33381
|
+
|
|
33382
|
+
// src/inspector/viewer/raw-data-card.tsx
|
|
33383
|
+
var import_react16 = __toESM(require_react(), 1);
|
|
33384
|
+
|
|
33385
|
+
// src/inspector/ui/modal.tsx
|
|
33386
|
+
var import_react12 = __toESM(require_react(), 1);
|
|
33387
|
+
import { styled as styled15 } from "goober";
|
|
33388
|
+
var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
|
|
33389
|
+
var ModalContent = styled15("dialog")`
|
|
33390
|
+
background-color: var(--j-background);
|
|
33391
|
+
border-radius: var(--j-radius-lg);
|
|
33392
|
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
|
33393
|
+
border: 1px solid var(--j-border-color);
|
|
33000
33394
|
max-width: 32rem;
|
|
33001
33395
|
margin-block: auto;
|
|
33002
33396
|
margin-inline: auto;
|
|
33003
33397
|
&::backdrop {
|
|
33004
33398
|
background-color: rgba(0, 0, 0, 0.7);
|
|
33005
33399
|
}
|
|
33006
|
-
|
|
33400
|
+
|
|
33007
33401
|
`;
|
|
33008
|
-
var ModalHeader =
|
|
33402
|
+
var ModalHeader = styled15("div")`
|
|
33009
33403
|
display: flex;
|
|
33010
33404
|
justify-content: space-between;
|
|
33011
33405
|
align-items: flex-start;
|
|
33012
33406
|
padding: 1.5rem 1.5rem 0 1.5rem;
|
|
33013
33407
|
gap: 1rem;
|
|
33014
33408
|
`;
|
|
33015
|
-
var ModalBody =
|
|
33409
|
+
var ModalBody = styled15("div")`
|
|
33016
33410
|
padding: 1rem 1.5rem;
|
|
33017
33411
|
flex: 1;
|
|
33018
33412
|
`;
|
|
33019
|
-
var ModalFooter =
|
|
33413
|
+
var ModalFooter = styled15("div")`
|
|
33020
33414
|
display: flex;
|
|
33021
33415
|
justify-content: flex-end;
|
|
33022
33416
|
gap: 0.75rem;
|
|
33023
33417
|
padding: 0 1.5rem 1.5rem 1.5rem;
|
|
33024
33418
|
`;
|
|
33025
|
-
var CloseButton =
|
|
33419
|
+
var CloseButton = styled15("button")`
|
|
33026
33420
|
background: none;
|
|
33027
33421
|
border: none;
|
|
33028
33422
|
cursor: pointer;
|
|
@@ -33036,17 +33430,17 @@ var CloseButton = styled12("button")`
|
|
|
33036
33430
|
justify-content: center;
|
|
33037
33431
|
min-width: 2rem;
|
|
33038
33432
|
min-height: 2rem;
|
|
33039
|
-
|
|
33433
|
+
|
|
33040
33434
|
&:hover {
|
|
33041
33435
|
background-color: var(--j-foreground);
|
|
33042
33436
|
}
|
|
33043
|
-
|
|
33437
|
+
|
|
33044
33438
|
&:focus-visible {
|
|
33045
33439
|
outline: 2px solid var(--j-border-focus);
|
|
33046
33440
|
outline-offset: 2px;
|
|
33047
33441
|
}
|
|
33048
33442
|
`;
|
|
33049
|
-
var Modal = (0,
|
|
33443
|
+
var Modal = (0, import_react12.forwardRef)(
|
|
33050
33444
|
({
|
|
33051
33445
|
isOpen,
|
|
33052
33446
|
onClose,
|
|
@@ -33060,8 +33454,8 @@ var Modal = (0, import_react9.forwardRef)(
|
|
|
33060
33454
|
showButtons = true,
|
|
33061
33455
|
className
|
|
33062
33456
|
}, ref) => {
|
|
33063
|
-
const modalRef = (0,
|
|
33064
|
-
(0,
|
|
33457
|
+
const modalRef = (0, import_react12.useRef)(null);
|
|
33458
|
+
(0, import_react12.useEffect)(() => {
|
|
33065
33459
|
if (isOpen) {
|
|
33066
33460
|
modalRef.current?.showModal();
|
|
33067
33461
|
} else {
|
|
@@ -33078,7 +33472,7 @@ var Modal = (0, import_react9.forwardRef)(
|
|
|
33078
33472
|
onClose();
|
|
33079
33473
|
};
|
|
33080
33474
|
if (!isOpen) return null;
|
|
33081
|
-
return /* @__PURE__ */ (0,
|
|
33475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
33082
33476
|
ModalContent,
|
|
33083
33477
|
{
|
|
33084
33478
|
ref: ref || modalRef,
|
|
@@ -33087,17 +33481,17 @@ var Modal = (0, import_react9.forwardRef)(
|
|
|
33087
33481
|
"aria-labelledby": "modal-heading",
|
|
33088
33482
|
onClose,
|
|
33089
33483
|
children: [
|
|
33090
|
-
/* @__PURE__ */ (0,
|
|
33091
|
-
/* @__PURE__ */ (0,
|
|
33092
|
-
/* @__PURE__ */ (0,
|
|
33484
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(ModalHeader, { children: [
|
|
33485
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Heading, { id: "modal-heading", children: heading }),
|
|
33486
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CloseButton, { onClick: onClose, "aria-label": "Close modal", type: "button", children: "\xD7" })
|
|
33093
33487
|
] }),
|
|
33094
|
-
/* @__PURE__ */ (0,
|
|
33095
|
-
text && /* @__PURE__ */ (0,
|
|
33488
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(ModalBody, { children: [
|
|
33489
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { style: { margin: "0 0 1rem 0", color: "var(--j-text-color)" }, children: text }),
|
|
33096
33490
|
children
|
|
33097
33491
|
] }),
|
|
33098
|
-
showButtons && /* @__PURE__ */ (0,
|
|
33099
|
-
/* @__PURE__ */ (0,
|
|
33100
|
-
/* @__PURE__ */ (0,
|
|
33492
|
+
showButtons && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(ModalFooter, { children: [
|
|
33493
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button, { variant: "secondary", onClick: handleCancel, children: cancelText }),
|
|
33494
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button, { variant: "primary", onClick: handleConfirm, children: confirmText })
|
|
33101
33495
|
] })
|
|
33102
33496
|
]
|
|
33103
33497
|
}
|
|
@@ -33106,71 +33500,17 @@ var Modal = (0, import_react9.forwardRef)(
|
|
|
33106
33500
|
);
|
|
33107
33501
|
Modal.displayName = "Modal";
|
|
33108
33502
|
|
|
33109
|
-
// src/inspector/ui/select.tsx
|
|
33110
|
-
var import_react10 = __toESM(require_react(), 1);
|
|
33111
|
-
import { styled as styled13 } from "goober";
|
|
33112
|
-
var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
|
|
33113
|
-
var SelectContainer = styled13("div")`
|
|
33114
|
-
display: grid;
|
|
33115
|
-
gap: 0.25rem;
|
|
33116
|
-
`;
|
|
33117
|
-
var SelectWrapper = styled13("div")`
|
|
33118
|
-
position: relative;
|
|
33119
|
-
display: flex;
|
|
33120
|
-
align-items: center;
|
|
33121
|
-
`;
|
|
33122
|
-
var StyledSelect = styled13("select")`
|
|
33123
|
-
width: 100%;
|
|
33124
|
-
border-radius: var(--j-radius-md);
|
|
33125
|
-
border: 1px solid var(--j-border-color);
|
|
33126
|
-
padding: 0.5rem 0.875rem 0.5rem 0.875rem;
|
|
33127
|
-
padding-right: 2rem;
|
|
33128
|
-
box-shadow: var(--j-shadow-sm);
|
|
33129
|
-
font-weight: 500;
|
|
33130
|
-
color: var(--j-text-color-strong);
|
|
33131
|
-
appearance: none;
|
|
33132
|
-
overflow: hidden;
|
|
33133
|
-
text-overflow: ellipsis;
|
|
33134
|
-
white-space: nowrap;
|
|
33135
|
-
|
|
33136
|
-
@media (prefers-color-scheme: dark) {
|
|
33137
|
-
background-color: var(--j-foreground);
|
|
33138
|
-
}
|
|
33139
|
-
`;
|
|
33140
|
-
var SelectIcon = styled13("span")`
|
|
33141
|
-
position: absolute;
|
|
33142
|
-
right: 0.5em;
|
|
33143
|
-
color: var(--j-neutral-400);
|
|
33144
|
-
pointer-events: none;
|
|
33145
|
-
|
|
33146
|
-
@media (prefers-color-scheme: dark) {
|
|
33147
|
-
color: var(--j-neutral-900);
|
|
33148
|
-
}
|
|
33149
|
-
`;
|
|
33150
|
-
function Select(props) {
|
|
33151
|
-
const { label, hideLabel, id: customId, className, ...selectProps } = props;
|
|
33152
|
-
const generatedId = (0, import_react10.useId)();
|
|
33153
|
-
const id = customId || generatedId;
|
|
33154
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(SelectContainer, { className, children: [
|
|
33155
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { htmlFor: id, className: hideLabel ? "j-sr-only" : "", children: label }),
|
|
33156
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(SelectWrapper, { children: [
|
|
33157
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StyledSelect, { ...selectProps, id, children: props.children }),
|
|
33158
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SelectIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "chevronDown", size: "sm" }) })
|
|
33159
|
-
] })
|
|
33160
|
-
] });
|
|
33161
|
-
}
|
|
33162
|
-
|
|
33163
33503
|
// src/inspector/ui/data-table.tsx
|
|
33164
|
-
var
|
|
33504
|
+
var import_react14 = __toESM(require_react(), 1);
|
|
33165
33505
|
|
|
33166
33506
|
// src/inspector/ui/table.tsx
|
|
33167
|
-
var
|
|
33168
|
-
var
|
|
33169
|
-
import { styled as
|
|
33170
|
-
var StyledTable =
|
|
33507
|
+
var import_react13 = __toESM(require_react(), 1);
|
|
33508
|
+
var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
|
|
33509
|
+
import { styled as styled16 } from "goober";
|
|
33510
|
+
var StyledTable = styled16("table")`
|
|
33171
33511
|
width: 100%;
|
|
33172
33512
|
`;
|
|
33173
|
-
var StyledThead =
|
|
33513
|
+
var StyledThead = styled16("thead")`
|
|
33174
33514
|
text-align: left;
|
|
33175
33515
|
border-bottom: 1px solid var(--j-border-color);
|
|
33176
33516
|
background-color: var(--j-neutral-100);
|
|
@@ -33179,7 +33519,7 @@ var StyledThead = styled14("thead")`
|
|
|
33179
33519
|
background-color: var(--j-neutral-925);
|
|
33180
33520
|
}
|
|
33181
33521
|
`;
|
|
33182
|
-
var StyledTbody =
|
|
33522
|
+
var StyledTbody = styled16("tbody")`
|
|
33183
33523
|
tr {
|
|
33184
33524
|
border-bottom: 1px solid var(--j-border-color);
|
|
33185
33525
|
|
|
@@ -33188,23 +33528,23 @@ var StyledTbody = styled14("tbody")`
|
|
|
33188
33528
|
}
|
|
33189
33529
|
}
|
|
33190
33530
|
`;
|
|
33191
|
-
var StyledTh =
|
|
33531
|
+
var StyledTh = styled16("th")`
|
|
33192
33532
|
font-weight: 500;
|
|
33193
33533
|
padding: 0.5rem 0.75rem;
|
|
33194
33534
|
color: var(--j-text-color-strong);
|
|
33195
33535
|
`;
|
|
33196
|
-
var StyledTd =
|
|
33536
|
+
var StyledTd = styled16("td")`
|
|
33197
33537
|
padding: 0.5rem 0.75rem;
|
|
33198
33538
|
`;
|
|
33199
|
-
var Table =
|
|
33200
|
-
var TableHead =
|
|
33201
|
-
var TableBody =
|
|
33202
|
-
var TableRow =
|
|
33203
|
-
var TableHeader =
|
|
33204
|
-
var TableCell =
|
|
33539
|
+
var Table = import_react13.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledTable, { ref, ...props, children }));
|
|
33540
|
+
var TableHead = import_react13.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledThead, { ref, ...props, children }));
|
|
33541
|
+
var TableBody = import_react13.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledTbody, { ref, ...props, children }));
|
|
33542
|
+
var TableRow = import_react13.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("tr", { ref, ...props, children }));
|
|
33543
|
+
var TableHeader = import_react13.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledTh, { ref, ...props, children }));
|
|
33544
|
+
var TableCell = import_react13.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledTd, { ref, ...props, children }));
|
|
33205
33545
|
|
|
33206
33546
|
// src/inspector/ui/data-table.tsx
|
|
33207
|
-
var
|
|
33547
|
+
var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
|
|
33208
33548
|
function DataTable({
|
|
33209
33549
|
columns,
|
|
33210
33550
|
data,
|
|
@@ -33213,10 +33553,10 @@ function DataTable({
|
|
|
33213
33553
|
getRowKey,
|
|
33214
33554
|
emptyMessage = "No data available"
|
|
33215
33555
|
}) {
|
|
33216
|
-
const [currentPage, setCurrentPage] = (0,
|
|
33217
|
-
const [sortConfig, setSortConfig] = (0,
|
|
33218
|
-
const [filters, setFilters] = (0,
|
|
33219
|
-
const filteredData = (0,
|
|
33556
|
+
const [currentPage, setCurrentPage] = (0, import_react14.useState)(1);
|
|
33557
|
+
const [sortConfig, setSortConfig] = (0, import_react14.useState)(initialSort);
|
|
33558
|
+
const [filters, setFilters] = (0, import_react14.useState)({});
|
|
33559
|
+
const filteredData = (0, import_react14.useMemo)(() => {
|
|
33220
33560
|
return data.filter((row) => {
|
|
33221
33561
|
return Object.entries(filters).every(([columnId, filterValue]) => {
|
|
33222
33562
|
if (!filterValue) return true;
|
|
@@ -33230,7 +33570,7 @@ function DataTable({
|
|
|
33230
33570
|
});
|
|
33231
33571
|
});
|
|
33232
33572
|
}, [data, filters, columns]);
|
|
33233
|
-
const sortedData = (0,
|
|
33573
|
+
const sortedData = (0, import_react14.useMemo)(() => {
|
|
33234
33574
|
if (!sortConfig) return filteredData;
|
|
33235
33575
|
const column = columns.find((col) => col.id === sortConfig.columnId);
|
|
33236
33576
|
if (!column?.sortable) return filteredData;
|
|
@@ -33249,7 +33589,7 @@ function DataTable({
|
|
|
33249
33589
|
const startIndex = (currentPage - 1) * pageSize;
|
|
33250
33590
|
const endIndex = startIndex + pageSize;
|
|
33251
33591
|
const paginatedData = sortedData.slice(startIndex, endIndex);
|
|
33252
|
-
(0,
|
|
33592
|
+
(0, import_react14.useEffect)(() => {
|
|
33253
33593
|
setCurrentPage(1);
|
|
33254
33594
|
}, [filters]);
|
|
33255
33595
|
const handleSort = (columnId) => {
|
|
@@ -33274,9 +33614,9 @@ function DataTable({
|
|
|
33274
33614
|
const handlePageChange = (page) => {
|
|
33275
33615
|
setCurrentPage(Math.max(1, Math.min(page, totalPages)));
|
|
33276
33616
|
};
|
|
33277
|
-
return /* @__PURE__ */ (0,
|
|
33278
|
-
/* @__PURE__ */ (0,
|
|
33279
|
-
/* @__PURE__ */ (0,
|
|
33617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
33618
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Table, { children: [
|
|
33619
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableRow, { children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
33280
33620
|
"div",
|
|
33281
33621
|
{
|
|
33282
33622
|
style: {
|
|
@@ -33287,8 +33627,8 @@ function DataTable({
|
|
|
33287
33627
|
},
|
|
33288
33628
|
onClick: () => handleSort(column.id),
|
|
33289
33629
|
children: [
|
|
33290
|
-
/* @__PURE__ */ (0,
|
|
33291
|
-
column.sortable && /* @__PURE__ */ (0,
|
|
33630
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: column.header }),
|
|
33631
|
+
column.sortable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33292
33632
|
"span",
|
|
33293
33633
|
{
|
|
33294
33634
|
style: {
|
|
@@ -33301,8 +33641,8 @@ function DataTable({
|
|
|
33301
33641
|
]
|
|
33302
33642
|
}
|
|
33303
33643
|
) }, column.id)) }) }),
|
|
33304
|
-
/* @__PURE__ */ (0,
|
|
33305
|
-
columns.some((column) => column.filterable) && /* @__PURE__ */ (0,
|
|
33644
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(TableBody, { children: [
|
|
33645
|
+
columns.some((column) => column.filterable) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableRow, { children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableCell, { children: column.filterable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33306
33646
|
Input,
|
|
33307
33647
|
{
|
|
33308
33648
|
label: "Filter",
|
|
@@ -33314,7 +33654,7 @@ function DataTable({
|
|
|
33314
33654
|
onClick: (e) => e.stopPropagation()
|
|
33315
33655
|
}
|
|
33316
33656
|
) }, column.id)) }),
|
|
33317
|
-
paginatedData.length === 0 ? /* @__PURE__ */ (0,
|
|
33657
|
+
paginatedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableCell, { colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33318
33658
|
"div",
|
|
33319
33659
|
{
|
|
33320
33660
|
style: {
|
|
@@ -33324,10 +33664,10 @@ function DataTable({
|
|
|
33324
33664
|
},
|
|
33325
33665
|
children: emptyMessage
|
|
33326
33666
|
}
|
|
33327
|
-
) }) }) : paginatedData.map((row, index) => /* @__PURE__ */ (0,
|
|
33667
|
+
) }) }) : paginatedData.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableRow, { children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableCell, { children: column.accessor(row) }, column.id)) }, getRowKey(row, startIndex + index)))
|
|
33328
33668
|
] })
|
|
33329
33669
|
] }),
|
|
33330
|
-
showPagination && /* @__PURE__ */ (0,
|
|
33670
|
+
showPagination && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
33331
33671
|
"div",
|
|
33332
33672
|
{
|
|
33333
33673
|
style: {
|
|
@@ -33338,7 +33678,7 @@ function DataTable({
|
|
|
33338
33678
|
padding: "8px 0"
|
|
33339
33679
|
},
|
|
33340
33680
|
children: [
|
|
33341
|
-
/* @__PURE__ */ (0,
|
|
33681
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { fontSize: "14px", opacity: 0.7 }, children: [
|
|
33342
33682
|
"Showing ",
|
|
33343
33683
|
startIndex + 1,
|
|
33344
33684
|
" to ",
|
|
@@ -33349,8 +33689,8 @@ function DataTable({
|
|
|
33349
33689
|
" entries",
|
|
33350
33690
|
Object.keys(filters).some((key) => filters[key]) && ` (filtered from ${data.length})`
|
|
33351
33691
|
] }),
|
|
33352
|
-
/* @__PURE__ */ (0,
|
|
33353
|
-
/* @__PURE__ */ (0,
|
|
33692
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
|
|
33693
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33354
33694
|
Button,
|
|
33355
33695
|
{
|
|
33356
33696
|
variant: "secondary",
|
|
@@ -33359,7 +33699,7 @@ function DataTable({
|
|
|
33359
33699
|
children: "\xAB\xAB"
|
|
33360
33700
|
}
|
|
33361
33701
|
),
|
|
33362
|
-
/* @__PURE__ */ (0,
|
|
33702
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33363
33703
|
Button,
|
|
33364
33704
|
{
|
|
33365
33705
|
variant: "secondary",
|
|
@@ -33368,13 +33708,13 @@ function DataTable({
|
|
|
33368
33708
|
children: "\xAB"
|
|
33369
33709
|
}
|
|
33370
33710
|
),
|
|
33371
|
-
/* @__PURE__ */ (0,
|
|
33711
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { style: { fontSize: "14px" }, children: [
|
|
33372
33712
|
"Page ",
|
|
33373
33713
|
currentPage,
|
|
33374
33714
|
" of ",
|
|
33375
33715
|
totalPages
|
|
33376
33716
|
] }),
|
|
33377
|
-
/* @__PURE__ */ (0,
|
|
33717
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33378
33718
|
Button,
|
|
33379
33719
|
{
|
|
33380
33720
|
variant: "secondary",
|
|
@@ -33383,7 +33723,7 @@ function DataTable({
|
|
|
33383
33723
|
children: "\xBB"
|
|
33384
33724
|
}
|
|
33385
33725
|
),
|
|
33386
|
-
/* @__PURE__ */ (0,
|
|
33726
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33387
33727
|
Button,
|
|
33388
33728
|
{
|
|
33389
33729
|
variant: "secondary",
|
|
@@ -33400,18 +33740,18 @@ function DataTable({
|
|
|
33400
33740
|
}
|
|
33401
33741
|
|
|
33402
33742
|
// src/inspector/ui/accordion.tsx
|
|
33403
|
-
var
|
|
33404
|
-
var
|
|
33405
|
-
import { styled as
|
|
33743
|
+
var import_react15 = __toESM(require_react(), 1);
|
|
33744
|
+
var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
|
|
33745
|
+
import { styled as styled17 } from "goober";
|
|
33406
33746
|
function Accordion({ title, children, storageKey }) {
|
|
33407
33747
|
const [open, setOpen] = useStoragedState(storageKey, false);
|
|
33408
|
-
return /* @__PURE__ */ (0,
|
|
33748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
33409
33749
|
"details",
|
|
33410
33750
|
{
|
|
33411
33751
|
open,
|
|
33412
33752
|
style: { display: "flex", flexDirection: "column", gap: "1rem" },
|
|
33413
33753
|
children: [
|
|
33414
|
-
/* @__PURE__ */ (0,
|
|
33754
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
33415
33755
|
StyledSummary,
|
|
33416
33756
|
{
|
|
33417
33757
|
onClick: (e) => {
|
|
@@ -33427,17 +33767,17 @@ function Accordion({ title, children, storageKey }) {
|
|
|
33427
33767
|
);
|
|
33428
33768
|
}
|
|
33429
33769
|
function useStoragedState(key, defaultValue) {
|
|
33430
|
-
const [state, setState] = (0,
|
|
33770
|
+
const [state, setState] = (0, import_react15.useState)(() => {
|
|
33431
33771
|
if (typeof window === "undefined") return defaultValue;
|
|
33432
33772
|
const stored = localStorage.getItem(key);
|
|
33433
33773
|
return stored ? JSON.parse(stored) : defaultValue;
|
|
33434
33774
|
});
|
|
33435
|
-
(0,
|
|
33775
|
+
(0, import_react15.useEffect)(() => {
|
|
33436
33776
|
localStorage.setItem(key, JSON.stringify(state));
|
|
33437
33777
|
}, [state]);
|
|
33438
33778
|
return [state, setState];
|
|
33439
33779
|
}
|
|
33440
|
-
var StyledSummary =
|
|
33780
|
+
var StyledSummary = styled17("summary")`
|
|
33441
33781
|
font-size: 1.125rem;
|
|
33442
33782
|
cursor: pointer;
|
|
33443
33783
|
font-weight: 500;
|
|
@@ -33445,12 +33785,12 @@ var StyledSummary = styled15("summary")`
|
|
|
33445
33785
|
`;
|
|
33446
33786
|
|
|
33447
33787
|
// src/inspector/viewer/raw-data-card.tsx
|
|
33448
|
-
var
|
|
33788
|
+
var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
|
|
33449
33789
|
function CopyButton({ data }) {
|
|
33450
|
-
const [copyCount, setCopyCount] = (0,
|
|
33790
|
+
const [copyCount, setCopyCount] = (0, import_react16.useState)(0);
|
|
33451
33791
|
const copied = copyCount > 0;
|
|
33452
33792
|
const stringifiedData = JSON.stringify(data);
|
|
33453
|
-
(0,
|
|
33793
|
+
(0, import_react16.useEffect)(() => {
|
|
33454
33794
|
if (copyCount > 0) {
|
|
33455
33795
|
const timeout = setTimeout(() => setCopyCount(0), 1e3);
|
|
33456
33796
|
return () => {
|
|
@@ -33458,7 +33798,7 @@ function CopyButton({ data }) {
|
|
|
33458
33798
|
};
|
|
33459
33799
|
}
|
|
33460
33800
|
}, [copyCount]);
|
|
33461
|
-
return /* @__PURE__ */ (0,
|
|
33801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
33462
33802
|
Button,
|
|
33463
33803
|
{
|
|
33464
33804
|
style: {
|
|
@@ -33477,14 +33817,14 @@ function CopyButton({ data }) {
|
|
|
33477
33817
|
);
|
|
33478
33818
|
}
|
|
33479
33819
|
function RawDataCard({ data }) {
|
|
33480
|
-
return /* @__PURE__ */ (0,
|
|
33481
|
-
/* @__PURE__ */ (0,
|
|
33482
|
-
/* @__PURE__ */ (0,
|
|
33820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Accordion, { title: "Raw data", storageKey: "jazz-inspector-show-raw-data", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Card, { style: { position: "relative" }, children: [
|
|
33821
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CardHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CopyButton, { data }) }),
|
|
33822
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CardBody, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ValueRenderer, { json: data }) })
|
|
33483
33823
|
] }) });
|
|
33484
33824
|
}
|
|
33485
33825
|
|
|
33486
33826
|
// src/inspector/viewer/account-view.tsx
|
|
33487
|
-
var
|
|
33827
|
+
var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
|
|
33488
33828
|
function AccountView({
|
|
33489
33829
|
data,
|
|
33490
33830
|
onNavigate,
|
|
@@ -33496,25 +33836,25 @@ function AccountView({
|
|
|
33496
33836
|
delete readableData[key];
|
|
33497
33837
|
}
|
|
33498
33838
|
}
|
|
33499
|
-
return /* @__PURE__ */ (0,
|
|
33500
|
-
/* @__PURE__ */ (0,
|
|
33501
|
-
/* @__PURE__ */ (0,
|
|
33839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
33840
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(GridView, { data: readableData, onNavigate, node }),
|
|
33841
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(RawDataCard, { data })
|
|
33502
33842
|
] });
|
|
33503
33843
|
}
|
|
33504
33844
|
|
|
33505
33845
|
// src/inspector/viewer/co-plain-text-view.tsx
|
|
33506
|
-
var
|
|
33846
|
+
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
|
|
33507
33847
|
function CoPlainTextView({ data }) {
|
|
33508
33848
|
if (!data) return;
|
|
33509
|
-
return /* @__PURE__ */ (0,
|
|
33510
|
-
/* @__PURE__ */ (0,
|
|
33511
|
-
/* @__PURE__ */ (0,
|
|
33849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
33850
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { children: Object.values(data).join("") }),
|
|
33851
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(RawDataCard, { data })
|
|
33512
33852
|
] });
|
|
33513
33853
|
}
|
|
33514
33854
|
|
|
33515
33855
|
// src/inspector/viewer/group-view.tsx
|
|
33516
|
-
var
|
|
33517
|
-
var
|
|
33856
|
+
var import_react17 = __toESM(require_react(), 1);
|
|
33857
|
+
var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
|
|
33518
33858
|
function partitionMembers(data) {
|
|
33519
33859
|
const everyone = Object.entries(data).filter(([key]) => key === "everyone").map(([key, value]) => ({
|
|
33520
33860
|
id: key,
|
|
@@ -33542,7 +33882,7 @@ function GroupView({
|
|
|
33542
33882
|
onNavigate,
|
|
33543
33883
|
node
|
|
33544
33884
|
}) {
|
|
33545
|
-
const [addMemberType, setAddMemberType] = (0,
|
|
33885
|
+
const [addMemberType, setAddMemberType] = (0, import_react17.useState)(null);
|
|
33546
33886
|
const { everyone, members, parentGroups, childGroups } = partitionMembers(
|
|
33547
33887
|
data
|
|
33548
33888
|
);
|
|
@@ -33621,28 +33961,28 @@ function GroupView({
|
|
|
33621
33961
|
alert(`Failed to add ${addMemberType}: ${error.message}`);
|
|
33622
33962
|
}
|
|
33623
33963
|
};
|
|
33624
|
-
return /* @__PURE__ */ (0,
|
|
33625
|
-
/* @__PURE__ */ (0,
|
|
33626
|
-
/* @__PURE__ */ (0,
|
|
33627
|
-
/* @__PURE__ */ (0,
|
|
33628
|
-
/* @__PURE__ */ (0,
|
|
33629
|
-
/* @__PURE__ */ (0,
|
|
33964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
33965
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Table, { children: [
|
|
33966
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(TableRow, { children: [
|
|
33967
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableHeader, { children: "Member" }),
|
|
33968
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableHeader, { children: "Permission" }),
|
|
33969
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableHeader, {})
|
|
33630
33970
|
] }) }),
|
|
33631
|
-
/* @__PURE__ */ (0,
|
|
33632
|
-
everyone.map((member) => /* @__PURE__ */ (0,
|
|
33633
|
-
/* @__PURE__ */ (0,
|
|
33634
|
-
/* @__PURE__ */ (0,
|
|
33635
|
-
/* @__PURE__ */ (0,
|
|
33971
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(TableBody, { children: [
|
|
33972
|
+
everyone.map((member) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(TableRow, { children: [
|
|
33973
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: member.id }),
|
|
33974
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: member.role }),
|
|
33975
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33636
33976
|
Button,
|
|
33637
33977
|
{
|
|
33638
33978
|
variant: "secondary",
|
|
33639
33979
|
onClick: () => onRemoveMember(member.id),
|
|
33640
|
-
children: /* @__PURE__ */ (0,
|
|
33980
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { name: "delete" })
|
|
33641
33981
|
}
|
|
33642
33982
|
) })
|
|
33643
33983
|
] }, member.id)),
|
|
33644
|
-
members.map((member) => /* @__PURE__ */ (0,
|
|
33645
|
-
/* @__PURE__ */ (0,
|
|
33984
|
+
members.map((member) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(TableRow, { children: [
|
|
33985
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33646
33986
|
AccountOrGroupText,
|
|
33647
33987
|
{
|
|
33648
33988
|
coId: member.id,
|
|
@@ -33653,18 +33993,18 @@ function GroupView({
|
|
|
33653
33993
|
}
|
|
33654
33994
|
}
|
|
33655
33995
|
) }),
|
|
33656
|
-
/* @__PURE__ */ (0,
|
|
33657
|
-
/* @__PURE__ */ (0,
|
|
33996
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: member.role }),
|
|
33997
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33658
33998
|
Button,
|
|
33659
33999
|
{
|
|
33660
34000
|
variant: "secondary",
|
|
33661
34001
|
onClick: () => onRemoveMember(member.id),
|
|
33662
|
-
children: /* @__PURE__ */ (0,
|
|
34002
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { name: "delete" })
|
|
33663
34003
|
}
|
|
33664
34004
|
) })
|
|
33665
34005
|
] }, member.id)),
|
|
33666
|
-
parentGroups.map((group) => /* @__PURE__ */ (0,
|
|
33667
|
-
/* @__PURE__ */ (0,
|
|
34006
|
+
parentGroups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(TableRow, { children: [
|
|
34007
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33668
34008
|
AccountOrGroupText,
|
|
33669
34009
|
{
|
|
33670
34010
|
coId: group.id,
|
|
@@ -33675,19 +34015,19 @@ function GroupView({
|
|
|
33675
34015
|
}
|
|
33676
34016
|
}
|
|
33677
34017
|
) }),
|
|
33678
|
-
/* @__PURE__ */ (0,
|
|
33679
|
-
/* @__PURE__ */ (0,
|
|
34018
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: group.role }),
|
|
34019
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: group.role !== "revoked" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33680
34020
|
Button,
|
|
33681
34021
|
{
|
|
33682
34022
|
variant: "secondary",
|
|
33683
34023
|
onClick: () => onRemoveGroup(group.id),
|
|
33684
|
-
children: /* @__PURE__ */ (0,
|
|
34024
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { name: "delete" })
|
|
33685
34025
|
}
|
|
33686
34026
|
) })
|
|
33687
34027
|
] }, group.id))
|
|
33688
34028
|
] })
|
|
33689
34029
|
] }),
|
|
33690
|
-
/* @__PURE__ */ (0,
|
|
34030
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
33691
34031
|
"div",
|
|
33692
34032
|
{
|
|
33693
34033
|
style: {
|
|
@@ -33697,14 +34037,14 @@ function GroupView({
|
|
|
33697
34037
|
marginTop: "1rem"
|
|
33698
34038
|
},
|
|
33699
34039
|
children: [
|
|
33700
|
-
/* @__PURE__ */ (0,
|
|
33701
|
-
/* @__PURE__ */ (0,
|
|
34040
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { variant: "primary", onClick: () => setAddMemberType("account"), children: "Add Account" }),
|
|
34041
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { variant: "primary", onClick: () => setAddMemberType("group"), children: "Add Group" })
|
|
33702
34042
|
]
|
|
33703
34043
|
}
|
|
33704
34044
|
),
|
|
33705
|
-
childGroups.length > 0 && /* @__PURE__ */ (0,
|
|
33706
|
-
/* @__PURE__ */ (0,
|
|
33707
|
-
/* @__PURE__ */ (0,
|
|
34045
|
+
childGroups.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Table, { children: [
|
|
34046
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableHeader, { children: "Member of" }) }) }),
|
|
34047
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableBody, { children: childGroups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33708
34048
|
AccountOrGroupText,
|
|
33709
34049
|
{
|
|
33710
34050
|
coId: group.id,
|
|
@@ -33716,20 +34056,20 @@ function GroupView({
|
|
|
33716
34056
|
}
|
|
33717
34057
|
) }) }, group.id)) })
|
|
33718
34058
|
] }),
|
|
33719
|
-
/* @__PURE__ */ (0,
|
|
33720
|
-
/* @__PURE__ */ (0,
|
|
34059
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RawDataCard, { data }),
|
|
34060
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33721
34061
|
Modal,
|
|
33722
34062
|
{
|
|
33723
34063
|
isOpen: addMemberType !== null,
|
|
33724
34064
|
onClose: () => setAddMemberType(null),
|
|
33725
34065
|
heading: addMemberType === "account" ? "Add Account" : "Add Group",
|
|
33726
34066
|
showButtons: false,
|
|
33727
|
-
children: /* @__PURE__ */ (0,
|
|
34067
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("form", { onSubmit: handleAddMemberSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
33728
34068
|
"div",
|
|
33729
34069
|
{
|
|
33730
34070
|
style: { display: "flex", flexDirection: "column", gap: "1rem" },
|
|
33731
34071
|
children: [
|
|
33732
|
-
/* @__PURE__ */ (0,
|
|
34072
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33733
34073
|
Input,
|
|
33734
34074
|
{
|
|
33735
34075
|
name: "memberId",
|
|
@@ -33738,13 +34078,13 @@ function GroupView({
|
|
|
33738
34078
|
required: true
|
|
33739
34079
|
}
|
|
33740
34080
|
),
|
|
33741
|
-
/* @__PURE__ */ (0,
|
|
33742
|
-
/* @__PURE__ */ (0,
|
|
33743
|
-
/* @__PURE__ */ (0,
|
|
33744
|
-
/* @__PURE__ */ (0,
|
|
33745
|
-
addMemberType === "account" ? /* @__PURE__ */ (0,
|
|
34081
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Select, { name: "role", label: "Role", children: [
|
|
34082
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "reader", children: "Reader" }),
|
|
34083
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "writer", children: "Writer" }),
|
|
34084
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "admin", children: "Admin" }),
|
|
34085
|
+
addMemberType === "account" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "writeOnly", children: "Write Only" }) }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "inherit", children: "Inherit" }) })
|
|
33746
34086
|
] }),
|
|
33747
|
-
/* @__PURE__ */ (0,
|
|
34087
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
33748
34088
|
"div",
|
|
33749
34089
|
{
|
|
33750
34090
|
style: {
|
|
@@ -33754,7 +34094,7 @@ function GroupView({
|
|
|
33754
34094
|
marginTop: "0.5rem"
|
|
33755
34095
|
},
|
|
33756
34096
|
children: [
|
|
33757
|
-
/* @__PURE__ */ (0,
|
|
34097
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33758
34098
|
Button,
|
|
33759
34099
|
{
|
|
33760
34100
|
type: "button",
|
|
@@ -33763,7 +34103,7 @@ function GroupView({
|
|
|
33763
34103
|
children: "Cancel"
|
|
33764
34104
|
}
|
|
33765
34105
|
),
|
|
33766
|
-
/* @__PURE__ */ (0,
|
|
34106
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { type: "submit", variant: "primary", children: "Add" })
|
|
33767
34107
|
]
|
|
33768
34108
|
}
|
|
33769
34109
|
)
|
|
@@ -33776,7 +34116,7 @@ function GroupView({
|
|
|
33776
34116
|
}
|
|
33777
34117
|
|
|
33778
34118
|
// src/inspector/viewer/role-display.tsx
|
|
33779
|
-
var
|
|
34119
|
+
var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
|
|
33780
34120
|
function RoleDisplay({
|
|
33781
34121
|
node,
|
|
33782
34122
|
value
|
|
@@ -33795,24 +34135,24 @@ function RoleDisplay({
|
|
|
33795
34135
|
} else {
|
|
33796
34136
|
role = "unauthorized";
|
|
33797
34137
|
}
|
|
33798
|
-
return /* @__PURE__ */ (0,
|
|
34138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Text, { children: [
|
|
33799
34139
|
"Role: ",
|
|
33800
34140
|
role
|
|
33801
34141
|
] });
|
|
33802
34142
|
}
|
|
33803
34143
|
|
|
33804
34144
|
// src/inspector/viewer/table-viewer.tsx
|
|
33805
|
-
var
|
|
33806
|
-
import { styled as
|
|
33807
|
-
var
|
|
33808
|
-
var PaginationContainer =
|
|
34145
|
+
var import_react18 = __toESM(require_react(), 1);
|
|
34146
|
+
import { styled as styled18 } from "goober";
|
|
34147
|
+
var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
|
|
34148
|
+
var PaginationContainer = styled18("div")`
|
|
33809
34149
|
padding: 1rem 0;
|
|
33810
34150
|
display: flex;
|
|
33811
34151
|
align-items: center;
|
|
33812
34152
|
justify-content: space-between;
|
|
33813
34153
|
gap: 0.5rem;
|
|
33814
34154
|
`;
|
|
33815
|
-
var RedTooltip =
|
|
34155
|
+
var RedTooltip = styled18("span")`
|
|
33816
34156
|
position:relative; /* making the .tooltip span a container for the tooltip text */
|
|
33817
34157
|
border-bottom:1px dashed #000; /* little indicater to indicate it's hoverable */
|
|
33818
34158
|
|
|
@@ -33849,8 +34189,8 @@ function CoValuesTableView({
|
|
|
33849
34189
|
onNavigate,
|
|
33850
34190
|
onRemove
|
|
33851
34191
|
}) {
|
|
33852
|
-
const [visibleRowsCount, setVisibleRowsCount] = (0,
|
|
33853
|
-
const [coIdArray, visibleRows] = (0,
|
|
34192
|
+
const [visibleRowsCount, setVisibleRowsCount] = (0, import_react18.useState)(10);
|
|
34193
|
+
const [coIdArray, visibleRows] = (0, import_react18.useMemo)(() => {
|
|
33854
34194
|
const coIdArray2 = Array.isArray(data) ? data : Object.values(data).every((k) => typeof k === "string" && isCoId(k)) ? Object.values(data).map((k) => k) : [];
|
|
33855
34195
|
const visibleRows2 = coIdArray2.slice(0, visibleRowsCount);
|
|
33856
34196
|
return [coIdArray2, visibleRows2];
|
|
@@ -33858,10 +34198,10 @@ function CoValuesTableView({
|
|
|
33858
34198
|
const resolvedRows = useResolvedCoValues(visibleRows, node);
|
|
33859
34199
|
const hasMore = visibleRowsCount < coIdArray.length;
|
|
33860
34200
|
if (!coIdArray.length) {
|
|
33861
|
-
return /* @__PURE__ */ (0,
|
|
34201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: "No data to display" });
|
|
33862
34202
|
}
|
|
33863
34203
|
if (resolvedRows.length === 0) {
|
|
33864
|
-
return /* @__PURE__ */ (0,
|
|
34204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: "Loading..." });
|
|
33865
34205
|
}
|
|
33866
34206
|
const keys = Array.from(
|
|
33867
34207
|
new Set(
|
|
@@ -33871,15 +34211,15 @@ function CoValuesTableView({
|
|
|
33871
34211
|
const loadMore = () => {
|
|
33872
34212
|
setVisibleRowsCount((prevVisibleRows) => prevVisibleRows + 10);
|
|
33873
34213
|
};
|
|
33874
|
-
return /* @__PURE__ */ (0,
|
|
33875
|
-
/* @__PURE__ */ (0,
|
|
33876
|
-
/* @__PURE__ */ (0,
|
|
33877
|
-
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */ (0,
|
|
33878
|
-
onRemove && /* @__PURE__ */ (0,
|
|
34214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
34215
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Table, { children: [
|
|
34216
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TableRow, { children: [
|
|
34217
|
+
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHeader, { children: key }, key)),
|
|
34218
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHeader, {})
|
|
33879
34219
|
] }) }),
|
|
33880
|
-
/* @__PURE__ */ (0,
|
|
33881
|
-
/* @__PURE__ */ (0,
|
|
33882
|
-
/* @__PURE__ */ (0,
|
|
34220
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableBody, { children: resolvedRows.slice(0, visibleRowsCount).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TableRow, { children: [
|
|
34221
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { mono: true, children: item.snapshot === "unavailable" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(RedTooltip, { "data-text": "Unavailable", children: [
|
|
34222
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
33883
34223
|
Icon,
|
|
33884
34224
|
{
|
|
33885
34225
|
name: "caution",
|
|
@@ -33892,7 +34232,7 @@ function CoValuesTableView({
|
|
|
33892
34232
|
),
|
|
33893
34233
|
visibleRows[index]
|
|
33894
34234
|
] }) : visibleRows[index] }) }),
|
|
33895
|
-
keys.map((key) => /* @__PURE__ */ (0,
|
|
34235
|
+
keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableCell, { children: item.snapshot !== "unavailable" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
33896
34236
|
ValueRenderer,
|
|
33897
34237
|
{
|
|
33898
34238
|
json: item.snapshot[key],
|
|
@@ -33913,7 +34253,7 @@ function CoValuesTableView({
|
|
|
33913
34253
|
}
|
|
33914
34254
|
}
|
|
33915
34255
|
) }, key)),
|
|
33916
|
-
/* @__PURE__ */ (0,
|
|
34256
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
33917
34257
|
Button,
|
|
33918
34258
|
{
|
|
33919
34259
|
variant: "secondary",
|
|
@@ -33926,18 +34266,18 @@ function CoValuesTableView({
|
|
|
33926
34266
|
children: "View"
|
|
33927
34267
|
}
|
|
33928
34268
|
) }),
|
|
33929
|
-
onRemove && /* @__PURE__ */ (0,
|
|
34269
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
33930
34270
|
] }, index)) })
|
|
33931
34271
|
] }),
|
|
33932
|
-
/* @__PURE__ */ (0,
|
|
33933
|
-
/* @__PURE__ */ (0,
|
|
34272
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(PaginationContainer, { children: [
|
|
34273
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Text, { muted: true, small: true, children: [
|
|
33934
34274
|
"Showing ",
|
|
33935
34275
|
Math.min(visibleRowsCount, coIdArray.length),
|
|
33936
34276
|
" of",
|
|
33937
34277
|
" ",
|
|
33938
34278
|
coIdArray.length
|
|
33939
34279
|
] }),
|
|
33940
|
-
hasMore && /* @__PURE__ */ (0,
|
|
34280
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "secondary", onClick: loadMore, children: "Load more" })
|
|
33941
34281
|
] })
|
|
33942
34282
|
] });
|
|
33943
34283
|
}
|
|
@@ -33947,11 +34287,11 @@ function TableView({
|
|
|
33947
34287
|
onNavigate,
|
|
33948
34288
|
onRemove
|
|
33949
34289
|
}) {
|
|
33950
|
-
const isListOfCoValues = (0,
|
|
34290
|
+
const isListOfCoValues = (0, import_react18.useMemo)(() => {
|
|
33951
34291
|
return Array.isArray(data) && data.every((k) => isCoId(k));
|
|
33952
34292
|
}, [data]);
|
|
33953
34293
|
if (isListOfCoValues) {
|
|
33954
|
-
return /* @__PURE__ */ (0,
|
|
34294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
33955
34295
|
CoValuesTableView,
|
|
33956
34296
|
{
|
|
33957
34297
|
data,
|
|
@@ -33961,29 +34301,72 @@ function TableView({
|
|
|
33961
34301
|
}
|
|
33962
34302
|
);
|
|
33963
34303
|
}
|
|
33964
|
-
return /* @__PURE__ */ (0,
|
|
33965
|
-
/* @__PURE__ */ (0,
|
|
33966
|
-
/* @__PURE__ */ (0,
|
|
33967
|
-
/* @__PURE__ */ (0,
|
|
33968
|
-
onRemove && /* @__PURE__ */ (0,
|
|
34304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Table, { children: [
|
|
34305
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TableRow, { children: [
|
|
34306
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHeader, { style: { width: "5rem" }, children: "Index" }),
|
|
34307
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHeader, { children: "Value" }),
|
|
34308
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHeader, { children: "Action" })
|
|
33969
34309
|
] }) }),
|
|
33970
|
-
/* @__PURE__ */ (0,
|
|
33971
|
-
/* @__PURE__ */ (0,
|
|
33972
|
-
/* @__PURE__ */ (0,
|
|
33973
|
-
onRemove && /* @__PURE__ */ (0,
|
|
34310
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableBody, { children: Array.isArray(data) && data?.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TableRow, { children: [
|
|
34311
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { mono: true, children: index }) }),
|
|
34312
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ValueRenderer, { json: value }) }),
|
|
34313
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
33974
34314
|
] }, index)) })
|
|
33975
34315
|
] });
|
|
33976
34316
|
}
|
|
33977
34317
|
|
|
33978
34318
|
// src/inspector/viewer/history-view.tsx
|
|
33979
|
-
var
|
|
33980
|
-
import { styled as
|
|
33981
|
-
|
|
34319
|
+
var import_react19 = __toESM(require_react(), 1);
|
|
34320
|
+
import { styled as styled19 } from "goober";
|
|
34321
|
+
|
|
34322
|
+
// src/inspector/utils/transactions-changes.ts
|
|
34323
|
+
var isGroupExtension = (change) => {
|
|
34324
|
+
return change?.op === "set" && change?.value === "extend";
|
|
34325
|
+
};
|
|
34326
|
+
var isGroupExtendRevocation = (change) => {
|
|
34327
|
+
return change?.op === "set" && change?.value === "revoked";
|
|
34328
|
+
};
|
|
34329
|
+
var isGroupPromotion = (change) => {
|
|
34330
|
+
return change?.op === "set" && change?.key.startsWith("parent_co_");
|
|
34331
|
+
};
|
|
34332
|
+
var isUserPromotion = (change) => {
|
|
34333
|
+
return change?.op === "set" && (isCoId(change?.key) || change?.key === "everyone");
|
|
34334
|
+
};
|
|
34335
|
+
var isKeyRevelation = (change) => {
|
|
34336
|
+
return change?.op === "set" && change?.key.includes("_for_");
|
|
34337
|
+
};
|
|
34338
|
+
var isPropertySet = (change) => {
|
|
34339
|
+
return change?.op === "set" && "key" in change && "value" in change;
|
|
34340
|
+
};
|
|
34341
|
+
var isPropertyDeletion = (change) => {
|
|
34342
|
+
return change?.op === "del" && "key" in change;
|
|
34343
|
+
};
|
|
34344
|
+
var isItemAppend = (change) => {
|
|
34345
|
+
return change?.op === "app" && "after" in change && "value" in change;
|
|
34346
|
+
};
|
|
34347
|
+
var isItemPrepend = (change) => {
|
|
34348
|
+
return change?.op === "pre" && "before" in change && "value" in change;
|
|
34349
|
+
};
|
|
34350
|
+
var isItemDeletion = (change) => {
|
|
34351
|
+
return change?.op === "del" && "insertion" in change;
|
|
34352
|
+
};
|
|
34353
|
+
var isStreamStart = (change) => {
|
|
34354
|
+
return change?.type === "start" && "mimeType" in change;
|
|
34355
|
+
};
|
|
34356
|
+
var isStreamChunk = (change) => {
|
|
34357
|
+
return change?.type === "chunk" && "chunk" in change;
|
|
34358
|
+
};
|
|
34359
|
+
var isStreamEnd = (change) => {
|
|
34360
|
+
return change?.type === "end";
|
|
34361
|
+
};
|
|
34362
|
+
|
|
34363
|
+
// src/inspector/viewer/history-view.tsx
|
|
34364
|
+
var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
|
|
33982
34365
|
function HistoryView({
|
|
33983
34366
|
coValue,
|
|
33984
34367
|
node
|
|
33985
34368
|
}) {
|
|
33986
|
-
const transactions = (0,
|
|
34369
|
+
const transactions = (0, import_react19.useMemo)(
|
|
33987
34370
|
() => getHistory(coValue),
|
|
33988
34371
|
[coValue.core.verifiedTransactions.length]
|
|
33989
34372
|
);
|
|
@@ -33991,8 +34374,8 @@ function HistoryView({
|
|
|
33991
34374
|
{
|
|
33992
34375
|
id: "author",
|
|
33993
34376
|
header: "Author",
|
|
33994
|
-
accessor: (row) => /* @__PURE__ */ (0,
|
|
33995
|
-
row.isValid || /* @__PURE__ */ (0,
|
|
34377
|
+
accessor: (row) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
34378
|
+
row.isValid || /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(RedTooltip2, { "data-text": "This transaction is invalid and is not used", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
33996
34379
|
Icon,
|
|
33997
34380
|
{
|
|
33998
34381
|
name: "caution",
|
|
@@ -34005,7 +34388,7 @@ function HistoryView({
|
|
|
34005
34388
|
}
|
|
34006
34389
|
}
|
|
34007
34390
|
) }),
|
|
34008
|
-
row.author.startsWith("co_") ? /* @__PURE__ */ (0,
|
|
34391
|
+
row.author.startsWith("co_") ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
34009
34392
|
AccountOrGroupText,
|
|
34010
34393
|
{
|
|
34011
34394
|
coId: row.author,
|
|
@@ -34024,9 +34407,9 @@ function HistoryView({
|
|
|
34024
34407
|
header: "Action",
|
|
34025
34408
|
accessor: (row) => {
|
|
34026
34409
|
if (row.isValid) return row.action;
|
|
34027
|
-
return /* @__PURE__ */ (0,
|
|
34410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
34028
34411
|
row.action,
|
|
34029
|
-
/* @__PURE__ */ (0,
|
|
34412
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { style: { color: "red", display: "block" }, children: [
|
|
34030
34413
|
"Invalid transaction: ",
|
|
34031
34414
|
row.validationErrorMessage
|
|
34032
34415
|
] })
|
|
@@ -34045,7 +34428,7 @@ function HistoryView({
|
|
|
34045
34428
|
sortFn: (a, b) => a.timestamp.getTime() - b.timestamp.getTime()
|
|
34046
34429
|
}
|
|
34047
34430
|
];
|
|
34048
|
-
return /* @__PURE__ */ (0,
|
|
34431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Accordion, { title: "CoValue history", storageKey: "jazz-inspector-show-history", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
34049
34432
|
DataTable,
|
|
34050
34433
|
{
|
|
34051
34434
|
columns,
|
|
@@ -34061,7 +34444,9 @@ function getTransactionChanges(tx, coValue) {
|
|
|
34061
34444
|
if (tx.isValid === false && tx.tx.privacy === "private") {
|
|
34062
34445
|
const readKey = coValue.core.getReadKey(tx.tx.keyUsed);
|
|
34063
34446
|
if (!readKey) {
|
|
34064
|
-
|
|
34447
|
+
return [
|
|
34448
|
+
`Unable to decrypt transaction: read key ${tx.tx.keyUsed} not found.`
|
|
34449
|
+
];
|
|
34065
34450
|
}
|
|
34066
34451
|
return coValue.core.verified.decryptTransaction(
|
|
34067
34452
|
tx.txID.sessionID,
|
|
@@ -34156,46 +34541,7 @@ var findListChange = (opId, coValue) => {
|
|
|
34156
34541
|
(tx) => tx.txID.sessionID === opId.sessionID && tx.txID.txIndex === opId.txIndex
|
|
34157
34542
|
)?.changes?.[opId.changeIdx];
|
|
34158
34543
|
};
|
|
34159
|
-
var
|
|
34160
|
-
return change?.op === "set" && change?.value === "extend";
|
|
34161
|
-
};
|
|
34162
|
-
var isGroupExtendRevocation = (change) => {
|
|
34163
|
-
return change?.op === "set" && change?.value === "revoked";
|
|
34164
|
-
};
|
|
34165
|
-
var isGroupPromotion = (change) => {
|
|
34166
|
-
return change?.op === "set" && change?.key.startsWith("parent_co_");
|
|
34167
|
-
};
|
|
34168
|
-
var isUserPromotion = (change) => {
|
|
34169
|
-
return change?.op === "set" && (isCoId(change?.key) || change?.key === "everyone");
|
|
34170
|
-
};
|
|
34171
|
-
var isKeyRevelation = (change) => {
|
|
34172
|
-
return change?.op === "set" && change?.key.includes("_for_");
|
|
34173
|
-
};
|
|
34174
|
-
var isPropertySet = (change) => {
|
|
34175
|
-
return change?.op === "set" && "key" in change && "value" in change;
|
|
34176
|
-
};
|
|
34177
|
-
var isPropertyDeletion = (change) => {
|
|
34178
|
-
return change?.op === "del" && "key" in change;
|
|
34179
|
-
};
|
|
34180
|
-
var isItemAppend = (change) => {
|
|
34181
|
-
return change?.op === "app" && "after" in change && "value" in change;
|
|
34182
|
-
};
|
|
34183
|
-
var isItemPrepend = (change) => {
|
|
34184
|
-
return change?.op === "pre" && "before" in change && "value" in change;
|
|
34185
|
-
};
|
|
34186
|
-
var isItemDeletion = (change) => {
|
|
34187
|
-
return change?.op === "del" && "insertion" in change;
|
|
34188
|
-
};
|
|
34189
|
-
var isStreamStart = (change) => {
|
|
34190
|
-
return change?.type === "start" && "mimeType" in change;
|
|
34191
|
-
};
|
|
34192
|
-
var isStreamChunk = (change) => {
|
|
34193
|
-
return change?.type === "chunk" && "chunk" in change;
|
|
34194
|
-
};
|
|
34195
|
-
var isStreamEnd = (change) => {
|
|
34196
|
-
return change?.type === "end";
|
|
34197
|
-
};
|
|
34198
|
-
var RedTooltip2 = styled17("span")`
|
|
34544
|
+
var RedTooltip2 = styled19("span")`
|
|
34199
34545
|
position:relative; /* making the .tooltip span a container for the tooltip text */
|
|
34200
34546
|
border-bottom:1px dashed #000; /* little indicater to indicate it's hoverable */
|
|
34201
34547
|
|
|
@@ -34227,12 +34573,325 @@ var RedTooltip2 = styled17("span")`
|
|
|
34227
34573
|
}
|
|
34228
34574
|
`;
|
|
34229
34575
|
|
|
34576
|
+
// src/inspector/viewer/co-map-view.tsx
|
|
34577
|
+
var import_react20 = __toESM(require_react(), 1);
|
|
34578
|
+
import { styled as styled20 } from "goober";
|
|
34579
|
+
|
|
34580
|
+
// src/inspector/utils/history.ts
|
|
34581
|
+
function restoreCoMapToTimestamp(coValue, timestamp, removeUnknownProperties) {
|
|
34582
|
+
const myRole = coValue.group.myRole();
|
|
34583
|
+
if (myRole === void 0 || !["admin", "manager", "writer", "writerOnly"].includes(myRole)) {
|
|
34584
|
+
return;
|
|
34585
|
+
}
|
|
34586
|
+
const newCoValue = coValue.atTime(timestamp).toJSON();
|
|
34587
|
+
const oldCoValue = coValue.toJSON();
|
|
34588
|
+
if (newCoValue === null) return;
|
|
34589
|
+
let changes = [];
|
|
34590
|
+
if (removeUnknownProperties) {
|
|
34591
|
+
for (const key in oldCoValue) {
|
|
34592
|
+
if (!(key in newCoValue)) {
|
|
34593
|
+
changes.push({
|
|
34594
|
+
op: "del",
|
|
34595
|
+
key
|
|
34596
|
+
});
|
|
34597
|
+
}
|
|
34598
|
+
}
|
|
34599
|
+
}
|
|
34600
|
+
for (const key in newCoValue) {
|
|
34601
|
+
if (newCoValue[key] !== oldCoValue[key]) {
|
|
34602
|
+
changes.push({
|
|
34603
|
+
op: "set",
|
|
34604
|
+
key,
|
|
34605
|
+
value: newCoValue[key]
|
|
34606
|
+
});
|
|
34607
|
+
}
|
|
34608
|
+
}
|
|
34609
|
+
if (changes.length > 0) {
|
|
34610
|
+
coValue.core.makeTransaction(changes, "private");
|
|
34611
|
+
}
|
|
34612
|
+
}
|
|
34613
|
+
|
|
34614
|
+
// src/inspector/viewer/co-map-view.tsx
|
|
34615
|
+
var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
|
|
34616
|
+
function CoMapView({
|
|
34617
|
+
coValue,
|
|
34618
|
+
data,
|
|
34619
|
+
node,
|
|
34620
|
+
onNavigate
|
|
34621
|
+
}) {
|
|
34622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
34623
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34624
|
+
GridView,
|
|
34625
|
+
{
|
|
34626
|
+
data,
|
|
34627
|
+
onNavigate,
|
|
34628
|
+
node,
|
|
34629
|
+
coValue
|
|
34630
|
+
}
|
|
34631
|
+
),
|
|
34632
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
34633
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34634
|
+
AddPropertyModal,
|
|
34635
|
+
{
|
|
34636
|
+
disabled: !isWriter(coValue.group.myRole()),
|
|
34637
|
+
coValue,
|
|
34638
|
+
node
|
|
34639
|
+
}
|
|
34640
|
+
),
|
|
34641
|
+
" ",
|
|
34642
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RestoreSnapshotModal, { coValue })
|
|
34643
|
+
] })
|
|
34644
|
+
] });
|
|
34645
|
+
}
|
|
34646
|
+
function AddPropertyModal({
|
|
34647
|
+
coValue,
|
|
34648
|
+
node,
|
|
34649
|
+
disabled
|
|
34650
|
+
}) {
|
|
34651
|
+
const [isAddPropertyModalOpen, setIsAddPropertyModalOpen] = (0, import_react20.useState)(false);
|
|
34652
|
+
const [propertyName, setPropertyName] = (0, import_react20.useState)("");
|
|
34653
|
+
const openAddPropertyModal = () => {
|
|
34654
|
+
setIsAddPropertyModalOpen(true);
|
|
34655
|
+
setPropertyName("");
|
|
34656
|
+
};
|
|
34657
|
+
const handleCancel = () => {
|
|
34658
|
+
setIsAddPropertyModalOpen(false);
|
|
34659
|
+
setPropertyName("");
|
|
34660
|
+
};
|
|
34661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
34662
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34663
|
+
Button,
|
|
34664
|
+
{
|
|
34665
|
+
title: "Add Property",
|
|
34666
|
+
variant: "secondary",
|
|
34667
|
+
disabled,
|
|
34668
|
+
onClick: openAddPropertyModal,
|
|
34669
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { name: "add" })
|
|
34670
|
+
}
|
|
34671
|
+
),
|
|
34672
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
34673
|
+
Modal,
|
|
34674
|
+
{
|
|
34675
|
+
isOpen: isAddPropertyModalOpen,
|
|
34676
|
+
onClose: handleCancel,
|
|
34677
|
+
heading: "Add Property",
|
|
34678
|
+
showButtons: false,
|
|
34679
|
+
children: [
|
|
34680
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34681
|
+
Input,
|
|
34682
|
+
{
|
|
34683
|
+
label: "Property Name",
|
|
34684
|
+
value: propertyName,
|
|
34685
|
+
onChange: (e) => setPropertyName(e.target.value),
|
|
34686
|
+
placeholder: "Enter property name"
|
|
34687
|
+
}
|
|
34688
|
+
),
|
|
34689
|
+
propertyName && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EditorContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34690
|
+
CoValueEditor,
|
|
34691
|
+
{
|
|
34692
|
+
node,
|
|
34693
|
+
property: propertyName,
|
|
34694
|
+
value: void 0,
|
|
34695
|
+
coValue,
|
|
34696
|
+
onCancel: handleCancel
|
|
34697
|
+
}
|
|
34698
|
+
) })
|
|
34699
|
+
]
|
|
34700
|
+
}
|
|
34701
|
+
)
|
|
34702
|
+
] });
|
|
34703
|
+
}
|
|
34704
|
+
function RestoreSnapshotModal({ coValue }) {
|
|
34705
|
+
const [isRestoreModalOpen, setIsRestoreModalOpen] = (0, import_react20.useState)(false);
|
|
34706
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react20.useState)(-1);
|
|
34707
|
+
const [removeUnknownProperties, setRemoveUnknownProperties] = (0, import_react20.useState)(false);
|
|
34708
|
+
const timestamps = (0, import_react20.useMemo)(
|
|
34709
|
+
() => coValue.core.verifiedTransactions.map((tx) => tx.madeAt),
|
|
34710
|
+
[coValue.core.verifiedTransactions.length]
|
|
34711
|
+
);
|
|
34712
|
+
const coMapAtSelectedIndex = (0, import_react20.useMemo)(() => {
|
|
34713
|
+
if (selectedIndex === -1) return null;
|
|
34714
|
+
return coValue.atTime(timestamps[selectedIndex]).toJSON();
|
|
34715
|
+
}, [coValue, timestamps, selectedIndex]);
|
|
34716
|
+
const openRestoreModal = () => {
|
|
34717
|
+
setIsRestoreModalOpen(true);
|
|
34718
|
+
setSelectedIndex(timestamps.length - 1);
|
|
34719
|
+
};
|
|
34720
|
+
const handleRestore = () => {
|
|
34721
|
+
if (timestamps.length < 2) return;
|
|
34722
|
+
if (timestamps.length === 0) return;
|
|
34723
|
+
const selectedTimestamp = timestamps[selectedIndex];
|
|
34724
|
+
if (selectedTimestamp === void 0) return;
|
|
34725
|
+
restoreCoMapToTimestamp(
|
|
34726
|
+
coValue,
|
|
34727
|
+
selectedTimestamp,
|
|
34728
|
+
removeUnknownProperties
|
|
34729
|
+
);
|
|
34730
|
+
setIsRestoreModalOpen(false);
|
|
34731
|
+
};
|
|
34732
|
+
const handleClose = () => {
|
|
34733
|
+
setIsRestoreModalOpen(false);
|
|
34734
|
+
};
|
|
34735
|
+
const canRestore = isWriter(coValue.group.myRole());
|
|
34736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
34737
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Button, { title: "Timeline", variant: "secondary", onClick: openRestoreModal, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { name: "history" }) }),
|
|
34738
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
34739
|
+
Modal,
|
|
34740
|
+
{
|
|
34741
|
+
isOpen: isRestoreModalOpen,
|
|
34742
|
+
onClose: handleClose,
|
|
34743
|
+
heading: "Timeline",
|
|
34744
|
+
confirmText: "Restore",
|
|
34745
|
+
cancelText: "Cancel",
|
|
34746
|
+
onConfirm: handleRestore,
|
|
34747
|
+
onCancel: handleClose,
|
|
34748
|
+
showButtons: timestamps.length > 1 && canRestore,
|
|
34749
|
+
children: [
|
|
34750
|
+
timestamps.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
34751
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(RangeContainer, { children: [
|
|
34752
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RangeLabel, { children: "Select Timestamp" }),
|
|
34753
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34754
|
+
RangeInput,
|
|
34755
|
+
{
|
|
34756
|
+
type: "range",
|
|
34757
|
+
min: 0,
|
|
34758
|
+
max: Math.max(0, timestamps.length - 1),
|
|
34759
|
+
value: selectedIndex,
|
|
34760
|
+
onChange: (e) => setSelectedIndex(Number(e.target.value)),
|
|
34761
|
+
disabled: timestamps.length === 0
|
|
34762
|
+
}
|
|
34763
|
+
),
|
|
34764
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TimestampDisplay, { children: timestamps[selectedIndex] !== void 0 ? new Date(timestamps[selectedIndex]).toISOString() : "No timestamps available" })
|
|
34765
|
+
] }),
|
|
34766
|
+
canRestore && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(CheckboxContainer, { children: [
|
|
34767
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34768
|
+
CheckboxInput,
|
|
34769
|
+
{
|
|
34770
|
+
type: "checkbox",
|
|
34771
|
+
id: "remove-unknown-properties",
|
|
34772
|
+
checked: removeUnknownProperties,
|
|
34773
|
+
onChange: (e) => setRemoveUnknownProperties(e.target.checked)
|
|
34774
|
+
}
|
|
34775
|
+
),
|
|
34776
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CheckboxLabel, { htmlFor: "remove-unknown-properties", children: "Remove unknown properties (properties that don't exist in the selected snapshot)" })
|
|
34777
|
+
] })
|
|
34778
|
+
] }),
|
|
34779
|
+
timestamps.length > 0 && timestamps[selectedIndex] !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(PreviewSection, { children: [
|
|
34780
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PreviewLabel, { children: "State at that time:" }),
|
|
34781
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PreviewPre, { children: JSON.stringify(coMapAtSelectedIndex, null, 2) })
|
|
34782
|
+
] }),
|
|
34783
|
+
timestamps.length < 2 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { style: { color: "var(--j-text-color)" }, children: "At least 2 timestamps are required to restore a snapshot." })
|
|
34784
|
+
]
|
|
34785
|
+
}
|
|
34786
|
+
)
|
|
34787
|
+
] });
|
|
34788
|
+
}
|
|
34789
|
+
var PreviewSection = styled20("div")`
|
|
34790
|
+
margin-top: 1.5rem;
|
|
34791
|
+
`;
|
|
34792
|
+
var PreviewLabel = styled20("div")`
|
|
34793
|
+
font-weight: 500;
|
|
34794
|
+
margin-bottom: 0.5rem;
|
|
34795
|
+
color: var(--j-text-color-strong);
|
|
34796
|
+
`;
|
|
34797
|
+
var PreviewPre = styled20("pre")`
|
|
34798
|
+
background-color: var(--j-foreground);
|
|
34799
|
+
border: 1px solid var(--j-border-color);
|
|
34800
|
+
border-radius: var(--j-radius-md);
|
|
34801
|
+
padding: 1rem;
|
|
34802
|
+
overflow-x: auto;
|
|
34803
|
+
font-size: 0.875rem;
|
|
34804
|
+
max-height: 400px;
|
|
34805
|
+
overflow-y: auto;
|
|
34806
|
+
color: var(--j-text-color);
|
|
34807
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
34808
|
+
`;
|
|
34809
|
+
var RangeContainer = styled20("div")`
|
|
34810
|
+
display: flex;
|
|
34811
|
+
flex-direction: column;
|
|
34812
|
+
gap: 0.75rem;
|
|
34813
|
+
`;
|
|
34814
|
+
var RangeLabel = styled20("label")`
|
|
34815
|
+
font-weight: 500;
|
|
34816
|
+
color: var(--j-text-color-strong);
|
|
34817
|
+
font-size: 0.875rem;
|
|
34818
|
+
`;
|
|
34819
|
+
var RangeInput = styled20("input")`
|
|
34820
|
+
width: 100%;
|
|
34821
|
+
height: 0.5rem;
|
|
34822
|
+
border-radius: var(--j-radius-sm);
|
|
34823
|
+
outline: none;
|
|
34824
|
+
-webkit-appearance: none;
|
|
34825
|
+
appearance: none;
|
|
34826
|
+
background: var(--j-foreground);
|
|
34827
|
+
cursor: pointer;
|
|
34828
|
+
|
|
34829
|
+
&::-webkit-slider-thumb {
|
|
34830
|
+
-webkit-appearance: none;
|
|
34831
|
+
appearance: none;
|
|
34832
|
+
width: 1.25rem;
|
|
34833
|
+
height: 1.25rem;
|
|
34834
|
+
border-radius: 50%;
|
|
34835
|
+
background: var(--j-primary-color);
|
|
34836
|
+
cursor: pointer;
|
|
34837
|
+
border: 2px solid var(--j-background);
|
|
34838
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
34839
|
+
}
|
|
34840
|
+
|
|
34841
|
+
&::-moz-range-thumb {
|
|
34842
|
+
width: 1.25rem;
|
|
34843
|
+
height: 1.25rem;
|
|
34844
|
+
border-radius: 50%;
|
|
34845
|
+
background: var(--j-primary-color);
|
|
34846
|
+
cursor: pointer;
|
|
34847
|
+
border: 2px solid var(--j-background);
|
|
34848
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
34849
|
+
}
|
|
34850
|
+
|
|
34851
|
+
&:disabled {
|
|
34852
|
+
opacity: 0.5;
|
|
34853
|
+
cursor: not-allowed;
|
|
34854
|
+
}
|
|
34855
|
+
`;
|
|
34856
|
+
var TimestampDisplay = styled20("div")`
|
|
34857
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
34858
|
+
font-size: 0.875rem;
|
|
34859
|
+
color: var(--j-text-color);
|
|
34860
|
+
padding: 0.5rem;
|
|
34861
|
+
background-color: var(--j-foreground);
|
|
34862
|
+
border: 1px solid var(--j-border-color);
|
|
34863
|
+
border-radius: var(--j-radius-md);
|
|
34864
|
+
text-align: center;
|
|
34865
|
+
`;
|
|
34866
|
+
var CheckboxContainer = styled20("div")`
|
|
34867
|
+
display: flex;
|
|
34868
|
+
align-items: flex-start;
|
|
34869
|
+
gap: 0.5rem;
|
|
34870
|
+
margin-top: 1rem;
|
|
34871
|
+
`;
|
|
34872
|
+
var CheckboxInput = styled20("input")`
|
|
34873
|
+
width: 1rem;
|
|
34874
|
+
height: 1rem;
|
|
34875
|
+
margin-top: 0.125rem;
|
|
34876
|
+
cursor: pointer;
|
|
34877
|
+
accent-color: var(--j-primary-color);
|
|
34878
|
+
`;
|
|
34879
|
+
var CheckboxLabel = styled20("label")`
|
|
34880
|
+
font-size: 0.875rem;
|
|
34881
|
+
color: var(--j-text-color);
|
|
34882
|
+
cursor: pointer;
|
|
34883
|
+
line-height: 1.25rem;
|
|
34884
|
+
`;
|
|
34885
|
+
var EditorContainer = styled20("div")`
|
|
34886
|
+
margin-top: 1rem;
|
|
34887
|
+
`;
|
|
34888
|
+
|
|
34230
34889
|
// src/inspector/viewer/page.tsx
|
|
34231
|
-
var
|
|
34232
|
-
var BasePageContainer =
|
|
34233
|
-
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ (0,
|
|
34890
|
+
var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
|
|
34891
|
+
var BasePageContainer = import_react21.default.forwardRef(
|
|
34892
|
+
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { ref, ...rest })
|
|
34234
34893
|
);
|
|
34235
|
-
var PageContainer =
|
|
34894
|
+
var PageContainer = styled21(BasePageContainer)`
|
|
34236
34895
|
position: absolute;
|
|
34237
34896
|
z-index: 10;
|
|
34238
34897
|
inset: 0;
|
|
@@ -34240,36 +34899,36 @@ var PageContainer = styled18(BasePageContainer)`
|
|
|
34240
34899
|
height: 100%;
|
|
34241
34900
|
padding: 0 0.75rem;
|
|
34242
34901
|
`;
|
|
34243
|
-
var BackButton =
|
|
34902
|
+
var BackButton = styled21("div")`
|
|
34244
34903
|
position: absolute;
|
|
34245
34904
|
left: 0;
|
|
34246
34905
|
right: 0;
|
|
34247
34906
|
top: 0;
|
|
34248
34907
|
height: 2.5rem;
|
|
34249
34908
|
`;
|
|
34250
|
-
var HeaderContainer =
|
|
34909
|
+
var HeaderContainer = styled21("div")`
|
|
34251
34910
|
display: flex;
|
|
34252
34911
|
justify-content: space-between;
|
|
34253
34912
|
align-items: center;
|
|
34254
34913
|
margin-bottom: 1rem;
|
|
34255
34914
|
`;
|
|
34256
|
-
var TitleContainer =
|
|
34915
|
+
var TitleContainer = styled21("div")`
|
|
34257
34916
|
display: flex;
|
|
34258
34917
|
align-items: center;
|
|
34259
34918
|
gap: 0.75rem;
|
|
34260
34919
|
`;
|
|
34261
|
-
var Title =
|
|
34920
|
+
var Title = styled21(Heading)`
|
|
34262
34921
|
display: flex;
|
|
34263
34922
|
flex-direction: column;
|
|
34264
34923
|
align-items: flex-start;
|
|
34265
34924
|
gap: 0.25rem;
|
|
34266
34925
|
`;
|
|
34267
|
-
var BadgeContainer =
|
|
34926
|
+
var BadgeContainer = styled21("div")`
|
|
34268
34927
|
display: flex;
|
|
34269
34928
|
align-items: center;
|
|
34270
34929
|
gap: 0.75rem;
|
|
34271
34930
|
`;
|
|
34272
|
-
var ContentContainer =
|
|
34931
|
+
var ContentContainer = styled21("div")`
|
|
34273
34932
|
overflow: auto;
|
|
34274
34933
|
display: flex;
|
|
34275
34934
|
flex-direction: column;
|
|
@@ -34290,7 +34949,7 @@ function View(props) {
|
|
|
34290
34949
|
const { node, onNavigate } = props;
|
|
34291
34950
|
if (!snapshot || snapshot === "unavailable") return;
|
|
34292
34951
|
if (type === "costream") {
|
|
34293
|
-
return /* @__PURE__ */ (0,
|
|
34952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
34294
34953
|
CoStreamView,
|
|
34295
34954
|
{
|
|
34296
34955
|
data: snapshot,
|
|
@@ -34301,7 +34960,7 @@ function View(props) {
|
|
|
34301
34960
|
);
|
|
34302
34961
|
}
|
|
34303
34962
|
if (extendedType === "group") {
|
|
34304
|
-
return /* @__PURE__ */ (0,
|
|
34963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
34305
34964
|
GroupView,
|
|
34306
34965
|
{
|
|
34307
34966
|
coValue: value,
|
|
@@ -34312,10 +34971,10 @@ function View(props) {
|
|
|
34312
34971
|
);
|
|
34313
34972
|
}
|
|
34314
34973
|
if (extendedType === "account") {
|
|
34315
|
-
return /* @__PURE__ */ (0,
|
|
34974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AccountView, { data: snapshot, node, onNavigate });
|
|
34316
34975
|
}
|
|
34317
34976
|
if (type === "coplaintext") {
|
|
34318
|
-
return /* @__PURE__ */ (0,
|
|
34977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CoPlainTextView, { data: snapshot });
|
|
34319
34978
|
}
|
|
34320
34979
|
if (type === "colist") {
|
|
34321
34980
|
const handleRemove = (index) => {
|
|
@@ -34324,7 +34983,7 @@ function View(props) {
|
|
|
34324
34983
|
list.delete(index);
|
|
34325
34984
|
}
|
|
34326
34985
|
};
|
|
34327
|
-
return /* @__PURE__ */ (0,
|
|
34986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
34328
34987
|
TableView,
|
|
34329
34988
|
{
|
|
34330
34989
|
data: snapshot,
|
|
@@ -34335,9 +34994,20 @@ function View(props) {
|
|
|
34335
34994
|
);
|
|
34336
34995
|
}
|
|
34337
34996
|
if (extendedType === "record") {
|
|
34338
|
-
return /* @__PURE__ */ (0,
|
|
34997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableView, { data: snapshot, node, onNavigate });
|
|
34998
|
+
}
|
|
34999
|
+
if (type === "comap") {
|
|
35000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
35001
|
+
CoMapView,
|
|
35002
|
+
{
|
|
35003
|
+
coValue: value,
|
|
35004
|
+
data: snapshot,
|
|
35005
|
+
node,
|
|
35006
|
+
onNavigate
|
|
35007
|
+
}
|
|
35008
|
+
);
|
|
34339
35009
|
}
|
|
34340
|
-
return /* @__PURE__ */ (0,
|
|
35010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(GridView, { data: snapshot, onNavigate, node });
|
|
34341
35011
|
}
|
|
34342
35012
|
function Page(props) {
|
|
34343
35013
|
const {
|
|
@@ -34353,13 +35023,13 @@ function Page(props) {
|
|
|
34353
35023
|
const coValue = useResolvedCoValue(coId, node);
|
|
34354
35024
|
const { value, snapshot, type, extendedType } = coValue;
|
|
34355
35025
|
if (snapshot === "unavailable") {
|
|
34356
|
-
return /* @__PURE__ */ (0,
|
|
35026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { style, children: "Data unavailable" });
|
|
34357
35027
|
}
|
|
34358
35028
|
if (!snapshot) {
|
|
34359
|
-
return /* @__PURE__ */ (0,
|
|
35029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { style });
|
|
34360
35030
|
}
|
|
34361
|
-
return /* @__PURE__ */ (0,
|
|
34362
|
-
!isTopLevel && /* @__PURE__ */ (0,
|
|
35031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(PageContainer, { style, className, isTopLevel, children: [
|
|
35032
|
+
!isTopLevel && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
34363
35033
|
BackButton,
|
|
34364
35034
|
{
|
|
34365
35035
|
"aria-label": "Back",
|
|
@@ -34369,27 +35039,27 @@ function Page(props) {
|
|
|
34369
35039
|
"aria-hidden": "true"
|
|
34370
35040
|
}
|
|
34371
35041
|
),
|
|
34372
|
-
/* @__PURE__ */ (0,
|
|
34373
|
-
/* @__PURE__ */ (0,
|
|
35042
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(HeaderContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(TitleContainer, { children: [
|
|
35043
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Title, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
|
|
34374
35044
|
name,
|
|
34375
|
-
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */ (0,
|
|
35045
|
+
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { style: { color: "#57534e", fontWeight: 500 }, children: [
|
|
34376
35046
|
" ",
|
|
34377
35047
|
snapshot.name
|
|
34378
35048
|
] }) : null
|
|
34379
35049
|
] }) }),
|
|
34380
|
-
/* @__PURE__ */ (0,
|
|
34381
|
-
/* @__PURE__ */ (0,
|
|
34382
|
-
/* @__PURE__ */ (0,
|
|
35050
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(BadgeContainer, { children: [
|
|
35051
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Badge, { children: type && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TypeIcon, { type, extendedType }) }),
|
|
35052
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Badge, { children: coId })
|
|
34383
35053
|
] })
|
|
34384
35054
|
] }) }),
|
|
34385
|
-
/* @__PURE__ */ (0,
|
|
34386
|
-
/* @__PURE__ */ (0,
|
|
34387
|
-
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */ (0,
|
|
34388
|
-
/* @__PURE__ */ (0,
|
|
34389
|
-
/* @__PURE__ */ (0,
|
|
35055
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(ContentContainer, { children: [
|
|
35056
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(View, { ...props, coValue }),
|
|
35057
|
+
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
35058
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RoleDisplay, { node, value }),
|
|
35059
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Text, { muted: true, children: [
|
|
34390
35060
|
"Owned by",
|
|
34391
35061
|
" ",
|
|
34392
|
-
/* @__PURE__ */ (0,
|
|
35062
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
34393
35063
|
AccountOrGroupText,
|
|
34394
35064
|
{
|
|
34395
35065
|
coId: value.group.id,
|
|
@@ -34402,16 +35072,16 @@ function Page(props) {
|
|
|
34402
35072
|
)
|
|
34403
35073
|
] })
|
|
34404
35074
|
] }),
|
|
34405
|
-
value && /* @__PURE__ */ (0,
|
|
35075
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(HistoryView, { coValue: value, node })
|
|
34406
35076
|
] })
|
|
34407
35077
|
] });
|
|
34408
35078
|
}
|
|
34409
35079
|
|
|
34410
35080
|
// src/inspector/ui/error-boundary.tsx
|
|
34411
|
-
var
|
|
34412
|
-
var
|
|
34413
|
-
import { styled as
|
|
34414
|
-
var ErrorBoundary = class extends
|
|
35081
|
+
var import_react22 = __toESM(require_react(), 1);
|
|
35082
|
+
var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
|
|
35083
|
+
import { styled as styled22 } from "goober";
|
|
35084
|
+
var ErrorBoundary = class extends import_react22.default.Component {
|
|
34415
35085
|
constructor(props) {
|
|
34416
35086
|
super(props);
|
|
34417
35087
|
this.state = { hasError: false };
|
|
@@ -34424,24 +35094,24 @@ var ErrorBoundary = class extends import_react19.default.Component {
|
|
|
34424
35094
|
}
|
|
34425
35095
|
render() {
|
|
34426
35096
|
if (this.state.hasError) {
|
|
34427
|
-
return /* @__PURE__ */ (0,
|
|
34428
|
-
/* @__PURE__ */ (0,
|
|
34429
|
-
/* @__PURE__ */ (0,
|
|
34430
|
-
/* @__PURE__ */ (0,
|
|
35097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { style: { padding: "1rem" }, children: [
|
|
35098
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(StyledHeading2, { children: this.props.title }),
|
|
35099
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Text, { mono: true, style: { marginTop: "0.5rem", color: "#ef4444" }, children: this.state.error?.message || "An unexpected error occurred" }),
|
|
35100
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { style: { paddingLeft: "1rem", color: "#ef4444" }, children: this.state.error?.stack })
|
|
34431
35101
|
] });
|
|
34432
35102
|
}
|
|
34433
35103
|
return this.props.children;
|
|
34434
35104
|
}
|
|
34435
35105
|
};
|
|
34436
|
-
var StyledHeading2 =
|
|
35106
|
+
var StyledHeading2 = styled22("h1")`
|
|
34437
35107
|
font-size: 1.125rem;
|
|
34438
35108
|
font-weight: 500;
|
|
34439
35109
|
color: var(--j-text-color-strong);
|
|
34440
35110
|
`;
|
|
34441
35111
|
|
|
34442
35112
|
// src/inspector/viewer/page-stack.tsx
|
|
34443
|
-
var
|
|
34444
|
-
var PageStackContainer =
|
|
35113
|
+
var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
|
|
35114
|
+
var PageStackContainer = styled23("div")`
|
|
34445
35115
|
position: relative;
|
|
34446
35116
|
padding: 0 0.75rem;
|
|
34447
35117
|
overflow-y: auto;
|
|
@@ -34458,9 +35128,9 @@ function PageStack({
|
|
|
34458
35128
|
}) {
|
|
34459
35129
|
const page = path[path.length - 1];
|
|
34460
35130
|
const index = path.length - 1;
|
|
34461
|
-
return /* @__PURE__ */ (0,
|
|
35131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(PageStackContainer, { children: [
|
|
34462
35132
|
children,
|
|
34463
|
-
node && page && /* @__PURE__ */ (0,
|
|
35133
|
+
node && page && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ErrorBoundary, { title: "An error occurred while rendering this CoValue", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
34464
35134
|
Page,
|
|
34465
35135
|
{
|
|
34466
35136
|
coId: page.coId,
|
|
@@ -34475,10 +35145,10 @@ function PageStack({
|
|
|
34475
35145
|
}
|
|
34476
35146
|
|
|
34477
35147
|
// src/inspector/viewer/use-page-path.ts
|
|
34478
|
-
var
|
|
35148
|
+
var import_react23 = __toESM(require_react(), 1);
|
|
34479
35149
|
var STORAGE_KEY = "jazz-inspector-paths";
|
|
34480
35150
|
function usePagePath(defaultPath) {
|
|
34481
|
-
const [path, setPath] = (0,
|
|
35151
|
+
const [path, setPath] = (0, import_react23.useState)(() => {
|
|
34482
35152
|
if (typeof window === "undefined") return [];
|
|
34483
35153
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
34484
35154
|
if (stored) {
|
|
@@ -34490,34 +35160,34 @@ function usePagePath(defaultPath) {
|
|
|
34490
35160
|
}
|
|
34491
35161
|
return defaultPath || [];
|
|
34492
35162
|
});
|
|
34493
|
-
const updatePath = (0,
|
|
35163
|
+
const updatePath = (0, import_react23.useCallback)((newPath) => {
|
|
34494
35164
|
setPath(newPath);
|
|
34495
35165
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(newPath));
|
|
34496
35166
|
}, []);
|
|
34497
|
-
(0,
|
|
35167
|
+
(0, import_react23.useEffect)(() => {
|
|
34498
35168
|
if (defaultPath && JSON.stringify(path) !== JSON.stringify(defaultPath)) {
|
|
34499
35169
|
updatePath(defaultPath);
|
|
34500
35170
|
}
|
|
34501
35171
|
}, [defaultPath, path, updatePath]);
|
|
34502
|
-
const addPages = (0,
|
|
35172
|
+
const addPages = (0, import_react23.useCallback)(
|
|
34503
35173
|
(newPages) => {
|
|
34504
35174
|
updatePath([...path, ...newPages]);
|
|
34505
35175
|
},
|
|
34506
35176
|
[path, updatePath]
|
|
34507
35177
|
);
|
|
34508
|
-
const goToIndex = (0,
|
|
35178
|
+
const goToIndex = (0, import_react23.useCallback)(
|
|
34509
35179
|
(index) => {
|
|
34510
35180
|
updatePath(path.slice(0, index + 1));
|
|
34511
35181
|
},
|
|
34512
35182
|
[path, updatePath]
|
|
34513
35183
|
);
|
|
34514
|
-
const setPage = (0,
|
|
35184
|
+
const setPage = (0, import_react23.useCallback)(
|
|
34515
35185
|
(coId) => {
|
|
34516
35186
|
updatePath([{ coId, name: "Root" }]);
|
|
34517
35187
|
},
|
|
34518
35188
|
[updatePath]
|
|
34519
35189
|
);
|
|
34520
|
-
const goBack = (0,
|
|
35190
|
+
const goBack = (0, import_react23.useCallback)(() => {
|
|
34521
35191
|
if (path.length > 1) {
|
|
34522
35192
|
updatePath(path.slice(0, path.length - 1));
|
|
34523
35193
|
}
|
|
@@ -34532,8 +35202,8 @@ function usePagePath(defaultPath) {
|
|
|
34532
35202
|
}
|
|
34533
35203
|
|
|
34534
35204
|
// src/inspector/ui/global-styles.tsx
|
|
34535
|
-
import { styled as
|
|
34536
|
-
var GlobalStyles =
|
|
35205
|
+
import { styled as styled24 } from "goober";
|
|
35206
|
+
var GlobalStyles = styled24("div")`
|
|
34537
35207
|
/* Colors */
|
|
34538
35208
|
--j-primary-color: #146AFF;
|
|
34539
35209
|
--j-link-color: var(--j-primary-color);
|
|
@@ -34607,9 +35277,9 @@ var GlobalStyles = styled21("div")`
|
|
|
34607
35277
|
`;
|
|
34608
35278
|
|
|
34609
35279
|
// src/inspector/viewer/inspector-button.tsx
|
|
34610
|
-
var
|
|
34611
|
-
import { styled as
|
|
34612
|
-
var StyledInspectorButton =
|
|
35280
|
+
var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
|
|
35281
|
+
import { styled as styled25 } from "goober";
|
|
35282
|
+
var StyledInspectorButton = styled25("button")`
|
|
34613
35283
|
position: fixed;
|
|
34614
35284
|
width: 2.5rem;
|
|
34615
35285
|
height: 2.5rem;
|
|
@@ -34640,7 +35310,7 @@ var StyledInspectorButton = styled22("button")`
|
|
|
34640
35310
|
}
|
|
34641
35311
|
}}
|
|
34642
35312
|
`;
|
|
34643
|
-
var JazzIcon =
|
|
35313
|
+
var JazzIcon = styled25("svg")`
|
|
34644
35314
|
width: 100%;
|
|
34645
35315
|
height: auto;
|
|
34646
35316
|
position: relative;
|
|
@@ -34651,8 +35321,8 @@ function InspectorButton({
|
|
|
34651
35321
|
position = "right",
|
|
34652
35322
|
...buttonProps
|
|
34653
35323
|
}) {
|
|
34654
|
-
return /* @__PURE__ */ (0,
|
|
34655
|
-
/* @__PURE__ */ (0,
|
|
35324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(StyledInspectorButton, { position, ...buttonProps, children: [
|
|
35325
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
34656
35326
|
JazzIcon,
|
|
34657
35327
|
{
|
|
34658
35328
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -34660,7 +35330,7 @@ function InspectorButton({
|
|
|
34660
35330
|
height: "115",
|
|
34661
35331
|
viewBox: "0 0 119 115",
|
|
34662
35332
|
fill: "none",
|
|
34663
|
-
children: /* @__PURE__ */ (0,
|
|
35333
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
34664
35334
|
"path",
|
|
34665
35335
|
{
|
|
34666
35336
|
fillRule: "evenodd",
|
|
@@ -34671,7 +35341,7 @@ function InspectorButton({
|
|
|
34671
35341
|
)
|
|
34672
35342
|
}
|
|
34673
35343
|
),
|
|
34674
|
-
/* @__PURE__ */ (0,
|
|
35344
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
34675
35345
|
"span",
|
|
34676
35346
|
{
|
|
34677
35347
|
style: {
|
|
@@ -34692,30 +35362,30 @@ function InspectorButton({
|
|
|
34692
35362
|
}
|
|
34693
35363
|
|
|
34694
35364
|
// src/inspector/viewer/use-open-inspector.ts
|
|
34695
|
-
var
|
|
35365
|
+
var import_react24 = __toESM(require_react(), 1);
|
|
34696
35366
|
var STORAGE_KEY2 = "jazz-inspector-open";
|
|
34697
35367
|
function useOpenInspector() {
|
|
34698
|
-
const [open, setOpen] = (0,
|
|
35368
|
+
const [open, setOpen] = (0, import_react24.useState)(() => {
|
|
34699
35369
|
if (typeof window === "undefined") return false;
|
|
34700
35370
|
const stored = localStorage.getItem(STORAGE_KEY2);
|
|
34701
35371
|
return stored ? JSON.parse(stored) : false;
|
|
34702
35372
|
});
|
|
34703
|
-
(0,
|
|
35373
|
+
(0, import_react24.useEffect)(() => {
|
|
34704
35374
|
localStorage.setItem(STORAGE_KEY2, JSON.stringify(open));
|
|
34705
35375
|
}, [open]);
|
|
34706
35376
|
return [open, setOpen];
|
|
34707
35377
|
}
|
|
34708
35378
|
|
|
34709
35379
|
// src/inspector/viewer/delete-local-data.tsx
|
|
34710
|
-
var
|
|
34711
|
-
var
|
|
35380
|
+
var import_react25 = __toESM(require_react(), 1);
|
|
35381
|
+
var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
|
|
34712
35382
|
var DELETE_LOCAL_DATA_STRING = "delete my local data";
|
|
34713
35383
|
function DeleteLocalData() {
|
|
34714
|
-
const [showDeleteModal, setShowDeleteModal] = (0,
|
|
34715
|
-
const [confirmDeleteString, setConfirmDeleteString] = (0,
|
|
34716
|
-
return /* @__PURE__ */ (0,
|
|
34717
|
-
/* @__PURE__ */ (0,
|
|
34718
|
-
/* @__PURE__ */ (0,
|
|
35384
|
+
const [showDeleteModal, setShowDeleteModal] = (0, import_react25.useState)(false);
|
|
35385
|
+
const [confirmDeleteString, setConfirmDeleteString] = (0, import_react25.useState)("");
|
|
35386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
35387
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { variant: "destructive", onClick: () => setShowDeleteModal(true), children: "Delete my local data" }),
|
|
35388
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
34719
35389
|
Modal,
|
|
34720
35390
|
{
|
|
34721
35391
|
isOpen: showDeleteModal,
|
|
@@ -34723,7 +35393,7 @@ function DeleteLocalData() {
|
|
|
34723
35393
|
heading: "Delete Local Data",
|
|
34724
35394
|
showButtons: false,
|
|
34725
35395
|
children: [
|
|
34726
|
-
/* @__PURE__ */ (0,
|
|
35396
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
34727
35397
|
"div",
|
|
34728
35398
|
{
|
|
34729
35399
|
style: {
|
|
@@ -34734,33 +35404,33 @@ function DeleteLocalData() {
|
|
|
34734
35404
|
gap: "0.5rem"
|
|
34735
35405
|
},
|
|
34736
35406
|
children: [
|
|
34737
|
-
/* @__PURE__ */ (0,
|
|
35407
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("p", { children: [
|
|
34738
35408
|
"This action ",
|
|
34739
|
-
/* @__PURE__ */ (0,
|
|
35409
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("strong", { children: "cannot" }),
|
|
34740
35410
|
" be undone."
|
|
34741
35411
|
] }),
|
|
34742
|
-
/* @__PURE__ */ (0,
|
|
35412
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("p", { children: [
|
|
34743
35413
|
"Be aware that the following data will be",
|
|
34744
35414
|
" ",
|
|
34745
|
-
/* @__PURE__ */ (0,
|
|
35415
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("strong", { children: "permanently" }),
|
|
34746
35416
|
" deleted:"
|
|
34747
35417
|
] }),
|
|
34748
|
-
/* @__PURE__ */ (0,
|
|
34749
|
-
/* @__PURE__ */ (0,
|
|
35418
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("ul", { style: { listStyleType: "disc", paddingLeft: "1rem" }, children: [
|
|
35419
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("li", { children: [
|
|
34750
35420
|
"Unsynced data for ",
|
|
34751
|
-
/* @__PURE__ */ (0,
|
|
35421
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("strong", { children: "all apps" }),
|
|
34752
35422
|
" on",
|
|
34753
35423
|
" ",
|
|
34754
|
-
/* @__PURE__ */ (0,
|
|
35424
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("code", { children: window.location.origin })
|
|
34755
35425
|
] }),
|
|
34756
|
-
/* @__PURE__ */ (0,
|
|
34757
|
-
/* @__PURE__ */ (0,
|
|
35426
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("li", { children: "Accounts" }),
|
|
35427
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("li", { children: "Logged in sessions" })
|
|
34758
35428
|
] }),
|
|
34759
|
-
/* @__PURE__ */ (0,
|
|
35429
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", {})
|
|
34760
35430
|
]
|
|
34761
35431
|
}
|
|
34762
35432
|
),
|
|
34763
|
-
/* @__PURE__ */ (0,
|
|
35433
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
34764
35434
|
Input,
|
|
34765
35435
|
{
|
|
34766
35436
|
label: `Type "${DELETE_LOCAL_DATA_STRING}" to confirm`,
|
|
@@ -34771,7 +35441,7 @@ function DeleteLocalData() {
|
|
|
34771
35441
|
}
|
|
34772
35442
|
}
|
|
34773
35443
|
),
|
|
34774
|
-
/* @__PURE__ */ (0,
|
|
35444
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
34775
35445
|
"p",
|
|
34776
35446
|
{
|
|
34777
35447
|
style: {
|
|
@@ -34781,14 +35451,14 @@ function DeleteLocalData() {
|
|
|
34781
35451
|
flexDirection: "column",
|
|
34782
35452
|
gap: "0.5rem"
|
|
34783
35453
|
},
|
|
34784
|
-
children: /* @__PURE__ */ (0,
|
|
35454
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("small", { children: [
|
|
34785
35455
|
"Data synced to a sync server will ",
|
|
34786
|
-
/* @__PURE__ */ (0,
|
|
35456
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("strong", { children: "not" }),
|
|
34787
35457
|
" be deleted, and will be synced when you log in again."
|
|
34788
35458
|
] })
|
|
34789
35459
|
}
|
|
34790
35460
|
),
|
|
34791
|
-
/* @__PURE__ */ (0,
|
|
35461
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
34792
35462
|
"div",
|
|
34793
35463
|
{
|
|
34794
35464
|
style: {
|
|
@@ -34798,8 +35468,8 @@ function DeleteLocalData() {
|
|
|
34798
35468
|
gap: "0.5rem"
|
|
34799
35469
|
},
|
|
34800
35470
|
children: [
|
|
34801
|
-
/* @__PURE__ */ (0,
|
|
34802
|
-
/* @__PURE__ */ (0,
|
|
35471
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { variant: "secondary", onClick: () => setShowDeleteModal(false), children: "Cancel" }),
|
|
35472
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
34803
35473
|
Button,
|
|
34804
35474
|
{
|
|
34805
35475
|
variant: "destructive",
|
|
@@ -34826,8 +35496,8 @@ function DeleteLocalData() {
|
|
|
34826
35496
|
}
|
|
34827
35497
|
|
|
34828
35498
|
// src/inspector/viewer/new-app.tsx
|
|
34829
|
-
var
|
|
34830
|
-
var InspectorContainer =
|
|
35499
|
+
var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
|
|
35500
|
+
var InspectorContainer = styled26("div")`
|
|
34831
35501
|
position: fixed;
|
|
34832
35502
|
height: 50vh;
|
|
34833
35503
|
max-height: 800px;
|
|
@@ -34844,17 +35514,17 @@ var InspectorContainer = styled23("div")`
|
|
|
34844
35514
|
background-color: var(--j-background);
|
|
34845
35515
|
}
|
|
34846
35516
|
`;
|
|
34847
|
-
var HeaderContainer2 =
|
|
35517
|
+
var HeaderContainer2 = styled26("div")`
|
|
34848
35518
|
display: flex;
|
|
34849
35519
|
align-items: center;
|
|
34850
35520
|
gap: 1rem;
|
|
34851
35521
|
padding: 0 0.75rem;
|
|
34852
35522
|
margin: 0.75rem 0;
|
|
34853
35523
|
`;
|
|
34854
|
-
var Form =
|
|
35524
|
+
var Form = styled26("form")`
|
|
34855
35525
|
width: 24rem;
|
|
34856
35526
|
`;
|
|
34857
|
-
var InitialForm =
|
|
35527
|
+
var InitialForm = styled26("form")`
|
|
34858
35528
|
display: flex;
|
|
34859
35529
|
flex-direction: column;
|
|
34860
35530
|
position: relative;
|
|
@@ -34866,7 +35536,7 @@ var InitialForm = styled23("form")`
|
|
|
34866
35536
|
max-width: 24rem;
|
|
34867
35537
|
margin: 0 auto;
|
|
34868
35538
|
`;
|
|
34869
|
-
var OrText =
|
|
35539
|
+
var OrText = styled26("p")`
|
|
34870
35540
|
text-align: center;
|
|
34871
35541
|
`;
|
|
34872
35542
|
function JazzInspectorInternal({
|
|
@@ -34875,7 +35545,7 @@ function JazzInspectorInternal({
|
|
|
34875
35545
|
accountId
|
|
34876
35546
|
}) {
|
|
34877
35547
|
const [open, setOpen] = useOpenInspector();
|
|
34878
|
-
const [coValueId, setCoValueId] = (0,
|
|
35548
|
+
const [coValueId, setCoValueId] = (0, import_react26.useState)("");
|
|
34879
35549
|
const { path, addPages, goToIndex, goBack, setPage } = usePagePath();
|
|
34880
35550
|
const handleCoValueIdSubmit = (e) => {
|
|
34881
35551
|
e.preventDefault();
|
|
@@ -34885,12 +35555,12 @@ function JazzInspectorInternal({
|
|
|
34885
35555
|
setCoValueId("");
|
|
34886
35556
|
};
|
|
34887
35557
|
if (!open) {
|
|
34888
|
-
return /* @__PURE__ */ (0,
|
|
35558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(InspectorButton, { position, onClick: () => setOpen(true) });
|
|
34889
35559
|
}
|
|
34890
|
-
return /* @__PURE__ */ (0,
|
|
34891
|
-
/* @__PURE__ */ (0,
|
|
34892
|
-
/* @__PURE__ */ (0,
|
|
34893
|
-
path.length !== 0 && /* @__PURE__ */ (0,
|
|
35560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(InspectorContainer, { as: GlobalStyles, style: { zIndex: 999 }, children: [
|
|
35561
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(HeaderContainer2, { children: [
|
|
35562
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Breadcrumbs, { path, onBreadcrumbClick: goToIndex }),
|
|
35563
|
+
path.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Form, { onSubmit: handleCoValueIdSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
34894
35564
|
Input,
|
|
34895
35565
|
{
|
|
34896
35566
|
label: "CoValue ID",
|
|
@@ -34901,24 +35571,24 @@ function JazzInspectorInternal({
|
|
|
34901
35571
|
onChange: (e) => setCoValueId(e.target.value)
|
|
34902
35572
|
}
|
|
34903
35573
|
) }),
|
|
34904
|
-
/* @__PURE__ */ (0,
|
|
34905
|
-
/* @__PURE__ */ (0,
|
|
35574
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(DeleteLocalData, {}),
|
|
35575
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button, { variant: "plain", type: "button", onClick: () => setOpen(false), children: "Close" })
|
|
34906
35576
|
] }),
|
|
34907
|
-
/* @__PURE__ */ (0,
|
|
35577
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
34908
35578
|
PageStack,
|
|
34909
35579
|
{
|
|
34910
35580
|
path,
|
|
34911
35581
|
node: localNode,
|
|
34912
35582
|
goBack,
|
|
34913
35583
|
addPages,
|
|
34914
|
-
children: path.length <= 0 && /* @__PURE__ */ (0,
|
|
35584
|
+
children: path.length <= 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
34915
35585
|
InitialForm,
|
|
34916
35586
|
{
|
|
34917
35587
|
onSubmit: handleCoValueIdSubmit,
|
|
34918
35588
|
"aria-hidden": path.length !== 0,
|
|
34919
35589
|
children: [
|
|
34920
|
-
/* @__PURE__ */ (0,
|
|
34921
|
-
/* @__PURE__ */ (0,
|
|
35590
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Heading, { children: "Jazz CoValue Inspector" }),
|
|
35591
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
34922
35592
|
Input,
|
|
34923
35593
|
{
|
|
34924
35594
|
label: "CoValue ID",
|
|
@@ -34929,10 +35599,10 @@ function JazzInspectorInternal({
|
|
|
34929
35599
|
onChange: (e) => setCoValueId(e.target.value)
|
|
34930
35600
|
}
|
|
34931
35601
|
),
|
|
34932
|
-
/* @__PURE__ */ (0,
|
|
34933
|
-
accountId && /* @__PURE__ */ (0,
|
|
34934
|
-
/* @__PURE__ */ (0,
|
|
34935
|
-
/* @__PURE__ */ (0,
|
|
35602
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button, { type: "submit", variant: "primary", children: "Inspect CoValue" }),
|
|
35603
|
+
accountId && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
35604
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(OrText, { children: "or" }),
|
|
35605
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
34936
35606
|
Button,
|
|
34937
35607
|
{
|
|
34938
35608
|
variant: "secondary",
|
|
@@ -34953,8 +35623,8 @@ function JazzInspectorInternal({
|
|
|
34953
35623
|
}
|
|
34954
35624
|
|
|
34955
35625
|
// src/inspector/custom-element.tsx
|
|
34956
|
-
var
|
|
34957
|
-
setup(
|
|
35626
|
+
var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
|
|
35627
|
+
setup(import_react27.default.createElement);
|
|
34958
35628
|
var JazzInspectorElement = class extends HTMLElement {
|
|
34959
35629
|
constructor() {
|
|
34960
35630
|
super(...arguments);
|
|
@@ -34996,7 +35666,7 @@ var JazzInspectorElement = class extends HTMLElement {
|
|
|
34996
35666
|
return;
|
|
34997
35667
|
}
|
|
34998
35668
|
this.root?.render(
|
|
34999
|
-
/* @__PURE__ */ (0,
|
|
35669
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
35000
35670
|
JazzInspectorInternal,
|
|
35001
35671
|
{
|
|
35002
35672
|
localNode: this.account.$jazz.localNode,
|
|
@@ -35122,4 +35792,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
35122
35792
|
* LICENSE file in the root directory of this source tree.
|
|
35123
35793
|
*)
|
|
35124
35794
|
*/
|
|
35125
|
-
//# sourceMappingURL=custom-element-
|
|
35795
|
+
//# sourceMappingURL=custom-element-3JAYHXWQ.js.map
|