jazz-tools 0.18.5 → 0.18.7
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 +57 -57
- package/CHANGELOG.md +33 -0
- package/dist/better-auth/auth/client.d.ts.map +1 -1
- package/dist/better-auth/auth/client.js +7 -1
- package/dist/better-auth/auth/client.js.map +1 -1
- package/dist/better-auth/auth/react.d.ts +0 -2145
- package/dist/better-auth/auth/react.d.ts.map +1 -1
- package/dist/better-auth/auth/react.js +2 -14
- package/dist/better-auth/auth/react.js.map +1 -1
- package/dist/better-auth/auth/server.d.ts.map +1 -1
- package/dist/better-auth/auth/server.js +77 -22
- package/dist/better-auth/auth/server.js.map +1 -1
- package/dist/better-auth/auth/tests/react.test.d.ts +2 -0
- package/dist/better-auth/auth/tests/react.test.d.ts.map +1 -0
- package/dist/{chunk-3LE7N6TH.js → chunk-CFAY3FMQ.js} +192 -101
- package/dist/chunk-CFAY3FMQ.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/inspector/{custom-element-WCY6D3QJ.js → custom-element-G6SPZEBR.js} +308 -97
- package/dist/inspector/custom-element-G6SPZEBR.js.map +1 -0
- package/dist/inspector/index.d.ts +5 -1
- package/dist/inspector/index.d.ts.map +1 -1
- package/dist/inspector/index.js +318 -56
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/register-custom-element.js +1 -1
- package/dist/inspector/ui/button.d.ts +1 -1
- package/dist/inspector/ui/button.d.ts.map +1 -1
- package/dist/inspector/ui/heading.d.ts +2 -1
- package/dist/inspector/ui/heading.d.ts.map +1 -1
- package/dist/inspector/ui/input.d.ts.map +1 -1
- package/dist/inspector/ui/modal.d.ts +16 -0
- package/dist/inspector/ui/modal.d.ts.map +1 -0
- package/dist/inspector/viewer/delete-local-data.d.ts +2 -0
- package/dist/inspector/viewer/delete-local-data.d.ts.map +1 -0
- package/dist/inspector/viewer/{inpsector-button.d.ts → inspector-button.d.ts} +1 -1
- package/dist/inspector/viewer/{inpsector-button.d.ts.map → inspector-button.d.ts.map} +1 -1
- package/dist/inspector/viewer/new-app.d.ts +1 -4
- package/dist/inspector/viewer/new-app.d.ts.map +1 -1
- package/dist/react/hooks.d.ts +1 -1
- package/dist/react/hooks.d.ts.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +3 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react-core/hooks.d.ts +133 -0
- package/dist/react-core/hooks.d.ts.map +1 -1
- package/dist/react-core/index.js +83 -17
- package/dist/react-core/index.js.map +1 -1
- package/dist/react-core/tests/useCoStateWithSelector.test.d.ts +2 -0
- package/dist/react-core/tests/useCoStateWithSelector.test.d.ts.map +1 -0
- package/dist/react-native-core/hooks.d.ts +1 -1
- package/dist/react-native-core/hooks.d.ts.map +1 -1
- package/dist/react-native-core/index.js +3 -1
- package/dist/react-native-core/index.js.map +1 -1
- package/dist/testing.js +2 -2
- package/dist/testing.js.map +1 -1
- package/dist/tools/coValues/CoValueBase.d.ts +14 -0
- package/dist/tools/coValues/CoValueBase.d.ts.map +1 -1
- package/dist/tools/coValues/coMap.d.ts +0 -12
- package/dist/tools/coValues/coMap.d.ts.map +1 -1
- package/dist/tools/coValues/inbox.d.ts +5 -5
- package/dist/tools/coValues/inbox.d.ts.map +1 -1
- package/dist/tools/implementation/createContext.d.ts +2 -1
- package/dist/tools/implementation/createContext.d.ts.map +1 -1
- package/dist/tools/tests/utils.d.ts.map +1 -1
- package/dist/worker/index.d.ts +12 -2
- package/dist/worker/index.d.ts.map +1 -1
- package/dist/worker/index.js +10 -4
- package/dist/worker/index.js.map +1 -1
- package/package.json +6 -4
- package/src/better-auth/auth/client.ts +8 -2
- package/src/better-auth/auth/react.tsx +2 -51
- package/src/better-auth/auth/server.ts +98 -24
- package/src/better-auth/auth/tests/client.test.ts +92 -4
- package/src/better-auth/auth/tests/react.test.tsx +43 -0
- package/src/better-auth/auth/tests/server.test.ts +276 -98
- package/src/inspector/custom-element.tsx +1 -1
- package/src/inspector/index.tsx +44 -0
- package/src/inspector/ui/button.tsx +15 -1
- package/src/inspector/ui/heading.tsx +7 -2
- package/src/inspector/ui/input.tsx +6 -2
- package/src/inspector/ui/modal.tsx +158 -0
- package/src/inspector/viewer/delete-local-data.tsx +101 -0
- package/src/inspector/viewer/new-app.tsx +3 -19
- package/src/react/hooks.tsx +1 -0
- package/src/react/index.ts +1 -0
- package/src/react-core/hooks.ts +162 -0
- package/src/react-core/tests/useCoStateWithSelector.test.ts +149 -0
- package/src/react-native-core/hooks.tsx +1 -0
- package/src/tools/coValues/CoValueBase.ts +32 -0
- package/src/tools/coValues/coList.ts +35 -0
- package/src/tools/coValues/coMap.ts +0 -18
- package/src/tools/coValues/inbox.ts +190 -108
- package/src/tools/implementation/createContext.ts +9 -2
- package/src/tools/testing.ts +1 -1
- package/src/tools/tests/coFeed.test.ts +33 -22
- package/src/tools/tests/coList.test.ts +47 -4
- package/src/tools/tests/coMap.test.ts +13 -5
- package/src/tools/tests/coPlainText.test.ts +24 -0
- package/src/tools/tests/createContext.test.ts +24 -0
- package/src/tools/tests/deepLoading.test.ts +2 -0
- package/src/tools/tests/exportImport.test.ts +3 -1
- package/src/tools/tests/groupsAndAccounts.test.ts +56 -44
- package/src/tools/tests/inbox.test.ts +293 -31
- package/src/tools/tests/patterns/requestToJoin.test.ts +14 -6
- package/src/tools/tests/utils.ts +1 -0
- package/src/worker/index.ts +21 -5
- package/tsup.config.ts +1 -1
- package/dist/chunk-3LE7N6TH.js.map +0 -1
- package/dist/inspector/custom-element-WCY6D3QJ.js.map +0 -1
- package/src/inspector/index.ts +0 -23
- /package/src/inspector/viewer/{inpsector-button.tsx → inspector-button.tsx} +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
export {
|
1
|
+
export { JazzInspectorInternal } from "./viewer/new-app.js";
|
2
2
|
export { PageStack } from "./viewer/page-stack.js";
|
3
3
|
export { Breadcrumbs } from "./viewer/breadcrumbs.js";
|
4
4
|
export { AccountOrGroupText } from "./viewer/account-or-group-text.js";
|
@@ -9,4 +9,8 @@ export { Icon } from "./ui/icon.js";
|
|
9
9
|
export { GlobalStyles } from "./ui/global-styles.js";
|
10
10
|
export { resolveCoValue, useResolvedCoValue, } from "./viewer/use-resolve-covalue.js";
|
11
11
|
export type { PageInfo } from "./viewer/types.js";
|
12
|
+
import { Position } from "./viewer/inspector-button.js";
|
13
|
+
export declare function JazzInspector({ position }: {
|
14
|
+
position?: Position;
|
15
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
12
16
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/inspector/index.
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/inspector/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EACL,cAAc,EACd,kBAAkB,GACnB,MAAM,iCAAiC,CAAC;AAEzC,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAOlD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,wBAAgB,aAAa,CAAC,EAAE,QAAkB,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,kDAc5E"}
|
package/dist/inspector/index.js
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
"use client";
|
2
2
|
|
3
|
-
// src/inspector/index.
|
3
|
+
// src/inspector/index.tsx
|
4
4
|
import React7 from "react";
|
5
5
|
|
6
6
|
// src/inspector/viewer/new-app.tsx
|
7
|
-
import { styled as
|
8
|
-
import {
|
9
|
-
import { useState as useState9 } from "react";
|
7
|
+
import { styled as styled19 } from "goober";
|
8
|
+
import { useState as useState10 } from "react";
|
10
9
|
|
11
10
|
// src/inspector/ui/button.tsx
|
12
11
|
import { styled } from "goober";
|
@@ -33,6 +32,9 @@ var StyledButton = styled("button")`
|
|
33
32
|
border-color: var(--j-primary-color);
|
34
33
|
color: white;
|
35
34
|
font-weight: 500;
|
35
|
+
&:hover {
|
36
|
+
opacity: 0.8;
|
37
|
+
}
|
36
38
|
`;
|
37
39
|
case "secondary":
|
38
40
|
return `
|
@@ -51,6 +53,17 @@ var StyledButton = styled("button")`
|
|
51
53
|
text-decoration: underline;
|
52
54
|
}
|
53
55
|
`;
|
56
|
+
case "destructive":
|
57
|
+
return `
|
58
|
+
padding: 0.375rem 0.75rem;
|
59
|
+
background-color: var(--j-destructive-color);
|
60
|
+
border-color: var(--j-destructive-color);
|
61
|
+
color: white;
|
62
|
+
font-weight: 500;
|
63
|
+
&:hover {
|
64
|
+
opacity: 0.8;
|
65
|
+
}
|
66
|
+
`;
|
54
67
|
default:
|
55
68
|
return "";
|
56
69
|
}
|
@@ -96,7 +109,7 @@ var StyledInput = styled2("input")`
|
|
96
109
|
box-shadow: var(--j-shadow-sm);
|
97
110
|
font-weight: 500;
|
98
111
|
background-color: white;
|
99
|
-
color: var(--text-color-strong);
|
112
|
+
color: var(--j-text-color-strong);
|
100
113
|
|
101
114
|
@media (prefers-color-scheme: dark) {
|
102
115
|
background-color: var(--j-foreground);
|
@@ -107,7 +120,15 @@ var Input = forwardRef2(
|
|
107
120
|
const generatedId = useId();
|
108
121
|
const id = customId || generatedId;
|
109
122
|
return /* @__PURE__ */ jsxs(Container, { className, children: [
|
110
|
-
/* @__PURE__ */ jsx2(
|
123
|
+
/* @__PURE__ */ jsx2(
|
124
|
+
"label",
|
125
|
+
{
|
126
|
+
htmlFor: id,
|
127
|
+
className: hideLabel ? "j-sr-only" : "",
|
128
|
+
style: { color: "var(--j-text-color)" },
|
129
|
+
children: label
|
130
|
+
}
|
131
|
+
),
|
111
132
|
/* @__PURE__ */ jsx2(StyledInput, { ref, ...inputProps, id })
|
112
133
|
] });
|
113
134
|
}
|
@@ -197,9 +218,10 @@ var StyledHeading = styled5("h1")`
|
|
197
218
|
`;
|
198
219
|
function Heading({
|
199
220
|
children,
|
200
|
-
className
|
221
|
+
className,
|
222
|
+
id
|
201
223
|
}) {
|
202
|
-
return /* @__PURE__ */ jsx5(StyledHeading, { className, children });
|
224
|
+
return /* @__PURE__ */ jsx5(StyledHeading, { className, id, children });
|
203
225
|
}
|
204
226
|
|
205
227
|
// src/inspector/ui/text.tsx
|
@@ -1798,7 +1820,7 @@ var GlobalStyles = styled16("div")`
|
|
1798
1820
|
}
|
1799
1821
|
`;
|
1800
1822
|
|
1801
|
-
// src/inspector/viewer/
|
1823
|
+
// src/inspector/viewer/inspector-button.tsx
|
1802
1824
|
import { styled as styled17 } from "goober";
|
1803
1825
|
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
1804
1826
|
var StyledInspectorButton = styled17("button")`
|
@@ -1897,9 +1919,246 @@ function useOpenInspector() {
|
|
1897
1919
|
return [open, setOpen];
|
1898
1920
|
}
|
1899
1921
|
|
1922
|
+
// src/inspector/ui/modal.tsx
|
1923
|
+
import { styled as styled18 } from "goober";
|
1924
|
+
import { forwardRef as forwardRef3, useEffect as useEffect7, useRef } from "react";
|
1925
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
1926
|
+
var ModalContent = styled18("dialog")`
|
1927
|
+
background-color: var(--j-background);
|
1928
|
+
border-radius: var(--j-radius-lg);
|
1929
|
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
1930
|
+
border: 1px solid var(--j-border-color);
|
1931
|
+
max-width: 32rem;
|
1932
|
+
margin-block: auto;
|
1933
|
+
margin-inline: auto;
|
1934
|
+
&::backdrop {
|
1935
|
+
background-color: rgba(0, 0, 0, 0.7);
|
1936
|
+
}
|
1937
|
+
|
1938
|
+
`;
|
1939
|
+
var ModalHeader = styled18("div")`
|
1940
|
+
display: flex;
|
1941
|
+
justify-content: space-between;
|
1942
|
+
align-items: flex-start;
|
1943
|
+
padding: 1.5rem 1.5rem 0 1.5rem;
|
1944
|
+
gap: 1rem;
|
1945
|
+
`;
|
1946
|
+
var ModalBody = styled18("div")`
|
1947
|
+
padding: 1rem 1.5rem;
|
1948
|
+
flex: 1;
|
1949
|
+
`;
|
1950
|
+
var ModalFooter = styled18("div")`
|
1951
|
+
display: flex;
|
1952
|
+
justify-content: flex-end;
|
1953
|
+
gap: 0.75rem;
|
1954
|
+
padding: 0 1.5rem 1.5rem 1.5rem;
|
1955
|
+
`;
|
1956
|
+
var CloseButton = styled18("button")`
|
1957
|
+
background: none;
|
1958
|
+
border: none;
|
1959
|
+
cursor: pointer;
|
1960
|
+
padding: 0.25rem;
|
1961
|
+
border-radius: var(--j-radius-sm);
|
1962
|
+
color: var(--j-text-color);
|
1963
|
+
font-size: 1.25rem;
|
1964
|
+
line-height: 1;
|
1965
|
+
display: flex;
|
1966
|
+
align-items: center;
|
1967
|
+
justify-content: center;
|
1968
|
+
min-width: 2rem;
|
1969
|
+
min-height: 2rem;
|
1970
|
+
|
1971
|
+
&:hover {
|
1972
|
+
background-color: var(--j-foreground);
|
1973
|
+
}
|
1974
|
+
|
1975
|
+
&:focus-visible {
|
1976
|
+
outline: 2px solid var(--j-border-focus);
|
1977
|
+
outline-offset: 2px;
|
1978
|
+
}
|
1979
|
+
`;
|
1980
|
+
var Modal = forwardRef3(
|
1981
|
+
({
|
1982
|
+
isOpen,
|
1983
|
+
onClose,
|
1984
|
+
heading,
|
1985
|
+
text,
|
1986
|
+
children,
|
1987
|
+
confirmText = "Confirm",
|
1988
|
+
cancelText = "Cancel",
|
1989
|
+
onConfirm,
|
1990
|
+
onCancel,
|
1991
|
+
showButtons = true,
|
1992
|
+
className
|
1993
|
+
}, ref) => {
|
1994
|
+
const modalRef = useRef(null);
|
1995
|
+
useEffect7(() => {
|
1996
|
+
if (isOpen) {
|
1997
|
+
modalRef.current?.showModal();
|
1998
|
+
} else {
|
1999
|
+
onClose();
|
2000
|
+
modalRef.current?.close();
|
2001
|
+
}
|
2002
|
+
}, [isOpen, onClose]);
|
2003
|
+
const handleConfirm = () => {
|
2004
|
+
onConfirm?.();
|
2005
|
+
onClose();
|
2006
|
+
};
|
2007
|
+
const handleCancel = () => {
|
2008
|
+
onCancel?.();
|
2009
|
+
onClose();
|
2010
|
+
};
|
2011
|
+
if (!isOpen) return null;
|
2012
|
+
return /* @__PURE__ */ jsxs16(
|
2013
|
+
ModalContent,
|
2014
|
+
{
|
2015
|
+
ref: ref || modalRef,
|
2016
|
+
className,
|
2017
|
+
role: "dialog",
|
2018
|
+
"aria-labelledby": "modal-heading",
|
2019
|
+
onClose,
|
2020
|
+
children: [
|
2021
|
+
/* @__PURE__ */ jsxs16(ModalHeader, { children: [
|
2022
|
+
/* @__PURE__ */ jsx26(Heading, { id: "modal-heading", children: heading }),
|
2023
|
+
/* @__PURE__ */ jsx26(CloseButton, { onClick: onClose, "aria-label": "Close modal", type: "button", children: "\xD7" })
|
2024
|
+
] }),
|
2025
|
+
/* @__PURE__ */ jsxs16(ModalBody, { children: [
|
2026
|
+
text && /* @__PURE__ */ jsx26("p", { style: { margin: "0 0 1rem 0", color: "var(--j-text-color)" }, children: text }),
|
2027
|
+
children
|
2028
|
+
] }),
|
2029
|
+
showButtons && /* @__PURE__ */ jsxs16(ModalFooter, { children: [
|
2030
|
+
/* @__PURE__ */ jsx26(Button, { variant: "secondary", onClick: handleCancel, children: cancelText }),
|
2031
|
+
/* @__PURE__ */ jsx26(Button, { variant: "primary", onClick: handleConfirm, children: confirmText })
|
2032
|
+
] })
|
2033
|
+
]
|
2034
|
+
}
|
2035
|
+
);
|
2036
|
+
}
|
2037
|
+
);
|
2038
|
+
Modal.displayName = "Modal";
|
2039
|
+
|
2040
|
+
// src/inspector/viewer/delete-local-data.tsx
|
2041
|
+
import { useState as useState9 } from "react";
|
2042
|
+
import { Fragment as Fragment11, jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
2043
|
+
var DELETE_LOCAL_DATA_STRING = "delete my local data";
|
2044
|
+
function DeleteLocalData() {
|
2045
|
+
const [showDeleteModal, setShowDeleteModal] = useState9(false);
|
2046
|
+
const [confirmDeleteString, setConfirmDeleteString] = useState9("");
|
2047
|
+
return /* @__PURE__ */ jsxs17(Fragment11, { children: [
|
2048
|
+
/* @__PURE__ */ jsx27(Button, { variant: "destructive", onClick: () => setShowDeleteModal(true), children: "Delete my local data" }),
|
2049
|
+
/* @__PURE__ */ jsxs17(
|
2050
|
+
Modal,
|
2051
|
+
{
|
2052
|
+
isOpen: showDeleteModal,
|
2053
|
+
onClose: () => setShowDeleteModal(false),
|
2054
|
+
heading: "Delete Local Data",
|
2055
|
+
showButtons: false,
|
2056
|
+
children: [
|
2057
|
+
/* @__PURE__ */ jsxs17(
|
2058
|
+
"div",
|
2059
|
+
{
|
2060
|
+
style: {
|
2061
|
+
margin: "0 0 1rem 0",
|
2062
|
+
color: "var(--j-text-color)",
|
2063
|
+
display: "flex",
|
2064
|
+
flexDirection: "column",
|
2065
|
+
gap: "0.5rem"
|
2066
|
+
},
|
2067
|
+
children: [
|
2068
|
+
/* @__PURE__ */ jsxs17("p", { children: [
|
2069
|
+
"This action ",
|
2070
|
+
/* @__PURE__ */ jsx27("strong", { children: "cannot" }),
|
2071
|
+
" be undone."
|
2072
|
+
] }),
|
2073
|
+
/* @__PURE__ */ jsxs17("p", { children: [
|
2074
|
+
"Be aware that the following data will be",
|
2075
|
+
" ",
|
2076
|
+
/* @__PURE__ */ jsx27("strong", { children: "permanently" }),
|
2077
|
+
" deleted:"
|
2078
|
+
] }),
|
2079
|
+
/* @__PURE__ */ jsxs17("ul", { style: { listStyleType: "disc", paddingLeft: "1rem" }, children: [
|
2080
|
+
/* @__PURE__ */ jsxs17("li", { children: [
|
2081
|
+
"Unsynced data for ",
|
2082
|
+
/* @__PURE__ */ jsx27("strong", { children: "all apps" }),
|
2083
|
+
" on",
|
2084
|
+
" ",
|
2085
|
+
/* @__PURE__ */ jsx27("code", { children: window.location.origin })
|
2086
|
+
] }),
|
2087
|
+
/* @__PURE__ */ jsx27("li", { children: "Accounts" }),
|
2088
|
+
/* @__PURE__ */ jsx27("li", { children: "Logged in sessions" })
|
2089
|
+
] }),
|
2090
|
+
/* @__PURE__ */ jsx27("p", {})
|
2091
|
+
]
|
2092
|
+
}
|
2093
|
+
),
|
2094
|
+
/* @__PURE__ */ jsx27(
|
2095
|
+
Input,
|
2096
|
+
{
|
2097
|
+
label: `Type "${DELETE_LOCAL_DATA_STRING}" to confirm`,
|
2098
|
+
placeholder: DELETE_LOCAL_DATA_STRING,
|
2099
|
+
value: confirmDeleteString,
|
2100
|
+
onChange: (e) => {
|
2101
|
+
setConfirmDeleteString(e.target.value);
|
2102
|
+
}
|
2103
|
+
}
|
2104
|
+
),
|
2105
|
+
/* @__PURE__ */ jsx27(
|
2106
|
+
"p",
|
2107
|
+
{
|
2108
|
+
style: {
|
2109
|
+
margin: "0 0 1rem 0",
|
2110
|
+
color: "var(--j-text-color)",
|
2111
|
+
display: "flex",
|
2112
|
+
flexDirection: "column",
|
2113
|
+
gap: "0.5rem"
|
2114
|
+
},
|
2115
|
+
children: /* @__PURE__ */ jsxs17("small", { children: [
|
2116
|
+
"Data synced to a sync server will ",
|
2117
|
+
/* @__PURE__ */ jsx27("strong", { children: "not" }),
|
2118
|
+
" be deleted, and will be synced when you log in again."
|
2119
|
+
] })
|
2120
|
+
}
|
2121
|
+
),
|
2122
|
+
/* @__PURE__ */ jsxs17(
|
2123
|
+
"div",
|
2124
|
+
{
|
2125
|
+
style: {
|
2126
|
+
display: "flex",
|
2127
|
+
marginTop: "0.5rem",
|
2128
|
+
justifyContent: "flex-end",
|
2129
|
+
gap: "0.5rem"
|
2130
|
+
},
|
2131
|
+
children: [
|
2132
|
+
/* @__PURE__ */ jsx27(Button, { variant: "secondary", onClick: () => setShowDeleteModal(false), children: "Cancel" }),
|
2133
|
+
/* @__PURE__ */ jsx27(
|
2134
|
+
Button,
|
2135
|
+
{
|
2136
|
+
variant: "destructive",
|
2137
|
+
disabled: confirmDeleteString !== DELETE_LOCAL_DATA_STRING,
|
2138
|
+
onClick: () => {
|
2139
|
+
const jazzKeys = Object.keys(localStorage).filter(
|
2140
|
+
(key) => key.startsWith("jazz-") || key.startsWith("co_z")
|
2141
|
+
);
|
2142
|
+
jazzKeys.forEach((key) => localStorage.removeItem(key));
|
2143
|
+
indexedDB.deleteDatabase("jazz-storage");
|
2144
|
+
window.location.reload();
|
2145
|
+
setShowDeleteModal(false);
|
2146
|
+
},
|
2147
|
+
children: "I'm sure, delete my local data"
|
2148
|
+
}
|
2149
|
+
)
|
2150
|
+
]
|
2151
|
+
}
|
2152
|
+
)
|
2153
|
+
]
|
2154
|
+
}
|
2155
|
+
)
|
2156
|
+
] });
|
2157
|
+
}
|
2158
|
+
|
1900
2159
|
// src/inspector/viewer/new-app.tsx
|
1901
|
-
import { Fragment as
|
1902
|
-
var InspectorContainer =
|
2160
|
+
import { Fragment as Fragment12, jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
2161
|
+
var InspectorContainer = styled19("div")`
|
1903
2162
|
position: fixed;
|
1904
2163
|
height: 50vh;
|
1905
2164
|
max-height: 800px;
|
@@ -1916,17 +2175,17 @@ var InspectorContainer = styled18("div")`
|
|
1916
2175
|
background-color: var(--j-background);
|
1917
2176
|
}
|
1918
2177
|
`;
|
1919
|
-
var HeaderContainer2 =
|
2178
|
+
var HeaderContainer2 = styled19("div")`
|
1920
2179
|
display: flex;
|
1921
2180
|
align-items: center;
|
1922
2181
|
gap: 1rem;
|
1923
2182
|
padding: 0 0.75rem;
|
1924
2183
|
margin: 0.75rem 0;
|
1925
2184
|
`;
|
1926
|
-
var Form =
|
2185
|
+
var Form = styled19("form")`
|
1927
2186
|
width: 24rem;
|
1928
2187
|
`;
|
1929
|
-
var InitialForm =
|
2188
|
+
var InitialForm = styled19("form")`
|
1930
2189
|
display: flex;
|
1931
2190
|
flex-direction: column;
|
1932
2191
|
position: relative;
|
@@ -1938,30 +2197,16 @@ var InitialForm = styled18("form")`
|
|
1938
2197
|
max-width: 24rem;
|
1939
2198
|
margin: 0 auto;
|
1940
2199
|
`;
|
1941
|
-
var OrText =
|
2200
|
+
var OrText = styled19("p")`
|
1942
2201
|
text-align: center;
|
1943
2202
|
`;
|
1944
|
-
function JazzInspector({ position = "right" }) {
|
1945
|
-
const context = useJazzContext();
|
1946
|
-
const localNode = context.node;
|
1947
|
-
const me = "me" in context ? context.me : void 0;
|
1948
|
-
if (process.env.NODE_ENV !== "development") return null;
|
1949
|
-
return /* @__PURE__ */ jsx26(
|
1950
|
-
JazzInspectorInternal,
|
1951
|
-
{
|
1952
|
-
position,
|
1953
|
-
localNode,
|
1954
|
-
accountId: me?.$jazz.raw.id
|
1955
|
-
}
|
1956
|
-
);
|
1957
|
-
}
|
1958
2203
|
function JazzInspectorInternal({
|
1959
2204
|
position = "right",
|
1960
2205
|
localNode,
|
1961
2206
|
accountId
|
1962
2207
|
}) {
|
1963
2208
|
const [open, setOpen] = useOpenInspector();
|
1964
|
-
const [coValueId, setCoValueId] =
|
2209
|
+
const [coValueId, setCoValueId] = useState10("");
|
1965
2210
|
const { path, addPages, goToIndex, goBack, setPage } = usePagePath();
|
1966
2211
|
const handleCoValueIdSubmit = (e) => {
|
1967
2212
|
e.preventDefault();
|
@@ -1971,12 +2216,12 @@ function JazzInspectorInternal({
|
|
1971
2216
|
setCoValueId("");
|
1972
2217
|
};
|
1973
2218
|
if (!open) {
|
1974
|
-
return /* @__PURE__ */
|
2219
|
+
return /* @__PURE__ */ jsx28(InspectorButton, { position, onClick: () => setOpen(true) });
|
1975
2220
|
}
|
1976
|
-
return /* @__PURE__ */
|
1977
|
-
/* @__PURE__ */
|
1978
|
-
/* @__PURE__ */
|
1979
|
-
/* @__PURE__ */
|
2221
|
+
return /* @__PURE__ */ jsxs18(InspectorContainer, { as: GlobalStyles, style: { zIndex: 999 }, children: [
|
2222
|
+
/* @__PURE__ */ jsxs18(HeaderContainer2, { children: [
|
2223
|
+
/* @__PURE__ */ jsx28(Breadcrumbs, { path, onBreadcrumbClick: goToIndex }),
|
2224
|
+
/* @__PURE__ */ jsx28(Form, { onSubmit: handleCoValueIdSubmit, children: path.length !== 0 && /* @__PURE__ */ jsx28(
|
1980
2225
|
Input,
|
1981
2226
|
{
|
1982
2227
|
label: "CoValue ID",
|
@@ -1987,23 +2232,24 @@ function JazzInspectorInternal({
|
|
1987
2232
|
onChange: (e) => setCoValueId(e.target.value)
|
1988
2233
|
}
|
1989
2234
|
) }),
|
1990
|
-
/* @__PURE__ */
|
2235
|
+
/* @__PURE__ */ jsx28(DeleteLocalData, {}),
|
2236
|
+
/* @__PURE__ */ jsx28(Button, { variant: "plain", type: "button", onClick: () => setOpen(false), children: "Close" })
|
1991
2237
|
] }),
|
1992
|
-
/* @__PURE__ */
|
2238
|
+
/* @__PURE__ */ jsx28(
|
1993
2239
|
PageStack,
|
1994
2240
|
{
|
1995
2241
|
path,
|
1996
2242
|
node: localNode,
|
1997
2243
|
goBack,
|
1998
2244
|
addPages,
|
1999
|
-
children: path.length <= 0 && /* @__PURE__ */
|
2245
|
+
children: path.length <= 0 && /* @__PURE__ */ jsxs18(
|
2000
2246
|
InitialForm,
|
2001
2247
|
{
|
2002
2248
|
onSubmit: handleCoValueIdSubmit,
|
2003
2249
|
"aria-hidden": path.length !== 0,
|
2004
2250
|
children: [
|
2005
|
-
/* @__PURE__ */
|
2006
|
-
/* @__PURE__ */
|
2251
|
+
/* @__PURE__ */ jsx28(Heading, { children: "Jazz CoValue Inspector" }),
|
2252
|
+
/* @__PURE__ */ jsx28(
|
2007
2253
|
Input,
|
2008
2254
|
{
|
2009
2255
|
label: "CoValue ID",
|
@@ -2014,10 +2260,10 @@ function JazzInspectorInternal({
|
|
2014
2260
|
onChange: (e) => setCoValueId(e.target.value)
|
2015
2261
|
}
|
2016
2262
|
),
|
2017
|
-
/* @__PURE__ */
|
2018
|
-
accountId && /* @__PURE__ */
|
2019
|
-
/* @__PURE__ */
|
2020
|
-
/* @__PURE__ */
|
2263
|
+
/* @__PURE__ */ jsx28(Button, { type: "submit", variant: "primary", children: "Inspect CoValue" }),
|
2264
|
+
accountId && /* @__PURE__ */ jsxs18(Fragment12, { children: [
|
2265
|
+
/* @__PURE__ */ jsx28(OrText, { children: "or" }),
|
2266
|
+
/* @__PURE__ */ jsx28(
|
2021
2267
|
Button,
|
2022
2268
|
{
|
2023
2269
|
variant: "secondary",
|
@@ -2038,19 +2284,19 @@ function JazzInspectorInternal({
|
|
2038
2284
|
}
|
2039
2285
|
|
2040
2286
|
// src/inspector/ui/select.tsx
|
2041
|
-
import { styled as
|
2287
|
+
import { styled as styled20 } from "goober";
|
2042
2288
|
import { useId as useId2 } from "react";
|
2043
|
-
import { jsx as
|
2044
|
-
var SelectContainer =
|
2289
|
+
import { jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
|
2290
|
+
var SelectContainer = styled20("div")`
|
2045
2291
|
display: grid;
|
2046
2292
|
gap: 0.25rem;
|
2047
2293
|
`;
|
2048
|
-
var SelectWrapper =
|
2294
|
+
var SelectWrapper = styled20("div")`
|
2049
2295
|
position: relative;
|
2050
2296
|
display: flex;
|
2051
2297
|
align-items: center;
|
2052
2298
|
`;
|
2053
|
-
var StyledSelect =
|
2299
|
+
var StyledSelect = styled20("select")`
|
2054
2300
|
width: 100%;
|
2055
2301
|
border-radius: var(--j-radius-md);
|
2056
2302
|
border: 1px solid var(--j-border-color);
|
@@ -2068,7 +2314,7 @@ var StyledSelect = styled19("select")`
|
|
2068
2314
|
background-color: var(--j-foreground);
|
2069
2315
|
}
|
2070
2316
|
`;
|
2071
|
-
var SelectIcon =
|
2317
|
+
var SelectIcon = styled20("span")`
|
2072
2318
|
position: absolute;
|
2073
2319
|
right: 0.5em;
|
2074
2320
|
color: var(--j-neutral-400);
|
@@ -2082,17 +2328,33 @@ function Select(props) {
|
|
2082
2328
|
const { label, hideLabel, id: customId, className, ...selectProps } = props;
|
2083
2329
|
const generatedId = useId2();
|
2084
2330
|
const id = customId || generatedId;
|
2085
|
-
return /* @__PURE__ */
|
2086
|
-
/* @__PURE__ */
|
2087
|
-
/* @__PURE__ */
|
2088
|
-
/* @__PURE__ */
|
2089
|
-
/* @__PURE__ */
|
2331
|
+
return /* @__PURE__ */ jsxs19(SelectContainer, { className, children: [
|
2332
|
+
/* @__PURE__ */ jsx29("label", { htmlFor: id, className: hideLabel ? "j-sr-only" : "", children: label }),
|
2333
|
+
/* @__PURE__ */ jsxs19(SelectWrapper, { children: [
|
2334
|
+
/* @__PURE__ */ jsx29(StyledSelect, { ...selectProps, id, children: props.children }),
|
2335
|
+
/* @__PURE__ */ jsx29(SelectIcon, { children: /* @__PURE__ */ jsx29(Icon, { name: "chevronDown", size: "sm" }) })
|
2090
2336
|
] })
|
2091
2337
|
] });
|
2092
2338
|
}
|
2093
2339
|
|
2094
|
-
// src/inspector/index.
|
2340
|
+
// src/inspector/index.tsx
|
2095
2341
|
import { setup } from "goober";
|
2342
|
+
import { useJazzContext } from "jazz-tools/react-core";
|
2343
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
2344
|
+
function JazzInspector({ position = "right" }) {
|
2345
|
+
const context = useJazzContext();
|
2346
|
+
const localNode = context.node;
|
2347
|
+
const me = "me" in context ? context.me : void 0;
|
2348
|
+
if (process.env.NODE_ENV !== "development") return null;
|
2349
|
+
return /* @__PURE__ */ jsx30(
|
2350
|
+
JazzInspectorInternal,
|
2351
|
+
{
|
2352
|
+
position,
|
2353
|
+
localNode,
|
2354
|
+
accountId: me?.$jazz.raw.id
|
2355
|
+
}
|
2356
|
+
);
|
2357
|
+
}
|
2096
2358
|
setup(React7.createElement);
|
2097
2359
|
export {
|
2098
2360
|
AccountOrGroupText,
|