jazz-tools 0.18.29 → 0.18.31
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/.svelte-kit/__package__/media/image.svelte +7 -4
- package/.svelte-kit/__package__/media/image.svelte.d.ts.map +1 -1
- package/.svelte-kit/__package__/media/image.types.d.ts +1 -0
- package/.svelte-kit/__package__/media/image.types.d.ts.map +1 -1
- package/.svelte-kit/__package__/tests/media/image.svelte.test.js +63 -0
- package/.turbo/turbo-build.log +60 -60
- package/CHANGELOG.md +26 -0
- package/dist/better-auth/auth/client.d.ts +1 -1
- package/dist/better-auth/auth/server.d.ts +1 -1
- package/dist/better-auth/auth/server.d.ts.map +1 -1
- package/dist/better-auth/auth/server.js.map +1 -1
- package/dist/better-auth/database-adapter/index.d.ts +3 -3
- package/dist/better-auth/database-adapter/index.d.ts.map +1 -1
- package/dist/better-auth/database-adapter/index.js +6 -2
- package/dist/better-auth/database-adapter/index.js.map +1 -1
- package/dist/better-auth/database-adapter/utils.d.ts.map +1 -1
- package/dist/browser/index.d.ts +2 -1
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/{chunk-F55R554M.js → chunk-6BIYT3KH.js} +51 -30
- package/dist/chunk-6BIYT3KH.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inspector/{custom-element-35MDW4SW.js → custom-element-RQTLPAPJ.js} +584 -298
- package/dist/inspector/custom-element-RQTLPAPJ.js.map +1 -0
- package/dist/inspector/index.js +570 -338
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/register-custom-element.js +1 -1
- package/dist/inspector/ui/index.d.ts +6 -0
- package/dist/inspector/ui/index.d.ts.map +1 -0
- package/dist/inspector/viewer/group-view.d.ts +3 -2
- package/dist/inspector/viewer/group-view.d.ts.map +1 -1
- package/dist/inspector/viewer/page.d.ts.map +1 -1
- package/dist/react/index.js +2 -2
- package/dist/react/index.js.map +1 -1
- package/dist/react/media/image.d.ts +8 -0
- package/dist/react/media/image.d.ts.map +1 -1
- package/dist/react-native-core/index.js +3 -3
- package/dist/react-native-core/index.js.map +1 -1
- package/dist/react-native-core/media/image.d.ts +15 -0
- package/dist/react-native-core/media/image.d.ts.map +1 -1
- package/dist/svelte/media/image.svelte +7 -4
- package/dist/svelte/media/image.svelte.d.ts.map +1 -1
- package/dist/svelte/media/image.types.d.ts +1 -0
- package/dist/svelte/media/image.types.d.ts.map +1 -1
- package/dist/svelte/tests/media/image.svelte.test.js +63 -0
- package/dist/testing.js +8 -1
- package/dist/testing.js.map +1 -1
- package/dist/tools/coValues/account.d.ts +1 -0
- package/dist/tools/coValues/account.d.ts.map +1 -1
- package/dist/tools/coValues/group.d.ts +3 -3
- package/dist/tools/coValues/group.d.ts.map +1 -1
- package/dist/tools/implementation/invites.d.ts +2 -2
- package/dist/tools/implementation/invites.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/runtimeConverters/schemaFieldToCoFieldDef.d.ts +1 -1
- package/dist/tools/implementation/zodSchema/runtimeConverters/schemaFieldToCoFieldDef.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/typeConverters/TypeOfZodSchema.d.ts +3 -1
- package/dist/tools/implementation/zodSchema/typeConverters/TypeOfZodSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/zodCo.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/zodReExport.d.ts +1 -1
- package/dist/tools/implementation/zodSchema/zodReExport.d.ts.map +1 -1
- package/dist/tools/subscribe/CoValueCoreSubscription.d.ts.map +1 -1
- package/dist/tools/subscribe/SubscriptionScope.d.ts +0 -2
- package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
- package/dist/tools/testing.d.ts +1 -0
- package/dist/tools/testing.d.ts.map +1 -1
- package/dist/tools/tests/CoValueCoreSubscription.test.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/better-auth/auth/server.ts +7 -2
- package/src/better-auth/auth/tests/server.test.ts +39 -17
- package/src/better-auth/database-adapter/index.ts +8 -5
- package/src/better-auth/database-adapter/utils.ts +4 -0
- package/src/browser/index.ts +2 -1
- package/src/inspector/ui/index.ts +5 -0
- package/src/inspector/viewer/group-view.tsx +304 -20
- package/src/inspector/viewer/new-app.tsx +4 -4
- package/src/inspector/viewer/page.tsx +16 -2
- package/src/react/media/image.tsx +11 -2
- package/src/react/tests/media/image.test.tsx +94 -0
- package/src/react-native-core/media/image.tsx +11 -3
- package/src/svelte/media/image.svelte +7 -4
- package/src/svelte/media/image.types.ts +1 -0
- package/src/svelte/tests/media/image.svelte.test.ts +85 -0
- package/src/tools/coValues/account.ts +30 -5
- package/src/tools/coValues/group.ts +13 -12
- package/src/tools/coValues/inbox.ts +5 -5
- package/src/tools/implementation/invites.ts +3 -8
- package/src/tools/implementation/zodSchema/runtimeConverters/schemaFieldToCoFieldDef.ts +5 -1
- package/src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts +2 -0
- package/src/tools/implementation/zodSchema/typeConverters/TypeOfZodSchema.ts +63 -50
- package/src/tools/implementation/zodSchema/zodReExport.ts +2 -2
- package/src/tools/subscribe/CoValueCoreSubscription.ts +17 -0
- package/src/tools/subscribe/SubscriptionScope.ts +1 -27
- package/src/tools/testing.ts +7 -0
- package/src/tools/{subscribe → tests}/CoValueCoreSubscription.test.ts +233 -3
- package/src/tools/tests/coFeed.branch.test.ts +14 -5
- package/src/tools/tests/coMap.test.ts +139 -42
- package/src/tools/tests/coOptional.test.ts +9 -1
- package/src/tools/tests/groupsAndAccounts.test.ts +156 -1
- package/src/tools/tests/load.test.ts +198 -1
- package/src/tools/tests/zod.test-d.ts +0 -2
- package/src/tools/tests/zod.test.ts +43 -40
- package/dist/chunk-F55R554M.js.map +0 -1
- package/dist/inspector/custom-element-35MDW4SW.js.map +0 -1
- package/dist/tools/subscribe/CoValueCoreSubscription.test.d.ts.map +0 -1
- /package/dist/tools/{subscribe → tests}/CoValueCoreSubscription.test.d.ts +0 -0
|
@@ -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_react20 = __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_react19 = __toESM(require_react(), 1);
|
|
31792
|
+
import { styled as styled20 } 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 styled17 } from "goober";
|
|
31968
31968
|
|
|
31969
31969
|
// src/inspector/viewer/page.tsx
|
|
31970
|
-
var
|
|
31971
|
-
import { styled as
|
|
31970
|
+
var import_react15 = __toESM(require_react(), 1);
|
|
31971
|
+
import { styled as styled16 } from "goober";
|
|
31972
31972
|
|
|
31973
31973
|
// src/inspector/ui/badge.tsx
|
|
31974
31974
|
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -33057,6 +33057,9 @@ function CoPlainTextView({ data }) {
|
|
|
33057
33057
|
] });
|
|
33058
33058
|
}
|
|
33059
33059
|
|
|
33060
|
+
// src/inspector/viewer/group-view.tsx
|
|
33061
|
+
var import_react13 = __toESM(require_react(), 1);
|
|
33062
|
+
|
|
33060
33063
|
// src/inspector/ui/table.tsx
|
|
33061
33064
|
var import_react10 = __toESM(require_react(), 1);
|
|
33062
33065
|
var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -33097,49 +33100,442 @@ var TableRow = import_react10.default.forwardRef(({ children, ...props }, ref) =
|
|
|
33097
33100
|
var TableHeader = import_react10.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyledTh, { ref, ...props, children }));
|
|
33098
33101
|
var TableCell = import_react10.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyledTd, { ref, ...props, children }));
|
|
33099
33102
|
|
|
33100
|
-
// src/inspector/
|
|
33103
|
+
// src/inspector/ui/modal.tsx
|
|
33104
|
+
var import_react11 = __toESM(require_react(), 1);
|
|
33105
|
+
import { styled as styled13 } from "goober";
|
|
33101
33106
|
var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
|
|
33107
|
+
var ModalContent = styled13("dialog")`
|
|
33108
|
+
background-color: var(--j-background);
|
|
33109
|
+
border-radius: var(--j-radius-lg);
|
|
33110
|
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
|
33111
|
+
border: 1px solid var(--j-border-color);
|
|
33112
|
+
max-width: 32rem;
|
|
33113
|
+
margin-block: auto;
|
|
33114
|
+
margin-inline: auto;
|
|
33115
|
+
&::backdrop {
|
|
33116
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
33117
|
+
}
|
|
33118
|
+
|
|
33119
|
+
`;
|
|
33120
|
+
var ModalHeader = styled13("div")`
|
|
33121
|
+
display: flex;
|
|
33122
|
+
justify-content: space-between;
|
|
33123
|
+
align-items: flex-start;
|
|
33124
|
+
padding: 1.5rem 1.5rem 0 1.5rem;
|
|
33125
|
+
gap: 1rem;
|
|
33126
|
+
`;
|
|
33127
|
+
var ModalBody = styled13("div")`
|
|
33128
|
+
padding: 1rem 1.5rem;
|
|
33129
|
+
flex: 1;
|
|
33130
|
+
`;
|
|
33131
|
+
var ModalFooter = styled13("div")`
|
|
33132
|
+
display: flex;
|
|
33133
|
+
justify-content: flex-end;
|
|
33134
|
+
gap: 0.75rem;
|
|
33135
|
+
padding: 0 1.5rem 1.5rem 1.5rem;
|
|
33136
|
+
`;
|
|
33137
|
+
var CloseButton = styled13("button")`
|
|
33138
|
+
background: none;
|
|
33139
|
+
border: none;
|
|
33140
|
+
cursor: pointer;
|
|
33141
|
+
padding: 0.25rem;
|
|
33142
|
+
border-radius: var(--j-radius-sm);
|
|
33143
|
+
color: var(--j-text-color);
|
|
33144
|
+
font-size: 1.25rem;
|
|
33145
|
+
line-height: 1;
|
|
33146
|
+
display: flex;
|
|
33147
|
+
align-items: center;
|
|
33148
|
+
justify-content: center;
|
|
33149
|
+
min-width: 2rem;
|
|
33150
|
+
min-height: 2rem;
|
|
33151
|
+
|
|
33152
|
+
&:hover {
|
|
33153
|
+
background-color: var(--j-foreground);
|
|
33154
|
+
}
|
|
33155
|
+
|
|
33156
|
+
&:focus-visible {
|
|
33157
|
+
outline: 2px solid var(--j-border-focus);
|
|
33158
|
+
outline-offset: 2px;
|
|
33159
|
+
}
|
|
33160
|
+
`;
|
|
33161
|
+
var Modal = (0, import_react11.forwardRef)(
|
|
33162
|
+
({
|
|
33163
|
+
isOpen,
|
|
33164
|
+
onClose,
|
|
33165
|
+
heading,
|
|
33166
|
+
text,
|
|
33167
|
+
children,
|
|
33168
|
+
confirmText = "Confirm",
|
|
33169
|
+
cancelText = "Cancel",
|
|
33170
|
+
onConfirm,
|
|
33171
|
+
onCancel,
|
|
33172
|
+
showButtons = true,
|
|
33173
|
+
className
|
|
33174
|
+
}, ref) => {
|
|
33175
|
+
const modalRef = (0, import_react11.useRef)(null);
|
|
33176
|
+
(0, import_react11.useEffect)(() => {
|
|
33177
|
+
if (isOpen) {
|
|
33178
|
+
modalRef.current?.showModal();
|
|
33179
|
+
} else {
|
|
33180
|
+
onClose();
|
|
33181
|
+
modalRef.current?.close();
|
|
33182
|
+
}
|
|
33183
|
+
}, [isOpen, onClose]);
|
|
33184
|
+
const handleConfirm = () => {
|
|
33185
|
+
onConfirm?.();
|
|
33186
|
+
onClose();
|
|
33187
|
+
};
|
|
33188
|
+
const handleCancel = () => {
|
|
33189
|
+
onCancel?.();
|
|
33190
|
+
onClose();
|
|
33191
|
+
};
|
|
33192
|
+
if (!isOpen) return null;
|
|
33193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
33194
|
+
ModalContent,
|
|
33195
|
+
{
|
|
33196
|
+
ref: ref || modalRef,
|
|
33197
|
+
className,
|
|
33198
|
+
role: "dialog",
|
|
33199
|
+
"aria-labelledby": "modal-heading",
|
|
33200
|
+
onClose,
|
|
33201
|
+
children: [
|
|
33202
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ModalHeader, { children: [
|
|
33203
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Heading, { id: "modal-heading", children: heading }),
|
|
33204
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CloseButton, { onClick: onClose, "aria-label": "Close modal", type: "button", children: "\xD7" })
|
|
33205
|
+
] }),
|
|
33206
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ModalBody, { children: [
|
|
33207
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { style: { margin: "0 0 1rem 0", color: "var(--j-text-color)" }, children: text }),
|
|
33208
|
+
children
|
|
33209
|
+
] }),
|
|
33210
|
+
showButtons && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ModalFooter, { children: [
|
|
33211
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { variant: "secondary", onClick: handleCancel, children: cancelText }),
|
|
33212
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { variant: "primary", onClick: handleConfirm, children: confirmText })
|
|
33213
|
+
] })
|
|
33214
|
+
]
|
|
33215
|
+
}
|
|
33216
|
+
);
|
|
33217
|
+
}
|
|
33218
|
+
);
|
|
33219
|
+
Modal.displayName = "Modal";
|
|
33220
|
+
|
|
33221
|
+
// src/inspector/ui/select.tsx
|
|
33222
|
+
var import_react12 = __toESM(require_react(), 1);
|
|
33223
|
+
import { styled as styled14 } from "goober";
|
|
33224
|
+
var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
|
|
33225
|
+
var SelectContainer = styled14("div")`
|
|
33226
|
+
display: grid;
|
|
33227
|
+
gap: 0.25rem;
|
|
33228
|
+
`;
|
|
33229
|
+
var SelectWrapper = styled14("div")`
|
|
33230
|
+
position: relative;
|
|
33231
|
+
display: flex;
|
|
33232
|
+
align-items: center;
|
|
33233
|
+
`;
|
|
33234
|
+
var StyledSelect = styled14("select")`
|
|
33235
|
+
width: 100%;
|
|
33236
|
+
border-radius: var(--j-radius-md);
|
|
33237
|
+
border: 1px solid var(--j-border-color);
|
|
33238
|
+
padding: 0.5rem 0.875rem 0.5rem 0.875rem;
|
|
33239
|
+
padding-right: 2rem;
|
|
33240
|
+
box-shadow: var(--j-shadow-sm);
|
|
33241
|
+
font-weight: 500;
|
|
33242
|
+
color: var(--j-text-color-strong);
|
|
33243
|
+
appearance: none;
|
|
33244
|
+
overflow: hidden;
|
|
33245
|
+
text-overflow: ellipsis;
|
|
33246
|
+
white-space: nowrap;
|
|
33247
|
+
|
|
33248
|
+
@media (prefers-color-scheme: dark) {
|
|
33249
|
+
background-color: var(--j-foreground);
|
|
33250
|
+
}
|
|
33251
|
+
`;
|
|
33252
|
+
var SelectIcon = styled14("span")`
|
|
33253
|
+
position: absolute;
|
|
33254
|
+
right: 0.5em;
|
|
33255
|
+
color: var(--j-neutral-400);
|
|
33256
|
+
pointer-events: none;
|
|
33257
|
+
|
|
33258
|
+
@media (prefers-color-scheme: dark) {
|
|
33259
|
+
color: var(--j-neutral-900);
|
|
33260
|
+
}
|
|
33261
|
+
`;
|
|
33262
|
+
function Select(props) {
|
|
33263
|
+
const { label, hideLabel, id: customId, className, ...selectProps } = props;
|
|
33264
|
+
const generatedId = (0, import_react12.useId)();
|
|
33265
|
+
const id = customId || generatedId;
|
|
33266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(SelectContainer, { className, children: [
|
|
33267
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("label", { htmlFor: id, className: hideLabel ? "j-sr-only" : "", children: label }),
|
|
33268
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(SelectWrapper, { children: [
|
|
33269
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StyledSelect, { ...selectProps, id, children: props.children }),
|
|
33270
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SelectIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, { name: "chevronDown", size: "sm" }) })
|
|
33271
|
+
] })
|
|
33272
|
+
] });
|
|
33273
|
+
}
|
|
33274
|
+
|
|
33275
|
+
// src/inspector/viewer/group-view.tsx
|
|
33276
|
+
var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
|
|
33277
|
+
function partitionMembers(data) {
|
|
33278
|
+
const everyone = Object.entries(data).filter(([key]) => key === "everyone").map(([key, value]) => ({
|
|
33279
|
+
id: key,
|
|
33280
|
+
role: value
|
|
33281
|
+
}));
|
|
33282
|
+
const members = Object.entries(data).filter(([key]) => isCoId(key)).map(([key, value]) => ({
|
|
33283
|
+
id: key,
|
|
33284
|
+
role: value
|
|
33285
|
+
}));
|
|
33286
|
+
const parentGroups = Object.entries(data).filter(([key]) => key.startsWith("parent_co_")).map(([key, value]) => ({
|
|
33287
|
+
id: key.slice(7),
|
|
33288
|
+
role: value
|
|
33289
|
+
}));
|
|
33290
|
+
const childGroups = Object.entries(data).filter(
|
|
33291
|
+
([key, value]) => key.startsWith("child_co_") && value !== "revoked"
|
|
33292
|
+
).map(([key, value]) => ({
|
|
33293
|
+
id: key.slice(6),
|
|
33294
|
+
role: value
|
|
33295
|
+
}));
|
|
33296
|
+
return { everyone, members, parentGroups, childGroups };
|
|
33297
|
+
}
|
|
33102
33298
|
function GroupView({
|
|
33299
|
+
coValue,
|
|
33103
33300
|
data,
|
|
33104
33301
|
onNavigate,
|
|
33105
33302
|
node
|
|
33106
33303
|
}) {
|
|
33107
|
-
|
|
33108
|
-
|
|
33109
|
-
|
|
33110
|
-
|
|
33111
|
-
|
|
33112
|
-
|
|
33304
|
+
const [addMemberType, setAddMemberType] = (0, import_react13.useState)(null);
|
|
33305
|
+
const { everyone, members, parentGroups, childGroups } = partitionMembers(
|
|
33306
|
+
data
|
|
33307
|
+
);
|
|
33308
|
+
const onRemoveMember = async (id) => {
|
|
33309
|
+
if (confirm("Are you sure you want to remove this member?") === false) {
|
|
33310
|
+
return;
|
|
33311
|
+
}
|
|
33312
|
+
try {
|
|
33313
|
+
const group = await node.load(coValue.id);
|
|
33314
|
+
if (group === "unavailable") {
|
|
33315
|
+
throw new Error("Group not found");
|
|
33316
|
+
}
|
|
33317
|
+
const rawGroup = group;
|
|
33318
|
+
rawGroup.removeMember(id);
|
|
33319
|
+
} catch (error) {
|
|
33320
|
+
console.error(error);
|
|
33321
|
+
throw error;
|
|
33322
|
+
}
|
|
33323
|
+
};
|
|
33324
|
+
const onRemoveGroup = async (id) => {
|
|
33325
|
+
if (confirm("Are you sure you want to remove this group?") === false) {
|
|
33326
|
+
return;
|
|
33327
|
+
}
|
|
33328
|
+
try {
|
|
33329
|
+
const group = await node.load(coValue.id);
|
|
33330
|
+
if (group === "unavailable") {
|
|
33331
|
+
throw new Error("Group not found");
|
|
33332
|
+
}
|
|
33333
|
+
const rawGroup = group;
|
|
33334
|
+
const targetGroup = await node.load(id);
|
|
33335
|
+
if (targetGroup === "unavailable") {
|
|
33336
|
+
throw new Error("Group not found");
|
|
33337
|
+
}
|
|
33338
|
+
const rawTargetGroup = targetGroup;
|
|
33339
|
+
rawGroup.revokeExtend(rawTargetGroup);
|
|
33340
|
+
} catch (error) {
|
|
33341
|
+
console.error(error);
|
|
33342
|
+
throw error;
|
|
33343
|
+
}
|
|
33344
|
+
};
|
|
33345
|
+
const handleAddMemberSubmit = async (event) => {
|
|
33346
|
+
event.preventDefault();
|
|
33347
|
+
const form = event.currentTarget;
|
|
33348
|
+
const memberId = form.elements.namedItem("memberId")?.value;
|
|
33349
|
+
const role = form.elements.namedItem("role")?.value;
|
|
33350
|
+
try {
|
|
33351
|
+
const group = await node.load(coValue.id);
|
|
33352
|
+
if (group === "unavailable") {
|
|
33353
|
+
throw new Error("Group not found");
|
|
33354
|
+
}
|
|
33355
|
+
const rawGroup = group;
|
|
33356
|
+
if (addMemberType === "account") {
|
|
33357
|
+
let rawAccount = "everyone";
|
|
33358
|
+
if (memberId !== "everyone") {
|
|
33359
|
+
const account = await node.load(memberId);
|
|
33360
|
+
if (account === "unavailable") {
|
|
33361
|
+
throw new Error("Account not found");
|
|
33362
|
+
}
|
|
33363
|
+
rawAccount = account;
|
|
33364
|
+
}
|
|
33365
|
+
rawGroup.addMember(rawAccount, role);
|
|
33366
|
+
} else if (addMemberType === "group") {
|
|
33367
|
+
const targetGroup = await node.load(memberId);
|
|
33368
|
+
if (targetGroup === "unavailable") {
|
|
33369
|
+
throw new Error("Group not found");
|
|
33370
|
+
}
|
|
33371
|
+
const rawTargetGroup = targetGroup;
|
|
33372
|
+
rawGroup.extend(
|
|
33373
|
+
rawTargetGroup,
|
|
33374
|
+
role
|
|
33375
|
+
);
|
|
33376
|
+
}
|
|
33377
|
+
setAddMemberType(null);
|
|
33378
|
+
} catch (error) {
|
|
33379
|
+
console.error(error);
|
|
33380
|
+
alert(`Failed to add ${addMemberType}: ${error.message}`);
|
|
33381
|
+
}
|
|
33382
|
+
};
|
|
33383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
33384
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Table, { children: [
|
|
33385
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(TableRow, { children: [
|
|
33386
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableHeader, { children: "Member" }),
|
|
33387
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableHeader, { children: "Permission" }),
|
|
33388
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableHeader, {})
|
|
33113
33389
|
] }) }),
|
|
33114
|
-
/* @__PURE__ */ (0,
|
|
33115
|
-
|
|
33116
|
-
/* @__PURE__ */ (0,
|
|
33117
|
-
/* @__PURE__ */ (0,
|
|
33118
|
-
|
|
33119
|
-
|
|
33120
|
-
|
|
33121
|
-
|
|
33122
|
-
|
|
33123
|
-
{
|
|
33124
|
-
|
|
33125
|
-
|
|
33126
|
-
|
|
33127
|
-
|
|
33128
|
-
|
|
33129
|
-
|
|
33390
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(TableBody, { children: [
|
|
33391
|
+
everyone.map((member) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(TableRow, { children: [
|
|
33392
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { children: member.id }),
|
|
33393
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { children: member.role }),
|
|
33394
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33395
|
+
Button,
|
|
33396
|
+
{
|
|
33397
|
+
variant: "secondary",
|
|
33398
|
+
onClick: () => onRemoveMember(member.id),
|
|
33399
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, { name: "delete" })
|
|
33400
|
+
}
|
|
33401
|
+
) })
|
|
33402
|
+
] }, member.id)),
|
|
33403
|
+
members.map((member) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(TableRow, { children: [
|
|
33404
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33405
|
+
AccountOrGroupText,
|
|
33406
|
+
{
|
|
33407
|
+
coId: member.id,
|
|
33408
|
+
node,
|
|
33409
|
+
showId: true,
|
|
33410
|
+
onClick: () => {
|
|
33411
|
+
onNavigate([{ coId: member.id, name: member.id }]);
|
|
33130
33412
|
}
|
|
33131
|
-
|
|
33132
|
-
|
|
33133
|
-
|
|
33134
|
-
|
|
33413
|
+
}
|
|
33414
|
+
) }),
|
|
33415
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { children: member.role }),
|
|
33416
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33417
|
+
Button,
|
|
33418
|
+
{
|
|
33419
|
+
variant: "secondary",
|
|
33420
|
+
onClick: () => onRemoveMember(member.id),
|
|
33421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, { name: "delete" })
|
|
33422
|
+
}
|
|
33423
|
+
) })
|
|
33424
|
+
] }, member.id)),
|
|
33425
|
+
parentGroups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(TableRow, { children: [
|
|
33426
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33427
|
+
AccountOrGroupText,
|
|
33428
|
+
{
|
|
33429
|
+
coId: group.id,
|
|
33430
|
+
node,
|
|
33431
|
+
showId: true,
|
|
33432
|
+
onClick: () => {
|
|
33433
|
+
onNavigate([{ coId: group.id, name: group.id }]);
|
|
33434
|
+
}
|
|
33435
|
+
}
|
|
33436
|
+
) }),
|
|
33437
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { children: group.role }),
|
|
33438
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { children: group.role !== "revoked" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33439
|
+
Button,
|
|
33440
|
+
{
|
|
33441
|
+
variant: "secondary",
|
|
33442
|
+
onClick: () => onRemoveGroup(group.id),
|
|
33443
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, { name: "delete" })
|
|
33444
|
+
}
|
|
33445
|
+
) })
|
|
33446
|
+
] }, group.id))
|
|
33135
33447
|
] })
|
|
33136
33448
|
] }),
|
|
33137
|
-
/* @__PURE__ */ (0,
|
|
33449
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
33450
|
+
"div",
|
|
33451
|
+
{
|
|
33452
|
+
style: {
|
|
33453
|
+
display: "flex",
|
|
33454
|
+
justifyContent: "flex-end",
|
|
33455
|
+
gap: "0.75rem",
|
|
33456
|
+
marginTop: "1rem"
|
|
33457
|
+
},
|
|
33458
|
+
children: [
|
|
33459
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { variant: "primary", onClick: () => setAddMemberType("account"), children: "Add Account" }),
|
|
33460
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { variant: "primary", onClick: () => setAddMemberType("group"), children: "Add Group" })
|
|
33461
|
+
]
|
|
33462
|
+
}
|
|
33463
|
+
),
|
|
33464
|
+
childGroups.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Table, { children: [
|
|
33465
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableHeader, { children: "Member of" }) }) }),
|
|
33466
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableBody, { children: childGroups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33467
|
+
AccountOrGroupText,
|
|
33468
|
+
{
|
|
33469
|
+
coId: group.id,
|
|
33470
|
+
node,
|
|
33471
|
+
showId: true,
|
|
33472
|
+
onClick: () => {
|
|
33473
|
+
onNavigate([{ coId: group.id, name: group.id }]);
|
|
33474
|
+
}
|
|
33475
|
+
}
|
|
33476
|
+
) }) }, group.id)) })
|
|
33477
|
+
] }),
|
|
33478
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(RawDataCard, { data }),
|
|
33479
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33480
|
+
Modal,
|
|
33481
|
+
{
|
|
33482
|
+
isOpen: addMemberType !== null,
|
|
33483
|
+
onClose: () => setAddMemberType(null),
|
|
33484
|
+
heading: addMemberType === "account" ? "Add Account" : "Add Group",
|
|
33485
|
+
showButtons: false,
|
|
33486
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("form", { onSubmit: handleAddMemberSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
33487
|
+
"div",
|
|
33488
|
+
{
|
|
33489
|
+
style: { display: "flex", flexDirection: "column", gap: "1rem" },
|
|
33490
|
+
children: [
|
|
33491
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33492
|
+
Input,
|
|
33493
|
+
{
|
|
33494
|
+
name: "memberId",
|
|
33495
|
+
label: addMemberType === "account" ? "Account ID" : "Group ID",
|
|
33496
|
+
placeholder: addMemberType === "account" ? "Enter account ID" : "Enter group ID",
|
|
33497
|
+
required: true
|
|
33498
|
+
}
|
|
33499
|
+
),
|
|
33500
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Select, { name: "role", label: "Role", children: [
|
|
33501
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "reader", children: "Reader" }),
|
|
33502
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "writer", children: "Writer" }),
|
|
33503
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "admin", children: "Admin" }),
|
|
33504
|
+
addMemberType === "account" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "writeOnly", children: "Write Only" }) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "inherit", children: "Inherit" }) })
|
|
33505
|
+
] }),
|
|
33506
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
33507
|
+
"div",
|
|
33508
|
+
{
|
|
33509
|
+
style: {
|
|
33510
|
+
display: "flex",
|
|
33511
|
+
gap: "0.75rem",
|
|
33512
|
+
justifyContent: "flex-end",
|
|
33513
|
+
marginTop: "0.5rem"
|
|
33514
|
+
},
|
|
33515
|
+
children: [
|
|
33516
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33517
|
+
Button,
|
|
33518
|
+
{
|
|
33519
|
+
type: "button",
|
|
33520
|
+
variant: "secondary",
|
|
33521
|
+
onClick: () => setAddMemberType(null),
|
|
33522
|
+
children: "Cancel"
|
|
33523
|
+
}
|
|
33524
|
+
),
|
|
33525
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { type: "submit", variant: "primary", children: "Add" })
|
|
33526
|
+
]
|
|
33527
|
+
}
|
|
33528
|
+
)
|
|
33529
|
+
]
|
|
33530
|
+
}
|
|
33531
|
+
) })
|
|
33532
|
+
}
|
|
33533
|
+
)
|
|
33138
33534
|
] });
|
|
33139
33535
|
}
|
|
33140
33536
|
|
|
33141
33537
|
// src/inspector/viewer/role-display.tsx
|
|
33142
|
-
var
|
|
33538
|
+
var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
|
|
33143
33539
|
function RoleDisplay({
|
|
33144
33540
|
node,
|
|
33145
33541
|
value
|
|
@@ -33158,24 +33554,24 @@ function RoleDisplay({
|
|
|
33158
33554
|
} else {
|
|
33159
33555
|
role = "unauthorized";
|
|
33160
33556
|
}
|
|
33161
|
-
return /* @__PURE__ */ (0,
|
|
33557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Text, { children: [
|
|
33162
33558
|
"Role: ",
|
|
33163
33559
|
role
|
|
33164
33560
|
] });
|
|
33165
33561
|
}
|
|
33166
33562
|
|
|
33167
33563
|
// src/inspector/viewer/table-viewer.tsx
|
|
33168
|
-
var
|
|
33169
|
-
import { styled as
|
|
33170
|
-
var
|
|
33171
|
-
var PaginationContainer =
|
|
33564
|
+
var import_react14 = __toESM(require_react(), 1);
|
|
33565
|
+
import { styled as styled15 } from "goober";
|
|
33566
|
+
var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
|
|
33567
|
+
var PaginationContainer = styled15("div")`
|
|
33172
33568
|
padding: 1rem 0;
|
|
33173
33569
|
display: flex;
|
|
33174
33570
|
align-items: center;
|
|
33175
33571
|
justify-content: space-between;
|
|
33176
33572
|
gap: 0.5rem;
|
|
33177
33573
|
`;
|
|
33178
|
-
var RedTooltip =
|
|
33574
|
+
var RedTooltip = styled15("span")`
|
|
33179
33575
|
position:relative; /* making the .tooltip span a container for the tooltip text */
|
|
33180
33576
|
border-bottom:1px dashed #000; /* little indicater to indicate it's hoverable */
|
|
33181
33577
|
|
|
@@ -33212,8 +33608,8 @@ function CoValuesTableView({
|
|
|
33212
33608
|
onNavigate,
|
|
33213
33609
|
onRemove
|
|
33214
33610
|
}) {
|
|
33215
|
-
const [visibleRowsCount, setVisibleRowsCount] = (0,
|
|
33216
|
-
const [coIdArray, visibleRows] = (0,
|
|
33611
|
+
const [visibleRowsCount, setVisibleRowsCount] = (0, import_react14.useState)(10);
|
|
33612
|
+
const [coIdArray, visibleRows] = (0, import_react14.useMemo)(() => {
|
|
33217
33613
|
const coIdArray2 = Array.isArray(data) ? data : Object.values(data).every((k) => typeof k === "string" && isCoId(k)) ? Object.values(data).map((k) => k) : [];
|
|
33218
33614
|
const visibleRows2 = coIdArray2.slice(0, visibleRowsCount);
|
|
33219
33615
|
return [coIdArray2, visibleRows2];
|
|
@@ -33221,10 +33617,10 @@ function CoValuesTableView({
|
|
|
33221
33617
|
const resolvedRows = useResolvedCoValues(visibleRows, node);
|
|
33222
33618
|
const hasMore = visibleRowsCount < coIdArray.length;
|
|
33223
33619
|
if (!coIdArray.length) {
|
|
33224
|
-
return /* @__PURE__ */ (0,
|
|
33620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children: "No data to display" });
|
|
33225
33621
|
}
|
|
33226
33622
|
if (resolvedRows.length === 0) {
|
|
33227
|
-
return /* @__PURE__ */ (0,
|
|
33623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children: "Loading..." });
|
|
33228
33624
|
}
|
|
33229
33625
|
const keys = Array.from(
|
|
33230
33626
|
new Set(
|
|
@@ -33234,15 +33630,15 @@ function CoValuesTableView({
|
|
|
33234
33630
|
const loadMore = () => {
|
|
33235
33631
|
setVisibleRowsCount((prevVisibleRows) => prevVisibleRows + 10);
|
|
33236
33632
|
};
|
|
33237
|
-
return /* @__PURE__ */ (0,
|
|
33238
|
-
/* @__PURE__ */ (0,
|
|
33239
|
-
/* @__PURE__ */ (0,
|
|
33240
|
-
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */ (0,
|
|
33241
|
-
onRemove && /* @__PURE__ */ (0,
|
|
33633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
33634
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Table, { children: [
|
|
33635
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TableRow, { children: [
|
|
33636
|
+
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableHeader, { children: key }, key)),
|
|
33637
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableHeader, {})
|
|
33242
33638
|
] }) }),
|
|
33243
|
-
/* @__PURE__ */ (0,
|
|
33244
|
-
/* @__PURE__ */ (0,
|
|
33245
|
-
/* @__PURE__ */ (0,
|
|
33639
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableBody, { children: resolvedRows.slice(0, visibleRowsCount).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TableRow, { children: [
|
|
33640
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { mono: true, children: item.snapshot === "unavailable" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(RedTooltip, { "data-text": "Unavailable", children: [
|
|
33641
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
33246
33642
|
Icon,
|
|
33247
33643
|
{
|
|
33248
33644
|
name: "caution",
|
|
@@ -33255,7 +33651,7 @@ function CoValuesTableView({
|
|
|
33255
33651
|
),
|
|
33256
33652
|
visibleRows[index]
|
|
33257
33653
|
] }) : visibleRows[index] }) }),
|
|
33258
|
-
keys.map((key) => /* @__PURE__ */ (0,
|
|
33654
|
+
keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableCell, { children: item.snapshot !== "unavailable" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
33259
33655
|
ValueRenderer,
|
|
33260
33656
|
{
|
|
33261
33657
|
json: item.snapshot[key],
|
|
@@ -33276,7 +33672,7 @@ function CoValuesTableView({
|
|
|
33276
33672
|
}
|
|
33277
33673
|
}
|
|
33278
33674
|
) }, key)),
|
|
33279
|
-
/* @__PURE__ */ (0,
|
|
33675
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
33280
33676
|
Button,
|
|
33281
33677
|
{
|
|
33282
33678
|
variant: "secondary",
|
|
@@ -33289,18 +33685,18 @@ function CoValuesTableView({
|
|
|
33289
33685
|
children: "View"
|
|
33290
33686
|
}
|
|
33291
33687
|
) }),
|
|
33292
|
-
onRemove && /* @__PURE__ */ (0,
|
|
33688
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
33293
33689
|
] }, index)) })
|
|
33294
33690
|
] }),
|
|
33295
|
-
/* @__PURE__ */ (0,
|
|
33296
|
-
/* @__PURE__ */ (0,
|
|
33691
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(PaginationContainer, { children: [
|
|
33692
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Text, { muted: true, small: true, children: [
|
|
33297
33693
|
"Showing ",
|
|
33298
33694
|
Math.min(visibleRowsCount, coIdArray.length),
|
|
33299
33695
|
" of",
|
|
33300
33696
|
" ",
|
|
33301
33697
|
coIdArray.length
|
|
33302
33698
|
] }),
|
|
33303
|
-
hasMore && /* @__PURE__ */ (0,
|
|
33699
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { variant: "secondary", onClick: loadMore, children: "Load more" })
|
|
33304
33700
|
] })
|
|
33305
33701
|
] });
|
|
33306
33702
|
}
|
|
@@ -33310,11 +33706,11 @@ function TableView({
|
|
|
33310
33706
|
onNavigate,
|
|
33311
33707
|
onRemove
|
|
33312
33708
|
}) {
|
|
33313
|
-
const isListOfCoValues = (0,
|
|
33709
|
+
const isListOfCoValues = (0, import_react14.useMemo)(() => {
|
|
33314
33710
|
return Array.isArray(data) && data.every((k) => isCoId(k));
|
|
33315
33711
|
}, [data]);
|
|
33316
33712
|
if (isListOfCoValues) {
|
|
33317
|
-
return /* @__PURE__ */ (0,
|
|
33713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
33318
33714
|
CoValuesTableView,
|
|
33319
33715
|
{
|
|
33320
33716
|
data,
|
|
@@ -33324,26 +33720,26 @@ function TableView({
|
|
|
33324
33720
|
}
|
|
33325
33721
|
);
|
|
33326
33722
|
}
|
|
33327
|
-
return /* @__PURE__ */ (0,
|
|
33328
|
-
/* @__PURE__ */ (0,
|
|
33329
|
-
/* @__PURE__ */ (0,
|
|
33330
|
-
/* @__PURE__ */ (0,
|
|
33331
|
-
onRemove && /* @__PURE__ */ (0,
|
|
33723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Table, { children: [
|
|
33724
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TableRow, { children: [
|
|
33725
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableHeader, { style: { width: "5rem" }, children: "Index" }),
|
|
33726
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableHeader, { children: "Value" }),
|
|
33727
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableHeader, { children: "Action" })
|
|
33332
33728
|
] }) }),
|
|
33333
|
-
/* @__PURE__ */ (0,
|
|
33334
|
-
/* @__PURE__ */ (0,
|
|
33335
|
-
/* @__PURE__ */ (0,
|
|
33336
|
-
onRemove && /* @__PURE__ */ (0,
|
|
33729
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableBody, { children: Array.isArray(data) && data?.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TableRow, { children: [
|
|
33730
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { mono: true, children: index }) }),
|
|
33731
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ValueRenderer, { json: value }) }),
|
|
33732
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
33337
33733
|
] }, index)) })
|
|
33338
33734
|
] });
|
|
33339
33735
|
}
|
|
33340
33736
|
|
|
33341
33737
|
// src/inspector/viewer/page.tsx
|
|
33342
|
-
var
|
|
33343
|
-
var BasePageContainer =
|
|
33344
|
-
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ (0,
|
|
33738
|
+
var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
|
|
33739
|
+
var BasePageContainer = import_react15.default.forwardRef(
|
|
33740
|
+
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref, ...rest })
|
|
33345
33741
|
);
|
|
33346
|
-
var PageContainer =
|
|
33742
|
+
var PageContainer = styled16(BasePageContainer)`
|
|
33347
33743
|
position: absolute;
|
|
33348
33744
|
z-index: 10;
|
|
33349
33745
|
inset: 0;
|
|
@@ -33351,36 +33747,36 @@ var PageContainer = styled14(BasePageContainer)`
|
|
|
33351
33747
|
height: 100%;
|
|
33352
33748
|
padding: 0 0.75rem;
|
|
33353
33749
|
`;
|
|
33354
|
-
var BackButton =
|
|
33750
|
+
var BackButton = styled16("div")`
|
|
33355
33751
|
position: absolute;
|
|
33356
33752
|
left: 0;
|
|
33357
33753
|
right: 0;
|
|
33358
33754
|
top: 0;
|
|
33359
33755
|
height: 2.5rem;
|
|
33360
33756
|
`;
|
|
33361
|
-
var HeaderContainer =
|
|
33757
|
+
var HeaderContainer = styled16("div")`
|
|
33362
33758
|
display: flex;
|
|
33363
33759
|
justify-content: space-between;
|
|
33364
33760
|
align-items: center;
|
|
33365
33761
|
margin-bottom: 1rem;
|
|
33366
33762
|
`;
|
|
33367
|
-
var TitleContainer =
|
|
33763
|
+
var TitleContainer = styled16("div")`
|
|
33368
33764
|
display: flex;
|
|
33369
33765
|
align-items: center;
|
|
33370
33766
|
gap: 0.75rem;
|
|
33371
33767
|
`;
|
|
33372
|
-
var Title =
|
|
33768
|
+
var Title = styled16(Heading)`
|
|
33373
33769
|
display: flex;
|
|
33374
33770
|
flex-direction: column;
|
|
33375
33771
|
align-items: flex-start;
|
|
33376
33772
|
gap: 0.25rem;
|
|
33377
33773
|
`;
|
|
33378
|
-
var BadgeContainer =
|
|
33774
|
+
var BadgeContainer = styled16("div")`
|
|
33379
33775
|
display: flex;
|
|
33380
33776
|
align-items: center;
|
|
33381
33777
|
gap: 0.75rem;
|
|
33382
33778
|
`;
|
|
33383
|
-
var ContentContainer =
|
|
33779
|
+
var ContentContainer = styled16("div")`
|
|
33384
33780
|
overflow: auto;
|
|
33385
33781
|
display: flex;
|
|
33386
33782
|
flex-direction: column;
|
|
@@ -33401,7 +33797,7 @@ function View(props) {
|
|
|
33401
33797
|
const { node, onNavigate } = props;
|
|
33402
33798
|
if (!snapshot || snapshot === "unavailable") return;
|
|
33403
33799
|
if (type === "costream") {
|
|
33404
|
-
return /* @__PURE__ */ (0,
|
|
33800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
33405
33801
|
CoStreamView,
|
|
33406
33802
|
{
|
|
33407
33803
|
data: snapshot,
|
|
@@ -33412,13 +33808,21 @@ function View(props) {
|
|
|
33412
33808
|
);
|
|
33413
33809
|
}
|
|
33414
33810
|
if (extendedType === "group") {
|
|
33415
|
-
return /* @__PURE__ */ (0,
|
|
33811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
33812
|
+
GroupView,
|
|
33813
|
+
{
|
|
33814
|
+
coValue: value,
|
|
33815
|
+
data: snapshot,
|
|
33816
|
+
node,
|
|
33817
|
+
onNavigate
|
|
33818
|
+
}
|
|
33819
|
+
);
|
|
33416
33820
|
}
|
|
33417
33821
|
if (extendedType === "account") {
|
|
33418
|
-
return /* @__PURE__ */ (0,
|
|
33822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AccountView, { data: snapshot, node, onNavigate });
|
|
33419
33823
|
}
|
|
33420
33824
|
if (type === "coplaintext") {
|
|
33421
|
-
return /* @__PURE__ */ (0,
|
|
33825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CoPlainTextView, { data: snapshot });
|
|
33422
33826
|
}
|
|
33423
33827
|
if (type === "colist") {
|
|
33424
33828
|
const handleRemove = (index) => {
|
|
@@ -33427,7 +33831,7 @@ function View(props) {
|
|
|
33427
33831
|
list.delete(index);
|
|
33428
33832
|
}
|
|
33429
33833
|
};
|
|
33430
|
-
return /* @__PURE__ */ (0,
|
|
33834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
33431
33835
|
TableView,
|
|
33432
33836
|
{
|
|
33433
33837
|
data: snapshot,
|
|
@@ -33438,9 +33842,9 @@ function View(props) {
|
|
|
33438
33842
|
);
|
|
33439
33843
|
}
|
|
33440
33844
|
if (extendedType === "record") {
|
|
33441
|
-
return /* @__PURE__ */ (0,
|
|
33845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableView, { data: snapshot, node, onNavigate });
|
|
33442
33846
|
}
|
|
33443
|
-
return /* @__PURE__ */ (0,
|
|
33847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GridView, { data: snapshot, onNavigate, node });
|
|
33444
33848
|
}
|
|
33445
33849
|
function Page(props) {
|
|
33446
33850
|
const {
|
|
@@ -33456,13 +33860,13 @@ function Page(props) {
|
|
|
33456
33860
|
const coValue = useResolvedCoValue(coId, node);
|
|
33457
33861
|
const { value, snapshot, type, extendedType } = coValue;
|
|
33458
33862
|
if (snapshot === "unavailable") {
|
|
33459
|
-
return /* @__PURE__ */ (0,
|
|
33863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style, children: "Data unavailable" });
|
|
33460
33864
|
}
|
|
33461
33865
|
if (!snapshot) {
|
|
33462
|
-
return /* @__PURE__ */ (0,
|
|
33866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style });
|
|
33463
33867
|
}
|
|
33464
|
-
return /* @__PURE__ */ (0,
|
|
33465
|
-
!isTopLevel && /* @__PURE__ */ (0,
|
|
33868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(PageContainer, { style, className, isTopLevel, children: [
|
|
33869
|
+
!isTopLevel && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
33466
33870
|
BackButton,
|
|
33467
33871
|
{
|
|
33468
33872
|
"aria-label": "Back",
|
|
@@ -33472,27 +33876,27 @@ function Page(props) {
|
|
|
33472
33876
|
"aria-hidden": "true"
|
|
33473
33877
|
}
|
|
33474
33878
|
),
|
|
33475
|
-
/* @__PURE__ */ (0,
|
|
33476
|
-
/* @__PURE__ */ (0,
|
|
33879
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(HeaderContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(TitleContainer, { children: [
|
|
33880
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Title, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { children: [
|
|
33477
33881
|
name,
|
|
33478
|
-
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */ (0,
|
|
33882
|
+
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { style: { color: "#57534e", fontWeight: 500 }, children: [
|
|
33479
33883
|
" ",
|
|
33480
33884
|
snapshot.name
|
|
33481
33885
|
] }) : null
|
|
33482
33886
|
] }) }),
|
|
33483
|
-
/* @__PURE__ */ (0,
|
|
33484
|
-
/* @__PURE__ */ (0,
|
|
33485
|
-
/* @__PURE__ */ (0,
|
|
33887
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(BadgeContainer, { children: [
|
|
33888
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Badge, { children: type && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TypeIcon, { type, extendedType }) }),
|
|
33889
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Badge, { children: coId })
|
|
33486
33890
|
] })
|
|
33487
33891
|
] }) }),
|
|
33488
|
-
/* @__PURE__ */ (0,
|
|
33489
|
-
/* @__PURE__ */ (0,
|
|
33490
|
-
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */ (0,
|
|
33491
|
-
/* @__PURE__ */ (0,
|
|
33492
|
-
/* @__PURE__ */ (0,
|
|
33892
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(ContentContainer, { children: [
|
|
33893
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(View, { ...props, coValue }),
|
|
33894
|
+
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
33895
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(RoleDisplay, { node, value }),
|
|
33896
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Text, { muted: true, children: [
|
|
33493
33897
|
"Owned by",
|
|
33494
33898
|
" ",
|
|
33495
|
-
/* @__PURE__ */ (0,
|
|
33899
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
33496
33900
|
AccountOrGroupText,
|
|
33497
33901
|
{
|
|
33498
33902
|
coId: value.group.id,
|
|
@@ -33510,8 +33914,8 @@ function Page(props) {
|
|
|
33510
33914
|
}
|
|
33511
33915
|
|
|
33512
33916
|
// src/inspector/viewer/page-stack.tsx
|
|
33513
|
-
var
|
|
33514
|
-
var PageStackContainer =
|
|
33917
|
+
var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
|
|
33918
|
+
var PageStackContainer = styled17("div")`
|
|
33515
33919
|
position: relative;
|
|
33516
33920
|
padding: 0 0.75rem;
|
|
33517
33921
|
overflow-y: auto;
|
|
@@ -33528,9 +33932,9 @@ function PageStack({
|
|
|
33528
33932
|
}) {
|
|
33529
33933
|
const page = path[path.length - 1];
|
|
33530
33934
|
const index = path.length - 1;
|
|
33531
|
-
return /* @__PURE__ */ (0,
|
|
33935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(PageStackContainer, { children: [
|
|
33532
33936
|
children,
|
|
33533
|
-
node && page && /* @__PURE__ */ (0,
|
|
33937
|
+
node && page && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
33534
33938
|
Page,
|
|
33535
33939
|
{
|
|
33536
33940
|
coId: page.coId,
|
|
@@ -33545,10 +33949,10 @@ function PageStack({
|
|
|
33545
33949
|
}
|
|
33546
33950
|
|
|
33547
33951
|
// src/inspector/viewer/use-page-path.ts
|
|
33548
|
-
var
|
|
33952
|
+
var import_react16 = __toESM(require_react(), 1);
|
|
33549
33953
|
var STORAGE_KEY = "jazz-inspector-paths";
|
|
33550
33954
|
function usePagePath(defaultPath) {
|
|
33551
|
-
const [path, setPath] = (0,
|
|
33955
|
+
const [path, setPath] = (0, import_react16.useState)(() => {
|
|
33552
33956
|
if (typeof window === "undefined") return [];
|
|
33553
33957
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
33554
33958
|
if (stored) {
|
|
@@ -33560,34 +33964,34 @@ function usePagePath(defaultPath) {
|
|
|
33560
33964
|
}
|
|
33561
33965
|
return defaultPath || [];
|
|
33562
33966
|
});
|
|
33563
|
-
const updatePath = (0,
|
|
33967
|
+
const updatePath = (0, import_react16.useCallback)((newPath) => {
|
|
33564
33968
|
setPath(newPath);
|
|
33565
33969
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(newPath));
|
|
33566
33970
|
}, []);
|
|
33567
|
-
(0,
|
|
33971
|
+
(0, import_react16.useEffect)(() => {
|
|
33568
33972
|
if (defaultPath && JSON.stringify(path) !== JSON.stringify(defaultPath)) {
|
|
33569
33973
|
updatePath(defaultPath);
|
|
33570
33974
|
}
|
|
33571
33975
|
}, [defaultPath, path, updatePath]);
|
|
33572
|
-
const addPages = (0,
|
|
33976
|
+
const addPages = (0, import_react16.useCallback)(
|
|
33573
33977
|
(newPages) => {
|
|
33574
33978
|
updatePath([...path, ...newPages]);
|
|
33575
33979
|
},
|
|
33576
33980
|
[path, updatePath]
|
|
33577
33981
|
);
|
|
33578
|
-
const goToIndex = (0,
|
|
33982
|
+
const goToIndex = (0, import_react16.useCallback)(
|
|
33579
33983
|
(index) => {
|
|
33580
33984
|
updatePath(path.slice(0, index + 1));
|
|
33581
33985
|
},
|
|
33582
33986
|
[path, updatePath]
|
|
33583
33987
|
);
|
|
33584
|
-
const setPage = (0,
|
|
33988
|
+
const setPage = (0, import_react16.useCallback)(
|
|
33585
33989
|
(coId) => {
|
|
33586
33990
|
updatePath([{ coId, name: "Root" }]);
|
|
33587
33991
|
},
|
|
33588
33992
|
[updatePath]
|
|
33589
33993
|
);
|
|
33590
|
-
const goBack = (0,
|
|
33994
|
+
const goBack = (0, import_react16.useCallback)(() => {
|
|
33591
33995
|
if (path.length > 1) {
|
|
33592
33996
|
updatePath(path.slice(0, path.length - 1));
|
|
33593
33997
|
}
|
|
@@ -33602,8 +34006,8 @@ function usePagePath(defaultPath) {
|
|
|
33602
34006
|
}
|
|
33603
34007
|
|
|
33604
34008
|
// src/inspector/ui/global-styles.tsx
|
|
33605
|
-
import { styled as
|
|
33606
|
-
var GlobalStyles =
|
|
34009
|
+
import { styled as styled18 } from "goober";
|
|
34010
|
+
var GlobalStyles = styled18("div")`
|
|
33607
34011
|
/* Colors */
|
|
33608
34012
|
--j-primary-color: #146AFF;
|
|
33609
34013
|
--j-link-color: var(--j-primary-color);
|
|
@@ -33677,9 +34081,9 @@ var GlobalStyles = styled16("div")`
|
|
|
33677
34081
|
`;
|
|
33678
34082
|
|
|
33679
34083
|
// src/inspector/viewer/inspector-button.tsx
|
|
33680
|
-
var
|
|
33681
|
-
import { styled as
|
|
33682
|
-
var StyledInspectorButton =
|
|
34084
|
+
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
|
|
34085
|
+
import { styled as styled19 } from "goober";
|
|
34086
|
+
var StyledInspectorButton = styled19("button")`
|
|
33683
34087
|
position: fixed;
|
|
33684
34088
|
width: 2.5rem;
|
|
33685
34089
|
height: 2.5rem;
|
|
@@ -33710,7 +34114,7 @@ var StyledInspectorButton = styled17("button")`
|
|
|
33710
34114
|
}
|
|
33711
34115
|
}}
|
|
33712
34116
|
`;
|
|
33713
|
-
var JazzIcon =
|
|
34117
|
+
var JazzIcon = styled19("svg")`
|
|
33714
34118
|
width: 100%;
|
|
33715
34119
|
height: auto;
|
|
33716
34120
|
position: relative;
|
|
@@ -33721,8 +34125,8 @@ function InspectorButton({
|
|
|
33721
34125
|
position = "right",
|
|
33722
34126
|
...buttonProps
|
|
33723
34127
|
}) {
|
|
33724
|
-
return /* @__PURE__ */ (0,
|
|
33725
|
-
/* @__PURE__ */ (0,
|
|
34128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(StyledInspectorButton, { position, ...buttonProps, children: [
|
|
34129
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
33726
34130
|
JazzIcon,
|
|
33727
34131
|
{
|
|
33728
34132
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -33730,7 +34134,7 @@ function InspectorButton({
|
|
|
33730
34134
|
height: "115",
|
|
33731
34135
|
viewBox: "0 0 119 115",
|
|
33732
34136
|
fill: "none",
|
|
33733
|
-
children: /* @__PURE__ */ (0,
|
|
34137
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
33734
34138
|
"path",
|
|
33735
34139
|
{
|
|
33736
34140
|
fillRule: "evenodd",
|
|
@@ -33741,7 +34145,7 @@ function InspectorButton({
|
|
|
33741
34145
|
)
|
|
33742
34146
|
}
|
|
33743
34147
|
),
|
|
33744
|
-
/* @__PURE__ */ (0,
|
|
34148
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
33745
34149
|
"span",
|
|
33746
34150
|
{
|
|
33747
34151
|
style: {
|
|
@@ -33762,148 +34166,30 @@ function InspectorButton({
|
|
|
33762
34166
|
}
|
|
33763
34167
|
|
|
33764
34168
|
// src/inspector/viewer/use-open-inspector.ts
|
|
33765
|
-
var
|
|
34169
|
+
var import_react17 = __toESM(require_react(), 1);
|
|
33766
34170
|
var STORAGE_KEY2 = "jazz-inspector-open";
|
|
33767
34171
|
function useOpenInspector() {
|
|
33768
|
-
const [open, setOpen] = (0,
|
|
34172
|
+
const [open, setOpen] = (0, import_react17.useState)(() => {
|
|
33769
34173
|
if (typeof window === "undefined") return false;
|
|
33770
34174
|
const stored = localStorage.getItem(STORAGE_KEY2);
|
|
33771
34175
|
return stored ? JSON.parse(stored) : false;
|
|
33772
34176
|
});
|
|
33773
|
-
(0,
|
|
34177
|
+
(0, import_react17.useEffect)(() => {
|
|
33774
34178
|
localStorage.setItem(STORAGE_KEY2, JSON.stringify(open));
|
|
33775
34179
|
}, [open]);
|
|
33776
34180
|
return [open, setOpen];
|
|
33777
34181
|
}
|
|
33778
34182
|
|
|
33779
|
-
// src/inspector/ui/modal.tsx
|
|
33780
|
-
var import_react15 = __toESM(require_react(), 1);
|
|
33781
|
-
import { styled as styled18 } from "goober";
|
|
33782
|
-
var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
|
|
33783
|
-
var ModalContent = styled18("dialog")`
|
|
33784
|
-
background-color: var(--j-background);
|
|
33785
|
-
border-radius: var(--j-radius-lg);
|
|
33786
|
-
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
|
33787
|
-
border: 1px solid var(--j-border-color);
|
|
33788
|
-
max-width: 32rem;
|
|
33789
|
-
margin-block: auto;
|
|
33790
|
-
margin-inline: auto;
|
|
33791
|
-
&::backdrop {
|
|
33792
|
-
background-color: rgba(0, 0, 0, 0.7);
|
|
33793
|
-
}
|
|
33794
|
-
|
|
33795
|
-
`;
|
|
33796
|
-
var ModalHeader = styled18("div")`
|
|
33797
|
-
display: flex;
|
|
33798
|
-
justify-content: space-between;
|
|
33799
|
-
align-items: flex-start;
|
|
33800
|
-
padding: 1.5rem 1.5rem 0 1.5rem;
|
|
33801
|
-
gap: 1rem;
|
|
33802
|
-
`;
|
|
33803
|
-
var ModalBody = styled18("div")`
|
|
33804
|
-
padding: 1rem 1.5rem;
|
|
33805
|
-
flex: 1;
|
|
33806
|
-
`;
|
|
33807
|
-
var ModalFooter = styled18("div")`
|
|
33808
|
-
display: flex;
|
|
33809
|
-
justify-content: flex-end;
|
|
33810
|
-
gap: 0.75rem;
|
|
33811
|
-
padding: 0 1.5rem 1.5rem 1.5rem;
|
|
33812
|
-
`;
|
|
33813
|
-
var CloseButton = styled18("button")`
|
|
33814
|
-
background: none;
|
|
33815
|
-
border: none;
|
|
33816
|
-
cursor: pointer;
|
|
33817
|
-
padding: 0.25rem;
|
|
33818
|
-
border-radius: var(--j-radius-sm);
|
|
33819
|
-
color: var(--j-text-color);
|
|
33820
|
-
font-size: 1.25rem;
|
|
33821
|
-
line-height: 1;
|
|
33822
|
-
display: flex;
|
|
33823
|
-
align-items: center;
|
|
33824
|
-
justify-content: center;
|
|
33825
|
-
min-width: 2rem;
|
|
33826
|
-
min-height: 2rem;
|
|
33827
|
-
|
|
33828
|
-
&:hover {
|
|
33829
|
-
background-color: var(--j-foreground);
|
|
33830
|
-
}
|
|
33831
|
-
|
|
33832
|
-
&:focus-visible {
|
|
33833
|
-
outline: 2px solid var(--j-border-focus);
|
|
33834
|
-
outline-offset: 2px;
|
|
33835
|
-
}
|
|
33836
|
-
`;
|
|
33837
|
-
var Modal = (0, import_react15.forwardRef)(
|
|
33838
|
-
({
|
|
33839
|
-
isOpen,
|
|
33840
|
-
onClose,
|
|
33841
|
-
heading,
|
|
33842
|
-
text,
|
|
33843
|
-
children,
|
|
33844
|
-
confirmText = "Confirm",
|
|
33845
|
-
cancelText = "Cancel",
|
|
33846
|
-
onConfirm,
|
|
33847
|
-
onCancel,
|
|
33848
|
-
showButtons = true,
|
|
33849
|
-
className
|
|
33850
|
-
}, ref) => {
|
|
33851
|
-
const modalRef = (0, import_react15.useRef)(null);
|
|
33852
|
-
(0, import_react15.useEffect)(() => {
|
|
33853
|
-
if (isOpen) {
|
|
33854
|
-
modalRef.current?.showModal();
|
|
33855
|
-
} else {
|
|
33856
|
-
onClose();
|
|
33857
|
-
modalRef.current?.close();
|
|
33858
|
-
}
|
|
33859
|
-
}, [isOpen, onClose]);
|
|
33860
|
-
const handleConfirm = () => {
|
|
33861
|
-
onConfirm?.();
|
|
33862
|
-
onClose();
|
|
33863
|
-
};
|
|
33864
|
-
const handleCancel = () => {
|
|
33865
|
-
onCancel?.();
|
|
33866
|
-
onClose();
|
|
33867
|
-
};
|
|
33868
|
-
if (!isOpen) return null;
|
|
33869
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
33870
|
-
ModalContent,
|
|
33871
|
-
{
|
|
33872
|
-
ref: ref || modalRef,
|
|
33873
|
-
className,
|
|
33874
|
-
role: "dialog",
|
|
33875
|
-
"aria-labelledby": "modal-heading",
|
|
33876
|
-
onClose,
|
|
33877
|
-
children: [
|
|
33878
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(ModalHeader, { children: [
|
|
33879
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Heading, { id: "modal-heading", children: heading }),
|
|
33880
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CloseButton, { onClick: onClose, "aria-label": "Close modal", type: "button", children: "\xD7" })
|
|
33881
|
-
] }),
|
|
33882
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(ModalBody, { children: [
|
|
33883
|
-
text && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { style: { margin: "0 0 1rem 0", color: "var(--j-text-color)" }, children: text }),
|
|
33884
|
-
children
|
|
33885
|
-
] }),
|
|
33886
|
-
showButtons && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(ModalFooter, { children: [
|
|
33887
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { variant: "secondary", onClick: handleCancel, children: cancelText }),
|
|
33888
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { variant: "primary", onClick: handleConfirm, children: confirmText })
|
|
33889
|
-
] })
|
|
33890
|
-
]
|
|
33891
|
-
}
|
|
33892
|
-
);
|
|
33893
|
-
}
|
|
33894
|
-
);
|
|
33895
|
-
Modal.displayName = "Modal";
|
|
33896
|
-
|
|
33897
34183
|
// src/inspector/viewer/delete-local-data.tsx
|
|
33898
|
-
var
|
|
33899
|
-
var
|
|
34184
|
+
var import_react18 = __toESM(require_react(), 1);
|
|
34185
|
+
var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
|
|
33900
34186
|
var DELETE_LOCAL_DATA_STRING = "delete my local data";
|
|
33901
34187
|
function DeleteLocalData() {
|
|
33902
|
-
const [showDeleteModal, setShowDeleteModal] = (0,
|
|
33903
|
-
const [confirmDeleteString, setConfirmDeleteString] = (0,
|
|
33904
|
-
return /* @__PURE__ */ (0,
|
|
33905
|
-
/* @__PURE__ */ (0,
|
|
33906
|
-
/* @__PURE__ */ (0,
|
|
34188
|
+
const [showDeleteModal, setShowDeleteModal] = (0, import_react18.useState)(false);
|
|
34189
|
+
const [confirmDeleteString, setConfirmDeleteString] = (0, import_react18.useState)("");
|
|
34190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
34191
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { variant: "destructive", onClick: () => setShowDeleteModal(true), children: "Delete my local data" }),
|
|
34192
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
33907
34193
|
Modal,
|
|
33908
34194
|
{
|
|
33909
34195
|
isOpen: showDeleteModal,
|
|
@@ -33911,7 +34197,7 @@ function DeleteLocalData() {
|
|
|
33911
34197
|
heading: "Delete Local Data",
|
|
33912
34198
|
showButtons: false,
|
|
33913
34199
|
children: [
|
|
33914
|
-
/* @__PURE__ */ (0,
|
|
34200
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
33915
34201
|
"div",
|
|
33916
34202
|
{
|
|
33917
34203
|
style: {
|
|
@@ -33922,33 +34208,33 @@ function DeleteLocalData() {
|
|
|
33922
34208
|
gap: "0.5rem"
|
|
33923
34209
|
},
|
|
33924
34210
|
children: [
|
|
33925
|
-
/* @__PURE__ */ (0,
|
|
34211
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("p", { children: [
|
|
33926
34212
|
"This action ",
|
|
33927
|
-
/* @__PURE__ */ (0,
|
|
34213
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("strong", { children: "cannot" }),
|
|
33928
34214
|
" be undone."
|
|
33929
34215
|
] }),
|
|
33930
|
-
/* @__PURE__ */ (0,
|
|
34216
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("p", { children: [
|
|
33931
34217
|
"Be aware that the following data will be",
|
|
33932
34218
|
" ",
|
|
33933
|
-
/* @__PURE__ */ (0,
|
|
34219
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("strong", { children: "permanently" }),
|
|
33934
34220
|
" deleted:"
|
|
33935
34221
|
] }),
|
|
33936
|
-
/* @__PURE__ */ (0,
|
|
33937
|
-
/* @__PURE__ */ (0,
|
|
34222
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("ul", { style: { listStyleType: "disc", paddingLeft: "1rem" }, children: [
|
|
34223
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("li", { children: [
|
|
33938
34224
|
"Unsynced data for ",
|
|
33939
|
-
/* @__PURE__ */ (0,
|
|
34225
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("strong", { children: "all apps" }),
|
|
33940
34226
|
" on",
|
|
33941
34227
|
" ",
|
|
33942
|
-
/* @__PURE__ */ (0,
|
|
34228
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("code", { children: window.location.origin })
|
|
33943
34229
|
] }),
|
|
33944
|
-
/* @__PURE__ */ (0,
|
|
33945
|
-
/* @__PURE__ */ (0,
|
|
34230
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("li", { children: "Accounts" }),
|
|
34231
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("li", { children: "Logged in sessions" })
|
|
33946
34232
|
] }),
|
|
33947
|
-
/* @__PURE__ */ (0,
|
|
34233
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", {})
|
|
33948
34234
|
]
|
|
33949
34235
|
}
|
|
33950
34236
|
),
|
|
33951
|
-
/* @__PURE__ */ (0,
|
|
34237
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33952
34238
|
Input,
|
|
33953
34239
|
{
|
|
33954
34240
|
label: `Type "${DELETE_LOCAL_DATA_STRING}" to confirm`,
|
|
@@ -33959,7 +34245,7 @@ function DeleteLocalData() {
|
|
|
33959
34245
|
}
|
|
33960
34246
|
}
|
|
33961
34247
|
),
|
|
33962
|
-
/* @__PURE__ */ (0,
|
|
34248
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33963
34249
|
"p",
|
|
33964
34250
|
{
|
|
33965
34251
|
style: {
|
|
@@ -33969,14 +34255,14 @@ function DeleteLocalData() {
|
|
|
33969
34255
|
flexDirection: "column",
|
|
33970
34256
|
gap: "0.5rem"
|
|
33971
34257
|
},
|
|
33972
|
-
children: /* @__PURE__ */ (0,
|
|
34258
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("small", { children: [
|
|
33973
34259
|
"Data synced to a sync server will ",
|
|
33974
|
-
/* @__PURE__ */ (0,
|
|
34260
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("strong", { children: "not" }),
|
|
33975
34261
|
" be deleted, and will be synced when you log in again."
|
|
33976
34262
|
] })
|
|
33977
34263
|
}
|
|
33978
34264
|
),
|
|
33979
|
-
/* @__PURE__ */ (0,
|
|
34265
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
33980
34266
|
"div",
|
|
33981
34267
|
{
|
|
33982
34268
|
style: {
|
|
@@ -33986,8 +34272,8 @@ function DeleteLocalData() {
|
|
|
33986
34272
|
gap: "0.5rem"
|
|
33987
34273
|
},
|
|
33988
34274
|
children: [
|
|
33989
|
-
/* @__PURE__ */ (0,
|
|
33990
|
-
/* @__PURE__ */ (0,
|
|
34275
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { variant: "secondary", onClick: () => setShowDeleteModal(false), children: "Cancel" }),
|
|
34276
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33991
34277
|
Button,
|
|
33992
34278
|
{
|
|
33993
34279
|
variant: "destructive",
|
|
@@ -34014,8 +34300,8 @@ function DeleteLocalData() {
|
|
|
34014
34300
|
}
|
|
34015
34301
|
|
|
34016
34302
|
// src/inspector/viewer/new-app.tsx
|
|
34017
|
-
var
|
|
34018
|
-
var InspectorContainer =
|
|
34303
|
+
var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
|
|
34304
|
+
var InspectorContainer = styled20("div")`
|
|
34019
34305
|
position: fixed;
|
|
34020
34306
|
height: 50vh;
|
|
34021
34307
|
max-height: 800px;
|
|
@@ -34032,17 +34318,17 @@ var InspectorContainer = styled19("div")`
|
|
|
34032
34318
|
background-color: var(--j-background);
|
|
34033
34319
|
}
|
|
34034
34320
|
`;
|
|
34035
|
-
var HeaderContainer2 =
|
|
34321
|
+
var HeaderContainer2 = styled20("div")`
|
|
34036
34322
|
display: flex;
|
|
34037
34323
|
align-items: center;
|
|
34038
34324
|
gap: 1rem;
|
|
34039
34325
|
padding: 0 0.75rem;
|
|
34040
34326
|
margin: 0.75rem 0;
|
|
34041
34327
|
`;
|
|
34042
|
-
var Form =
|
|
34328
|
+
var Form = styled20("form")`
|
|
34043
34329
|
width: 24rem;
|
|
34044
34330
|
`;
|
|
34045
|
-
var InitialForm =
|
|
34331
|
+
var InitialForm = styled20("form")`
|
|
34046
34332
|
display: flex;
|
|
34047
34333
|
flex-direction: column;
|
|
34048
34334
|
position: relative;
|
|
@@ -34054,7 +34340,7 @@ var InitialForm = styled19("form")`
|
|
|
34054
34340
|
max-width: 24rem;
|
|
34055
34341
|
margin: 0 auto;
|
|
34056
34342
|
`;
|
|
34057
|
-
var OrText =
|
|
34343
|
+
var OrText = styled20("p")`
|
|
34058
34344
|
text-align: center;
|
|
34059
34345
|
`;
|
|
34060
34346
|
function JazzInspectorInternal({
|
|
@@ -34063,7 +34349,7 @@ function JazzInspectorInternal({
|
|
|
34063
34349
|
accountId
|
|
34064
34350
|
}) {
|
|
34065
34351
|
const [open, setOpen] = useOpenInspector();
|
|
34066
|
-
const [coValueId, setCoValueId] = (0,
|
|
34352
|
+
const [coValueId, setCoValueId] = (0, import_react19.useState)("");
|
|
34067
34353
|
const { path, addPages, goToIndex, goBack, setPage } = usePagePath();
|
|
34068
34354
|
const handleCoValueIdSubmit = (e) => {
|
|
34069
34355
|
e.preventDefault();
|
|
@@ -34073,12 +34359,12 @@ function JazzInspectorInternal({
|
|
|
34073
34359
|
setCoValueId("");
|
|
34074
34360
|
};
|
|
34075
34361
|
if (!open) {
|
|
34076
|
-
return /* @__PURE__ */ (0,
|
|
34362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(InspectorButton, { position, onClick: () => setOpen(true) });
|
|
34077
34363
|
}
|
|
34078
|
-
return /* @__PURE__ */ (0,
|
|
34079
|
-
/* @__PURE__ */ (0,
|
|
34080
|
-
/* @__PURE__ */ (0,
|
|
34081
|
-
/* @__PURE__ */ (0,
|
|
34364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(InspectorContainer, { as: GlobalStyles, style: { zIndex: 999 }, children: [
|
|
34365
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(HeaderContainer2, { children: [
|
|
34366
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Breadcrumbs, { path, onBreadcrumbClick: goToIndex }),
|
|
34367
|
+
path.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Form, { onSubmit: handleCoValueIdSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
34082
34368
|
Input,
|
|
34083
34369
|
{
|
|
34084
34370
|
label: "CoValue ID",
|
|
@@ -34089,24 +34375,24 @@ function JazzInspectorInternal({
|
|
|
34089
34375
|
onChange: (e) => setCoValueId(e.target.value)
|
|
34090
34376
|
}
|
|
34091
34377
|
) }),
|
|
34092
|
-
/* @__PURE__ */ (0,
|
|
34093
|
-
/* @__PURE__ */ (0,
|
|
34378
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DeleteLocalData, {}),
|
|
34379
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Button, { variant: "plain", type: "button", onClick: () => setOpen(false), children: "Close" })
|
|
34094
34380
|
] }),
|
|
34095
|
-
/* @__PURE__ */ (0,
|
|
34381
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
34096
34382
|
PageStack,
|
|
34097
34383
|
{
|
|
34098
34384
|
path,
|
|
34099
34385
|
node: localNode,
|
|
34100
34386
|
goBack,
|
|
34101
34387
|
addPages,
|
|
34102
|
-
children: path.length <= 0 && /* @__PURE__ */ (0,
|
|
34388
|
+
children: path.length <= 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
34103
34389
|
InitialForm,
|
|
34104
34390
|
{
|
|
34105
34391
|
onSubmit: handleCoValueIdSubmit,
|
|
34106
34392
|
"aria-hidden": path.length !== 0,
|
|
34107
34393
|
children: [
|
|
34108
|
-
/* @__PURE__ */ (0,
|
|
34109
|
-
/* @__PURE__ */ (0,
|
|
34394
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Heading, { children: "Jazz CoValue Inspector" }),
|
|
34395
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
34110
34396
|
Input,
|
|
34111
34397
|
{
|
|
34112
34398
|
label: "CoValue ID",
|
|
@@ -34117,10 +34403,10 @@ function JazzInspectorInternal({
|
|
|
34117
34403
|
onChange: (e) => setCoValueId(e.target.value)
|
|
34118
34404
|
}
|
|
34119
34405
|
),
|
|
34120
|
-
/* @__PURE__ */ (0,
|
|
34121
|
-
accountId && /* @__PURE__ */ (0,
|
|
34122
|
-
/* @__PURE__ */ (0,
|
|
34123
|
-
/* @__PURE__ */ (0,
|
|
34406
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Button, { type: "submit", variant: "primary", children: "Inspect CoValue" }),
|
|
34407
|
+
accountId && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
34408
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(OrText, { children: "or" }),
|
|
34409
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
34124
34410
|
Button,
|
|
34125
34411
|
{
|
|
34126
34412
|
variant: "secondary",
|
|
@@ -34141,8 +34427,8 @@ function JazzInspectorInternal({
|
|
|
34141
34427
|
}
|
|
34142
34428
|
|
|
34143
34429
|
// src/inspector/custom-element.tsx
|
|
34144
|
-
var
|
|
34145
|
-
setup(
|
|
34430
|
+
var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
|
|
34431
|
+
setup(import_react20.default.createElement);
|
|
34146
34432
|
var JazzInspectorElement = class extends HTMLElement {
|
|
34147
34433
|
constructor() {
|
|
34148
34434
|
super(...arguments);
|
|
@@ -34184,7 +34470,7 @@ var JazzInspectorElement = class extends HTMLElement {
|
|
|
34184
34470
|
return;
|
|
34185
34471
|
}
|
|
34186
34472
|
this.root?.render(
|
|
34187
|
-
/* @__PURE__ */ (0,
|
|
34473
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
34188
34474
|
JazzInspectorInternal,
|
|
34189
34475
|
{
|
|
34190
34476
|
localNode: this.account.$jazz.localNode,
|
|
@@ -34310,4 +34596,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
34310
34596
|
* LICENSE file in the root directory of this source tree.
|
|
34311
34597
|
*)
|
|
34312
34598
|
*/
|
|
34313
|
-
//# sourceMappingURL=custom-element-
|
|
34599
|
+
//# sourceMappingURL=custom-element-RQTLPAPJ.js.map
|