jazz-tools 0.19.0 → 0.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +53 -53
- package/CHANGELOG.md +21 -0
- package/dist/{chunk-P3YLNFN4.js → chunk-NCNM6UDZ.js} +61 -22
- package/dist/chunk-NCNM6UDZ.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/inspector/{custom-element-QESCMFY7.js → custom-element-ABVPHX53.js} +1118 -465
- package/dist/inspector/custom-element-ABVPHX53.js.map +1 -0
- package/dist/inspector/index.js +1090 -437
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/register-custom-element.js +1 -1
- package/dist/inspector/tests/utils/history.test.d.ts +2 -0
- package/dist/inspector/tests/utils/history.test.d.ts.map +1 -0
- package/dist/inspector/tests/viewer/co-value-editor.test.d.ts +2 -0
- package/dist/inspector/tests/viewer/co-value-editor.test.d.ts.map +1 -0
- package/dist/inspector/tests/viewer/comap-view.test.d.ts +2 -0
- package/dist/inspector/tests/viewer/comap-view.test.d.ts.map +1 -0
- package/dist/inspector/ui/icon.d.ts +6 -0
- package/dist/inspector/ui/icon.d.ts.map +1 -1
- package/dist/inspector/ui/icons/add-icon.d.ts +2 -0
- package/dist/inspector/ui/icons/add-icon.d.ts.map +1 -0
- package/dist/inspector/ui/icons/edit-icon.d.ts +2 -0
- package/dist/inspector/ui/icons/edit-icon.d.ts.map +1 -0
- package/dist/inspector/ui/icons/history.d.ts +2 -0
- package/dist/inspector/ui/icons/history.d.ts.map +1 -0
- package/dist/inspector/utils/history.d.ts +3 -0
- package/dist/inspector/utils/history.d.ts.map +1 -0
- package/dist/inspector/utils/transactions-changes.d.ts +38 -0
- package/dist/inspector/utils/transactions-changes.d.ts.map +1 -0
- package/dist/inspector/viewer/co-map-view.d.ts +9 -0
- package/dist/inspector/viewer/co-map-view.d.ts.map +1 -0
- package/dist/inspector/viewer/co-value-editor.d.ts +10 -0
- package/dist/inspector/viewer/co-value-editor.d.ts.map +1 -0
- package/dist/inspector/viewer/grid-view.d.ts +3 -2
- package/dist/inspector/viewer/grid-view.d.ts.map +1 -1
- package/dist/inspector/viewer/history-view.d.ts.map +1 -1
- package/dist/inspector/viewer/page.d.ts.map +1 -1
- package/dist/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/coValues/deepLoading.d.ts +8 -7
- package/dist/tools/coValues/deepLoading.d.ts.map +1 -1
- package/dist/tools/coValues/interfaces.d.ts +3 -3
- package/dist/tools/coValues/interfaces.d.ts.map +1 -1
- package/dist/tools/coValues/schemaUnion.d.ts +6 -9
- package/dist/tools/coValues/schemaUnion.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.d.ts +18 -7
- package/dist/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.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/dist/tools/subscribe/SubscriptionScope.d.ts +1 -0
- package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/inspector/tests/utils/history.test.ts +401 -0
- package/src/inspector/tests/viewer/co-value-editor.test.tsx +903 -0
- package/src/inspector/tests/viewer/comap-view.test.tsx +581 -0
- package/src/inspector/ui/icon.tsx +6 -0
- package/src/inspector/ui/icons/add-icon.tsx +21 -0
- package/src/inspector/ui/icons/edit-icon.tsx +17 -0
- package/src/inspector/ui/icons/history.tsx +28 -0
- package/src/inspector/ui/modal.tsx +3 -3
- package/src/inspector/utils/history.ts +49 -0
- package/src/inspector/utils/transactions-changes.ts +98 -0
- package/src/inspector/viewer/co-map-view.tsx +312 -0
- package/src/inspector/viewer/co-value-editor.tsx +164 -0
- package/src/inspector/viewer/grid-view.tsx +139 -10
- package/src/inspector/viewer/history-view.tsx +16 -118
- package/src/inspector/viewer/page.tsx +13 -0
- package/src/react-core/tests/usePassPhraseAuth.test.ts +1 -1
- package/src/tools/coValues/CoFieldInit.ts +6 -3
- package/src/tools/coValues/coList.ts +1 -1
- package/src/tools/coValues/deepLoading.ts +85 -71
- package/src/tools/coValues/interfaces.ts +3 -3
- package/src/tools/coValues/schemaUnion.ts +19 -14
- package/src/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.ts +69 -9
- package/src/tools/implementation/zodSchema/typeConverters/CoFieldSchemaInit.ts +12 -7
- package/src/tools/implementation/zodSchema/unionUtils.ts +35 -4
- package/src/tools/subscribe/SubscriptionScope.ts +3 -14
- package/src/tools/tests/coDiscriminatedUnion.test.ts +347 -5
- package/src/tools/tests/coVector.test.ts +43 -0
- package/src/tools/tests/deepLoading.test.ts +55 -59
- package/src/tools/tests/schema.resolved.test.ts +70 -1
- package/dist/chunk-P3YLNFN4.js.map +0 -1
- 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,76 @@ 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
|
|
|
32937
33215
|
// src/inspector/viewer/grid-view.tsx
|
|
32938
|
-
var
|
|
33216
|
+
var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
|
|
32939
33217
|
function GridItem({
|
|
32940
33218
|
entry,
|
|
32941
33219
|
onNavigate,
|
|
32942
|
-
node
|
|
33220
|
+
node,
|
|
33221
|
+
coValue
|
|
32943
33222
|
}) {
|
|
32944
33223
|
const [key, value] = entry;
|
|
32945
33224
|
const isCoValue = isCoId(value);
|
|
32946
|
-
const
|
|
33225
|
+
const [isEditing, setIsEditing] = (0, import_react11.useState)(false);
|
|
33226
|
+
const handleEditClick = (e) => {
|
|
33227
|
+
e.stopPropagation();
|
|
33228
|
+
setIsEditing(true);
|
|
33229
|
+
};
|
|
33230
|
+
const handleCancel = () => {
|
|
33231
|
+
setIsEditing(false);
|
|
33232
|
+
};
|
|
33233
|
+
const handleDelete = (e) => {
|
|
33234
|
+
e.stopPropagation();
|
|
33235
|
+
if (confirm(`Are you sure you want to delete the property "${key}"?`)) {
|
|
33236
|
+
coValue?.core.makeTransaction(
|
|
33237
|
+
[
|
|
33238
|
+
{
|
|
33239
|
+
op: "del",
|
|
33240
|
+
key
|
|
33241
|
+
}
|
|
33242
|
+
],
|
|
33243
|
+
"private"
|
|
33244
|
+
);
|
|
33245
|
+
}
|
|
33246
|
+
};
|
|
33247
|
+
if (isEditing) {
|
|
33248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
33249
|
+
Card,
|
|
33250
|
+
{
|
|
33251
|
+
style: {
|
|
33252
|
+
backgroundColor: "var(--j-foreground)",
|
|
33253
|
+
borderColor: "var(--j-foreground)"
|
|
33254
|
+
},
|
|
33255
|
+
children: [
|
|
33256
|
+
/* @__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: [
|
|
33257
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { strong: true, children: key }),
|
|
33258
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Badge, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ResolveIcon, { coId: value, node }) })
|
|
33259
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { strong: true, children: key }) }) }),
|
|
33260
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardBody, { style: { wordBreak: "break-word" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
33261
|
+
CoValueEditor,
|
|
33262
|
+
{
|
|
33263
|
+
node,
|
|
33264
|
+
property: key,
|
|
33265
|
+
value,
|
|
33266
|
+
coValue,
|
|
33267
|
+
onCancel: handleCancel
|
|
33268
|
+
}
|
|
33269
|
+
) })
|
|
33270
|
+
]
|
|
33271
|
+
}
|
|
33272
|
+
);
|
|
33273
|
+
}
|
|
33274
|
+
const cardProps = isCoValue ? {
|
|
32947
33275
|
onClick: () => onNavigate([{ coId: value, name: key }]),
|
|
32948
33276
|
as: "button"
|
|
32949
33277
|
} : {
|
|
@@ -32952,12 +33280,34 @@ function GridItem({
|
|
|
32952
33280
|
borderColor: "var(--j-foreground)"
|
|
32953
33281
|
}
|
|
32954
33282
|
};
|
|
32955
|
-
return /* @__PURE__ */ (0,
|
|
32956
|
-
/* @__PURE__ */ (0,
|
|
32957
|
-
/* @__PURE__ */ (0,
|
|
32958
|
-
|
|
32959
|
-
|
|
32960
|
-
|
|
33283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Card, { ...cardProps, children: [
|
|
33284
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(CardHeader, { children: [
|
|
33285
|
+
/* @__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: [
|
|
33286
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { strong: true, children: key }),
|
|
33287
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Badge, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ResolveIcon, { coId: value, node }) })
|
|
33288
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { strong: true, children: key }) }),
|
|
33289
|
+
coValue && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ActionButtons, { children: [
|
|
33290
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
33291
|
+
EditButton,
|
|
33292
|
+
{
|
|
33293
|
+
onClick: handleEditClick,
|
|
33294
|
+
type: "button",
|
|
33295
|
+
"aria-label": "Edit",
|
|
33296
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "edit", size: "sm" })
|
|
33297
|
+
}
|
|
33298
|
+
),
|
|
33299
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
33300
|
+
DeleteButton,
|
|
33301
|
+
{
|
|
33302
|
+
onClick: handleDelete,
|
|
33303
|
+
type: "button",
|
|
33304
|
+
"aria-label": "Delete",
|
|
33305
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "delete", size: "sm" })
|
|
33306
|
+
}
|
|
33307
|
+
)
|
|
33308
|
+
] })
|
|
33309
|
+
] }),
|
|
33310
|
+
/* @__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
33311
|
ValueRenderer,
|
|
32962
33312
|
{
|
|
32963
33313
|
json: value,
|
|
@@ -32971,58 +33321,97 @@ function GridItem({
|
|
|
32971
33321
|
function GridView({
|
|
32972
33322
|
data,
|
|
32973
33323
|
onNavigate,
|
|
32974
|
-
node
|
|
33324
|
+
node,
|
|
33325
|
+
coValue
|
|
32975
33326
|
}) {
|
|
32976
33327
|
const entries = Object.entries(data);
|
|
32977
|
-
return /* @__PURE__ */ (0,
|
|
33328
|
+
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
33329
|
GridItem,
|
|
32979
33330
|
{
|
|
32980
33331
|
entry,
|
|
32981
33332
|
onNavigate,
|
|
32982
|
-
node
|
|
33333
|
+
node,
|
|
33334
|
+
coValue
|
|
32983
33335
|
},
|
|
32984
33336
|
childIndex
|
|
32985
33337
|
)) });
|
|
32986
33338
|
}
|
|
33339
|
+
var EditButton = styled14("button")`
|
|
33340
|
+
display: inline-flex;
|
|
33341
|
+
align-items: center;
|
|
33342
|
+
justify-content: center;
|
|
33343
|
+
padding: 0.25rem;
|
|
33344
|
+
border: none;
|
|
33345
|
+
background: transparent;
|
|
33346
|
+
cursor: pointer;
|
|
33347
|
+
color: var(--j-text-color);
|
|
33348
|
+
border-radius: var(--j-radius-sm);
|
|
33349
|
+
transition: background-color 0.2s;
|
|
32987
33350
|
|
|
32988
|
-
|
|
32989
|
-
var
|
|
32990
|
-
|
|
32991
|
-
|
|
32992
|
-
var
|
|
32993
|
-
|
|
32994
|
-
|
|
32995
|
-
|
|
32996
|
-
|
|
32997
|
-
border
|
|
32998
|
-
|
|
32999
|
-
|
|
33000
|
-
|
|
33001
|
-
|
|
33351
|
+
&:hover {
|
|
33352
|
+
background-color: var(--j-foreground);
|
|
33353
|
+
}
|
|
33354
|
+
`;
|
|
33355
|
+
var DeleteButton = styled14("button")`
|
|
33356
|
+
display: inline-flex;
|
|
33357
|
+
align-items: center;
|
|
33358
|
+
justify-content: center;
|
|
33359
|
+
padding: 0.25rem;
|
|
33360
|
+
border: none;
|
|
33361
|
+
background: transparent;
|
|
33362
|
+
cursor: pointer;
|
|
33363
|
+
color: var(--j-text-color);
|
|
33364
|
+
border-radius: var(--j-radius-sm);
|
|
33365
|
+
transition: background-color 0.2s;
|
|
33366
|
+
|
|
33367
|
+
&:hover {
|
|
33368
|
+
background-color: var(--j-foreground);
|
|
33369
|
+
}
|
|
33370
|
+
`;
|
|
33371
|
+
var ActionButtons = styled14("div")`
|
|
33372
|
+
display: flex;
|
|
33373
|
+
align-items: center;
|
|
33374
|
+
gap: 0.25rem;
|
|
33375
|
+
`;
|
|
33376
|
+
|
|
33377
|
+
// src/inspector/viewer/raw-data-card.tsx
|
|
33378
|
+
var import_react16 = __toESM(require_react(), 1);
|
|
33379
|
+
|
|
33380
|
+
// src/inspector/ui/modal.tsx
|
|
33381
|
+
var import_react12 = __toESM(require_react(), 1);
|
|
33382
|
+
import { styled as styled15 } from "goober";
|
|
33383
|
+
var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
|
|
33384
|
+
var ModalContent = styled15("dialog")`
|
|
33385
|
+
background-color: var(--j-background);
|
|
33386
|
+
border-radius: var(--j-radius-lg);
|
|
33387
|
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
|
33388
|
+
border: 1px solid var(--j-border-color);
|
|
33389
|
+
max-width: 32rem;
|
|
33390
|
+
margin-block: auto;
|
|
33002
33391
|
margin-inline: auto;
|
|
33003
33392
|
&::backdrop {
|
|
33004
33393
|
background-color: rgba(0, 0, 0, 0.7);
|
|
33005
33394
|
}
|
|
33006
|
-
|
|
33395
|
+
|
|
33007
33396
|
`;
|
|
33008
|
-
var ModalHeader =
|
|
33397
|
+
var ModalHeader = styled15("div")`
|
|
33009
33398
|
display: flex;
|
|
33010
33399
|
justify-content: space-between;
|
|
33011
33400
|
align-items: flex-start;
|
|
33012
33401
|
padding: 1.5rem 1.5rem 0 1.5rem;
|
|
33013
33402
|
gap: 1rem;
|
|
33014
33403
|
`;
|
|
33015
|
-
var ModalBody =
|
|
33404
|
+
var ModalBody = styled15("div")`
|
|
33016
33405
|
padding: 1rem 1.5rem;
|
|
33017
33406
|
flex: 1;
|
|
33018
33407
|
`;
|
|
33019
|
-
var ModalFooter =
|
|
33408
|
+
var ModalFooter = styled15("div")`
|
|
33020
33409
|
display: flex;
|
|
33021
33410
|
justify-content: flex-end;
|
|
33022
33411
|
gap: 0.75rem;
|
|
33023
33412
|
padding: 0 1.5rem 1.5rem 1.5rem;
|
|
33024
33413
|
`;
|
|
33025
|
-
var CloseButton =
|
|
33414
|
+
var CloseButton = styled15("button")`
|
|
33026
33415
|
background: none;
|
|
33027
33416
|
border: none;
|
|
33028
33417
|
cursor: pointer;
|
|
@@ -33036,17 +33425,17 @@ var CloseButton = styled12("button")`
|
|
|
33036
33425
|
justify-content: center;
|
|
33037
33426
|
min-width: 2rem;
|
|
33038
33427
|
min-height: 2rem;
|
|
33039
|
-
|
|
33428
|
+
|
|
33040
33429
|
&:hover {
|
|
33041
33430
|
background-color: var(--j-foreground);
|
|
33042
33431
|
}
|
|
33043
|
-
|
|
33432
|
+
|
|
33044
33433
|
&:focus-visible {
|
|
33045
33434
|
outline: 2px solid var(--j-border-focus);
|
|
33046
33435
|
outline-offset: 2px;
|
|
33047
33436
|
}
|
|
33048
33437
|
`;
|
|
33049
|
-
var Modal = (0,
|
|
33438
|
+
var Modal = (0, import_react12.forwardRef)(
|
|
33050
33439
|
({
|
|
33051
33440
|
isOpen,
|
|
33052
33441
|
onClose,
|
|
@@ -33060,8 +33449,8 @@ var Modal = (0, import_react9.forwardRef)(
|
|
|
33060
33449
|
showButtons = true,
|
|
33061
33450
|
className
|
|
33062
33451
|
}, ref) => {
|
|
33063
|
-
const modalRef = (0,
|
|
33064
|
-
(0,
|
|
33452
|
+
const modalRef = (0, import_react12.useRef)(null);
|
|
33453
|
+
(0, import_react12.useEffect)(() => {
|
|
33065
33454
|
if (isOpen) {
|
|
33066
33455
|
modalRef.current?.showModal();
|
|
33067
33456
|
} else {
|
|
@@ -33078,7 +33467,7 @@ var Modal = (0, import_react9.forwardRef)(
|
|
|
33078
33467
|
onClose();
|
|
33079
33468
|
};
|
|
33080
33469
|
if (!isOpen) return null;
|
|
33081
|
-
return /* @__PURE__ */ (0,
|
|
33470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
33082
33471
|
ModalContent,
|
|
33083
33472
|
{
|
|
33084
33473
|
ref: ref || modalRef,
|
|
@@ -33087,17 +33476,17 @@ var Modal = (0, import_react9.forwardRef)(
|
|
|
33087
33476
|
"aria-labelledby": "modal-heading",
|
|
33088
33477
|
onClose,
|
|
33089
33478
|
children: [
|
|
33090
|
-
/* @__PURE__ */ (0,
|
|
33091
|
-
/* @__PURE__ */ (0,
|
|
33092
|
-
/* @__PURE__ */ (0,
|
|
33479
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(ModalHeader, { children: [
|
|
33480
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Heading, { id: "modal-heading", children: heading }),
|
|
33481
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CloseButton, { onClick: onClose, "aria-label": "Close modal", type: "button", children: "\xD7" })
|
|
33093
33482
|
] }),
|
|
33094
|
-
/* @__PURE__ */ (0,
|
|
33095
|
-
text && /* @__PURE__ */ (0,
|
|
33483
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(ModalBody, { children: [
|
|
33484
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { style: { margin: "0 0 1rem 0", color: "var(--j-text-color)" }, children: text }),
|
|
33096
33485
|
children
|
|
33097
33486
|
] }),
|
|
33098
|
-
showButtons && /* @__PURE__ */ (0,
|
|
33099
|
-
/* @__PURE__ */ (0,
|
|
33100
|
-
/* @__PURE__ */ (0,
|
|
33487
|
+
showButtons && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(ModalFooter, { children: [
|
|
33488
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button, { variant: "secondary", onClick: handleCancel, children: cancelText }),
|
|
33489
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button, { variant: "primary", onClick: handleConfirm, children: confirmText })
|
|
33101
33490
|
] })
|
|
33102
33491
|
]
|
|
33103
33492
|
}
|
|
@@ -33106,71 +33495,17 @@ var Modal = (0, import_react9.forwardRef)(
|
|
|
33106
33495
|
);
|
|
33107
33496
|
Modal.displayName = "Modal";
|
|
33108
33497
|
|
|
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
33498
|
// src/inspector/ui/data-table.tsx
|
|
33164
|
-
var
|
|
33499
|
+
var import_react14 = __toESM(require_react(), 1);
|
|
33165
33500
|
|
|
33166
33501
|
// src/inspector/ui/table.tsx
|
|
33167
|
-
var
|
|
33168
|
-
var
|
|
33169
|
-
import { styled as
|
|
33170
|
-
var StyledTable =
|
|
33502
|
+
var import_react13 = __toESM(require_react(), 1);
|
|
33503
|
+
var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
|
|
33504
|
+
import { styled as styled16 } from "goober";
|
|
33505
|
+
var StyledTable = styled16("table")`
|
|
33171
33506
|
width: 100%;
|
|
33172
33507
|
`;
|
|
33173
|
-
var StyledThead =
|
|
33508
|
+
var StyledThead = styled16("thead")`
|
|
33174
33509
|
text-align: left;
|
|
33175
33510
|
border-bottom: 1px solid var(--j-border-color);
|
|
33176
33511
|
background-color: var(--j-neutral-100);
|
|
@@ -33179,7 +33514,7 @@ var StyledThead = styled14("thead")`
|
|
|
33179
33514
|
background-color: var(--j-neutral-925);
|
|
33180
33515
|
}
|
|
33181
33516
|
`;
|
|
33182
|
-
var StyledTbody =
|
|
33517
|
+
var StyledTbody = styled16("tbody")`
|
|
33183
33518
|
tr {
|
|
33184
33519
|
border-bottom: 1px solid var(--j-border-color);
|
|
33185
33520
|
|
|
@@ -33188,23 +33523,23 @@ var StyledTbody = styled14("tbody")`
|
|
|
33188
33523
|
}
|
|
33189
33524
|
}
|
|
33190
33525
|
`;
|
|
33191
|
-
var StyledTh =
|
|
33526
|
+
var StyledTh = styled16("th")`
|
|
33192
33527
|
font-weight: 500;
|
|
33193
33528
|
padding: 0.5rem 0.75rem;
|
|
33194
33529
|
color: var(--j-text-color-strong);
|
|
33195
33530
|
`;
|
|
33196
|
-
var StyledTd =
|
|
33531
|
+
var StyledTd = styled16("td")`
|
|
33197
33532
|
padding: 0.5rem 0.75rem;
|
|
33198
33533
|
`;
|
|
33199
|
-
var Table =
|
|
33200
|
-
var TableHead =
|
|
33201
|
-
var TableBody =
|
|
33202
|
-
var TableRow =
|
|
33203
|
-
var TableHeader =
|
|
33204
|
-
var TableCell =
|
|
33534
|
+
var Table = import_react13.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledTable, { ref, ...props, children }));
|
|
33535
|
+
var TableHead = import_react13.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledThead, { ref, ...props, children }));
|
|
33536
|
+
var TableBody = import_react13.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledTbody, { ref, ...props, children }));
|
|
33537
|
+
var TableRow = import_react13.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("tr", { ref, ...props, children }));
|
|
33538
|
+
var TableHeader = import_react13.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledTh, { ref, ...props, children }));
|
|
33539
|
+
var TableCell = import_react13.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledTd, { ref, ...props, children }));
|
|
33205
33540
|
|
|
33206
33541
|
// src/inspector/ui/data-table.tsx
|
|
33207
|
-
var
|
|
33542
|
+
var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
|
|
33208
33543
|
function DataTable({
|
|
33209
33544
|
columns,
|
|
33210
33545
|
data,
|
|
@@ -33213,10 +33548,10 @@ function DataTable({
|
|
|
33213
33548
|
getRowKey,
|
|
33214
33549
|
emptyMessage = "No data available"
|
|
33215
33550
|
}) {
|
|
33216
|
-
const [currentPage, setCurrentPage] = (0,
|
|
33217
|
-
const [sortConfig, setSortConfig] = (0,
|
|
33218
|
-
const [filters, setFilters] = (0,
|
|
33219
|
-
const filteredData = (0,
|
|
33551
|
+
const [currentPage, setCurrentPage] = (0, import_react14.useState)(1);
|
|
33552
|
+
const [sortConfig, setSortConfig] = (0, import_react14.useState)(initialSort);
|
|
33553
|
+
const [filters, setFilters] = (0, import_react14.useState)({});
|
|
33554
|
+
const filteredData = (0, import_react14.useMemo)(() => {
|
|
33220
33555
|
return data.filter((row) => {
|
|
33221
33556
|
return Object.entries(filters).every(([columnId, filterValue]) => {
|
|
33222
33557
|
if (!filterValue) return true;
|
|
@@ -33230,7 +33565,7 @@ function DataTable({
|
|
|
33230
33565
|
});
|
|
33231
33566
|
});
|
|
33232
33567
|
}, [data, filters, columns]);
|
|
33233
|
-
const sortedData = (0,
|
|
33568
|
+
const sortedData = (0, import_react14.useMemo)(() => {
|
|
33234
33569
|
if (!sortConfig) return filteredData;
|
|
33235
33570
|
const column = columns.find((col) => col.id === sortConfig.columnId);
|
|
33236
33571
|
if (!column?.sortable) return filteredData;
|
|
@@ -33249,7 +33584,7 @@ function DataTable({
|
|
|
33249
33584
|
const startIndex = (currentPage - 1) * pageSize;
|
|
33250
33585
|
const endIndex = startIndex + pageSize;
|
|
33251
33586
|
const paginatedData = sortedData.slice(startIndex, endIndex);
|
|
33252
|
-
(0,
|
|
33587
|
+
(0, import_react14.useEffect)(() => {
|
|
33253
33588
|
setCurrentPage(1);
|
|
33254
33589
|
}, [filters]);
|
|
33255
33590
|
const handleSort = (columnId) => {
|
|
@@ -33274,9 +33609,9 @@ function DataTable({
|
|
|
33274
33609
|
const handlePageChange = (page) => {
|
|
33275
33610
|
setCurrentPage(Math.max(1, Math.min(page, totalPages)));
|
|
33276
33611
|
};
|
|
33277
|
-
return /* @__PURE__ */ (0,
|
|
33278
|
-
/* @__PURE__ */ (0,
|
|
33279
|
-
/* @__PURE__ */ (0,
|
|
33612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
33613
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Table, { children: [
|
|
33614
|
+
/* @__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
33615
|
"div",
|
|
33281
33616
|
{
|
|
33282
33617
|
style: {
|
|
@@ -33287,8 +33622,8 @@ function DataTable({
|
|
|
33287
33622
|
},
|
|
33288
33623
|
onClick: () => handleSort(column.id),
|
|
33289
33624
|
children: [
|
|
33290
|
-
/* @__PURE__ */ (0,
|
|
33291
|
-
column.sortable && /* @__PURE__ */ (0,
|
|
33625
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: column.header }),
|
|
33626
|
+
column.sortable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33292
33627
|
"span",
|
|
33293
33628
|
{
|
|
33294
33629
|
style: {
|
|
@@ -33301,8 +33636,8 @@ function DataTable({
|
|
|
33301
33636
|
]
|
|
33302
33637
|
}
|
|
33303
33638
|
) }, column.id)) }) }),
|
|
33304
|
-
/* @__PURE__ */ (0,
|
|
33305
|
-
columns.some((column) => column.filterable) && /* @__PURE__ */ (0,
|
|
33639
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(TableBody, { children: [
|
|
33640
|
+
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
33641
|
Input,
|
|
33307
33642
|
{
|
|
33308
33643
|
label: "Filter",
|
|
@@ -33314,7 +33649,7 @@ function DataTable({
|
|
|
33314
33649
|
onClick: (e) => e.stopPropagation()
|
|
33315
33650
|
}
|
|
33316
33651
|
) }, column.id)) }),
|
|
33317
|
-
paginatedData.length === 0 ? /* @__PURE__ */ (0,
|
|
33652
|
+
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
33653
|
"div",
|
|
33319
33654
|
{
|
|
33320
33655
|
style: {
|
|
@@ -33324,10 +33659,10 @@ function DataTable({
|
|
|
33324
33659
|
},
|
|
33325
33660
|
children: emptyMessage
|
|
33326
33661
|
}
|
|
33327
|
-
) }) }) : paginatedData.map((row, index) => /* @__PURE__ */ (0,
|
|
33662
|
+
) }) }) : 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
33663
|
] })
|
|
33329
33664
|
] }),
|
|
33330
|
-
showPagination && /* @__PURE__ */ (0,
|
|
33665
|
+
showPagination && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
33331
33666
|
"div",
|
|
33332
33667
|
{
|
|
33333
33668
|
style: {
|
|
@@ -33338,7 +33673,7 @@ function DataTable({
|
|
|
33338
33673
|
padding: "8px 0"
|
|
33339
33674
|
},
|
|
33340
33675
|
children: [
|
|
33341
|
-
/* @__PURE__ */ (0,
|
|
33676
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { fontSize: "14px", opacity: 0.7 }, children: [
|
|
33342
33677
|
"Showing ",
|
|
33343
33678
|
startIndex + 1,
|
|
33344
33679
|
" to ",
|
|
@@ -33349,8 +33684,8 @@ function DataTable({
|
|
|
33349
33684
|
" entries",
|
|
33350
33685
|
Object.keys(filters).some((key) => filters[key]) && ` (filtered from ${data.length})`
|
|
33351
33686
|
] }),
|
|
33352
|
-
/* @__PURE__ */ (0,
|
|
33353
|
-
/* @__PURE__ */ (0,
|
|
33687
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
|
|
33688
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33354
33689
|
Button,
|
|
33355
33690
|
{
|
|
33356
33691
|
variant: "secondary",
|
|
@@ -33359,7 +33694,7 @@ function DataTable({
|
|
|
33359
33694
|
children: "\xAB\xAB"
|
|
33360
33695
|
}
|
|
33361
33696
|
),
|
|
33362
|
-
/* @__PURE__ */ (0,
|
|
33697
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33363
33698
|
Button,
|
|
33364
33699
|
{
|
|
33365
33700
|
variant: "secondary",
|
|
@@ -33368,13 +33703,13 @@ function DataTable({
|
|
|
33368
33703
|
children: "\xAB"
|
|
33369
33704
|
}
|
|
33370
33705
|
),
|
|
33371
|
-
/* @__PURE__ */ (0,
|
|
33706
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { style: { fontSize: "14px" }, children: [
|
|
33372
33707
|
"Page ",
|
|
33373
33708
|
currentPage,
|
|
33374
33709
|
" of ",
|
|
33375
33710
|
totalPages
|
|
33376
33711
|
] }),
|
|
33377
|
-
/* @__PURE__ */ (0,
|
|
33712
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33378
33713
|
Button,
|
|
33379
33714
|
{
|
|
33380
33715
|
variant: "secondary",
|
|
@@ -33383,7 +33718,7 @@ function DataTable({
|
|
|
33383
33718
|
children: "\xBB"
|
|
33384
33719
|
}
|
|
33385
33720
|
),
|
|
33386
|
-
/* @__PURE__ */ (0,
|
|
33721
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33387
33722
|
Button,
|
|
33388
33723
|
{
|
|
33389
33724
|
variant: "secondary",
|
|
@@ -33400,18 +33735,18 @@ function DataTable({
|
|
|
33400
33735
|
}
|
|
33401
33736
|
|
|
33402
33737
|
// src/inspector/ui/accordion.tsx
|
|
33403
|
-
var
|
|
33404
|
-
var
|
|
33405
|
-
import { styled as
|
|
33738
|
+
var import_react15 = __toESM(require_react(), 1);
|
|
33739
|
+
var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
|
|
33740
|
+
import { styled as styled17 } from "goober";
|
|
33406
33741
|
function Accordion({ title, children, storageKey }) {
|
|
33407
33742
|
const [open, setOpen] = useStoragedState(storageKey, false);
|
|
33408
|
-
return /* @__PURE__ */ (0,
|
|
33743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
33409
33744
|
"details",
|
|
33410
33745
|
{
|
|
33411
33746
|
open,
|
|
33412
33747
|
style: { display: "flex", flexDirection: "column", gap: "1rem" },
|
|
33413
33748
|
children: [
|
|
33414
|
-
/* @__PURE__ */ (0,
|
|
33749
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
33415
33750
|
StyledSummary,
|
|
33416
33751
|
{
|
|
33417
33752
|
onClick: (e) => {
|
|
@@ -33427,17 +33762,17 @@ function Accordion({ title, children, storageKey }) {
|
|
|
33427
33762
|
);
|
|
33428
33763
|
}
|
|
33429
33764
|
function useStoragedState(key, defaultValue) {
|
|
33430
|
-
const [state, setState] = (0,
|
|
33765
|
+
const [state, setState] = (0, import_react15.useState)(() => {
|
|
33431
33766
|
if (typeof window === "undefined") return defaultValue;
|
|
33432
33767
|
const stored = localStorage.getItem(key);
|
|
33433
33768
|
return stored ? JSON.parse(stored) : defaultValue;
|
|
33434
33769
|
});
|
|
33435
|
-
(0,
|
|
33770
|
+
(0, import_react15.useEffect)(() => {
|
|
33436
33771
|
localStorage.setItem(key, JSON.stringify(state));
|
|
33437
33772
|
}, [state]);
|
|
33438
33773
|
return [state, setState];
|
|
33439
33774
|
}
|
|
33440
|
-
var StyledSummary =
|
|
33775
|
+
var StyledSummary = styled17("summary")`
|
|
33441
33776
|
font-size: 1.125rem;
|
|
33442
33777
|
cursor: pointer;
|
|
33443
33778
|
font-weight: 500;
|
|
@@ -33445,12 +33780,12 @@ var StyledSummary = styled15("summary")`
|
|
|
33445
33780
|
`;
|
|
33446
33781
|
|
|
33447
33782
|
// src/inspector/viewer/raw-data-card.tsx
|
|
33448
|
-
var
|
|
33783
|
+
var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
|
|
33449
33784
|
function CopyButton({ data }) {
|
|
33450
|
-
const [copyCount, setCopyCount] = (0,
|
|
33785
|
+
const [copyCount, setCopyCount] = (0, import_react16.useState)(0);
|
|
33451
33786
|
const copied = copyCount > 0;
|
|
33452
33787
|
const stringifiedData = JSON.stringify(data);
|
|
33453
|
-
(0,
|
|
33788
|
+
(0, import_react16.useEffect)(() => {
|
|
33454
33789
|
if (copyCount > 0) {
|
|
33455
33790
|
const timeout = setTimeout(() => setCopyCount(0), 1e3);
|
|
33456
33791
|
return () => {
|
|
@@ -33458,7 +33793,7 @@ function CopyButton({ data }) {
|
|
|
33458
33793
|
};
|
|
33459
33794
|
}
|
|
33460
33795
|
}, [copyCount]);
|
|
33461
|
-
return /* @__PURE__ */ (0,
|
|
33796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
33462
33797
|
Button,
|
|
33463
33798
|
{
|
|
33464
33799
|
style: {
|
|
@@ -33477,14 +33812,14 @@ function CopyButton({ data }) {
|
|
|
33477
33812
|
);
|
|
33478
33813
|
}
|
|
33479
33814
|
function RawDataCard({ data }) {
|
|
33480
|
-
return /* @__PURE__ */ (0,
|
|
33481
|
-
/* @__PURE__ */ (0,
|
|
33482
|
-
/* @__PURE__ */ (0,
|
|
33815
|
+
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: [
|
|
33816
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CardHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CopyButton, { data }) }),
|
|
33817
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CardBody, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ValueRenderer, { json: data }) })
|
|
33483
33818
|
] }) });
|
|
33484
33819
|
}
|
|
33485
33820
|
|
|
33486
33821
|
// src/inspector/viewer/account-view.tsx
|
|
33487
|
-
var
|
|
33822
|
+
var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
|
|
33488
33823
|
function AccountView({
|
|
33489
33824
|
data,
|
|
33490
33825
|
onNavigate,
|
|
@@ -33496,25 +33831,25 @@ function AccountView({
|
|
|
33496
33831
|
delete readableData[key];
|
|
33497
33832
|
}
|
|
33498
33833
|
}
|
|
33499
|
-
return /* @__PURE__ */ (0,
|
|
33500
|
-
/* @__PURE__ */ (0,
|
|
33501
|
-
/* @__PURE__ */ (0,
|
|
33834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
33835
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(GridView, { data: readableData, onNavigate, node }),
|
|
33836
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(RawDataCard, { data })
|
|
33502
33837
|
] });
|
|
33503
33838
|
}
|
|
33504
33839
|
|
|
33505
33840
|
// src/inspector/viewer/co-plain-text-view.tsx
|
|
33506
|
-
var
|
|
33841
|
+
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
|
|
33507
33842
|
function CoPlainTextView({ data }) {
|
|
33508
33843
|
if (!data) return;
|
|
33509
|
-
return /* @__PURE__ */ (0,
|
|
33510
|
-
/* @__PURE__ */ (0,
|
|
33511
|
-
/* @__PURE__ */ (0,
|
|
33844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
33845
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { children: Object.values(data).join("") }),
|
|
33846
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(RawDataCard, { data })
|
|
33512
33847
|
] });
|
|
33513
33848
|
}
|
|
33514
33849
|
|
|
33515
33850
|
// src/inspector/viewer/group-view.tsx
|
|
33516
|
-
var
|
|
33517
|
-
var
|
|
33851
|
+
var import_react17 = __toESM(require_react(), 1);
|
|
33852
|
+
var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
|
|
33518
33853
|
function partitionMembers(data) {
|
|
33519
33854
|
const everyone = Object.entries(data).filter(([key]) => key === "everyone").map(([key, value]) => ({
|
|
33520
33855
|
id: key,
|
|
@@ -33542,7 +33877,7 @@ function GroupView({
|
|
|
33542
33877
|
onNavigate,
|
|
33543
33878
|
node
|
|
33544
33879
|
}) {
|
|
33545
|
-
const [addMemberType, setAddMemberType] = (0,
|
|
33880
|
+
const [addMemberType, setAddMemberType] = (0, import_react17.useState)(null);
|
|
33546
33881
|
const { everyone, members, parentGroups, childGroups } = partitionMembers(
|
|
33547
33882
|
data
|
|
33548
33883
|
);
|
|
@@ -33621,28 +33956,28 @@ function GroupView({
|
|
|
33621
33956
|
alert(`Failed to add ${addMemberType}: ${error.message}`);
|
|
33622
33957
|
}
|
|
33623
33958
|
};
|
|
33624
|
-
return /* @__PURE__ */ (0,
|
|
33625
|
-
/* @__PURE__ */ (0,
|
|
33626
|
-
/* @__PURE__ */ (0,
|
|
33627
|
-
/* @__PURE__ */ (0,
|
|
33628
|
-
/* @__PURE__ */ (0,
|
|
33629
|
-
/* @__PURE__ */ (0,
|
|
33959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
33960
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Table, { children: [
|
|
33961
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(TableRow, { children: [
|
|
33962
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableHeader, { children: "Member" }),
|
|
33963
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableHeader, { children: "Permission" }),
|
|
33964
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableHeader, {})
|
|
33630
33965
|
] }) }),
|
|
33631
|
-
/* @__PURE__ */ (0,
|
|
33632
|
-
everyone.map((member) => /* @__PURE__ */ (0,
|
|
33633
|
-
/* @__PURE__ */ (0,
|
|
33634
|
-
/* @__PURE__ */ (0,
|
|
33635
|
-
/* @__PURE__ */ (0,
|
|
33966
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(TableBody, { children: [
|
|
33967
|
+
everyone.map((member) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(TableRow, { children: [
|
|
33968
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: member.id }),
|
|
33969
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: member.role }),
|
|
33970
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33636
33971
|
Button,
|
|
33637
33972
|
{
|
|
33638
33973
|
variant: "secondary",
|
|
33639
33974
|
onClick: () => onRemoveMember(member.id),
|
|
33640
|
-
children: /* @__PURE__ */ (0,
|
|
33975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { name: "delete" })
|
|
33641
33976
|
}
|
|
33642
33977
|
) })
|
|
33643
33978
|
] }, member.id)),
|
|
33644
|
-
members.map((member) => /* @__PURE__ */ (0,
|
|
33645
|
-
/* @__PURE__ */ (0,
|
|
33979
|
+
members.map((member) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(TableRow, { children: [
|
|
33980
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33646
33981
|
AccountOrGroupText,
|
|
33647
33982
|
{
|
|
33648
33983
|
coId: member.id,
|
|
@@ -33653,18 +33988,18 @@ function GroupView({
|
|
|
33653
33988
|
}
|
|
33654
33989
|
}
|
|
33655
33990
|
) }),
|
|
33656
|
-
/* @__PURE__ */ (0,
|
|
33657
|
-
/* @__PURE__ */ (0,
|
|
33991
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: member.role }),
|
|
33992
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33658
33993
|
Button,
|
|
33659
33994
|
{
|
|
33660
33995
|
variant: "secondary",
|
|
33661
33996
|
onClick: () => onRemoveMember(member.id),
|
|
33662
|
-
children: /* @__PURE__ */ (0,
|
|
33997
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { name: "delete" })
|
|
33663
33998
|
}
|
|
33664
33999
|
) })
|
|
33665
34000
|
] }, member.id)),
|
|
33666
|
-
parentGroups.map((group) => /* @__PURE__ */ (0,
|
|
33667
|
-
/* @__PURE__ */ (0,
|
|
34001
|
+
parentGroups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(TableRow, { children: [
|
|
34002
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33668
34003
|
AccountOrGroupText,
|
|
33669
34004
|
{
|
|
33670
34005
|
coId: group.id,
|
|
@@ -33675,19 +34010,19 @@ function GroupView({
|
|
|
33675
34010
|
}
|
|
33676
34011
|
}
|
|
33677
34012
|
) }),
|
|
33678
|
-
/* @__PURE__ */ (0,
|
|
33679
|
-
/* @__PURE__ */ (0,
|
|
34013
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: group.role }),
|
|
34014
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TableCell, { children: group.role !== "revoked" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33680
34015
|
Button,
|
|
33681
34016
|
{
|
|
33682
34017
|
variant: "secondary",
|
|
33683
34018
|
onClick: () => onRemoveGroup(group.id),
|
|
33684
|
-
children: /* @__PURE__ */ (0,
|
|
34019
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { name: "delete" })
|
|
33685
34020
|
}
|
|
33686
34021
|
) })
|
|
33687
34022
|
] }, group.id))
|
|
33688
34023
|
] })
|
|
33689
34024
|
] }),
|
|
33690
|
-
/* @__PURE__ */ (0,
|
|
34025
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
33691
34026
|
"div",
|
|
33692
34027
|
{
|
|
33693
34028
|
style: {
|
|
@@ -33697,14 +34032,14 @@ function GroupView({
|
|
|
33697
34032
|
marginTop: "1rem"
|
|
33698
34033
|
},
|
|
33699
34034
|
children: [
|
|
33700
|
-
/* @__PURE__ */ (0,
|
|
33701
|
-
/* @__PURE__ */ (0,
|
|
34035
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { variant: "primary", onClick: () => setAddMemberType("account"), children: "Add Account" }),
|
|
34036
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { variant: "primary", onClick: () => setAddMemberType("group"), children: "Add Group" })
|
|
33702
34037
|
]
|
|
33703
34038
|
}
|
|
33704
34039
|
),
|
|
33705
|
-
childGroups.length > 0 && /* @__PURE__ */ (0,
|
|
33706
|
-
/* @__PURE__ */ (0,
|
|
33707
|
-
/* @__PURE__ */ (0,
|
|
34040
|
+
childGroups.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Table, { children: [
|
|
34041
|
+
/* @__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" }) }) }),
|
|
34042
|
+
/* @__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
34043
|
AccountOrGroupText,
|
|
33709
34044
|
{
|
|
33710
34045
|
coId: group.id,
|
|
@@ -33716,20 +34051,20 @@ function GroupView({
|
|
|
33716
34051
|
}
|
|
33717
34052
|
) }) }, group.id)) })
|
|
33718
34053
|
] }),
|
|
33719
|
-
/* @__PURE__ */ (0,
|
|
33720
|
-
/* @__PURE__ */ (0,
|
|
34054
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RawDataCard, { data }),
|
|
34055
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33721
34056
|
Modal,
|
|
33722
34057
|
{
|
|
33723
34058
|
isOpen: addMemberType !== null,
|
|
33724
34059
|
onClose: () => setAddMemberType(null),
|
|
33725
34060
|
heading: addMemberType === "account" ? "Add Account" : "Add Group",
|
|
33726
34061
|
showButtons: false,
|
|
33727
|
-
children: /* @__PURE__ */ (0,
|
|
34062
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("form", { onSubmit: handleAddMemberSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
33728
34063
|
"div",
|
|
33729
34064
|
{
|
|
33730
34065
|
style: { display: "flex", flexDirection: "column", gap: "1rem" },
|
|
33731
34066
|
children: [
|
|
33732
|
-
/* @__PURE__ */ (0,
|
|
34067
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33733
34068
|
Input,
|
|
33734
34069
|
{
|
|
33735
34070
|
name: "memberId",
|
|
@@ -33738,13 +34073,13 @@ function GroupView({
|
|
|
33738
34073
|
required: true
|
|
33739
34074
|
}
|
|
33740
34075
|
),
|
|
33741
|
-
/* @__PURE__ */ (0,
|
|
33742
|
-
/* @__PURE__ */ (0,
|
|
33743
|
-
/* @__PURE__ */ (0,
|
|
33744
|
-
/* @__PURE__ */ (0,
|
|
33745
|
-
addMemberType === "account" ? /* @__PURE__ */ (0,
|
|
34076
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Select, { name: "role", label: "Role", children: [
|
|
34077
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "reader", children: "Reader" }),
|
|
34078
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "writer", children: "Writer" }),
|
|
34079
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "admin", children: "Admin" }),
|
|
34080
|
+
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
34081
|
] }),
|
|
33747
|
-
/* @__PURE__ */ (0,
|
|
34082
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
33748
34083
|
"div",
|
|
33749
34084
|
{
|
|
33750
34085
|
style: {
|
|
@@ -33754,7 +34089,7 @@ function GroupView({
|
|
|
33754
34089
|
marginTop: "0.5rem"
|
|
33755
34090
|
},
|
|
33756
34091
|
children: [
|
|
33757
|
-
/* @__PURE__ */ (0,
|
|
34092
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33758
34093
|
Button,
|
|
33759
34094
|
{
|
|
33760
34095
|
type: "button",
|
|
@@ -33763,7 +34098,7 @@ function GroupView({
|
|
|
33763
34098
|
children: "Cancel"
|
|
33764
34099
|
}
|
|
33765
34100
|
),
|
|
33766
|
-
/* @__PURE__ */ (0,
|
|
34101
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { type: "submit", variant: "primary", children: "Add" })
|
|
33767
34102
|
]
|
|
33768
34103
|
}
|
|
33769
34104
|
)
|
|
@@ -33776,7 +34111,7 @@ function GroupView({
|
|
|
33776
34111
|
}
|
|
33777
34112
|
|
|
33778
34113
|
// src/inspector/viewer/role-display.tsx
|
|
33779
|
-
var
|
|
34114
|
+
var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
|
|
33780
34115
|
function RoleDisplay({
|
|
33781
34116
|
node,
|
|
33782
34117
|
value
|
|
@@ -33795,24 +34130,24 @@ function RoleDisplay({
|
|
|
33795
34130
|
} else {
|
|
33796
34131
|
role = "unauthorized";
|
|
33797
34132
|
}
|
|
33798
|
-
return /* @__PURE__ */ (0,
|
|
34133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Text, { children: [
|
|
33799
34134
|
"Role: ",
|
|
33800
34135
|
role
|
|
33801
34136
|
] });
|
|
33802
34137
|
}
|
|
33803
34138
|
|
|
33804
34139
|
// src/inspector/viewer/table-viewer.tsx
|
|
33805
|
-
var
|
|
33806
|
-
import { styled as
|
|
33807
|
-
var
|
|
33808
|
-
var PaginationContainer =
|
|
34140
|
+
var import_react18 = __toESM(require_react(), 1);
|
|
34141
|
+
import { styled as styled18 } from "goober";
|
|
34142
|
+
var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
|
|
34143
|
+
var PaginationContainer = styled18("div")`
|
|
33809
34144
|
padding: 1rem 0;
|
|
33810
34145
|
display: flex;
|
|
33811
34146
|
align-items: center;
|
|
33812
34147
|
justify-content: space-between;
|
|
33813
34148
|
gap: 0.5rem;
|
|
33814
34149
|
`;
|
|
33815
|
-
var RedTooltip =
|
|
34150
|
+
var RedTooltip = styled18("span")`
|
|
33816
34151
|
position:relative; /* making the .tooltip span a container for the tooltip text */
|
|
33817
34152
|
border-bottom:1px dashed #000; /* little indicater to indicate it's hoverable */
|
|
33818
34153
|
|
|
@@ -33849,8 +34184,8 @@ function CoValuesTableView({
|
|
|
33849
34184
|
onNavigate,
|
|
33850
34185
|
onRemove
|
|
33851
34186
|
}) {
|
|
33852
|
-
const [visibleRowsCount, setVisibleRowsCount] = (0,
|
|
33853
|
-
const [coIdArray, visibleRows] = (0,
|
|
34187
|
+
const [visibleRowsCount, setVisibleRowsCount] = (0, import_react18.useState)(10);
|
|
34188
|
+
const [coIdArray, visibleRows] = (0, import_react18.useMemo)(() => {
|
|
33854
34189
|
const coIdArray2 = Array.isArray(data) ? data : Object.values(data).every((k) => typeof k === "string" && isCoId(k)) ? Object.values(data).map((k) => k) : [];
|
|
33855
34190
|
const visibleRows2 = coIdArray2.slice(0, visibleRowsCount);
|
|
33856
34191
|
return [coIdArray2, visibleRows2];
|
|
@@ -33858,10 +34193,10 @@ function CoValuesTableView({
|
|
|
33858
34193
|
const resolvedRows = useResolvedCoValues(visibleRows, node);
|
|
33859
34194
|
const hasMore = visibleRowsCount < coIdArray.length;
|
|
33860
34195
|
if (!coIdArray.length) {
|
|
33861
|
-
return /* @__PURE__ */ (0,
|
|
34196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: "No data to display" });
|
|
33862
34197
|
}
|
|
33863
34198
|
if (resolvedRows.length === 0) {
|
|
33864
|
-
return /* @__PURE__ */ (0,
|
|
34199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: "Loading..." });
|
|
33865
34200
|
}
|
|
33866
34201
|
const keys = Array.from(
|
|
33867
34202
|
new Set(
|
|
@@ -33871,15 +34206,15 @@ function CoValuesTableView({
|
|
|
33871
34206
|
const loadMore = () => {
|
|
33872
34207
|
setVisibleRowsCount((prevVisibleRows) => prevVisibleRows + 10);
|
|
33873
34208
|
};
|
|
33874
|
-
return /* @__PURE__ */ (0,
|
|
33875
|
-
/* @__PURE__ */ (0,
|
|
33876
|
-
/* @__PURE__ */ (0,
|
|
33877
|
-
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */ (0,
|
|
33878
|
-
onRemove && /* @__PURE__ */ (0,
|
|
34209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
34210
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Table, { children: [
|
|
34211
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TableRow, { children: [
|
|
34212
|
+
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHeader, { children: key }, key)),
|
|
34213
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHeader, {})
|
|
33879
34214
|
] }) }),
|
|
33880
|
-
/* @__PURE__ */ (0,
|
|
33881
|
-
/* @__PURE__ */ (0,
|
|
33882
|
-
/* @__PURE__ */ (0,
|
|
34215
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableBody, { children: resolvedRows.slice(0, visibleRowsCount).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TableRow, { children: [
|
|
34216
|
+
/* @__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: [
|
|
34217
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
33883
34218
|
Icon,
|
|
33884
34219
|
{
|
|
33885
34220
|
name: "caution",
|
|
@@ -33892,7 +34227,7 @@ function CoValuesTableView({
|
|
|
33892
34227
|
),
|
|
33893
34228
|
visibleRows[index]
|
|
33894
34229
|
] }) : visibleRows[index] }) }),
|
|
33895
|
-
keys.map((key) => /* @__PURE__ */ (0,
|
|
34230
|
+
keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableCell, { children: item.snapshot !== "unavailable" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
33896
34231
|
ValueRenderer,
|
|
33897
34232
|
{
|
|
33898
34233
|
json: item.snapshot[key],
|
|
@@ -33913,7 +34248,7 @@ function CoValuesTableView({
|
|
|
33913
34248
|
}
|
|
33914
34249
|
}
|
|
33915
34250
|
) }, key)),
|
|
33916
|
-
/* @__PURE__ */ (0,
|
|
34251
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
33917
34252
|
Button,
|
|
33918
34253
|
{
|
|
33919
34254
|
variant: "secondary",
|
|
@@ -33926,18 +34261,18 @@ function CoValuesTableView({
|
|
|
33926
34261
|
children: "View"
|
|
33927
34262
|
}
|
|
33928
34263
|
) }),
|
|
33929
|
-
onRemove && /* @__PURE__ */ (0,
|
|
34264
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
33930
34265
|
] }, index)) })
|
|
33931
34266
|
] }),
|
|
33932
|
-
/* @__PURE__ */ (0,
|
|
33933
|
-
/* @__PURE__ */ (0,
|
|
34267
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(PaginationContainer, { children: [
|
|
34268
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Text, { muted: true, small: true, children: [
|
|
33934
34269
|
"Showing ",
|
|
33935
34270
|
Math.min(visibleRowsCount, coIdArray.length),
|
|
33936
34271
|
" of",
|
|
33937
34272
|
" ",
|
|
33938
34273
|
coIdArray.length
|
|
33939
34274
|
] }),
|
|
33940
|
-
hasMore && /* @__PURE__ */ (0,
|
|
34275
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "secondary", onClick: loadMore, children: "Load more" })
|
|
33941
34276
|
] })
|
|
33942
34277
|
] });
|
|
33943
34278
|
}
|
|
@@ -33947,11 +34282,11 @@ function TableView({
|
|
|
33947
34282
|
onNavigate,
|
|
33948
34283
|
onRemove
|
|
33949
34284
|
}) {
|
|
33950
|
-
const isListOfCoValues = (0,
|
|
34285
|
+
const isListOfCoValues = (0, import_react18.useMemo)(() => {
|
|
33951
34286
|
return Array.isArray(data) && data.every((k) => isCoId(k));
|
|
33952
34287
|
}, [data]);
|
|
33953
34288
|
if (isListOfCoValues) {
|
|
33954
|
-
return /* @__PURE__ */ (0,
|
|
34289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
33955
34290
|
CoValuesTableView,
|
|
33956
34291
|
{
|
|
33957
34292
|
data,
|
|
@@ -33961,29 +34296,72 @@ function TableView({
|
|
|
33961
34296
|
}
|
|
33962
34297
|
);
|
|
33963
34298
|
}
|
|
33964
|
-
return /* @__PURE__ */ (0,
|
|
33965
|
-
/* @__PURE__ */ (0,
|
|
33966
|
-
/* @__PURE__ */ (0,
|
|
33967
|
-
/* @__PURE__ */ (0,
|
|
33968
|
-
onRemove && /* @__PURE__ */ (0,
|
|
34299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Table, { children: [
|
|
34300
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TableRow, { children: [
|
|
34301
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHeader, { style: { width: "5rem" }, children: "Index" }),
|
|
34302
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHeader, { children: "Value" }),
|
|
34303
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableHeader, { children: "Action" })
|
|
33969
34304
|
] }) }),
|
|
33970
|
-
/* @__PURE__ */ (0,
|
|
33971
|
-
/* @__PURE__ */ (0,
|
|
33972
|
-
/* @__PURE__ */ (0,
|
|
33973
|
-
onRemove && /* @__PURE__ */ (0,
|
|
34305
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableBody, { children: Array.isArray(data) && data?.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TableRow, { children: [
|
|
34306
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { mono: true, children: index }) }),
|
|
34307
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ValueRenderer, { json: value }) }),
|
|
34308
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
33974
34309
|
] }, index)) })
|
|
33975
34310
|
] });
|
|
33976
34311
|
}
|
|
33977
34312
|
|
|
33978
34313
|
// src/inspector/viewer/history-view.tsx
|
|
33979
|
-
var
|
|
33980
|
-
import { styled as
|
|
33981
|
-
|
|
34314
|
+
var import_react19 = __toESM(require_react(), 1);
|
|
34315
|
+
import { styled as styled19 } from "goober";
|
|
34316
|
+
|
|
34317
|
+
// src/inspector/utils/transactions-changes.ts
|
|
34318
|
+
var isGroupExtension = (change) => {
|
|
34319
|
+
return change?.op === "set" && change?.value === "extend";
|
|
34320
|
+
};
|
|
34321
|
+
var isGroupExtendRevocation = (change) => {
|
|
34322
|
+
return change?.op === "set" && change?.value === "revoked";
|
|
34323
|
+
};
|
|
34324
|
+
var isGroupPromotion = (change) => {
|
|
34325
|
+
return change?.op === "set" && change?.key.startsWith("parent_co_");
|
|
34326
|
+
};
|
|
34327
|
+
var isUserPromotion = (change) => {
|
|
34328
|
+
return change?.op === "set" && (isCoId(change?.key) || change?.key === "everyone");
|
|
34329
|
+
};
|
|
34330
|
+
var isKeyRevelation = (change) => {
|
|
34331
|
+
return change?.op === "set" && change?.key.includes("_for_");
|
|
34332
|
+
};
|
|
34333
|
+
var isPropertySet = (change) => {
|
|
34334
|
+
return change?.op === "set" && "key" in change && "value" in change;
|
|
34335
|
+
};
|
|
34336
|
+
var isPropertyDeletion = (change) => {
|
|
34337
|
+
return change?.op === "del" && "key" in change;
|
|
34338
|
+
};
|
|
34339
|
+
var isItemAppend = (change) => {
|
|
34340
|
+
return change?.op === "app" && "after" in change && "value" in change;
|
|
34341
|
+
};
|
|
34342
|
+
var isItemPrepend = (change) => {
|
|
34343
|
+
return change?.op === "pre" && "before" in change && "value" in change;
|
|
34344
|
+
};
|
|
34345
|
+
var isItemDeletion = (change) => {
|
|
34346
|
+
return change?.op === "del" && "insertion" in change;
|
|
34347
|
+
};
|
|
34348
|
+
var isStreamStart = (change) => {
|
|
34349
|
+
return change?.type === "start" && "mimeType" in change;
|
|
34350
|
+
};
|
|
34351
|
+
var isStreamChunk = (change) => {
|
|
34352
|
+
return change?.type === "chunk" && "chunk" in change;
|
|
34353
|
+
};
|
|
34354
|
+
var isStreamEnd = (change) => {
|
|
34355
|
+
return change?.type === "end";
|
|
34356
|
+
};
|
|
34357
|
+
|
|
34358
|
+
// src/inspector/viewer/history-view.tsx
|
|
34359
|
+
var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
|
|
33982
34360
|
function HistoryView({
|
|
33983
34361
|
coValue,
|
|
33984
34362
|
node
|
|
33985
34363
|
}) {
|
|
33986
|
-
const transactions = (0,
|
|
34364
|
+
const transactions = (0, import_react19.useMemo)(
|
|
33987
34365
|
() => getHistory(coValue),
|
|
33988
34366
|
[coValue.core.verifiedTransactions.length]
|
|
33989
34367
|
);
|
|
@@ -33991,8 +34369,8 @@ function HistoryView({
|
|
|
33991
34369
|
{
|
|
33992
34370
|
id: "author",
|
|
33993
34371
|
header: "Author",
|
|
33994
|
-
accessor: (row) => /* @__PURE__ */ (0,
|
|
33995
|
-
row.isValid || /* @__PURE__ */ (0,
|
|
34372
|
+
accessor: (row) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
34373
|
+
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
34374
|
Icon,
|
|
33997
34375
|
{
|
|
33998
34376
|
name: "caution",
|
|
@@ -34005,7 +34383,7 @@ function HistoryView({
|
|
|
34005
34383
|
}
|
|
34006
34384
|
}
|
|
34007
34385
|
) }),
|
|
34008
|
-
row.author.startsWith("co_") ? /* @__PURE__ */ (0,
|
|
34386
|
+
row.author.startsWith("co_") ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
34009
34387
|
AccountOrGroupText,
|
|
34010
34388
|
{
|
|
34011
34389
|
coId: row.author,
|
|
@@ -34024,9 +34402,9 @@ function HistoryView({
|
|
|
34024
34402
|
header: "Action",
|
|
34025
34403
|
accessor: (row) => {
|
|
34026
34404
|
if (row.isValid) return row.action;
|
|
34027
|
-
return /* @__PURE__ */ (0,
|
|
34405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
34028
34406
|
row.action,
|
|
34029
|
-
/* @__PURE__ */ (0,
|
|
34407
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { style: { color: "red", display: "block" }, children: [
|
|
34030
34408
|
"Invalid transaction: ",
|
|
34031
34409
|
row.validationErrorMessage
|
|
34032
34410
|
] })
|
|
@@ -34045,7 +34423,7 @@ function HistoryView({
|
|
|
34045
34423
|
sortFn: (a, b) => a.timestamp.getTime() - b.timestamp.getTime()
|
|
34046
34424
|
}
|
|
34047
34425
|
];
|
|
34048
|
-
return /* @__PURE__ */ (0,
|
|
34426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Accordion, { title: "CoValue history", storageKey: "jazz-inspector-show-history", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
34049
34427
|
DataTable,
|
|
34050
34428
|
{
|
|
34051
34429
|
columns,
|
|
@@ -34156,46 +34534,7 @@ var findListChange = (opId, coValue) => {
|
|
|
34156
34534
|
(tx) => tx.txID.sessionID === opId.sessionID && tx.txID.txIndex === opId.txIndex
|
|
34157
34535
|
)?.changes?.[opId.changeIdx];
|
|
34158
34536
|
};
|
|
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")`
|
|
34537
|
+
var RedTooltip2 = styled19("span")`
|
|
34199
34538
|
position:relative; /* making the .tooltip span a container for the tooltip text */
|
|
34200
34539
|
border-bottom:1px dashed #000; /* little indicater to indicate it's hoverable */
|
|
34201
34540
|
|
|
@@ -34227,12 +34566,315 @@ var RedTooltip2 = styled17("span")`
|
|
|
34227
34566
|
}
|
|
34228
34567
|
`;
|
|
34229
34568
|
|
|
34569
|
+
// src/inspector/viewer/co-map-view.tsx
|
|
34570
|
+
var import_react20 = __toESM(require_react(), 1);
|
|
34571
|
+
import { styled as styled20 } from "goober";
|
|
34572
|
+
|
|
34573
|
+
// src/inspector/utils/history.ts
|
|
34574
|
+
function restoreCoMapToTimestamp(coValue, timestamp, removeUnknownProperties) {
|
|
34575
|
+
const myRole = coValue.group.myRole();
|
|
34576
|
+
if (myRole === void 0 || !["admin", "manager", "writer", "writerOnly"].includes(myRole)) {
|
|
34577
|
+
return;
|
|
34578
|
+
}
|
|
34579
|
+
const newCoValue = coValue.atTime(timestamp).toJSON();
|
|
34580
|
+
const oldCoValue = coValue.toJSON();
|
|
34581
|
+
if (newCoValue === null) return;
|
|
34582
|
+
let changes = [];
|
|
34583
|
+
if (removeUnknownProperties) {
|
|
34584
|
+
for (const key in oldCoValue) {
|
|
34585
|
+
if (!(key in newCoValue)) {
|
|
34586
|
+
changes.push({
|
|
34587
|
+
op: "del",
|
|
34588
|
+
key
|
|
34589
|
+
});
|
|
34590
|
+
}
|
|
34591
|
+
}
|
|
34592
|
+
}
|
|
34593
|
+
for (const key in newCoValue) {
|
|
34594
|
+
if (newCoValue[key] !== oldCoValue[key]) {
|
|
34595
|
+
changes.push({
|
|
34596
|
+
op: "set",
|
|
34597
|
+
key,
|
|
34598
|
+
value: newCoValue[key]
|
|
34599
|
+
});
|
|
34600
|
+
}
|
|
34601
|
+
}
|
|
34602
|
+
if (changes.length > 0) {
|
|
34603
|
+
coValue.core.makeTransaction(changes, "private");
|
|
34604
|
+
}
|
|
34605
|
+
}
|
|
34606
|
+
|
|
34607
|
+
// src/inspector/viewer/co-map-view.tsx
|
|
34608
|
+
var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
|
|
34609
|
+
function CoMapView({
|
|
34610
|
+
coValue,
|
|
34611
|
+
data,
|
|
34612
|
+
node,
|
|
34613
|
+
onNavigate
|
|
34614
|
+
}) {
|
|
34615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
34616
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34617
|
+
GridView,
|
|
34618
|
+
{
|
|
34619
|
+
data,
|
|
34620
|
+
onNavigate,
|
|
34621
|
+
node,
|
|
34622
|
+
coValue
|
|
34623
|
+
}
|
|
34624
|
+
),
|
|
34625
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
34626
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddPropertyModal, { coValue, node }),
|
|
34627
|
+
" ",
|
|
34628
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RestoreSnapshotModal, { coValue })
|
|
34629
|
+
] })
|
|
34630
|
+
] });
|
|
34631
|
+
}
|
|
34632
|
+
function AddPropertyModal({
|
|
34633
|
+
coValue,
|
|
34634
|
+
node
|
|
34635
|
+
}) {
|
|
34636
|
+
const [isAddPropertyModalOpen, setIsAddPropertyModalOpen] = (0, import_react20.useState)(false);
|
|
34637
|
+
const [propertyName, setPropertyName] = (0, import_react20.useState)("");
|
|
34638
|
+
const openAddPropertyModal = () => {
|
|
34639
|
+
setIsAddPropertyModalOpen(true);
|
|
34640
|
+
setPropertyName("");
|
|
34641
|
+
};
|
|
34642
|
+
const handleCancel = () => {
|
|
34643
|
+
setIsAddPropertyModalOpen(false);
|
|
34644
|
+
setPropertyName("");
|
|
34645
|
+
};
|
|
34646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
34647
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34648
|
+
Button,
|
|
34649
|
+
{
|
|
34650
|
+
title: "Add Property",
|
|
34651
|
+
variant: "secondary",
|
|
34652
|
+
onClick: openAddPropertyModal,
|
|
34653
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { name: "edit" })
|
|
34654
|
+
}
|
|
34655
|
+
),
|
|
34656
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
34657
|
+
Modal,
|
|
34658
|
+
{
|
|
34659
|
+
isOpen: isAddPropertyModalOpen,
|
|
34660
|
+
onClose: handleCancel,
|
|
34661
|
+
heading: "Add Property",
|
|
34662
|
+
showButtons: false,
|
|
34663
|
+
children: [
|
|
34664
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34665
|
+
Input,
|
|
34666
|
+
{
|
|
34667
|
+
label: "Property Name",
|
|
34668
|
+
value: propertyName,
|
|
34669
|
+
onChange: (e) => setPropertyName(e.target.value),
|
|
34670
|
+
placeholder: "Enter property name"
|
|
34671
|
+
}
|
|
34672
|
+
),
|
|
34673
|
+
propertyName && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EditorContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34674
|
+
CoValueEditor,
|
|
34675
|
+
{
|
|
34676
|
+
node,
|
|
34677
|
+
property: propertyName,
|
|
34678
|
+
value: void 0,
|
|
34679
|
+
coValue,
|
|
34680
|
+
onCancel: handleCancel
|
|
34681
|
+
}
|
|
34682
|
+
) })
|
|
34683
|
+
]
|
|
34684
|
+
}
|
|
34685
|
+
)
|
|
34686
|
+
] });
|
|
34687
|
+
}
|
|
34688
|
+
function RestoreSnapshotModal({ coValue }) {
|
|
34689
|
+
const [isRestoreModalOpen, setIsRestoreModalOpen] = (0, import_react20.useState)(false);
|
|
34690
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react20.useState)(-1);
|
|
34691
|
+
const [removeUnknownProperties, setRemoveUnknownProperties] = (0, import_react20.useState)(false);
|
|
34692
|
+
const timestamps = (0, import_react20.useMemo)(
|
|
34693
|
+
() => coValue.core.verifiedTransactions.map((tx) => tx.madeAt),
|
|
34694
|
+
[coValue.core.verifiedTransactions.length]
|
|
34695
|
+
);
|
|
34696
|
+
const coMapAtSelectedIndex = (0, import_react20.useMemo)(() => {
|
|
34697
|
+
if (selectedIndex === -1) return null;
|
|
34698
|
+
return coValue.atTime(timestamps[selectedIndex]).toJSON();
|
|
34699
|
+
}, [coValue, timestamps, selectedIndex]);
|
|
34700
|
+
const openRestoreModal = () => {
|
|
34701
|
+
setIsRestoreModalOpen(true);
|
|
34702
|
+
setSelectedIndex(timestamps.length - 1);
|
|
34703
|
+
};
|
|
34704
|
+
const handleRestore = () => {
|
|
34705
|
+
if (timestamps.length < 2) return;
|
|
34706
|
+
if (timestamps.length === 0) return;
|
|
34707
|
+
const selectedTimestamp = timestamps[selectedIndex];
|
|
34708
|
+
if (selectedTimestamp === void 0) return;
|
|
34709
|
+
restoreCoMapToTimestamp(
|
|
34710
|
+
coValue,
|
|
34711
|
+
selectedTimestamp,
|
|
34712
|
+
removeUnknownProperties
|
|
34713
|
+
);
|
|
34714
|
+
setIsRestoreModalOpen(false);
|
|
34715
|
+
};
|
|
34716
|
+
const handleClose = () => {
|
|
34717
|
+
setIsRestoreModalOpen(false);
|
|
34718
|
+
};
|
|
34719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
34720
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Button, { title: "Timeline", variant: "secondary", onClick: openRestoreModal, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { name: "history" }) }),
|
|
34721
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
34722
|
+
Modal,
|
|
34723
|
+
{
|
|
34724
|
+
isOpen: isRestoreModalOpen,
|
|
34725
|
+
onClose: handleClose,
|
|
34726
|
+
heading: "Timeline",
|
|
34727
|
+
confirmText: "Restore",
|
|
34728
|
+
cancelText: "Cancel",
|
|
34729
|
+
onConfirm: handleRestore,
|
|
34730
|
+
onCancel: handleClose,
|
|
34731
|
+
showButtons: timestamps.length > 1,
|
|
34732
|
+
children: [
|
|
34733
|
+
timestamps.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
34734
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(RangeContainer, { children: [
|
|
34735
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RangeLabel, { children: "Select Timestamp" }),
|
|
34736
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34737
|
+
RangeInput,
|
|
34738
|
+
{
|
|
34739
|
+
type: "range",
|
|
34740
|
+
min: 0,
|
|
34741
|
+
max: Math.max(0, timestamps.length - 1),
|
|
34742
|
+
value: selectedIndex,
|
|
34743
|
+
onChange: (e) => setSelectedIndex(Number(e.target.value)),
|
|
34744
|
+
disabled: timestamps.length === 0
|
|
34745
|
+
}
|
|
34746
|
+
),
|
|
34747
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TimestampDisplay, { children: timestamps[selectedIndex] !== void 0 ? new Date(timestamps[selectedIndex]).toISOString() : "No timestamps available" })
|
|
34748
|
+
] }),
|
|
34749
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(CheckboxContainer, { children: [
|
|
34750
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34751
|
+
CheckboxInput,
|
|
34752
|
+
{
|
|
34753
|
+
type: "checkbox",
|
|
34754
|
+
id: "remove-unknown-properties",
|
|
34755
|
+
checked: removeUnknownProperties,
|
|
34756
|
+
onChange: (e) => setRemoveUnknownProperties(e.target.checked)
|
|
34757
|
+
}
|
|
34758
|
+
),
|
|
34759
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CheckboxLabel, { htmlFor: "remove-unknown-properties", children: "Remove unknown properties (properties that don't exist in the selected snapshot)" })
|
|
34760
|
+
] })
|
|
34761
|
+
] }),
|
|
34762
|
+
timestamps.length > 0 && timestamps[selectedIndex] !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(PreviewSection, { children: [
|
|
34763
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PreviewLabel, { children: "State at that time:" }),
|
|
34764
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PreviewPre, { children: JSON.stringify(coMapAtSelectedIndex, null, 2) })
|
|
34765
|
+
] }),
|
|
34766
|
+
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." })
|
|
34767
|
+
]
|
|
34768
|
+
}
|
|
34769
|
+
)
|
|
34770
|
+
] });
|
|
34771
|
+
}
|
|
34772
|
+
var PreviewSection = styled20("div")`
|
|
34773
|
+
margin-top: 1.5rem;
|
|
34774
|
+
`;
|
|
34775
|
+
var PreviewLabel = styled20("div")`
|
|
34776
|
+
font-weight: 500;
|
|
34777
|
+
margin-bottom: 0.5rem;
|
|
34778
|
+
color: var(--j-text-color-strong);
|
|
34779
|
+
`;
|
|
34780
|
+
var PreviewPre = styled20("pre")`
|
|
34781
|
+
background-color: var(--j-foreground);
|
|
34782
|
+
border: 1px solid var(--j-border-color);
|
|
34783
|
+
border-radius: var(--j-radius-md);
|
|
34784
|
+
padding: 1rem;
|
|
34785
|
+
overflow-x: auto;
|
|
34786
|
+
font-size: 0.875rem;
|
|
34787
|
+
max-height: 400px;
|
|
34788
|
+
overflow-y: auto;
|
|
34789
|
+
color: var(--j-text-color);
|
|
34790
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
34791
|
+
`;
|
|
34792
|
+
var RangeContainer = styled20("div")`
|
|
34793
|
+
display: flex;
|
|
34794
|
+
flex-direction: column;
|
|
34795
|
+
gap: 0.75rem;
|
|
34796
|
+
`;
|
|
34797
|
+
var RangeLabel = styled20("label")`
|
|
34798
|
+
font-weight: 500;
|
|
34799
|
+
color: var(--j-text-color-strong);
|
|
34800
|
+
font-size: 0.875rem;
|
|
34801
|
+
`;
|
|
34802
|
+
var RangeInput = styled20("input")`
|
|
34803
|
+
width: 100%;
|
|
34804
|
+
height: 0.5rem;
|
|
34805
|
+
border-radius: var(--j-radius-sm);
|
|
34806
|
+
outline: none;
|
|
34807
|
+
-webkit-appearance: none;
|
|
34808
|
+
appearance: none;
|
|
34809
|
+
background: var(--j-foreground);
|
|
34810
|
+
cursor: pointer;
|
|
34811
|
+
|
|
34812
|
+
&::-webkit-slider-thumb {
|
|
34813
|
+
-webkit-appearance: none;
|
|
34814
|
+
appearance: none;
|
|
34815
|
+
width: 1.25rem;
|
|
34816
|
+
height: 1.25rem;
|
|
34817
|
+
border-radius: 50%;
|
|
34818
|
+
background: var(--j-primary-color);
|
|
34819
|
+
cursor: pointer;
|
|
34820
|
+
border: 2px solid var(--j-background);
|
|
34821
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
34822
|
+
}
|
|
34823
|
+
|
|
34824
|
+
&::-moz-range-thumb {
|
|
34825
|
+
width: 1.25rem;
|
|
34826
|
+
height: 1.25rem;
|
|
34827
|
+
border-radius: 50%;
|
|
34828
|
+
background: var(--j-primary-color);
|
|
34829
|
+
cursor: pointer;
|
|
34830
|
+
border: 2px solid var(--j-background);
|
|
34831
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
34832
|
+
}
|
|
34833
|
+
|
|
34834
|
+
&:disabled {
|
|
34835
|
+
opacity: 0.5;
|
|
34836
|
+
cursor: not-allowed;
|
|
34837
|
+
}
|
|
34838
|
+
`;
|
|
34839
|
+
var TimestampDisplay = styled20("div")`
|
|
34840
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
34841
|
+
font-size: 0.875rem;
|
|
34842
|
+
color: var(--j-text-color);
|
|
34843
|
+
padding: 0.5rem;
|
|
34844
|
+
background-color: var(--j-foreground);
|
|
34845
|
+
border: 1px solid var(--j-border-color);
|
|
34846
|
+
border-radius: var(--j-radius-md);
|
|
34847
|
+
text-align: center;
|
|
34848
|
+
`;
|
|
34849
|
+
var CheckboxContainer = styled20("div")`
|
|
34850
|
+
display: flex;
|
|
34851
|
+
align-items: flex-start;
|
|
34852
|
+
gap: 0.5rem;
|
|
34853
|
+
margin-top: 1rem;
|
|
34854
|
+
`;
|
|
34855
|
+
var CheckboxInput = styled20("input")`
|
|
34856
|
+
width: 1rem;
|
|
34857
|
+
height: 1rem;
|
|
34858
|
+
margin-top: 0.125rem;
|
|
34859
|
+
cursor: pointer;
|
|
34860
|
+
accent-color: var(--j-primary-color);
|
|
34861
|
+
`;
|
|
34862
|
+
var CheckboxLabel = styled20("label")`
|
|
34863
|
+
font-size: 0.875rem;
|
|
34864
|
+
color: var(--j-text-color);
|
|
34865
|
+
cursor: pointer;
|
|
34866
|
+
line-height: 1.25rem;
|
|
34867
|
+
`;
|
|
34868
|
+
var EditorContainer = styled20("div")`
|
|
34869
|
+
margin-top: 1rem;
|
|
34870
|
+
`;
|
|
34871
|
+
|
|
34230
34872
|
// src/inspector/viewer/page.tsx
|
|
34231
|
-
var
|
|
34232
|
-
var BasePageContainer =
|
|
34233
|
-
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ (0,
|
|
34873
|
+
var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
|
|
34874
|
+
var BasePageContainer = import_react21.default.forwardRef(
|
|
34875
|
+
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { ref, ...rest })
|
|
34234
34876
|
);
|
|
34235
|
-
var PageContainer =
|
|
34877
|
+
var PageContainer = styled21(BasePageContainer)`
|
|
34236
34878
|
position: absolute;
|
|
34237
34879
|
z-index: 10;
|
|
34238
34880
|
inset: 0;
|
|
@@ -34240,36 +34882,36 @@ var PageContainer = styled18(BasePageContainer)`
|
|
|
34240
34882
|
height: 100%;
|
|
34241
34883
|
padding: 0 0.75rem;
|
|
34242
34884
|
`;
|
|
34243
|
-
var BackButton =
|
|
34885
|
+
var BackButton = styled21("div")`
|
|
34244
34886
|
position: absolute;
|
|
34245
34887
|
left: 0;
|
|
34246
34888
|
right: 0;
|
|
34247
34889
|
top: 0;
|
|
34248
34890
|
height: 2.5rem;
|
|
34249
34891
|
`;
|
|
34250
|
-
var HeaderContainer =
|
|
34892
|
+
var HeaderContainer = styled21("div")`
|
|
34251
34893
|
display: flex;
|
|
34252
34894
|
justify-content: space-between;
|
|
34253
34895
|
align-items: center;
|
|
34254
34896
|
margin-bottom: 1rem;
|
|
34255
34897
|
`;
|
|
34256
|
-
var TitleContainer =
|
|
34898
|
+
var TitleContainer = styled21("div")`
|
|
34257
34899
|
display: flex;
|
|
34258
34900
|
align-items: center;
|
|
34259
34901
|
gap: 0.75rem;
|
|
34260
34902
|
`;
|
|
34261
|
-
var Title =
|
|
34903
|
+
var Title = styled21(Heading)`
|
|
34262
34904
|
display: flex;
|
|
34263
34905
|
flex-direction: column;
|
|
34264
34906
|
align-items: flex-start;
|
|
34265
34907
|
gap: 0.25rem;
|
|
34266
34908
|
`;
|
|
34267
|
-
var BadgeContainer =
|
|
34909
|
+
var BadgeContainer = styled21("div")`
|
|
34268
34910
|
display: flex;
|
|
34269
34911
|
align-items: center;
|
|
34270
34912
|
gap: 0.75rem;
|
|
34271
34913
|
`;
|
|
34272
|
-
var ContentContainer =
|
|
34914
|
+
var ContentContainer = styled21("div")`
|
|
34273
34915
|
overflow: auto;
|
|
34274
34916
|
display: flex;
|
|
34275
34917
|
flex-direction: column;
|
|
@@ -34290,7 +34932,7 @@ function View(props) {
|
|
|
34290
34932
|
const { node, onNavigate } = props;
|
|
34291
34933
|
if (!snapshot || snapshot === "unavailable") return;
|
|
34292
34934
|
if (type === "costream") {
|
|
34293
|
-
return /* @__PURE__ */ (0,
|
|
34935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
34294
34936
|
CoStreamView,
|
|
34295
34937
|
{
|
|
34296
34938
|
data: snapshot,
|
|
@@ -34301,7 +34943,7 @@ function View(props) {
|
|
|
34301
34943
|
);
|
|
34302
34944
|
}
|
|
34303
34945
|
if (extendedType === "group") {
|
|
34304
|
-
return /* @__PURE__ */ (0,
|
|
34946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
34305
34947
|
GroupView,
|
|
34306
34948
|
{
|
|
34307
34949
|
coValue: value,
|
|
@@ -34312,10 +34954,10 @@ function View(props) {
|
|
|
34312
34954
|
);
|
|
34313
34955
|
}
|
|
34314
34956
|
if (extendedType === "account") {
|
|
34315
|
-
return /* @__PURE__ */ (0,
|
|
34957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AccountView, { data: snapshot, node, onNavigate });
|
|
34316
34958
|
}
|
|
34317
34959
|
if (type === "coplaintext") {
|
|
34318
|
-
return /* @__PURE__ */ (0,
|
|
34960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CoPlainTextView, { data: snapshot });
|
|
34319
34961
|
}
|
|
34320
34962
|
if (type === "colist") {
|
|
34321
34963
|
const handleRemove = (index) => {
|
|
@@ -34324,7 +34966,7 @@ function View(props) {
|
|
|
34324
34966
|
list.delete(index);
|
|
34325
34967
|
}
|
|
34326
34968
|
};
|
|
34327
|
-
return /* @__PURE__ */ (0,
|
|
34969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
34328
34970
|
TableView,
|
|
34329
34971
|
{
|
|
34330
34972
|
data: snapshot,
|
|
@@ -34335,9 +34977,20 @@ function View(props) {
|
|
|
34335
34977
|
);
|
|
34336
34978
|
}
|
|
34337
34979
|
if (extendedType === "record") {
|
|
34338
|
-
return /* @__PURE__ */ (0,
|
|
34980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableView, { data: snapshot, node, onNavigate });
|
|
34981
|
+
}
|
|
34982
|
+
if (type === "comap") {
|
|
34983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
34984
|
+
CoMapView,
|
|
34985
|
+
{
|
|
34986
|
+
coValue: value,
|
|
34987
|
+
data: snapshot,
|
|
34988
|
+
node,
|
|
34989
|
+
onNavigate
|
|
34990
|
+
}
|
|
34991
|
+
);
|
|
34339
34992
|
}
|
|
34340
|
-
return /* @__PURE__ */ (0,
|
|
34993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(GridView, { data: snapshot, onNavigate, node });
|
|
34341
34994
|
}
|
|
34342
34995
|
function Page(props) {
|
|
34343
34996
|
const {
|
|
@@ -34353,13 +35006,13 @@ function Page(props) {
|
|
|
34353
35006
|
const coValue = useResolvedCoValue(coId, node);
|
|
34354
35007
|
const { value, snapshot, type, extendedType } = coValue;
|
|
34355
35008
|
if (snapshot === "unavailable") {
|
|
34356
|
-
return /* @__PURE__ */ (0,
|
|
35009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { style, children: "Data unavailable" });
|
|
34357
35010
|
}
|
|
34358
35011
|
if (!snapshot) {
|
|
34359
|
-
return /* @__PURE__ */ (0,
|
|
35012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { style });
|
|
34360
35013
|
}
|
|
34361
|
-
return /* @__PURE__ */ (0,
|
|
34362
|
-
!isTopLevel && /* @__PURE__ */ (0,
|
|
35014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(PageContainer, { style, className, isTopLevel, children: [
|
|
35015
|
+
!isTopLevel && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
34363
35016
|
BackButton,
|
|
34364
35017
|
{
|
|
34365
35018
|
"aria-label": "Back",
|
|
@@ -34369,27 +35022,27 @@ function Page(props) {
|
|
|
34369
35022
|
"aria-hidden": "true"
|
|
34370
35023
|
}
|
|
34371
35024
|
),
|
|
34372
|
-
/* @__PURE__ */ (0,
|
|
34373
|
-
/* @__PURE__ */ (0,
|
|
35025
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(HeaderContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(TitleContainer, { children: [
|
|
35026
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Title, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
|
|
34374
35027
|
name,
|
|
34375
|
-
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */ (0,
|
|
35028
|
+
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { style: { color: "#57534e", fontWeight: 500 }, children: [
|
|
34376
35029
|
" ",
|
|
34377
35030
|
snapshot.name
|
|
34378
35031
|
] }) : null
|
|
34379
35032
|
] }) }),
|
|
34380
|
-
/* @__PURE__ */ (0,
|
|
34381
|
-
/* @__PURE__ */ (0,
|
|
34382
|
-
/* @__PURE__ */ (0,
|
|
35033
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(BadgeContainer, { children: [
|
|
35034
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Badge, { children: type && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TypeIcon, { type, extendedType }) }),
|
|
35035
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Badge, { children: coId })
|
|
34383
35036
|
] })
|
|
34384
35037
|
] }) }),
|
|
34385
|
-
/* @__PURE__ */ (0,
|
|
34386
|
-
/* @__PURE__ */ (0,
|
|
34387
|
-
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */ (0,
|
|
34388
|
-
/* @__PURE__ */ (0,
|
|
34389
|
-
/* @__PURE__ */ (0,
|
|
35038
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(ContentContainer, { children: [
|
|
35039
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(View, { ...props, coValue }),
|
|
35040
|
+
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
35041
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RoleDisplay, { node, value }),
|
|
35042
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Text, { muted: true, children: [
|
|
34390
35043
|
"Owned by",
|
|
34391
35044
|
" ",
|
|
34392
|
-
/* @__PURE__ */ (0,
|
|
35045
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
34393
35046
|
AccountOrGroupText,
|
|
34394
35047
|
{
|
|
34395
35048
|
coId: value.group.id,
|
|
@@ -34402,16 +35055,16 @@ function Page(props) {
|
|
|
34402
35055
|
)
|
|
34403
35056
|
] })
|
|
34404
35057
|
] }),
|
|
34405
|
-
value && /* @__PURE__ */ (0,
|
|
35058
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(HistoryView, { coValue: value, node })
|
|
34406
35059
|
] })
|
|
34407
35060
|
] });
|
|
34408
35061
|
}
|
|
34409
35062
|
|
|
34410
35063
|
// src/inspector/ui/error-boundary.tsx
|
|
34411
|
-
var
|
|
34412
|
-
var
|
|
34413
|
-
import { styled as
|
|
34414
|
-
var ErrorBoundary = class extends
|
|
35064
|
+
var import_react22 = __toESM(require_react(), 1);
|
|
35065
|
+
var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
|
|
35066
|
+
import { styled as styled22 } from "goober";
|
|
35067
|
+
var ErrorBoundary = class extends import_react22.default.Component {
|
|
34415
35068
|
constructor(props) {
|
|
34416
35069
|
super(props);
|
|
34417
35070
|
this.state = { hasError: false };
|
|
@@ -34424,24 +35077,24 @@ var ErrorBoundary = class extends import_react19.default.Component {
|
|
|
34424
35077
|
}
|
|
34425
35078
|
render() {
|
|
34426
35079
|
if (this.state.hasError) {
|
|
34427
|
-
return /* @__PURE__ */ (0,
|
|
34428
|
-
/* @__PURE__ */ (0,
|
|
34429
|
-
/* @__PURE__ */ (0,
|
|
34430
|
-
/* @__PURE__ */ (0,
|
|
35080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { style: { padding: "1rem" }, children: [
|
|
35081
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(StyledHeading2, { children: this.props.title }),
|
|
35082
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Text, { mono: true, style: { marginTop: "0.5rem", color: "#ef4444" }, children: this.state.error?.message || "An unexpected error occurred" }),
|
|
35083
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { style: { paddingLeft: "1rem", color: "#ef4444" }, children: this.state.error?.stack })
|
|
34431
35084
|
] });
|
|
34432
35085
|
}
|
|
34433
35086
|
return this.props.children;
|
|
34434
35087
|
}
|
|
34435
35088
|
};
|
|
34436
|
-
var StyledHeading2 =
|
|
35089
|
+
var StyledHeading2 = styled22("h1")`
|
|
34437
35090
|
font-size: 1.125rem;
|
|
34438
35091
|
font-weight: 500;
|
|
34439
35092
|
color: var(--j-text-color-strong);
|
|
34440
35093
|
`;
|
|
34441
35094
|
|
|
34442
35095
|
// src/inspector/viewer/page-stack.tsx
|
|
34443
|
-
var
|
|
34444
|
-
var PageStackContainer =
|
|
35096
|
+
var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
|
|
35097
|
+
var PageStackContainer = styled23("div")`
|
|
34445
35098
|
position: relative;
|
|
34446
35099
|
padding: 0 0.75rem;
|
|
34447
35100
|
overflow-y: auto;
|
|
@@ -34458,9 +35111,9 @@ function PageStack({
|
|
|
34458
35111
|
}) {
|
|
34459
35112
|
const page = path[path.length - 1];
|
|
34460
35113
|
const index = path.length - 1;
|
|
34461
|
-
return /* @__PURE__ */ (0,
|
|
35114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(PageStackContainer, { children: [
|
|
34462
35115
|
children,
|
|
34463
|
-
node && page && /* @__PURE__ */ (0,
|
|
35116
|
+
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
35117
|
Page,
|
|
34465
35118
|
{
|
|
34466
35119
|
coId: page.coId,
|
|
@@ -34475,10 +35128,10 @@ function PageStack({
|
|
|
34475
35128
|
}
|
|
34476
35129
|
|
|
34477
35130
|
// src/inspector/viewer/use-page-path.ts
|
|
34478
|
-
var
|
|
35131
|
+
var import_react23 = __toESM(require_react(), 1);
|
|
34479
35132
|
var STORAGE_KEY = "jazz-inspector-paths";
|
|
34480
35133
|
function usePagePath(defaultPath) {
|
|
34481
|
-
const [path, setPath] = (0,
|
|
35134
|
+
const [path, setPath] = (0, import_react23.useState)(() => {
|
|
34482
35135
|
if (typeof window === "undefined") return [];
|
|
34483
35136
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
34484
35137
|
if (stored) {
|
|
@@ -34490,34 +35143,34 @@ function usePagePath(defaultPath) {
|
|
|
34490
35143
|
}
|
|
34491
35144
|
return defaultPath || [];
|
|
34492
35145
|
});
|
|
34493
|
-
const updatePath = (0,
|
|
35146
|
+
const updatePath = (0, import_react23.useCallback)((newPath) => {
|
|
34494
35147
|
setPath(newPath);
|
|
34495
35148
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(newPath));
|
|
34496
35149
|
}, []);
|
|
34497
|
-
(0,
|
|
35150
|
+
(0, import_react23.useEffect)(() => {
|
|
34498
35151
|
if (defaultPath && JSON.stringify(path) !== JSON.stringify(defaultPath)) {
|
|
34499
35152
|
updatePath(defaultPath);
|
|
34500
35153
|
}
|
|
34501
35154
|
}, [defaultPath, path, updatePath]);
|
|
34502
|
-
const addPages = (0,
|
|
35155
|
+
const addPages = (0, import_react23.useCallback)(
|
|
34503
35156
|
(newPages) => {
|
|
34504
35157
|
updatePath([...path, ...newPages]);
|
|
34505
35158
|
},
|
|
34506
35159
|
[path, updatePath]
|
|
34507
35160
|
);
|
|
34508
|
-
const goToIndex = (0,
|
|
35161
|
+
const goToIndex = (0, import_react23.useCallback)(
|
|
34509
35162
|
(index) => {
|
|
34510
35163
|
updatePath(path.slice(0, index + 1));
|
|
34511
35164
|
},
|
|
34512
35165
|
[path, updatePath]
|
|
34513
35166
|
);
|
|
34514
|
-
const setPage = (0,
|
|
35167
|
+
const setPage = (0, import_react23.useCallback)(
|
|
34515
35168
|
(coId) => {
|
|
34516
35169
|
updatePath([{ coId, name: "Root" }]);
|
|
34517
35170
|
},
|
|
34518
35171
|
[updatePath]
|
|
34519
35172
|
);
|
|
34520
|
-
const goBack = (0,
|
|
35173
|
+
const goBack = (0, import_react23.useCallback)(() => {
|
|
34521
35174
|
if (path.length > 1) {
|
|
34522
35175
|
updatePath(path.slice(0, path.length - 1));
|
|
34523
35176
|
}
|
|
@@ -34532,8 +35185,8 @@ function usePagePath(defaultPath) {
|
|
|
34532
35185
|
}
|
|
34533
35186
|
|
|
34534
35187
|
// src/inspector/ui/global-styles.tsx
|
|
34535
|
-
import { styled as
|
|
34536
|
-
var GlobalStyles =
|
|
35188
|
+
import { styled as styled24 } from "goober";
|
|
35189
|
+
var GlobalStyles = styled24("div")`
|
|
34537
35190
|
/* Colors */
|
|
34538
35191
|
--j-primary-color: #146AFF;
|
|
34539
35192
|
--j-link-color: var(--j-primary-color);
|
|
@@ -34607,9 +35260,9 @@ var GlobalStyles = styled21("div")`
|
|
|
34607
35260
|
`;
|
|
34608
35261
|
|
|
34609
35262
|
// src/inspector/viewer/inspector-button.tsx
|
|
34610
|
-
var
|
|
34611
|
-
import { styled as
|
|
34612
|
-
var StyledInspectorButton =
|
|
35263
|
+
var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
|
|
35264
|
+
import { styled as styled25 } from "goober";
|
|
35265
|
+
var StyledInspectorButton = styled25("button")`
|
|
34613
35266
|
position: fixed;
|
|
34614
35267
|
width: 2.5rem;
|
|
34615
35268
|
height: 2.5rem;
|
|
@@ -34640,7 +35293,7 @@ var StyledInspectorButton = styled22("button")`
|
|
|
34640
35293
|
}
|
|
34641
35294
|
}}
|
|
34642
35295
|
`;
|
|
34643
|
-
var JazzIcon =
|
|
35296
|
+
var JazzIcon = styled25("svg")`
|
|
34644
35297
|
width: 100%;
|
|
34645
35298
|
height: auto;
|
|
34646
35299
|
position: relative;
|
|
@@ -34651,8 +35304,8 @@ function InspectorButton({
|
|
|
34651
35304
|
position = "right",
|
|
34652
35305
|
...buttonProps
|
|
34653
35306
|
}) {
|
|
34654
|
-
return /* @__PURE__ */ (0,
|
|
34655
|
-
/* @__PURE__ */ (0,
|
|
35307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(StyledInspectorButton, { position, ...buttonProps, children: [
|
|
35308
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
34656
35309
|
JazzIcon,
|
|
34657
35310
|
{
|
|
34658
35311
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -34660,7 +35313,7 @@ function InspectorButton({
|
|
|
34660
35313
|
height: "115",
|
|
34661
35314
|
viewBox: "0 0 119 115",
|
|
34662
35315
|
fill: "none",
|
|
34663
|
-
children: /* @__PURE__ */ (0,
|
|
35316
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
34664
35317
|
"path",
|
|
34665
35318
|
{
|
|
34666
35319
|
fillRule: "evenodd",
|
|
@@ -34671,7 +35324,7 @@ function InspectorButton({
|
|
|
34671
35324
|
)
|
|
34672
35325
|
}
|
|
34673
35326
|
),
|
|
34674
|
-
/* @__PURE__ */ (0,
|
|
35327
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
34675
35328
|
"span",
|
|
34676
35329
|
{
|
|
34677
35330
|
style: {
|
|
@@ -34692,30 +35345,30 @@ function InspectorButton({
|
|
|
34692
35345
|
}
|
|
34693
35346
|
|
|
34694
35347
|
// src/inspector/viewer/use-open-inspector.ts
|
|
34695
|
-
var
|
|
35348
|
+
var import_react24 = __toESM(require_react(), 1);
|
|
34696
35349
|
var STORAGE_KEY2 = "jazz-inspector-open";
|
|
34697
35350
|
function useOpenInspector() {
|
|
34698
|
-
const [open, setOpen] = (0,
|
|
35351
|
+
const [open, setOpen] = (0, import_react24.useState)(() => {
|
|
34699
35352
|
if (typeof window === "undefined") return false;
|
|
34700
35353
|
const stored = localStorage.getItem(STORAGE_KEY2);
|
|
34701
35354
|
return stored ? JSON.parse(stored) : false;
|
|
34702
35355
|
});
|
|
34703
|
-
(0,
|
|
35356
|
+
(0, import_react24.useEffect)(() => {
|
|
34704
35357
|
localStorage.setItem(STORAGE_KEY2, JSON.stringify(open));
|
|
34705
35358
|
}, [open]);
|
|
34706
35359
|
return [open, setOpen];
|
|
34707
35360
|
}
|
|
34708
35361
|
|
|
34709
35362
|
// src/inspector/viewer/delete-local-data.tsx
|
|
34710
|
-
var
|
|
34711
|
-
var
|
|
35363
|
+
var import_react25 = __toESM(require_react(), 1);
|
|
35364
|
+
var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
|
|
34712
35365
|
var DELETE_LOCAL_DATA_STRING = "delete my local data";
|
|
34713
35366
|
function DeleteLocalData() {
|
|
34714
|
-
const [showDeleteModal, setShowDeleteModal] = (0,
|
|
34715
|
-
const [confirmDeleteString, setConfirmDeleteString] = (0,
|
|
34716
|
-
return /* @__PURE__ */ (0,
|
|
34717
|
-
/* @__PURE__ */ (0,
|
|
34718
|
-
/* @__PURE__ */ (0,
|
|
35367
|
+
const [showDeleteModal, setShowDeleteModal] = (0, import_react25.useState)(false);
|
|
35368
|
+
const [confirmDeleteString, setConfirmDeleteString] = (0, import_react25.useState)("");
|
|
35369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
35370
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { variant: "destructive", onClick: () => setShowDeleteModal(true), children: "Delete my local data" }),
|
|
35371
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
34719
35372
|
Modal,
|
|
34720
35373
|
{
|
|
34721
35374
|
isOpen: showDeleteModal,
|
|
@@ -34723,7 +35376,7 @@ function DeleteLocalData() {
|
|
|
34723
35376
|
heading: "Delete Local Data",
|
|
34724
35377
|
showButtons: false,
|
|
34725
35378
|
children: [
|
|
34726
|
-
/* @__PURE__ */ (0,
|
|
35379
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
34727
35380
|
"div",
|
|
34728
35381
|
{
|
|
34729
35382
|
style: {
|
|
@@ -34734,33 +35387,33 @@ function DeleteLocalData() {
|
|
|
34734
35387
|
gap: "0.5rem"
|
|
34735
35388
|
},
|
|
34736
35389
|
children: [
|
|
34737
|
-
/* @__PURE__ */ (0,
|
|
35390
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("p", { children: [
|
|
34738
35391
|
"This action ",
|
|
34739
|
-
/* @__PURE__ */ (0,
|
|
35392
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("strong", { children: "cannot" }),
|
|
34740
35393
|
" be undone."
|
|
34741
35394
|
] }),
|
|
34742
|
-
/* @__PURE__ */ (0,
|
|
35395
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("p", { children: [
|
|
34743
35396
|
"Be aware that the following data will be",
|
|
34744
35397
|
" ",
|
|
34745
|
-
/* @__PURE__ */ (0,
|
|
35398
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("strong", { children: "permanently" }),
|
|
34746
35399
|
" deleted:"
|
|
34747
35400
|
] }),
|
|
34748
|
-
/* @__PURE__ */ (0,
|
|
34749
|
-
/* @__PURE__ */ (0,
|
|
35401
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("ul", { style: { listStyleType: "disc", paddingLeft: "1rem" }, children: [
|
|
35402
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("li", { children: [
|
|
34750
35403
|
"Unsynced data for ",
|
|
34751
|
-
/* @__PURE__ */ (0,
|
|
35404
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("strong", { children: "all apps" }),
|
|
34752
35405
|
" on",
|
|
34753
35406
|
" ",
|
|
34754
|
-
/* @__PURE__ */ (0,
|
|
35407
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("code", { children: window.location.origin })
|
|
34755
35408
|
] }),
|
|
34756
|
-
/* @__PURE__ */ (0,
|
|
34757
|
-
/* @__PURE__ */ (0,
|
|
35409
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("li", { children: "Accounts" }),
|
|
35410
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("li", { children: "Logged in sessions" })
|
|
34758
35411
|
] }),
|
|
34759
|
-
/* @__PURE__ */ (0,
|
|
35412
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", {})
|
|
34760
35413
|
]
|
|
34761
35414
|
}
|
|
34762
35415
|
),
|
|
34763
|
-
/* @__PURE__ */ (0,
|
|
35416
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
34764
35417
|
Input,
|
|
34765
35418
|
{
|
|
34766
35419
|
label: `Type "${DELETE_LOCAL_DATA_STRING}" to confirm`,
|
|
@@ -34771,7 +35424,7 @@ function DeleteLocalData() {
|
|
|
34771
35424
|
}
|
|
34772
35425
|
}
|
|
34773
35426
|
),
|
|
34774
|
-
/* @__PURE__ */ (0,
|
|
35427
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
34775
35428
|
"p",
|
|
34776
35429
|
{
|
|
34777
35430
|
style: {
|
|
@@ -34781,14 +35434,14 @@ function DeleteLocalData() {
|
|
|
34781
35434
|
flexDirection: "column",
|
|
34782
35435
|
gap: "0.5rem"
|
|
34783
35436
|
},
|
|
34784
|
-
children: /* @__PURE__ */ (0,
|
|
35437
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("small", { children: [
|
|
34785
35438
|
"Data synced to a sync server will ",
|
|
34786
|
-
/* @__PURE__ */ (0,
|
|
35439
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("strong", { children: "not" }),
|
|
34787
35440
|
" be deleted, and will be synced when you log in again."
|
|
34788
35441
|
] })
|
|
34789
35442
|
}
|
|
34790
35443
|
),
|
|
34791
|
-
/* @__PURE__ */ (0,
|
|
35444
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
34792
35445
|
"div",
|
|
34793
35446
|
{
|
|
34794
35447
|
style: {
|
|
@@ -34798,8 +35451,8 @@ function DeleteLocalData() {
|
|
|
34798
35451
|
gap: "0.5rem"
|
|
34799
35452
|
},
|
|
34800
35453
|
children: [
|
|
34801
|
-
/* @__PURE__ */ (0,
|
|
34802
|
-
/* @__PURE__ */ (0,
|
|
35454
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { variant: "secondary", onClick: () => setShowDeleteModal(false), children: "Cancel" }),
|
|
35455
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
34803
35456
|
Button,
|
|
34804
35457
|
{
|
|
34805
35458
|
variant: "destructive",
|
|
@@ -34826,8 +35479,8 @@ function DeleteLocalData() {
|
|
|
34826
35479
|
}
|
|
34827
35480
|
|
|
34828
35481
|
// src/inspector/viewer/new-app.tsx
|
|
34829
|
-
var
|
|
34830
|
-
var InspectorContainer =
|
|
35482
|
+
var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
|
|
35483
|
+
var InspectorContainer = styled26("div")`
|
|
34831
35484
|
position: fixed;
|
|
34832
35485
|
height: 50vh;
|
|
34833
35486
|
max-height: 800px;
|
|
@@ -34844,17 +35497,17 @@ var InspectorContainer = styled23("div")`
|
|
|
34844
35497
|
background-color: var(--j-background);
|
|
34845
35498
|
}
|
|
34846
35499
|
`;
|
|
34847
|
-
var HeaderContainer2 =
|
|
35500
|
+
var HeaderContainer2 = styled26("div")`
|
|
34848
35501
|
display: flex;
|
|
34849
35502
|
align-items: center;
|
|
34850
35503
|
gap: 1rem;
|
|
34851
35504
|
padding: 0 0.75rem;
|
|
34852
35505
|
margin: 0.75rem 0;
|
|
34853
35506
|
`;
|
|
34854
|
-
var Form =
|
|
35507
|
+
var Form = styled26("form")`
|
|
34855
35508
|
width: 24rem;
|
|
34856
35509
|
`;
|
|
34857
|
-
var InitialForm =
|
|
35510
|
+
var InitialForm = styled26("form")`
|
|
34858
35511
|
display: flex;
|
|
34859
35512
|
flex-direction: column;
|
|
34860
35513
|
position: relative;
|
|
@@ -34866,7 +35519,7 @@ var InitialForm = styled23("form")`
|
|
|
34866
35519
|
max-width: 24rem;
|
|
34867
35520
|
margin: 0 auto;
|
|
34868
35521
|
`;
|
|
34869
|
-
var OrText =
|
|
35522
|
+
var OrText = styled26("p")`
|
|
34870
35523
|
text-align: center;
|
|
34871
35524
|
`;
|
|
34872
35525
|
function JazzInspectorInternal({
|
|
@@ -34875,7 +35528,7 @@ function JazzInspectorInternal({
|
|
|
34875
35528
|
accountId
|
|
34876
35529
|
}) {
|
|
34877
35530
|
const [open, setOpen] = useOpenInspector();
|
|
34878
|
-
const [coValueId, setCoValueId] = (0,
|
|
35531
|
+
const [coValueId, setCoValueId] = (0, import_react26.useState)("");
|
|
34879
35532
|
const { path, addPages, goToIndex, goBack, setPage } = usePagePath();
|
|
34880
35533
|
const handleCoValueIdSubmit = (e) => {
|
|
34881
35534
|
e.preventDefault();
|
|
@@ -34885,12 +35538,12 @@ function JazzInspectorInternal({
|
|
|
34885
35538
|
setCoValueId("");
|
|
34886
35539
|
};
|
|
34887
35540
|
if (!open) {
|
|
34888
|
-
return /* @__PURE__ */ (0,
|
|
35541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(InspectorButton, { position, onClick: () => setOpen(true) });
|
|
34889
35542
|
}
|
|
34890
|
-
return /* @__PURE__ */ (0,
|
|
34891
|
-
/* @__PURE__ */ (0,
|
|
34892
|
-
/* @__PURE__ */ (0,
|
|
34893
|
-
path.length !== 0 && /* @__PURE__ */ (0,
|
|
35543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(InspectorContainer, { as: GlobalStyles, style: { zIndex: 999 }, children: [
|
|
35544
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(HeaderContainer2, { children: [
|
|
35545
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Breadcrumbs, { path, onBreadcrumbClick: goToIndex }),
|
|
35546
|
+
path.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Form, { onSubmit: handleCoValueIdSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
34894
35547
|
Input,
|
|
34895
35548
|
{
|
|
34896
35549
|
label: "CoValue ID",
|
|
@@ -34901,24 +35554,24 @@ function JazzInspectorInternal({
|
|
|
34901
35554
|
onChange: (e) => setCoValueId(e.target.value)
|
|
34902
35555
|
}
|
|
34903
35556
|
) }),
|
|
34904
|
-
/* @__PURE__ */ (0,
|
|
34905
|
-
/* @__PURE__ */ (0,
|
|
35557
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(DeleteLocalData, {}),
|
|
35558
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button, { variant: "plain", type: "button", onClick: () => setOpen(false), children: "Close" })
|
|
34906
35559
|
] }),
|
|
34907
|
-
/* @__PURE__ */ (0,
|
|
35560
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
34908
35561
|
PageStack,
|
|
34909
35562
|
{
|
|
34910
35563
|
path,
|
|
34911
35564
|
node: localNode,
|
|
34912
35565
|
goBack,
|
|
34913
35566
|
addPages,
|
|
34914
|
-
children: path.length <= 0 && /* @__PURE__ */ (0,
|
|
35567
|
+
children: path.length <= 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
34915
35568
|
InitialForm,
|
|
34916
35569
|
{
|
|
34917
35570
|
onSubmit: handleCoValueIdSubmit,
|
|
34918
35571
|
"aria-hidden": path.length !== 0,
|
|
34919
35572
|
children: [
|
|
34920
|
-
/* @__PURE__ */ (0,
|
|
34921
|
-
/* @__PURE__ */ (0,
|
|
35573
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Heading, { children: "Jazz CoValue Inspector" }),
|
|
35574
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
34922
35575
|
Input,
|
|
34923
35576
|
{
|
|
34924
35577
|
label: "CoValue ID",
|
|
@@ -34929,10 +35582,10 @@ function JazzInspectorInternal({
|
|
|
34929
35582
|
onChange: (e) => setCoValueId(e.target.value)
|
|
34930
35583
|
}
|
|
34931
35584
|
),
|
|
34932
|
-
/* @__PURE__ */ (0,
|
|
34933
|
-
accountId && /* @__PURE__ */ (0,
|
|
34934
|
-
/* @__PURE__ */ (0,
|
|
34935
|
-
/* @__PURE__ */ (0,
|
|
35585
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button, { type: "submit", variant: "primary", children: "Inspect CoValue" }),
|
|
35586
|
+
accountId && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
35587
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(OrText, { children: "or" }),
|
|
35588
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
34936
35589
|
Button,
|
|
34937
35590
|
{
|
|
34938
35591
|
variant: "secondary",
|
|
@@ -34953,8 +35606,8 @@ function JazzInspectorInternal({
|
|
|
34953
35606
|
}
|
|
34954
35607
|
|
|
34955
35608
|
// src/inspector/custom-element.tsx
|
|
34956
|
-
var
|
|
34957
|
-
setup(
|
|
35609
|
+
var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
|
|
35610
|
+
setup(import_react27.default.createElement);
|
|
34958
35611
|
var JazzInspectorElement = class extends HTMLElement {
|
|
34959
35612
|
constructor() {
|
|
34960
35613
|
super(...arguments);
|
|
@@ -34996,7 +35649,7 @@ var JazzInspectorElement = class extends HTMLElement {
|
|
|
34996
35649
|
return;
|
|
34997
35650
|
}
|
|
34998
35651
|
this.root?.render(
|
|
34999
|
-
/* @__PURE__ */ (0,
|
|
35652
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
35000
35653
|
JazzInspectorInternal,
|
|
35001
35654
|
{
|
|
35002
35655
|
localNode: this.account.$jazz.localNode,
|
|
@@ -35122,4 +35775,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
35122
35775
|
* LICENSE file in the root directory of this source tree.
|
|
35123
35776
|
*)
|
|
35124
35777
|
*/
|
|
35125
|
-
//# sourceMappingURL=custom-element-
|
|
35778
|
+
//# sourceMappingURL=custom-element-ABVPHX53.js.map
|