jazz-tools 0.20.1 → 0.20.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.
Files changed (115) hide show
  1. package/.turbo/turbo-build.log +48 -48
  2. package/CHANGELOG.md +10 -0
  3. package/dist/{chunk-2OPP7KWV.js → chunk-Q5RNSSUM.js} +121 -22
  4. package/dist/chunk-Q5RNSSUM.js.map +1 -0
  5. package/dist/index.js +1 -1
  6. package/dist/inspector/{chunk-MCTB5ZJC.js → chunk-6JPVMI3V.js} +302 -182
  7. package/dist/inspector/chunk-6JPVMI3V.js.map +1 -0
  8. package/dist/inspector/{custom-element-5YWVZBWA.js → custom-element-PWRX4VCA.js} +1337 -206
  9. package/dist/inspector/custom-element-PWRX4VCA.js.map +1 -0
  10. package/dist/inspector/in-app.d.ts +1 -0
  11. package/dist/inspector/in-app.d.ts.map +1 -1
  12. package/dist/inspector/index.d.ts +1 -0
  13. package/dist/inspector/index.d.ts.map +1 -1
  14. package/dist/inspector/index.js +1044 -17
  15. package/dist/inspector/index.js.map +1 -1
  16. package/dist/inspector/pages/home.d.ts +4 -1
  17. package/dist/inspector/pages/home.d.ts.map +1 -1
  18. package/dist/inspector/pages/performance/PerformancePage.d.ts +7 -0
  19. package/dist/inspector/pages/performance/PerformancePage.d.ts.map +1 -0
  20. package/dist/inspector/pages/performance/SubscriptionDetailPanel.d.ts +8 -0
  21. package/dist/inspector/pages/performance/SubscriptionDetailPanel.d.ts.map +1 -0
  22. package/dist/inspector/pages/performance/SubscriptionRow.d.ts +11 -0
  23. package/dist/inspector/pages/performance/SubscriptionRow.d.ts.map +1 -0
  24. package/dist/inspector/pages/performance/Timeline.d.ts +12 -0
  25. package/dist/inspector/pages/performance/Timeline.d.ts.map +1 -0
  26. package/dist/inspector/pages/performance/helpers.d.ts +5 -0
  27. package/dist/inspector/pages/performance/helpers.d.ts.map +1 -0
  28. package/dist/inspector/pages/performance/index.d.ts +3 -0
  29. package/dist/inspector/pages/performance/index.d.ts.map +1 -0
  30. package/dist/inspector/pages/performance/types.d.ts +13 -0
  31. package/dist/inspector/pages/performance/types.d.ts.map +1 -0
  32. package/dist/inspector/pages/performance/usePerformanceEntries.d.ts +3 -0
  33. package/dist/inspector/pages/performance/usePerformanceEntries.d.ts.map +1 -0
  34. package/dist/inspector/register-custom-element.js +3 -1
  35. package/dist/inspector/register-custom-element.js.map +1 -1
  36. package/dist/inspector/standalone.js +1 -1
  37. package/dist/inspector/tests/pages/performance/PerformancePage.test.d.ts +2 -0
  38. package/dist/inspector/tests/pages/performance/PerformancePage.test.d.ts.map +1 -0
  39. package/dist/inspector/tests/pages/performance/SubscriptionDetailPanel.test.d.ts +2 -0
  40. package/dist/inspector/tests/pages/performance/SubscriptionDetailPanel.test.d.ts.map +1 -0
  41. package/dist/inspector/tests/pages/performance/SubscriptionRow.test.d.ts +2 -0
  42. package/dist/inspector/tests/pages/performance/SubscriptionRow.test.d.ts.map +1 -0
  43. package/dist/inspector/tests/pages/performance/Timeline.test.d.ts +2 -0
  44. package/dist/inspector/tests/pages/performance/Timeline.test.d.ts.map +1 -0
  45. package/dist/inspector/tests/pages/performance/helpers.test.d.ts +2 -0
  46. package/dist/inspector/tests/pages/performance/helpers.test.d.ts.map +1 -0
  47. package/dist/inspector/viewer/delete-local-data.d.ts.map +1 -1
  48. package/dist/inspector/viewer/header.d.ts +4 -2
  49. package/dist/inspector/viewer/header.d.ts.map +1 -1
  50. package/dist/inspector/viewer/page-stack.d.ts +3 -1
  51. package/dist/inspector/viewer/page-stack.d.ts.map +1 -1
  52. package/dist/react-core/hooks.d.ts +2 -2
  53. package/dist/react-core/hooks.d.ts.map +1 -1
  54. package/dist/react-core/index.js +50 -18
  55. package/dist/react-core/index.js.map +1 -1
  56. package/dist/react-core/subscription-provider.d.ts.map +1 -1
  57. package/dist/react-native-core/media/image.d.ts +1 -1
  58. package/dist/svelte/jazz.class.svelte.d.ts.map +1 -1
  59. package/dist/svelte/jazz.class.svelte.js +27 -22
  60. package/dist/testing.js +1 -1
  61. package/dist/tools/coValues/interfaces.d.ts.map +1 -1
  62. package/dist/tools/exports.d.ts +1 -1
  63. package/dist/tools/exports.d.ts.map +1 -1
  64. package/dist/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.d.ts.map +1 -1
  65. package/dist/tools/subscribe/SubscriptionCache.d.ts +2 -2
  66. package/dist/tools/subscribe/SubscriptionCache.d.ts.map +1 -1
  67. package/dist/tools/subscribe/SubscriptionScope.d.ts +19 -12
  68. package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
  69. package/dist/tools/subscribe/errorReporting.d.ts +6 -0
  70. package/dist/tools/subscribe/errorReporting.d.ts.map +1 -1
  71. package/dist/tools/subscribe/index.d.ts +4 -4
  72. package/dist/tools/subscribe/index.d.ts.map +1 -1
  73. package/dist/tools/subscribe/types.d.ts +48 -3
  74. package/dist/tools/subscribe/types.d.ts.map +1 -1
  75. package/dist/tools/subscribe/utils.d.ts +1 -1
  76. package/dist/tools/subscribe/utils.d.ts.map +1 -1
  77. package/dist/tools/tests/SubscriptionScope.performance.test.d.ts +2 -0
  78. package/dist/tools/tests/SubscriptionScope.performance.test.d.ts.map +1 -0
  79. package/package.json +4 -4
  80. package/src/inspector/in-app.tsx +41 -3
  81. package/src/inspector/index.tsx +5 -1
  82. package/src/inspector/pages/home.tsx +26 -3
  83. package/src/inspector/pages/performance/PerformancePage.tsx +215 -0
  84. package/src/inspector/pages/performance/SubscriptionDetailPanel.tsx +182 -0
  85. package/src/inspector/pages/performance/SubscriptionRow.tsx +242 -0
  86. package/src/inspector/pages/performance/Timeline.tsx +513 -0
  87. package/src/inspector/pages/performance/helpers.ts +70 -0
  88. package/src/inspector/pages/performance/index.ts +2 -0
  89. package/src/inspector/pages/performance/types.ts +12 -0
  90. package/src/inspector/pages/performance/usePerformanceEntries.ts +53 -0
  91. package/src/inspector/register-custom-element.ts +3 -0
  92. package/src/inspector/tests/pages/performance/PerformancePage.test.tsx +83 -0
  93. package/src/inspector/tests/pages/performance/SubscriptionDetailPanel.test.tsx +68 -0
  94. package/src/inspector/tests/pages/performance/SubscriptionRow.test.tsx +93 -0
  95. package/src/inspector/tests/pages/performance/Timeline.test.tsx +57 -0
  96. package/src/inspector/tests/pages/performance/helpers.test.ts +91 -0
  97. package/src/inspector/viewer/delete-local-data.tsx +24 -5
  98. package/src/inspector/viewer/header.tsx +96 -17
  99. package/src/inspector/viewer/page-stack.tsx +22 -18
  100. package/src/react-core/hooks.ts +34 -4
  101. package/src/react-core/subscription-provider.tsx +17 -8
  102. package/src/svelte/jazz.class.svelte.ts +51 -33
  103. package/src/tools/coValues/interfaces.ts +3 -0
  104. package/src/tools/exports.ts +1 -0
  105. package/src/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.ts +13 -0
  106. package/src/tools/subscribe/SubscriptionCache.ts +6 -4
  107. package/src/tools/subscribe/SubscriptionScope.ts +141 -23
  108. package/src/tools/subscribe/errorReporting.ts +1 -1
  109. package/src/tools/subscribe/index.ts +1 -1
  110. package/src/tools/subscribe/types.ts +62 -9
  111. package/src/tools/subscribe/utils.ts +2 -2
  112. package/src/tools/tests/SubscriptionScope.performance.test.ts +149 -0
  113. package/dist/chunk-2OPP7KWV.js.map +0 -1
  114. package/dist/inspector/chunk-MCTB5ZJC.js.map +0 -1
  115. package/dist/inspector/custom-element-5YWVZBWA.js.map +0 -1
package/dist/index.js CHANGED
@@ -50,7 +50,7 @@ import {
50
50
  subscribeToCoValue,
51
51
  unstable_loadUnique,
52
52
  zodReExport_exports
53
- } from "./chunk-2OPP7KWV.js";
53
+ } from "./chunk-Q5RNSSUM.js";
54
54
  import {
55
55
  createSSRJazzAgent
56
56
  } from "./chunk-K4D7IMFM.js";
@@ -3706,14 +3706,163 @@ var StyledHeading2 = styled22("h1")`
3706
3706
 
3707
3707
  // src/inspector/pages/home.tsx
3708
3708
  import { styled as styled23 } from "goober";
3709
+ import { useState as useState18 } from "react";
3710
+
3711
+ // src/inspector/viewer/delete-local-data.tsx
3709
3712
  import { useState as useState17 } from "react";
3713
+ import { useJazzContext } from "jazz-tools/react-core";
3710
3714
  import { Fragment as Fragment13, jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
3711
- function HomePage() {
3715
+ var DELETE_LOCAL_DATA_STRING = "delete my local data";
3716
+ function DeleteLocalData() {
3717
+ const [showDeleteModal, setShowDeleteModal] = useState17(false);
3718
+ const [confirmDeleteString, setConfirmDeleteString] = useState17("");
3719
+ const jazzContext = useJazzContext();
3720
+ return /* @__PURE__ */ jsxs23(Fragment13, { children: [
3721
+ /* @__PURE__ */ jsx38(
3722
+ Button,
3723
+ {
3724
+ variant: "destructive",
3725
+ onClick: () => setShowDeleteModal(true),
3726
+ title: "Delete my local data",
3727
+ children: /* @__PURE__ */ jsx38(
3728
+ "svg",
3729
+ {
3730
+ width: "16",
3731
+ height: "16",
3732
+ viewBox: "0 0 16 16",
3733
+ fill: "none",
3734
+ xmlns: "http://www.w3.org/2000/svg",
3735
+ children: /* @__PURE__ */ jsx38(
3736
+ "path",
3737
+ {
3738
+ d: "M2 4h12M5.333 4V2.667a1.333 1.333 0 011.334-1.334h2.666a1.333 1.333 0 011.334 1.334V4m2 0v9.333a1.333 1.333 0 01-1.334 1.334H4.667a1.333 1.333 0 01-1.334-1.334V4h9.334z",
3739
+ stroke: "currentColor",
3740
+ strokeWidth: "1.5",
3741
+ strokeLinecap: "round",
3742
+ strokeLinejoin: "round"
3743
+ }
3744
+ )
3745
+ }
3746
+ )
3747
+ }
3748
+ ),
3749
+ /* @__PURE__ */ jsxs23(
3750
+ Modal,
3751
+ {
3752
+ isOpen: showDeleteModal,
3753
+ onClose: () => setShowDeleteModal(false),
3754
+ heading: "Delete Local Data",
3755
+ showButtons: false,
3756
+ children: [
3757
+ /* @__PURE__ */ jsxs23(
3758
+ "div",
3759
+ {
3760
+ style: {
3761
+ margin: "0 0 1rem 0",
3762
+ color: "var(--j-text-color)",
3763
+ display: "flex",
3764
+ flexDirection: "column",
3765
+ gap: "0.5rem"
3766
+ },
3767
+ children: [
3768
+ /* @__PURE__ */ jsxs23("p", { children: [
3769
+ "This action ",
3770
+ /* @__PURE__ */ jsx38("strong", { children: "cannot" }),
3771
+ " be undone."
3772
+ ] }),
3773
+ /* @__PURE__ */ jsxs23("p", { children: [
3774
+ "Be aware that the following data will be",
3775
+ " ",
3776
+ /* @__PURE__ */ jsx38("strong", { children: "permanently" }),
3777
+ " deleted:"
3778
+ ] }),
3779
+ /* @__PURE__ */ jsxs23("ul", { style: { listStyleType: "disc", paddingLeft: "1rem" }, children: [
3780
+ /* @__PURE__ */ jsxs23("li", { children: [
3781
+ "Unsynced data for ",
3782
+ /* @__PURE__ */ jsx38("strong", { children: "all apps" }),
3783
+ " on",
3784
+ " ",
3785
+ /* @__PURE__ */ jsx38("code", { children: window.location.origin })
3786
+ ] }),
3787
+ /* @__PURE__ */ jsx38("li", { children: "Accounts" }),
3788
+ /* @__PURE__ */ jsx38("li", { children: "Logged in sessions" })
3789
+ ] }),
3790
+ /* @__PURE__ */ jsx38("p", {})
3791
+ ]
3792
+ }
3793
+ ),
3794
+ /* @__PURE__ */ jsx38(
3795
+ Input,
3796
+ {
3797
+ label: `Type "${DELETE_LOCAL_DATA_STRING}" to confirm`,
3798
+ placeholder: DELETE_LOCAL_DATA_STRING,
3799
+ value: confirmDeleteString,
3800
+ onChange: (e) => {
3801
+ setConfirmDeleteString(e.target.value);
3802
+ }
3803
+ }
3804
+ ),
3805
+ /* @__PURE__ */ jsx38(
3806
+ "p",
3807
+ {
3808
+ style: {
3809
+ margin: "0 0 1rem 0",
3810
+ color: "var(--j-text-color)",
3811
+ display: "flex",
3812
+ flexDirection: "column",
3813
+ gap: "0.5rem"
3814
+ },
3815
+ children: /* @__PURE__ */ jsxs23("small", { children: [
3816
+ "Data synced to a sync server will ",
3817
+ /* @__PURE__ */ jsx38("strong", { children: "not" }),
3818
+ " be deleted, and will be synced when you log in again."
3819
+ ] })
3820
+ }
3821
+ ),
3822
+ /* @__PURE__ */ jsxs23(
3823
+ "div",
3824
+ {
3825
+ style: {
3826
+ display: "flex",
3827
+ marginTop: "0.5rem",
3828
+ justifyContent: "flex-end",
3829
+ gap: "0.5rem"
3830
+ },
3831
+ children: [
3832
+ /* @__PURE__ */ jsx38(Button, { variant: "secondary", onClick: () => setShowDeleteModal(false), children: "Cancel" }),
3833
+ /* @__PURE__ */ jsx38(
3834
+ Button,
3835
+ {
3836
+ variant: "destructive",
3837
+ disabled: confirmDeleteString !== DELETE_LOCAL_DATA_STRING,
3838
+ onClick: () => {
3839
+ localStorage.removeItem(
3840
+ jazzContext.getAuthSecretStorage().getStorageKey()
3841
+ );
3842
+ indexedDB.deleteDatabase("jazz-storage");
3843
+ window.location.reload();
3844
+ setShowDeleteModal(false);
3845
+ },
3846
+ children: "I'm sure, delete my local data"
3847
+ }
3848
+ )
3849
+ ]
3850
+ }
3851
+ )
3852
+ ]
3853
+ }
3854
+ )
3855
+ ] });
3856
+ }
3857
+
3858
+ // src/inspector/pages/home.tsx
3859
+ import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
3860
+ function HomePage({ showDeleteLocalData }) {
3712
3861
  const { localNode, accountID } = useNode();
3713
3862
  const { path, setPage } = useRouter();
3714
- const [coValueId, setCoValueId] = useState17("");
3863
+ const [coValueId, setCoValueId] = useState18("");
3715
3864
  if (!localNode || !accountID) {
3716
- return /* @__PURE__ */ jsx38("div", { children: "Loading..." });
3865
+ return /* @__PURE__ */ jsx39("div", { children: "Loading..." });
3717
3866
  }
3718
3867
  const handleCoValueIdSubmit = (e) => {
3719
3868
  e.preventDefault();
@@ -3722,40 +3871,48 @@ function HomePage() {
3722
3871
  }
3723
3872
  setCoValueId("");
3724
3873
  };
3725
- return /* @__PURE__ */ jsx38(Fragment13, { children: /* @__PURE__ */ jsxs23(
3726
- CenteredForm,
3727
- {
3728
- onSubmit: handleCoValueIdSubmit,
3729
- "aria-hidden": path.length !== 0,
3730
- children: [
3731
- /* @__PURE__ */ jsx38(Heading, { children: "Jazz CoValue Inspector" }),
3732
- /* @__PURE__ */ jsx38(
3733
- Input,
3734
- {
3735
- label: "CoValue ID",
3736
- className: "font-mono",
3737
- hideLabel: true,
3738
- placeholder: "co_z1234567890abcdef123456789",
3739
- value: coValueId,
3740
- onChange: (e) => setCoValueId(e.target.value)
3741
- }
3742
- ),
3743
- /* @__PURE__ */ jsx38(Button, { type: "submit", variant: "primary", children: "Inspect CoValue" }),
3744
- /* @__PURE__ */ jsx38(OrText, { children: "or" }),
3745
- /* @__PURE__ */ jsx38(
3746
- Button,
3747
- {
3748
- variant: "secondary",
3749
- onClick: () => {
3750
- setPage(accountID);
3751
- },
3752
- children: "Inspect my account"
3753
- }
3754
- )
3755
- ]
3756
- }
3757
- ) });
3874
+ return /* @__PURE__ */ jsxs24(PageContainer2, { children: [
3875
+ /* @__PURE__ */ jsxs24(
3876
+ CenteredForm,
3877
+ {
3878
+ onSubmit: handleCoValueIdSubmit,
3879
+ "aria-hidden": path.length !== 0,
3880
+ children: [
3881
+ /* @__PURE__ */ jsx39(Heading, { children: "Jazz CoValue Inspector" }),
3882
+ /* @__PURE__ */ jsx39(
3883
+ Input,
3884
+ {
3885
+ label: "CoValue ID",
3886
+ className: "font-mono",
3887
+ hideLabel: true,
3888
+ placeholder: "co_z1234567890abcdef123456789",
3889
+ value: coValueId,
3890
+ onChange: (e) => setCoValueId(e.target.value)
3891
+ }
3892
+ ),
3893
+ /* @__PURE__ */ jsx39(Button, { type: "submit", variant: "primary", children: "Inspect CoValue" }),
3894
+ /* @__PURE__ */ jsx39(OrText, { children: "or" }),
3895
+ /* @__PURE__ */ jsx39(
3896
+ Button,
3897
+ {
3898
+ variant: "secondary",
3899
+ onClick: () => {
3900
+ setPage(accountID);
3901
+ },
3902
+ children: "Inspect my account"
3903
+ }
3904
+ )
3905
+ ]
3906
+ }
3907
+ ),
3908
+ showDeleteLocalData && /* @__PURE__ */ jsx39(BottomRight, { children: /* @__PURE__ */ jsx39(DeleteLocalData, {}) })
3909
+ ] });
3758
3910
  }
3911
+ var PageContainer2 = styled23("div")`
3912
+ position: relative;
3913
+ height: 100%;
3914
+ width: 100%;
3915
+ `;
3759
3916
  var CenteredForm = styled23("form")`
3760
3917
  display: flex;
3761
3918
  flex-direction: column;
@@ -3771,9 +3928,14 @@ var CenteredForm = styled23("form")`
3771
3928
  var OrText = styled23("p")`
3772
3929
  text-align: center;
3773
3930
  `;
3931
+ var BottomRight = styled23("div")`
3932
+ position: absolute;
3933
+ bottom: 0.75rem;
3934
+ right: 0;
3935
+ `;
3774
3936
 
3775
3937
  // src/inspector/viewer/page-stack.tsx
3776
- import { Fragment as Fragment14, jsx as jsx39 } from "react/jsx-runtime";
3938
+ import { jsx as jsx40 } from "react/jsx-runtime";
3777
3939
  var PageStackContainer = styled24("article")`
3778
3940
  position: relative;
3779
3941
  padding: 0 0.75rem;
@@ -3782,15 +3944,15 @@ var PageStackContainer = styled24("article")`
3782
3944
  color: var(--j-text-color);
3783
3945
  font-size: 16px;
3784
3946
  `;
3785
- function PageStack({ homePage }) {
3947
+ function PageStack({ homePage, style }) {
3786
3948
  const { path, addPages, goBack } = useRouter();
3787
3949
  const { localNode } = useNode();
3788
3950
  const page = path[path.length - 1];
3789
3951
  const index = path.length - 1;
3790
3952
  if (path.length <= 0) {
3791
- return /* @__PURE__ */ jsx39(PageStackContainer, { children: homePage ?? /* @__PURE__ */ jsx39(HomePage, {}) });
3953
+ return /* @__PURE__ */ jsx40(PageStackContainer, { style, children: homePage ?? /* @__PURE__ */ jsx40(HomePage, {}) });
3792
3954
  }
3793
- return /* @__PURE__ */ jsx39(Fragment14, { children: /* @__PURE__ */ jsx39(PageStackContainer, { children: localNode && page && /* @__PURE__ */ jsx39(ErrorBoundary, { title: "An error occurred while rendering this CoValue", children: /* @__PURE__ */ jsx39(
3955
+ return /* @__PURE__ */ jsx40(PageStackContainer, { style, children: localNode && page && /* @__PURE__ */ jsx40(ErrorBoundary, { title: "An error occurred while rendering this CoValue", children: /* @__PURE__ */ jsx40(
3794
3956
  Page,
3795
3957
  {
3796
3958
  coId: page.coId,
@@ -3800,7 +3962,7 @@ function PageStack({ homePage }) {
3800
3962
  onNavigate: addPages,
3801
3963
  isTopLevel: index === path.length - 1
3802
3964
  }
3803
- ) }) }) });
3965
+ ) }) });
3804
3966
  }
3805
3967
 
3806
3968
  // src/inspector/ui/global-styles.tsx
@@ -3885,7 +4047,7 @@ import { useState as useState19 } from "react";
3885
4047
  // src/inspector/viewer/breadcrumbs.tsx
3886
4048
  import { styled as styled26 } from "goober";
3887
4049
  import React7 from "react";
3888
- import { jsx as jsx40, jsxs as jsxs24 } from "react/jsx-runtime";
4050
+ import { jsx as jsx41, jsxs as jsxs25 } from "react/jsx-runtime";
3889
4051
  var BreadcrumbsContainer = styled26("div")`
3890
4052
  position: relative;
3891
4053
  z-index: 20;
@@ -3898,8 +4060,8 @@ var Separator = styled26("span")`
3898
4060
  `;
3899
4061
  var Breadcrumbs = () => {
3900
4062
  const { path, goToIndex } = useRouter();
3901
- return /* @__PURE__ */ jsxs24(BreadcrumbsContainer, { children: [
3902
- /* @__PURE__ */ jsx40(
4063
+ return /* @__PURE__ */ jsxs25(BreadcrumbsContainer, { children: [
4064
+ /* @__PURE__ */ jsx41(
3903
4065
  Button,
3904
4066
  {
3905
4067
  variant: "link",
@@ -3909,9 +4071,9 @@ var Breadcrumbs = () => {
3909
4071
  }
3910
4072
  ),
3911
4073
  path.map((page, index) => {
3912
- return /* @__PURE__ */ jsxs24(React7.Fragment, { children: [
3913
- /* @__PURE__ */ jsx40(Separator, { "aria-hidden": true, children: "/" }),
3914
- /* @__PURE__ */ jsx40(
4074
+ return /* @__PURE__ */ jsxs25(React7.Fragment, { children: [
4075
+ /* @__PURE__ */ jsx41(Separator, { "aria-hidden": true, children: "/" }),
4076
+ /* @__PURE__ */ jsx41(
3915
4077
  Button,
3916
4078
  {
3917
4079
  variant: "link",
@@ -3925,131 +4087,13 @@ var Breadcrumbs = () => {
3925
4087
  ] });
3926
4088
  };
3927
4089
 
3928
- // src/inspector/viewer/delete-local-data.tsx
3929
- import { useState as useState18 } from "react";
3930
- import { Fragment as Fragment15, jsx as jsx41, jsxs as jsxs25 } from "react/jsx-runtime";
3931
- var DELETE_LOCAL_DATA_STRING = "delete my local data";
3932
- function DeleteLocalData() {
3933
- const [showDeleteModal, setShowDeleteModal] = useState18(false);
3934
- const [confirmDeleteString, setConfirmDeleteString] = useState18("");
3935
- return /* @__PURE__ */ jsxs25(Fragment15, { children: [
3936
- /* @__PURE__ */ jsx41(Button, { variant: "destructive", onClick: () => setShowDeleteModal(true), children: "Delete my local data" }),
3937
- /* @__PURE__ */ jsxs25(
3938
- Modal,
3939
- {
3940
- isOpen: showDeleteModal,
3941
- onClose: () => setShowDeleteModal(false),
3942
- heading: "Delete Local Data",
3943
- showButtons: false,
3944
- children: [
3945
- /* @__PURE__ */ jsxs25(
3946
- "div",
3947
- {
3948
- style: {
3949
- margin: "0 0 1rem 0",
3950
- color: "var(--j-text-color)",
3951
- display: "flex",
3952
- flexDirection: "column",
3953
- gap: "0.5rem"
3954
- },
3955
- children: [
3956
- /* @__PURE__ */ jsxs25("p", { children: [
3957
- "This action ",
3958
- /* @__PURE__ */ jsx41("strong", { children: "cannot" }),
3959
- " be undone."
3960
- ] }),
3961
- /* @__PURE__ */ jsxs25("p", { children: [
3962
- "Be aware that the following data will be",
3963
- " ",
3964
- /* @__PURE__ */ jsx41("strong", { children: "permanently" }),
3965
- " deleted:"
3966
- ] }),
3967
- /* @__PURE__ */ jsxs25("ul", { style: { listStyleType: "disc", paddingLeft: "1rem" }, children: [
3968
- /* @__PURE__ */ jsxs25("li", { children: [
3969
- "Unsynced data for ",
3970
- /* @__PURE__ */ jsx41("strong", { children: "all apps" }),
3971
- " on",
3972
- " ",
3973
- /* @__PURE__ */ jsx41("code", { children: window.location.origin })
3974
- ] }),
3975
- /* @__PURE__ */ jsx41("li", { children: "Accounts" }),
3976
- /* @__PURE__ */ jsx41("li", { children: "Logged in sessions" })
3977
- ] }),
3978
- /* @__PURE__ */ jsx41("p", {})
3979
- ]
3980
- }
3981
- ),
3982
- /* @__PURE__ */ jsx41(
3983
- Input,
3984
- {
3985
- label: `Type "${DELETE_LOCAL_DATA_STRING}" to confirm`,
3986
- placeholder: DELETE_LOCAL_DATA_STRING,
3987
- value: confirmDeleteString,
3988
- onChange: (e) => {
3989
- setConfirmDeleteString(e.target.value);
3990
- }
3991
- }
3992
- ),
3993
- /* @__PURE__ */ jsx41(
3994
- "p",
3995
- {
3996
- style: {
3997
- margin: "0 0 1rem 0",
3998
- color: "var(--j-text-color)",
3999
- display: "flex",
4000
- flexDirection: "column",
4001
- gap: "0.5rem"
4002
- },
4003
- children: /* @__PURE__ */ jsxs25("small", { children: [
4004
- "Data synced to a sync server will ",
4005
- /* @__PURE__ */ jsx41("strong", { children: "not" }),
4006
- " be deleted, and will be synced when you log in again."
4007
- ] })
4008
- }
4009
- ),
4010
- /* @__PURE__ */ jsxs25(
4011
- "div",
4012
- {
4013
- style: {
4014
- display: "flex",
4015
- marginTop: "0.5rem",
4016
- justifyContent: "flex-end",
4017
- gap: "0.5rem"
4018
- },
4019
- children: [
4020
- /* @__PURE__ */ jsx41(Button, { variant: "secondary", onClick: () => setShowDeleteModal(false), children: "Cancel" }),
4021
- /* @__PURE__ */ jsx41(
4022
- Button,
4023
- {
4024
- variant: "destructive",
4025
- disabled: confirmDeleteString !== DELETE_LOCAL_DATA_STRING,
4026
- onClick: () => {
4027
- const jazzKeys = Object.keys(localStorage).filter(
4028
- (key) => key.startsWith("jazz-") || key.startsWith("co_z")
4029
- );
4030
- jazzKeys.forEach((key) => localStorage.removeItem(key));
4031
- indexedDB.deleteDatabase("jazz-storage");
4032
- window.location.reload();
4033
- setShowDeleteModal(false);
4034
- },
4035
- children: "I'm sure, delete my local data"
4036
- }
4037
- )
4038
- ]
4039
- }
4040
- )
4041
- ]
4042
- }
4043
- )
4044
- ] });
4045
- }
4046
-
4047
4090
  // src/inspector/viewer/header.tsx
4048
- import { jsx as jsx42, jsxs as jsxs26 } from "react/jsx-runtime";
4091
+ import { Fragment as Fragment14, jsx as jsx42, jsxs as jsxs26 } from "react/jsx-runtime";
4049
4092
  function Header({
4050
- showDeleteLocalData = false,
4051
4093
  showClose = false,
4052
4094
  onClose,
4095
+ activeTab,
4096
+ onTabChange,
4053
4097
  children
4054
4098
  }) {
4055
4099
  const [coValueId, setCoValueId] = useState19("");
@@ -4062,21 +4106,59 @@ function Header({
4062
4106
  setCoValueId("");
4063
4107
  };
4064
4108
  return /* @__PURE__ */ jsxs26(HeaderContainer2, { children: [
4065
- /* @__PURE__ */ jsx42(Breadcrumbs, {}),
4066
- path.length !== 0 && /* @__PURE__ */ jsx42(Form, { onSubmit: handleCoValueIdSubmit, children: /* @__PURE__ */ jsx42(
4067
- Input,
4109
+ activeTab && onTabChange && /* @__PURE__ */ jsxs26(TabBar, { children: [
4110
+ /* @__PURE__ */ jsx42(
4111
+ Tab,
4112
+ {
4113
+ active: activeTab === "inspector",
4114
+ onClick: () => onTabChange("inspector"),
4115
+ children: "Inspector"
4116
+ }
4117
+ ),
4118
+ /* @__PURE__ */ jsx42(
4119
+ Tab,
4120
+ {
4121
+ active: activeTab === "performance",
4122
+ onClick: () => onTabChange("performance"),
4123
+ children: "Performance"
4124
+ }
4125
+ )
4126
+ ] }),
4127
+ (activeTab === "inspector" || !activeTab) && /* @__PURE__ */ jsxs26(Fragment14, { children: [
4128
+ /* @__PURE__ */ jsx42(Breadcrumbs, {}),
4129
+ path.length !== 0 && /* @__PURE__ */ jsx42(Form, { onSubmit: handleCoValueIdSubmit, children: /* @__PURE__ */ jsx42(
4130
+ Input,
4131
+ {
4132
+ label: "CoValue ID",
4133
+ style: { fontFamily: "monospace" },
4134
+ hideLabel: true,
4135
+ placeholder: "co_z1234567890abcdef123456789",
4136
+ value: coValueId,
4137
+ onChange: (e) => setCoValueId(e.target.value)
4138
+ }
4139
+ ) })
4140
+ ] }),
4141
+ children,
4142
+ /* @__PURE__ */ jsx42(Spacer, {}),
4143
+ showClose && /* @__PURE__ */ jsx42(Button, { variant: "plain", type: "button", onClick: onClose, children: /* @__PURE__ */ jsx42(
4144
+ "svg",
4068
4145
  {
4069
- label: "CoValue ID",
4070
- style: { fontFamily: "monospace" },
4071
- hideLabel: true,
4072
- placeholder: "co_z1234567890abcdef123456789",
4073
- value: coValueId,
4074
- onChange: (e) => setCoValueId(e.target.value)
4146
+ width: "14",
4147
+ height: "14",
4148
+ viewBox: "0 0 14 14",
4149
+ fill: "none",
4150
+ xmlns: "http://www.w3.org/2000/svg",
4151
+ children: /* @__PURE__ */ jsx42(
4152
+ "path",
4153
+ {
4154
+ d: "M1 1L13 13M1 13L13 1",
4155
+ stroke: "currentColor",
4156
+ strokeWidth: "2",
4157
+ strokeLinecap: "round"
4158
+ }
4159
+ )
4075
4160
  }
4076
- ) }),
4077
- children,
4078
- showDeleteLocalData && /* @__PURE__ */ jsx42(DeleteLocalData, {}),
4079
- showClose && /* @__PURE__ */ jsx42(Button, { variant: "plain", type: "button", onClick: onClose, children: "Close" })
4161
+ ) })
4080
4162
  ] });
4081
4163
  }
4082
4164
  var HeaderContainer2 = styled27("div")`
@@ -4089,6 +4171,42 @@ var HeaderContainer2 = styled27("div")`
4089
4171
  var Form = styled27("form")`
4090
4172
  width: 24rem;
4091
4173
  `;
4174
+ var TabBar = styled27("div")`
4175
+ display: flex;
4176
+ gap: 0.25rem;
4177
+ background-color: var(--j-foreground);
4178
+ border-radius: var(--j-radius-lg);
4179
+ padding: 0.25rem;
4180
+ `;
4181
+ var Tab = styled27("button")`
4182
+ padding: 0.375rem 0.75rem;
4183
+ border: none;
4184
+ border-radius: var(--j-radius-md);
4185
+ font-size: 0.875rem;
4186
+ font-weight: 500;
4187
+ cursor: pointer;
4188
+ transition: all 0.15s ease;
4189
+
4190
+ ${(props) => props.active ? `
4191
+ background-color: white;
4192
+ color: var(--j-text-color-strong);
4193
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
4194
+
4195
+ @media (prefers-color-scheme: dark) {
4196
+ background-color: var(--j-neutral-800);
4197
+ }
4198
+ ` : `
4199
+ background-color: transparent;
4200
+ color: var(--j-neutral-500);
4201
+
4202
+ &:hover {
4203
+ color: var(--j-text-color-strong);
4204
+ }
4205
+ `}
4206
+ `;
4207
+ var Spacer = styled27("div")`
4208
+ flex: 1;
4209
+ `;
4092
4210
 
4093
4211
  export {
4094
4212
  Button,
@@ -4096,13 +4214,15 @@ export {
4096
4214
  Icon,
4097
4215
  Modal,
4098
4216
  Input,
4217
+ useRouter,
4099
4218
  NodeContext,
4100
4219
  NodeProvider,
4101
4220
  useNode,
4102
4221
  InMemoryRouterProvider,
4103
4222
  HashRouterProvider,
4223
+ HomePage,
4104
4224
  PageStack,
4105
4225
  GlobalStyles,
4106
4226
  Header
4107
4227
  };
4108
- //# sourceMappingURL=chunk-MCTB5ZJC.js.map
4228
+ //# sourceMappingURL=chunk-6JPVMI3V.js.map