jazz-tools 0.18.31 → 0.18.33
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 +1 -1
- package/.svelte-kit/__package__/tests/media/image.svelte.test.js +1 -1
- package/.turbo/turbo-build.log +58 -58
- package/CHANGELOG.md +23 -0
- package/dist/{chunk-6BIYT3KH.js → chunk-OSQ7S47Q.js} +3 -3
- package/dist/chunk-OSQ7S47Q.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/inspector/{custom-element-RQTLPAPJ.js → custom-element-RBBL46TI.js} +636 -193
- package/dist/inspector/custom-element-RBBL46TI.js.map +1 -0
- package/dist/inspector/index.js +626 -183
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/register-custom-element.js +1 -1
- package/dist/inspector/tests/ui/data-table.test.d.ts +2 -0
- package/dist/inspector/tests/ui/data-table.test.d.ts.map +1 -0
- package/dist/inspector/tests/viewer/history-view.test.d.ts +2 -0
- package/dist/inspector/tests/viewer/history-view.test.d.ts.map +1 -0
- package/dist/inspector/ui/data-table.d.ts +23 -0
- package/dist/inspector/ui/data-table.d.ts.map +1 -0
- package/dist/inspector/ui/index.d.ts +1 -0
- package/dist/inspector/ui/index.d.ts.map +1 -1
- package/dist/inspector/viewer/history-view.d.ts +6 -0
- package/dist/inspector/viewer/history-view.d.ts.map +1 -0
- package/dist/inspector/viewer/page.d.ts.map +1 -1
- package/dist/svelte/media/image.svelte +1 -1
- package/dist/svelte/tests/media/image.svelte.test.js +1 -1
- package/dist/testing.js +1 -1
- package/dist/tools/coValues/coFeed.d.ts +1 -1
- package/dist/tools/coValues/coFeed.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts +2 -2
- package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts.map +1 -1
- package/dist/worker/index.d.ts +2 -1
- package/dist/worker/index.d.ts.map +1 -1
- package/dist/worker/index.js +2 -1
- package/dist/worker/index.js.map +1 -1
- package/package.json +4 -4
- package/src/inspector/tests/ui/data-table.test.tsx +296 -0
- package/src/inspector/tests/viewer/history-view.test.tsx +246 -0
- package/src/inspector/ui/data-table.tsx +265 -0
- package/src/inspector/ui/index.ts +1 -0
- package/src/inspector/viewer/history-view.tsx +379 -0
- package/src/inspector/viewer/page.tsx +2 -0
- package/src/media/create-image-factory.test.ts +2 -2
- package/src/svelte/media/image.svelte +1 -1
- package/src/svelte/tests/media/image.svelte.test.ts +1 -1
- package/src/tools/coValues/coFeed.ts +2 -2
- package/src/tools/coValues/interfaces.ts +1 -1
- package/src/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.ts +1 -1
- package/src/tools/tests/CoValueCoreSubscription.test.ts +1 -1
- package/src/tools/tests/coFeed.test.ts +1 -1
- package/src/tools/tests/load.test.ts +1 -1
- package/src/worker/index.ts +9 -1
- package/dist/chunk-6BIYT3KH.js.map +0 -1
- package/dist/inspector/custom-element-RQTLPAPJ.js.map +0 -1
|
@@ -31782,14 +31782,14 @@ var require_jsx_runtime = __commonJS({
|
|
|
31782
31782
|
});
|
|
31783
31783
|
|
|
31784
31784
|
// src/inspector/custom-element.tsx
|
|
31785
|
-
var
|
|
31785
|
+
var import_react22 = __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_react21 = __toESM(require_react(), 1);
|
|
31792
|
+
import { styled as styled21 } 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 styled18 } from "goober";
|
|
31968
31968
|
|
|
31969
31969
|
// src/inspector/viewer/page.tsx
|
|
31970
|
-
var
|
|
31971
|
-
import { styled as
|
|
31970
|
+
var import_react17 = __toESM(require_react(), 1);
|
|
31971
|
+
import { styled as styled17 } from "goober";
|
|
31972
31972
|
|
|
31973
31973
|
// src/inspector/ui/badge.tsx
|
|
31974
31974
|
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -33058,7 +33058,7 @@ function CoPlainTextView({ data }) {
|
|
|
33058
33058
|
}
|
|
33059
33059
|
|
|
33060
33060
|
// src/inspector/viewer/group-view.tsx
|
|
33061
|
-
var
|
|
33061
|
+
var import_react14 = __toESM(require_react(), 1);
|
|
33062
33062
|
|
|
33063
33063
|
// src/inspector/ui/table.tsx
|
|
33064
33064
|
var import_react10 = __toESM(require_react(), 1);
|
|
@@ -33272,8 +33272,205 @@ function Select(props) {
|
|
|
33272
33272
|
] });
|
|
33273
33273
|
}
|
|
33274
33274
|
|
|
33275
|
-
// src/inspector/
|
|
33275
|
+
// src/inspector/ui/data-table.tsx
|
|
33276
|
+
var import_react13 = __toESM(require_react(), 1);
|
|
33276
33277
|
var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
|
|
33278
|
+
function DataTable({
|
|
33279
|
+
columns,
|
|
33280
|
+
data,
|
|
33281
|
+
pageSize = 10,
|
|
33282
|
+
initialSort = null,
|
|
33283
|
+
getRowKey,
|
|
33284
|
+
emptyMessage = "No data available"
|
|
33285
|
+
}) {
|
|
33286
|
+
const [currentPage, setCurrentPage] = (0, import_react13.useState)(1);
|
|
33287
|
+
const [sortConfig, setSortConfig] = (0, import_react13.useState)(initialSort);
|
|
33288
|
+
const [filters, setFilters] = (0, import_react13.useState)({});
|
|
33289
|
+
const filteredData = (0, import_react13.useMemo)(() => {
|
|
33290
|
+
return data.filter((row) => {
|
|
33291
|
+
return Object.entries(filters).every(([columnId, filterValue]) => {
|
|
33292
|
+
if (!filterValue) return true;
|
|
33293
|
+
const column = columns.find((col) => col.id === columnId);
|
|
33294
|
+
if (!column?.filterable) return true;
|
|
33295
|
+
if (column.filterFn) {
|
|
33296
|
+
return column.filterFn(row, filterValue);
|
|
33297
|
+
}
|
|
33298
|
+
const cellValue = String(column.accessor(row));
|
|
33299
|
+
return cellValue.toLowerCase().includes(filterValue.toLowerCase());
|
|
33300
|
+
});
|
|
33301
|
+
});
|
|
33302
|
+
}, [data, filters, columns]);
|
|
33303
|
+
const sortedData = (0, import_react13.useMemo)(() => {
|
|
33304
|
+
if (!sortConfig) return filteredData;
|
|
33305
|
+
const column = columns.find((col) => col.id === sortConfig.columnId);
|
|
33306
|
+
if (!column?.sortable) return filteredData;
|
|
33307
|
+
const sorted = [...filteredData].sort((a, b) => {
|
|
33308
|
+
if (column.sortFn) {
|
|
33309
|
+
return column.sortFn(a, b);
|
|
33310
|
+
}
|
|
33311
|
+
const aValue = String(column.accessor(a));
|
|
33312
|
+
const bValue = String(column.accessor(b));
|
|
33313
|
+
return aValue.localeCompare(bValue);
|
|
33314
|
+
});
|
|
33315
|
+
return sortConfig.direction === "desc" ? sorted.reverse() : sorted;
|
|
33316
|
+
}, [filteredData, sortConfig, columns]);
|
|
33317
|
+
const totalPages = Math.ceil(sortedData.length / pageSize);
|
|
33318
|
+
const showPagination = sortedData.length > pageSize;
|
|
33319
|
+
const startIndex = (currentPage - 1) * pageSize;
|
|
33320
|
+
const endIndex = startIndex + pageSize;
|
|
33321
|
+
const paginatedData = sortedData.slice(startIndex, endIndex);
|
|
33322
|
+
(0, import_react13.useEffect)(() => {
|
|
33323
|
+
setCurrentPage(1);
|
|
33324
|
+
}, [filters]);
|
|
33325
|
+
const handleSort = (columnId) => {
|
|
33326
|
+
const column = columns.find((col) => col.id === columnId);
|
|
33327
|
+
if (!column?.sortable) return;
|
|
33328
|
+
setSortConfig((current) => {
|
|
33329
|
+
if (current?.columnId === columnId) {
|
|
33330
|
+
if (current.direction === "asc") {
|
|
33331
|
+
return { columnId, direction: "desc" };
|
|
33332
|
+
}
|
|
33333
|
+
return null;
|
|
33334
|
+
}
|
|
33335
|
+
return { columnId, direction: "asc" };
|
|
33336
|
+
});
|
|
33337
|
+
};
|
|
33338
|
+
const handleFilterChange = (columnId, value) => {
|
|
33339
|
+
setFilters((current) => ({
|
|
33340
|
+
...current,
|
|
33341
|
+
[columnId]: value
|
|
33342
|
+
}));
|
|
33343
|
+
};
|
|
33344
|
+
const handlePageChange = (page) => {
|
|
33345
|
+
setCurrentPage(Math.max(1, Math.min(page, totalPages)));
|
|
33346
|
+
};
|
|
33347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
33348
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Table, { children: [
|
|
33349
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableRow, { children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
33350
|
+
"div",
|
|
33351
|
+
{
|
|
33352
|
+
style: {
|
|
33353
|
+
display: "flex",
|
|
33354
|
+
alignItems: "center",
|
|
33355
|
+
gap: "8px",
|
|
33356
|
+
cursor: column.sortable ? "pointer" : "default"
|
|
33357
|
+
},
|
|
33358
|
+
onClick: () => handleSort(column.id),
|
|
33359
|
+
children: [
|
|
33360
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: column.header }),
|
|
33361
|
+
column.sortable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33362
|
+
"span",
|
|
33363
|
+
{
|
|
33364
|
+
style: {
|
|
33365
|
+
fontSize: "12px",
|
|
33366
|
+
opacity: 0.7
|
|
33367
|
+
},
|
|
33368
|
+
children: sortConfig?.columnId === column.id ? sortConfig.direction === "asc" ? "\u2191" : "\u2193" : "\u2195"
|
|
33369
|
+
}
|
|
33370
|
+
)
|
|
33371
|
+
]
|
|
33372
|
+
}
|
|
33373
|
+
) }, column.id)) }) }),
|
|
33374
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(TableBody, { children: [
|
|
33375
|
+
columns.some((column) => column.filterable) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableRow, { children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { children: column.filterable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33376
|
+
Input,
|
|
33377
|
+
{
|
|
33378
|
+
label: "Filter",
|
|
33379
|
+
hideLabel: true,
|
|
33380
|
+
type: "search",
|
|
33381
|
+
placeholder: `Filter ${column.header.toLowerCase()}`,
|
|
33382
|
+
value: filters[column.id] || "",
|
|
33383
|
+
onChange: (e) => handleFilterChange(column.id, e.target.value),
|
|
33384
|
+
onClick: (e) => e.stopPropagation()
|
|
33385
|
+
}
|
|
33386
|
+
) }, column.id)) }),
|
|
33387
|
+
paginatedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33388
|
+
"div",
|
|
33389
|
+
{
|
|
33390
|
+
style: {
|
|
33391
|
+
textAlign: "center",
|
|
33392
|
+
padding: "20px",
|
|
33393
|
+
opacity: 0.6
|
|
33394
|
+
},
|
|
33395
|
+
children: emptyMessage
|
|
33396
|
+
}
|
|
33397
|
+
) }) }) : paginatedData.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableRow, { children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { children: column.accessor(row) }, column.id)) }, getRowKey(row, startIndex + index)))
|
|
33398
|
+
] })
|
|
33399
|
+
] }),
|
|
33400
|
+
showPagination && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
33401
|
+
"div",
|
|
33402
|
+
{
|
|
33403
|
+
style: {
|
|
33404
|
+
display: "flex",
|
|
33405
|
+
justifyContent: "space-between",
|
|
33406
|
+
alignItems: "center",
|
|
33407
|
+
marginTop: "16px",
|
|
33408
|
+
padding: "8px 0"
|
|
33409
|
+
},
|
|
33410
|
+
children: [
|
|
33411
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { fontSize: "14px", opacity: 0.7 }, children: [
|
|
33412
|
+
"Showing ",
|
|
33413
|
+
startIndex + 1,
|
|
33414
|
+
" to ",
|
|
33415
|
+
Math.min(endIndex, sortedData.length),
|
|
33416
|
+
" ",
|
|
33417
|
+
"of ",
|
|
33418
|
+
sortedData.length,
|
|
33419
|
+
" entries",
|
|
33420
|
+
Object.keys(filters).some((key) => filters[key]) && ` (filtered from ${data.length})`
|
|
33421
|
+
] }),
|
|
33422
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
|
|
33423
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33424
|
+
Button,
|
|
33425
|
+
{
|
|
33426
|
+
variant: "secondary",
|
|
33427
|
+
onClick: () => handlePageChange(1),
|
|
33428
|
+
disabled: currentPage === 1,
|
|
33429
|
+
children: "\xAB\xAB"
|
|
33430
|
+
}
|
|
33431
|
+
),
|
|
33432
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33433
|
+
Button,
|
|
33434
|
+
{
|
|
33435
|
+
variant: "secondary",
|
|
33436
|
+
onClick: () => handlePageChange(currentPage - 1),
|
|
33437
|
+
disabled: currentPage === 1,
|
|
33438
|
+
children: "\xAB"
|
|
33439
|
+
}
|
|
33440
|
+
),
|
|
33441
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { style: { fontSize: "14px" }, children: [
|
|
33442
|
+
"Page ",
|
|
33443
|
+
currentPage,
|
|
33444
|
+
" of ",
|
|
33445
|
+
totalPages
|
|
33446
|
+
] }),
|
|
33447
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33448
|
+
Button,
|
|
33449
|
+
{
|
|
33450
|
+
variant: "secondary",
|
|
33451
|
+
onClick: () => handlePageChange(currentPage + 1),
|
|
33452
|
+
disabled: currentPage === totalPages,
|
|
33453
|
+
children: "\xBB"
|
|
33454
|
+
}
|
|
33455
|
+
),
|
|
33456
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
33457
|
+
Button,
|
|
33458
|
+
{
|
|
33459
|
+
variant: "secondary",
|
|
33460
|
+
onClick: () => handlePageChange(totalPages),
|
|
33461
|
+
disabled: currentPage === totalPages,
|
|
33462
|
+
children: "\xBB\xBB"
|
|
33463
|
+
}
|
|
33464
|
+
)
|
|
33465
|
+
] })
|
|
33466
|
+
]
|
|
33467
|
+
}
|
|
33468
|
+
)
|
|
33469
|
+
] });
|
|
33470
|
+
}
|
|
33471
|
+
|
|
33472
|
+
// src/inspector/viewer/group-view.tsx
|
|
33473
|
+
var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
|
|
33277
33474
|
function partitionMembers(data) {
|
|
33278
33475
|
const everyone = Object.entries(data).filter(([key]) => key === "everyone").map(([key, value]) => ({
|
|
33279
33476
|
id: key,
|
|
@@ -33301,7 +33498,7 @@ function GroupView({
|
|
|
33301
33498
|
onNavigate,
|
|
33302
33499
|
node
|
|
33303
33500
|
}) {
|
|
33304
|
-
const [addMemberType, setAddMemberType] = (0,
|
|
33501
|
+
const [addMemberType, setAddMemberType] = (0, import_react14.useState)(null);
|
|
33305
33502
|
const { everyone, members, parentGroups, childGroups } = partitionMembers(
|
|
33306
33503
|
data
|
|
33307
33504
|
);
|
|
@@ -33380,28 +33577,28 @@ function GroupView({
|
|
|
33380
33577
|
alert(`Failed to add ${addMemberType}: ${error.message}`);
|
|
33381
33578
|
}
|
|
33382
33579
|
};
|
|
33383
|
-
return /* @__PURE__ */ (0,
|
|
33384
|
-
/* @__PURE__ */ (0,
|
|
33385
|
-
/* @__PURE__ */ (0,
|
|
33386
|
-
/* @__PURE__ */ (0,
|
|
33387
|
-
/* @__PURE__ */ (0,
|
|
33388
|
-
/* @__PURE__ */ (0,
|
|
33580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
33581
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Table, { children: [
|
|
33582
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(TableRow, { children: [
|
|
33583
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableHeader, { children: "Member" }),
|
|
33584
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableHeader, { children: "Permission" }),
|
|
33585
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableHeader, {})
|
|
33389
33586
|
] }) }),
|
|
33390
|
-
/* @__PURE__ */ (0,
|
|
33391
|
-
everyone.map((member) => /* @__PURE__ */ (0,
|
|
33392
|
-
/* @__PURE__ */ (0,
|
|
33393
|
-
/* @__PURE__ */ (0,
|
|
33394
|
-
/* @__PURE__ */ (0,
|
|
33587
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(TableBody, { children: [
|
|
33588
|
+
everyone.map((member) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(TableRow, { children: [
|
|
33589
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableCell, { children: member.id }),
|
|
33590
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableCell, { children: member.role }),
|
|
33591
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33395
33592
|
Button,
|
|
33396
33593
|
{
|
|
33397
33594
|
variant: "secondary",
|
|
33398
33595
|
onClick: () => onRemoveMember(member.id),
|
|
33399
|
-
children: /* @__PURE__ */ (0,
|
|
33596
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, { name: "delete" })
|
|
33400
33597
|
}
|
|
33401
33598
|
) })
|
|
33402
33599
|
] }, member.id)),
|
|
33403
|
-
members.map((member) => /* @__PURE__ */ (0,
|
|
33404
|
-
/* @__PURE__ */ (0,
|
|
33600
|
+
members.map((member) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(TableRow, { children: [
|
|
33601
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33405
33602
|
AccountOrGroupText,
|
|
33406
33603
|
{
|
|
33407
33604
|
coId: member.id,
|
|
@@ -33412,18 +33609,18 @@ function GroupView({
|
|
|
33412
33609
|
}
|
|
33413
33610
|
}
|
|
33414
33611
|
) }),
|
|
33415
|
-
/* @__PURE__ */ (0,
|
|
33416
|
-
/* @__PURE__ */ (0,
|
|
33612
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableCell, { children: member.role }),
|
|
33613
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33417
33614
|
Button,
|
|
33418
33615
|
{
|
|
33419
33616
|
variant: "secondary",
|
|
33420
33617
|
onClick: () => onRemoveMember(member.id),
|
|
33421
|
-
children: /* @__PURE__ */ (0,
|
|
33618
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, { name: "delete" })
|
|
33422
33619
|
}
|
|
33423
33620
|
) })
|
|
33424
33621
|
] }, member.id)),
|
|
33425
|
-
parentGroups.map((group) => /* @__PURE__ */ (0,
|
|
33426
|
-
/* @__PURE__ */ (0,
|
|
33622
|
+
parentGroups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(TableRow, { children: [
|
|
33623
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33427
33624
|
AccountOrGroupText,
|
|
33428
33625
|
{
|
|
33429
33626
|
coId: group.id,
|
|
@@ -33434,19 +33631,19 @@ function GroupView({
|
|
|
33434
33631
|
}
|
|
33435
33632
|
}
|
|
33436
33633
|
) }),
|
|
33437
|
-
/* @__PURE__ */ (0,
|
|
33438
|
-
/* @__PURE__ */ (0,
|
|
33634
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableCell, { children: group.role }),
|
|
33635
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableCell, { children: group.role !== "revoked" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33439
33636
|
Button,
|
|
33440
33637
|
{
|
|
33441
33638
|
variant: "secondary",
|
|
33442
33639
|
onClick: () => onRemoveGroup(group.id),
|
|
33443
|
-
children: /* @__PURE__ */ (0,
|
|
33640
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, { name: "delete" })
|
|
33444
33641
|
}
|
|
33445
33642
|
) })
|
|
33446
33643
|
] }, group.id))
|
|
33447
33644
|
] })
|
|
33448
33645
|
] }),
|
|
33449
|
-
/* @__PURE__ */ (0,
|
|
33646
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
33450
33647
|
"div",
|
|
33451
33648
|
{
|
|
33452
33649
|
style: {
|
|
@@ -33456,14 +33653,14 @@ function GroupView({
|
|
|
33456
33653
|
marginTop: "1rem"
|
|
33457
33654
|
},
|
|
33458
33655
|
children: [
|
|
33459
|
-
/* @__PURE__ */ (0,
|
|
33460
|
-
/* @__PURE__ */ (0,
|
|
33656
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { variant: "primary", onClick: () => setAddMemberType("account"), children: "Add Account" }),
|
|
33657
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { variant: "primary", onClick: () => setAddMemberType("group"), children: "Add Group" })
|
|
33461
33658
|
]
|
|
33462
33659
|
}
|
|
33463
33660
|
),
|
|
33464
|
-
childGroups.length > 0 && /* @__PURE__ */ (0,
|
|
33465
|
-
/* @__PURE__ */ (0,
|
|
33466
|
-
/* @__PURE__ */ (0,
|
|
33661
|
+
childGroups.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Table, { children: [
|
|
33662
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableHeader, { children: "Member of" }) }) }),
|
|
33663
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableBody, { children: childGroups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33467
33664
|
AccountOrGroupText,
|
|
33468
33665
|
{
|
|
33469
33666
|
coId: group.id,
|
|
@@ -33475,20 +33672,20 @@ function GroupView({
|
|
|
33475
33672
|
}
|
|
33476
33673
|
) }) }, group.id)) })
|
|
33477
33674
|
] }),
|
|
33478
|
-
/* @__PURE__ */ (0,
|
|
33479
|
-
/* @__PURE__ */ (0,
|
|
33675
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RawDataCard, { data }),
|
|
33676
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33480
33677
|
Modal,
|
|
33481
33678
|
{
|
|
33482
33679
|
isOpen: addMemberType !== null,
|
|
33483
33680
|
onClose: () => setAddMemberType(null),
|
|
33484
33681
|
heading: addMemberType === "account" ? "Add Account" : "Add Group",
|
|
33485
33682
|
showButtons: false,
|
|
33486
|
-
children: /* @__PURE__ */ (0,
|
|
33683
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("form", { onSubmit: handleAddMemberSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
33487
33684
|
"div",
|
|
33488
33685
|
{
|
|
33489
33686
|
style: { display: "flex", flexDirection: "column", gap: "1rem" },
|
|
33490
33687
|
children: [
|
|
33491
|
-
/* @__PURE__ */ (0,
|
|
33688
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33492
33689
|
Input,
|
|
33493
33690
|
{
|
|
33494
33691
|
name: "memberId",
|
|
@@ -33497,13 +33694,13 @@ function GroupView({
|
|
|
33497
33694
|
required: true
|
|
33498
33695
|
}
|
|
33499
33696
|
),
|
|
33500
|
-
/* @__PURE__ */ (0,
|
|
33501
|
-
/* @__PURE__ */ (0,
|
|
33502
|
-
/* @__PURE__ */ (0,
|
|
33503
|
-
/* @__PURE__ */ (0,
|
|
33504
|
-
addMemberType === "account" ? /* @__PURE__ */ (0,
|
|
33697
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Select, { name: "role", label: "Role", children: [
|
|
33698
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "reader", children: "Reader" }),
|
|
33699
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "writer", children: "Writer" }),
|
|
33700
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "admin", children: "Admin" }),
|
|
33701
|
+
addMemberType === "account" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "writeOnly", children: "Write Only" }) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "inherit", children: "Inherit" }) })
|
|
33505
33702
|
] }),
|
|
33506
|
-
/* @__PURE__ */ (0,
|
|
33703
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
33507
33704
|
"div",
|
|
33508
33705
|
{
|
|
33509
33706
|
style: {
|
|
@@ -33513,7 +33710,7 @@ function GroupView({
|
|
|
33513
33710
|
marginTop: "0.5rem"
|
|
33514
33711
|
},
|
|
33515
33712
|
children: [
|
|
33516
|
-
/* @__PURE__ */ (0,
|
|
33713
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
33517
33714
|
Button,
|
|
33518
33715
|
{
|
|
33519
33716
|
type: "button",
|
|
@@ -33522,7 +33719,7 @@ function GroupView({
|
|
|
33522
33719
|
children: "Cancel"
|
|
33523
33720
|
}
|
|
33524
33721
|
),
|
|
33525
|
-
/* @__PURE__ */ (0,
|
|
33722
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { type: "submit", variant: "primary", children: "Add" })
|
|
33526
33723
|
]
|
|
33527
33724
|
}
|
|
33528
33725
|
)
|
|
@@ -33535,7 +33732,7 @@ function GroupView({
|
|
|
33535
33732
|
}
|
|
33536
33733
|
|
|
33537
33734
|
// src/inspector/viewer/role-display.tsx
|
|
33538
|
-
var
|
|
33735
|
+
var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
|
|
33539
33736
|
function RoleDisplay({
|
|
33540
33737
|
node,
|
|
33541
33738
|
value
|
|
@@ -33554,16 +33751,16 @@ function RoleDisplay({
|
|
|
33554
33751
|
} else {
|
|
33555
33752
|
role = "unauthorized";
|
|
33556
33753
|
}
|
|
33557
|
-
return /* @__PURE__ */ (0,
|
|
33754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Text, { children: [
|
|
33558
33755
|
"Role: ",
|
|
33559
33756
|
role
|
|
33560
33757
|
] });
|
|
33561
33758
|
}
|
|
33562
33759
|
|
|
33563
33760
|
// src/inspector/viewer/table-viewer.tsx
|
|
33564
|
-
var
|
|
33761
|
+
var import_react15 = __toESM(require_react(), 1);
|
|
33565
33762
|
import { styled as styled15 } from "goober";
|
|
33566
|
-
var
|
|
33763
|
+
var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
|
|
33567
33764
|
var PaginationContainer = styled15("div")`
|
|
33568
33765
|
padding: 1rem 0;
|
|
33569
33766
|
display: flex;
|
|
@@ -33608,8 +33805,8 @@ function CoValuesTableView({
|
|
|
33608
33805
|
onNavigate,
|
|
33609
33806
|
onRemove
|
|
33610
33807
|
}) {
|
|
33611
|
-
const [visibleRowsCount, setVisibleRowsCount] = (0,
|
|
33612
|
-
const [coIdArray, visibleRows] = (0,
|
|
33808
|
+
const [visibleRowsCount, setVisibleRowsCount] = (0, import_react15.useState)(10);
|
|
33809
|
+
const [coIdArray, visibleRows] = (0, import_react15.useMemo)(() => {
|
|
33613
33810
|
const coIdArray2 = Array.isArray(data) ? data : Object.values(data).every((k) => typeof k === "string" && isCoId(k)) ? Object.values(data).map((k) => k) : [];
|
|
33614
33811
|
const visibleRows2 = coIdArray2.slice(0, visibleRowsCount);
|
|
33615
33812
|
return [coIdArray2, visibleRows2];
|
|
@@ -33617,10 +33814,10 @@ function CoValuesTableView({
|
|
|
33617
33814
|
const resolvedRows = useResolvedCoValues(visibleRows, node);
|
|
33618
33815
|
const hasMore = visibleRowsCount < coIdArray.length;
|
|
33619
33816
|
if (!coIdArray.length) {
|
|
33620
|
-
return /* @__PURE__ */ (0,
|
|
33817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: "No data to display" });
|
|
33621
33818
|
}
|
|
33622
33819
|
if (resolvedRows.length === 0) {
|
|
33623
|
-
return /* @__PURE__ */ (0,
|
|
33820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: "Loading..." });
|
|
33624
33821
|
}
|
|
33625
33822
|
const keys = Array.from(
|
|
33626
33823
|
new Set(
|
|
@@ -33630,15 +33827,15 @@ function CoValuesTableView({
|
|
|
33630
33827
|
const loadMore = () => {
|
|
33631
33828
|
setVisibleRowsCount((prevVisibleRows) => prevVisibleRows + 10);
|
|
33632
33829
|
};
|
|
33633
|
-
return /* @__PURE__ */ (0,
|
|
33634
|
-
/* @__PURE__ */ (0,
|
|
33635
|
-
/* @__PURE__ */ (0,
|
|
33636
|
-
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */ (0,
|
|
33637
|
-
onRemove && /* @__PURE__ */ (0,
|
|
33830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
33831
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Table, { children: [
|
|
33832
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(TableRow, { children: [
|
|
33833
|
+
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableHeader, { children: key }, key)),
|
|
33834
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableHeader, {})
|
|
33638
33835
|
] }) }),
|
|
33639
|
-
/* @__PURE__ */ (0,
|
|
33640
|
-
/* @__PURE__ */ (0,
|
|
33641
|
-
/* @__PURE__ */ (0,
|
|
33836
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableBody, { children: resolvedRows.slice(0, visibleRowsCount).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(TableRow, { children: [
|
|
33837
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { mono: true, children: item.snapshot === "unavailable" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(RedTooltip, { "data-text": "Unavailable", children: [
|
|
33838
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
33642
33839
|
Icon,
|
|
33643
33840
|
{
|
|
33644
33841
|
name: "caution",
|
|
@@ -33651,7 +33848,7 @@ function CoValuesTableView({
|
|
|
33651
33848
|
),
|
|
33652
33849
|
visibleRows[index]
|
|
33653
33850
|
] }) : visibleRows[index] }) }),
|
|
33654
|
-
keys.map((key) => /* @__PURE__ */ (0,
|
|
33851
|
+
keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableCell, { children: item.snapshot !== "unavailable" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
33655
33852
|
ValueRenderer,
|
|
33656
33853
|
{
|
|
33657
33854
|
json: item.snapshot[key],
|
|
@@ -33672,7 +33869,7 @@ function CoValuesTableView({
|
|
|
33672
33869
|
}
|
|
33673
33870
|
}
|
|
33674
33871
|
) }, key)),
|
|
33675
|
-
/* @__PURE__ */ (0,
|
|
33872
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
33676
33873
|
Button,
|
|
33677
33874
|
{
|
|
33678
33875
|
variant: "secondary",
|
|
@@ -33685,18 +33882,18 @@ function CoValuesTableView({
|
|
|
33685
33882
|
children: "View"
|
|
33686
33883
|
}
|
|
33687
33884
|
) }),
|
|
33688
|
-
onRemove && /* @__PURE__ */ (0,
|
|
33885
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
33689
33886
|
] }, index)) })
|
|
33690
33887
|
] }),
|
|
33691
|
-
/* @__PURE__ */ (0,
|
|
33692
|
-
/* @__PURE__ */ (0,
|
|
33888
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(PaginationContainer, { children: [
|
|
33889
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Text, { muted: true, small: true, children: [
|
|
33693
33890
|
"Showing ",
|
|
33694
33891
|
Math.min(visibleRowsCount, coIdArray.length),
|
|
33695
33892
|
" of",
|
|
33696
33893
|
" ",
|
|
33697
33894
|
coIdArray.length
|
|
33698
33895
|
] }),
|
|
33699
|
-
hasMore && /* @__PURE__ */ (0,
|
|
33896
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { variant: "secondary", onClick: loadMore, children: "Load more" })
|
|
33700
33897
|
] })
|
|
33701
33898
|
] });
|
|
33702
33899
|
}
|
|
@@ -33706,11 +33903,11 @@ function TableView({
|
|
|
33706
33903
|
onNavigate,
|
|
33707
33904
|
onRemove
|
|
33708
33905
|
}) {
|
|
33709
|
-
const isListOfCoValues = (0,
|
|
33906
|
+
const isListOfCoValues = (0, import_react15.useMemo)(() => {
|
|
33710
33907
|
return Array.isArray(data) && data.every((k) => isCoId(k));
|
|
33711
33908
|
}, [data]);
|
|
33712
33909
|
if (isListOfCoValues) {
|
|
33713
|
-
return /* @__PURE__ */ (0,
|
|
33910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
33714
33911
|
CoValuesTableView,
|
|
33715
33912
|
{
|
|
33716
33913
|
data,
|
|
@@ -33720,26 +33917,271 @@ function TableView({
|
|
|
33720
33917
|
}
|
|
33721
33918
|
);
|
|
33722
33919
|
}
|
|
33723
|
-
return /* @__PURE__ */ (0,
|
|
33724
|
-
/* @__PURE__ */ (0,
|
|
33725
|
-
/* @__PURE__ */ (0,
|
|
33726
|
-
/* @__PURE__ */ (0,
|
|
33727
|
-
onRemove && /* @__PURE__ */ (0,
|
|
33920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Table, { children: [
|
|
33921
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(TableRow, { children: [
|
|
33922
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableHeader, { style: { width: "5rem" }, children: "Index" }),
|
|
33923
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableHeader, { children: "Value" }),
|
|
33924
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableHeader, { children: "Action" })
|
|
33728
33925
|
] }) }),
|
|
33729
|
-
/* @__PURE__ */ (0,
|
|
33730
|
-
/* @__PURE__ */ (0,
|
|
33731
|
-
/* @__PURE__ */ (0,
|
|
33732
|
-
onRemove && /* @__PURE__ */ (0,
|
|
33926
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableBody, { children: Array.isArray(data) && data?.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(TableRow, { children: [
|
|
33927
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { mono: true, children: index }) }),
|
|
33928
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ValueRenderer, { json: value }) }),
|
|
33929
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
33733
33930
|
] }, index)) })
|
|
33734
33931
|
] });
|
|
33735
33932
|
}
|
|
33736
33933
|
|
|
33934
|
+
// src/inspector/viewer/history-view.tsx
|
|
33935
|
+
var import_react16 = __toESM(require_react(), 1);
|
|
33936
|
+
import { styled as styled16 } from "goober";
|
|
33937
|
+
var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
|
|
33938
|
+
function HistoryView({
|
|
33939
|
+
coValue,
|
|
33940
|
+
node
|
|
33941
|
+
}) {
|
|
33942
|
+
const transactions = (0, import_react16.useMemo)(
|
|
33943
|
+
() => getHistory(coValue),
|
|
33944
|
+
[coValue.core.verifiedTransactions.length]
|
|
33945
|
+
);
|
|
33946
|
+
const columns = [
|
|
33947
|
+
{
|
|
33948
|
+
id: "author",
|
|
33949
|
+
header: "Author",
|
|
33950
|
+
accessor: (row) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
33951
|
+
row.isValid || /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(RedTooltip2, { "data-text": "This transaction is invalid and is not used", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
33952
|
+
Icon,
|
|
33953
|
+
{
|
|
33954
|
+
name: "caution",
|
|
33955
|
+
size: "xs",
|
|
33956
|
+
color: "red",
|
|
33957
|
+
style: {
|
|
33958
|
+
display: "inline-block",
|
|
33959
|
+
verticalAlign: "middle",
|
|
33960
|
+
marginRight: "0.25rem"
|
|
33961
|
+
}
|
|
33962
|
+
}
|
|
33963
|
+
) }),
|
|
33964
|
+
row.author.startsWith("co_") ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
33965
|
+
AccountOrGroupText,
|
|
33966
|
+
{
|
|
33967
|
+
coId: row.author,
|
|
33968
|
+
node,
|
|
33969
|
+
showId: true
|
|
33970
|
+
}
|
|
33971
|
+
) : row.author
|
|
33972
|
+
] }),
|
|
33973
|
+
sortable: false,
|
|
33974
|
+
filterable: true,
|
|
33975
|
+
sortFn: (a, b) => a.author.localeCompare(b.author),
|
|
33976
|
+
filterFn: (row, filterValue) => row.author.toLowerCase().includes(filterValue.toLowerCase())
|
|
33977
|
+
},
|
|
33978
|
+
{
|
|
33979
|
+
id: "action",
|
|
33980
|
+
header: "Action",
|
|
33981
|
+
accessor: (row) => row.action,
|
|
33982
|
+
sortable: false,
|
|
33983
|
+
filterable: true,
|
|
33984
|
+
sortFn: (a, b) => a.action.localeCompare(b.action)
|
|
33985
|
+
},
|
|
33986
|
+
{
|
|
33987
|
+
id: "timestamp",
|
|
33988
|
+
header: "Timestamp",
|
|
33989
|
+
accessor: (row) => row.timestamp.toISOString(),
|
|
33990
|
+
sortable: true,
|
|
33991
|
+
filterable: true,
|
|
33992
|
+
sortFn: (a, b) => a.timestamp.getTime() - b.timestamp.getTime()
|
|
33993
|
+
}
|
|
33994
|
+
];
|
|
33995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("section", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
|
|
33996
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Heading, { children: "CoValue history" }),
|
|
33997
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
33998
|
+
DataTable,
|
|
33999
|
+
{
|
|
34000
|
+
columns,
|
|
34001
|
+
data: transactions,
|
|
34002
|
+
pageSize: 10,
|
|
34003
|
+
initialSort: { columnId: "timestamp", direction: "desc" },
|
|
34004
|
+
getRowKey: (row) => row.id,
|
|
34005
|
+
emptyMessage: "No history available"
|
|
34006
|
+
}
|
|
34007
|
+
)
|
|
34008
|
+
] });
|
|
34009
|
+
}
|
|
34010
|
+
function getTransactionChanges(tx, coValue) {
|
|
34011
|
+
if (tx.isValid === false && tx.tx.privacy === "private") {
|
|
34012
|
+
const readKey = coValue.core.getReadKey(tx.tx.keyUsed);
|
|
34013
|
+
if (!readKey) {
|
|
34014
|
+
throw new Error("Read key not found");
|
|
34015
|
+
}
|
|
34016
|
+
return coValue.core.verified.decryptTransaction(
|
|
34017
|
+
tx.txID.sessionID,
|
|
34018
|
+
tx.txID.txIndex,
|
|
34019
|
+
readKey
|
|
34020
|
+
) ?? [];
|
|
34021
|
+
}
|
|
34022
|
+
return tx.changes ?? tx.tx.changes ?? [];
|
|
34023
|
+
}
|
|
34024
|
+
function getHistory(coValue) {
|
|
34025
|
+
return coValue.core.verifiedTransactions.flatMap((tx, index) => {
|
|
34026
|
+
const changes = getTransactionChanges(tx, coValue);
|
|
34027
|
+
return changes.map((change, changeIndex) => ({
|
|
34028
|
+
id: `${tx.txID.sessionID.toString()}-${tx.txID.txIndex}-${index}-${changeIndex}`,
|
|
34029
|
+
author: tx.author,
|
|
34030
|
+
action: mapTransactionToAction(change, coValue),
|
|
34031
|
+
timestamp: new Date(tx.currentMadeAt),
|
|
34032
|
+
isValid: tx.isValid
|
|
34033
|
+
}));
|
|
34034
|
+
});
|
|
34035
|
+
}
|
|
34036
|
+
function mapTransactionToAction(change, coValue) {
|
|
34037
|
+
if (isUserPromotion(change)) {
|
|
34038
|
+
if (change.value === "revoked") {
|
|
34039
|
+
return `${change.key} has been revoked`;
|
|
34040
|
+
}
|
|
34041
|
+
return `${change.key} has been promoted to ${change.value}`;
|
|
34042
|
+
}
|
|
34043
|
+
if (isGroupExtension(change)) {
|
|
34044
|
+
const child = change.key.slice(6);
|
|
34045
|
+
return `Group became a member of ${child}`;
|
|
34046
|
+
}
|
|
34047
|
+
if (isGroupExtendRevocation(change)) {
|
|
34048
|
+
const child = change.key.slice(6);
|
|
34049
|
+
return `Group's membership of ${child} has been revoked.`;
|
|
34050
|
+
}
|
|
34051
|
+
if (isGroupPromotion(change)) {
|
|
34052
|
+
const parent = change.key.slice(7);
|
|
34053
|
+
return `Group ${parent} has been promoted to ${change.value}`;
|
|
34054
|
+
}
|
|
34055
|
+
if (isKeyRevelation(change)) {
|
|
34056
|
+
const [key, target] = change.key.split("_for_");
|
|
34057
|
+
return `Key "${key}" has been revealed to "${target}"`;
|
|
34058
|
+
}
|
|
34059
|
+
if (isItemAppend(change)) {
|
|
34060
|
+
if (change.after === "start") {
|
|
34061
|
+
return `"${change.value}" has been appended`;
|
|
34062
|
+
}
|
|
34063
|
+
const after = findListChange(change.after, coValue);
|
|
34064
|
+
if (after === void 0) {
|
|
34065
|
+
return `"${change.value}" has been inserted after undefined item`;
|
|
34066
|
+
}
|
|
34067
|
+
return `"${change.value}" has been inserted after "${after.value}"`;
|
|
34068
|
+
}
|
|
34069
|
+
if (isItemPrepend(change)) {
|
|
34070
|
+
if (change.before === "end") {
|
|
34071
|
+
return `"${change.value}" has been prepended`;
|
|
34072
|
+
}
|
|
34073
|
+
const before = findListChange(change.before, coValue);
|
|
34074
|
+
if (before === void 0) {
|
|
34075
|
+
return `"${change.value}" has been inserted before undefined item`;
|
|
34076
|
+
}
|
|
34077
|
+
return `"${change.value}" has been inserted before "${before.value}"`;
|
|
34078
|
+
}
|
|
34079
|
+
if (isItemDeletion(change)) {
|
|
34080
|
+
const insertion = findListChange(change.insertion, coValue);
|
|
34081
|
+
if (insertion === void 0) {
|
|
34082
|
+
return `An undefined item has been deleted`;
|
|
34083
|
+
}
|
|
34084
|
+
return `"${insertion.value}" has been deleted`;
|
|
34085
|
+
}
|
|
34086
|
+
if (isStreamStart(change)) {
|
|
34087
|
+
return `Stream started with mime type "${change.mimeType}" and file name "${change.fileName}"`;
|
|
34088
|
+
}
|
|
34089
|
+
if (isStreamChunk(change)) {
|
|
34090
|
+
return `Stream chunk added`;
|
|
34091
|
+
}
|
|
34092
|
+
if (isStreamEnd(change)) {
|
|
34093
|
+
return `Stream ended`;
|
|
34094
|
+
}
|
|
34095
|
+
if (isPropertySet(change)) {
|
|
34096
|
+
return `Property "${change.key}" has been set to "${change.value}"`;
|
|
34097
|
+
}
|
|
34098
|
+
if (isPropertyDeletion(change)) {
|
|
34099
|
+
return `Property "${change.key}" has been deleted`;
|
|
34100
|
+
}
|
|
34101
|
+
return "Unknown action: " + JSON.stringify(change);
|
|
34102
|
+
}
|
|
34103
|
+
var findListChange = (opId, coValue) => {
|
|
34104
|
+
return coValue.core.verifiedTransactions.find(
|
|
34105
|
+
(tx) => tx.txID.sessionID === opId.sessionID && tx.txID.txIndex === opId.txIndex
|
|
34106
|
+
)?.changes?.[opId.changeIdx];
|
|
34107
|
+
};
|
|
34108
|
+
var isGroupExtension = (change) => {
|
|
34109
|
+
return change?.op === "set" && change?.value === "extend";
|
|
34110
|
+
};
|
|
34111
|
+
var isGroupExtendRevocation = (change) => {
|
|
34112
|
+
return change?.op === "set" && change?.value === "revoked";
|
|
34113
|
+
};
|
|
34114
|
+
var isGroupPromotion = (change) => {
|
|
34115
|
+
return change?.op === "set" && change?.key.startsWith("parent_co_");
|
|
34116
|
+
};
|
|
34117
|
+
var isUserPromotion = (change) => {
|
|
34118
|
+
return change?.op === "set" && (isCoId(change?.key) || change?.key === "everyone");
|
|
34119
|
+
};
|
|
34120
|
+
var isKeyRevelation = (change) => {
|
|
34121
|
+
return change?.op === "set" && change?.key.includes("_for_");
|
|
34122
|
+
};
|
|
34123
|
+
var isPropertySet = (change) => {
|
|
34124
|
+
return change?.op === "set" && "key" in change && "value" in change;
|
|
34125
|
+
};
|
|
34126
|
+
var isPropertyDeletion = (change) => {
|
|
34127
|
+
return change?.op === "del" && "key" in change;
|
|
34128
|
+
};
|
|
34129
|
+
var isItemAppend = (change) => {
|
|
34130
|
+
return change?.op === "app" && "after" in change && "value" in change;
|
|
34131
|
+
};
|
|
34132
|
+
var isItemPrepend = (change) => {
|
|
34133
|
+
return change?.op === "pre" && "before" in change && "value" in change;
|
|
34134
|
+
};
|
|
34135
|
+
var isItemDeletion = (change) => {
|
|
34136
|
+
return change?.op === "del" && "insertion" in change;
|
|
34137
|
+
};
|
|
34138
|
+
var isStreamStart = (change) => {
|
|
34139
|
+
return change?.type === "start" && "mimeType" in change;
|
|
34140
|
+
};
|
|
34141
|
+
var isStreamChunk = (change) => {
|
|
34142
|
+
return change?.type === "chunk" && "chunk" in change;
|
|
34143
|
+
};
|
|
34144
|
+
var isStreamEnd = (change) => {
|
|
34145
|
+
return change?.type === "end";
|
|
34146
|
+
};
|
|
34147
|
+
var RedTooltip2 = styled16("span")`
|
|
34148
|
+
position:relative; /* making the .tooltip span a container for the tooltip text */
|
|
34149
|
+
border-bottom:1px dashed #000; /* little indicater to indicate it's hoverable */
|
|
34150
|
+
|
|
34151
|
+
&:before {
|
|
34152
|
+
content: attr(data-text);
|
|
34153
|
+
background-color: red;
|
|
34154
|
+
position:absolute;
|
|
34155
|
+
|
|
34156
|
+
/* vertically center */
|
|
34157
|
+
top:50%;
|
|
34158
|
+
transform:translateY(-50%);
|
|
34159
|
+
|
|
34160
|
+
/* move to right */
|
|
34161
|
+
left:100%;
|
|
34162
|
+
margin-left:15px; /* and add a small left margin */
|
|
34163
|
+
|
|
34164
|
+
/* basic styles */
|
|
34165
|
+
width:200px;
|
|
34166
|
+
padding:10px;
|
|
34167
|
+
border-radius:10px;
|
|
34168
|
+
color: #fff;
|
|
34169
|
+
text-align:center;
|
|
34170
|
+
|
|
34171
|
+
display:none; /* hide by default */
|
|
34172
|
+
}
|
|
34173
|
+
|
|
34174
|
+
&:hover:before {
|
|
34175
|
+
display:block;
|
|
34176
|
+
}
|
|
34177
|
+
`;
|
|
34178
|
+
|
|
33737
34179
|
// src/inspector/viewer/page.tsx
|
|
33738
|
-
var
|
|
33739
|
-
var BasePageContainer =
|
|
33740
|
-
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ (0,
|
|
34180
|
+
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
|
|
34181
|
+
var BasePageContainer = import_react17.default.forwardRef(
|
|
34182
|
+
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { ref, ...rest })
|
|
33741
34183
|
);
|
|
33742
|
-
var PageContainer =
|
|
34184
|
+
var PageContainer = styled17(BasePageContainer)`
|
|
33743
34185
|
position: absolute;
|
|
33744
34186
|
z-index: 10;
|
|
33745
34187
|
inset: 0;
|
|
@@ -33747,36 +34189,36 @@ var PageContainer = styled16(BasePageContainer)`
|
|
|
33747
34189
|
height: 100%;
|
|
33748
34190
|
padding: 0 0.75rem;
|
|
33749
34191
|
`;
|
|
33750
|
-
var BackButton =
|
|
34192
|
+
var BackButton = styled17("div")`
|
|
33751
34193
|
position: absolute;
|
|
33752
34194
|
left: 0;
|
|
33753
34195
|
right: 0;
|
|
33754
34196
|
top: 0;
|
|
33755
34197
|
height: 2.5rem;
|
|
33756
34198
|
`;
|
|
33757
|
-
var HeaderContainer =
|
|
34199
|
+
var HeaderContainer = styled17("div")`
|
|
33758
34200
|
display: flex;
|
|
33759
34201
|
justify-content: space-between;
|
|
33760
34202
|
align-items: center;
|
|
33761
34203
|
margin-bottom: 1rem;
|
|
33762
34204
|
`;
|
|
33763
|
-
var TitleContainer =
|
|
34205
|
+
var TitleContainer = styled17("div")`
|
|
33764
34206
|
display: flex;
|
|
33765
34207
|
align-items: center;
|
|
33766
34208
|
gap: 0.75rem;
|
|
33767
34209
|
`;
|
|
33768
|
-
var Title =
|
|
34210
|
+
var Title = styled17(Heading)`
|
|
33769
34211
|
display: flex;
|
|
33770
34212
|
flex-direction: column;
|
|
33771
34213
|
align-items: flex-start;
|
|
33772
34214
|
gap: 0.25rem;
|
|
33773
34215
|
`;
|
|
33774
|
-
var BadgeContainer =
|
|
34216
|
+
var BadgeContainer = styled17("div")`
|
|
33775
34217
|
display: flex;
|
|
33776
34218
|
align-items: center;
|
|
33777
34219
|
gap: 0.75rem;
|
|
33778
34220
|
`;
|
|
33779
|
-
var ContentContainer =
|
|
34221
|
+
var ContentContainer = styled17("div")`
|
|
33780
34222
|
overflow: auto;
|
|
33781
34223
|
display: flex;
|
|
33782
34224
|
flex-direction: column;
|
|
@@ -33797,7 +34239,7 @@ function View(props) {
|
|
|
33797
34239
|
const { node, onNavigate } = props;
|
|
33798
34240
|
if (!snapshot || snapshot === "unavailable") return;
|
|
33799
34241
|
if (type === "costream") {
|
|
33800
|
-
return /* @__PURE__ */ (0,
|
|
34242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
33801
34243
|
CoStreamView,
|
|
33802
34244
|
{
|
|
33803
34245
|
data: snapshot,
|
|
@@ -33808,7 +34250,7 @@ function View(props) {
|
|
|
33808
34250
|
);
|
|
33809
34251
|
}
|
|
33810
34252
|
if (extendedType === "group") {
|
|
33811
|
-
return /* @__PURE__ */ (0,
|
|
34253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
33812
34254
|
GroupView,
|
|
33813
34255
|
{
|
|
33814
34256
|
coValue: value,
|
|
@@ -33819,10 +34261,10 @@ function View(props) {
|
|
|
33819
34261
|
);
|
|
33820
34262
|
}
|
|
33821
34263
|
if (extendedType === "account") {
|
|
33822
|
-
return /* @__PURE__ */ (0,
|
|
34264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AccountView, { data: snapshot, node, onNavigate });
|
|
33823
34265
|
}
|
|
33824
34266
|
if (type === "coplaintext") {
|
|
33825
|
-
return /* @__PURE__ */ (0,
|
|
34267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CoPlainTextView, { data: snapshot });
|
|
33826
34268
|
}
|
|
33827
34269
|
if (type === "colist") {
|
|
33828
34270
|
const handleRemove = (index) => {
|
|
@@ -33831,7 +34273,7 @@ function View(props) {
|
|
|
33831
34273
|
list.delete(index);
|
|
33832
34274
|
}
|
|
33833
34275
|
};
|
|
33834
|
-
return /* @__PURE__ */ (0,
|
|
34276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
33835
34277
|
TableView,
|
|
33836
34278
|
{
|
|
33837
34279
|
data: snapshot,
|
|
@@ -33842,9 +34284,9 @@ function View(props) {
|
|
|
33842
34284
|
);
|
|
33843
34285
|
}
|
|
33844
34286
|
if (extendedType === "record") {
|
|
33845
|
-
return /* @__PURE__ */ (0,
|
|
34287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TableView, { data: snapshot, node, onNavigate });
|
|
33846
34288
|
}
|
|
33847
|
-
return /* @__PURE__ */ (0,
|
|
34289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(GridView, { data: snapshot, onNavigate, node });
|
|
33848
34290
|
}
|
|
33849
34291
|
function Page(props) {
|
|
33850
34292
|
const {
|
|
@@ -33860,13 +34302,13 @@ function Page(props) {
|
|
|
33860
34302
|
const coValue = useResolvedCoValue(coId, node);
|
|
33861
34303
|
const { value, snapshot, type, extendedType } = coValue;
|
|
33862
34304
|
if (snapshot === "unavailable") {
|
|
33863
|
-
return /* @__PURE__ */ (0,
|
|
34305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style, children: "Data unavailable" });
|
|
33864
34306
|
}
|
|
33865
34307
|
if (!snapshot) {
|
|
33866
|
-
return /* @__PURE__ */ (0,
|
|
34308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style });
|
|
33867
34309
|
}
|
|
33868
|
-
return /* @__PURE__ */ (0,
|
|
33869
|
-
!isTopLevel && /* @__PURE__ */ (0,
|
|
34310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(PageContainer, { style, className, isTopLevel, children: [
|
|
34311
|
+
!isTopLevel && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
33870
34312
|
BackButton,
|
|
33871
34313
|
{
|
|
33872
34314
|
"aria-label": "Back",
|
|
@@ -33876,27 +34318,27 @@ function Page(props) {
|
|
|
33876
34318
|
"aria-hidden": "true"
|
|
33877
34319
|
}
|
|
33878
34320
|
),
|
|
33879
|
-
/* @__PURE__ */ (0,
|
|
33880
|
-
/* @__PURE__ */ (0,
|
|
34321
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(HeaderContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(TitleContainer, { children: [
|
|
34322
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Title, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
|
|
33881
34323
|
name,
|
|
33882
|
-
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */ (0,
|
|
34324
|
+
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { style: { color: "#57534e", fontWeight: 500 }, children: [
|
|
33883
34325
|
" ",
|
|
33884
34326
|
snapshot.name
|
|
33885
34327
|
] }) : null
|
|
33886
34328
|
] }) }),
|
|
33887
|
-
/* @__PURE__ */ (0,
|
|
33888
|
-
/* @__PURE__ */ (0,
|
|
33889
|
-
/* @__PURE__ */ (0,
|
|
34329
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(BadgeContainer, { children: [
|
|
34330
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Badge, { children: type && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TypeIcon, { type, extendedType }) }),
|
|
34331
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Badge, { children: coId })
|
|
33890
34332
|
] })
|
|
33891
34333
|
] }) }),
|
|
33892
|
-
/* @__PURE__ */ (0,
|
|
33893
|
-
/* @__PURE__ */ (0,
|
|
33894
|
-
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */ (0,
|
|
33895
|
-
/* @__PURE__ */ (0,
|
|
33896
|
-
/* @__PURE__ */ (0,
|
|
34334
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(ContentContainer, { children: [
|
|
34335
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(View, { ...props, coValue }),
|
|
34336
|
+
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
34337
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(RoleDisplay, { node, value }),
|
|
34338
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Text, { muted: true, children: [
|
|
33897
34339
|
"Owned by",
|
|
33898
34340
|
" ",
|
|
33899
|
-
/* @__PURE__ */ (0,
|
|
34341
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
33900
34342
|
AccountOrGroupText,
|
|
33901
34343
|
{
|
|
33902
34344
|
coId: value.group.id,
|
|
@@ -33908,14 +34350,15 @@ function Page(props) {
|
|
|
33908
34350
|
}
|
|
33909
34351
|
)
|
|
33910
34352
|
] })
|
|
33911
|
-
] })
|
|
34353
|
+
] }),
|
|
34354
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(HistoryView, { coValue: value, node })
|
|
33912
34355
|
] })
|
|
33913
34356
|
] });
|
|
33914
34357
|
}
|
|
33915
34358
|
|
|
33916
34359
|
// src/inspector/viewer/page-stack.tsx
|
|
33917
|
-
var
|
|
33918
|
-
var PageStackContainer =
|
|
34360
|
+
var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
|
|
34361
|
+
var PageStackContainer = styled18("div")`
|
|
33919
34362
|
position: relative;
|
|
33920
34363
|
padding: 0 0.75rem;
|
|
33921
34364
|
overflow-y: auto;
|
|
@@ -33932,9 +34375,9 @@ function PageStack({
|
|
|
33932
34375
|
}) {
|
|
33933
34376
|
const page = path[path.length - 1];
|
|
33934
34377
|
const index = path.length - 1;
|
|
33935
|
-
return /* @__PURE__ */ (0,
|
|
34378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(PageStackContainer, { children: [
|
|
33936
34379
|
children,
|
|
33937
|
-
node && page && /* @__PURE__ */ (0,
|
|
34380
|
+
node && page && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
33938
34381
|
Page,
|
|
33939
34382
|
{
|
|
33940
34383
|
coId: page.coId,
|
|
@@ -33949,10 +34392,10 @@ function PageStack({
|
|
|
33949
34392
|
}
|
|
33950
34393
|
|
|
33951
34394
|
// src/inspector/viewer/use-page-path.ts
|
|
33952
|
-
var
|
|
34395
|
+
var import_react18 = __toESM(require_react(), 1);
|
|
33953
34396
|
var STORAGE_KEY = "jazz-inspector-paths";
|
|
33954
34397
|
function usePagePath(defaultPath) {
|
|
33955
|
-
const [path, setPath] = (0,
|
|
34398
|
+
const [path, setPath] = (0, import_react18.useState)(() => {
|
|
33956
34399
|
if (typeof window === "undefined") return [];
|
|
33957
34400
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
33958
34401
|
if (stored) {
|
|
@@ -33964,34 +34407,34 @@ function usePagePath(defaultPath) {
|
|
|
33964
34407
|
}
|
|
33965
34408
|
return defaultPath || [];
|
|
33966
34409
|
});
|
|
33967
|
-
const updatePath = (0,
|
|
34410
|
+
const updatePath = (0, import_react18.useCallback)((newPath) => {
|
|
33968
34411
|
setPath(newPath);
|
|
33969
34412
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(newPath));
|
|
33970
34413
|
}, []);
|
|
33971
|
-
(0,
|
|
34414
|
+
(0, import_react18.useEffect)(() => {
|
|
33972
34415
|
if (defaultPath && JSON.stringify(path) !== JSON.stringify(defaultPath)) {
|
|
33973
34416
|
updatePath(defaultPath);
|
|
33974
34417
|
}
|
|
33975
34418
|
}, [defaultPath, path, updatePath]);
|
|
33976
|
-
const addPages = (0,
|
|
34419
|
+
const addPages = (0, import_react18.useCallback)(
|
|
33977
34420
|
(newPages) => {
|
|
33978
34421
|
updatePath([...path, ...newPages]);
|
|
33979
34422
|
},
|
|
33980
34423
|
[path, updatePath]
|
|
33981
34424
|
);
|
|
33982
|
-
const goToIndex = (0,
|
|
34425
|
+
const goToIndex = (0, import_react18.useCallback)(
|
|
33983
34426
|
(index) => {
|
|
33984
34427
|
updatePath(path.slice(0, index + 1));
|
|
33985
34428
|
},
|
|
33986
34429
|
[path, updatePath]
|
|
33987
34430
|
);
|
|
33988
|
-
const setPage = (0,
|
|
34431
|
+
const setPage = (0, import_react18.useCallback)(
|
|
33989
34432
|
(coId) => {
|
|
33990
34433
|
updatePath([{ coId, name: "Root" }]);
|
|
33991
34434
|
},
|
|
33992
34435
|
[updatePath]
|
|
33993
34436
|
);
|
|
33994
|
-
const goBack = (0,
|
|
34437
|
+
const goBack = (0, import_react18.useCallback)(() => {
|
|
33995
34438
|
if (path.length > 1) {
|
|
33996
34439
|
updatePath(path.slice(0, path.length - 1));
|
|
33997
34440
|
}
|
|
@@ -34006,8 +34449,8 @@ function usePagePath(defaultPath) {
|
|
|
34006
34449
|
}
|
|
34007
34450
|
|
|
34008
34451
|
// src/inspector/ui/global-styles.tsx
|
|
34009
|
-
import { styled as
|
|
34010
|
-
var GlobalStyles =
|
|
34452
|
+
import { styled as styled19 } from "goober";
|
|
34453
|
+
var GlobalStyles = styled19("div")`
|
|
34011
34454
|
/* Colors */
|
|
34012
34455
|
--j-primary-color: #146AFF;
|
|
34013
34456
|
--j-link-color: var(--j-primary-color);
|
|
@@ -34081,9 +34524,9 @@ var GlobalStyles = styled18("div")`
|
|
|
34081
34524
|
`;
|
|
34082
34525
|
|
|
34083
34526
|
// src/inspector/viewer/inspector-button.tsx
|
|
34084
|
-
var
|
|
34085
|
-
import { styled as
|
|
34086
|
-
var StyledInspectorButton =
|
|
34527
|
+
var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
|
|
34528
|
+
import { styled as styled20 } from "goober";
|
|
34529
|
+
var StyledInspectorButton = styled20("button")`
|
|
34087
34530
|
position: fixed;
|
|
34088
34531
|
width: 2.5rem;
|
|
34089
34532
|
height: 2.5rem;
|
|
@@ -34114,7 +34557,7 @@ var StyledInspectorButton = styled19("button")`
|
|
|
34114
34557
|
}
|
|
34115
34558
|
}}
|
|
34116
34559
|
`;
|
|
34117
|
-
var JazzIcon =
|
|
34560
|
+
var JazzIcon = styled20("svg")`
|
|
34118
34561
|
width: 100%;
|
|
34119
34562
|
height: auto;
|
|
34120
34563
|
position: relative;
|
|
@@ -34125,8 +34568,8 @@ function InspectorButton({
|
|
|
34125
34568
|
position = "right",
|
|
34126
34569
|
...buttonProps
|
|
34127
34570
|
}) {
|
|
34128
|
-
return /* @__PURE__ */ (0,
|
|
34129
|
-
/* @__PURE__ */ (0,
|
|
34571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(StyledInspectorButton, { position, ...buttonProps, children: [
|
|
34572
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
34130
34573
|
JazzIcon,
|
|
34131
34574
|
{
|
|
34132
34575
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -34134,7 +34577,7 @@ function InspectorButton({
|
|
|
34134
34577
|
height: "115",
|
|
34135
34578
|
viewBox: "0 0 119 115",
|
|
34136
34579
|
fill: "none",
|
|
34137
|
-
children: /* @__PURE__ */ (0,
|
|
34580
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
34138
34581
|
"path",
|
|
34139
34582
|
{
|
|
34140
34583
|
fillRule: "evenodd",
|
|
@@ -34145,7 +34588,7 @@ function InspectorButton({
|
|
|
34145
34588
|
)
|
|
34146
34589
|
}
|
|
34147
34590
|
),
|
|
34148
|
-
/* @__PURE__ */ (0,
|
|
34591
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
34149
34592
|
"span",
|
|
34150
34593
|
{
|
|
34151
34594
|
style: {
|
|
@@ -34166,30 +34609,30 @@ function InspectorButton({
|
|
|
34166
34609
|
}
|
|
34167
34610
|
|
|
34168
34611
|
// src/inspector/viewer/use-open-inspector.ts
|
|
34169
|
-
var
|
|
34612
|
+
var import_react19 = __toESM(require_react(), 1);
|
|
34170
34613
|
var STORAGE_KEY2 = "jazz-inspector-open";
|
|
34171
34614
|
function useOpenInspector() {
|
|
34172
|
-
const [open, setOpen] = (0,
|
|
34615
|
+
const [open, setOpen] = (0, import_react19.useState)(() => {
|
|
34173
34616
|
if (typeof window === "undefined") return false;
|
|
34174
34617
|
const stored = localStorage.getItem(STORAGE_KEY2);
|
|
34175
34618
|
return stored ? JSON.parse(stored) : false;
|
|
34176
34619
|
});
|
|
34177
|
-
(0,
|
|
34620
|
+
(0, import_react19.useEffect)(() => {
|
|
34178
34621
|
localStorage.setItem(STORAGE_KEY2, JSON.stringify(open));
|
|
34179
34622
|
}, [open]);
|
|
34180
34623
|
return [open, setOpen];
|
|
34181
34624
|
}
|
|
34182
34625
|
|
|
34183
34626
|
// src/inspector/viewer/delete-local-data.tsx
|
|
34184
|
-
var
|
|
34185
|
-
var
|
|
34627
|
+
var import_react20 = __toESM(require_react(), 1);
|
|
34628
|
+
var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
|
|
34186
34629
|
var DELETE_LOCAL_DATA_STRING = "delete my local data";
|
|
34187
34630
|
function DeleteLocalData() {
|
|
34188
|
-
const [showDeleteModal, setShowDeleteModal] = (0,
|
|
34189
|
-
const [confirmDeleteString, setConfirmDeleteString] = (0,
|
|
34190
|
-
return /* @__PURE__ */ (0,
|
|
34191
|
-
/* @__PURE__ */ (0,
|
|
34192
|
-
/* @__PURE__ */ (0,
|
|
34631
|
+
const [showDeleteModal, setShowDeleteModal] = (0, import_react20.useState)(false);
|
|
34632
|
+
const [confirmDeleteString, setConfirmDeleteString] = (0, import_react20.useState)("");
|
|
34633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
34634
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "destructive", onClick: () => setShowDeleteModal(true), children: "Delete my local data" }),
|
|
34635
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
34193
34636
|
Modal,
|
|
34194
34637
|
{
|
|
34195
34638
|
isOpen: showDeleteModal,
|
|
@@ -34197,7 +34640,7 @@ function DeleteLocalData() {
|
|
|
34197
34640
|
heading: "Delete Local Data",
|
|
34198
34641
|
showButtons: false,
|
|
34199
34642
|
children: [
|
|
34200
|
-
/* @__PURE__ */ (0,
|
|
34643
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
34201
34644
|
"div",
|
|
34202
34645
|
{
|
|
34203
34646
|
style: {
|
|
@@ -34208,33 +34651,33 @@ function DeleteLocalData() {
|
|
|
34208
34651
|
gap: "0.5rem"
|
|
34209
34652
|
},
|
|
34210
34653
|
children: [
|
|
34211
|
-
/* @__PURE__ */ (0,
|
|
34654
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("p", { children: [
|
|
34212
34655
|
"This action ",
|
|
34213
|
-
/* @__PURE__ */ (0,
|
|
34656
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: "cannot" }),
|
|
34214
34657
|
" be undone."
|
|
34215
34658
|
] }),
|
|
34216
|
-
/* @__PURE__ */ (0,
|
|
34659
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("p", { children: [
|
|
34217
34660
|
"Be aware that the following data will be",
|
|
34218
34661
|
" ",
|
|
34219
|
-
/* @__PURE__ */ (0,
|
|
34662
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: "permanently" }),
|
|
34220
34663
|
" deleted:"
|
|
34221
34664
|
] }),
|
|
34222
|
-
/* @__PURE__ */ (0,
|
|
34223
|
-
/* @__PURE__ */ (0,
|
|
34665
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("ul", { style: { listStyleType: "disc", paddingLeft: "1rem" }, children: [
|
|
34666
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("li", { children: [
|
|
34224
34667
|
"Unsynced data for ",
|
|
34225
|
-
/* @__PURE__ */ (0,
|
|
34668
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: "all apps" }),
|
|
34226
34669
|
" on",
|
|
34227
34670
|
" ",
|
|
34228
|
-
/* @__PURE__ */ (0,
|
|
34671
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { children: window.location.origin })
|
|
34229
34672
|
] }),
|
|
34230
|
-
/* @__PURE__ */ (0,
|
|
34231
|
-
/* @__PURE__ */ (0,
|
|
34673
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("li", { children: "Accounts" }),
|
|
34674
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("li", { children: "Logged in sessions" })
|
|
34232
34675
|
] }),
|
|
34233
|
-
/* @__PURE__ */ (0,
|
|
34676
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", {})
|
|
34234
34677
|
]
|
|
34235
34678
|
}
|
|
34236
34679
|
),
|
|
34237
|
-
/* @__PURE__ */ (0,
|
|
34680
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
34238
34681
|
Input,
|
|
34239
34682
|
{
|
|
34240
34683
|
label: `Type "${DELETE_LOCAL_DATA_STRING}" to confirm`,
|
|
@@ -34245,7 +34688,7 @@ function DeleteLocalData() {
|
|
|
34245
34688
|
}
|
|
34246
34689
|
}
|
|
34247
34690
|
),
|
|
34248
|
-
/* @__PURE__ */ (0,
|
|
34691
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
34249
34692
|
"p",
|
|
34250
34693
|
{
|
|
34251
34694
|
style: {
|
|
@@ -34255,14 +34698,14 @@ function DeleteLocalData() {
|
|
|
34255
34698
|
flexDirection: "column",
|
|
34256
34699
|
gap: "0.5rem"
|
|
34257
34700
|
},
|
|
34258
|
-
children: /* @__PURE__ */ (0,
|
|
34701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("small", { children: [
|
|
34259
34702
|
"Data synced to a sync server will ",
|
|
34260
|
-
/* @__PURE__ */ (0,
|
|
34703
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: "not" }),
|
|
34261
34704
|
" be deleted, and will be synced when you log in again."
|
|
34262
34705
|
] })
|
|
34263
34706
|
}
|
|
34264
34707
|
),
|
|
34265
|
-
/* @__PURE__ */ (0,
|
|
34708
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
34266
34709
|
"div",
|
|
34267
34710
|
{
|
|
34268
34711
|
style: {
|
|
@@ -34272,8 +34715,8 @@ function DeleteLocalData() {
|
|
|
34272
34715
|
gap: "0.5rem"
|
|
34273
34716
|
},
|
|
34274
34717
|
children: [
|
|
34275
|
-
/* @__PURE__ */ (0,
|
|
34276
|
-
/* @__PURE__ */ (0,
|
|
34718
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "secondary", onClick: () => setShowDeleteModal(false), children: "Cancel" }),
|
|
34719
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
34277
34720
|
Button,
|
|
34278
34721
|
{
|
|
34279
34722
|
variant: "destructive",
|
|
@@ -34300,8 +34743,8 @@ function DeleteLocalData() {
|
|
|
34300
34743
|
}
|
|
34301
34744
|
|
|
34302
34745
|
// src/inspector/viewer/new-app.tsx
|
|
34303
|
-
var
|
|
34304
|
-
var InspectorContainer =
|
|
34746
|
+
var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
|
|
34747
|
+
var InspectorContainer = styled21("div")`
|
|
34305
34748
|
position: fixed;
|
|
34306
34749
|
height: 50vh;
|
|
34307
34750
|
max-height: 800px;
|
|
@@ -34318,17 +34761,17 @@ var InspectorContainer = styled20("div")`
|
|
|
34318
34761
|
background-color: var(--j-background);
|
|
34319
34762
|
}
|
|
34320
34763
|
`;
|
|
34321
|
-
var HeaderContainer2 =
|
|
34764
|
+
var HeaderContainer2 = styled21("div")`
|
|
34322
34765
|
display: flex;
|
|
34323
34766
|
align-items: center;
|
|
34324
34767
|
gap: 1rem;
|
|
34325
34768
|
padding: 0 0.75rem;
|
|
34326
34769
|
margin: 0.75rem 0;
|
|
34327
34770
|
`;
|
|
34328
|
-
var Form =
|
|
34771
|
+
var Form = styled21("form")`
|
|
34329
34772
|
width: 24rem;
|
|
34330
34773
|
`;
|
|
34331
|
-
var InitialForm =
|
|
34774
|
+
var InitialForm = styled21("form")`
|
|
34332
34775
|
display: flex;
|
|
34333
34776
|
flex-direction: column;
|
|
34334
34777
|
position: relative;
|
|
@@ -34340,7 +34783,7 @@ var InitialForm = styled20("form")`
|
|
|
34340
34783
|
max-width: 24rem;
|
|
34341
34784
|
margin: 0 auto;
|
|
34342
34785
|
`;
|
|
34343
|
-
var OrText =
|
|
34786
|
+
var OrText = styled21("p")`
|
|
34344
34787
|
text-align: center;
|
|
34345
34788
|
`;
|
|
34346
34789
|
function JazzInspectorInternal({
|
|
@@ -34349,7 +34792,7 @@ function JazzInspectorInternal({
|
|
|
34349
34792
|
accountId
|
|
34350
34793
|
}) {
|
|
34351
34794
|
const [open, setOpen] = useOpenInspector();
|
|
34352
|
-
const [coValueId, setCoValueId] = (0,
|
|
34795
|
+
const [coValueId, setCoValueId] = (0, import_react21.useState)("");
|
|
34353
34796
|
const { path, addPages, goToIndex, goBack, setPage } = usePagePath();
|
|
34354
34797
|
const handleCoValueIdSubmit = (e) => {
|
|
34355
34798
|
e.preventDefault();
|
|
@@ -34359,12 +34802,12 @@ function JazzInspectorInternal({
|
|
|
34359
34802
|
setCoValueId("");
|
|
34360
34803
|
};
|
|
34361
34804
|
if (!open) {
|
|
34362
|
-
return /* @__PURE__ */ (0,
|
|
34805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(InspectorButton, { position, onClick: () => setOpen(true) });
|
|
34363
34806
|
}
|
|
34364
|
-
return /* @__PURE__ */ (0,
|
|
34365
|
-
/* @__PURE__ */ (0,
|
|
34366
|
-
/* @__PURE__ */ (0,
|
|
34367
|
-
path.length !== 0 && /* @__PURE__ */ (0,
|
|
34807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(InspectorContainer, { as: GlobalStyles, style: { zIndex: 999 }, children: [
|
|
34808
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(HeaderContainer2, { children: [
|
|
34809
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Breadcrumbs, { path, onBreadcrumbClick: goToIndex }),
|
|
34810
|
+
path.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Form, { onSubmit: handleCoValueIdSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
34368
34811
|
Input,
|
|
34369
34812
|
{
|
|
34370
34813
|
label: "CoValue ID",
|
|
@@ -34375,24 +34818,24 @@ function JazzInspectorInternal({
|
|
|
34375
34818
|
onChange: (e) => setCoValueId(e.target.value)
|
|
34376
34819
|
}
|
|
34377
34820
|
) }),
|
|
34378
|
-
/* @__PURE__ */ (0,
|
|
34379
|
-
/* @__PURE__ */ (0,
|
|
34821
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DeleteLocalData, {}),
|
|
34822
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Button, { variant: "plain", type: "button", onClick: () => setOpen(false), children: "Close" })
|
|
34380
34823
|
] }),
|
|
34381
|
-
/* @__PURE__ */ (0,
|
|
34824
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
34382
34825
|
PageStack,
|
|
34383
34826
|
{
|
|
34384
34827
|
path,
|
|
34385
34828
|
node: localNode,
|
|
34386
34829
|
goBack,
|
|
34387
34830
|
addPages,
|
|
34388
|
-
children: path.length <= 0 && /* @__PURE__ */ (0,
|
|
34831
|
+
children: path.length <= 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
34389
34832
|
InitialForm,
|
|
34390
34833
|
{
|
|
34391
34834
|
onSubmit: handleCoValueIdSubmit,
|
|
34392
34835
|
"aria-hidden": path.length !== 0,
|
|
34393
34836
|
children: [
|
|
34394
|
-
/* @__PURE__ */ (0,
|
|
34395
|
-
/* @__PURE__ */ (0,
|
|
34837
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Heading, { children: "Jazz CoValue Inspector" }),
|
|
34838
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
34396
34839
|
Input,
|
|
34397
34840
|
{
|
|
34398
34841
|
label: "CoValue ID",
|
|
@@ -34403,10 +34846,10 @@ function JazzInspectorInternal({
|
|
|
34403
34846
|
onChange: (e) => setCoValueId(e.target.value)
|
|
34404
34847
|
}
|
|
34405
34848
|
),
|
|
34406
|
-
/* @__PURE__ */ (0,
|
|
34407
|
-
accountId && /* @__PURE__ */ (0,
|
|
34408
|
-
/* @__PURE__ */ (0,
|
|
34409
|
-
/* @__PURE__ */ (0,
|
|
34849
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Button, { type: "submit", variant: "primary", children: "Inspect CoValue" }),
|
|
34850
|
+
accountId && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
34851
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(OrText, { children: "or" }),
|
|
34852
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
34410
34853
|
Button,
|
|
34411
34854
|
{
|
|
34412
34855
|
variant: "secondary",
|
|
@@ -34427,8 +34870,8 @@ function JazzInspectorInternal({
|
|
|
34427
34870
|
}
|
|
34428
34871
|
|
|
34429
34872
|
// src/inspector/custom-element.tsx
|
|
34430
|
-
var
|
|
34431
|
-
setup(
|
|
34873
|
+
var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
|
|
34874
|
+
setup(import_react22.default.createElement);
|
|
34432
34875
|
var JazzInspectorElement = class extends HTMLElement {
|
|
34433
34876
|
constructor() {
|
|
34434
34877
|
super(...arguments);
|
|
@@ -34470,7 +34913,7 @@ var JazzInspectorElement = class extends HTMLElement {
|
|
|
34470
34913
|
return;
|
|
34471
34914
|
}
|
|
34472
34915
|
this.root?.render(
|
|
34473
|
-
/* @__PURE__ */ (0,
|
|
34916
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34474
34917
|
JazzInspectorInternal,
|
|
34475
34918
|
{
|
|
34476
34919
|
localNode: this.account.$jazz.localNode,
|
|
@@ -34596,4 +35039,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
34596
35039
|
* LICENSE file in the root directory of this source tree.
|
|
34597
35040
|
*)
|
|
34598
35041
|
*/
|
|
34599
|
-
//# sourceMappingURL=custom-element-
|
|
35042
|
+
//# sourceMappingURL=custom-element-RBBL46TI.js.map
|